Fix models being backwards

- Regression in ModelUtil#rotateToFace
This commit is contained in:
Jozufozu 2021-12-22 22:01:05 -08:00
parent d78f030264
commit c3bc231d0a
3 changed files with 16 additions and 2 deletions

View file

@ -99,7 +99,7 @@ public class ModelUtil {
PoseStack stack = new PoseStack(); PoseStack stack = new PoseStack();
TransformStack.cast(stack) TransformStack.cast(stack)
.centre() .centre()
.rotateToFace(facing) .rotateToFace(facing.getOpposite())
.unCentre(); .unCentre();
return stack; return stack;
}; };

View file

@ -1,6 +1,8 @@
package com.jozufozu.flywheel.util.transform; package com.jozufozu.flywheel.util.transform;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Quaternion; import com.mojang.math.Quaternion;
public class MatrixTransformStack implements TransformStack { public class MatrixTransformStack implements TransformStack {
@ -64,4 +66,16 @@ public class MatrixTransformStack implements TransformStack {
internal.popPose(); internal.popPose();
return this; return this;
} }
@Override
public TransformStack mulPose(Matrix4f pose) {
internal.last().pose().multiply(pose);
return this;
}
@Override
public TransformStack mulNormal(Matrix3f normal) {
internal.last().normal().mul(normal);
return this;
}
} }

View file

@ -2,7 +2,7 @@ package com.jozufozu.flywheel.util.transform;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
public interface TransformStack extends Scale<TransformStack>, Translate<TransformStack>, Rotate<TransformStack>, TStack<TransformStack> { public interface TransformStack extends Transform<TransformStack>, TStack<TransformStack> {
static TransformStack cast(PoseStack stack) { static TransformStack cast(PoseStack stack) {
return (TransformStack) stack; return (TransformStack) stack;
} }