TextureFromVertices() публичный Метод

public TextureFromVertices ( Vertices vertices, MaterialType type, Color color, float materialScale ) : Microsoft.Xna.Framework.Graphics.Texture2D
vertices Vertices
type MaterialType
color Color
materialScale float
Результат Microsoft.Xna.Framework.Graphics.Texture2D
Пример #1
0
        private void CreateLegTextures(AssetCreator assets)
        {
            Vector2 p1 = new Vector2(-5.4f, 6.1f);
            Vector2 p2 = new Vector2(-7.2f, 1.2f);
            Vector2 p3 = new Vector2(-4.3f, 1.9f);
            Vector2 p4 = new Vector2(-2.9f, -0.7f);
            Vector2 p5 = new Vector2(0.6f, -2.9f);

            Vertices vertices = new Vertices(3);

            vertices.Add(p1);
            vertices.Add(p2);
            vertices.Add(p3);
            _leftLeg = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.IndianRed * 0.8f, 1f));

            vertices[0] = Vector2.Zero;
            vertices[1] = p4;
            vertices[2] = p5;
            _leftShoulder = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.Beige * 0.8f, 1f));

            p1.X *= -1f;
            p2.X *= -1f;
            p3.X *= -1f;
            p4.X *= -1f;
            p5.X *= -1f;

            vertices[0] = p1;
            vertices[1] = p3;
            vertices[2] = p2;
            _rightLeg = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.IndianRed * 0.8f, 1f));

            vertices[0] = Vector2.Zero;
            vertices[1] = p5;
            vertices[2] = p4;
            _rightShoulder = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.Beige * 0.8f, 1f));
        }
Пример #2
0
        private void CreateGFX(AssetCreator assets)
        {
            _face = new Sprite(assets.CircleTexture(0.9f, MaterialType.Squares, Color.Gray, 1f));
            _torso = new Sprite(assets.TextureFromVertices(PolygonTools.CreateRoundedRectangle(2f, 4f, 0.5f, 0.7f, 2), MaterialType.Squares, Color.LightSlateGray, 0.8f));

            _upperArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DimGray, 0.8f));
            _lowerArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f));

            _upperLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DimGray, 0.8f));
            _lowerLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f));
        }