Class MatrixMath

java.lang.Object
com.jozufozu.flywheel.lib.math.MatrixMath

public final class MatrixMath extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.mojang.blaze3d.vertex.PoseStack
    copyPoseStack(com.mojang.blaze3d.vertex.PoseStack stack)
     
    static float
    extractScale(org.joml.Matrix4f matrix)
    Extracts the greatest scale factor across all axes from the given matrix.
    static float
    transformNormalX(org.joml.Matrix3f matrix, float x, float y, float z)
     
    static float
    transformNormalY(org.joml.Matrix3f matrix, float x, float y, float z)
     
    static float
    transformNormalZ(org.joml.Matrix3f matrix, float x, float y, float z)
     
    static float
    transformPositionX(org.joml.Matrix4f matrix, float x, float y, float z)
     
    static float
    transformPositionY(org.joml.Matrix4f matrix, float x, float y, float z)
     
    static float
    transformPositionZ(org.joml.Matrix4f matrix, float x, float y, float z)
     
    static void
    writePackedFrustumPlanes(long ptr, org.joml.Matrix4f m)
    Writes the frustum planes of the given projection matrix to the given buffer.
    static void
    writeUnsafe(long ptr, org.joml.Matrix3f matrix)
     
    static void
    writeUnsafe(long ptr, org.joml.Matrix4f matrix)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • copyPoseStack

      public static com.mojang.blaze3d.vertex.PoseStack copyPoseStack(com.mojang.blaze3d.vertex.PoseStack stack)
    • transformPositionX

      public static float transformPositionX(org.joml.Matrix4f matrix, float x, float y, float z)
    • transformPositionY

      public static float transformPositionY(org.joml.Matrix4f matrix, float x, float y, float z)
    • transformPositionZ

      public static float transformPositionZ(org.joml.Matrix4f matrix, float x, float y, float z)
    • transformNormalX

      public static float transformNormalX(org.joml.Matrix3f matrix, float x, float y, float z)
    • transformNormalY

      public static float transformNormalY(org.joml.Matrix3f matrix, float x, float y, float z)
    • transformNormalZ

      public static float transformNormalZ(org.joml.Matrix3f matrix, float x, float y, float z)
    • writeUnsafe

      public static void writeUnsafe(long ptr, org.joml.Matrix4f matrix)
    • writeUnsafe

      public static void writeUnsafe(long ptr, org.joml.Matrix3f matrix)
    • extractScale

      public static float extractScale(org.joml.Matrix4f matrix)
      Extracts the greatest scale factor across all axes from the given matrix.
      Parameters:
      matrix - The matrix to extract the scale from.
      Returns:
      The greatest scale factor across all axes.
    • writePackedFrustumPlanes

      public static void writePackedFrustumPlanes(long ptr, org.joml.Matrix4f m)
      Writes the frustum planes of the given projection matrix to the given buffer.

      Uses a different format that is friendly towards an optimized instruction-parallel implementation of sphere-frustum intersection.

      The format is as follows:

      vec4(nxX, pxX, nyX, pyX)
      vec4(nxY, pxY, nyY, pyY)
      vec4(nxZ, pxZ, nyZ, pyZ)
      vec4(nxW, pxW, nyW, pyW)
      vec2(nzX, pzX)
      vec2(nzY, pzY)
      vec2(nzZ, pzZ)
      vec2(nzW, pzW)

      Writes 96 bytes to the buffer.

      Parameters:
      ptr - The buffer to write the planes to.
      m - The projection matrix to compute the frustum planes for.