Record Class ObjParser.ObjMesh

java.lang.Object
java.lang.Record
com.hypixel.hytale.builtin.buildertools.objimport.ObjParser.ObjMesh
Record Components:
vertices - list of vertex positions [x, y, z]
uvCoordinates - list of UV texture coordinates [u, v]
faces - list of triangulated face vertex indices
faceUvIndices - UV indices for each face (parallel to faces, may contain nulls)
faceMaterials - material name for each face (may be null per face)
mtlLib - path to the material library file (may be null)
Enclosing class:
ObjParser

public static record ObjParser.ObjMesh(List<float[]> vertices, List<float[]> uvCoordinates, List<int[]> faces, List<int[]> faceUvIndices, List<String> faceMaterials, @Nullable String mtlLib) extends Record
Represents parsed mesh data from an OBJ file.
  • Constructor Details

    • ObjMesh

      public ObjMesh(List<float[]> vertices, List<float[]> uvCoordinates, List<int[]> faces, List<int[]> faceUvIndices, List<String> faceMaterials, @Nullable String mtlLib)
      Creates an instance of a ObjMesh record class.
      Parameters:
      vertices - the value for the vertices record component
      uvCoordinates - the value for the uvCoordinates record component
      faces - the value for the faces record component
      faceUvIndices - the value for the faceUvIndices record component
      faceMaterials - the value for the faceMaterials record component
      mtlLib - the value for the mtlLib record component
  • Method Details

    • getBounds

      public float[] getBounds()
      Returns:
      the bounding box as {minX, minY, minZ, maxX, maxY, maxZ}
    • getHeight

      public float getHeight()
      Returns:
      the height of the mesh (Y extent)
    • hasMaterials

      public boolean hasMaterials()
      Returns:
      true if the mesh has material information
    • hasUvCoordinates

      public boolean hasUvCoordinates()
      Returns:
      true if the mesh has UV coordinates
    • transformZUpToYUp

      public void transformZUpToYUp()
      Transforms vertices in-place to convert from Z-up coordinate system to Y-up. Use for models exported from Blender or 3ds Max.
    • transformXUpToYUp

      public void transformXUpToYUp()
      Transforms vertices in-place to convert from X-up coordinate system to Y-up.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • vertices

      public List<float[]> vertices()
      Returns the value of the vertices record component.
      Returns:
      the value of the vertices record component
    • uvCoordinates

      public List<float[]> uvCoordinates()
      Returns the value of the uvCoordinates record component.
      Returns:
      the value of the uvCoordinates record component
    • faces

      public List<int[]> faces()
      Returns the value of the faces record component.
      Returns:
      the value of the faces record component
    • faceUvIndices

      public List<int[]> faceUvIndices()
      Returns the value of the faceUvIndices record component.
      Returns:
      the value of the faceUvIndices record component
    • faceMaterials

      public List<String> faceMaterials()
      Returns the value of the faceMaterials record component.
      Returns:
      the value of the faceMaterials record component
    • mtlLib

      @Nullable public String mtlLib()
      Returns the value of the mtlLib record component.
      Returns:
      the value of the mtlLib record component