Class StructLayout

java.lang.Object
dev.engine.core.layout.StructLayout

public final class StructLayout extends Object
  • Method Details

    • of

      public static StructLayout of(Class<?> recordType)
      Packed layout (vertex buffers, CPU-side).
    • of

      public static StructLayout of(Class<?> recordType, LayoutMode mode)
      Layout with specific mode (PACKED, STD140, STD430).
    • register

      public static void register(Class<?> recordType, LayoutMode mode, StructLayout layout)
      Pre-registers a struct layout, bypassing reflection. Use this for platforms that don't support Class.getRecordComponents() (e.g., TeaVM). Must be called before StructLayout.of() for the same type.
    • manual

      public static StructLayout manual(Class<?> recordType, LayoutMode mode, List<StructLayout.Field> fields, int size, StructLayout.WriteFunction writeFunc)
      Creates a StructLayout from manually specified fields (no reflection needed). The write function receives (memory, baseOffset, record) and must write all fields relative to the given base offset.
    • fields

      public List<StructLayout.Field> fields()
    • size

      public int size()
    • mode

      public LayoutMode mode()
    • write

      public void write(NativeMemory memory, long offset, Object record)