Record Class Mat4

java.lang.Object
java.lang.Record
dev.engine.core.math.Mat4

public record Mat4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Mat4
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Mat4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
    Creates an instance of a Mat4 record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
     
    static Mat4
    lookAt(Vec3 eye, Vec3 center, Vec3 up)
     
    float
    m00()
    Returns the value of the m00 record component.
    float
    m01()
    Returns the value of the m01 record component.
    float
    m02()
    Returns the value of the m02 record component.
    float
    m03()
    Returns the value of the m03 record component.
    float
    m10()
    Returns the value of the m10 record component.
    float
    m11()
    Returns the value of the m11 record component.
    float
    m12()
    Returns the value of the m12 record component.
    float
    m13()
    Returns the value of the m13 record component.
    float
    m20()
    Returns the value of the m20 record component.
    float
    m21()
    Returns the value of the m21 record component.
    float
    m22()
    Returns the value of the m22 record component.
    float
    m23()
    Returns the value of the m23 record component.
    float
    m30()
    Returns the value of the m30 record component.
    float
    m31()
    Returns the value of the m31 record component.
    float
    m32()
    Returns the value of the m32 record component.
    float
    m33()
    Returns the value of the m33 record component.
    mul(Mat4 o)
     
    static Mat4
    ortho(float left, float right, float bottom, float top, float near, float far)
     
    static Mat4
    perspective(float fovY, float aspect, float near, float far)
     
    static Mat4
    rotationX(float radians)
     
    static Mat4
    rotationY(float radians)
     
    static Mat4
    rotationZ(float radians)
     
    static Mat4
    scaling(float sx, float sy, float sz)
     
    Extracts the upper-left 3x3 submatrix.
    final String
    Returns a string representation of this record class.
     
    static Mat4
    translation(float tx, float ty, float tz)
     
    static Mat4
     
     
    void
    writeGpu(NativeMemory mem, long offset)
    Writes this matrix to a NativeMemory in column-major order (GPU layout).

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • IDENTITY

      public static final Mat4 IDENTITY
  • Constructor Details

    • Mat4

      public Mat4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
      Creates an instance of a Mat4 record class.
      Parameters:
      m00 - the value for the m00 record component
      m01 - the value for the m01 record component
      m02 - the value for the m02 record component
      m03 - the value for the m03 record component
      m10 - the value for the m10 record component
      m11 - the value for the m11 record component
      m12 - the value for the m12 record component
      m13 - the value for the m13 record component
      m20 - the value for the m20 record component
      m21 - the value for the m21 record component
      m22 - the value for the m22 record component
      m23 - the value for the m23 record component
      m30 - the value for the m30 record component
      m31 - the value for the m31 record component
      m32 - the value for the m32 record component
      m33 - the value for the m33 record component
  • Method Details

    • translation

      public static Mat4 translation(float tx, float ty, float tz)
    • translation

      public static Mat4 translation(Vec3 t)
    • scaling

      public static Mat4 scaling(float sx, float sy, float sz)
    • rotationX

      public static Mat4 rotationX(float radians)
    • rotationY

      public static Mat4 rotationY(float radians)
    • rotationZ

      public static Mat4 rotationZ(float radians)
    • perspective

      public static Mat4 perspective(float fovY, float aspect, float near, float far)
    • ortho

      public static Mat4 ortho(float left, float right, float bottom, float top, float near, float far)
    • lookAt

      public static Mat4 lookAt(Vec3 eye, Vec3 center, Vec3 up)
    • mul

      public Mat4 mul(Mat4 o)
    • transform

      public Vec4 transform(Vec4 v)
    • transpose

      public Mat4 transpose()
    • determinant

      public float determinant()
    • inverse

      public Mat4 inverse()
    • toMat3

      public Mat3 toMat3()
      Extracts the upper-left 3x3 submatrix.
    • writeGpu

      public void writeGpu(NativeMemory mem, long offset)
      Writes this matrix to a NativeMemory in column-major order (GPU layout). GPU APIs (OpenGL, Vulkan) expect columns stored contiguously.
    • 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 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.
    • m00

      public float m00()
      Returns the value of the m00 record component.
      Returns:
      the value of the m00 record component
    • m01

      public float m01()
      Returns the value of the m01 record component.
      Returns:
      the value of the m01 record component
    • m02

      public float m02()
      Returns the value of the m02 record component.
      Returns:
      the value of the m02 record component
    • m03

      public float m03()
      Returns the value of the m03 record component.
      Returns:
      the value of the m03 record component
    • m10

      public float m10()
      Returns the value of the m10 record component.
      Returns:
      the value of the m10 record component
    • m11

      public float m11()
      Returns the value of the m11 record component.
      Returns:
      the value of the m11 record component
    • m12

      public float m12()
      Returns the value of the m12 record component.
      Returns:
      the value of the m12 record component
    • m13

      public float m13()
      Returns the value of the m13 record component.
      Returns:
      the value of the m13 record component
    • m20

      public float m20()
      Returns the value of the m20 record component.
      Returns:
      the value of the m20 record component
    • m21

      public float m21()
      Returns the value of the m21 record component.
      Returns:
      the value of the m21 record component
    • m22

      public float m22()
      Returns the value of the m22 record component.
      Returns:
      the value of the m22 record component
    • m23

      public float m23()
      Returns the value of the m23 record component.
      Returns:
      the value of the m23 record component
    • m30

      public float m30()
      Returns the value of the m30 record component.
      Returns:
      the value of the m30 record component
    • m31

      public float m31()
      Returns the value of the m31 record component.
      Returns:
      the value of the m31 record component
    • m32

      public float m32()
      Returns the value of the m32 record component.
      Returns:
      the value of the m32 record component
    • m33

      public float m33()
      Returns the value of the m33 record component.
      Returns:
      the value of the m33 record component