Ejemplo n.º 1
0
 private void AddTriangle(Vector2 a, Vector2 b, Vector2 c)
 {
     Triangle triangle = new Triangle(a.X, a.Y, (float)CurrentZ, b.X, b.Y, (float)CurrentZ, c.X, c.Y, (float)CurrentZ, ColorOut.Color.ToArgb())
                             {
                                 BasePoint =
                                     new Vector2(SmoothLineParticles[SmoothLineParticles.Count - 1].x,
                                                 SmoothLineParticles[SmoothLineParticles.Count - 1].y)
                             };
     AddMesh(triangle);
     TriangleList.Add(triangle);
 }
Ejemplo n.º 2
0
        //Adding triangle to mesh
        private void AddMesh(Triangle triangle)
        {
            for (int i = 0; i < 3; i++)
            {
                Vertex vertex = new Vertex
                                    {
                                        pv = new Vector3(triangle.Vertices[i].X, triangle.Vertices[i].Y, triangle.Vertices[i].Z),
                                        nv = new Vector3(0.0f, 0.0f, 1.0f),
                                        tu1 = 0.5f - triangle.Vertices[i].X,
                                        tv1 = 0.5f - triangle.Vertices[i].Y
                                    };

                Vertices.Add(vertex);
            }

            Indexes.Add(Convert.ToInt16((Vertices.Count - 3)));
            Indexes.Add(Convert.ToInt16((Vertices.Count - 2)));
            Indexes.Add(Convert.ToInt16((Vertices.Count - 1)));
        }