From e541b6d449aba6918122afda466cf4638ab5d174 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 e6c67fecc7a7bbd65b0ff449a42d5aeee7addfa7 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 0b2e8834d872e685b06c1b00b7cc3d5e9b335f93 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 ae6d953c6be0106fb59d3b111b954ca3c5c52f06 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;