Class MeshRecorder

java.lang.Object
lol.trq.helios.mesh.MeshRecorder

public final class MeshRecorder extends Object
Records vertices of one format through the matching sink, to upload once as a StaticMesh. Recording touches no GL state and can run on any thread; build(MeshRenderer) must run on the render thread.
MeshRecorder rec = new MeshRecorder(MeshFormat.TEXTURED);
rec.textured().vertex(...)...;
StaticMesh mesh = rec.build(helios.meshes());
helios.meshes().texture(tex).draw(mesh, model);
  • Constructor Details

    • MeshRecorder

      public MeshRecorder(MeshFormat format)
      Creates an empty recorder.
      Parameters:
      format - the vertex format; only the matching sink accepts vertices
  • Method Details

    • quads

      public QuadSink quads()
      Returns the sink for a MeshFormat.COLOR recorder.
      Returns:
      the sink
      Throws:
      IllegalStateException - if the recorder has another format
    • lines

      public LineSink lines()
      Returns the sink for a MeshFormat.LINE recorder.
      Returns:
      the sink
      Throws:
      IllegalStateException - if the recorder has another format
    • textured

      public TexturedSink textured()
      Returns the sink for a MeshFormat.TEXTURED recorder.
      Returns:
      the sink
      Throws:
      IllegalStateException - if the recorder has another format
    • quadCount

      public int quadCount()
      Returns the number of complete quads recorded; a line counts as one.
      Returns:
      the quad count
    • build

      public StaticMesh build(MeshRenderer renderer)
      Uploads the complete quads recorded so far. The recorder can keep recording or be discarded.
      Parameters:
      renderer - the renderer the mesh will be drawn with
      Returns:
      the mesh