Class PolygonBuilder

PolygonBuilder class

A helper class to build polygon for Mesh

public sealed class PolygonBuilder

Constructors

NameDescription
PolygonBuilder(Mesh)Initializes a new instance of the PolygonBuilder class.

Methods

NameDescription
AddVertex(int)Adds a vertex index to the polygon
Begin()Begins to add a new polygon
End()Finishes the polygon creation

Examples

Mesh mesh = new Mesh();
PolygonBuilder builder = new PolygonBuilder(mesh);
builder.Begin();
builder.AddVertex(0);
builder.AddVertex(1);
builder.AddVertex(2);
builder.End();

Equals to :

Mesh mesh = new Mesh();
int[] indices = new int[] {0, 1, 2};
mesh.CreatePolygon(indices);

If all indices are ready to use, CreatePolygon is preferred, otherwise PolygonBuilder would be a better choice.

See Also