Package limn.render3d

Interface GpuMesh


public interface GpuMesh
An opaque handle to mesh geometry uploaded to the GPU (via Graphics3D.upload). Owned by the GL context it was created in; call dispose() to release it (or let the context reclaim it on teardown).
  • Method Summary

    Modifier and Type
    Method
    Description
    Object-space bounds, used by picking's broadphase.
    void
     
    default void
    Rewrites this mesh's contents, for geometry that changes every frame.
  • Method Details

    • bounds

      Aabb bounds()
      Object-space bounds, used by picking's broadphase.
    • update

      default void update(MeshData mesh)
      Rewrites this mesh's contents, for geometry that changes every frame. Only a mesh uploaded with MeshUsage.DYNAMIC accepts it; a static one throws, because its buffers were allocated for a single write.

      The replacement must present the same attributes as the original upload (the vertex layout is baked into the mesh's GPU state) but may hold any number of live vertices and indices (see MeshData.counts(int, int)), growing past the original capacity if it has to. bounds() is recomputed from the new data, so picking and shadow fitting stay correct.

      Default: rejected. Existing implementations and hand-rolled test doubles do not have to know about dynamic geometry.

      Throws:
      UnsupportedOperationException - if this mesh is not MeshUsage.DYNAMIC
      IllegalArgumentException - if the attribute set differs from the upload's
    • dispose

      void dispose()