Class MeshoptMeshlet

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<MeshoptMeshlet>
org.lwjgl.util.meshoptimizer.MeshoptMeshlet
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class MeshoptMeshlet extends org.lwjgl.system.Struct<MeshoptMeshlet> implements org.lwjgl.system.NativeResource
Meshlet is a small mesh cluster (subset) that consists of:
  • triangles, an 8-bit micro triangle (index) buffer, that for each triangle specifies three local vertices to use;
  • vertices, a 32-bit vertex indirection buffer, that for each local vertex specifies which mesh vertex to fetch vertex attributes from.

For efficiency, meshlet triangles and vertices are packed into two large arrays; this structure contains offsets and counts to access the data.

Layout


 struct meshopt_Meshlet {
     unsigned int vertex_offset();
     unsigned int triangle_offset();
     unsigned int vertex_count();
     unsigned int triangle_count();
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • VERTEX_OFFSET

      public static final int VERTEX_OFFSET
      The struct member offsets.
    • TRIANGLE_OFFSET

      public static final int TRIANGLE_OFFSET
      The struct member offsets.
    • VERTEX_COUNT

      public static final int VERTEX_COUNT
      The struct member offsets.
    • TRIANGLE_COUNT

      public static final int TRIANGLE_COUNT
      The struct member offsets.
  • Constructor Details

    • MeshoptMeshlet

      public MeshoptMeshlet(ByteBuffer container)
      Creates a MeshoptMeshlet instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<MeshoptMeshlet>
    • vertex_offset

      public int vertex_offset()
      offset within meshlet_vertices array with meshlet data
    • triangle_offset

      public int triangle_offset()
      offset within meshlet_triangles array with meshlet data
    • vertex_count

      public int vertex_count()
      number of vertices used in the meshlet; data is stored in consecutive range defined by offset and count
    • triangle_count

      public int triangle_count()
      number of triangles used in the meshlet; data is stored in consecutive range defined by offset and count
    • malloc

      public static MeshoptMeshlet malloc()
      Returns a new MeshoptMeshlet instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static MeshoptMeshlet calloc()
      Returns a new MeshoptMeshlet instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static MeshoptMeshlet create()
      Returns a new MeshoptMeshlet instance allocated with BufferUtils.
    • create

      public static MeshoptMeshlet create(long address)
      Returns a new MeshoptMeshlet instance for the specified memory address.
    • createSafe

      public static @Nullable MeshoptMeshlet createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static MeshoptMeshlet.Buffer malloc(int capacity)
      Returns a new MeshoptMeshlet.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static MeshoptMeshlet.Buffer calloc(int capacity)
      Returns a new MeshoptMeshlet.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static MeshoptMeshlet.Buffer create(int capacity)
      Returns a new MeshoptMeshlet.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static MeshoptMeshlet.Buffer create(long address, int capacity)
      Create a MeshoptMeshlet.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable MeshoptMeshlet.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static MeshoptMeshlet malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new MeshoptMeshlet instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static MeshoptMeshlet calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new MeshoptMeshlet instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static MeshoptMeshlet.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new MeshoptMeshlet.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static MeshoptMeshlet.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new MeshoptMeshlet.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nvertex_offset

      public static int nvertex_offset(long struct)
      Unsafe version of vertex_offset().
    • ntriangle_offset

      public static int ntriangle_offset(long struct)
      Unsafe version of triangle_offset().
    • nvertex_count

      public static int nvertex_count(long struct)
      Unsafe version of vertex_count().
    • ntriangle_count

      public static int ntriangle_count(long struct)
      Unsafe version of triangle_count().