Exemplo n.º 1
0
        private void Grow()
        {
            MaxTriangles *= 2;
            var newVerts = new ThickLineVertex[MaxTriangles * 3];

            Verticies.CopyTo(newVerts, 0);
            VertexScratch = new ThickLineVertex[MaxTriangles * 3];
            Verticies     = newVerts;
            if (Buffer != null)
            {
                Buffer.Dispose();
            }

            Buffer = new DynamicVertexBuffer(Device, ThickLineVertex.VertexDeclaration, MaxTriangles * 3, BufferUsage.None);
            Buffer.SetData(Verticies);
        }
Exemplo n.º 2
0
        public static int WriteTriangle(Vector4 A, Vector4 B, Vector4 C, Vector3 direction, Color Color, int start, ThickLineVertex[] buffer)
        {
            buffer[start] = new ThickLineVertex
            {
                Position  = A,
                Color     = Color,
                Direction = direction
            };

            buffer[start + 1] = new ThickLineVertex
            {
                Position  = B,
                Color     = Color,
                Direction = direction
            };

            buffer[start + 2] = new ThickLineVertex
            {
                Position  = C,
                Color     = Color,
                Direction = direction
            };
            return(start + 3);
        }