当前位置: 首页>>代码示例>>C#>>正文


C# SlimDX.Color4类代码示例

本文整理汇总了C#中SlimDX.Color4的典型用法代码示例。如果您正苦于以下问题:C# Color4类的具体用法?C# Color4怎么用?C# Color4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Color4类属于SlimDX命名空间,在下文中一共展示了Color4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawLine

 public static void DrawLine(Location from, Location to, Color4 color)
 {
     var vertices = new PositionColored[2];
     vertices[0] = new PositionColored(from.ToVector3(), color.ToArgb());
     vertices[1] = new PositionColored(to.ToVector3(), color.ToArgb());
     Device.DrawUserPrimitives(PrimitiveType.LineList, 1, vertices);
 }
开发者ID:aash,项目名称:cleanCore,代码行数:7,代码来源:Rendering.cs

示例2: Text

 public Text(int x, int y, string text, Color4 color)
 {
     X = x;
     Y = y;
     String = text;
     Color = color;
 }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:7,代码来源:Text.cs

示例3: SkyBox

        public SkyBox(SourceMap map, string texturename, Entity light_environment)
        {
            Init(texturename);
            Color4 skyColor = new Color4(2f, 255f, 255f, 255f);

            if (light_environment != null)
            {
                // This makes the skybox blend in better with the rest of the world
                string lightval = light_environment.Values["_light"];
                string[] vals = lightval.Split(' ');
                if (vals.Length == 4)
                {
                    // Try to get sun light color
                    float r, g, b;
                    r = int.Parse(vals[0]);
                    g = int.Parse(vals[1]);
                    b = int.Parse(vals[2]);
                    float brightness = int.Parse(vals[3]);
                    skyColor = new Color4(brightness, r, g, b);
                }
            }

            // Create a tiny lightmap, and take white+ maxExponent from the map as a color
            // Grab brightness of environment light and convert to exponent offset
            tex2 = TextureManager.CreateTexture(1,1,Format.A16B16G16R16F, skyColor);
            SharedTexture2 = true;
        }
开发者ID:maesse,项目名称:CubeHags,代码行数:27,代码来源:SkyBox.cs

示例4: ClearRenderTarget

 public override void ClearRenderTarget(DeviceContext context, Color4 color)
 {
     foreach (RenderTargetView view in renderTargetView)
     {
         context.ClearRenderTargetView(view, color);
     }
 }
开发者ID:nickudell,项目名称:PigmentFramework,代码行数:7,代码来源:MultiRenderTexture.cs

示例5: Clear

 public void Clear(Color4 clearcolor)
 {
     foreach (IDX11RenderTargetView view in this.rtvs)
     {
         this.context.CurrentDeviceContext.ClearRenderTargetView(view.RTV, clearcolor);
     }
 }
开发者ID:hameleon-ed,项目名称:dx11-vvvv,代码行数:7,代码来源:DX11GraphicsRenderer.cs

示例6: Evaluate

        public void Evaluate(int SpreadMax)
        {
            if (this.FInAddressU.IsChanged
                || this.FInAddressV.IsChanged
                || this.FInAddressW.IsChanged
                || this.FInBorderColor.IsChanged
                || this.FInComparison.IsChanged
                || this.FInFilterMode.IsChanged
                || this.FInMaximumAnisotropy.IsChanged
                || this.FInMaximumLod.IsChanged
                || this.FInMinimumLod.IsChanged
                || this.FInMipLodBias.IsChanged)
            {
                this.FOutSampler.SliceCount = 1;
                RGBAColor c = this.FInBorderColor[0];
                Color4 col = new Color4((float)c.R, (float)c.G, (float)c.B, (float)c.A);
                SamplerDescription sampler = new SamplerDescription()
                {
                    AddressU = this.FInAddressU[0],
                    AddressV = this.FInAddressV[0],
                    AddressW = this.FInAddressW[0],
                    BorderColor = col,
                    ComparisonFunction = this.FInComparison[0],
                    Filter = this.FInFilterMode[0],
                    MaximumAnisotropy = this.FInMaximumAnisotropy[0],
                    MaximumLod = this.FInMaximumLod[0],
                    MinimumLod = this.FInMinimumLod[0],
                    MipLodBias = this.FInMipLodBias[0]
                };
                this.FOutSampler.SliceCount = SpreadMax;

                this.FOutSampler[0] = sampler;

            }
        }
开发者ID:koldo4,项目名称:dx11-vvvv,代码行数:35,代码来源:DX11SamplerStateNode.cs

