mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-02-22 09:55:33 +01:00
Saving face
- Remove rotateToFace "optimization" that ended up generating NaNs in TransformedInstance - Switch a rotateTo to a rotationTo to save some fmas
This commit is contained in:
parent
77cd4fb898
commit
22c482283f
2 changed files with 1 additions and 10 deletions
|
@ -10,7 +10,6 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import dev.engine_room.flywheel.api.instance.InstanceHandle;
|
import dev.engine_room.flywheel.api.instance.InstanceHandle;
|
||||||
import dev.engine_room.flywheel.api.instance.InstanceType;
|
import dev.engine_room.flywheel.api.instance.InstanceType;
|
||||||
import dev.engine_room.flywheel.lib.transform.Affine;
|
import dev.engine_room.flywheel.lib.transform.Affine;
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
|
|
||||||
public class TransformedInstance extends ColoredLitOverlayInstance implements Affine<TransformedInstance> {
|
public class TransformedInstance extends ColoredLitOverlayInstance implements Affine<TransformedInstance> {
|
||||||
public final Matrix4f pose = new Matrix4f();
|
public final Matrix4f pose = new Matrix4f();
|
||||||
|
@ -148,12 +147,4 @@ public class TransformedInstance extends ColoredLitOverlayInstance implements Af
|
||||||
pose.rotateZ(radians);
|
pose.rotateZ(radians);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TransformedInstance rotateToFace(Direction facing) {
|
|
||||||
// Need to invert the step because the super default method rotates from North (-Z),
|
|
||||||
// but rotateTowards rotates from South (+Z)
|
|
||||||
pose.rotateTowards(-facing.getStepX(), -facing.getStepY(), -facing.getStepZ(), 0, 1, 0);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public interface Rotate<Self extends Rotate<Self>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
default Self rotateTo(float fromX, float fromY, float fromZ, float toX, float toY, float toZ) {
|
default Self rotateTo(float fromX, float fromY, float fromZ, float toX, float toY, float toZ) {
|
||||||
return rotate(new Quaternionf().rotateTo(fromX, fromY, fromZ, toX, toY, toZ));
|
return rotate(new Quaternionf().rotationTo(fromX, fromY, fromZ, toX, toY, toZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
default Self rotateTo(Vector3fc from, Vector3fc to) {
|
default Self rotateTo(Vector3fc from, Vector3fc to) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue