From 4fbb8088322842e8398d5bdf1236fe00f6eb7656 Mon Sep 17 00:00:00 2001 From: MehVahdJukaar Date: Wed, 25 Aug 2021 20:21:33 +0200 Subject: [PATCH 1/4] Added 3 parameter scaling function Simply adds a 3 parameter function to to MatrixTransformStack so a matrix can be scaled on different axis --- .../flywheel/util/transform/MatrixTransformStack.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java index ed08b5dc7..5b61913c5 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java @@ -41,6 +41,12 @@ public class MatrixTransformStack implements TransformStack { internal.scale(factor, factor, factor); return this; } + + @Override + public TransformStack scale(float factorX, float factorY, float factorZ) { + internal.scale(factorX, factorY, factorZ); + return this; + } @Override public TransformStack push() { From b0625ef13e8e1fe6ba56f0c4d4758eab0935442f Mon Sep 17 00:00:00 2001 From: MehVahdJukaar Date: Wed, 25 Aug 2021 21:40:35 +0200 Subject: [PATCH 2/4] Update MatrixTransformStack.java --- .../jozufozu/flywheel/util/transform/MatrixTransformStack.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java index 5b61913c5..14cecf5d7 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java @@ -38,8 +38,7 @@ public class MatrixTransformStack implements TransformStack { @Override public TransformStack scale(float factor) { - internal.scale(factor, factor, factor); - return this; + return this.scale(factor, factor, factor); } @Override From d9c631cfe7f0997ec889b7586b6fd47caecf8ee8 Mon Sep 17 00:00:00 2001 From: MehVahdJukaar Date: Wed, 25 Aug 2021 21:49:06 +0200 Subject: [PATCH 3/4] Update TransformStack.java --- .../com/jozufozu/flywheel/util/transform/TransformStack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java index 1962bcf26..737b07441 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java @@ -13,7 +13,7 @@ public interface TransformStack { TransformStack multiply(Quaternion quaternion); - TransformStack scale(float factor); + TransformStack scale(float factorX, float factorY, float factorZ); TransformStack push(); From f0f423ca0d9fa27d75fed13538013d8f9b4c0ce9 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Wed, 25 Aug 2021 13:15:29 -0700 Subject: [PATCH 4/4] Restore single paramater scale function - Now has default impl in TransformStack - MatrixTransformStack now only overrides xyz scale --- .../flywheel/util/transform/MatrixTransformStack.java | 5 ----- .../com/jozufozu/flywheel/util/transform/TransformStack.java | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java index 14cecf5d7..bdb07aaa9 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/MatrixTransformStack.java @@ -36,11 +36,6 @@ public class MatrixTransformStack implements TransformStack { return this; } - @Override - public TransformStack scale(float factor) { - return this.scale(factor, factor, factor); - } - @Override public TransformStack scale(float factorX, float factorY, float factorZ) { internal.scale(factorX, factorY, factorZ); diff --git a/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java b/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java index 737b07441..0b155591e 100644 --- a/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java +++ b/src/main/java/com/jozufozu/flywheel/util/transform/TransformStack.java @@ -19,6 +19,10 @@ public interface TransformStack { TransformStack pop(); + default TransformStack scale(float factor) { + return scale(factor, factor, factor); + } + default TransformStack rotate(Direction axis, float radians) { if (radians == 0) return this;