Files
MinecraftForge/patches/minecraft/com/mojang/math/Transformation.java.patch
T
2026-06-17 19:35:27 -07:00

33 lines
1.2 KiB
Diff

--- a/com/mojang/math/Transformation.java
+++ b/com/mojang/math/Transformation.java
@@ -14,7 +_,7 @@
import org.joml.Vector3fc;
import org.jspecify.annotations.Nullable;
-public final class Transformation {
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
private static final Vector3fc ZERO_TRANSLATION = new Vector3f();
private static final Vector3fc UNIT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
private static final Quaternionfc ZERO_ROTATION = new Quaternionf();
@@ -172,6 +_,20 @@
this.scale().lerp(that.scale(), progress, new Vector3f()),
this.rightRotation().slerp(that.rightRotation(), progress, new Quaternionf())
);
+ }
+
+ private org.joml.Matrix3f normalTransform = null;
+ public org.joml.Matrix3f getNormalMatrix() {
+ checkNormalTransform();
+ return normalTransform;
+ }
+
+ private void checkNormalTransform() {
+ if (normalTransform == null) {
+ normalTransform = new org.joml.Matrix3f(matrix);
+ normalTransform.invert();
+ normalTransform.transpose();
+ }
}
public static Matrix4fc compose(final Matrix4fc parent, final Optional<Transformation> transform) {