Mesh Builder Local
Mesh Builder Local is a helper utility that makes building and working with the mesh data for the most common vertex format simpler. You can customize the exact data types and it will internally switch between the necessary conversion types just like TRealtimeMeshStreamBuilder.
Creating a basic mesh builder local
// First we create the empty stream set
FRealtimeMeshStreamSet StreamSet;
// Then we can bind the Mesh Builder Local to it.
// We can configure the stream data types through the template parameters
// We can also supply void to get dynamic conversion for unknown stream layouts.
TRealtimeMeshBuilderLocal<uint16, FPackedNormal, FVector2DHalf, 1> Builder(StreamSet);
// We can decide what vertex elements are enabled.
Builder.EnableTangents();
Builder.EnableTexCoords();
Builder.EnableColors();
Builder.EnablePolyGroups();
// We can add a vertex, and optionally set things like the tangents, color, texcoords.
// We can then get the new index from it to use later.
int32 V0 = Builder.AddVertex(FVector3f(-50.0f, 0.0f, 0.0f))
.SetNormalAndTangent(FVector3f(0.0f, -1.0f, 1.0f), FVector3f(1.0f, 0.0f, 0.0f))
.SetColor(FColor::Red)
.SetTexCoord(FVector2f(0.0f, 0.0f));
// Now we can add a triangle giving it the indices of the vertices for the 3 corners, as well as optionally supplying the polygroup
Builder.AddTriangle(V0, V1, V2, 0);