當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。