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


C# Color4.ToArgb方法代码示例

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


在下文中一共展示了Color4.ToArgb方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: toDX9

 /// <summary>
 /// Convert an Assimp aiColour4D into an integer.
 /// </summary>
 /// <param name="vValue">The assimp value.</param>
 /// <returns>The equivilant DX value.</returns>
 public static int toDX9(aiColor4D vValue)
 {
     Color4 pColour = new Color4(vValue.a, vValue.r, vValue.g, vValue.b);
     return pColour.ToArgb();
 }
开发者ID:dkushner,项目名称:managed-assimp,代码行数:10,代码来源:SimpleModel.cs

示例7: FillVertexBuffer

        private void FillVertexBuffer(Mesh animationMesh, List<odfVertex> vertexList, float[][] vertexWeights, int selectedBoneIdx)
        {
            using (DataStream vertexStream = animationMesh.LockVertexBuffer(LockFlags.None))
            {
                Color4 col = new Color4(1f, 1f, 1f);
                for (int j = 0; j < vertexList.Count; j++)
                {
                    odfVertex vertex = vertexList[j];
            #if !DONT_MIRROR
                    Vector3 position = new Vector3(vertex.Position.X, vertex.Position.Y, -vertex.Position.Z);
                    Vector3 normal = new Vector3(vertex.Normal.X, vertex.Normal.Y, -vertex.Normal.Z);
            #else
                    Vector3 position = vertex.Position;
                    Vector3 normal = vertex.Normal;
            #endif
                    float[] boneWeights = vertexWeights[j];
                    vertexStream.Write(position.X);
                    vertexStream.Write(position.Y);
                    vertexStream.Write(position.Z);
                    vertexStream.Write(boneWeights[0]);
                    vertexStream.Write(boneWeights[1]);
                    vertexStream.Write(boneWeights[2]);
                    vertexStream.Write(vertex.BoneIndices[0]);
                    vertexStream.Write(vertex.BoneIndices[1]);
                    vertexStream.Write(vertex.BoneIndices[2]);
                    vertexStream.Write(vertex.BoneIndices[3]);
                    vertexStream.Write(normal.X);
                    vertexStream.Write(normal.Y);
                    vertexStream.Write(normal.Z);
                    if (selectedBoneIdx >= 0)
                    {
                        col.Red = 0f; col.Green = 0f; col.Blue = 0f;
                        byte[] boneIndices = vertex.BoneIndices;
                        for (int k = 0; k < boneIndices.Length; k++)
                        {
                            if (boneIndices[k] == 0xFF)
                            {
                                continue;
                            }

                            byte boneIdx = boneIndices[k];
                            if (boneIdx == selectedBoneIdx)
                            {
            /*								switch (cols)
                                {
                                case WeightsColourPreset.Greyscale:
                                    col.r = col.g = col.b = boneWeights[k];
                                    break;
                                case WeightsColourPreset.Metal:
                                    col.r = boneWeights[k] > 0.666f ? 1f : boneWeights[k] * 1.5f;
                                    col.g = boneWeights[k] * boneWeights[k] * boneWeights[k];
                                    break;
                                case WeightsColourPreset.Rainbow:*/
                                    if (boneWeights[k] > 0.75f)
                                    {
                                        col.Red = 1f;
                                        col.Green = (1f - boneWeights[k]) * 2f;
                                        col.Blue = 0f;
                                    }
                                    else if (boneWeights[k] > 0.5f)
                                    {
                                        col.Red = 1f;
                                        col.Green = (1f - boneWeights[k]) * 2f;
                                        col.Blue = 0f;
                                    }
                                    else if (boneWeights[k] > 0.25f)
                                    {
                                        col.Red = (boneWeights[k] - 0.25f) * 4f;
                                        col.Green = 1f;
                                        col.Blue = 0f;
                                    }
                                    else
                                    {
                                        col.Green = boneWeights[k] * 4f;
                                        col.Blue = 1f - boneWeights[k] * 4f;
                                    }
            /*									break;
                                }*/
                                break;
                            }
                        }
                    }
                    vertexStream.Write(col.ToArgb());
                    vertexStream.Write(vertex.UV[0]);
                    vertexStream.Write(vertex.UV[1]);
                }
                animationMesh.UnlockVertexBuffer();
            }
        }
