Example #1
0
        public void AddQuad(ref Vertex2D a, ref Vertex2D b, ref Vertex2D c, ref Vertex2D d)
        {
            while (indexCount + 6 > indices.Length)
            {
                Array.Resize(ref indices, indexCount * 2);
            }
            int i = vertexCount;

            indices[indexCount++] = i;
            indices[indexCount++] = i + 1;
            indices[indexCount++] = i + 2;
            indices[indexCount++] = i;
            indices[indexCount++] = i + 2;
            indices[indexCount++] = i + 3;

            //AddVertices(ref a, ref b, ref c, ref d);
            while (vertexCount + 4 > vertices.Length)
            {
                Array.Resize(ref vertices, vertexCount * 2);
            }
            a.CopyTo(out vertices[vertexCount++]);
            b.CopyTo(out vertices[vertexCount++]);
            c.CopyTo(out vertices[vertexCount++]);
            d.CopyTo(out vertices[vertexCount++]);
        }
Example #2
0
 public void AddVertex(ref Vertex2D vert)
 {
     if (vertexCount == vertices.Length)
     {
         Array.Resize(ref vertices, vertexCount * 2);
     }
     vert.CopyTo(out vertices[vertexCount++]);
 }
Example #3
0
 public void AddVertices(ref Vertex2D a, ref Vertex2D b)
 {
     while (vertexCount + 2 > vertices.Length)
     {
         Array.Resize(ref vertices, vertexCount * 2);
     }
     a.CopyTo(out vertices[vertexCount++]);
     b.CopyTo(out vertices[vertexCount++]);
 }
Example #4
0
        public void AddTriangle(ref Vertex2D a, ref Vertex2D b, ref Vertex2D c)
        {
            while (indexCount + 3 > indices.Length)
            {
                Array.Resize(ref indices, indexCount * 2);
            }
            int i = vertexCount;

            indices[indexCount++] = i;
            indices[indexCount++] = i + 1;
            indices[indexCount++] = i + 2;

            AddVertices(ref a, ref b, ref c);
        }
Example #5
0
 public void SetVertex(int i, ref Vertex2D vert)
 {
     vert.CopyTo(out vertices[i]);
 }
Example #6
0
 public void GetVertex(int i, out Vertex2D result)
 {
     vertices[i].CopyTo(out result);
 }
Example #7
0
 public void AddQuad(Vertex2D a, Vertex2D b, Vertex2D c, Vertex2D d)
 {
     AddQuad(ref a, ref b, ref c, ref d);
 }
Example #8
0
 public void AddTriangle(Vertex2D a, Vertex2D b, Vertex2D c)
 {
     AddTriangle(ref a, ref b, ref c);
 }
Example #9
0
 public void AddVertex(Vertex2D vert)
 {
     AddVertex(ref vert);
 }