public static TemplateMesh Quad(TemplateVertex bottomLeft, TemplateVertex topLeft, TemplateVertex bottomRight, TemplateVertex topRight) { var r = TemplateMesh.EmptyMesh(); r.QuadPart(bottomLeft, topLeft, bottomRight, topRight); return(r); }
private void GrowVerticies(int by) { VertexCount += by; if (Verticies.Length < VertexCount) { var newVerts = new TemplateVertex[(int)Math.Ceiling(VertexCount * 1.5)]; Verticies.CopyTo(newVerts, 0); Verticies = newVerts; } }
public void QuadPart(TemplateVertex bottomLeft, TemplateVertex topLeft, TemplateVertex bottomRight, TemplateVertex topRight) { var baseIndex = VertexCount; GrowVerticies(4); Verticies[baseIndex + 0] = topLeft.WithTextCoordinate(new Vector2(0.0f, 0.0f)); Verticies[baseIndex + 1] = topRight.WithTextCoordinate(new Vector2(1.0f, 0.0f)); Verticies[baseIndex + 2] = bottomRight.WithTextCoordinate(new Vector2(1.0f, 1.0f)); Verticies[baseIndex + 3] = bottomLeft.WithTextCoordinate(new Vector2(0.0f, 1.0f)); }