Interface MutableMesh
- All Superinterfaces:
MeshView
A bundle of mutable quads encoded by the renderer that can have more quads added to it.
Typically used to build optimized, thread-safe, immutable
Mesh
es via emitter()
,
immutableCopy()
, and clear()
. Encoded quads can also be inspected, modified, and output directly to
allow for advanced use cases where creating an immutable Mesh
is not desirable.
All declared methods in this interface are not thread-safe and must not be used concurrently.
Only the renderer should implement or extend this interface.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Resets this mesh to an empty state with zero quads, effectively clearing all existing quads.emitter()
Returns theQuadEmitter
used to append quads to this mesh.void
forEachMutable
(Consumer<? super MutableQuadView> action) Access all the quads encoded in this mesh and modify them as necessary.Returns a new, optimized, thread-safe, immutableMesh
containing all quads currently encoded inthis
mesh.
-
Method Details
-
emitter
QuadEmitter emitter()Returns theQuadEmitter
used to append quads to this mesh. Calling this method a second time invalidates any prior result. Do not retain references outside the context of this mesh. -
forEachMutable
Access all the quads encoded in this mesh and modify them as necessary. The quad instance sent to the consumer should never be retained outside the current call to the consumer.Nesting calls to this method on the same mesh is not allowed.
-
immutableCopy
Mesh immutableCopy()Returns a new, optimized, thread-safe, immutableMesh
containing all quads currently encoded inthis
mesh. This operation does not change the state ofthis
mesh; if you need to build another immutable mesh from scratch, callclear()
first.If quad data has been added to the
emitter()
but has not yet been emitted, calling this method will not affect it. -
clear
void clear()Resets this mesh to an empty state with zero quads, effectively clearing all existing quads.
-