示例7: DrawFullRectangle

        public static ShapeDescription DrawFullRectangle(Vector3 position, Size size, IGradientShader linearShader, Color4 fillColor, Thickness borderSize, BorderStyle borderStyle, Color4 borderColor)
        {
            Color4[] shadedColors = linearShader.Method(linearShader, 4,Shape.Rectangle);
            Color4[] borderColors;

            switch (borderStyle)
            {
                case BorderStyle.None:
                    borderColors = LinearShader.FillColorArray(new Color4(0), 4);
                    break;
                case BorderStyle.Flat:
                    borderColors = LinearShader.FillColorArray(borderColor, 4);
                    break;
                case BorderStyle.Raised:
                    borderColors = LinearShader.BorderRaised(borderColor, 4);
                    break;
                case BorderStyle.Sunken:
                    borderColors = LinearShader.BorderSunken(borderColor, 4);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("borderStyle");
            }
            ShapeDescription inside = DrawRectangle(position, size, shadedColors);
            ShapeDescription outline = DrawRectangularOutline(position, size, borderSize.All, borderColors, borderStyle, Borders.All);

            ShapeDescription result = ShapeDescription.Join(inside, outline);
            result.Shape = Shape.RectangleWithOutline;
            return result;
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:29,代码来源:ShapeCreator.Rectangle.cs

示例8: RenderRectangle

 /**
  * Draws a rectangle
  */
 internal void RenderRectangle(int x, int y, int width, int height, Color4 color)
 {
     RenderLine(x, y, color, x + width, y, color);
     RenderLine(x + width, y, color, x + width, y + height, color);
     RenderLine(x + width, y + height, color, x, y + height, color);
     RenderLine(x, y + height, color, x, y, color);
 }
开发者ID:sea-reel,项目名称:DirectX-2D-Mini-Engine,代码行数:10,代码来源:UIRenderer.cs

示例9: DrawBox

        public override void DrawBox(ref Vector3 bbMin, ref Vector3 bbMax, Color4 color)
        {
            var p1 = bbMin;
            var p2 = new Vector3(bbMax.X, bbMin.Y, bbMin.Z);
            var p3 = new Vector3(bbMax.X, bbMax.Y, bbMin.Z);
            var p4 = new Vector3(bbMin.X, bbMax.Y, bbMin.Z);
            var p5 = new Vector3(bbMin.X, bbMin.Y, bbMax.Z);
            var p6 = new Vector3(bbMax.X, bbMin.Y, bbMax.Z);
            var p7 = bbMax;
            var p8 = new Vector3(bbMin.X, bbMax.Y, bbMax.Z);

            int intColor = color.ToArgb();
            PositionColored[] vertices = new PositionColored[] {
                new PositionColored(p1, intColor), new PositionColored(p2, intColor),
                new PositionColored(p2, intColor), new PositionColored(p3, intColor),
                new PositionColored(p3, intColor), new PositionColored(p4, intColor),
                new PositionColored(p4, intColor), new PositionColored(p1, intColor),
                
                new PositionColored(p1, intColor), new PositionColored(p5, intColor),
                new PositionColored(p2, intColor), new PositionColored(p6, intColor),
                new PositionColored(p3, intColor), new PositionColored(p7, intColor),
                new PositionColored(p4, intColor), new PositionColored(p8, intColor),
                
                new PositionColored(p5, intColor), new PositionColored(p6, intColor),
                new PositionColored(p6, intColor), new PositionColored(p7, intColor),
                new PositionColored(p7, intColor), new PositionColored(p8, intColor),
                new PositionColored(p8, intColor), new PositionColored(p5, intColor),
            };

            device.DrawUserPrimitives(PrimitiveType.LineList, 12, vertices);
        }
开发者ID:raiker,项目名称:BulletSharp,代码行数:31,代码来源:PhysicsDebugDraw.cs

示例10: DrawLine

 public override void DrawLine(ref Vector3 from, ref Vector3 to, Color4 fromColor, Color4 toColor)
 {
     PositionColored[] vertices = new PositionColored[2];
     vertices[0] = new PositionColored(from, fromColor.ToArgb());
     vertices[1] = new PositionColored(to, toColor.ToArgb());
     device.DrawUserPrimitives(PrimitiveType.LineList, 1, vertices);
 }
开发者ID:raiker,项目名称:BulletSharp,代码行数:7,代码来源:PhysicsDebugDraw.cs

示例11: ClearTarget

 internal void ClearTarget()
 {
     DayWatch watch = DayWatch.Now;
     BackgroundColor = Color4.Lerp(new Color4(0.8f, 0.8f, 1f), new Color4(0f, 0f, 0f), 1f - watch.SunHeight);
     device.ImmediateContext.ClearRenderTargetView(renderView, BackgroundColor);
     device.ImmediateContext.ClearDepthStencilView(depthView, DepthStencilClearFlags.Depth, 1.0f, 0);
 }
开发者ID:samuto,项目名称:HelloWorld,代码行数:7,代码来源:GlobalRenderer.cs

示例12: VertexPositonNormalColorTexture

 public VertexPositonNormalColorTexture(Vector3 Position, Vector3 normal, Color4 Color, Vector2 texcoords)
 {
     this.Position = Position;
     this.Color = Color.ToArgb();
     this.texcoords = texcoords;
     this.Normal = normal;
 }
开发者ID:maesse,项目名称:CubeHags,代码行数:7,代码来源:VertexPositonNormalColorTexture.cs

示例13: RadialManual

        public static Color4[] RadialManual(GradientStop[] gradient, int numVertex, int offsetIndex)
        {
            Color4[] colors = new Color4[numVertex];
            for (int i = 0; i < numVertex; i++)
                colors[i] = gradient[offsetIndex].Color;

            return colors;
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:8,代码来源:RadialShader.cs

示例14: DrawContactPoint

 public override void DrawContactPoint(ref Vector3 pointOnB, ref Vector3 normalOnB, float distance, int lifeTime, Color4 color)
 {
     int intColor = color.ToArgb();
     PositionColored[] vertices = new PositionColored[2];
     vertices[0] = new PositionColored(pointOnB, intColor);
     vertices[1] = new PositionColored(pointOnB + normalOnB, intColor);
     device.DrawUserPrimitives(PrimitiveType.LineList, 1, vertices);
 }
开发者ID:raiker,项目名称:BulletSharp,代码行数:8,代码来源:PhysicsDebugDraw.cs

示例15: CreateBox

        public static VertexPositionColor[] CreateBox(Vector3 mins, Vector3 maxs, Color4 color)
        {
            VertexPositionColor[] verts = new VertexPositionColor[36];

            // Front face
            verts[0] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, maxs.Z), color);
            verts[1] = new VertexPositionColor(new Vector3(mins.X, mins.Y, maxs.Z), color);
            verts[2] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, maxs.Z), color);
            verts[3] = new VertexPositionColor(new Vector3(mins.X, mins.Y, maxs.Z), color);
            verts[4] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, maxs.Z), color);
            verts[5] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, maxs.Z), color);

            // Back face (remember this is facing *away* from the camera, so vertices should be
            //    clockwise order)
            verts[6] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, mins.Z), color);
            verts[7] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, mins.Z), color);
            verts[8] = new VertexPositionColor(new Vector3(mins.X, mins.Y, mins.Z), color);
            verts[9] = new VertexPositionColor(new Vector3(mins.X, mins.Y, mins.Z), color);
            verts[10] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, mins.Z), color);
            verts[11] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, mins.Z), color);

            // Top face
            verts[12] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, maxs.Z), color);
            verts[13] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, mins.Z), color);
            verts[14] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, mins.Z), color);
            verts[15] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, maxs.Z), color);
            verts[16] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, maxs.Z), color);
            verts[17] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, mins.Z), color);

            // Bottom face (remember this is facing *away* from the camera, so vertices should be
            //    clockwise order)
            verts[18] = new VertexPositionColor(new Vector3(mins.X, mins.Y, maxs.Z), color);
            verts[19] = new VertexPositionColor(new Vector3(mins.X, mins.Y, mins.Z), color);
            verts[20] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, mins.Z), color);
            verts[21] = new VertexPositionColor(new Vector3(mins.X, mins.Y, maxs.Z), color);
            verts[22] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, mins.Z), color);
            verts[23] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, maxs.Z), color);

            // Left face
            verts[24] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, maxs.Z), color);
            verts[25] = new VertexPositionColor(new Vector3(mins.X, mins.Y, mins.Z), color);
            verts[26] = new VertexPositionColor(new Vector3(mins.X, mins.Y, maxs.Z), color);

            verts[27] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, mins.Z), color);
            verts[28] = new VertexPositionColor(new Vector3(mins.X, mins.Y, mins.Z), color);
            verts[29] = new VertexPositionColor(new Vector3(mins.X, maxs.Y, maxs.Z), color);

            // Right face (remember this is facing *away* from the camera, so vertices should be
            //    clockwise order)
            verts[30] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, maxs.Z), color);
            verts[31] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, maxs.Z), color);
            verts[32] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, mins.Z), color);
            verts[33] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, mins.Z), color);
            verts[34] = new VertexPositionColor(new Vector3(maxs.X, maxs.Y, maxs.Z), color);
            verts[35] = new VertexPositionColor(new Vector3(maxs.X, mins.Y, mins.Z), color);

            return verts;
        }
开发者ID:maesse,项目名称:CubeHags,代码行数:58,代码来源:MiscRender.cs


注:本文中的SlimDX.Color4类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。