Interface MutableMesh

All Superinterfaces:
Mesh

public interface MutableMesh extends Mesh
A bundle of MutableQuadView instances encoded by the renderer that can have more quads added to it. Typically used to build optimized, immutable Meshes via emitter(), immutableCopy(), and clear(). Encoded quads can also be inspected, modified, and outputted 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 should not be used concurrently. Inherited methods from Mesh are still thread-safe when used in isolation.

Only the renderer should implement or extend this interface.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Resets this mesh to an empty state with zero quads, effectively clearing all existing quads.
    Returns the QuadEmitter used to append quads to this mesh.
    void
    Use to access all the quads encoded in this mesh and modify them as necessary.
    Returns a new, optimized, immutable Mesh instance containing all quads currently encoded in this mesh.

    Methods inherited from interface net.fabricmc.fabric.api.renderer.v1.mesh.Mesh

    forEach, outputTo, size
  • Method Details

    • emitter

      QuadEmitter emitter()
      Returns the QuadEmitter 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

      void forEachMutable(Consumer<? super MutableQuadView> action)
      Use to 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.
    • immutableCopy

      Mesh immutableCopy()
      Returns a new, optimized, immutable Mesh instance containing all quads currently encoded in this mesh. This operation does not change the state of this mesh; if you need to build another immutable mesh, call clear() 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.