开发者ID:hejob,项目名称:SB3Utility,代码行数:89,代码来源:RenderObjectODF.cs

示例8: RenderLine

        /// <summary>
        /// Renders a line.
        /// </summary>
        /// <param name="x0">The X coordinate of the first point.</param>
        /// <param name="y0">The Y coordinate of the first point.</param>
        /// <param name="color0">The color of the first point.</param>
        /// <param name="x1">The X coordinate of the second point.</param>
        /// <param name="y1">The Y coordinate of the second point.</param>
        /// <param name="color1">The color of the second point.</param>
        internal override void RenderLine(int x0, int y0, Color4 color0, int x1, int y1, Color4 color1) {
            lineBuffer.Add(new ColoredVertex(
                new Vector3(x0, y0, 0.0f),
                color0.ToArgb()
            ));

            lineBuffer.Add(new ColoredVertex(
                new Vector3(x1, y1, 0.0f),
                color1.ToArgb()
            ));
        }
开发者ID:zhandb,项目名称:slimdx,代码行数:20,代码来源:UserInterfaceRenderer9.cs

示例9: SetRenderState

 private void SetRenderState(RenderState state, Color4 val)
 {
     var oldVal = ActiveD3D9Device.GetRenderState<Color4>(state);
     if (oldVal != val)
         ActiveD3D9Device.SetRenderState(state, val.ToArgb());
 }
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:D3DRenderSystem.cs

示例10: VertexPositionColor

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

示例11: FillVertexBuffer

        private void FillVertexBuffer(SlimDX.Direct3D9.Mesh animationMesh, List<Operations.vVertex> vertexList, int selectedBoneIdx)
        {
            using (DataStream vertexStream = animationMesh.LockVertexBuffer(LockFlags.None))
            {
                Color4 col = new Color4(1f, 1f, 1f);
                for (int i = 0; i < vertexList.Count; i++)
                {
                    Operations.vVertex vertex = vertexList[i];
                    vertexStream.Write(vertex.position.X);
                    vertexStream.Write(vertex.position.Y);
                    vertexStream.Write(vertex.position.Z);
                    if (vertex.boneIndices != null)
                    {
                        vertexStream.Write(vertex.weights[0]);
                        vertexStream.Write(vertex.weights[1]);
                        vertexStream.Write(vertex.weights[2]);
                        vertexStream.Write((byte)vertex.boneIndices[0]);
                        vertexStream.Write((byte)vertex.boneIndices[1]);
                        vertexStream.Write((byte)vertex.boneIndices[2]);
                        vertexStream.Write((byte)vertex.boneIndices[3]);
                    }
                    else
                    {
                        vertexStream.Write((float)0);
                        vertexStream.Write((float)0);
                        vertexStream.Write((float)0);
                        vertexStream.Write((byte)0);
                        vertexStream.Write((byte)0);
                        vertexStream.Write((byte)0);
                        vertexStream.Write((byte)0);
                    }
                    vertexStream.Write(vertex.normal.X);
                    vertexStream.Write(vertex.normal.Y);
                    vertexStream.Write(vertex.normal.Z);
                    if (selectedBoneIdx >= 0)
                    {
                        col.Red = 0f; col.Green = 0f; col.Blue = 0f;
                        int[] boneIndices = vertex.boneIndices;
                        float[] boneWeights = vertex.weights;
                        for (int j = 0; j < boneIndices.Length; j++)
                        {
                            if (boneIndices[j] == 0 && boneWeights[j] == 0)
                            {
                                continue;
                            }

                            int boneIdx = boneIndices[j];
                            if (boneIdx == selectedBoneIdx)
                            {
            /*								switch (cols)
                                {
                                case WeightsColourPreset.Greyscale:
                                    col.r = col.g = col.b = boneWeights[j];
                                    break;
                                case WeightsColourPreset.Metal:
                                    col.r = boneWeights[j] > 0.666f ? 1f : boneWeights[j] * 1.5f;
                                    col.g = boneWeights[j] * boneWeights[j] * boneWeights[j];
                                    break;
                                WeightsColourPreset.Rainbow:*/
                                    if (boneWeights[j] > 0.75f)
                                    {
                                        col.Red = 1f;
                                        col.Green = (1f - boneWeights[j]) * 2f;
                                        col.Blue = 0f;
                                    }
                                    else if (boneWeights[j] > 0.5f)
                                    {
                                        col.Red = 1f;
                                        col.Green = (1f - boneWeights[j]) * 2f;
                                        col.Blue = 0f;
                                    }
                                    else if (boneWeights[j] > 0.25f)
                                    {
                                        col.Red = (boneWeights[j] - 0.25f) * 4f;
                                        col.Green = 1f;
                                        col.Blue = 0f;
                                    }
                                    else
                                    {
                                        col.Green = boneWeights[j] * 4f;
                                        col.Blue = 1f - boneWeights[j] * 4f;
                                    }
            /*									break;
                                }*/
                                break;
                            }
                        }
                    }
                    vertexStream.Write(col.ToArgb());
                    vertexStream.Write(vertex.uv[0]);
                    vertexStream.Write(vertex.uv[1]);
                }
                animationMesh.UnlockVertexBuffer();
            }
        }
