Example #1
0
        private Polygon GetPolygon(bool counterClockwise = true)
        {
            IEnumerable <Vertex> vertices = new Vertex[5]
            {
                Vertex.ByCoordinates(0, 0),
                Vertex.ByCoordinates(10, 0),
                Vertex.ByCoordinates(10, 10),
                Vertex.ByCoordinates(5, 15),
                Vertex.ByCoordinates(0, 10)
            };

            if (!counterClockwise)
            {
                vertices = vertices.Reverse();
            }

            return(Polygon.ByVertices(vertices.ToList()));
        }
Example #2
0
 public void AddVertex(Vertex InVertex)
 {
     VertexPositions.AddElement(InVertex.ToList());
 }
Example #3
0
        public static Model CreatePlane(Vector2 Scale)
        {
            Vertex[] vertices = new Vertex[] {
                new Vertex(new Vector3(-0.5f * Scale.X, 0.5f * Scale.Y,  0f), new Vector2(0, 0)),
                new Vertex(new Vector3(0.5f * Scale.X, 0.5f * Scale.Y,  0f), new Vector2(1, 0)),
                new Vertex(new Vector3(0.5f * Scale.X, -0.5f * Scale.Y,  0f), new Vector2(1, 1)),
                new Vertex(new Vector3(-0.5f * Scale.X, -0.5f * Scale.Y,  0f), new Vector2(0, 1))
            };

            /*int[] indices = new int[] {
                0, 2, 1,
                0, 3, 2,
            };*/
            Mesh mesh = new Mesh();
            mesh.Vertices = vertices.ToList();
            mesh.Indices.AddRange(new[] { 0, 2, 1 });
            mesh.Indices.AddRange(new[] { 0, 3, 2 });
            Model model = new Model(mesh);
            /*model.AddTriangle(0, 2, 1);
            model.AddTriangle(0, 3, 2);*/
            return model;
        }