Class BGFXVertexLayout

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class BGFXVertexLayout extends Struct<BGFXVertexLayout> implements NativeResource

 struct bgfx_vertex_layout_t {
     uint32_t hash;
     uint16_t stride;
     uint16_t offset[BGFX_ATTRIB_COUNT];
     uint16_t attributes[BGFX_ATTRIB_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.
    • HASH

      public static final int HASH
      The struct member offsets.
    • STRIDE

      public static final int STRIDE
      The struct member offsets.
    • OFFSET

      public static final int OFFSET
      The struct member offsets.
    • ATTRIBUTES

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

    • BGFXVertexLayout

      public BGFXVertexLayout(ByteBuffer container)
      Creates a BGFXVertexLayout 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()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<BGFXVertexLayout>
    • hash

      public int hash()
      Returns:
      the value of the hash field.
    • stride

      public short stride()
      Returns:
      the value of the stride field.
    • offset

      public ShortBuffer offset()
      Returns:
      a ShortBuffer view of the offset field.
    • offset

      public short offset(int index)
      Returns:
      the value at the specified index of the offset field.
    • attributes

      public ShortBuffer attributes()
      Returns:
      a ShortBuffer view of the attributes field.
    • attributes

      public short attributes(int index)
      Returns:
      the value at the specified index of the attributes field.
    • hash

      public BGFXVertexLayout hash(int value)
      Sets the specified value to the hash field.
    • stride

      public BGFXVertexLayout stride(short value)
      Sets the specified value to the stride field.
    • offset

      public BGFXVertexLayout offset(ShortBuffer value)
      Copies the specified ShortBuffer to the offset field.
    • offset

      public BGFXVertexLayout offset(int index, short value)
      Sets the specified value at the specified index of the offset field.
    • attributes

      public BGFXVertexLayout attributes(ShortBuffer value)
      Copies the specified ShortBuffer to the attributes field.
    • attributes

      public BGFXVertexLayout attributes(int index, short value)
      Sets the specified value at the specified index of the attributes field.
    • set

      public BGFXVertexLayout set(int hash, short stride, ShortBuffer offset, ShortBuffer attributes)
      Initializes this struct with the specified values.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static BGFXVertexLayout.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new BGFXVertexLayout.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
    • nhash

      public static int nhash(long struct)
      Unsafe version of hash().
    • nstride

      public static short nstride(long struct)
      Unsafe version of stride().
    • noffset

      public static ShortBuffer noffset(long struct)
      Unsafe version of offset().
    • noffset

      public static short noffset(long struct, int index)
      Unsafe version of offset.
    • nattributes

      public static ShortBuffer nattributes(long struct)
      Unsafe version of attributes().
    • nattributes

      public static short nattributes(long struct, int index)
      Unsafe version of attributes.
    • nhash

      public static void nhash(long struct, int value)
      Unsafe version of hash.
    • nstride

      public static void nstride(long struct, short value)
      Unsafe version of stride.
    • noffset

      public static void noffset(long struct, ShortBuffer value)
      Unsafe version of offset.
    • noffset

      public static void noffset(long struct, int index, short value)
      Unsafe version of offset.
    • nattributes

      public static void nattributes(long struct, ShortBuffer value)
      Unsafe version of attributes.
    • nattributes

      public static void nattributes(long struct, int index, short value)
      Unsafe version of attributes.