Package com.jozufozu.flywheel.lib.math
Class MatrixMath
java.lang.Object
com.jozufozu.flywheel.lib.math.MatrixMath
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.mojang.blaze3d.vertex.PoseStackcopyPoseStack(com.mojang.blaze3d.vertex.PoseStack stack) static floatextractScale(org.joml.Matrix4f matrix) Extracts the greatest scale factor across all axes from the given matrix.static floattransformNormalX(org.joml.Matrix3f matrix, float x, float y, float z) static floattransformNormalY(org.joml.Matrix3f matrix, float x, float y, float z) static floattransformNormalZ(org.joml.Matrix3f matrix, float x, float y, float z) static floattransformPositionX(org.joml.Matrix4f matrix, float x, float y, float z) static floattransformPositionY(org.joml.Matrix4f matrix, float x, float y, float z) static floattransformPositionZ(org.joml.Matrix4f matrix, float x, float y, float z) static voidwritePackedFrustumPlanes(long ptr, org.joml.Matrix4f m) Writes the frustum planes of the given projection matrix to the given buffer.static voidwriteUnsafe(long ptr, org.joml.Matrix3f matrix) static voidwriteUnsafe(long ptr, org.joml.Matrix4f matrix)
-
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.
-