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

    Constructors
    Constructor
    Description
    MeshData(ByteBuffer vertexData, VertexFormat format, int[] indices, int vertexCount, int indexCount)
    Creates an instance of a MeshData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static MeshData
    create(float[] vertices, int[] indices, VertexFormat format)
    Creates MeshData from float arrays.
    static MeshData
    create(float[] vertices, VertexFormat format)
    Creates MeshData with no indices (non-indexed geometry).
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the format record component.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the indexCount record component.
    int[]
    Returns the value of the indices record component.
    boolean
    Whether this mesh uses index data.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the vertexCount record component.
    Returns the value of the vertexData record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface Component

    slotType
  • Constructor Details

    • MeshData

      public MeshData(ByteBuffer vertexData, VertexFormat format, int[] indices, int vertexCount, int indexCount)
      Creates an instance of a MeshData record class.
      Parameters:
      vertexData - the value for the vertexData record component
      format - the value for the format record component
      indices - the value for the indices record component
      vertexCount - the value for the vertexCount record component
      indexCount - the value for the indexCount record component
  • Method Details

    • create

      public static MeshData create(float[] vertices, int[] indices, VertexFormat format)
      Creates MeshData from float arrays. The most common creation path.
    • create

      public static MeshData create(float[] vertices, VertexFormat format)
      Creates MeshData with no indices (non-indexed geometry).
    • isIndexed

      public boolean isIndexed()
      Whether this mesh uses index data.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • vertexData

      public ByteBuffer vertexData()
      Returns the value of the vertexData record component.
      Returns:
      the value of the vertexData record component
    • format

      public VertexFormat format()
      Returns the value of the format record component.
      Returns:
      the value of the format record component
    • indices

      public int[] indices()
      Returns the value of the indices record component.
      Returns:
      the value of the indices record component
    • vertexCount

      public int vertexCount()
      Returns the value of the vertexCount record component.
      Returns:
      the value of the vertexCount record component
    • indexCount

      public int indexCount()
      Returns the value of the indexCount record component.
      Returns:
      the value of the indexCount record component