java.lang.Object
com.seibel.distanthorizons.coreapi.util.math.Mat4f

public class Mat4f extends Object
An (almost) exact copy of Minecraft's 1.16.5 implementation of a 4x4 float matrix.
  • Constructor Details

    • Mat4f

      public Mat4f()
    • Mat4f

      public Mat4f(Mat4f sourceMatrix)
    • Mat4f

      public Mat4f(org.joml.Matrix4fc sourceMatrix)
    • Mat4f

      public Mat4f(float[] values)
    • Mat4f

      public Mat4f(FloatBuffer buffer)
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • store

      public void store(FloatBuffer floatBuffer)
    • createJomlMatrix

      public org.joml.Matrix4f createJomlMatrix()
    • setIdentity

      public void setIdentity()
    • adjudicateAndDet

      public float adjudicateAndDet()
      adjudicate and determinate
    • transpose

      public void transpose()
    • canInvert

      public boolean canInvert()
    • invert

      public void invert()
    • multiply

      public void multiply(Mat4f multMatrix)
    • multiply

      public void multiply(float scalar)
    • perspective

      public static Mat4f perspective(double fov, float widthHeightRatio, float nearClipPlane, float farClipPlane)
    • translate

      public void translate(Vec3f vec)
      TODO: what kind of translation is this? and how is this different from "multiplyTranslationMatrix"? Answer: This is faster and direct (but only if this is pure translation matrix without rotate)
    • multiplyTranslationMatrix

      public void multiplyTranslationMatrix(double x, double y, double z)
      originally "translate" from Minecraft's MatrixStack
    • copy

      public Mat4f copy()
    • createScaleMatrix

      public static Mat4f createScaleMatrix(float x, float y, float z)
    • createTranslateMatrix

      public static Mat4f createTranslateMatrix(float x, float y, float z)
    • getValuesAsArray

      public float[] getValuesAsArray()
      Returns the values of this matrix in row major order (AKA rows then columns)
    • asNonNormalizedLookForwardVector

      public Vec3f asNonNormalizedLookForwardVector()
    • set

      public void set(Mat4f mat)
    • add

      public void add(Mat4f other)
    • multiplyBackward

      public void multiplyBackward(Mat4f other)
    • setTranslation

      public void setTranslation(float x, float y, float z)
    • setClipPlanes

      public void setClipPlanes(float nearClip, float farClip)
      Changes the values that store the clipping planes. Formula for calculating matrix values is the same that OpenGL uses when making matrices.
      Parameters:
      nearClip - New near clipping plane value.
      farClip - New far clipping plane value.