Record Class MeshData
java.lang.Object
java.lang.Record
dev.engine.core.mesh.MeshData
- All Implemented Interfaces:
Component
public record MeshData(ByteBuffer vertexData, VertexFormat format, int[] indices, int vertexCount, int indexCount)
extends Record
implements Component
Pure mesh data — no GPU resources. Just vertices, indices, and format.
Created by loaders, procedural generators, or user code.
Registered with the Engine to get a Handle<MeshTag> for scene assignment.
The vertex data layout is determined entirely by the format — MeshData makes no assumptions about which attributes exist. Any vertex type works.
-
Constructor Summary
ConstructorsConstructorDescriptionMeshData(ByteBuffer vertexData, VertexFormat format, int[] indices, int vertexCount, int indexCount) Creates an instance of aMeshDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic MeshDatacreate(float[] vertices, int[] indices, VertexFormat format) Creates MeshData from float arrays.static MeshDatacreate(float[] vertices, VertexFormat format) Creates MeshData with no indices (non-indexed geometry).final booleanIndicates whether some other object is "equal to" this one.format()Returns the value of theformatrecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of theindexCountrecord component.int[]indices()Returns the value of theindicesrecord component.booleanWhether this mesh uses index data.final StringtoString()Returns a string representation of this record class.intReturns the value of thevertexCountrecord component.Returns the value of thevertexDatarecord component.
-
Constructor Details
-
MeshData
public MeshData(ByteBuffer vertexData, VertexFormat format, int[] indices, int vertexCount, int indexCount) Creates an instance of aMeshDatarecord class.- Parameters:
vertexData- the value for thevertexDatarecord componentformat- the value for theformatrecord componentindices- the value for theindicesrecord componentvertexCount- the value for thevertexCountrecord componentindexCount- the value for theindexCountrecord component
-
-
Method Details
-
create
Creates MeshData from float arrays. The most common creation path. -
create
Creates MeshData with no indices (non-indexed geometry). -
isIndexed
public boolean isIndexed()Whether this mesh uses index data. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
vertexData
Returns the value of thevertexDatarecord component.- Returns:
- the value of the
vertexDatarecord component
-
format
Returns the value of theformatrecord component.- Returns:
- the value of the
formatrecord component
-
indices
public int[] indices()Returns the value of theindicesrecord component.- Returns:
- the value of the
indicesrecord component
-
vertexCount
public int vertexCount()Returns the value of thevertexCountrecord component.- Returns:
- the value of the
vertexCountrecord component
-
indexCount
public int indexCount()Returns the value of theindexCountrecord component.- Returns:
- the value of the
indexCountrecord component
-