Class StructLayout
java.lang.Object
dev.engine.core.layout.StructLayout
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic interfaceA write function that serializes a record to native memory at a given offset. -
Method Summary
Modifier and TypeMethodDescriptionfields()static StructLayoutmanual(Class<?> recordType, LayoutMode mode, List<StructLayout.Field> fields, int size, StructLayout.WriteFunction writeFunc) Creates a StructLayout from manually specified fields (no reflection needed).mode()static StructLayoutPacked layout (vertex buffers, CPU-side).static StructLayoutof(Class<?> recordType, LayoutMode mode) Layout with specific mode (PACKED, STD140, STD430).static voidregister(Class<?> recordType, LayoutMode mode, StructLayout layout) Pre-registers a struct layout, bypassing reflection.intsize()voidwrite(NativeMemory memory, long offset, Object record)
-
Method Details
-
of
Packed layout (vertex buffers, CPU-side). -
of
Layout with specific mode (PACKED, STD140, STD430). -
register
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
-
size
public int size() -
mode
-
write
-