Skip to content
PRODUCT GITHUB  ↗

Stream Set

A stream set (FRealtimeMeshStreamSet) is a container holding one or more streams. Internally it’s a map from stream key (a name plus a buffer type — Vertex or Index) to the stream. This is the most common way to pass mesh data around, and it can store arbitrarily complex sets of data. When you hand mesh data to a URealtimeMeshSimple you hand it a stream set.


using namespace RealtimeMesh;
// First we create the empty stream set.
FRealtimeMeshStreamSet StreamSet;
// Then we add whatever streams we want. You can pass an explicit buffer layout...
FRealtimeMeshStream& PositionStream =
StreamSet.AddStream(FRealtimeMeshStreams::Position, GetRealtimeMeshBufferLayout<FVector3f>());
// ...or supply the type as a template argument, which derives the layout for you.
FRealtimeMeshStream& TangentsStream =
StreamSet.AddStream<FRealtimeMeshTangentsNormalPrecision>(FRealtimeMeshStreams::Tangents);
// Look streams back up by key. Find returns a pointer (null if absent);
// FindChecked returns a reference and asserts if the stream isn't present.
if (StreamSet.Contains(FRealtimeMeshStreams::Position))
{
TRealtimeMeshStreamBuilder<FVector3f> PositionBuilder(StreamSet.FindChecked(FRealtimeMeshStreams::Position));
// ...fill the stream through the builder...
}

To keep several of the streams the same size, create a stream linkage over the streams you added and bind them. In earlier versions the stream set itself owned “link pools”; linkage state now lives on standalone FRealtimeMeshStreamLinkage instances owned by you (or, most commonly, by the local mesh builder), not on the stream set.


Stream sets don’t allow implicit copy through assignment. Copying duplicates every stream’s data, which can be expensive, so it has to be explicit. Use the explicit copy constructor (or CopyFrom) when you really do want a copy:

// Explicit copy constructor — implicit copy and copy-assignment are deliberately disabled.
FRealtimeMeshStreamSet StreamSet2(StreamSet);

Moving a stream set is far cheaper: it transfers ownership of the internal data instead of duplicating it, resetting the source in the process.

// Move assignment is fast because it moves ownership rather than duplicating the data.
FRealtimeMeshStreamSet StreamSet3 = MoveTemp(StreamSet);

Because most APIs that consume a stream set — like CreateBufferSet — copy or take ownership of it, you’ll frequently MoveTemp a stream set into them once you’ve finished building it.