From 98e1fbb9fe2a8a21da51116fb833b4defca6ef88 Mon Sep 17 00:00:00 2001 From: Speiger Date: Sat, 23 Apr 2022 17:50:13 +0200 Subject: [PATCH] Refactored Constraints & Vector Classes creators --- build.gradle | 2 +- .../coreengine/math/collision2d/Circle.java | 6 +- .../math/collision2d/Mixed2DCollision.java | 4 +- .../coreengine/math/collision2d/Plane.java | 6 +- .../src/coreengine/math/misc/Facing.java | 8 +- .../src/coreengine/math/misc/FacingList.java | 2 +- .../coreengine/math/smooth/SmoothVec3f.java | 6 +- .../coreengine/math/vector/bytes/Vec2b.java | 40 +++---- .../math/vector/bytes/Vec2bImmutable.java | 8 +- .../math/vector/bytes/Vec2bMutable.java | 2 +- .../coreengine/math/vector/bytes/Vec3b.java | 40 +++---- .../math/vector/bytes/Vec3bImmutable.java | 10 +- .../math/vector/bytes/Vec3bMutable.java | 2 +- .../coreengine/math/vector/bytes/Vec4b.java | 40 +++---- .../math/vector/bytes/Vec4bImmutable.java | 12 +- .../math/vector/bytes/Vec4bMutable.java | 2 +- .../coreengine/math/vector/doubles/Vec2d.java | 40 +++---- .../math/vector/doubles/Vec2dImmutable.java | 8 +- .../math/vector/doubles/Vec2dMutable.java | 2 +- .../coreengine/math/vector/doubles/Vec3d.java | 40 +++---- .../math/vector/doubles/Vec3dImmutable.java | 10 +- .../math/vector/doubles/Vec3dMutable.java | 2 +- .../coreengine/math/vector/doubles/Vec4d.java | 40 +++---- .../math/vector/doubles/Vec4dImmutable.java | 12 +- .../math/vector/doubles/Vec4dMutable.java | 2 +- .../coreengine/math/vector/floats/Vec2f.java | 40 +++---- .../math/vector/floats/Vec2fImmutable.java | 8 +- .../math/vector/floats/Vec2fMutable.java | 2 +- .../coreengine/math/vector/floats/Vec3f.java | 40 +++---- .../math/vector/floats/Vec3fImmutable.java | 10 +- .../math/vector/floats/Vec3fMutable.java | 2 +- .../coreengine/math/vector/floats/Vec4f.java | 40 +++---- .../math/vector/floats/Vec4fImmutable.java | 12 +- .../math/vector/floats/Vec4fMutable.java | 2 +- .../coreengine/math/vector/ints/Vec2i.java | 40 +++---- .../math/vector/ints/Vec2iImmutable.java | 8 +- .../math/vector/ints/Vec2iMutable.java | 2 +- .../coreengine/math/vector/ints/Vec3i.java | 40 +++---- .../math/vector/ints/Vec3iImmutable.java | 10 +- .../math/vector/ints/Vec3iMutable.java | 2 +- .../coreengine/math/vector/ints/Vec4i.java | 40 +++---- .../math/vector/ints/Vec4iImmutable.java | 12 +- .../math/vector/ints/Vec4iMutable.java | 2 +- .../coreengine/math/vector/longs/Vec2l.java | 40 +++---- .../math/vector/longs/Vec2lImmutable.java | 8 +- .../math/vector/longs/Vec2lMutable.java | 2 +- .../coreengine/math/vector/longs/Vec3l.java | 40 +++---- .../math/vector/longs/Vec3lImmutable.java | 10 +- .../math/vector/longs/Vec3lMutable.java | 2 +- .../coreengine/math/vector/longs/Vec4l.java | 40 +++---- .../math/vector/longs/Vec4lImmutable.java | 12 +- .../math/vector/longs/Vec4lMutable.java | 2 +- .../math/vector/matrix/Matrix4f.java | 6 +- .../math/vector/quaternion/Quaternion.java | 36 +++--- .../quaternion/QuaternionImmutable.java | 4 +- .../vector/quaternion/QuaternionMutable.java | 2 +- .../coreengine/math/vector/shorts/Vec2s.java | 40 +++---- .../math/vector/shorts/Vec2sImmutable.java | 8 +- .../math/vector/shorts/Vec2sMutable.java | 2 +- .../coreengine/math/vector/shorts/Vec3s.java | 40 +++---- .../math/vector/shorts/Vec3sImmutable.java | 10 +- .../math/vector/shorts/Vec3sMutable.java | 2 +- .../coreengine/math/vector/shorts/Vec4s.java | 40 +++---- .../math/vector/shorts/Vec4sImmutable.java | 12 +- .../math/vector/shorts/Vec4sMutable.java | 2 +- .../src/coreengine/rendering/gui/GuiBase.java | 12 +- .../rendering/gui/GuiComponent.java | 16 +-- .../rendering/gui/base/GuiScreenBase.java | 6 +- .../gui/components/ButtonComponent.java | 4 +- .../gui/components/LabelComponent.java | 4 +- .../gui/components/ListComponent.java | 8 +- .../gui/components/ProgressBarComponent.java | 4 +- .../gui/components/ScrollPanelComponent.java | 14 +-- .../gui/components/ScrollWindowComponent.java | 16 +-- .../gui/components/SelectionComponent.java | 9 +- .../gui/components/SliderComponent.java | 4 +- .../gui/components/TabbedWindowComponent.java | 8 +- .../gui/components/TextCheckBoxComponent.java | 4 +- .../gui/components/TextComponent.java | 63 ++++------ .../gui/components/TextFieldComponent.java | 10 +- .../gui/components/TextPanelComponent.java | 8 +- .../gui/components/TooltipPanel.java | 4 +- .../gui/components/TreeComponent.java | 8 +- .../gui/components/WindowComponent.java | 14 +-- .../gui/components/menu/MenuBarComponent.java | 4 +- .../menu/MenuCheckBoxComponent.java | 4 +- .../gui/components/menu/MenuComponent.java | 6 +- .../components/menu/MenuItemComponent.java | 4 +- .../components/special/ConsoleComponent.java | 6 +- .../color/ColorPickerWindowComponent.java | 6 +- .../debug/PieProfilerWindowComponent.java | 16 +-- .../debug/TreeProfilerWindowComponent.java | 8 +- .../window/misc/ChoiceComponent.java | 8 +- .../window/misc/MessageComponent.java | 6 +- .../rendering/gui/helper/FontBuilder.java | 2 +- .../helper/constrains/CenterConstrain.java | 1 - .../constrains/ComponentConstrains.java | 52 -------- .../constrains/ConditionalConstraint.java | 9 +- .../gui/helper/constrains/Constrain.java | 62 +++++++--- .../gui/helper/constrains/Constrains.java | 112 ++++++++++++++++++ .../gui/helper/constrains/Constraints.java | 74 ------------ .../gui/helper/constrains/MenuConstrain.java | 2 +- .../rendering/gui/renderer/UIRenderer.java | 31 ++--- .../gui/renderer/buffer/RenderBuffer.java | 2 +- .../src/coreengine/rendering/input/Mouse.java | 6 +- .../coreengine/rendering/input/MouseRay.java | 8 +- .../rendering/input/camera/Camera.java | 16 +-- .../rendering/input/camera/Frustrum.java | 2 +- .../input/window/ScaledResolution.java | 6 +- .../shader/uniforms/UniformVec2f.java | 4 +- .../shader/uniforms/UniformVec3f.java | 4 +- .../shader/uniforms/UniformVec3fArray.java | 4 +- .../shader/uniforms/UniformVec4f.java | 4 +- .../shader/uniforms/UniformVec4fArray.java | 4 +- .../rendering/tesselation/GLCall.java | 2 +- .../rendering/tesselation/Tesselator.java | 4 +- .../textures/custom/TextureAtlas.java | 2 +- .../rendering/utils/ViewPortStack.java | 4 +- .../utils/helpers/InternalThreadPools.java | 2 +- 119 files changed, 860 insertions(+), 861 deletions(-) delete mode 100644 src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ComponentConstrains.java create mode 100644 src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/Constrains.java delete mode 100644 src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/Constraints.java diff --git a/build.gradle b/build.gradle index cc0ebd7..ce57f6a 100644 --- a/build.gradle +++ b/build.gradle @@ -66,5 +66,5 @@ dependencies { compile 'com.google.code.gson:gson:2.8.6' //Primitive Collections - compile 'de.speiger:Primitive-Collections:0.6.0' + compile 'de.speiger:Primitive-Collections:0.6.1' } \ No newline at end of file diff --git a/src/main/java/speiger/src/coreengine/math/collision2d/Circle.java b/src/main/java/speiger/src/coreengine/math/collision2d/Circle.java index cb911fb..b966d8b 100644 --- a/src/main/java/speiger/src/coreengine/math/collision2d/Circle.java +++ b/src/main/java/speiger/src/coreengine/math/collision2d/Circle.java @@ -12,7 +12,7 @@ public class Circle implements I2DCollision public Circle(int x, int y, int radius) { - center = Vec2i.newVec(x, y); + center = Vec2i.of(x, y); this.radius = radius; } @@ -49,8 +49,8 @@ public class Circle implements I2DCollision public Iterator iterator() { return new Iterator(){ - Vec2i iter = step(Vec2i.newMutable(center).sub(radius)); - Vec2i result = Vec2i.newMutable(); + Vec2i iter = step(Vec2i.mutable(center).sub(radius)); + Vec2i result = Vec2i.mutable(); @Override public boolean hasNext() diff --git a/src/main/java/speiger/src/coreengine/math/collision2d/Mixed2DCollision.java b/src/main/java/speiger/src/coreengine/math/collision2d/Mixed2DCollision.java index d9fb168..0e85f0b 100644 --- a/src/main/java/speiger/src/coreengine/math/collision2d/Mixed2DCollision.java +++ b/src/main/java/speiger/src/coreengine/math/collision2d/Mixed2DCollision.java @@ -38,8 +38,8 @@ public class Mixed2DCollision implements I2DCollision { return new Iterator(){ Iterator mainIter = mainBox.iterator(); - Vec2i cache = findNext(Vec2i.newMutable()); - Vec2i result = Vec2i.newMutable(); + Vec2i cache = findNext(Vec2i.mutable()); + Vec2i result = Vec2i.mutable(); @Override public boolean hasNext() { diff --git a/src/main/java/speiger/src/coreengine/math/collision2d/Plane.java b/src/main/java/speiger/src/coreengine/math/collision2d/Plane.java index 593ac79..4edc79f 100644 --- a/src/main/java/speiger/src/coreengine/math/collision2d/Plane.java +++ b/src/main/java/speiger/src/coreengine/math/collision2d/Plane.java @@ -16,7 +16,7 @@ public class Plane implements I2DCollision public Plane(int minX, int minY, int maxX, int maxY) { - this(Vec2i.newMutable(minX, minY), Vec2i.newMutable(maxX, maxY)); + this(Vec2i.mutable(minX, minY), Vec2i.mutable(maxX, maxY)); } public Plane(Vec2i center, int radius) @@ -73,8 +73,8 @@ public class Plane implements I2DCollision public Iterator iterator() { return new Iterator(){ - Vec2i iter = Vec2i.newMutable(min); - Vec2i result = Vec2i.newMutable(); + Vec2i iter = Vec2i.mutable(min); + Vec2i result = Vec2i.mutable(); @Override public boolean hasNext() diff --git a/src/main/java/speiger/src/coreengine/math/misc/Facing.java b/src/main/java/speiger/src/coreengine/math/misc/Facing.java index d67953a..7fcaacd 100644 --- a/src/main/java/speiger/src/coreengine/math/misc/Facing.java +++ b/src/main/java/speiger/src/coreengine/math/misc/Facing.java @@ -6,10 +6,10 @@ import speiger.src.coreengine.math.vector.ints.Vec2i; public enum Facing { - NORTH(0, 2, "North", Axis.VERTICAL, Vec2i.newVec(0, 1)), - EAST(1, 3, "East", Axis.HORIZONTAL, Vec2i.newVec(1, 0)), - SOUTH(2, 0, "South", Axis.VERTICAL, Vec2i.newVec(0, -1)), - WEST(3, 1, "West", Axis.HORIZONTAL, Vec2i.newVec(-1, 0)); + NORTH(0, 2, "North", Axis.VERTICAL, Vec2i.of(0, 1)), + EAST(1, 3, "East", Axis.HORIZONTAL, Vec2i.of(1, 0)), + SOUTH(2, 0, "South", Axis.VERTICAL, Vec2i.of(0, -1)), + WEST(3, 1, "West", Axis.HORIZONTAL, Vec2i.of(-1, 0)); private static final Facing[] VALUES; private static final Facing[] ROTATIONS; diff --git a/src/main/java/speiger/src/coreengine/math/misc/FacingList.java b/src/main/java/speiger/src/coreengine/math/misc/FacingList.java index b163d12..d182eef 100644 --- a/src/main/java/speiger/src/coreengine/math/misc/FacingList.java +++ b/src/main/java/speiger/src/coreengine/math/misc/FacingList.java @@ -41,7 +41,7 @@ public final class FacingList implements Iterable, Predicate private FacingList(int initCode) { code = (byte)MathUtils.clamp(0, 15, initCode); - Vec2i pos = Vec2i.newMutable(); + Vec2i pos = Vec2i.mutable(); ObjectList facings = new ObjectArrayList(); for(int i = 0;i<4;i++) { diff --git a/src/main/java/speiger/src/coreengine/math/smooth/SmoothVec3f.java b/src/main/java/speiger/src/coreengine/math/smooth/SmoothVec3f.java index f2cb4cf..95349bf 100644 --- a/src/main/java/speiger/src/coreengine/math/smooth/SmoothVec3f.java +++ b/src/main/java/speiger/src/coreengine/math/smooth/SmoothVec3f.java @@ -4,9 +4,9 @@ import speiger.src.coreengine.math.vector.floats.Vec3f; public class SmoothVec3f { - Vec3f value = Vec3f.newMutable(); - Vec3f target = Vec3f.newMutable(); - Vec3f helper = Vec3f.newMutable(); + Vec3f value = Vec3f.mutable(); + Vec3f target = Vec3f.mutable(); + Vec3f helper = Vec3f.mutable(); float agility = 0F; public SmoothVec3f(float agility) diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2b.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2b.java index dc33ecb..eded728 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2b.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2b.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s; public interface Vec2b extends Vecb { - public static final Vec2b ZERO = newVec(); - public static final Vec2b MINUS_ONE = newVec((byte)-1); - public static final Vec2b ONE = newVec((byte)1); + public static final Vec2b ZERO = of(); + public static final Vec2b MINUS_ONE = of((byte)-1); + public static final Vec2b ONE = of((byte)1); - public static Vec2b newMutable(){return new Vec2bMutable();} - public static Vec2b newMutable(byte value){return new Vec2bMutable(value);} - public static Vec2b newMutable(byte x, byte y){return new Vec2bMutable(x, y);} - public static Vec2b newMutable(Vec2b value){return newMutable(value.getX(), value.getY());} + public static Vec2b mutable(){return new Vec2bMutable();} + public static Vec2b mutable(byte value){return new Vec2bMutable(value);} + public static Vec2b mutable(byte x, byte y){return new Vec2bMutable(x, y);} + public static Vec2b mutable(Vec2b value){return mutable(value.getX(), value.getY());} - public static Vec2b newVec(){return new Vec2bImmutable();} - public static Vec2b newVec(byte value){return new Vec2bImmutable(value);} - public static Vec2b newVec(byte x, byte y){return new Vec2bImmutable(x, y);} - public static Vec2b newVec(Vec2b value){return newVec(value.getX(), value.getY());} + public static Vec2b of(){return new Vec2bImmutable();} + public static Vec2b of(byte value){return new Vec2bImmutable(value);} + public static Vec2b of(byte x, byte y){return new Vec2bImmutable(x, y);} + public static Vec2b of(Vec2b value){return of(value.getX(), value.getY());} public byte getX(); public byte getY(); @@ -128,22 +128,22 @@ public interface Vec2b extends Vecb } @Override - public default Vec2s asShort(){return isMutable() ? Vec2s.newMutable(getX(), getY()) : Vec2s.newVec(getX(), getY());} + public default Vec2s asShort(){return isMutable() ? Vec2s.mutable(getX(), getY()) : Vec2s.of(getX(), getY());} @Override - public default Vec2i asInt(){return isMutable() ? Vec2i.newMutable(getX(), getY()) : Vec2i.newVec(getX(), getY());} + public default Vec2i asInt(){return isMutable() ? Vec2i.mutable(getX(), getY()) : Vec2i.of(getX(), getY());} @Override - public default Vec2l asLong(){return isMutable() ? Vec2l.newMutable(getX(), getY()) : Vec2l.newVec(getX(), getY());} + public default Vec2l asLong(){return isMutable() ? Vec2l.mutable(getX(), getY()) : Vec2l.of(getX(), getY());} @Override - public default Vec2f asFloat() {return isMutable() ? Vec2f.newMutable(getX(), getY()) : Vec2f.newVec(getX(), getY());} + public default Vec2f asFloat() {return isMutable() ? Vec2f.mutable(getX(), getY()) : Vec2f.of(getX(), getY());} @Override - public default Vec2d asDouble(){return isMutable() ? Vec2d.newMutable(getX(), getY()) : Vec2d.newVec(getX(), getY());} + public default Vec2d asDouble(){return isMutable() ? Vec2d.mutable(getX(), getY()) : Vec2d.of(getX(), getY());} @Override - public default Vec2b asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec2b asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec2b asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec2b asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec2b copyAsMutable(){return newMutable(this);} + public default Vec2b copyAsMutable(){return mutable(this);} @Override - public default Vec2b copyAsImmutable(){return newVec(this);} + public default Vec2b copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bImmutable.java index 2c2878b..ae6676b 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bImmutable.java @@ -46,25 +46,25 @@ public class Vec2bImmutable implements Vec2b @Override public Vec2b setX(byte x) { - return this.x == x ? this : Vec2b.newVec(x, y); + return this.x == x ? this : Vec2b.of(x, y); } @Override public Vec2b setY(byte y) { - return this.y == y ? this : Vec2b.newVec(x, y); + return this.y == y ? this : Vec2b.of(x, y); } @Override public Vec2b copy() { - return Vec2b.newVec(this); + return Vec2b.of(this); } @Override public Vec2b set(byte x, byte y) { - return this.x == x && this.y == y ? this : Vec2b.newVec(x, y); + return this.x == x && this.y == y ? this : Vec2b.of(x, y); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bMutable.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bMutable.java index ecdde7c..25bc44a 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec2bMutable.java @@ -58,7 +58,7 @@ public class Vec2bMutable implements Vec2b @Override public Vec2b copy() { - return Vec2b.newMutable(this); + return Vec2b.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3b.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3b.java index cc35c14..1bae5b0 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3b.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3b.java @@ -11,19 +11,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s; public interface Vec3b extends Vecb { - public static final Vec3b ZERO = newVec(); - public static final Vec3b MINUS_ONE = newVec((byte)-1); - public static final Vec3b ONE = newVec((byte)1); + public static final Vec3b ZERO = of(); + public static final Vec3b MINUS_ONE = of((byte)-1); + public static final Vec3b ONE = of((byte)1); - public static Vec3b newMutable(){return new Vec3bMutable();} - public static Vec3b newMutable(byte value){return new Vec3bMutable(value);} - public static Vec3b newMutable(byte x, byte y, byte z){return new Vec3bMutable(x, y, z);} - public static Vec3b newMutable(Vec3b vec){return newMutable(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3b mutable(){return new Vec3bMutable();} + public static Vec3b mutable(byte value){return new Vec3bMutable(value);} + public static Vec3b mutable(byte x, byte y, byte z){return new Vec3bMutable(x, y, z);} + public static Vec3b mutable(Vec3b vec){return mutable(vec.getX(), vec.getY(), vec.getZ());} - public static Vec3b newVec(){return new Vec3bImmutable();} - public static Vec3b newVec(byte value){return new Vec3bImmutable(value);} - public static Vec3b newVec(byte x, byte y, byte z){return new Vec3bImmutable(x, y, z);} - public static Vec3b newVec(Vec3b vec){return newVec(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3b of(){return new Vec3bImmutable();} + public static Vec3b of(byte value){return new Vec3bImmutable(value);} + public static Vec3b of(byte x, byte y, byte z){return new Vec3bImmutable(x, y, z);} + public static Vec3b of(Vec3b vec){return of(vec.getX(), vec.getY(), vec.getZ());} public byte getX(); public byte getY(); @@ -120,22 +120,22 @@ public interface Vec3b extends Vecb } @Override - public default Vec3s asShort(){return isMutable() ? Vec3s.newMutable(getX(), getY(), getZ()) : Vec3s.newVec(getX(), getY(), getZ());} + public default Vec3s asShort(){return isMutable() ? Vec3s.mutable(getX(), getY(), getZ()) : Vec3s.of(getX(), getY(), getZ());} @Override - public default Vec3i asInt(){return isMutable() ? Vec3i.newMutable(getX(), getY(), getZ()) : Vec3i.newVec(getX(), getY(), getZ());} + public default Vec3i asInt(){return isMutable() ? Vec3i.mutable(getX(), getY(), getZ()) : Vec3i.of(getX(), getY(), getZ());} @Override - public default Vec3l asLong(){return isMutable() ? Vec3l.newMutable(getX(), getY(), getZ()) : Vec3l.newVec(getX(), getY(), getZ());} + public default Vec3l asLong(){return isMutable() ? Vec3l.mutable(getX(), getY(), getZ()) : Vec3l.of(getX(), getY(), getZ());} @Override - public default Vec3f asFloat() {return isMutable() ? Vec3f.newMutable(getX(), getY(), getZ()) : Vec3f.newVec(getX(), getY(), getZ());} + public default Vec3f asFloat() {return isMutable() ? Vec3f.mutable(getX(), getY(), getZ()) : Vec3f.of(getX(), getY(), getZ());} @Override - public default Vec3d asDouble(){return isMutable() ? Vec3d.newMutable(getX(), getY(), getZ()) : Vec3d.newVec(getX(), getY(), getZ());} + public default Vec3d asDouble(){return isMutable() ? Vec3d.mutable(getX(), getY(), getZ()) : Vec3d.of(getX(), getY(), getZ());} @Override - public default Vec3b asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec3b asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec3b asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec3b asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec3b copyAsMutable(){return newMutable(this);} + public default Vec3b copyAsMutable(){return mutable(this);} @Override - public default Vec3b copyAsImmutable(){return newVec(this);} + public default Vec3b copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bImmutable.java index 5e33e4d..3fd70bf 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bImmutable.java @@ -56,31 +56,31 @@ public class Vec3bImmutable implements Vec3b @Override public Vec3b setX(byte x) { - return this.x == x ? this : Vec3b.newVec(x, y, z); + return this.x == x ? this : Vec3b.of(x, y, z); } @Override public Vec3b setY(byte y) { - return this.y == y ? this : Vec3b.newVec(x, y, z); + return this.y == y ? this : Vec3b.of(x, y, z); } @Override public Vec3b setZ(byte z) { - return this.z == z ? this : Vec3b.newVec(x, y, z); + return this.z == z ? this : Vec3b.of(x, y, z); } @Override public Vec3b copy() { - return Vec3b.newVec(this); + return Vec3b.of(this); } @Override public Vec3b set(byte x, byte y, byte z) { - return this.x == x && this.y == y && this.z == z ? this : Vec3b.newVec(x, y, z); + return this.x == x && this.y == y && this.z == z ? this : Vec3b.of(x, y, z); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bMutable.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bMutable.java index 2c59e64..5fcb6b4 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec3bMutable.java @@ -74,7 +74,7 @@ public class Vec3bMutable implements Vec3b @Override public Vec3b copy() { - return Vec3b.newMutable(this); + return Vec3b.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4b.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4b.java index 0355c70..de29655 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4b.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4b.java @@ -11,19 +11,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s; public interface Vec4b extends Vecb { - public static final Vec4b ZERO = newVec(); - public static final Vec4b MINUS_ONE = newVec((byte)-1); - public static final Vec4b ONE = newVec((byte)1); + public static final Vec4b ZERO = of(); + public static final Vec4b MINUS_ONE = of((byte)-1); + public static final Vec4b ONE = of((byte)1); - public static Vec4b newMutable(){return new Vec4bMutable();} - public static Vec4b newMutable(byte value){return new Vec4bMutable(value);} - public static Vec4b newMutable(byte x, byte y, byte z, byte w){return new Vec4bMutable(x, y, z, w);} - public static Vec4b newMutable(Vec4b vec){return newMutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4b mutable(){return new Vec4bMutable();} + public static Vec4b mutable(byte value){return new Vec4bMutable(value);} + public static Vec4b mutable(byte x, byte y, byte z, byte w){return new Vec4bMutable(x, y, z, w);} + public static Vec4b mutable(Vec4b vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} - public static Vec4b newVec(){return new Vec4bImmutable();} - public static Vec4b newVec(byte value){return new Vec4bImmutable(value);} - public static Vec4b newVec(byte x, byte y, byte z, byte w){return new Vec4bImmutable(x, y, z, w);} - public static Vec4b newVec(Vec4b vec){return newVec(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4b of(){return new Vec4bImmutable();} + public static Vec4b of(byte value){return new Vec4bImmutable(value);} + public static Vec4b of(byte x, byte y, byte z, byte w){return new Vec4bImmutable(x, y, z, w);} + public static Vec4b of(Vec4b vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} public byte getX(); public byte getY(); @@ -123,23 +123,23 @@ public interface Vec4b extends Vecb } @Override - public default Vec4s asShort(){return isMutable() ? Vec4s.newMutable(getX(), getY(), getZ(), getW()) : Vec4s.newVec(getX(), getY(), getZ(), getW());} + public default Vec4s asShort(){return isMutable() ? Vec4s.mutable(getX(), getY(), getZ(), getW()) : Vec4s.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4i asInt(){return isMutable() ? Vec4i.newMutable(getX(), getY(), getZ(), getW()) : Vec4i.newVec(getX(), getY(), getZ(), getW());} + public default Vec4i asInt(){return isMutable() ? Vec4i.mutable(getX(), getY(), getZ(), getW()) : Vec4i.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4l asLong(){return isMutable() ? Vec4l.newMutable(getX(), getY(), getZ(), getW()) : Vec4l.newVec(getX(), getY(), getZ(), getW());} + public default Vec4l asLong(){return isMutable() ? Vec4l.mutable(getX(), getY(), getZ(), getW()) : Vec4l.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4f asFloat() {return isMutable() ? Vec4f.newMutable(getX(), getY(), getZ(), getW()) : Vec4f.newVec(getX(), getY(), getZ(), getW());} + public default Vec4f asFloat() {return isMutable() ? Vec4f.mutable(getX(), getY(), getZ(), getW()) : Vec4f.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4d asDouble(){return isMutable() ? Vec4d.newMutable(getX(), getY(), getZ(), getW()) : Vec4d.newVec(getX(), getY(), getZ(), getW());} + public default Vec4d asDouble(){return isMutable() ? Vec4d.mutable(getX(), getY(), getZ(), getW()) : Vec4d.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4b asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec4b asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec4b asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec4b asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec4b copyAsMutable(){return newMutable(this);} + public default Vec4b copyAsMutable(){return mutable(this);} @Override - public default Vec4b copyAsImmutable(){return newVec(this);} + public default Vec4b copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bImmutable.java index 040bde5..010aa7c 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bImmutable.java @@ -66,37 +66,37 @@ public class Vec4bImmutable implements Vec4b @Override public Vec4b setX(byte x) { - return this.x == x ? this : Vec4b.newVec(x, y, z, w); + return this.x == x ? this : Vec4b.of(x, y, z, w); } @Override public Vec4b setY(byte y) { - return this.y == y ? this : Vec4b.newVec(x, y, z, w); + return this.y == y ? this : Vec4b.of(x, y, z, w); } @Override public Vec4b setZ(byte z) { - return this.z == z ? this : Vec4b.newVec(x, y, z, w); + return this.z == z ? this : Vec4b.of(x, y, z, w); } @Override public Vec4b setW(byte w) { - return this.w == w ? this : Vec4b.newVec(x, y, z, w); + return this.w == w ? this : Vec4b.of(x, y, z, w); } @Override public Vec4b copy() { - return Vec4b.newVec(this); + return Vec4b.of(this); } @Override public Vec4b set(byte x, byte y, byte z, byte w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4b.newVec(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4b.of(x, y, z, w); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bMutable.java b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bMutable.java index ca5c2fd..bd6744b 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/bytes/Vec4bMutable.java @@ -90,7 +90,7 @@ public class Vec4bMutable implements Vec4b @Override public Vec4b copy() { - return Vec4b.newMutable(this); + return Vec4b.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2d.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2d.java index 9d2d5d2..3d4f54a 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2d.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2d.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s; public interface Vec2d extends Vecd { - public static final Vec2d ZERO = newVec(); - public static final Vec2d MINUS_ONE = newVec(-1D); - public static final Vec2d ONE = newVec(1D); + public static final Vec2d ZERO = of(); + public static final Vec2d MINUS_ONE = of(-1D); + public static final Vec2d ONE = of(1D); - public static Vec2d newMutable(){return new Vec2dMutable();} - public static Vec2d newMutable(double value){return new Vec2dMutable(value);} - public static Vec2d newMutable(double x, double y){return new Vec2dMutable(x, y);} - public static Vec2d newMutable(Vec2d value){return newMutable(value.getX(), value.getY());} + public static Vec2d mutable(){return new Vec2dMutable();} + public static Vec2d mutable(double value){return new Vec2dMutable(value);} + public static Vec2d mutable(double x, double y){return new Vec2dMutable(x, y);} + public static Vec2d mutable(Vec2d value){return mutable(value.getX(), value.getY());} - public static Vec2d newVec(){return new Vec2dImmutable();} - public static Vec2d newVec(double value){return new Vec2dImmutable(value);} - public static Vec2d newVec(double x, double y){return new Vec2dImmutable(x, y);} - public static Vec2d newVec(Vec2d value){return newVec(value.getX(), value.getY());} + public static Vec2d of(){return new Vec2dImmutable();} + public static Vec2d of(double value){return new Vec2dImmutable(value);} + public static Vec2d of(double x, double y){return new Vec2dImmutable(x, y);} + public static Vec2d of(Vec2d value){return of(value.getX(), value.getY());} public double getX(); public double getY(); @@ -165,23 +165,23 @@ public interface Vec2d extends Vecd return set(buffer.get(), buffer.get()); } @Override - public default Vec2b asByte(){return isMutable() ? Vec2b.newMutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY())) : Vec2b.newVec((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()));} + public default Vec2b asByte(){return isMutable() ? Vec2b.mutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY())) : Vec2b.of((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()));} @Override - public default Vec2s asShort(){return isMutable() ? Vec2s.newMutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY())) : Vec2s.newVec((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()));} + public default Vec2s asShort(){return isMutable() ? Vec2s.mutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY())) : Vec2s.of((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()));} @Override - public default Vec2i asInt(){return isMutable() ? Vec2i.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2i.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()));} + public default Vec2i asInt(){return isMutable() ? Vec2i.mutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2i.of(MathUtils.floor(getX()), MathUtils.floor(getY()));} @Override - public default Vec2l asLong() {return isMutable() ? Vec2l.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2l.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()));} + public default Vec2l asLong() {return isMutable() ? Vec2l.mutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2l.of(MathUtils.floor(getX()), MathUtils.floor(getY()));} @Override - public default Vec2f asFloat(){return isMutable() ? Vec2f.newMutable((float)getX(), (float)getY()) : Vec2f.newVec((float)getX(), (float)getY());} + public default Vec2f asFloat(){return isMutable() ? Vec2f.mutable((float)getX(), (float)getY()) : Vec2f.of((float)getX(), (float)getY());} @Override - public default Vec2d asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec2d asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec2d asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec2d asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec2d copyAsMutable(){return newMutable(this);} + public default Vec2d copyAsMutable(){return mutable(this);} @Override - public default Vec2d copyAsImmutable(){return newVec(this);} + public default Vec2d copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dImmutable.java index 210e961..1411133 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dImmutable.java @@ -46,25 +46,25 @@ public class Vec2dImmutable implements Vec2d @Override public Vec2d setX(double x) { - return this.x == x ? this : Vec2d.newVec(x, y); + return this.x == x ? this : Vec2d.of(x, y); } @Override public Vec2d setY(double y) { - return this.y == y ? this : Vec2d.newVec(x, y); + return this.y == y ? this : Vec2d.of(x, y); } @Override public Vec2d copy() { - return Vec2d.newVec(this); + return Vec2d.of(this); } @Override public Vec2d set(double x, double y) { - return this.x == x && this.y == y ? this : Vec2d.newVec(x, y); + return this.x == x && this.y == y ? this : Vec2d.of(x, y); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dMutable.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dMutable.java index 0e2c107..9621f53 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec2dMutable.java @@ -60,7 +60,7 @@ public class Vec2dMutable implements Vec2d @Override public Vec2d copy() { - return Vec2d.newMutable(this); + return Vec2d.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3d.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3d.java index 95c9652..9671523 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3d.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3d.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s; public interface Vec3d extends Vecd { - public static final Vec3d ZERO = newVec(); - public static final Vec3d MINUS_ONE = newVec(-1D); - public static final Vec3d ONE = newVec(1D); + public static final Vec3d ZERO = of(); + public static final Vec3d MINUS_ONE = of(-1D); + public static final Vec3d ONE = of(1D); - public static Vec3d newMutable(){return new Vec3dMutable();} - public static Vec3d newMutable(double value){return new Vec3dMutable(value);} - public static Vec3d newMutable(double x, double y, double z){return new Vec3dMutable(x, y, z);} - public static Vec3d newMutable(Vec3d vec){return newMutable(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3d mutable(){return new Vec3dMutable();} + public static Vec3d mutable(double value){return new Vec3dMutable(value);} + public static Vec3d mutable(double x, double y, double z){return new Vec3dMutable(x, y, z);} + public static Vec3d mutable(Vec3d vec){return mutable(vec.getX(), vec.getY(), vec.getZ());} - public static Vec3d newVec(){return new Vec3dImmutable();} - public static Vec3d newVec(double value){return new Vec3dImmutable(value);} - public static Vec3d newVec(double x, double y, double z){return new Vec3dImmutable(x, y, z);} - public static Vec3d newVec(Vec3d vec){return newVec(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3d of(){return new Vec3dImmutable();} + public static Vec3d of(double value){return new Vec3dImmutable(value);} + public static Vec3d of(double x, double y, double z){return new Vec3dImmutable(x, y, z);} + public static Vec3d of(Vec3d vec){return of(vec.getX(), vec.getY(), vec.getZ());} public double getX(); public double getY(); @@ -220,22 +220,22 @@ public interface Vec3d extends Vecd } @Override - public default Vec3b asByte(){return isMutable() ? Vec3b.newMutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ())) : Vec3b.newVec((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()));} + public default Vec3b asByte(){return isMutable() ? Vec3b.mutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ())) : Vec3b.of((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()));} @Override - public default Vec3s asShort(){return isMutable() ? Vec3s.newMutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ())) : Vec3s.newVec((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()));} + public default Vec3s asShort(){return isMutable() ? Vec3s.mutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ())) : Vec3s.of((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()));} @Override - public default Vec3i asInt(){return isMutable() ? Vec3i.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3i.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} + public default Vec3i asInt(){return isMutable() ? Vec3i.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3i.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} @Override - public default Vec3l asLong() {return isMutable() ? Vec3l.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3l.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} + public default Vec3l asLong() {return isMutable() ? Vec3l.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3l.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} @Override - public default Vec3f asFloat(){return isMutable() ? Vec3f.newMutable((float)getX(), (float)getY(), (float)getZ()) : Vec3f.newVec((float)getX(), (float)getY(), (float)getZ());} + public default Vec3f asFloat(){return isMutable() ? Vec3f.mutable((float)getX(), (float)getY(), (float)getZ()) : Vec3f.of((float)getX(), (float)getY(), (float)getZ());} @Override - public default Vec3d asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec3d asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec3d asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec3d asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec3d copyAsMutable(){return newMutable(this);} + public default Vec3d copyAsMutable(){return mutable(this);} @Override - public default Vec3d copyAsImmutable(){return newVec(this);} + public default Vec3d copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dImmutable.java index c99b341..bf4a24d 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dImmutable.java @@ -56,31 +56,31 @@ public class Vec3dImmutable implements Vec3d @Override public Vec3d setX(double x) { - return this.x == x ? this : Vec3d.newVec(x, y, z); + return this.x == x ? this : Vec3d.of(x, y, z); } @Override public Vec3d setY(double y) { - return this.y == y ? this : Vec3d.newVec(x, y, z); + return this.y == y ? this : Vec3d.of(x, y, z); } @Override public Vec3d setZ(double z) { - return this.z == z ? this : Vec3d.newVec(x, y, z); + return this.z == z ? this : Vec3d.of(x, y, z); } @Override public Vec3d copy() { - return Vec3d.newVec(this); + return Vec3d.of(this); } @Override public Vec3d set(double x, double y, double z) { - return this.x == x && this.y == y && this.z == z ? this : Vec3d.newVec(x, y, z); + return this.x == x && this.y == y && this.z == z ? this : Vec3d.of(x, y, z); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dMutable.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dMutable.java index 34a929b..580ad99 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec3dMutable.java @@ -77,7 +77,7 @@ public class Vec3dMutable implements Vec3d @Override public Vec3d copy() { - return Vec3d.newMutable(this); + return Vec3d.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4d.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4d.java index 6025d44..308e29e 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4d.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4d.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s; public interface Vec4d extends Vecd { - public static final Vec4d ZERO = newVec(); - public static final Vec4d MINUS_ONE = newVec(-1D); - public static final Vec4d ONE = newVec(1D); + public static final Vec4d ZERO = of(); + public static final Vec4d MINUS_ONE = of(-1D); + public static final Vec4d ONE = of(1D); - public static Vec4d newMutable(){return new Vec4dMutable();} - public static Vec4d newMutable(double value){return new Vec4dMutable(value);} - public static Vec4d newMutable(double x, double y, double z, double w){return new Vec4dMutable(x, y, z, w);} - public static Vec4d newMutable(Vec4d vec){return newMutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4d mutable(){return new Vec4dMutable();} + public static Vec4d mutable(double value){return new Vec4dMutable(value);} + public static Vec4d mutable(double x, double y, double z, double w){return new Vec4dMutable(x, y, z, w);} + public static Vec4d mutable(Vec4d vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} - public static Vec4d newVec(){return new Vec4dImmutable();} - public static Vec4d newVec(double value){return new Vec4dImmutable(value);} - public static Vec4d newVec(double x, double y, double z, double w){return new Vec4dImmutable(x, y, z, w);} - public static Vec4d newVec(Vec4d vec){return newVec(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4d of(){return new Vec4dImmutable();} + public static Vec4d of(double value){return new Vec4dImmutable(value);} + public static Vec4d of(double x, double y, double z, double w){return new Vec4dImmutable(x, y, z, w);} + public static Vec4d of(Vec4d vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} public double getX(); public double getY(); @@ -210,22 +210,22 @@ public interface Vec4d extends Vecd } @Override - public default Vec4b asByte(){return isMutable() ? Vec4b.newMutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW())) : Vec4b.newVec((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW()));} + public default Vec4b asByte(){return isMutable() ? Vec4b.mutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW())) : Vec4b.of((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW()));} @Override - public default Vec4s asShort(){return isMutable() ? Vec4s.newMutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW())) : Vec4s.newVec((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW()));} + public default Vec4s asShort(){return isMutable() ? Vec4s.mutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW())) : Vec4s.of((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW()));} @Override - public default Vec4i asInt(){return isMutable() ? Vec4i.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4i.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} + public default Vec4i asInt(){return isMutable() ? Vec4i.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4i.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} @Override - public default Vec4l asLong() {return isMutable() ? Vec4l.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4l.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} + public default Vec4l asLong() {return isMutable() ? Vec4l.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4l.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} @Override - public default Vec4f asFloat(){return isMutable() ? Vec4f.newMutable((float)getX(), (float)getY(), (float)getZ(), (float)getW()) : Vec4f.newVec((float)getX(), (float)getY(), (float)getZ(), (float)getW());} + public default Vec4f asFloat(){return isMutable() ? Vec4f.mutable((float)getX(), (float)getY(), (float)getZ(), (float)getW()) : Vec4f.of((float)getX(), (float)getY(), (float)getZ(), (float)getW());} @Override - public default Vec4d asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec4d asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec4d asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec4d asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec4d copyAsMutable(){return newMutable(this);} + public default Vec4d copyAsMutable(){return mutable(this);} @Override - public default Vec4d copyAsImmutable(){return newVec(this);} + public default Vec4d copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dImmutable.java index cb6c1ac..ab3ca95 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dImmutable.java @@ -66,37 +66,37 @@ public class Vec4dImmutable implements Vec4d @Override public Vec4d setX(double x) { - return this.x == x ? this : Vec4d.newVec(x, y, z, w); + return this.x == x ? this : Vec4d.of(x, y, z, w); } @Override public Vec4d setY(double y) { - return this.y == y ? this : Vec4d.newVec(x, y, z, w); + return this.y == y ? this : Vec4d.of(x, y, z, w); } @Override public Vec4d setZ(double z) { - return this.z == z ? this : Vec4d.newVec(x, y, z, w); + return this.z == z ? this : Vec4d.of(x, y, z, w); } @Override public Vec4d setW(double w) { - return this.w == w ? this : Vec4d.newVec(x, y, z, w); + return this.w == w ? this : Vec4d.of(x, y, z, w); } @Override public Vec4d copy() { - return Vec4d.newVec(this); + return Vec4d.of(this); } @Override public Vec4d set(double x, double y, double z, double w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4d.newVec(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4d.of(x, y, z, w); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dMutable.java b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dMutable.java index c38cfd2..ecf6d9d 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/doubles/Vec4dMutable.java @@ -90,7 +90,7 @@ public class Vec4dMutable implements Vec4d @Override public Vec4d copy() { - return Vec4d.newMutable(this); + return Vec4d.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2f.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2f.java index 1d7e1b3..eb7cf0a 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2f.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2f.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s; public interface Vec2f extends Vecf { - public static final Vec2f ZERO = newVec(); - public static final Vec2f MINUS_ONE = newVec(-1F); - public static final Vec2f ONE = newVec(1F); + public static final Vec2f ZERO = of(); + public static final Vec2f MINUS_ONE = of(-1F); + public static final Vec2f ONE = of(1F); - public static Vec2f newMutable(){return new Vec2fMutable();} - public static Vec2f newMutable(float value){return new Vec2fMutable(value);} - public static Vec2f newMutable(float x, float y){return new Vec2fMutable(x, y);} - public static Vec2f newMutable(Vec2f value){return newMutable(value.getX(), value.getY());} + public static Vec2f mutable(){return new Vec2fMutable();} + public static Vec2f mutable(float value){return new Vec2fMutable(value);} + public static Vec2f mutable(float x, float y){return new Vec2fMutable(x, y);} + public static Vec2f mutable(Vec2f value){return mutable(value.getX(), value.getY());} - public static Vec2f newVec(){return new Vec2fImmutable();} - public static Vec2f newVec(float value){return new Vec2fImmutable(value);} - public static Vec2f newVec(float x, float y){return new Vec2fImmutable(x, y);} - public static Vec2f newVec(Vec2f value){return newVec(value.getX(), value.getY());} + public static Vec2f of(){return new Vec2fImmutable();} + public static Vec2f of(float value){return new Vec2fImmutable(value);} + public static Vec2f of(float x, float y){return new Vec2fImmutable(x, y);} + public static Vec2f of(Vec2f value){return of(value.getX(), value.getY());} public float getX(); public float getY(); @@ -165,23 +165,23 @@ public interface Vec2f extends Vecf return set(buffer.get(), buffer.get()); } @Override - public default Vec2b asByte(){return isMutable() ? Vec2b.newMutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY())) : Vec2b.newVec((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()));} + public default Vec2b asByte(){return isMutable() ? Vec2b.mutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY())) : Vec2b.of((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()));} @Override - public default Vec2s asShort(){return isMutable() ? Vec2s.newMutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY())) : Vec2s.newVec((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()));} + public default Vec2s asShort(){return isMutable() ? Vec2s.mutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY())) : Vec2s.of((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()));} @Override - public default Vec2i asInt(){return isMutable() ? Vec2i.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2i.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()));} + public default Vec2i asInt(){return isMutable() ? Vec2i.mutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2i.of(MathUtils.floor(getX()), MathUtils.floor(getY()));} @Override - public default Vec2l asLong() {return isMutable() ? Vec2l.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2l.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()));} + public default Vec2l asLong() {return isMutable() ? Vec2l.mutable(MathUtils.floor(getX()), MathUtils.floor(getY())) : Vec2l.of(MathUtils.floor(getX()), MathUtils.floor(getY()));} @Override - public default Vec2d asDouble(){return isMutable() ? Vec2d.newMutable(getX(), getY()) : Vec2d.newVec(getX(), getY());} + public default Vec2d asDouble(){return isMutable() ? Vec2d.mutable(getX(), getY()) : Vec2d.of(getX(), getY());} @Override - public default Vec2f asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec2f asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec2f asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec2f asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec2f copyAsMutable(){return newMutable(this);} + public default Vec2f copyAsMutable(){return mutable(this);} @Override - public default Vec2f copyAsImmutable(){return newVec(this);} + public default Vec2f copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fImmutable.java index 92dd3e9..27f873b 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fImmutable.java @@ -46,25 +46,25 @@ public class Vec2fImmutable implements Vec2f @Override public Vec2f setX(float x) { - return this.x == x ? this : Vec2f.newVec(x, y); + return this.x == x ? this : Vec2f.of(x, y); } @Override public Vec2f setY(float y) { - return this.y == y ? this : Vec2f.newVec(x, y); + return this.y == y ? this : Vec2f.of(x, y); } @Override public Vec2f copy() { - return Vec2f.newVec(x, y); + return Vec2f.of(x, y); } @Override public Vec2f set(float x, float y) { - return this.x == x && this.y == y ? this : Vec2f.newVec(x, y); + return this.x == x && this.y == y ? this : Vec2f.of(x, y); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fMutable.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fMutable.java index 554a2a2..c02022e 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec2fMutable.java @@ -58,7 +58,7 @@ public class Vec2fMutable implements Vec2f @Override public Vec2f copy() { - return Vec2f.newMutable(this); + return Vec2f.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3f.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3f.java index 19e96ae..99f89bd 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3f.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3f.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s; public interface Vec3f extends Vecf { - public static final Vec3f ZERO = newVec(); - public static final Vec3f MINUS_ONE = newVec(-1F); - public static final Vec3f ONE = newVec(1F); + public static final Vec3f ZERO = of(); + public static final Vec3f MINUS_ONE = of(-1F); + public static final Vec3f ONE = of(1F); - public static Vec3f newMutable(){return new Vec3fMutable();} - public static Vec3f newMutable(float value){return new Vec3fMutable(value);} - public static Vec3f newMutable(float x, float y, float z){return new Vec3fMutable(x, y, z);} - public static Vec3f newMutable(Vec3f vec){return newMutable(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3f mutable(){return new Vec3fMutable();} + public static Vec3f mutable(float value){return new Vec3fMutable(value);} + public static Vec3f mutable(float x, float y, float z){return new Vec3fMutable(x, y, z);} + public static Vec3f mutable(Vec3f vec){return mutable(vec.getX(), vec.getY(), vec.getZ());} - public static Vec3f newVec(){return new Vec3fImmutable();} - public static Vec3f newVec(float value){return new Vec3fImmutable(value);} - public static Vec3f newVec(float x, float y, float z){return new Vec3fImmutable(x, y, z);} - public static Vec3f newVec(Vec3f vec){return newVec(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3f of(){return new Vec3fImmutable();} + public static Vec3f of(float value){return new Vec3fImmutable(value);} + public static Vec3f of(float x, float y, float z){return new Vec3fImmutable(x, y, z);} + public static Vec3f of(Vec3f vec){return of(vec.getX(), vec.getY(), vec.getZ());} public float getX(); public float getY(); @@ -220,23 +220,23 @@ public interface Vec3f extends Vecf } @Override - public default Vec3b asByte(){return isMutable() ? Vec3b.newMutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ())) : Vec3b.newVec((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()));} + public default Vec3b asByte(){return isMutable() ? Vec3b.mutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ())) : Vec3b.of((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()));} @Override - public default Vec3s asShort(){return isMutable() ? Vec3s.newMutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ())) : Vec3s.newVec((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()));} + public default Vec3s asShort(){return isMutable() ? Vec3s.mutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ())) : Vec3s.of((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()));} @Override - public default Vec3i asInt(){return isMutable() ? Vec3i.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3i.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} + public default Vec3i asInt(){return isMutable() ? Vec3i.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3i.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} @Override - public default Vec3l asLong() {return isMutable() ? Vec3l.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3l.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} + public default Vec3l asLong() {return isMutable() ? Vec3l.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ())) : Vec3l.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()));} @Override - public default Vec3d asDouble(){return isMutable() ? Vec3d.newMutable(getX(), getY(), getZ()) : Vec3d.newVec(getX(), getY(), getZ());} + public default Vec3d asDouble(){return isMutable() ? Vec3d.mutable(getX(), getY(), getZ()) : Vec3d.of(getX(), getY(), getZ());} @Override - public default Vec3f asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec3f asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec3f asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec3f asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec3f copyAsMutable(){return newMutable(this);} + public default Vec3f copyAsMutable(){return mutable(this);} @Override - public default Vec3f copyAsImmutable(){return newVec(this);} + public default Vec3f copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fImmutable.java index e0886ad..d18953f 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fImmutable.java @@ -56,31 +56,31 @@ public class Vec3fImmutable implements Vec3f @Override public Vec3f setX(float x) { - return this.x == x ? this : Vec3f.newVec(x, y, z); + return this.x == x ? this : Vec3f.of(x, y, z); } @Override public Vec3f setY(float y) { - return this.y == y ? this : Vec3f.newVec(x, y, z); + return this.y == y ? this : Vec3f.of(x, y, z); } @Override public Vec3f setZ(float z) { - return this.z == z ? this : Vec3f.newVec(x, y, z); + return this.z == z ? this : Vec3f.of(x, y, z); } @Override public Vec3f copy() { - return Vec3f.newVec(this); + return Vec3f.of(this); } @Override public Vec3f set(float x, float y, float z) { - return this.x == x && this.y == y && this.z == z ? this : Vec3f.newVec(x, y, z); + return this.x == x && this.y == y && this.z == z ? this : Vec3f.of(x, y, z); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fMutable.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fMutable.java index 522a2da..06a0363 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec3fMutable.java @@ -74,7 +74,7 @@ public class Vec3fMutable implements Vec3f @Override public Vec3f copy() { - return Vec3f.newMutable(this); + return Vec3f.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4f.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4f.java index 4086764..15d4794 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4f.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4f.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s; public interface Vec4f extends Vecf { - public static final Vec4f ZERO = newVec(); - public static final Vec4f MINUS_ONE = newVec(-1F); - public static final Vec4f ONE = newVec(1F); + public static final Vec4f ZERO = of(); + public static final Vec4f MINUS_ONE = of(-1F); + public static final Vec4f ONE = of(1F); - public static Vec4f newMutable(){return new Vec4fMutable();} - public static Vec4f newMutable(float value){return new Vec4fMutable(value);} - public static Vec4f newMutable(float x, float y, float z, float w){return new Vec4fMutable(x, y, z, w);} - public static Vec4f newMutable(Vec4f vec){return newMutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4f mutable(){return new Vec4fMutable();} + public static Vec4f mutable(float value){return new Vec4fMutable(value);} + public static Vec4f mutable(float x, float y, float z, float w){return new Vec4fMutable(x, y, z, w);} + public static Vec4f mutable(Vec4f vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} - public static Vec4f newVec(){return new Vec4fImmutable();} - public static Vec4f newVec(float value){return new Vec4fImmutable(value);} - public static Vec4f newVec(float x, float y, float z, float w){return new Vec4fImmutable(x, y, z, w);} - public static Vec4f newVec(Vec4f vec){return newVec(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4f of(){return new Vec4fImmutable();} + public static Vec4f of(float value){return new Vec4fImmutable(value);} + public static Vec4f of(float x, float y, float z, float w){return new Vec4fImmutable(x, y, z, w);} + public static Vec4f of(Vec4f vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} public float getX(); public float getY(); @@ -210,23 +210,23 @@ public interface Vec4f extends Vecf } @Override - public default Vec4b asByte(){return isMutable() ? Vec4b.newMutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW())) : Vec4b.newVec((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW()));} + public default Vec4b asByte(){return isMutable() ? Vec4b.mutable((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW())) : Vec4b.of((byte)MathUtils.floor(getX()), (byte)MathUtils.floor(getY()), (byte)MathUtils.floor(getZ()), (byte)MathUtils.floor(getW()));} @Override - public default Vec4s asShort(){return isMutable() ? Vec4s.newMutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW())) : Vec4s.newVec((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW()));} + public default Vec4s asShort(){return isMutable() ? Vec4s.mutable((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW())) : Vec4s.of((short)MathUtils.floor(getX()), (short)MathUtils.floor(getY()), (short)MathUtils.floor(getZ()), (short)MathUtils.floor(getW()));} @Override - public default Vec4i asInt(){return isMutable() ? Vec4i.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4i.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} + public default Vec4i asInt(){return isMutable() ? Vec4i.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4i.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} @Override - public default Vec4l asLong() {return isMutable() ? Vec4l.newMutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4l.newVec(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} + public default Vec4l asLong() {return isMutable() ? Vec4l.mutable(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW())) : Vec4l.of(MathUtils.floor(getX()), MathUtils.floor(getY()), MathUtils.floor(getZ()), MathUtils.floor(getW()));} @Override - public default Vec4d asDouble(){return isMutable() ? Vec4d.newMutable(getX(), getY(), getZ(), getW()) : Vec4d.newVec(getX(), getY(), getZ(), getW());} + public default Vec4d asDouble(){return isMutable() ? Vec4d.mutable(getX(), getY(), getZ(), getW()) : Vec4d.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4f asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec4f asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec4f asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec4f asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec4f copyAsMutable(){return newMutable(this);} + public default Vec4f copyAsMutable(){return mutable(this);} @Override - public default Vec4f copyAsImmutable(){return newVec(this);} + public default Vec4f copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fImmutable.java index e272831..d8cb922 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fImmutable.java @@ -66,37 +66,37 @@ public class Vec4fImmutable implements Vec4f @Override public Vec4f setX(float x) { - return this.x == x ? this : Vec4f.newVec(x, y, z, w); + return this.x == x ? this : Vec4f.of(x, y, z, w); } @Override public Vec4f setY(float y) { - return this.y == y ? this : Vec4f.newVec(x, y, z, w); + return this.y == y ? this : Vec4f.of(x, y, z, w); } @Override public Vec4f setZ(float z) { - return this.z == z ? this : Vec4f.newVec(x, y, z, w); + return this.z == z ? this : Vec4f.of(x, y, z, w); } @Override public Vec4f setW(float w) { - return this.w == w ? this : Vec4f.newVec(x, y, z, w); + return this.w == w ? this : Vec4f.of(x, y, z, w); } @Override public Vec4f copy() { - return Vec4f.newVec(this); + return Vec4f.of(this); } @Override public Vec4f set(float x, float y, float z, float w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4f.newVec(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4f.of(x, y, z, w); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fMutable.java b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fMutable.java index e1b5215..aaf15bb 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/floats/Vec4fMutable.java @@ -94,7 +94,7 @@ public class Vec4fMutable implements Vec4f @Override public Vec4f copy() { - return Vec4f.newMutable(this); + return Vec4f.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2i.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2i.java index 491bcb0..e1bf736 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2i.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2i.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s; public interface Vec2i extends Veci { - public static final Vec2i ZERO = newVec(); - public static final Vec2i MINUS_ONE = newVec(-1); - public static final Vec2i ONE = newVec(1); + public static final Vec2i ZERO = of(); + public static final Vec2i MINUS_ONE = of(-1); + public static final Vec2i ONE = of(1); - public static Vec2i newMutable(){return new Vec2iMutable();} - public static Vec2i newMutable(int value){return new Vec2iMutable(value);} - public static Vec2i newMutable(int x, int y){return new Vec2iMutable(x, y);} - public static Vec2i newMutable(Vec2i value){return newMutable(value.getX(), value.getY());} + public static Vec2i mutable(){return new Vec2iMutable();} + public static Vec2i mutable(int value){return new Vec2iMutable(value);} + public static Vec2i mutable(int x, int y){return new Vec2iMutable(x, y);} + public static Vec2i mutable(Vec2i value){return mutable(value.getX(), value.getY());} - public static Vec2i newVec(){return new Vec2iImmutable();} - public static Vec2i newVec(int value){return new Vec2iImmutable(value);} - public static Vec2i newVec(int x, int y){return new Vec2iImmutable(x, y);} - public static Vec2i newVec(Vec2i value){return newVec(value.getX(), value.getY());} + public static Vec2i of(){return new Vec2iImmutable();} + public static Vec2i of(int value){return new Vec2iImmutable(value);} + public static Vec2i of(int x, int y){return new Vec2iImmutable(x, y);} + public static Vec2i of(Vec2i value){return of(value.getX(), value.getY());} public int getX(); public int getY(); @@ -141,23 +141,23 @@ public interface Vec2i extends Veci } @Override - public default Vec2b asByte(){return isMutable() ? Vec2b.newMutable((byte)getX(), (byte)getY()) : Vec2b.newVec((byte)getX(), (byte)getY());} + public default Vec2b asByte(){return isMutable() ? Vec2b.mutable((byte)getX(), (byte)getY()) : Vec2b.of((byte)getX(), (byte)getY());} @Override - public default Vec2s asShort(){return isMutable() ? Vec2s.newMutable((short)getX(), (short)getY()) : Vec2s.newVec((short)getX(), (short)getY());} + public default Vec2s asShort(){return isMutable() ? Vec2s.mutable((short)getX(), (short)getY()) : Vec2s.of((short)getX(), (short)getY());} @Override - public default Vec2l asLong(){return isMutable() ? Vec2l.newMutable(getX(), getY()) : Vec2l.newVec(getX(), getY());} + public default Vec2l asLong(){return isMutable() ? Vec2l.mutable(getX(), getY()) : Vec2l.of(getX(), getY());} @Override - public default Vec2f asFloat() {return isMutable() ? Vec2f.newMutable(getX(), getY()) : Vec2f.newVec(getX(), getY());} + public default Vec2f asFloat() {return isMutable() ? Vec2f.mutable(getX(), getY()) : Vec2f.of(getX(), getY());} @Override - public default Vec2d asDouble(){return isMutable() ? Vec2d.newMutable(getX(), getY()) : Vec2d.newVec(getX(), getY());} + public default Vec2d asDouble(){return isMutable() ? Vec2d.mutable(getX(), getY()) : Vec2d.of(getX(), getY());} @Override - public default Vec2i asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec2i asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec2i asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec2i asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec2i copyAsMutable(){return newMutable(this);} + public default Vec2i copyAsMutable(){return mutable(this);} @Override - public default Vec2i copyAsImmutable(){return newVec(this);} + public default Vec2i copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iImmutable.java index 1435978..5b3c00c 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iImmutable.java @@ -46,25 +46,25 @@ public class Vec2iImmutable implements Vec2i @Override public Vec2i setX(int x) { - return this.x == x ? this : Vec2i.newVec(x, y); + return this.x == x ? this : Vec2i.of(x, y); } @Override public Vec2i setY(int y) { - return this.y == y ? this : Vec2i.newVec(x, y); + return this.y == y ? this : Vec2i.of(x, y); } @Override public Vec2i copy() { - return Vec2i.newVec(this); + return Vec2i.of(this); } @Override public Vec2i set(int x, int y) { - return this.x == x && this.y == y ? this : Vec2i.newVec(x, y); + return this.x == x && this.y == y ? this : Vec2i.of(x, y); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iMutable.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iMutable.java index d21e5f7..752b04a 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec2iMutable.java @@ -58,7 +58,7 @@ public class Vec2iMutable implements Vec2i @Override public Vec2i copy() { - return Vec2i.newMutable(this); + return Vec2i.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3i.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3i.java index 4b8a3cf..fef07d8 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3i.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3i.java @@ -13,19 +13,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s; public interface Vec3i extends Veci { - public static final Vec3i ZERO = newVec(); - public static final Vec3i MINUS_ONE = newVec(-1); - public static final Vec3i ONE = newVec(1); + public static final Vec3i ZERO = of(); + public static final Vec3i MINUS_ONE = of(-1); + public static final Vec3i ONE = of(1); - public static Vec3i newMutable(){return new Vec3iMutable();} - public static Vec3i newMutable(int value){return new Vec3iMutable(value);} - public static Vec3i newMutable(int x, int y, int z){return new Vec3iMutable(x, y, z);} - public static Vec3i newMutable(Vec3i vec){return newMutable(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3i mutable(){return new Vec3iMutable();} + public static Vec3i mutable(int value){return new Vec3iMutable(value);} + public static Vec3i mutable(int x, int y, int z){return new Vec3iMutable(x, y, z);} + public static Vec3i mutable(Vec3i vec){return mutable(vec.getX(), vec.getY(), vec.getZ());} - public static Vec3i newVec(){return new Vec3iImmutable();} - public static Vec3i newVec(int value){return new Vec3iImmutable(value);} - public static Vec3i newVec(int x, int y, int z){return new Vec3iImmutable(x, y, z);} - public static Vec3i newVec(Vec3i vec){return newVec(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3i of(){return new Vec3iImmutable();} + public static Vec3i of(int value){return new Vec3iImmutable(value);} + public static Vec3i of(int x, int y, int z){return new Vec3iImmutable(x, y, z);} + public static Vec3i of(Vec3i vec){return of(vec.getX(), vec.getY(), vec.getZ());} public int getX(); public int getY(); @@ -135,23 +135,23 @@ public interface Vec3i extends Veci } @Override - public default Vec3b asByte(){return isMutable() ? Vec3b.newMutable((byte)getX(), (byte)getY(), (byte)getZ()) : Vec3b.newVec((byte)getX(), (byte)getY(), (byte)getZ());} + public default Vec3b asByte(){return isMutable() ? Vec3b.mutable((byte)getX(), (byte)getY(), (byte)getZ()) : Vec3b.of((byte)getX(), (byte)getY(), (byte)getZ());} @Override - public default Vec3s asShort(){return isMutable() ? Vec3s.newMutable((short)getX(), (short)getY(), (short)getZ()) : Vec3s.newVec((short)getX(), (short)getY(), (short)getZ());} + public default Vec3s asShort(){return isMutable() ? Vec3s.mutable((short)getX(), (short)getY(), (short)getZ()) : Vec3s.of((short)getX(), (short)getY(), (short)getZ());} @Override - public default Vec3l asLong(){return isMutable() ? Vec3l.newMutable(getX(), getY(), getZ()) : Vec3l.newVec(getX(), getY(), getZ());} + public default Vec3l asLong(){return isMutable() ? Vec3l.mutable(getX(), getY(), getZ()) : Vec3l.of(getX(), getY(), getZ());} @Override - public default Vec3f asFloat() {return isMutable() ? Vec3f.newMutable(getX(), getY(), getZ()) : Vec3f.newVec(getX(), getY(), getZ());} + public default Vec3f asFloat() {return isMutable() ? Vec3f.mutable(getX(), getY(), getZ()) : Vec3f.of(getX(), getY(), getZ());} @Override - public default Vec3d asDouble(){return isMutable() ? Vec3d.newMutable(getX(), getY(), getZ()) : Vec3d.newVec(getX(), getY(), getZ());} + public default Vec3d asDouble(){return isMutable() ? Vec3d.mutable(getX(), getY(), getZ()) : Vec3d.of(getX(), getY(), getZ());} @Override - public default Vec3i asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec3i asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec3i asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec3i asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec3i copyAsMutable(){return newMutable(this);} + public default Vec3i copyAsMutable(){return mutable(this);} @Override - public default Vec3i copyAsImmutable(){return newVec(this);} + public default Vec3i copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iImmutable.java index 09299ff..1645cd4 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iImmutable.java @@ -56,31 +56,31 @@ public class Vec3iImmutable implements Vec3i @Override public Vec3i setX(int x) { - return this.x == x ? this : Vec3i.newVec(x, y, z); + return this.x == x ? this : Vec3i.of(x, y, z); } @Override public Vec3i setY(int y) { - return this.y == y ? this : Vec3i.newVec(x, y, z); + return this.y == y ? this : Vec3i.of(x, y, z); } @Override public Vec3i setZ(int z) { - return this.z == z ? this : Vec3i.newVec(x, y, z); + return this.z == z ? this : Vec3i.of(x, y, z); } @Override public Vec3i copy() { - return Vec3i.newVec(this); + return Vec3i.of(this); } @Override public Vec3i set(int x, int y, int z) { - return this.x == x && this.y == y && this.z == z ? this : Vec3i.newVec(x, y, z); + return this.x == x && this.y == y && this.z == z ? this : Vec3i.of(x, y, z); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iMutable.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iMutable.java index 1aebf3d..cc8d1d5 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec3iMutable.java @@ -74,7 +74,7 @@ public class Vec3iMutable implements Vec3i @Override public Vec3i copy() { - return Vec3i.newMutable(this); + return Vec3i.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4i.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4i.java index cd9f345..5a40a2d 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4i.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4i.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s; public interface Vec4i extends Veci { - public static final Vec4i ZERO = newVec(); - public static final Vec4i MINUS_ONE = newVec(-1); - public static final Vec4i ONE = newVec(1); + public static final Vec4i ZERO = of(); + public static final Vec4i MINUS_ONE = of(-1); + public static final Vec4i ONE = of(1); - public static Vec4i newMutable(){return new Vec4iMutable();} - public static Vec4i newMutable(int value){return new Vec4iMutable(value);} - public static Vec4i newMutable(int x, int y, int z, int w){return new Vec4iMutable(x, y, z, w);} - public static Vec4i newMutable(Vec4i vec){return newMutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4i mutable(){return new Vec4iMutable();} + public static Vec4i mutable(int value){return new Vec4iMutable(value);} + public static Vec4i mutable(int x, int y, int z, int w){return new Vec4iMutable(x, y, z, w);} + public static Vec4i mutable(Vec4i vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} - public static Vec4i newVec(){return new Vec4iImmutable();} - public static Vec4i newVec(int value){return new Vec4iImmutable(value);} - public static Vec4i newVec(int x, int y, int z, int w){return new Vec4iImmutable(x, y, z, w);} - public static Vec4i newVec(Vec4i vec){return newVec(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4i of(){return new Vec4iImmutable();} + public static Vec4i of(int value){return new Vec4iImmutable(value);} + public static Vec4i of(int x, int y, int z, int w){return new Vec4iImmutable(x, y, z, w);} + public static Vec4i of(Vec4i vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} public int getX(); public int getY(); @@ -137,22 +137,22 @@ public interface Vec4i extends Veci } @Override - public default Vec4b asByte(){return isMutable() ? Vec4b.newMutable((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW()) : Vec4b.newVec((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW());} + public default Vec4b asByte(){return isMutable() ? Vec4b.mutable((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW()) : Vec4b.of((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW());} @Override - public default Vec4s asShort(){return isMutable() ? Vec4s.newMutable((short)getX(), (short)getY(), (short)getZ(), (short)getW()) : Vec4s.newVec((short)getX(), (short)getY(), (short)getZ(), (short)getW());} + public default Vec4s asShort(){return isMutable() ? Vec4s.mutable((short)getX(), (short)getY(), (short)getZ(), (short)getW()) : Vec4s.of((short)getX(), (short)getY(), (short)getZ(), (short)getW());} @Override - public default Vec4l asLong(){return isMutable() ? Vec4l.newMutable(getX(), getY(), getZ(), getW()) : Vec4l.newVec(getX(), getY(), getZ(), getW());} + public default Vec4l asLong(){return isMutable() ? Vec4l.mutable(getX(), getY(), getZ(), getW()) : Vec4l.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4f asFloat() {return isMutable() ? Vec4f.newMutable(getX(), getY(), getZ(), getW()) : Vec4f.newVec(getX(), getY(), getZ(), getW());} + public default Vec4f asFloat() {return isMutable() ? Vec4f.mutable(getX(), getY(), getZ(), getW()) : Vec4f.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4d asDouble(){return isMutable() ? Vec4d.newMutable(getX(), getY(), getZ(), getW()) : Vec4d.newVec(getX(), getY(), getZ(), getW());} + public default Vec4d asDouble(){return isMutable() ? Vec4d.mutable(getX(), getY(), getZ(), getW()) : Vec4d.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4i asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec4i asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec4i asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec4i asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec4i copyAsMutable(){return newMutable(this);} + public default Vec4i copyAsMutable(){return mutable(this);} @Override - public default Vec4i copyAsImmutable(){return newVec(this);} + public default Vec4i copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iImmutable.java index 1d03c74..6db9633 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iImmutable.java @@ -66,37 +66,37 @@ public class Vec4iImmutable implements Vec4i @Override public Vec4i setX(int x) { - return this.x == x ? this : Vec4i.newVec(x, y, z, w); + return this.x == x ? this : Vec4i.of(x, y, z, w); } @Override public Vec4i setY(int y) { - return this.y == y ? this : Vec4i.newVec(x, y, z, w); + return this.y == y ? this : Vec4i.of(x, y, z, w); } @Override public Vec4i setZ(int z) { - return this.z == z ? this : Vec4i.newVec(x, y, z, w); + return this.z == z ? this : Vec4i.of(x, y, z, w); } @Override public Vec4i setW(int w) { - return this.w == w ? this : Vec4i.newVec(x, y, z, w); + return this.w == w ? this : Vec4i.of(x, y, z, w); } @Override public Vec4i copy() { - return Vec4i.newVec(this); + return Vec4i.of(this); } @Override public Vec4i set(int x, int y, int z, int w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4i.newVec(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4i.of(x, y, z, w); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iMutable.java b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iMutable.java index 2a8bbd3..341beda 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/ints/Vec4iMutable.java @@ -90,7 +90,7 @@ public class Vec4iMutable implements Vec4i @Override public Vec4i copy() { - return Vec4i.newMutable(this); + return Vec4i.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2l.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2l.java index 6e0bc6d..c89b560 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2l.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2l.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s; public interface Vec2l extends Vecl { - public static final Vec2l ZERO = newVec(); - public static final Vec2l MINUS_ONE = newVec(-1L); - public static final Vec2l ONE = newVec(1L); + public static final Vec2l ZERO = of(); + public static final Vec2l MINUS_ONE = of(-1L); + public static final Vec2l ONE = of(1L); - public static Vec2l newMutable(){return new Vec2lMutable();} - public static Vec2l newMutable(long value){return new Vec2lMutable(value);} - public static Vec2l newMutable(long x, long y){return new Vec2lMutable(x, y);} - public static Vec2l newMutable(Vec2l value){return newMutable(value.getX(), value.getY());} + public static Vec2l mutable(){return new Vec2lMutable();} + public static Vec2l mutable(long value){return new Vec2lMutable(value);} + public static Vec2l mutable(long x, long y){return new Vec2lMutable(x, y);} + public static Vec2l mutable(Vec2l value){return mutable(value.getX(), value.getY());} - public static Vec2l newVec(){return new Vec2lImmutable();} - public static Vec2l newVec(long value){return new Vec2lImmutable(value);} - public static Vec2l newVec(long x, long y){return new Vec2lImmutable(x, y);} - public static Vec2l newVec(Vec2l value){return newVec(value.getX(), value.getY());} + public static Vec2l of(){return new Vec2lImmutable();} + public static Vec2l of(long value){return new Vec2lImmutable(value);} + public static Vec2l of(long x, long y){return new Vec2lImmutable(x, y);} + public static Vec2l of(Vec2l value){return of(value.getX(), value.getY());} public long getX(); public long getY(); @@ -141,23 +141,23 @@ public interface Vec2l extends Vecl } @Override - public default Vec2b asByte(){return isMutable() ? Vec2b.newMutable((byte)getX(), (byte)getY()) : Vec2b.newVec((byte)getX(), (byte)getY());} + public default Vec2b asByte(){return isMutable() ? Vec2b.mutable((byte)getX(), (byte)getY()) : Vec2b.of((byte)getX(), (byte)getY());} @Override - public default Vec2s asShort(){return isMutable() ? Vec2s.newMutable((short)getX(), (short)getY()) : Vec2s.newVec((short)getX(), (short)getY());} + public default Vec2s asShort(){return isMutable() ? Vec2s.mutable((short)getX(), (short)getY()) : Vec2s.of((short)getX(), (short)getY());} @Override - public default Vec2i asInt(){return isMutable() ? Vec2i.newMutable((int)getX(), (int)getY()) : Vec2i.newVec((int)getX(), (int)getY());} + public default Vec2i asInt(){return isMutable() ? Vec2i.mutable((int)getX(), (int)getY()) : Vec2i.of((int)getX(), (int)getY());} @Override - public default Vec2f asFloat() {return isMutable() ? Vec2f.newMutable(getX(), getY()) : Vec2f.newVec(getX(), getY());} + public default Vec2f asFloat() {return isMutable() ? Vec2f.mutable(getX(), getY()) : Vec2f.of(getX(), getY());} @Override - public default Vec2d asDouble(){return isMutable() ? Vec2d.newMutable(getX(), getY()) : Vec2d.newVec(getX(), getY());} + public default Vec2d asDouble(){return isMutable() ? Vec2d.mutable(getX(), getY()) : Vec2d.of(getX(), getY());} @Override - public default Vec2l asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec2l asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec2l asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec2l asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec2l copyAsMutable(){return newMutable(this);} + public default Vec2l copyAsMutable(){return mutable(this);} @Override - public default Vec2l copyAsImmutable(){return newVec(this);} + public default Vec2l copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lImmutable.java index 9e66de8..8c60885 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lImmutable.java @@ -46,25 +46,25 @@ public class Vec2lImmutable implements Vec2l @Override public Vec2l setX(long x) { - return this.x == x ? this : Vec2l.newVec(x, y); + return this.x == x ? this : Vec2l.of(x, y); } @Override public Vec2l setY(long y) { - return this.y == y ? this : Vec2l.newVec(x, y); + return this.y == y ? this : Vec2l.of(x, y); } @Override public Vec2l copy() { - return Vec2l.newVec(this); + return Vec2l.of(this); } @Override public Vec2l set(long x, long y) { - return this.x == x && this.y == y ? this : Vec2l.newVec(x, y); + return this.x == x && this.y == y ? this : Vec2l.of(x, y); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lMutable.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lMutable.java index 6c5f7c6..bc42057 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec2lMutable.java @@ -58,7 +58,7 @@ public class Vec2lMutable implements Vec2l @Override public Vec2l copy() { - return Vec2l.newMutable(this); + return Vec2l.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3l.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3l.java index d7c1da7..a40bd26 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3l.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3l.java @@ -13,19 +13,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s; public interface Vec3l extends Vecl { - public static final Vec3l ZERO = newVec(); - public static final Vec3l MINUS_ONE = newVec(-1L); - public static final Vec3l ONE = newVec(1L); + public static final Vec3l ZERO = of(); + public static final Vec3l MINUS_ONE = of(-1L); + public static final Vec3l ONE = of(1L); - public static Vec3l newMutable(){return new Vec3lMutable();} - public static Vec3l newMutable(long value){return new Vec3lMutable(value);} - public static Vec3l newMutable(long x, long y, long z){return new Vec3lMutable(x, y, z);} - public static Vec3l newMutable(Vec3l vec){return newMutable(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3l mutable(){return new Vec3lMutable();} + public static Vec3l mutable(long value){return new Vec3lMutable(value);} + public static Vec3l mutable(long x, long y, long z){return new Vec3lMutable(x, y, z);} + public static Vec3l mutable(Vec3l vec){return mutable(vec.getX(), vec.getY(), vec.getZ());} - public static Vec3l newVec(){return new Vec3lImmutable();} - public static Vec3l newVec(long value){return new Vec3lImmutable(value);} - public static Vec3l newVec(long x, long y, long z){return new Vec3lImmutable(x, y, z);} - public static Vec3l newVec(Vec3l vec){return newVec(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3l of(){return new Vec3lImmutable();} + public static Vec3l of(long value){return new Vec3lImmutable(value);} + public static Vec3l of(long x, long y, long z){return new Vec3lImmutable(x, y, z);} + public static Vec3l of(Vec3l vec){return of(vec.getX(), vec.getY(), vec.getZ());} public long getX(); public long getY(); @@ -135,22 +135,22 @@ public interface Vec3l extends Vecl } @Override - public default Vec3b asByte(){return isMutable() ? Vec3b.newMutable((byte)getX(), (byte)getY(), (byte)getZ()) : Vec3b.newVec((byte)getX(), (byte)getY(), (byte)getZ());} + public default Vec3b asByte(){return isMutable() ? Vec3b.mutable((byte)getX(), (byte)getY(), (byte)getZ()) : Vec3b.of((byte)getX(), (byte)getY(), (byte)getZ());} @Override - public default Vec3s asShort(){return isMutable() ? Vec3s.newMutable((short)getX(), (short)getY(), (short)getZ()) : Vec3s.newVec((short)getX(), (short)getY(), (short)getZ());} + public default Vec3s asShort(){return isMutable() ? Vec3s.mutable((short)getX(), (short)getY(), (short)getZ()) : Vec3s.of((short)getX(), (short)getY(), (short)getZ());} @Override - public default Vec3i asInt(){return isMutable() ? Vec3i.newMutable((int)getX(), (int)getY(), (int)getZ()) : Vec3i.newVec((int)getX(), (int)getY(), (int)getZ());} + public default Vec3i asInt(){return isMutable() ? Vec3i.mutable((int)getX(), (int)getY(), (int)getZ()) : Vec3i.of((int)getX(), (int)getY(), (int)getZ());} @Override - public default Vec3f asFloat() {return isMutable() ? Vec3f.newMutable(getX(), getY(), getZ()) : Vec3f.newVec(getX(), getY(), getZ());} + public default Vec3f asFloat() {return isMutable() ? Vec3f.mutable(getX(), getY(), getZ()) : Vec3f.of(getX(), getY(), getZ());} @Override - public default Vec3d asDouble(){return isMutable() ? Vec3d.newMutable(getX(), getY(), getZ()) : Vec3d.newVec(getX(), getY(), getZ());} + public default Vec3d asDouble(){return isMutable() ? Vec3d.mutable(getX(), getY(), getZ()) : Vec3d.of(getX(), getY(), getZ());} @Override - public default Vec3l asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec3l asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec3l asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec3l asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec3l copyAsMutable(){return newMutable(this);} + public default Vec3l copyAsMutable(){return mutable(this);} @Override - public default Vec3l copyAsImmutable(){return newVec(this);} + public default Vec3l copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lImmutable.java index f66bb26..d54ef90 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lImmutable.java @@ -56,31 +56,31 @@ public class Vec3lImmutable implements Vec3l @Override public Vec3l setX(long x) { - return this.x == x ? this : Vec3l.newVec(x, y, z); + return this.x == x ? this : Vec3l.of(x, y, z); } @Override public Vec3l setY(long y) { - return this.y == y ? this : Vec3l.newVec(x, y, z); + return this.y == y ? this : Vec3l.of(x, y, z); } @Override public Vec3l setZ(long z) { - return this.z == z ? this : Vec3l.newVec(x, y, z); + return this.z == z ? this : Vec3l.of(x, y, z); } @Override public Vec3l copy() { - return Vec3l.newVec(this); + return Vec3l.of(this); } @Override public Vec3l set(long x, long y, long z) { - return this.x == x && this.y == y && this.z == z ? this : Vec3l.newVec(x, y, z); + return this.x == x && this.y == y && this.z == z ? this : Vec3l.of(x, y, z); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lMutable.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lMutable.java index 2cbf789..64453ab 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec3lMutable.java @@ -74,7 +74,7 @@ public class Vec3lMutable implements Vec3l @Override public Vec3l copy() { - return Vec3l.newMutable(this); + return Vec3l.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4l.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4l.java index 6c070f5..6364ad5 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4l.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4l.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s; public interface Vec4l extends Vecl { - public static final Vec4l ZERO = newVec(); - public static final Vec4l MINUS_ONE = newVec(-1L); - public static final Vec4l ONE = newVec(1L); + public static final Vec4l ZERO = of(); + public static final Vec4l MINUS_ONE = of(-1L); + public static final Vec4l ONE = of(1L); - public static Vec4l newMutable(){return new Vec4lMutable();} - public static Vec4l newMutable(long value){return new Vec4lMutable(value);} - public static Vec4l newMutable(long x, long y, long z, long w){return new Vec4lMutable(x, y, z, w);} - public static Vec4l newMutable(Vec4l vec){return newMutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4l mutable(){return new Vec4lMutable();} + public static Vec4l mutable(long value){return new Vec4lMutable(value);} + public static Vec4l mutable(long x, long y, long z, long w){return new Vec4lMutable(x, y, z, w);} + public static Vec4l mutable(Vec4l vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} - public static Vec4l newVec(){return new Vec4lImmutable();} - public static Vec4l newVec(long value){return new Vec4lImmutable(value);} - public static Vec4l newVec(long x, long y, long z, long w){return new Vec4lImmutable(x, y, z, w);} - public static Vec4l newVec(Vec4l vec){return newVec(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4l of(){return new Vec4lImmutable();} + public static Vec4l of(long value){return new Vec4lImmutable(value);} + public static Vec4l of(long x, long y, long z, long w){return new Vec4lImmutable(x, y, z, w);} + public static Vec4l of(Vec4l vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} public long getX(); public long getY(); @@ -137,22 +137,22 @@ public interface Vec4l extends Vecl } @Override - public default Vec4b asByte(){return isMutable() ? Vec4b.newMutable((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW()) : Vec4b.newVec((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW());} + public default Vec4b asByte(){return isMutable() ? Vec4b.mutable((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW()) : Vec4b.of((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW());} @Override - public default Vec4s asShort(){return isMutable() ? Vec4s.newMutable((short)getX(), (short)getY(), (short)getZ(), (short)getW()) : Vec4s.newVec((short)getX(), (short)getY(), (short)getZ(), (short)getW());} + public default Vec4s asShort(){return isMutable() ? Vec4s.mutable((short)getX(), (short)getY(), (short)getZ(), (short)getW()) : Vec4s.of((short)getX(), (short)getY(), (short)getZ(), (short)getW());} @Override - public default Vec4i asInt(){return isMutable() ? Vec4i.newMutable((int)getX(), (int)getY(), (int)getZ(), (int)getW()) : Vec4i.newVec((int)getX(), (int)getY(), (int)getZ(), (int)getW());} + public default Vec4i asInt(){return isMutable() ? Vec4i.mutable((int)getX(), (int)getY(), (int)getZ(), (int)getW()) : Vec4i.of((int)getX(), (int)getY(), (int)getZ(), (int)getW());} @Override - public default Vec4f asFloat() {return isMutable() ? Vec4f.newMutable(getX(), getY(), getZ(), getW()) : Vec4f.newVec(getX(), getY(), getZ(), getW());} + public default Vec4f asFloat() {return isMutable() ? Vec4f.mutable(getX(), getY(), getZ(), getW()) : Vec4f.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4d asDouble(){return isMutable() ? Vec4d.newMutable(getX(), getY(), getZ(), getW()) : Vec4d.newVec(getX(), getY(), getZ(), getW());} + public default Vec4d asDouble(){return isMutable() ? Vec4d.mutable(getX(), getY(), getZ(), getW()) : Vec4d.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4l asMutable(){return isMutable() ? this : newMutable(this);} + public default Vec4l asMutable(){return isMutable() ? this : mutable(this);} @Override - public default Vec4l asImmutable(){return isMutable() ? newVec(this) : this;} + public default Vec4l asImmutable(){return isMutable() ? of(this) : this;} @Override - public default Vec4l copyAsMutable(){return newMutable(this);} + public default Vec4l copyAsMutable(){return mutable(this);} @Override - public default Vec4l copyAsImmutable(){return newVec(this);} + public default Vec4l copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lImmutable.java index 81b5726..4e3364d 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lImmutable.java @@ -66,37 +66,37 @@ public class Vec4lImmutable implements Vec4l @Override public Vec4l setX(long x) { - return this.x == x ? this : Vec4l.newVec(x, y, z, w); + return this.x == x ? this : Vec4l.of(x, y, z, w); } @Override public Vec4l setY(long y) { - return this.y == y ? this : Vec4l.newVec(x, y, z, w); + return this.y == y ? this : Vec4l.of(x, y, z, w); } @Override public Vec4l setZ(long z) { - return this.z == z ? this : Vec4l.newVec(x, y, z, w); + return this.z == z ? this : Vec4l.of(x, y, z, w); } @Override public Vec4l setW(long w) { - return this.w == w ? this : Vec4l.newVec(x, y, z, w); + return this.w == w ? this : Vec4l.of(x, y, z, w); } @Override public Vec4l copy() { - return Vec4l.newVec(this); + return Vec4l.of(this); } @Override public Vec4l set(long x, long y, long z, long w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4l.newVec(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4l.of(x, y, z, w); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lMutable.java b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lMutable.java index 5e37dfd..7beac5c 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/longs/Vec4lMutable.java @@ -90,7 +90,7 @@ public class Vec4lMutable implements Vec4l @Override public Vec4l copy() { - return Vec4l.newMutable(this); + return Vec4l.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4f.java b/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4f.java index 47f053a..28fa244 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4f.java +++ b/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4f.java @@ -13,9 +13,9 @@ import speiger.src.coreengine.math.vector.quaternion.Quaternion; public class Matrix4f { - static final Vec3f X_ROTATION = Vec3f.newVec(1F, 0F, 0F); - static final Vec3f Y_ROTATION = Vec3f.newVec(0F, 1F, 0F); - static final Vec3f Z_ROTATION = Vec3f.newVec(0F, 0F, 1F); + static final Vec3f X_ROTATION = Vec3f.of(1F, 0F, 0F); + static final Vec3f Y_ROTATION = Vec3f.of(0F, 1F, 0F); + static final Vec3f Z_ROTATION = Vec3f.of(0F, 0F, 1F); float[] data = new float[16]; diff --git a/src/main/java/speiger/src/coreengine/math/vector/quaternion/Quaternion.java b/src/main/java/speiger/src/coreengine/math/vector/quaternion/Quaternion.java index 022c665..409686b 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/quaternion/Quaternion.java +++ b/src/main/java/speiger/src/coreengine/math/vector/quaternion/Quaternion.java @@ -9,20 +9,20 @@ import speiger.src.coreengine.math.vector.matrix.Matrix4f; public interface Quaternion { - public static final Quaternion ZERO = newQuat(0F, 0F, 0F, 0F); - public static final Quaternion IDENTITY = newQuat(); + public static final Quaternion ZERO = of(0F, 0F, 0F, 0F); + public static final Quaternion IDENTITY = of(); - public static Quaternion newQuat(){return new QuaternionImmutable();} - public static Quaternion newQuat(Quaternion source){return newQuat(source.getX(), source.getY(), source.getZ(), source.getW());} - public static Quaternion newQuat(float x, float y, float z, float w){return new QuaternionImmutable(x, y, z, w);} - public static Quaternion newAxisRadQuat(float x, float y, float z, float angle){return ZERO.setAxisRad(x, y, z, angle);} - public static Quaternion newAxisDegQuat(float x, float y, float z, float angle){return ZERO.setAxisDeg(x, y, z, angle);} + public static Quaternion mutable(){return new QuaternionMutable();} + public static Quaternion mutable(Quaternion source){return mutable(source.getX(), source.getY(), source.getZ(), source.getW());} + public static Quaternion mutable(float x, float y, float z, float w){return new QuaternionMutable(x, y, z, w);} + public static Quaternion mutableRad(float x, float y, float z, float angle){return mutable().setAxisRad(x, y, z, angle);} + public static Quaternion mutableDeg(float x, float y, float z, float angle){return mutable().setAxisDeg(x, y, z, angle);} - public static Quaternion newMutable(){return new QuaternionMutable();} - public static Quaternion newMutable(Quaternion source){return newMutable(source.getX(), source.getY(), source.getZ(), source.getW());} - public static Quaternion newMutable(float x, float y, float z, float w){return new QuaternionMutable(x, y, z, w);} - public static Quaternion newMutableRadAxis(float x, float y, float z, float angle){return newMutable().setAxisRad(x, y, z, angle);} - public static Quaternion newMutableDegAxis(float x, float y, float z, float angle){return newMutable().setAxisDeg(x, y, z, angle);} + public static Quaternion of(){return new QuaternionImmutable();} + public static Quaternion of(Quaternion source){return of(source.getX(), source.getY(), source.getZ(), source.getW());} + public static Quaternion of(float x, float y, float z, float w){return new QuaternionImmutable(x, y, z, w);} + public static Quaternion ofRad(float x, float y, float z, float angle){return ZERO.setAxisRad(x, y, z, angle);} + public static Quaternion ofDeg(float x, float y, float z, float angle){return ZERO.setAxisDeg(x, y, z, angle);} public static double acos(double v){return v < -1D ? 3.141592653589793D : (v > 1D ? 0D : Math.acos(v));} @@ -172,13 +172,13 @@ public interface Quaternion public default double lengthSquared(){return (getX() * getX()) + (getY() * getY()) + (getZ() * getZ()) + (getW() * getW());} public default Matrix4f asRotationMatrix(){return new Matrix4f().rotate(this);} - public default Vec4f toAxisDegreeRotation() {return toAxisDegreeRotation(Vec4f.newMutable());} + public default Vec4f toAxisDegreeRotation() {return toAxisDegreeRotation(Vec4f.mutable());} public default Vec4f toAxisDegreeRotation(Vec4f input) { double invSqrt = 1.0D / Math.sqrt(1.0D - getW() * getW()); return input.set((float)(getX() * invSqrt), (float)(getY() * invSqrt), (float)(getZ() * invSqrt), (float)Math.toDegrees(acos(getW()) * 2F)); } - public default Vec4f toAxisRotation() {return toAxisRotation(Vec4f.newMutable());} + public default Vec4f toAxisRotation() {return toAxisRotation(Vec4f.mutable());} public default Vec4f toAxisRotation(Vec4f input) { double invSqrt = 1.0D / Math.sqrt(1.0D - getW() * getW()); @@ -209,8 +209,8 @@ public interface Quaternion public Quaternion copy(); public boolean isMutable(); - public default Quaternion asMutable(){return isMutable() ? this : newQuat(this);} - public default Quaternion asImmutable(){return isMutable() ? newMutable(this) : this;} - public default Quaternion copyAsMutable(){return newMutable(this);} - public default Quaternion copyAsImmutable(){return newQuat(this);} + public default Quaternion asMutable(){return isMutable() ? this : of(this);} + public default Quaternion asImmutable(){return isMutable() ? mutable(this) : this;} + public default Quaternion copyAsMutable(){return mutable(this);} + public default Quaternion copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionImmutable.java index f5892ef..c9a55c1 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionImmutable.java @@ -76,13 +76,13 @@ public class QuaternionImmutable implements Quaternion @Override public Quaternion set(float x, float y, float z, float w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Quaternion.newQuat(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Quaternion.of(x, y, z, w); } @Override public Quaternion copy() { - return Quaternion.newQuat(this); + return Quaternion.of(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionMutable.java b/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionMutable.java index 61b8d46..82bffa0 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/quaternion/QuaternionMutable.java @@ -90,7 +90,7 @@ public class QuaternionMutable implements Quaternion @Override public Quaternion copy() { - return Quaternion.newMutable(this); + return Quaternion.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2s.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2s.java index d32573f..1508666 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2s.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2s.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.longs.Vec2l; public interface Vec2s extends Vecs { - public static final Vec2s ZERO = newVec(); - public static final Vec2s MINUS_ONE = newVec((short)-1); - public static final Vec2s ONE = newVec((short)1); + public static final Vec2s ZERO = of(); + public static final Vec2s MINUS_ONE = of((short)-1); + public static final Vec2s ONE = of((short)1); - public static Vec2s newMutable(){return new Vec2sMutable();} - public static Vec2s newMutable(short value){return new Vec2sMutable(value);} - public static Vec2s newMutable(short x, short y){return new Vec2sMutable(x, y);} - public static Vec2s newMutable(Vec2s value){return newMutable(value.getX(), value.getY());} + public static Vec2s mutable(){return new Vec2sMutable();} + public static Vec2s mutable(short value){return new Vec2sMutable(value);} + public static Vec2s mutable(short x, short y){return new Vec2sMutable(x, y);} + public static Vec2s mutable(Vec2s value){return mutable(value.getX(), value.getY());} - public static Vec2s newVec(){return new Vec2sImmutable();} - public static Vec2s newVec(short value){return new Vec2sImmutable(value);} - public static Vec2s newVec(short x, short y){return new Vec2sImmutable(x, y);} - public static Vec2s newVec(Vec2s value){return newVec(value.getX(), value.getY());} + public static Vec2s of(){return new Vec2sImmutable();} + public static Vec2s of(short value){return new Vec2sImmutable(value);} + public static Vec2s of(short x, short y){return new Vec2sImmutable(x, y);} + public static Vec2s of(Vec2s value){return of(value.getX(), value.getY());} public short getX(); public short getY(); @@ -141,22 +141,22 @@ public interface Vec2s extends Vecs } @Override - public default Vec2b asByte(){return isMutable() ? Vec2b.newMutable((byte)getX(), (byte)getY()) : Vec2b.newVec((byte)getX(), (byte)getY());} + public default Vec2b asByte(){return isMutable() ? Vec2b.mutable((byte)getX(), (byte)getY()) : Vec2b.of((byte)getX(), (byte)getY());} @Override - public default Vec2i asInt(){return isMutable() ? Vec2i.newMutable(getX(), getY()) : Vec2i.newVec(getX(), getY());} + public default Vec2i asInt(){return isMutable() ? Vec2i.mutable(getX(), getY()) : Vec2i.of(getX(), getY());} @Override - public default Vec2l asLong(){return isMutable() ? Vec2l.newMutable(getX(), getY()) : Vec2l.newVec(getX(), getY());} + public default Vec2l asLong(){return isMutable() ? Vec2l.mutable(getX(), getY()) : Vec2l.of(getX(), getY());} @Override - public default Vec2f asFloat() {return isMutable() ? Vec2f.newMutable(getX(), getY()) : Vec2f.newVec(getX(), getY());} + public default Vec2f asFloat() {return isMutable() ? Vec2f.mutable(getX(), getY()) : Vec2f.of(getX(), getY());} @Override - public default Vec2d asDouble(){return isMutable() ? Vec2d.newMutable(getX(), getY()) : Vec2d.newVec(getX(), getY());} + public default Vec2d asDouble(){return isMutable() ? Vec2d.mutable(getX(), getY()) : Vec2d.of(getX(), getY());} @Override - public default Vec2s asMutable(){return isMutable() ? this : newVec(this);} + public default Vec2s asMutable(){return isMutable() ? this : of(this);} @Override - public default Vec2s asImmutable(){return isMutable() ? newMutable(this) : this;} + public default Vec2s asImmutable(){return isMutable() ? mutable(this) : this;} @Override - public default Vec2s copyAsMutable(){return newMutable(this);} + public default Vec2s copyAsMutable(){return mutable(this);} @Override - public default Vec2s copyAsImmutable(){return newVec(this);} + public default Vec2s copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sImmutable.java index 121ade3..e457b3c 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sImmutable.java @@ -46,25 +46,25 @@ public class Vec2sImmutable implements Vec2s @Override public Vec2s setX(short x) { - return this.x == x ? this : Vec2s.newVec(x, y); + return this.x == x ? this : Vec2s.of(x, y); } @Override public Vec2s setY(short y) { - return this.y == y ? this : Vec2s.newVec(x, y); + return this.y == y ? this : Vec2s.of(x, y); } @Override public Vec2s copy() { - return Vec2s.newVec(this); + return Vec2s.of(this); } @Override public Vec2s set(short x, short y) { - return this.x == x && this.y == y ? this : Vec2s.newVec(x, y); + return this.x == x && this.y == y ? this : Vec2s.of(x, y); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sMutable.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sMutable.java index ada2c0e..98bc57b 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec2sMutable.java @@ -58,7 +58,7 @@ public class Vec2sMutable implements Vec2s @Override public Vec2s copy() { - return Vec2s.newMutable(this); + return Vec2s.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3s.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3s.java index b6584cb..6b1be93 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3s.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3s.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.longs.Vec3l; public interface Vec3s extends Vecs { - public static final Vec3s ZERO = newVec(); - public static final Vec3s MINUS_ONE = newVec((short)-1); - public static final Vec3s ONE = newVec((short)1); + public static final Vec3s ZERO = of(); + public static final Vec3s MINUS_ONE = of((short)-1); + public static final Vec3s ONE = of((short)1); - public static Vec3s newMutable(){return new Vec3sMutable();} - public static Vec3s newMutable(short value){return new Vec3sMutable(value);} - public static Vec3s newMutable(short x, short y, short z){return new Vec3sMutable(x, y, z);} - public static Vec3s newMutable(Vec3s vec){return newMutable(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3s mutable(){return new Vec3sMutable();} + public static Vec3s mutable(short value){return new Vec3sMutable(value);} + public static Vec3s mutable(short x, short y, short z){return new Vec3sMutable(x, y, z);} + public static Vec3s mutable(Vec3s vec){return mutable(vec.getX(), vec.getY(), vec.getZ());} - public static Vec3s newVec(){return new Vec3sImmutable();} - public static Vec3s newVec(short value){return new Vec3sImmutable(value);} - public static Vec3s newVec(short x, short y, short z){return new Vec3sImmutable(x, y, z);} - public static Vec3s newVec(Vec3s vec){return newVec(vec.getX(), vec.getY(), vec.getZ());} + public static Vec3s of(){return new Vec3sImmutable();} + public static Vec3s of(short value){return new Vec3sImmutable(value);} + public static Vec3s of(short x, short y, short z){return new Vec3sImmutable(x, y, z);} + public static Vec3s of(Vec3s vec){return of(vec.getX(), vec.getY(), vec.getZ());} public short getX(); public short getY(); @@ -134,23 +134,23 @@ public interface Vec3s extends Vecs } @Override - public default Vec3b asByte(){return isMutable() ? Vec3b.newMutable((byte)getX(), (byte)getY(), (byte)getZ()) : Vec3b.newVec((byte)getX(), (byte)getY(), (byte)getZ());} + public default Vec3b asByte(){return isMutable() ? Vec3b.mutable((byte)getX(), (byte)getY(), (byte)getZ()) : Vec3b.of((byte)getX(), (byte)getY(), (byte)getZ());} @Override - public default Vec3i asInt(){return isMutable() ? Vec3i.newMutable(getX(), getY(), getZ()) : Vec3i.newVec(getX(), getY(), getZ());} + public default Vec3i asInt(){return isMutable() ? Vec3i.mutable(getX(), getY(), getZ()) : Vec3i.of(getX(), getY(), getZ());} @Override - public default Vec3l asLong(){return isMutable() ? Vec3l.newMutable(getX(), getY(), getZ()) : Vec3l.newVec(getX(), getY(), getZ());} + public default Vec3l asLong(){return isMutable() ? Vec3l.mutable(getX(), getY(), getZ()) : Vec3l.of(getX(), getY(), getZ());} @Override - public default Vec3f asFloat() {return isMutable() ? Vec3f.newMutable(getX(), getY(), getZ()) : Vec3f.newVec(getX(), getY(), getZ());} + public default Vec3f asFloat() {return isMutable() ? Vec3f.mutable(getX(), getY(), getZ()) : Vec3f.of(getX(), getY(), getZ());} @Override - public default Vec3d asDouble(){return isMutable() ? Vec3d.newMutable(getX(), getY(), getZ()) : Vec3d.newVec(getX(), getY(), getZ());} + public default Vec3d asDouble(){return isMutable() ? Vec3d.mutable(getX(), getY(), getZ()) : Vec3d.of(getX(), getY(), getZ());} @Override - public default Vec3s asMutable(){return isMutable() ? this : newVec(this);} + public default Vec3s asMutable(){return isMutable() ? this : of(this);} @Override - public default Vec3s asImmutable(){return isMutable() ? newMutable(this) : this;} + public default Vec3s asImmutable(){return isMutable() ? mutable(this) : this;} @Override - public default Vec3s copyAsMutable(){return newMutable(this);} + public default Vec3s copyAsMutable(){return mutable(this);} @Override - public default Vec3s copyAsImmutable(){return newVec(this);} + public default Vec3s copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sImmutable.java index 416eec8..e008629 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sImmutable.java @@ -56,31 +56,31 @@ public class Vec3sImmutable implements Vec3s @Override public Vec3s setX(short x) { - return this.x == x ? this : Vec3s.newVec(x, y, z); + return this.x == x ? this : Vec3s.of(x, y, z); } @Override public Vec3s setY(short y) { - return this.y == y ? this : Vec3s.newVec(x, y, z); + return this.y == y ? this : Vec3s.of(x, y, z); } @Override public Vec3s setZ(short z) { - return this.z == z ? this : Vec3s.newVec(x, y, z); + return this.z == z ? this : Vec3s.of(x, y, z); } @Override public Vec3s copy() { - return Vec3s.newVec(this); + return Vec3s.of(this); } @Override public Vec3s set(short x, short y, short z) { - return this.x == x && this.y == y && this.z == z ? this : Vec3s.newVec(x, y, z); + return this.x == x && this.y == y && this.z == z ? this : Vec3s.of(x, y, z); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sMutable.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sMutable.java index 5c4c243..9daed94 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec3sMutable.java @@ -74,7 +74,7 @@ public class Vec3sMutable implements Vec3s @Override public Vec3s copy() { - return Vec3s.newMutable(this); + return Vec3s.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4s.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4s.java index 9aa7ebd..b6921f4 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4s.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4s.java @@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.longs.Vec4l; public interface Vec4s extends Vecs { - public static final Vec4s ZERO = newVec(); - public static final Vec4s MINUS_ONE = newVec((short)-1); - public static final Vec4s ONE = newVec((short)1); + public static final Vec4s ZERO = of(); + public static final Vec4s MINUS_ONE = of((short)-1); + public static final Vec4s ONE = of((short)1); - public static Vec4s newMutable(){return new Vec4sMutable();} - public static Vec4s newMutable(short value){return new Vec4sMutable(value);} - public static Vec4s newMutable(short x, short y, short z, short w){return new Vec4sMutable(x, y, z, w);} - public static Vec4s newMutable(Vec4s vec){return newMutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4s mutable(){return new Vec4sMutable();} + public static Vec4s mutable(short value){return new Vec4sMutable(value);} + public static Vec4s mutable(short x, short y, short z, short w){return new Vec4sMutable(x, y, z, w);} + public static Vec4s mutable(Vec4s vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} - public static Vec4s newVec(){return new Vec4sImmutable();} - public static Vec4s newVec(short value){return new Vec4sImmutable(value);} - public static Vec4s newVec(short x, short y, short z, short w){return new Vec4sImmutable(x, y, z, w);} - public static Vec4s newVec(Vec4s vec){return newVec(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} + public static Vec4s of(){return new Vec4sImmutable();} + public static Vec4s of(short value){return new Vec4sImmutable(value);} + public static Vec4s of(short x, short y, short z, short w){return new Vec4sImmutable(x, y, z, w);} + public static Vec4s of(Vec4s vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());} public short getX(); public short getY(); @@ -137,23 +137,23 @@ public interface Vec4s extends Vecs } @Override - public default Vec4b asByte(){return isMutable() ? Vec4b.newMutable((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW()) : Vec4b.newVec((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW());} + public default Vec4b asByte(){return isMutable() ? Vec4b.mutable((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW()) : Vec4b.of((byte)getX(), (byte)getY(), (byte)getZ(), (byte)getW());} @Override - public default Vec4i asInt(){return isMutable() ? Vec4i.newMutable(getX(), getY(), getZ(), getW()) : Vec4i.newVec(getX(), getY(), getZ(), getW());} + public default Vec4i asInt(){return isMutable() ? Vec4i.mutable(getX(), getY(), getZ(), getW()) : Vec4i.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4l asLong(){return isMutable() ? Vec4l.newMutable(getX(), getY(), getZ(), getW()) : Vec4l.newVec(getX(), getY(), getZ(), getW());} + public default Vec4l asLong(){return isMutable() ? Vec4l.mutable(getX(), getY(), getZ(), getW()) : Vec4l.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4f asFloat() {return isMutable() ? Vec4f.newMutable(getX(), getY(), getZ(), getW()) : Vec4f.newVec(getX(), getY(), getZ(), getW());} + public default Vec4f asFloat() {return isMutable() ? Vec4f.mutable(getX(), getY(), getZ(), getW()) : Vec4f.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4d asDouble(){return isMutable() ? Vec4d.newMutable(getX(), getY(), getZ(), getW()) : Vec4d.newVec(getX(), getY(), getZ(), getW());} + public default Vec4d asDouble(){return isMutable() ? Vec4d.mutable(getX(), getY(), getZ(), getW()) : Vec4d.of(getX(), getY(), getZ(), getW());} @Override - public default Vec4s asMutable(){return isMutable() ? this : newVec(this);} + public default Vec4s asMutable(){return isMutable() ? this : of(this);} @Override - public default Vec4s asImmutable(){return isMutable() ? newMutable(this) : this;} + public default Vec4s asImmutable(){return isMutable() ? mutable(this) : this;} @Override - public default Vec4s copyAsMutable(){return newMutable(this);} + public default Vec4s copyAsMutable(){return mutable(this);} @Override - public default Vec4s copyAsImmutable(){return newVec(this);} + public default Vec4s copyAsImmutable(){return of(this);} } diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sImmutable.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sImmutable.java index 0c7763a..0f9ffea 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sImmutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sImmutable.java @@ -66,37 +66,37 @@ public class Vec4sImmutable implements Vec4s @Override public Vec4s setX(short x) { - return this.x == x ? this : Vec4s.newVec(x, y, z, w); + return this.x == x ? this : Vec4s.of(x, y, z, w); } @Override public Vec4s setY(short y) { - return this.y == y ? this : Vec4s.newVec(x, y, z, w); + return this.y == y ? this : Vec4s.of(x, y, z, w); } @Override public Vec4s setZ(short z) { - return this.z == z ? this : Vec4s.newVec(x, y, z, w); + return this.z == z ? this : Vec4s.of(x, y, z, w); } @Override public Vec4s setW(short w) { - return this.w == w ? this : Vec4s.newVec(x, y, z, w); + return this.w == w ? this : Vec4s.of(x, y, z, w); } @Override public Vec4s copy() { - return Vec4s.newVec(this); + return Vec4s.of(this); } @Override public Vec4s set(short x, short y, short z, short w) { - return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4s.newVec(x, y, z, w); + return this.x == x && this.y == y && this.z == z && this.w == w ? this : Vec4s.of(x, y, z, w); } @Override diff --git a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sMutable.java b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sMutable.java index 5046117..6dc9bfd 100644 --- a/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sMutable.java +++ b/src/main/java/speiger/src/coreengine/math/vector/shorts/Vec4sMutable.java @@ -90,7 +90,7 @@ public class Vec4sMutable implements Vec4s @Override public Vec4s copy() { - return Vec4s.newMutable(this); + return Vec4s.mutable(this); } @Override diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/GuiBase.java b/src/main/java/speiger/src/coreengine/rendering/gui/GuiBase.java index 54876a6..9d15647 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/GuiBase.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/GuiBase.java @@ -10,7 +10,7 @@ import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.base.IKeyComponent; import speiger.src.coreengine.rendering.gui.helper.Align; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain; import speiger.src.coreengine.rendering.gui.renderer.FontRenderer; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; @@ -73,17 +73,17 @@ public abstract class GuiBase public T addComponent(T comp, Constrain xPos, Constrain yPos, Constrain width, Constrain height) { - return addComponent(comp, new ComponentConstrains(xPos, yPos, width, height)); + return addComponent(comp, new Constrains(xPos, yPos, width, height)); } public T addComponent(int id, T comp, Constrain xPos, Constrain yPos, Constrain width, Constrain height) { - return addComponent(id, comp, new ComponentConstrains(xPos, yPos, width, height)); + return addComponent(id, comp, new Constrains(xPos, yPos, width, height)); } - public abstract T addComponent(T comp, ComponentConstrains contrains); + public abstract T addComponent(T comp, Constrains contrains); - public abstract T addComponent(int id, T comp, ComponentConstrains contrains); + public abstract T addComponent(int id, T comp, Constrains contrains); public T centerComponent(T comp) { @@ -114,7 +114,7 @@ public abstract class GuiBase public abstract void removeKeyListener(IKeyComponent listener); - protected void addConstrains(GuiComponent comp, ComponentConstrains contrains) + protected void addConstrains(GuiComponent comp, Constrains contrains) { comp.constraints = contrains; if(contrains != null) diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/GuiComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/GuiComponent.java index 51dde9c..d7e5751 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/GuiComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/GuiComponent.java @@ -21,8 +21,8 @@ import speiger.src.coreengine.rendering.gui.helper.Align; import speiger.src.coreengine.rendering.gui.helper.animations.Animator; import speiger.src.coreengine.rendering.gui.helper.box.GuiBox; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.FontRenderer; import speiger.src.coreengine.rendering.gui.renderer.IComponentRenderer; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; @@ -59,7 +59,7 @@ public abstract class GuiComponent extends FlagHolder final IGuiBox box; GuiBase owner; GuiComponent parent; - ComponentConstrains constraints = null; + Constrains constraints = null; Animator animation = null; KeyBindAction binding = null; IComponentRenderer customRenderer; @@ -303,9 +303,10 @@ public abstract class GuiComponent extends FlagHolder return isVisible() && (parent == null || parent.isVisible()); } - public final void setMassChanging() + public final GuiComponent setMassChanging() { setFlag(FLAG_MASS_CHANGE); + return this; } public final T setMassChanging(Class clz) @@ -364,7 +365,7 @@ public abstract class GuiComponent extends FlagHolder return this; } - public GuiComponent setScissorsTest(boolean value) + public final GuiComponent setScissorsTest(boolean value) { setFlag(FLAG_TEST_SCISSORS, value); return this; @@ -480,10 +481,10 @@ public abstract class GuiComponent extends FlagHolder public T addChild(T comp, Constrain xPos, Constrain yPos, Constrain width, Constrain height) { - return addChild(comp, new ComponentConstrains(xPos, yPos, width, height)); + return addChild(comp, new Constrains(xPos, yPos, width, height)); } - public T addChild(T comp, ComponentConstrains constrains) + public T addChild(T comp, Constrains constrains) { comp.constraints = constrains; comp.parent = this; @@ -516,7 +517,7 @@ public abstract class GuiComponent extends FlagHolder return popup; } - protected void addConstrains(GuiComponent comp, ComponentConstrains constrains) + protected void addConstrains(GuiComponent comp, Constrains constrains) { comp.constraints = constrains; if(constrains != null) @@ -1140,6 +1141,5 @@ public abstract class GuiComponent extends FlagHolder } return false; } - } } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/base/GuiScreenBase.java b/src/main/java/speiger/src/coreengine/rendering/gui/base/GuiScreenBase.java index 48c337d..f2462cd 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/base/GuiScreenBase.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/base/GuiScreenBase.java @@ -26,7 +26,7 @@ import speiger.src.coreengine.math.misc.ColorUtils; import speiger.src.coreengine.rendering.gui.GuiBase; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.components.TooltipPanel; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; import speiger.src.coreengine.utils.collections.iterators.IterableWrapper; @@ -59,7 +59,7 @@ public class GuiScreenBase extends GuiBase } @Override - public T addComponent(T comp, ComponentConstrains contrains) + public T addComponent(T comp, Constrains contrains) { components.add(comp); renderOrder.addAndMoveToLast(comp); @@ -78,7 +78,7 @@ public class GuiScreenBase extends GuiBase } @Override - public T addComponent(int id, T comp, ComponentConstrains contrains) + public T addComponent(int id, T comp, Constrains contrains) { getters.put(id, comp); return addComponent(comp, contrains); diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/ButtonComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/ButtonComponent.java index addc7a3..d5bf0df 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/ButtonComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/ButtonComponent.java @@ -2,7 +2,7 @@ package speiger.src.coreengine.rendering.gui.components; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.base.IButtonComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; public class ButtonComponent extends GuiComponent implements IButtonComponent { @@ -25,7 +25,7 @@ public class ButtonComponent extends GuiComponent implements IButtonComponent @Override public void init() { - addChild(text, Constraints.getParentConstrains()); + addChild(text, Constrains.parent()); } public TextComponent getText() diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/LabelComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/LabelComponent.java index 5d7f989..456d776 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/LabelComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/LabelComponent.java @@ -1,7 +1,7 @@ package speiger.src.coreengine.rendering.gui.components; import speiger.src.coreengine.rendering.gui.GuiComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; public class LabelComponent extends GuiComponent { @@ -39,7 +39,7 @@ public class LabelComponent extends GuiComponent @Override public void init() { - addChild(text, Constraints.getParentConstrains()); + addChild(text, Constrains.parent()); } @Override diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/ListComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/ListComponent.java index 2686ff5..d5e9276 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/ListComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/ListComponent.java @@ -22,7 +22,7 @@ import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.components.list.IListEntry; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; import speiger.src.coreengine.rendering.input.Keyboard; @@ -55,7 +55,7 @@ public class ListComponent extends GuiComponent protected float cachedWidth = 0F; protected ScrollBarComponent verticalBar = new ScrollBarComponent(ColorUtils.LIGHT_GRAY); protected ScrollBarComponent horizontalBar = new ScrollBarComponent(ColorUtils.LIGHT_GRAY).setHorizontal(true); - protected Vec2i lastMouse = Vec2i.newMutable(); + protected Vec2i lastMouse = Vec2i.mutable(); public ListComponent() { @@ -79,8 +79,8 @@ public class ListComponent extends GuiComponent @Override public void init() { - addChild(horizontalBar, Constraints.getScrollbarConstraints(verticalBar::isInUse, true, 5F)); - addChild(verticalBar, Constraints.getScrollbarConstraints(horizontalBar::isInUse, false, 5F)); + addChild(horizontalBar, Constrains.scrollBar(verticalBar::isInUse, true, 5F)); + addChild(verticalBar, Constrains.scrollBar(horizontalBar::isInUse, false, 5F)); for(int i = 0, m = entries.size();i < m;i++) { entries.get(i).init(this, getGui()); diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/ProgressBarComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/ProgressBarComponent.java index 6378d7c..0bd40b9 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/ProgressBarComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/ProgressBarComponent.java @@ -6,7 +6,7 @@ import java.util.function.IntSupplier; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; import speiger.src.coreengine.rendering.gui.helper.box.ParentBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; public class ProgressBarComponent extends GuiComponent @@ -49,7 +49,7 @@ public class ProgressBarComponent extends GuiComponent addBox(inner); text.setZOffset(0.1F); text.setText(stringify()); - addChild(text, Constraints.getParentConstrains()); + addChild(text, Constrains.parent()); } public TextComponent getText() diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollPanelComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollPanelComponent.java index 09083f4..fdfcd37 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollPanelComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollPanelComponent.java @@ -3,8 +3,8 @@ package speiger.src.coreengine.rendering.gui.components; import speiger.src.coreengine.math.misc.ColorUtils; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.ConditionalConstraint; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; public class ScrollPanelComponent extends GuiComponent { @@ -28,19 +28,19 @@ public class ScrollPanelComponent extends GuiComponent @Override public void init() { - addChild(horizontalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); - addChild(verticalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F)); + addChild(horizontalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); + addChild(verticalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F)); viewPort.addChild(container); container.addChangeListener(this::recalculateSize); - addChild(viewPort, new ComponentConstrains(null, null, Constraints.createConditionalParent(verticalBar::isInUse, 0F, 5F), Constraints.createConditionalParent(horizontalBar::isInUse, 0F, 5F))); + addChild(viewPort, Constrains.width(ConditionalConstraint.parent(verticalBar::isInUse, 0F, 5F)).height(ConditionalConstraint.parent(horizontalBar::isInUse, 0F, 5F)).build()); } public ScrollPanelComponent setForcedCorner(boolean value) { if(setFlag(FLAG_CORNER, value) && getGui() != null) { - addConstrains(horizontalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); - addConstrains(verticalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F)); + addConstrains(horizontalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); + addConstrains(verticalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F)); onChanged(false); } return this; diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollWindowComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollWindowComponent.java index fe93184..5c68dd3 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollWindowComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/ScrollWindowComponent.java @@ -3,8 +3,8 @@ package speiger.src.coreengine.rendering.gui.components; import speiger.src.coreengine.math.misc.ColorUtils; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.ConditionalConstraint; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; public class ScrollWindowComponent extends WindowComponent { @@ -28,11 +28,11 @@ public class ScrollWindowComponent extends WindowComponent public void init() { super.init(); - addChild(horizontalBar.addChangeListener(minimizedListener), Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); - addChild(verticalBar.addChangeListener(minimizedListener), Constraints.getVerticalScrollbar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F)); + addChild(horizontalBar.addChangeListener(minimizedListener), Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); + addChild(verticalBar.addChangeListener(minimizedListener), Constrains.verticalScrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F)); viewPort.addChild(container); container.addChangeListener(this::recalculateSize).addChangeListener(minimizedListener); - addChild(viewPort.set(0F, 7.5F), new ComponentConstrains(null, null, Constraints.createConditionalParent(verticalBar::isInUse, 0F, 5F), Constraints.createConditionalParent(horizontalBar::isInUse, 7.5F, 12.5F))); + addChild(viewPort.set(0F, 7.5F), Constrains.width(ConditionalConstraint.parent(verticalBar::isInUse, 0F, 5F)).height(ConditionalConstraint.parent(horizontalBar::isInUse, 0F, 5F)).build()); } public T addComponent(T comp) @@ -40,7 +40,7 @@ public class ScrollWindowComponent extends WindowComponent return container.addChild(comp); } - public T addComponent(T comp, ComponentConstrains constraints) + public T addComponent(T comp, Constrains constraints) { return container.addChild(comp, constraints); } @@ -59,8 +59,8 @@ public class ScrollWindowComponent extends WindowComponent { if(setFlag(FLAG_CORNER, value) && getGui() != null) { - addConstrains(horizontalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); - addConstrains(verticalBar, Constraints.getVerticalScrollbar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F)); + addConstrains(horizontalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F)); + addConstrains(verticalBar, Constrains.verticalScrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F)); onChanged(false); } return this; diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/SelectionComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/SelectionComponent.java index 9f53b12..dbe0ee7 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/SelectionComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/SelectionComponent.java @@ -13,9 +13,8 @@ import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.components.list.SelectionEntry; import speiger.src.coreengine.rendering.gui.helper.Align; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; -import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain.Target; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer; import speiger.src.coreengine.rendering.tesselation.Tesselator; @@ -71,8 +70,8 @@ public class SelectionComponent extends GuiComponent implements IButtonComponent public void init() { list.setEntryHeight(getGui().getFont().height()).addUserActionListener(this); - addChild(text, Constraints.getParentConstrains(21F, 0F, 10.5F, 0F)); - addChild(list, new ComponentConstrains(new ParentConstrain(), new ParentConstrain().invert(), new ParentConstrain(), null)); + addChild(text, Constrains.parent(21F, 0F, 10.5F, 0F)); + addChild(list, Constrains.parent(Target.X).invParent(Target.Y).parent(Target.WIDTH).build()); addCloseListener(buffer = getRenderer().createBuffer()); createArrow(); } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/SliderComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/SliderComponent.java index d4a47b3..193c3dd 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/SliderComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/SliderComponent.java @@ -7,7 +7,7 @@ import speiger.src.coreengine.math.misc.Facing; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.helper.UIShapes; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer; public class SliderComponent extends GuiComponent implements IButtonComponent @@ -43,7 +43,7 @@ public class SliderComponent extends GuiComponent implements IButtonComponent public void init() { text.setTextScale(0.35F); - addChild(text, Constraints.getParentConstrains()); + addChild(text, Constrains.parent()); createArrow(); } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TabbedWindowComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TabbedWindowComponent.java index 90857e0..e326f04 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TabbedWindowComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TabbedWindowComponent.java @@ -2,7 +2,7 @@ package speiger.src.coreengine.rendering.gui.components; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.helper.Align; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; public class TabbedWindowComponent extends WindowComponent @@ -23,9 +23,10 @@ public class TabbedWindowComponent extends WindowComponent public static class Tab extends GuiComponent { String name; + float width = -1F; boolean closeable; TextComponent comp; - + public Tab(String name) { super(0F, 7F, 100F, 10F); @@ -36,7 +37,8 @@ public class TabbedWindowComponent extends WindowComponent @Override public void init() { - addChild(comp, Constraints.getParentConstrains()); + width = getFont().width(name); + addChild(comp, Constrains.parent()); } @Override diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextCheckBoxComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextCheckBoxComponent.java index 76197b4..741886a 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextCheckBoxComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextCheckBoxComponent.java @@ -1,6 +1,6 @@ package speiger.src.coreengine.rendering.gui.components; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain; @@ -37,7 +37,7 @@ public class TextCheckBoxComponent extends CheckBoxComponent public void init() { super.init(); - addChild(text, new ComponentConstrains(new PixelConstrain(getBox().getWidth() + 1F), new ParentConstrain(), TextConstrain.width(text), new ParentConstrain())); + addChild(text, new Constrains(new PixelConstrain(getBox().getWidth() + 1F), new ParentConstrain(), TextConstrain.width(text), new ParentConstrain())); } public TextComponent getText() diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextComponent.java index 56e50c9..25031ef 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextComponent.java @@ -355,94 +355,83 @@ public class TextComponent extends GuiComponent public final TextComponent italic(float value) { - if(italic == value) + if(italic != value) { - return this; + italic = value; + onChanged(true); } - italic = value; - onChanged(true); return this; } public TextComponent align(Align horizontal, Align vertical) { - if(this.horizontal == horizontal && this.vertical == vertical) + if(this.horizontal != horizontal || this.vertical != vertical) { - return this; + this.horizontal = horizontal; + this.vertical = vertical; + onChanged(true); } - this.horizontal = horizontal; - this.vertical = vertical; - onChanged(true); return this; } public TextComponent horizontal(Align horizontal) { - if(this.horizontal == horizontal) + if(this.horizontal != horizontal) { - return this; + this.horizontal = horizontal; + onChanged(true); } - this.horizontal = horizontal; - onChanged(true); return this; } public TextComponent vertical(Align vertical) { - if(this.vertical == vertical) + if(this.vertical != vertical) { - return this; + this.vertical = vertical; + onChanged(true); } - this.vertical = vertical; - onChanged(true); return this; } public TextComponent setText(String text) { - if(text == null) + if(text == null) text = "null"; + if(!this.text.equals(text)) { - text = "null"; + this.text = text; + onChanged(true); } - if(this.text.equals(text)) - { - return this; - } - this.text = text; - onChanged(true); return this; } public TextComponent textColor(int color) { - if(textColor == color) + if(textColor != color) { - return this; + textColor = color; + onChanged(true); } - textColor = color; - onChanged(true); return this; } public TextComponent backgroundColor(int color) { - if(backGroundColor == color) + if(backGroundColor != color) { - return this; + backGroundColor = color; + onChanged(true); } - backGroundColor = color; - onChanged(true); return this; } public TextComponent setFont(FontRenderer font) { - if(this.font == font) + if(this.font != font) { - return this; + this.font = font; + onChanged(true); } - this.font = font; - onChanged(true); return this; } } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextFieldComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextFieldComponent.java index 2656894..5d8a2be 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextFieldComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextFieldComponent.java @@ -11,10 +11,8 @@ import speiger.src.coreengine.rendering.gui.base.IKeyComponent; import speiger.src.coreengine.rendering.gui.helper.Align; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; import speiger.src.coreengine.rendering.gui.helper.box.ParentBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; -import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain; -import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain.Target; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; import speiger.src.coreengine.rendering.gui.renderer.lexer.TextMetadata; import speiger.src.coreengine.rendering.gui.renderer.lexer.Word; @@ -76,9 +74,9 @@ public class TextFieldComponent extends GuiComponent } } - private ComponentConstrains createConstraints() + private Constrains createConstraints() { - return isFlagNotSet(FLAG_INFINITE_WIDTH) ? Constraints.getParentConstrains(1F) : new ComponentConstrains(new DynamicConstrain(this::getOffset), new ParentConstrain(1F), new ParentConstrain(1F), new ParentConstrain(1F)); + return isFlagNotSet(FLAG_INFINITE_WIDTH) ? Constrains.parent(1F) : Constrains.dynamic(this::getOffset, Target.X).parent(1F, Target.Y).parent(1F, Target.WIDTH).parent(1F, Target.HEIGHT).build(); } public TextFieldComponent setValidator(Predicate validator) diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextPanelComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextPanelComponent.java index 776e168..e58269e 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TextPanelComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TextPanelComponent.java @@ -10,7 +10,7 @@ import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.base.IKeyComponent; import speiger.src.coreengine.rendering.gui.helper.Align; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; import speiger.src.coreengine.rendering.gui.renderer.lexer.Line; import speiger.src.coreengine.rendering.gui.renderer.lexer.TextMetadata; @@ -28,9 +28,9 @@ public class TextPanelComponent extends GuiComponent implements IButtonComponent TextComponent text = new TextComponent().align(Align.LEFT_TOP, Align.LEFT_TOP).singleLine(true).special(false).cast(); int color; int curserPosition = 0; - Vec2i curserPos = Vec2i.newMutable(); + Vec2i curserPos = Vec2i.mutable(); int selectionPosition = 0; - Vec2i selectionPos = Vec2i.newMutable(); + Vec2i selectionPos = Vec2i.mutable(); long lastClickTime = 0; int maxTextLength = 64; int clickCount = 0; @@ -51,7 +51,7 @@ public class TextPanelComponent extends GuiComponent implements IButtonComponent @Override public void init() { - addChild(text, Constraints.getParentConstrains(1F)); + addChild(text, Constrains.parent(1F)); } public TextPanelComponent setValidator(Predicate validator) diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TooltipPanel.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TooltipPanel.java index 0ddac8f..629253c 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TooltipPanel.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TooltipPanel.java @@ -12,7 +12,7 @@ import speiger.src.coreengine.math.misc.ColorUtils; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; import speiger.src.coreengine.rendering.gui.helper.box.ParentBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.MenuConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; @@ -51,7 +51,7 @@ public class TooltipPanel extends PanelComponent { renderedTooltips.put(entry.getKey(), entry.getValue()); indexedComponents.add(entry.getValue()); - addChild(entry.getValue(), new ComponentConstrains(new ParentConstrain(3.2F), new MenuConstrain<>(indexedComponents, () -> 1F), null, null)); + addChild(entry.getValue(), new Constrains(new ParentConstrain(3.2F), new MenuConstrain<>(indexedComponents, () -> 1F), null, null)); } float[] data = new float[]{ Float.MAX_VALUE, diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/TreeComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/TreeComponent.java index 2da7534..95b320f 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/TreeComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/TreeComponent.java @@ -18,7 +18,7 @@ import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.components.tree.ITreeEntry; import speiger.src.coreengine.rendering.gui.helper.UIShapes; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.renderer.UIRenderer; import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer; import speiger.src.coreengine.rendering.input.Keyboard; @@ -46,7 +46,7 @@ public class TreeComponent extends GuiComponent implements int hoverIndex = -1; int dragIndex = -1; int movement; - Vec2i lastMouse = Vec2i.newMutable(); + Vec2i lastMouse = Vec2i.mutable(); IButtonComponent customButton; protected ObjectSet openNodes = new ObjectOpenHashSet<>(); protected ObjectSet selectedNodes = new ObjectOpenHashSet<>(); @@ -98,8 +98,8 @@ public class TreeComponent extends GuiComponent implements public void init() { addCloseListener(buffer = getRenderer().createBuffer()); - addChild(horizontalBar, Constraints.getScrollbarConstraints(verticalBar::isInUse, true, 5F)); - addChild(verticalBar, Constraints.getScrollbarConstraints(horizontalBar::isInUse, false, 5F)); + addChild(horizontalBar, Constrains.scrollBar(verticalBar::isInUse, true, 5F)); + addChild(verticalBar, Constrains.scrollBar(horizontalBar::isInUse, false, 5F)); List entries = new ObjectArrayList(); getNodes(node, entries, false); for(int i = 0, m = entries.size();i < m;i++) diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/WindowComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/WindowComponent.java index 4681fda..f1e0452 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/WindowComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/WindowComponent.java @@ -16,7 +16,7 @@ import speiger.src.coreengine.rendering.gui.components.icon.CrossIcon; import speiger.src.coreengine.rendering.gui.components.icon.LineIcon; import speiger.src.coreengine.rendering.gui.helper.Align; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; import speiger.src.coreengine.rendering.utils.Cursor; @@ -25,7 +25,7 @@ import speiger.src.coreengine.utils.helpers.InternalThreadPools; public class WindowComponent extends PanelComponent implements IButtonComponent, ObjIntConsumer { - public static final Vec2f DEFAULT_MINIMUM_BOUNDS = Vec2f.newVec(75F, 7.5F); + public static final Vec2f DEFAULT_MINIMUM_BOUNDS = Vec2f.of(75F, 7.5F); public static final int FLAG_MINIMIZED = 1 << 20; public static final int FLAG_RESIZEABLE = 1 << 21; public static final int FLAG_MOVEABLE = 1 << 22; @@ -49,8 +49,8 @@ public class WindowComponent extends PanelComponent implements IButtonComponent, FacingList facing = null; String name; int color = ColorUtils.WINDOW_DEFAULT_BACKGROUND; - Vec2f lastSize = Vec2f.newMutable(); - Vec2i lastClick = Vec2i.newMutable(); + Vec2f lastSize = Vec2f.mutable(); + Vec2i lastClick = Vec2i.mutable(); IValue animation = null; protected final Consumer closeListener = new ConsumerConverter(0, this); protected final Consumer minimizedListener = new ConsumerConverter(2, this); @@ -71,16 +71,16 @@ public class WindowComponent extends PanelComponent implements IButtonComponent, super.init(); LabelComponent label = new LabelComponent(name, ColorUtils.DARK_GRAY); label.getText().setTextScale(0.4F).horizontal(Align.LEFT_TOP).singleLine(true); - addChild(label, new ComponentConstrains(null, null, new ParentConstrain(), new PixelConstrain(7.5F))); + addChild(label, new Constrains(null, null, new ParentConstrain(), new PixelConstrain(7.5F))); float offset = 9F; if((flags & WINDOW_FLAG_CLOSEABLE) != 0) { - addChild(new IconButtonComponent(0F, 0F, 7.5F, 7.5F, ColorUtils.RED, new CrossIcon(ColorUtils.WHITE).setPadding(2.5F, 2F)).addUserActionListener(new ConsumerConverter<>(0, this)).setZOffset(0.001F), new ComponentConstrains(new PixelConstrain(offset).setInverted(), null, null, null)); + addChild(new IconButtonComponent(0F, 0F, 7.5F, 7.5F, ColorUtils.RED, new CrossIcon(ColorUtils.WHITE).setPadding(2.5F, 2F)).addUserActionListener(new ConsumerConverter<>(0, this)).setZOffset(0.001F), new Constrains(new PixelConstrain(offset).setInverted(), null, null, null)); offset += 7.5F; } if((flags & WINDOW_FLAG_MINIMIZEABLE) != 0) { - addChild(new IconButtonComponent(0F, 0F, 7.5F, 7.5F, ColorUtils.GRAY, new LineIcon(ColorUtils.WHITE, 0.7F, 0.25F)).addUserActionListener(new ConsumerConverter<>(1, this)).setZOffset(0.001F), new ComponentConstrains(new PixelConstrain(offset).setInverted(), null, null, null)); + addChild(new IconButtonComponent(0F, 0F, 7.5F, 7.5F, ColorUtils.GRAY, new LineIcon(ColorUtils.WHITE, 0.7F, 0.25F)).addUserActionListener(new ConsumerConverter<>(1, this)).setZOffset(0.001F), new Constrains(new PixelConstrain(offset).setInverted(), null, null, null)); } if(canMoveIntoForground()) { diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuBarComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuBarComponent.java index b01f1e2..8766d74 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuBarComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuBarComponent.java @@ -4,7 +4,7 @@ import java.util.List; import speiger.src.collections.objects.lists.ObjectArrayList; import speiger.src.coreengine.rendering.gui.GuiComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.MenuConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; @@ -74,7 +74,7 @@ public class MenuBarComponent extends GuiComponent { menuItems.add(item); item.setMenuColor(color); - addChild(item, new ComponentConstrains(new MenuConstrain(menuItems), new PixelConstrain(), item.createWidthConstriain(), new ParentConstrain())); + addChild(item, new Constrains(new MenuConstrain(menuItems), new PixelConstrain(), item.createWidthConstriain(), new ParentConstrain())); item.setZOffset(0.3F); item.setTextScale(scale); item.onChanged(false); diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuCheckBoxComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuCheckBoxComponent.java index 8a5fbe0..aec1ff1 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuCheckBoxComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuCheckBoxComponent.java @@ -2,7 +2,7 @@ package speiger.src.coreengine.rendering.gui.components.menu; import speiger.src.coreengine.rendering.gui.components.misc.ICheckBox; import speiger.src.coreengine.rendering.gui.helper.UIShapes; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain; import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; @@ -43,7 +43,7 @@ public class MenuCheckBoxComponent extends MenuItemComponent implements ICheckBo @Override public void init() { - addChild(text, new ComponentConstrains(new PixelConstrain(getBox().getHeight() + 1F), new ParentConstrain(), new DynamicConstrain(() -> text.getMetadata().getMaxWidth() + 0.5F), new ParentConstrain())); + addChild(text, new Constrains(new PixelConstrain(getBox().getHeight() + 1F), new ParentConstrain(), new DynamicConstrain(() -> text.getMetadata().getMaxWidth() + 0.5F), new ParentConstrain())); addCloseListener(buffer = getRenderer().createBuffer()); } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuComponent.java index a2b947f..2d8dcec 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuComponent.java @@ -5,7 +5,7 @@ import java.util.function.Consumer; import speiger.src.collections.objects.lists.ObjectArrayList; import speiger.src.coreengine.rendering.gui.GuiComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain; import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.MenuConstrain; @@ -133,10 +133,10 @@ public class MenuComponent extends MenuItemComponent implements Consumer Math.max(getBox().getBaseWidth(), boxWidth / getBox().getScale())) : new PixelConstrain(); - return new ComponentConstrains(constraint, new MenuConstrain(components, isFlagSet(FLAG_SUB_MENU) ? MenuConstrain.DEFAULT : () -> getBox().getBaseHeight() + 0.1F).setPadding(0.01F), comp.createWidthConstriain(), new PixelConstrain(entryHeight)); + return new Constrains(constraint, new MenuConstrain(components, isFlagSet(FLAG_SUB_MENU) ? MenuConstrain.DEFAULT : () -> getBox().getBaseHeight() + 0.1F).setPadding(0.01F), comp.createWidthConstriain(), new PixelConstrain(entryHeight)); } @Override diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuItemComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuItemComponent.java index 55179ab..663cdd0 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuItemComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/menu/MenuItemComponent.java @@ -3,7 +3,7 @@ package speiger.src.coreengine.rendering.gui.components.menu; import speiger.src.coreengine.rendering.gui.GuiComponent; import speiger.src.coreengine.rendering.gui.base.IButtonComponent; import speiger.src.coreengine.rendering.gui.components.TextComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; @@ -77,7 +77,7 @@ public class MenuItemComponent extends GuiComponent implements IButtonComponent @Override public void init() { - addChild(text, new ComponentConstrains(new PixelConstrain(0.25F), new ParentConstrain(), new ParentConstrain(), new ParentConstrain())); + addChild(text, new Constrains(new PixelConstrain(0.25F), new ParentConstrain(), new ParentConstrain(), new ParentConstrain())); } @Override diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/special/ConsoleComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/special/ConsoleComponent.java index ace622a..10204e2 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/special/ConsoleComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/special/ConsoleComponent.java @@ -13,7 +13,7 @@ import speiger.src.coreengine.rendering.gui.components.ListComponent; import speiger.src.coreengine.rendering.gui.components.ScrollBarComponent; import speiger.src.coreengine.rendering.gui.components.TextFieldComponent; import speiger.src.coreengine.rendering.gui.components.list.TextListEntry; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain; @@ -52,8 +52,8 @@ public class ConsoleComponent extends GuiComponent implements IKeyComponent chat.addUserActionListener(this::onEnter); list.setSelectionMode(ListComponent.SELECTION_MODE_DISABLE); list.setStartAtBottom(true); - addChild(chat, new ComponentConstrains(new ParentConstrain(), new ParentConstrain(12F).invert(), new ParentConstrain(), new PixelConstrain(12F))); - addChild(list, new ComponentConstrains(new ParentConstrain(), new ParentConstrain(100).invert(), new RelativeConstrain(0.8F), new PixelConstrain(88))); + addChild(chat, new Constrains(new ParentConstrain(), new ParentConstrain(12F).invert(), new ParentConstrain(), new PixelConstrain(12F))); + addChild(list, new Constrains(new ParentConstrain(), new ParentConstrain(100).invert(), new RelativeConstrain(0.8F), new PixelConstrain(88))); } @Override diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/color/ColorPickerWindowComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/color/ColorPickerWindowComponent.java index eca809d..8307037 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/color/ColorPickerWindowComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/color/ColorPickerWindowComponent.java @@ -17,7 +17,7 @@ import speiger.src.coreengine.rendering.gui.components.icon.IIcon; import speiger.src.coreengine.rendering.gui.components.icon.TexturedIcon; import speiger.src.coreengine.rendering.gui.helper.box.GuiBox; import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain; import speiger.src.coreengine.utils.functions.Functions; @@ -59,8 +59,8 @@ public class ColorPickerWindowComponent extends WindowComponent addChild(brightness.addChangeListener(minimizedListener).addUserActionListener(T -> setColor(hsv[0], hsv[1], T.cast(SliderComponent.class).getValue() * 0.01F))); addChild(saturation.addChangeListener(minimizedListener).addUserActionListener(T -> setColor(hsv[0], T.cast(SliderComponent.class).getValue() * 0.01F, hsv[2]))); addChild(code.setScale(0.5F).addChangeListener(minimizedListener).addUserActionListener(T -> onTyped())); - addChild(new ButtonComponent(0F, 0F, 0F, 20F, "Select", ColorUtils.GREEN).setScale(0.4F).addUserActionListener(T -> apply()), new ComponentConstrains(null, new ParentConstrain(8F).invert(), new RelativeConstrain(0.5F / 0.4F), null)); - addChild(new ButtonComponent(0F, 0F, 0F, 20F, "Cancel", ColorUtils.RED).setScale(0.4F).addUserActionListener(T -> T.getGui().removeComponent(this)), new ComponentConstrains(new RelativeConstrain(0.5F), new ParentConstrain(8F).invert(), new RelativeConstrain(0.5F / 0.4F), null)); + addChild(new ButtonComponent(0F, 0F, 0F, 20F, "Select", ColorUtils.GREEN).setScale(0.4F).addUserActionListener(T -> apply()), new Constrains(null, new ParentConstrain(8F).invert(), new RelativeConstrain(0.5F / 0.4F), null)); + addChild(new ButtonComponent(0F, 0F, 0F, 20F, "Cancel", ColorUtils.RED).setScale(0.4F).addUserActionListener(T -> T.getGui().removeComponent(this)), new Constrains(new RelativeConstrain(0.5F), new ParentConstrain(8F).invert(), new RelativeConstrain(0.5F / 0.4F), null)); setColor(hsv[0], hsv[1], hsv[2]); } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/PieProfilerWindowComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/PieProfilerWindowComponent.java index 9f0d867..a81caf4 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/PieProfilerWindowComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/PieProfilerWindowComponent.java @@ -20,7 +20,7 @@ import speiger.src.coreengine.rendering.gui.components.PieComponent.PieIndex; import speiger.src.coreengine.rendering.gui.components.TextComponent; import speiger.src.coreengine.rendering.gui.components.WindowComponent; import speiger.src.coreengine.rendering.gui.helper.Align; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain; import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; @@ -61,18 +61,18 @@ public class PieProfilerWindowComponent extends WindowComponent public void init() { super.init(); - addChild(pie.setAutoUpdate(true).set(0F, 5F).addChangeListener(minimizedListener), new ComponentConstrains(null, null, new ParentConstrain(), new DynamicConstrain(this::calculatePieHeight))); + addChild(pie.setAutoUpdate(true).set(0F, 5F).addChangeListener(minimizedListener), new Constrains(null, null, new ParentConstrain(), new DynamicConstrain(this::calculatePieHeight))); buttons[0] = createButton(0, "Client"); buttons[1] = createButton(1, "GPU"); buttons[2] = createButton(2, "Server"); extraFeatures[0] = new TextComponent(0F, 0F, 18F, 5.5F).setTextScale(0.3F).setText("[0] Back").align(Align.LEFT_TOP, Align.CENTER); extraFeatures[0].addChangeListener(T -> T.setVisible(!isMinimized() && currentEntry != null && currentEntry.getParent() != null)); - addChild(extraFeatures[0], new ComponentConstrains(null, new DynamicConstrain(() -> pie.getBox().getBaseHeight() + (-5.5F)), new PixelConstrain(38).setInverted(), null)); + addChild(extraFeatures[0], new Constrains(null, new DynamicConstrain(() -> pie.getBox().getBaseHeight() + (-5.5F)), new PixelConstrain(38).setInverted(), null)); extraFeatures[1] = new TextComponent(0F, 0F, 0F, 7F).setTextScale(0.4F).setText("Client Thread"); - addChild(extraFeatures[1].addChangeListener(minimizedListener), new ComponentConstrains(null, new PixelConstrain(8F), new ParentConstrain(), null)); + addChild(extraFeatures[1].addChangeListener(minimizedListener), new Constrains(null, new PixelConstrain(8F), new ParentConstrain(), null)); extraFeatures[2] = new TextComponent(0F, 0F, 0F, 6F).setTextScale(0.33F).setText("Client"); - addChild(extraFeatures[2].addChangeListener(minimizedListener), new ComponentConstrains(null, new PixelConstrain(15F), new ParentConstrain(), null)); + addChild(extraFeatures[2].addChangeListener(minimizedListener), new Constrains(null, new PixelConstrain(15F), new ParentConstrain(), null)); } @@ -236,7 +236,7 @@ public class PieProfilerWindowComponent extends WindowComponent @Override public Vec2f getMinimumBounds() { - return Vec2f.newVec(80F, 80F + (textInUse * 5.5F)); + return Vec2f.of(80F, 80F + (textInUse * 5.5F)); } @Override @@ -291,7 +291,7 @@ public class PieProfilerWindowComponent extends WindowComponent TextComponent comp = new TextComponent(0F, 0F, 18F, 5.5F).setTextScale(0.3F).setText(text).align(column == 0 ? Align.LEFT_TOP : Align.RIGHT_BOTTOM, Align.CENTER); comp.addChangeListener(T -> T.setVisible(!isMinimized() && index < textInUse)); Constrain xPos = column == 0 ? null : (column == 1 ? new PixelConstrain(38F).setInverted() : new PixelConstrain(19F).setInverted()); - addChild(comp, new ComponentConstrains(xPos, new DynamicConstrain(() -> pie.getBox().getBaseHeight() + (index * 5.5F)), column == 0 ? new PixelConstrain(38).setInverted() : null, null)); + addChild(comp, new Constrains(xPos, new DynamicConstrain(() -> pie.getBox().getBaseHeight() + (index * 5.5F)), column == 0 ? new PixelConstrain(38).setInverted() : null, null)); return comp; } @@ -300,7 +300,7 @@ public class PieProfilerWindowComponent extends WindowComponent ButtonComponent button = new ButtonComponent(name, ColorUtils.GRAY); button.getText().setTextScale(0.3F); button.addChangeListener(minimizedListener).addUserActionListener(T -> setProfiler(getProfiler(index), getRoot(index))); - addChild(button, new ComponentConstrains(new RelativeConstrain(index * 0.3333F), new PixelConstrain(8F).setInverted(), new RelativeConstrain(0.3333F), new PixelConstrain(7F))); + addChild(button, new Constrains(new RelativeConstrain(index * 0.3333F), new PixelConstrain(8F).setInverted(), new RelativeConstrain(0.3333F), new PixelConstrain(7F))); return button; } } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/TreeProfilerWindowComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/TreeProfilerWindowComponent.java index b183998..6d90ebd 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/TreeProfilerWindowComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/debug/TreeProfilerWindowComponent.java @@ -12,7 +12,7 @@ import speiger.src.coreengine.rendering.gui.components.ButtonComponent; import speiger.src.coreengine.rendering.gui.components.TreeComponent; import speiger.src.coreengine.rendering.gui.components.WindowComponent; import speiger.src.coreengine.rendering.gui.components.tree.ProfilerTreeEntry; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain; @@ -43,7 +43,7 @@ public class TreeProfilerWindowComponent extends WindowComponent public void init() { super.init(); - addChild(tree.addChangeListener(minimizedListener), new ComponentConstrains(new PixelConstrain(2F), new PixelConstrain(getMinimizedY()), new ParentConstrain(1.5F), new PixelConstrain(getMinimizedY() + 8.5F).setInverted())); + addChild(tree.addChangeListener(minimizedListener), new Constrains(new PixelConstrain(2F), new PixelConstrain(getMinimizedY()), new ParentConstrain(1.5F), new PixelConstrain(getMinimizedY() + 8.5F).setInverted())); buttons[0] = createButton(0, "Client"); buttons[1] = createButton(1, "GPU"); buttons[2] = createButton(2, "Server"); @@ -172,13 +172,13 @@ public class TreeProfilerWindowComponent extends WindowComponent ButtonComponent button = new ButtonComponent(name, ColorUtils.GRAY); button.getText().setTextScale(0.3F); button.addChangeListener(minimizedListener).addUserActionListener(T -> setProfiler(getProfiler(index), PieProfilerWindowComponent.getRoot(index))); - addChild(button, new ComponentConstrains(new RelativeConstrain(index * 0.3333F), new PixelConstrain(8F).setInverted(), new RelativeConstrain(0.3333F), new PixelConstrain(7F))); + addChild(button, new Constrains(new RelativeConstrain(index * 0.3333F), new PixelConstrain(8F).setInverted(), new RelativeConstrain(0.3333F), new PixelConstrain(7F))); return button; } @Override public Vec2f getMinimumBounds() { - return Vec2f.newVec(100F, 50F); + return Vec2f.of(100F, 50F); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/ChoiceComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/ChoiceComponent.java index 3277e92..62e744f 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/ChoiceComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/ChoiceComponent.java @@ -5,7 +5,7 @@ import speiger.src.coreengine.math.misc.ColorUtils; import speiger.src.coreengine.rendering.gui.components.ButtonComponent; import speiger.src.coreengine.rendering.gui.components.TextComponent; import speiger.src.coreengine.rendering.gui.components.WindowComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain; @@ -46,9 +46,9 @@ public class ChoiceComponent extends WindowComponent super.init(); yesButton.getText().setTextScale(0.5F); noButton.getText().setTextScale(0.5F); - addChild(yesButton.addChangeListener(minimizedListener).addUserActionListener(closeListener).addUserActionListener(T -> listener.accept(true)), new ComponentConstrains(new RelativeConstrain(0F), new ParentConstrain(10F).invert(), new RelativeConstrain(0.5F), new PixelConstrain(10F))); - addChild(noButton.addChangeListener(minimizedListener).addUserActionListener(closeListener).addUserActionListener(T -> listener.accept(false)), new ComponentConstrains(new RelativeConstrain(0.5F), new ParentConstrain(10F).invert(), new RelativeConstrain(0.5F), new PixelConstrain(10F))); - addChild(message, new ComponentConstrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message))); + addChild(yesButton.addChangeListener(minimizedListener).addUserActionListener(closeListener).addUserActionListener(T -> listener.accept(true)), new Constrains(new RelativeConstrain(0F), new ParentConstrain(10F).invert(), new RelativeConstrain(0.5F), new PixelConstrain(10F))); + addChild(noButton.addChangeListener(minimizedListener).addUserActionListener(closeListener).addUserActionListener(T -> listener.accept(false)), new Constrains(new RelativeConstrain(0.5F), new ParentConstrain(10F).invert(), new RelativeConstrain(0.5F), new PixelConstrain(10F))); + addChild(message, new Constrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message))); getBox().setHeight(25F + message.getMetadata().getMaxHeight()); } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/MessageComponent.java b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/MessageComponent.java index fe8114c..63a79ab 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/MessageComponent.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/components/window/misc/MessageComponent.java @@ -4,7 +4,7 @@ import speiger.src.coreengine.math.misc.ColorUtils; import speiger.src.coreengine.rendering.gui.components.ButtonComponent; import speiger.src.coreengine.rendering.gui.components.TextComponent; import speiger.src.coreengine.rendering.gui.components.WindowComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains; +import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains; import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain; import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain; @@ -61,8 +61,8 @@ public class MessageComponent extends WindowComponent { super.init(); resultButton.getText().setTextScale(0.5F); - addChild(resultButton.addChangeListener(minimizedListener).addUserActionListener(closeListener), new ComponentConstrains(new ParentConstrain(), new ParentConstrain(10F).invert(), new ParentConstrain(), new PixelConstrain(10F))); - addChild(message, new ComponentConstrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message))); + addChild(resultButton.addChangeListener(minimizedListener).addUserActionListener(closeListener), new Constrains(new ParentConstrain(), new ParentConstrain(10F).invert(), new ParentConstrain(), new PixelConstrain(10F))); + addChild(message, new Constrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message))); getBox().setHeight(25F + message.getMetadata().getMaxHeight()); } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/helper/FontBuilder.java b/src/main/java/speiger/src/coreengine/rendering/gui/helper/FontBuilder.java index 7dff821..c91fc65 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/helper/FontBuilder.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/helper/FontBuilder.java @@ -102,7 +102,7 @@ public class FontBuilder result.getValue().add(new WrittenChar(pair.getLetter(), entry.getX(), entry.getY(), entry.getWidth(), entry.getHeight(), pair.isBold())); } toDraw.values().forEach(T -> result.getValue().add(new WrittenChar(T.getLetter(), 0, 0, 0, 0, T.isBold()))); - result.setKey(ObjectObjectPair.of(Vec2i.newVec(metric.getAscent()+extra, metric.getHeight()+extra), image)); + result.setKey(ObjectObjectPair.of(Vec2i.of(metric.getAscent()+extra, metric.getHeight()+extra), image)); graphics.dispose(); }); return result; diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/CenterConstrain.java b/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/CenterConstrain.java index 43b2b0e..3a4b0be 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/CenterConstrain.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/CenterConstrain.java @@ -5,7 +5,6 @@ import speiger.src.coreengine.utils.functions.FloatSupplier; public class CenterConstrain extends Constrain { - @Override public void apply() { diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ComponentConstrains.java b/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ComponentConstrains.java deleted file mode 100644 index 284a523..0000000 --- a/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ComponentConstrains.java +++ /dev/null @@ -1,52 +0,0 @@ -package speiger.src.coreengine.rendering.gui.helper.constrains; - -import speiger.src.coreengine.rendering.gui.GuiComponent; -import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain.ConstrainTarget; - -public class ComponentConstrains -{ - Constrain xPos; - Constrain yPos; - Constrain width; - Constrain height; - - public ComponentConstrains(Constrain xPos, Constrain yPos, Constrain width, Constrain height) - { - this.xPos = xPos; - this.yPos = yPos; - this.width = width; - this.height = height; - } - - public void setOwner(GuiComponent owner, GuiComponent parent) - { - set(xPos, owner, parent, ConstrainTarget.X_POS); - set(yPos, owner, parent, ConstrainTarget.Y_POS); - set(width, owner, parent, ConstrainTarget.WIDTH); - set(height, owner, parent, ConstrainTarget.HEIGHT); - } - - public void onComponentChanged() - { - apply(xPos); - apply(yPos); - apply(width); - apply(height); - } - - private void set(Constrain c, GuiComponent owner, GuiComponent parent, ConstrainTarget target) - { - if(c != null) - { - c.setComponents(owner, parent, target); - } - } - - private void apply(Constrain c) - { - if(c != null) - { - c.apply(); - } - } -} diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ConditionalConstraint.java b/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ConditionalConstraint.java index 2771118..28f240e 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ConditionalConstraint.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/helper/constrains/ConditionalConstraint.java @@ -14,7 +14,12 @@ public class ConditionalConstraint extends Constrain this.provider = provider; this.target = target; } - + + public static ConditionalConstraint parent(BooleanSupplier provider, float active, float inactive) + { + return new ConditionalConstraint(provider, new ParentConstrain(active * 0.5F), new ParentConstrain(inactive * 0.5F)); + } + @Override public void apply() { @@ -22,7 +27,7 @@ public class ConditionalConstraint extends Constrain } @Override - public void setComponents(GuiComponent owner, GuiComponent parent, ConstrainTarget target) + public void setComponents(GuiComponent owner, GuiComponent parent, Target target) { super.setComponents(owner, parent, target); for(int i = 0,m=this.target.length;i extends Constrain @Override public void apply() { - boolean vertical = target == ConstrainTarget.Y_POS; + boolean vertical = target == Target.Y; if(!target.isPosition()) { float max = 0F; diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/UIRenderer.java b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/UIRenderer.java index 3790e7b..1fb5495 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/UIRenderer.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/UIRenderer.java @@ -38,9 +38,9 @@ public class UIRenderer implements IReloadableResource Stack transformStack = new ObjectArrayList<>(); Matrix4f transform = new Matrix4f(); boolean isFastTransform = true; - SimplePool fastPool = new SimplePool<>(100, () -> Vec4f.newMutable(0F, 0F, 0F, 1F)); + SimplePool fastPool = new SimplePool<>(100, () -> Vec4f.mutable(0F, 0F, 0F, 1F)); Stack fastStack = new ObjectArrayList<>(); - Vec4f fastTransform = Vec4f.newMutable(0F, 0F, 0F, 1F); + Vec4f fastTransform = Vec4f.mutable(0F, 0F, 0F, 1F); SimplePool callPool = new SimplePool<>(100, GLCall::new); ObjectPriorityDequeue activeCalls = new ObjectArrayFIFOQueue<>(); @@ -51,7 +51,7 @@ public class UIRenderer implements IReloadableResource ITexture currentTexture; boolean drawing = false; boolean useTexture = false; - Vec4f currentFrame = Vec4f.newMutable(); + Vec4f currentFrame = Vec4f.mutable(); float roundedNess = 0F; GuiModel texturedModel = GuiModel.createTextureModel(Short.MAX_VALUE * 2); @@ -59,11 +59,11 @@ public class UIRenderer implements IReloadableResource Align horizontal = Align.CENTER; Align vertical = Align.CENTER; - Vec3f helper = Vec3f.newMutable(); - Vec4f transformHelper = Vec4f.newMutable(); - Vec4f alignHelper = Vec4f.newMutable(); - Vec3f alignTranslation = Vec3f.newMutable(0F); - Vec3f alignScale = Vec3f.newMutable(1F); + Vec3f helper = Vec3f.mutable(); + Vec4f transformHelper = Vec4f.mutable(); + Vec4f alignHelper = Vec4f.mutable(); + Vec3f alignTranslation = Vec3f.mutable(0F); + Vec3f alignScale = Vec3f.mutable(1F); GuiManager manager; @@ -80,12 +80,8 @@ public class UIRenderer implements IReloadableResource public UIRenderer push() { - if(isFastTransform) - { - fastStack.push(fastPool.get().set(fastTransform)); - return this; - } - transformStack.push(recylcePool.get().load(transform)); + if(isFastTransform) fastStack.push(fastPool.get().set(fastTransform)); + else transformStack.push(recylcePool.get().load(transform)); return this; } @@ -175,7 +171,7 @@ public class UIRenderer implements IReloadableResource fastTransform.add(x, y, z, 0F); return this; } - transform.translate(helper.set(x, y, z)); + transform.translate(x, y, z); return this; } @@ -221,7 +217,7 @@ public class UIRenderer implements IReloadableResource public UIRenderer scale(float x, float y, float z) { if(isFastTransform) return this; - transform.scale(helper.set(x, y, z)); + transform.scale(x, y, z); alignScale.multiply(x, y, z); return this; } @@ -254,7 +250,7 @@ public class UIRenderer implements IReloadableResource fastTransform.multiply(1F, 1F, 1F, scale); return this; } - transform.scale(helper.set(scale, scale, scale)).getScale(alignScale); + transform.scale(scale, scale, scale).getScale(alignScale); alignScale.multiply(scale); return this; } @@ -346,7 +342,6 @@ public class UIRenderer implements IReloadableResource last = call.getCount(); callPool.accept(call); } - activeCalls.clear(); texturedModel.unbindArray(); shader.stopShader(); renderer.resetVertexes(); diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/buffer/RenderBuffer.java b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/buffer/RenderBuffer.java index 2e8757d..105b472 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/buffer/RenderBuffer.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/buffer/RenderBuffer.java @@ -75,6 +75,6 @@ public class RenderBuffer implements Consumer, Iterable public Iterable selectionIterator(int...indexes) { - return IterableWrapper.wrap(new IndexIterator(drawCalls, indexes)); + return IterableWrapper.wrap(new IndexIterator<>(drawCalls, indexes)); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/input/Mouse.java b/src/main/java/speiger/src/coreengine/rendering/input/Mouse.java index 576c61e..337d4f5 100644 --- a/src/main/java/speiger/src/coreengine/rendering/input/Mouse.java +++ b/src/main/java/speiger/src/coreengine/rendering/input/Mouse.java @@ -22,9 +22,9 @@ public class Mouse MouseRay ray; EventBus bus; IntSet pressedButton = new IntLinkedOpenHashSet(); - Vec2i position = Vec2i.newMutable(); - Vec2i movement = Vec2i.newMutable(); - Vec2i scroll = Vec2i.newMutable(); + Vec2i position = Vec2i.mutable(); + Vec2i movement = Vec2i.mutable(); + Vec2i scroll = Vec2i.mutable(); boolean active = true; public void init(EventBus bus, Window window, Camera cam) diff --git a/src/main/java/speiger/src/coreengine/rendering/input/MouseRay.java b/src/main/java/speiger/src/coreengine/rendering/input/MouseRay.java index b854f81..306f9fb 100644 --- a/src/main/java/speiger/src/coreengine/rendering/input/MouseRay.java +++ b/src/main/java/speiger/src/coreengine/rendering/input/MouseRay.java @@ -15,9 +15,9 @@ public class MouseRay implements IWindowListener final static Vec3f INVALID_3D = Vec3f.MINUS_ONE; Camera cam; Matrix4f windowMatrix; - Vec2i windowBounds = Vec2i.newMutable(); - Vec3f direction = Vec3f.newVec(); - Vec4f helper = Vec4f.newMutable(); + Vec2i windowBounds = Vec2i.mutable(); + Vec3f direction = Vec3f.of(); + Vec4f helper = Vec4f.mutable(); public MouseRay(Camera cam, Window window) { @@ -71,6 +71,6 @@ public class MouseRay implements IWindowListener helper.set(2F * Mouse.getX() / windowBounds.getX() - 1.0f, 1F - 2F * Mouse.getY() / windowBounds.getY(), -1F, 1F); windowMatrix.transform(helper).setZ(-1F).setW(0F); cam.getInvertedViewMatrix().transform(helper); - return Vec3f.newVec(helper.getX(), helper.getY(), helper.getZ()).normalize(); + return Vec3f.of(helper.getX(), helper.getY(), helper.getZ()).normalize(); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/input/camera/Camera.java b/src/main/java/speiger/src/coreengine/rendering/input/camera/Camera.java index 7716655..98f379e 100644 --- a/src/main/java/speiger/src/coreengine/rendering/input/camera/Camera.java +++ b/src/main/java/speiger/src/coreengine/rendering/input/camera/Camera.java @@ -15,13 +15,13 @@ import speiger.src.coreengine.rendering.input.window.Window; public class Camera { - static final Vec3f X_ROTATION = Vec3f.newVec(1, 0, 0); - static final Vec3f Y_ROTATION = Vec3f.newVec(0, 1, 0); + static final Vec3f X_ROTATION = Vec3f.of(1, 0, 0); + static final Vec3f Y_ROTATION = Vec3f.of(0, 1, 0); - Vec3f position = Vec3f.newMutable(0, 0, 0); - Vec3f lastPosition = Vec3f.newMutable(); - Vec2f rotation = Vec2f.newMutable(0); - Vec2f lastRotation = Vec2f.newMutable(); + Vec3f position = Vec3f.mutable(0, 0, 0); + Vec3f lastPosition = Vec3f.mutable(); + Vec2f rotation = Vec2f.mutable(0); + Vec2f lastRotation = Vec2f.mutable(); boolean moved = false; boolean rotated = false; @@ -145,7 +145,7 @@ public class Camera float f1 = MathUtils.sin(-rotation.getY() * 0.017453292F - (float)Math.PI); float f2 = -MathUtils.cos(-rotation.getX() * 0.017453292F); float f3 = MathUtils.sin(-rotation.getX() * 0.017453292F); - return Vec3f.newVec(f1 * f2, f3, f * f2); + return Vec3f.of(f1 * f2, f3, f * f2); } public Camera setCameraChanged() @@ -164,7 +164,7 @@ public class Camera } public Vec2i getActualCenter(){return controller.getCenter(this);} - public Vec2i getSolidPosition(){return Vec2i.newVec((int)position.getX(), (int)position.getZ());} + public Vec2i getSolidPosition(){return Vec2i.of((int)position.getX(), (int)position.getZ());} public void rotate(Vec2i vec){rotate(vec.getY(), vec.getX());} public void rotate(Vec2f vec){rotate(vec.getY(), vec.getX());} diff --git a/src/main/java/speiger/src/coreengine/rendering/input/camera/Frustrum.java b/src/main/java/speiger/src/coreengine/rendering/input/camera/Frustrum.java index 79a4012..3dddc42 100644 --- a/src/main/java/speiger/src/coreengine/rendering/input/camera/Frustrum.java +++ b/src/main/java/speiger/src/coreengine/rendering/input/camera/Frustrum.java @@ -21,7 +21,7 @@ public class Frustrum implements IWindowListener projectMatrix = new Matrix4f(); for(int i = 0;i<6;i++) { - frustrumPlanes[i] = Vec4f.newMutable(); + frustrumPlanes[i] = Vec4f.mutable(); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/input/window/ScaledResolution.java b/src/main/java/speiger/src/coreengine/rendering/input/window/ScaledResolution.java index 2faf615..b448950 100644 --- a/src/main/java/speiger/src/coreengine/rendering/input/window/ScaledResolution.java +++ b/src/main/java/speiger/src/coreengine/rendering/input/window/ScaledResolution.java @@ -56,7 +56,7 @@ public class ScaledResolution { return Vec2i.MINUS_ONE; } - return Vec2i.newVec(Mouse.getX() * scaledWidth / window.getWidth(), Mouse.getY() * scaledHeight / window.getHeight()); + return Vec2i.of(Mouse.getX() * scaledWidth / window.getWidth(), Mouse.getY() * scaledHeight / window.getHeight()); } public MouseEvent getScaledMouseEvent(MouseEvent evt) @@ -72,11 +72,11 @@ public class ScaledResolution public Vec2i getReverseScale(int xPos, int yPos) { - return Vec2i.newVec(xPos * window.getWidth() / scaledWidth, yPos * window.getHeight() / scaledHeight); + return Vec2i.of(xPos * window.getWidth() / scaledWidth, yPos * window.getHeight() / scaledHeight); } public Vec2d getScaleVec() { - return Vec2d.newVec((double)window.getWidth() / scaledWidth, (double)window.getHeight() / scaledHeight); + return Vec2d.of((double)window.getWidth() / scaledWidth, (double)window.getHeight() / scaledHeight); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec2f.java b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec2f.java index e074b41..fa35107 100644 --- a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec2f.java +++ b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec2f.java @@ -7,7 +7,7 @@ import speiger.src.coreengine.rendering.utils.AllocationTracker; public class UniformVec2f extends UniformBase { - static final Vec2f STORED = Vec2f.newMutable(); + static final Vec2f STORED = Vec2f.mutable(); public UniformVec2f(String id) { super(id); @@ -21,7 +21,7 @@ public class UniformVec2f extends UniformBase oldValue.set(newValue.getX(), newValue.getY()); return oldValue; } - return Vec2f.newMutable(newValue); + return Vec2f.mutable(newValue); } public void storeData(Vec2f data) diff --git a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3f.java b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3f.java index 4becadd..bad3b98 100644 --- a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3f.java +++ b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3f.java @@ -8,7 +8,7 @@ import speiger.src.coreengine.rendering.utils.AllocationTracker; public class UniformVec3f extends UniformBase { - static final Vec3f STORAGE = Vec3f.newMutable(); + static final Vec3f STORAGE = Vec3f.mutable(); public UniformVec3f(String id) { @@ -41,6 +41,6 @@ public class UniformVec3f extends UniformBase { return oldValue.set(newValue); } - return Vec3f.newMutable(newValue); + return Vec3f.mutable(newValue); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3fArray.java b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3fArray.java index e35e83f..14b6683 100644 --- a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3fArray.java +++ b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec3fArray.java @@ -10,7 +10,7 @@ import speiger.src.coreengine.rendering.utils.AllocationTracker; public class UniformVec3fArray extends UniformArrayBase { - static final Vec3f STORAGE = Vec3f.newMutable(); + static final Vec3f STORAGE = Vec3f.mutable(); public UniformVec3fArray(String id, int length) { @@ -49,6 +49,6 @@ public class UniformVec3fArray extends UniformArrayBase oldValue.set(newValue); return oldValue; } - return Vec3f.newMutable(newValue); + return Vec3f.mutable(newValue); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4f.java b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4f.java index d3b7014..d063aa9 100644 --- a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4f.java +++ b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4f.java @@ -8,7 +8,7 @@ import speiger.src.coreengine.rendering.utils.AllocationTracker; public class UniformVec4f extends UniformBase { - static final Vec4f STORAGE = Vec4f.newMutable(); + static final Vec4f STORAGE = Vec4f.mutable(); public UniformVec4f(String id) { @@ -43,6 +43,6 @@ public class UniformVec4f extends UniformBase oldValue.set(newValue); return oldValue; } - return Vec4f.newMutable(newValue); + return Vec4f.mutable(newValue); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4fArray.java b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4fArray.java index ff02380..40d0562 100644 --- a/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4fArray.java +++ b/src/main/java/speiger/src/coreengine/rendering/shader/uniforms/UniformVec4fArray.java @@ -10,7 +10,7 @@ import speiger.src.coreengine.rendering.utils.AllocationTracker; public class UniformVec4fArray extends UniformArrayBase { - static final Vec4f STORAGE = Vec4f.newMutable(); + static final Vec4f STORAGE = Vec4f.mutable(); public UniformVec4fArray(String id, int length) { @@ -49,6 +49,6 @@ public class UniformVec4fArray extends UniformArrayBase oldValue.set(newValue); return oldValue; } - return Vec4f.newMutable(newValue); + return Vec4f.mutable(newValue); } } diff --git a/src/main/java/speiger/src/coreengine/rendering/tesselation/GLCall.java b/src/main/java/speiger/src/coreengine/rendering/tesselation/GLCall.java index 1142f4d..120b797 100644 --- a/src/main/java/speiger/src/coreengine/rendering/tesselation/GLCall.java +++ b/src/main/java/speiger/src/coreengine/rendering/tesselation/GLCall.java @@ -7,7 +7,7 @@ public class GLCall int type; int count; int texture; - Vec4f frame = Vec4f.newMutable(); + Vec4f frame = Vec4f.mutable(); float roundedNess = 0F; public GLCall() diff --git a/src/main/java/speiger/src/coreengine/rendering/tesselation/Tesselator.java b/src/main/java/speiger/src/coreengine/rendering/tesselation/Tesselator.java index e4f642b..c41b311 100644 --- a/src/main/java/speiger/src/coreengine/rendering/tesselation/Tesselator.java +++ b/src/main/java/speiger/src/coreengine/rendering/tesselation/Tesselator.java @@ -16,8 +16,8 @@ public class Tesselator implements IVertexBuilder VertexElement currentElement; int currentIndex = 0; - Vec3f offset = Vec3f.newMutable(); - Vec2f effects = Vec2f.newMutable(1F); + Vec3f offset = Vec3f.mutable(); + Vec2f effects = Vec2f.mutable(1F); FloatBuffer buffer; int vertexes = 0; diff --git a/src/main/java/speiger/src/coreengine/rendering/textures/custom/TextureAtlas.java b/src/main/java/speiger/src/coreengine/rendering/textures/custom/TextureAtlas.java index 77ac67a..e22b0bf 100644 --- a/src/main/java/speiger/src/coreengine/rendering/textures/custom/TextureAtlas.java +++ b/src/main/java/speiger/src/coreengine/rendering/textures/custom/TextureAtlas.java @@ -106,7 +106,7 @@ public class TextureAtlas } Object2ObjectMap entries = new Object2ObjectLinkedOpenHashMap<>(); slot.build(entries::put); - return ObjectObjectPair.of(Vec2i.newVec(textureWidth, textureHeight), entries); + return ObjectObjectPair.of(Vec2i.of(textureWidth, textureHeight), entries); } throw new IllegalStateException("Couldn't fit Texture Atlas after growing it 5 Times"); } diff --git a/src/main/java/speiger/src/coreengine/rendering/utils/ViewPortStack.java b/src/main/java/speiger/src/coreengine/rendering/utils/ViewPortStack.java index 2c48611..0b472ee 100644 --- a/src/main/java/speiger/src/coreengine/rendering/utils/ViewPortStack.java +++ b/src/main/java/speiger/src/coreengine/rendering/utils/ViewPortStack.java @@ -9,9 +9,9 @@ import speiger.src.coreengine.utils.collections.pools.SimplePool; public class ViewPortStack { - SimplePool pool = new SimplePool<>(100, Vec4i::newMutable); + SimplePool pool = new SimplePool<>(100, Vec4i::mutable); Stack viewPort = new ObjectArrayList(); - Vec4i defaultPort = Vec4i.newMutable(); + Vec4i defaultPort = Vec4i.mutable(); int inUse = 0; public void setDefault(int x, int y, int w, int h) diff --git a/src/main/java/speiger/src/coreengine/utils/helpers/InternalThreadPools.java b/src/main/java/speiger/src/coreengine/utils/helpers/InternalThreadPools.java index f5b8504..b0686e8 100644 --- a/src/main/java/speiger/src/coreengine/utils/helpers/InternalThreadPools.java +++ b/src/main/java/speiger/src/coreengine/utils/helpers/InternalThreadPools.java @@ -7,5 +7,5 @@ import speiger.src.coreengine.utils.collections.pools.ThreadPool; public class InternalThreadPools { public static final ThreadPool MATRIX = new ThreadPool(100, Matrix4f::new); - public static final ThreadPool VEC2F = new ThreadPool(100, Vec2f::newMutable); + public static final ThreadPool VEC2F = new ThreadPool(100, Vec2f::mutable); }