开发者ID:hejob,项目名称:SB3Utility,代码行数:95,代码来源:RenderObjectUnity.cs

示例12: DrawTriangle

        public override void DrawTriangle(ref Vector3 v0, ref Vector3 v1, ref Vector3 v2, Color4 color, float __unnamed004)
        {
            int intColor = color.ToArgb();
            PositionColored[] vertices = new PositionColored[4];
            vertices[0].Position = v0;
            vertices[0].Color = intColor;
            vertices[1].Position = v1;
            vertices[1].Color = intColor;
            vertices[2].Position = v2;
            vertices[2].Color = intColor;
            vertices[3].Position = v0;
            vertices[3].Color = intColor;

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

示例13: FillVertexBuffer

        private void FillVertexBuffer(Mesh animationMesh, List<xxVertex> vertexList, int selectedBoneIdx)
        {
            using (DataStream vertexStream = animationMesh.LockVertexBuffer(LockFlags.None))
            {
                Color4 col = new Color4(1f, 1f, 1f);
                for (int i = 0; i < vertexList.Count; i++)
                {
                    xxVertex vertex = vertexList[i];
                    vertexStream.Write(vertex.Position.X);
                    vertexStream.Write(vertex.Position.Y);
                    vertexStream.Write(vertex.Position.Z);
                    vertexStream.Write(vertex.Weights3[0]);
                    vertexStream.Write(vertex.Weights3[1]);
                    vertexStream.Write(vertex.Weights3[2]);
                    vertexStream.Write(vertex.BoneIndices[0]);
                    vertexStream.Write(vertex.BoneIndices[1]);
                    vertexStream.Write(vertex.BoneIndices[2]);
                    vertexStream.Write(vertex.BoneIndices[3]);
                    vertexStream.Write(vertex.Normal.X);
                    vertexStream.Write(vertex.Normal.Y);
                    vertexStream.Write(vertex.Normal.Z);
                    if (selectedBoneIdx >= 0)
                    {
                        col.Red = 0f; col.Green = 0f; col.Blue = 0f;
                        byte[] boneIndices = vertex.BoneIndices;
                        float[] boneWeights = vertex.Weights4(true);
                        for (int j = 0; j < boneIndices.Length; j++)
                        {
                            if (boneIndices[j] == 0xFF)
                            {
                                continue;
                            }

                            byte boneIdx = boneIndices[j];
                            if (boneIdx == selectedBoneIdx)
                            {
            /*								switch (cols)
                                {
                                case WeightsColourPreset.Greyscale:
                                    col.r = col.g = col.b = boneWeights[j];
                                    break;
                                case WeightsColourPreset.Metal:
                                    col.r = boneWeights[j] > 0.666f ? 1f : boneWeights[j] * 1.5f;
                                    col.g = boneWeights[j] * boneWeights[j] * boneWeights[j];
                                    break;
                                WeightsColourPreset.Rainbow:*/
                                    if (boneWeights[j] > 0.75f)
                                    {
                                        col.Red = 1f;
                                        col.Green = (1f - boneWeights[j]) * 2f;
                                        col.Blue = 0f;
                                    }
                                    else if (boneWeights[j] > 0.5f)
                                    {
                                        col.Red = 1f;
                                        col.Green = (1f - boneWeights[j]) * 2f;
                                        col.Blue = 0f;
                                    }
                                    else if (boneWeights[j] > 0.25f)
                                    {
                                        col.Red = (boneWeights[j] - 0.25f) * 4f;
                                        col.Green = 1f;
                                        col.Blue = 0f;
                                    }
                                    else
                                    {
                                        col.Green = boneWeights[j] * 4f;
                                        col.Blue = 1f - boneWeights[j] * 4f;
                                    }
            /*									break;
                                }*/
                                break;
                            }
                        }
                    }
                    vertexStream.Write(col.ToArgb());
                    vertexStream.Write(vertex.UV[0]);
                    vertexStream.Write(vertex.UV[1]);
                }
                animationMesh.UnlockVertexBuffer();
            }
        }
开发者ID:anhlehoang410,项目名称:SB3Utility,代码行数:82,代码来源:RenderObjectXX.cs

示例14: VertexPositionColorTex

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

示例15: CreateTexture

        // Create a systemmem texture, fill with the given color and copy it to a more hardware-friendly memory pool
        public static Texture CreateTexture(int w, int h, Format format, Color4 color)
        {
            Texture texture = new Texture(Renderer.Instance.device, w, h, 1, Usage.None, format, Pool.SystemMemory);
            DataRectangle drect = texture.LockRectangle(0, LockFlags.None);
            DataStream ds = drect.Data;

            // pixelsize in bytes
            int fieldsize = 8;
            switch (format)
            {
                case Format.A8R8G8B8:
                    fieldsize = 4;
                    break;
                case Format.A16B16G16R16F:
                    fieldsize = 8;
                    break;
            }

            // Fill texture with color
            for (int j = 0; j < (w * h); j++)
            {
                int x = ((j) % (w));
                int y = ((j) / (w));

                ds.Seek((long)(y * fieldsize) + (long)(x * fieldsize), System.IO.SeekOrigin.Begin);

                switch (format)
                {
                    case Format.A8R8G8B8:
                        ds.Write<int>(color.ToArgb());
                        break;
                    case Format.A16B16G16R16F:
                        Half[] half = Half.ConvertToHalf(new float[] { color.Red, color.Green, color.Blue, color.Alpha });
                        ds.Write<Half4>(new Half4(half[0], half[1], half[2], half[3]));
                        break;
                }

            }
            texture.UnlockRectangle(0);
            Texture realtexture = new Texture(Renderer.Instance.device, w, h, 1, Usage.None, format, Pool.Default);
            Renderer.Instance.device.UpdateTexture(texture, realtexture);
            texture.Dispose();
            return realtexture;
        }
开发者ID:maesse,项目名称:CubeHags,代码行数:45,代码来源:TextureManager.cs


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