Refactored Constraints & Vector Classes creators
This commit is contained in:
parent
f550becac5
commit
98e1fbb9fe
|
@ -66,5 +66,5 @@ dependencies {
|
||||||
compile 'com.google.code.gson:gson:2.8.6'
|
compile 'com.google.code.gson:gson:2.8.6'
|
||||||
|
|
||||||
//Primitive Collections
|
//Primitive Collections
|
||||||
compile 'de.speiger:Primitive-Collections:0.6.0'
|
compile 'de.speiger:Primitive-Collections:0.6.1'
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ public class Circle implements I2DCollision
|
||||||
|
|
||||||
public Circle(int x, int y, int radius)
|
public Circle(int x, int y, int radius)
|
||||||
{
|
{
|
||||||
center = Vec2i.newVec(x, y);
|
center = Vec2i.of(x, y);
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public class Circle implements I2DCollision
|
||||||
public Iterator<Vec2i> iterator()
|
public Iterator<Vec2i> iterator()
|
||||||
{
|
{
|
||||||
return new Iterator<Vec2i>(){
|
return new Iterator<Vec2i>(){
|
||||||
Vec2i iter = step(Vec2i.newMutable(center).sub(radius));
|
Vec2i iter = step(Vec2i.mutable(center).sub(radius));
|
||||||
Vec2i result = Vec2i.newMutable();
|
Vec2i result = Vec2i.mutable();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext()
|
public boolean hasNext()
|
||||||
|
|
|
@ -38,8 +38,8 @@ public class Mixed2DCollision implements I2DCollision
|
||||||
{
|
{
|
||||||
return new Iterator<Vec2i>(){
|
return new Iterator<Vec2i>(){
|
||||||
Iterator<Vec2i> mainIter = mainBox.iterator();
|
Iterator<Vec2i> mainIter = mainBox.iterator();
|
||||||
Vec2i cache = findNext(Vec2i.newMutable());
|
Vec2i cache = findNext(Vec2i.mutable());
|
||||||
Vec2i result = Vec2i.newMutable();
|
Vec2i result = Vec2i.mutable();
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext()
|
public boolean hasNext()
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class Plane implements I2DCollision
|
||||||
|
|
||||||
public Plane(int minX, int minY, int maxX, int maxY)
|
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)
|
public Plane(Vec2i center, int radius)
|
||||||
|
@ -73,8 +73,8 @@ public class Plane implements I2DCollision
|
||||||
public Iterator<Vec2i> iterator()
|
public Iterator<Vec2i> iterator()
|
||||||
{
|
{
|
||||||
return new Iterator<Vec2i>(){
|
return new Iterator<Vec2i>(){
|
||||||
Vec2i iter = Vec2i.newMutable(min);
|
Vec2i iter = Vec2i.mutable(min);
|
||||||
Vec2i result = Vec2i.newMutable();
|
Vec2i result = Vec2i.mutable();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext()
|
public boolean hasNext()
|
||||||
|
|
|
@ -6,10 +6,10 @@ import speiger.src.coreengine.math.vector.ints.Vec2i;
|
||||||
|
|
||||||
public enum Facing
|
public enum Facing
|
||||||
{
|
{
|
||||||
NORTH(0, 2, "North", Axis.VERTICAL, Vec2i.newVec(0, 1)),
|
NORTH(0, 2, "North", Axis.VERTICAL, Vec2i.of(0, 1)),
|
||||||
EAST(1, 3, "East", Axis.HORIZONTAL, Vec2i.newVec(1, 0)),
|
EAST(1, 3, "East", Axis.HORIZONTAL, Vec2i.of(1, 0)),
|
||||||
SOUTH(2, 0, "South", Axis.VERTICAL, Vec2i.newVec(0, -1)),
|
SOUTH(2, 0, "South", Axis.VERTICAL, Vec2i.of(0, -1)),
|
||||||
WEST(3, 1, "West", Axis.HORIZONTAL, Vec2i.newVec(-1, 0));
|
WEST(3, 1, "West", Axis.HORIZONTAL, Vec2i.of(-1, 0));
|
||||||
|
|
||||||
private static final Facing[] VALUES;
|
private static final Facing[] VALUES;
|
||||||
private static final Facing[] ROTATIONS;
|
private static final Facing[] ROTATIONS;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public final class FacingList implements Iterable<Facing>, Predicate<Facing>
|
||||||
private FacingList(int initCode)
|
private FacingList(int initCode)
|
||||||
{
|
{
|
||||||
code = (byte)MathUtils.clamp(0, 15, initCode);
|
code = (byte)MathUtils.clamp(0, 15, initCode);
|
||||||
Vec2i pos = Vec2i.newMutable();
|
Vec2i pos = Vec2i.mutable();
|
||||||
ObjectList<Facing> facings = new ObjectArrayList<Facing>();
|
ObjectList<Facing> facings = new ObjectArrayList<Facing>();
|
||||||
for(int i = 0;i<4;i++)
|
for(int i = 0;i<4;i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,9 +4,9 @@ import speiger.src.coreengine.math.vector.floats.Vec3f;
|
||||||
|
|
||||||
public class SmoothVec3f
|
public class SmoothVec3f
|
||||||
{
|
{
|
||||||
Vec3f value = Vec3f.newMutable();
|
Vec3f value = Vec3f.mutable();
|
||||||
Vec3f target = Vec3f.newMutable();
|
Vec3f target = Vec3f.mutable();
|
||||||
Vec3f helper = Vec3f.newMutable();
|
Vec3f helper = Vec3f.mutable();
|
||||||
float agility = 0F;
|
float agility = 0F;
|
||||||
|
|
||||||
public SmoothVec3f(float agility)
|
public SmoothVec3f(float agility)
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s;
|
||||||
|
|
||||||
public interface Vec2b extends Vecb
|
public interface Vec2b extends Vecb
|
||||||
{
|
{
|
||||||
public static final Vec2b ZERO = newVec();
|
public static final Vec2b ZERO = of();
|
||||||
public static final Vec2b MINUS_ONE = newVec((byte)-1);
|
public static final Vec2b MINUS_ONE = of((byte)-1);
|
||||||
public static final Vec2b ONE = newVec((byte)1);
|
public static final Vec2b ONE = of((byte)1);
|
||||||
|
|
||||||
public static Vec2b newMutable(){return new Vec2bMutable();}
|
public static Vec2b mutable(){return new Vec2bMutable();}
|
||||||
public static Vec2b newMutable(byte value){return new Vec2bMutable(value);}
|
public static Vec2b mutable(byte value){return new Vec2bMutable(value);}
|
||||||
public static Vec2b newMutable(byte x, byte y){return new Vec2bMutable(x, y);}
|
public static Vec2b mutable(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(Vec2b value){return mutable(value.getX(), value.getY());}
|
||||||
|
|
||||||
public static Vec2b newVec(){return new Vec2bImmutable();}
|
public static Vec2b of(){return new Vec2bImmutable();}
|
||||||
public static Vec2b newVec(byte value){return new Vec2bImmutable(value);}
|
public static Vec2b of(byte value){return new Vec2bImmutable(value);}
|
||||||
public static Vec2b newVec(byte x, byte y){return new Vec2bImmutable(x, y);}
|
public static Vec2b of(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(Vec2b value){return of(value.getX(), value.getY());}
|
||||||
|
|
||||||
public byte getX();
|
public byte getX();
|
||||||
public byte getY();
|
public byte getY();
|
||||||
|
@ -128,22 +128,22 @@ public interface Vec2b extends Vecb
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec2b asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec2b asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2b asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec2b asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2b copyAsMutable(){return newMutable(this);}
|
public default Vec2b copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2b copyAsImmutable(){return newVec(this);}
|
public default Vec2b copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,25 @@ public class Vec2bImmutable implements Vec2b
|
||||||
@Override
|
@Override
|
||||||
public Vec2b setX(byte x)
|
public Vec2b setX(byte x)
|
||||||
{
|
{
|
||||||
return this.x == x ? this : Vec2b.newVec(x, y);
|
return this.x == x ? this : Vec2b.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2b setY(byte y)
|
public Vec2b setY(byte y)
|
||||||
{
|
{
|
||||||
return this.y == y ? this : Vec2b.newVec(x, y);
|
return this.y == y ? this : Vec2b.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2b copy()
|
public Vec2b copy()
|
||||||
{
|
{
|
||||||
return Vec2b.newVec(this);
|
return Vec2b.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2b set(byte x, byte y)
|
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
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Vec2bMutable implements Vec2b
|
||||||
@Override
|
@Override
|
||||||
public Vec2b copy()
|
public Vec2b copy()
|
||||||
{
|
{
|
||||||
return Vec2b.newMutable(this);
|
return Vec2b.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,19 +11,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s;
|
||||||
|
|
||||||
public interface Vec3b extends Vecb
|
public interface Vec3b extends Vecb
|
||||||
{
|
{
|
||||||
public static final Vec3b ZERO = newVec();
|
public static final Vec3b ZERO = of();
|
||||||
public static final Vec3b MINUS_ONE = newVec((byte)-1);
|
public static final Vec3b MINUS_ONE = of((byte)-1);
|
||||||
public static final Vec3b ONE = newVec((byte)1);
|
public static final Vec3b ONE = of((byte)1);
|
||||||
|
|
||||||
public static Vec3b newMutable(){return new Vec3bMutable();}
|
public static Vec3b mutable(){return new Vec3bMutable();}
|
||||||
public static Vec3b newMutable(byte value){return new Vec3bMutable(value);}
|
public static Vec3b mutable(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 mutable(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(Vec3b vec){return mutable(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public static Vec3b newVec(){return new Vec3bImmutable();}
|
public static Vec3b of(){return new Vec3bImmutable();}
|
||||||
public static Vec3b newVec(byte value){return new Vec3bImmutable(value);}
|
public static Vec3b of(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 of(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(Vec3b vec){return of(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public byte getX();
|
public byte getX();
|
||||||
public byte getY();
|
public byte getY();
|
||||||
|
@ -120,22 +120,22 @@ public interface Vec3b extends Vecb
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec3b asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec3b asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3b asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec3b asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3b copyAsMutable(){return newMutable(this);}
|
public default Vec3b copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3b copyAsImmutable(){return newVec(this);}
|
public default Vec3b copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,31 +56,31 @@ public class Vec3bImmutable implements Vec3b
|
||||||
@Override
|
@Override
|
||||||
public Vec3b setX(byte x)
|
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
|
@Override
|
||||||
public Vec3b setY(byte y)
|
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
|
@Override
|
||||||
public Vec3b setZ(byte z)
|
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
|
@Override
|
||||||
public Vec3b copy()
|
public Vec3b copy()
|
||||||
{
|
{
|
||||||
return Vec3b.newVec(this);
|
return Vec3b.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3b set(byte x, byte y, byte z)
|
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
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class Vec3bMutable implements Vec3b
|
||||||
@Override
|
@Override
|
||||||
public Vec3b copy()
|
public Vec3b copy()
|
||||||
{
|
{
|
||||||
return Vec3b.newMutable(this);
|
return Vec3b.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,19 +11,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s;
|
||||||
|
|
||||||
public interface Vec4b extends Vecb
|
public interface Vec4b extends Vecb
|
||||||
{
|
{
|
||||||
public static final Vec4b ZERO = newVec();
|
public static final Vec4b ZERO = of();
|
||||||
public static final Vec4b MINUS_ONE = newVec((byte)-1);
|
public static final Vec4b MINUS_ONE = of((byte)-1);
|
||||||
public static final Vec4b ONE = newVec((byte)1);
|
public static final Vec4b ONE = of((byte)1);
|
||||||
|
|
||||||
public static Vec4b newMutable(){return new Vec4bMutable();}
|
public static Vec4b mutable(){return new Vec4bMutable();}
|
||||||
public static Vec4b newMutable(byte value){return new Vec4bMutable(value);}
|
public static Vec4b mutable(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 mutable(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(Vec4b vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public static Vec4b newVec(){return new Vec4bImmutable();}
|
public static Vec4b of(){return new Vec4bImmutable();}
|
||||||
public static Vec4b newVec(byte value){return new Vec4bImmutable(value);}
|
public static Vec4b of(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 of(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(Vec4b vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public byte getX();
|
public byte getX();
|
||||||
public byte getY();
|
public byte getY();
|
||||||
|
@ -123,23 +123,23 @@ public interface Vec4b extends Vecb
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec4b asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec4b asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4b asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec4b asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4b copyAsMutable(){return newMutable(this);}
|
public default Vec4b copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4b copyAsImmutable(){return newVec(this);}
|
public default Vec4b copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,37 +66,37 @@ public class Vec4bImmutable implements Vec4b
|
||||||
@Override
|
@Override
|
||||||
public Vec4b setX(byte x)
|
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
|
@Override
|
||||||
public Vec4b setY(byte y)
|
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
|
@Override
|
||||||
public Vec4b setZ(byte z)
|
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
|
@Override
|
||||||
public Vec4b setW(byte w)
|
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
|
@Override
|
||||||
public Vec4b copy()
|
public Vec4b copy()
|
||||||
{
|
{
|
||||||
return Vec4b.newVec(this);
|
return Vec4b.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec4b set(byte x, byte y, byte z, byte w)
|
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
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class Vec4bMutable implements Vec4b
|
||||||
@Override
|
@Override
|
||||||
public Vec4b copy()
|
public Vec4b copy()
|
||||||
{
|
{
|
||||||
return Vec4b.newMutable(this);
|
return Vec4b.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s;
|
||||||
|
|
||||||
public interface Vec2d extends Vecd
|
public interface Vec2d extends Vecd
|
||||||
{
|
{
|
||||||
public static final Vec2d ZERO = newVec();
|
public static final Vec2d ZERO = of();
|
||||||
public static final Vec2d MINUS_ONE = newVec(-1D);
|
public static final Vec2d MINUS_ONE = of(-1D);
|
||||||
public static final Vec2d ONE = newVec(1D);
|
public static final Vec2d ONE = of(1D);
|
||||||
|
|
||||||
public static Vec2d newMutable(){return new Vec2dMutable();}
|
public static Vec2d mutable(){return new Vec2dMutable();}
|
||||||
public static Vec2d newMutable(double value){return new Vec2dMutable(value);}
|
public static Vec2d mutable(double value){return new Vec2dMutable(value);}
|
||||||
public static Vec2d newMutable(double x, double y){return new Vec2dMutable(x, y);}
|
public static Vec2d mutable(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(Vec2d value){return mutable(value.getX(), value.getY());}
|
||||||
|
|
||||||
public static Vec2d newVec(){return new Vec2dImmutable();}
|
public static Vec2d of(){return new Vec2dImmutable();}
|
||||||
public static Vec2d newVec(double value){return new Vec2dImmutable(value);}
|
public static Vec2d of(double value){return new Vec2dImmutable(value);}
|
||||||
public static Vec2d newVec(double x, double y){return new Vec2dImmutable(x, y);}
|
public static Vec2d of(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(Vec2d value){return of(value.getX(), value.getY());}
|
||||||
|
|
||||||
public double getX();
|
public double getX();
|
||||||
public double getY();
|
public double getY();
|
||||||
|
@ -165,23 +165,23 @@ public interface Vec2d extends Vecd
|
||||||
return set(buffer.get(), buffer.get());
|
return set(buffer.get(), buffer.get());
|
||||||
}
|
}
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec2d asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec2d asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2d asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec2d asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2d copyAsMutable(){return newMutable(this);}
|
public default Vec2d copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2d copyAsImmutable(){return newVec(this);}
|
public default Vec2d copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,25 @@ public class Vec2dImmutable implements Vec2d
|
||||||
@Override
|
@Override
|
||||||
public Vec2d setX(double x)
|
public Vec2d setX(double x)
|
||||||
{
|
{
|
||||||
return this.x == x ? this : Vec2d.newVec(x, y);
|
return this.x == x ? this : Vec2d.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2d setY(double y)
|
public Vec2d setY(double y)
|
||||||
{
|
{
|
||||||
return this.y == y ? this : Vec2d.newVec(x, y);
|
return this.y == y ? this : Vec2d.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2d copy()
|
public Vec2d copy()
|
||||||
{
|
{
|
||||||
return Vec2d.newVec(this);
|
return Vec2d.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2d set(double x, double y)
|
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
|
@Override
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class Vec2dMutable implements Vec2d
|
||||||
@Override
|
@Override
|
||||||
public Vec2d copy()
|
public Vec2d copy()
|
||||||
{
|
{
|
||||||
return Vec2d.newMutable(this);
|
return Vec2d.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s;
|
||||||
|
|
||||||
public interface Vec3d extends Vecd
|
public interface Vec3d extends Vecd
|
||||||
{
|
{
|
||||||
public static final Vec3d ZERO = newVec();
|
public static final Vec3d ZERO = of();
|
||||||
public static final Vec3d MINUS_ONE = newVec(-1D);
|
public static final Vec3d MINUS_ONE = of(-1D);
|
||||||
public static final Vec3d ONE = newVec(1D);
|
public static final Vec3d ONE = of(1D);
|
||||||
|
|
||||||
public static Vec3d newMutable(){return new Vec3dMutable();}
|
public static Vec3d mutable(){return new Vec3dMutable();}
|
||||||
public static Vec3d newMutable(double value){return new Vec3dMutable(value);}
|
public static Vec3d mutable(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 mutable(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(Vec3d vec){return mutable(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public static Vec3d newVec(){return new Vec3dImmutable();}
|
public static Vec3d of(){return new Vec3dImmutable();}
|
||||||
public static Vec3d newVec(double value){return new Vec3dImmutable(value);}
|
public static Vec3d of(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 of(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(Vec3d vec){return of(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public double getX();
|
public double getX();
|
||||||
public double getY();
|
public double getY();
|
||||||
|
@ -220,22 +220,22 @@ public interface Vec3d extends Vecd
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec3d asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec3d asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3d asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec3d asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3d copyAsMutable(){return newMutable(this);}
|
public default Vec3d copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3d copyAsImmutable(){return newVec(this);}
|
public default Vec3d copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,31 +56,31 @@ public class Vec3dImmutable implements Vec3d
|
||||||
@Override
|
@Override
|
||||||
public Vec3d setX(double x)
|
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
|
@Override
|
||||||
public Vec3d setY(double y)
|
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
|
@Override
|
||||||
public Vec3d setZ(double z)
|
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
|
@Override
|
||||||
public Vec3d copy()
|
public Vec3d copy()
|
||||||
{
|
{
|
||||||
return Vec3d.newVec(this);
|
return Vec3d.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3d set(double x, double y, double z)
|
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
|
@Override
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class Vec3dMutable implements Vec3d
|
||||||
@Override
|
@Override
|
||||||
public Vec3d copy()
|
public Vec3d copy()
|
||||||
{
|
{
|
||||||
return Vec3d.newMutable(this);
|
return Vec3d.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s;
|
||||||
|
|
||||||
public interface Vec4d extends Vecd
|
public interface Vec4d extends Vecd
|
||||||
{
|
{
|
||||||
public static final Vec4d ZERO = newVec();
|
public static final Vec4d ZERO = of();
|
||||||
public static final Vec4d MINUS_ONE = newVec(-1D);
|
public static final Vec4d MINUS_ONE = of(-1D);
|
||||||
public static final Vec4d ONE = newVec(1D);
|
public static final Vec4d ONE = of(1D);
|
||||||
|
|
||||||
public static Vec4d newMutable(){return new Vec4dMutable();}
|
public static Vec4d mutable(){return new Vec4dMutable();}
|
||||||
public static Vec4d newMutable(double value){return new Vec4dMutable(value);}
|
public static Vec4d mutable(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 mutable(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(Vec4d vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public static Vec4d newVec(){return new Vec4dImmutable();}
|
public static Vec4d of(){return new Vec4dImmutable();}
|
||||||
public static Vec4d newVec(double value){return new Vec4dImmutable(value);}
|
public static Vec4d of(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 of(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(Vec4d vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public double getX();
|
public double getX();
|
||||||
public double getY();
|
public double getY();
|
||||||
|
@ -210,22 +210,22 @@ public interface Vec4d extends Vecd
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec4d asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec4d asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4d asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec4d asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4d copyAsMutable(){return newMutable(this);}
|
public default Vec4d copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4d copyAsImmutable(){return newVec(this);}
|
public default Vec4d copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,37 +66,37 @@ public class Vec4dImmutable implements Vec4d
|
||||||
@Override
|
@Override
|
||||||
public Vec4d setX(double x)
|
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
|
@Override
|
||||||
public Vec4d setY(double y)
|
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
|
@Override
|
||||||
public Vec4d setZ(double z)
|
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
|
@Override
|
||||||
public Vec4d setW(double w)
|
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
|
@Override
|
||||||
public Vec4d copy()
|
public Vec4d copy()
|
||||||
{
|
{
|
||||||
return Vec4d.newVec(this);
|
return Vec4d.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec4d set(double x, double y, double z, double w)
|
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
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class Vec4dMutable implements Vec4d
|
||||||
@Override
|
@Override
|
||||||
public Vec4d copy()
|
public Vec4d copy()
|
||||||
{
|
{
|
||||||
return Vec4d.newMutable(this);
|
return Vec4d.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s;
|
||||||
|
|
||||||
public interface Vec2f extends Vecf
|
public interface Vec2f extends Vecf
|
||||||
{
|
{
|
||||||
public static final Vec2f ZERO = newVec();
|
public static final Vec2f ZERO = of();
|
||||||
public static final Vec2f MINUS_ONE = newVec(-1F);
|
public static final Vec2f MINUS_ONE = of(-1F);
|
||||||
public static final Vec2f ONE = newVec(1F);
|
public static final Vec2f ONE = of(1F);
|
||||||
|
|
||||||
public static Vec2f newMutable(){return new Vec2fMutable();}
|
public static Vec2f mutable(){return new Vec2fMutable();}
|
||||||
public static Vec2f newMutable(float value){return new Vec2fMutable(value);}
|
public static Vec2f mutable(float value){return new Vec2fMutable(value);}
|
||||||
public static Vec2f newMutable(float x, float y){return new Vec2fMutable(x, y);}
|
public static Vec2f mutable(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(Vec2f value){return mutable(value.getX(), value.getY());}
|
||||||
|
|
||||||
public static Vec2f newVec(){return new Vec2fImmutable();}
|
public static Vec2f of(){return new Vec2fImmutable();}
|
||||||
public static Vec2f newVec(float value){return new Vec2fImmutable(value);}
|
public static Vec2f of(float value){return new Vec2fImmutable(value);}
|
||||||
public static Vec2f newVec(float x, float y){return new Vec2fImmutable(x, y);}
|
public static Vec2f of(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(Vec2f value){return of(value.getX(), value.getY());}
|
||||||
|
|
||||||
public float getX();
|
public float getX();
|
||||||
public float getY();
|
public float getY();
|
||||||
|
@ -165,23 +165,23 @@ public interface Vec2f extends Vecf
|
||||||
return set(buffer.get(), buffer.get());
|
return set(buffer.get(), buffer.get());
|
||||||
}
|
}
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec2f asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec2f asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2f asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec2f asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2f copyAsMutable(){return newMutable(this);}
|
public default Vec2f copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2f copyAsImmutable(){return newVec(this);}
|
public default Vec2f copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,25 @@ public class Vec2fImmutable implements Vec2f
|
||||||
@Override
|
@Override
|
||||||
public Vec2f setX(float x)
|
public Vec2f setX(float x)
|
||||||
{
|
{
|
||||||
return this.x == x ? this : Vec2f.newVec(x, y);
|
return this.x == x ? this : Vec2f.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2f setY(float y)
|
public Vec2f setY(float y)
|
||||||
{
|
{
|
||||||
return this.y == y ? this : Vec2f.newVec(x, y);
|
return this.y == y ? this : Vec2f.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2f copy()
|
public Vec2f copy()
|
||||||
{
|
{
|
||||||
return Vec2f.newVec(x, y);
|
return Vec2f.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2f set(float x, float y)
|
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
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Vec2fMutable implements Vec2f
|
||||||
@Override
|
@Override
|
||||||
public Vec2f copy()
|
public Vec2f copy()
|
||||||
{
|
{
|
||||||
return Vec2f.newMutable(this);
|
return Vec2f.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s;
|
||||||
|
|
||||||
public interface Vec3f extends Vecf
|
public interface Vec3f extends Vecf
|
||||||
{
|
{
|
||||||
public static final Vec3f ZERO = newVec();
|
public static final Vec3f ZERO = of();
|
||||||
public static final Vec3f MINUS_ONE = newVec(-1F);
|
public static final Vec3f MINUS_ONE = of(-1F);
|
||||||
public static final Vec3f ONE = newVec(1F);
|
public static final Vec3f ONE = of(1F);
|
||||||
|
|
||||||
public static Vec3f newMutable(){return new Vec3fMutable();}
|
public static Vec3f mutable(){return new Vec3fMutable();}
|
||||||
public static Vec3f newMutable(float value){return new Vec3fMutable(value);}
|
public static Vec3f mutable(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 mutable(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(Vec3f vec){return mutable(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public static Vec3f newVec(){return new Vec3fImmutable();}
|
public static Vec3f of(){return new Vec3fImmutable();}
|
||||||
public static Vec3f newVec(float value){return new Vec3fImmutable(value);}
|
public static Vec3f of(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 of(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(Vec3f vec){return of(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public float getX();
|
public float getX();
|
||||||
public float getY();
|
public float getY();
|
||||||
|
@ -220,23 +220,23 @@ public interface Vec3f extends Vecf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec3f asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec3f asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3f asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec3f asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3f copyAsMutable(){return newMutable(this);}
|
public default Vec3f copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3f copyAsImmutable(){return newVec(this);}
|
public default Vec3f copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,31 +56,31 @@ public class Vec3fImmutable implements Vec3f
|
||||||
@Override
|
@Override
|
||||||
public Vec3f setX(float x)
|
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
|
@Override
|
||||||
public Vec3f setY(float y)
|
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
|
@Override
|
||||||
public Vec3f setZ(float z)
|
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
|
@Override
|
||||||
public Vec3f copy()
|
public Vec3f copy()
|
||||||
{
|
{
|
||||||
return Vec3f.newVec(this);
|
return Vec3f.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3f set(float x, float y, float z)
|
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
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class Vec3fMutable implements Vec3f
|
||||||
@Override
|
@Override
|
||||||
public Vec3f copy()
|
public Vec3f copy()
|
||||||
{
|
{
|
||||||
return Vec3f.newMutable(this);
|
return Vec3f.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s;
|
||||||
|
|
||||||
public interface Vec4f extends Vecf
|
public interface Vec4f extends Vecf
|
||||||
{
|
{
|
||||||
public static final Vec4f ZERO = newVec();
|
public static final Vec4f ZERO = of();
|
||||||
public static final Vec4f MINUS_ONE = newVec(-1F);
|
public static final Vec4f MINUS_ONE = of(-1F);
|
||||||
public static final Vec4f ONE = newVec(1F);
|
public static final Vec4f ONE = of(1F);
|
||||||
|
|
||||||
public static Vec4f newMutable(){return new Vec4fMutable();}
|
public static Vec4f mutable(){return new Vec4fMutable();}
|
||||||
public static Vec4f newMutable(float value){return new Vec4fMutable(value);}
|
public static Vec4f mutable(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 mutable(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(Vec4f vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public static Vec4f newVec(){return new Vec4fImmutable();}
|
public static Vec4f of(){return new Vec4fImmutable();}
|
||||||
public static Vec4f newVec(float value){return new Vec4fImmutable(value);}
|
public static Vec4f of(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 of(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(Vec4f vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public float getX();
|
public float getX();
|
||||||
public float getY();
|
public float getY();
|
||||||
|
@ -210,23 +210,23 @@ public interface Vec4f extends Vecf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec4f asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec4f asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4f asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec4f asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4f copyAsMutable(){return newMutable(this);}
|
public default Vec4f copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4f copyAsImmutable(){return newVec(this);}
|
public default Vec4f copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,37 +66,37 @@ public class Vec4fImmutable implements Vec4f
|
||||||
@Override
|
@Override
|
||||||
public Vec4f setX(float x)
|
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
|
@Override
|
||||||
public Vec4f setY(float y)
|
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
|
@Override
|
||||||
public Vec4f setZ(float z)
|
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
|
@Override
|
||||||
public Vec4f setW(float w)
|
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
|
@Override
|
||||||
public Vec4f copy()
|
public Vec4f copy()
|
||||||
{
|
{
|
||||||
return Vec4f.newVec(this);
|
return Vec4f.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec4f set(float x, float y, float z, float w)
|
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
|
@Override
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class Vec4fMutable implements Vec4f
|
||||||
@Override
|
@Override
|
||||||
public Vec4f copy()
|
public Vec4f copy()
|
||||||
{
|
{
|
||||||
return Vec4f.newMutable(this);
|
return Vec4f.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s;
|
||||||
|
|
||||||
public interface Vec2i extends Veci
|
public interface Vec2i extends Veci
|
||||||
{
|
{
|
||||||
public static final Vec2i ZERO = newVec();
|
public static final Vec2i ZERO = of();
|
||||||
public static final Vec2i MINUS_ONE = newVec(-1);
|
public static final Vec2i MINUS_ONE = of(-1);
|
||||||
public static final Vec2i ONE = newVec(1);
|
public static final Vec2i ONE = of(1);
|
||||||
|
|
||||||
public static Vec2i newMutable(){return new Vec2iMutable();}
|
public static Vec2i mutable(){return new Vec2iMutable();}
|
||||||
public static Vec2i newMutable(int value){return new Vec2iMutable(value);}
|
public static Vec2i mutable(int value){return new Vec2iMutable(value);}
|
||||||
public static Vec2i newMutable(int x, int y){return new Vec2iMutable(x, y);}
|
public static Vec2i mutable(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(Vec2i value){return mutable(value.getX(), value.getY());}
|
||||||
|
|
||||||
public static Vec2i newVec(){return new Vec2iImmutable();}
|
public static Vec2i of(){return new Vec2iImmutable();}
|
||||||
public static Vec2i newVec(int value){return new Vec2iImmutable(value);}
|
public static Vec2i of(int value){return new Vec2iImmutable(value);}
|
||||||
public static Vec2i newVec(int x, int y){return new Vec2iImmutable(x, y);}
|
public static Vec2i of(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(Vec2i value){return of(value.getX(), value.getY());}
|
||||||
|
|
||||||
public int getX();
|
public int getX();
|
||||||
public int getY();
|
public int getY();
|
||||||
|
@ -141,23 +141,23 @@ public interface Vec2i extends Veci
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec2i asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec2i asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2i asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec2i asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2i copyAsMutable(){return newMutable(this);}
|
public default Vec2i copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2i copyAsImmutable(){return newVec(this);}
|
public default Vec2i copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,25 @@ public class Vec2iImmutable implements Vec2i
|
||||||
@Override
|
@Override
|
||||||
public Vec2i setX(int x)
|
public Vec2i setX(int x)
|
||||||
{
|
{
|
||||||
return this.x == x ? this : Vec2i.newVec(x, y);
|
return this.x == x ? this : Vec2i.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2i setY(int y)
|
public Vec2i setY(int y)
|
||||||
{
|
{
|
||||||
return this.y == y ? this : Vec2i.newVec(x, y);
|
return this.y == y ? this : Vec2i.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2i copy()
|
public Vec2i copy()
|
||||||
{
|
{
|
||||||
return Vec2i.newVec(this);
|
return Vec2i.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2i set(int x, int y)
|
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
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Vec2iMutable implements Vec2i
|
||||||
@Override
|
@Override
|
||||||
public Vec2i copy()
|
public Vec2i copy()
|
||||||
{
|
{
|
||||||
return Vec2i.newMutable(this);
|
return Vec2i.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,19 +13,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s;
|
||||||
|
|
||||||
public interface Vec3i extends Veci
|
public interface Vec3i extends Veci
|
||||||
{
|
{
|
||||||
public static final Vec3i ZERO = newVec();
|
public static final Vec3i ZERO = of();
|
||||||
public static final Vec3i MINUS_ONE = newVec(-1);
|
public static final Vec3i MINUS_ONE = of(-1);
|
||||||
public static final Vec3i ONE = newVec(1);
|
public static final Vec3i ONE = of(1);
|
||||||
|
|
||||||
public static Vec3i newMutable(){return new Vec3iMutable();}
|
public static Vec3i mutable(){return new Vec3iMutable();}
|
||||||
public static Vec3i newMutable(int value){return new Vec3iMutable(value);}
|
public static Vec3i mutable(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 mutable(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(Vec3i vec){return mutable(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public static Vec3i newVec(){return new Vec3iImmutable();}
|
public static Vec3i of(){return new Vec3iImmutable();}
|
||||||
public static Vec3i newVec(int value){return new Vec3iImmutable(value);}
|
public static Vec3i of(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 of(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(Vec3i vec){return of(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public int getX();
|
public int getX();
|
||||||
public int getY();
|
public int getY();
|
||||||
|
@ -135,23 +135,23 @@ public interface Vec3i extends Veci
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec3i asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec3i asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3i asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec3i asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3i copyAsMutable(){return newMutable(this);}
|
public default Vec3i copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3i copyAsImmutable(){return newVec(this);}
|
public default Vec3i copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,31 +56,31 @@ public class Vec3iImmutable implements Vec3i
|
||||||
@Override
|
@Override
|
||||||
public Vec3i setX(int x)
|
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
|
@Override
|
||||||
public Vec3i setY(int y)
|
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
|
@Override
|
||||||
public Vec3i setZ(int z)
|
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
|
@Override
|
||||||
public Vec3i copy()
|
public Vec3i copy()
|
||||||
{
|
{
|
||||||
return Vec3i.newVec(this);
|
return Vec3i.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3i set(int x, int y, int z)
|
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
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class Vec3iMutable implements Vec3i
|
||||||
@Override
|
@Override
|
||||||
public Vec3i copy()
|
public Vec3i copy()
|
||||||
{
|
{
|
||||||
return Vec3i.newMutable(this);
|
return Vec3i.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s;
|
||||||
|
|
||||||
public interface Vec4i extends Veci
|
public interface Vec4i extends Veci
|
||||||
{
|
{
|
||||||
public static final Vec4i ZERO = newVec();
|
public static final Vec4i ZERO = of();
|
||||||
public static final Vec4i MINUS_ONE = newVec(-1);
|
public static final Vec4i MINUS_ONE = of(-1);
|
||||||
public static final Vec4i ONE = newVec(1);
|
public static final Vec4i ONE = of(1);
|
||||||
|
|
||||||
public static Vec4i newMutable(){return new Vec4iMutable();}
|
public static Vec4i mutable(){return new Vec4iMutable();}
|
||||||
public static Vec4i newMutable(int value){return new Vec4iMutable(value);}
|
public static Vec4i mutable(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 mutable(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(Vec4i vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public static Vec4i newVec(){return new Vec4iImmutable();}
|
public static Vec4i of(){return new Vec4iImmutable();}
|
||||||
public static Vec4i newVec(int value){return new Vec4iImmutable(value);}
|
public static Vec4i of(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 of(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(Vec4i vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public int getX();
|
public int getX();
|
||||||
public int getY();
|
public int getY();
|
||||||
|
@ -137,22 +137,22 @@ public interface Vec4i extends Veci
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec4i asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec4i asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4i asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec4i asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4i copyAsMutable(){return newMutable(this);}
|
public default Vec4i copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4i copyAsImmutable(){return newVec(this);}
|
public default Vec4i copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,37 +66,37 @@ public class Vec4iImmutable implements Vec4i
|
||||||
@Override
|
@Override
|
||||||
public Vec4i setX(int x)
|
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
|
@Override
|
||||||
public Vec4i setY(int y)
|
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
|
@Override
|
||||||
public Vec4i setZ(int z)
|
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
|
@Override
|
||||||
public Vec4i setW(int w)
|
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
|
@Override
|
||||||
public Vec4i copy()
|
public Vec4i copy()
|
||||||
{
|
{
|
||||||
return Vec4i.newVec(this);
|
return Vec4i.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec4i set(int x, int y, int z, int w)
|
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
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class Vec4iMutable implements Vec4i
|
||||||
@Override
|
@Override
|
||||||
public Vec4i copy()
|
public Vec4i copy()
|
||||||
{
|
{
|
||||||
return Vec4i.newMutable(this);
|
return Vec4i.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec2s;
|
||||||
|
|
||||||
public interface Vec2l extends Vecl
|
public interface Vec2l extends Vecl
|
||||||
{
|
{
|
||||||
public static final Vec2l ZERO = newVec();
|
public static final Vec2l ZERO = of();
|
||||||
public static final Vec2l MINUS_ONE = newVec(-1L);
|
public static final Vec2l MINUS_ONE = of(-1L);
|
||||||
public static final Vec2l ONE = newVec(1L);
|
public static final Vec2l ONE = of(1L);
|
||||||
|
|
||||||
public static Vec2l newMutable(){return new Vec2lMutable();}
|
public static Vec2l mutable(){return new Vec2lMutable();}
|
||||||
public static Vec2l newMutable(long value){return new Vec2lMutable(value);}
|
public static Vec2l mutable(long value){return new Vec2lMutable(value);}
|
||||||
public static Vec2l newMutable(long x, long y){return new Vec2lMutable(x, y);}
|
public static Vec2l mutable(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(Vec2l value){return mutable(value.getX(), value.getY());}
|
||||||
|
|
||||||
public static Vec2l newVec(){return new Vec2lImmutable();}
|
public static Vec2l of(){return new Vec2lImmutable();}
|
||||||
public static Vec2l newVec(long value){return new Vec2lImmutable(value);}
|
public static Vec2l of(long value){return new Vec2lImmutable(value);}
|
||||||
public static Vec2l newVec(long x, long y){return new Vec2lImmutable(x, y);}
|
public static Vec2l of(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(Vec2l value){return of(value.getX(), value.getY());}
|
||||||
|
|
||||||
public long getX();
|
public long getX();
|
||||||
public long getY();
|
public long getY();
|
||||||
|
@ -141,23 +141,23 @@ public interface Vec2l extends Vecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec2l asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec2l asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2l asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec2l asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2l copyAsMutable(){return newMutable(this);}
|
public default Vec2l copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2l copyAsImmutable(){return newVec(this);}
|
public default Vec2l copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,25 @@ public class Vec2lImmutable implements Vec2l
|
||||||
@Override
|
@Override
|
||||||
public Vec2l setX(long x)
|
public Vec2l setX(long x)
|
||||||
{
|
{
|
||||||
return this.x == x ? this : Vec2l.newVec(x, y);
|
return this.x == x ? this : Vec2l.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2l setY(long y)
|
public Vec2l setY(long y)
|
||||||
{
|
{
|
||||||
return this.y == y ? this : Vec2l.newVec(x, y);
|
return this.y == y ? this : Vec2l.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2l copy()
|
public Vec2l copy()
|
||||||
{
|
{
|
||||||
return Vec2l.newVec(this);
|
return Vec2l.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2l set(long x, long y)
|
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
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Vec2lMutable implements Vec2l
|
||||||
@Override
|
@Override
|
||||||
public Vec2l copy()
|
public Vec2l copy()
|
||||||
{
|
{
|
||||||
return Vec2l.newMutable(this);
|
return Vec2l.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,19 +13,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec3s;
|
||||||
|
|
||||||
public interface Vec3l extends Vecl
|
public interface Vec3l extends Vecl
|
||||||
{
|
{
|
||||||
public static final Vec3l ZERO = newVec();
|
public static final Vec3l ZERO = of();
|
||||||
public static final Vec3l MINUS_ONE = newVec(-1L);
|
public static final Vec3l MINUS_ONE = of(-1L);
|
||||||
public static final Vec3l ONE = newVec(1L);
|
public static final Vec3l ONE = of(1L);
|
||||||
|
|
||||||
public static Vec3l newMutable(){return new Vec3lMutable();}
|
public static Vec3l mutable(){return new Vec3lMutable();}
|
||||||
public static Vec3l newMutable(long value){return new Vec3lMutable(value);}
|
public static Vec3l mutable(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 mutable(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(Vec3l vec){return mutable(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public static Vec3l newVec(){return new Vec3lImmutable();}
|
public static Vec3l of(){return new Vec3lImmutable();}
|
||||||
public static Vec3l newVec(long value){return new Vec3lImmutable(value);}
|
public static Vec3l of(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 of(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(Vec3l vec){return of(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public long getX();
|
public long getX();
|
||||||
public long getY();
|
public long getY();
|
||||||
|
@ -135,22 +135,22 @@ public interface Vec3l extends Vecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec3l asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec3l asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3l asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec3l asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3l copyAsMutable(){return newMutable(this);}
|
public default Vec3l copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3l copyAsImmutable(){return newVec(this);}
|
public default Vec3l copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,31 +56,31 @@ public class Vec3lImmutable implements Vec3l
|
||||||
@Override
|
@Override
|
||||||
public Vec3l setX(long x)
|
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
|
@Override
|
||||||
public Vec3l setY(long y)
|
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
|
@Override
|
||||||
public Vec3l setZ(long z)
|
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
|
@Override
|
||||||
public Vec3l copy()
|
public Vec3l copy()
|
||||||
{
|
{
|
||||||
return Vec3l.newVec(this);
|
return Vec3l.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3l set(long x, long y, long z)
|
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
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class Vec3lMutable implements Vec3l
|
||||||
@Override
|
@Override
|
||||||
public Vec3l copy()
|
public Vec3l copy()
|
||||||
{
|
{
|
||||||
return Vec3l.newMutable(this);
|
return Vec3l.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.shorts.Vec4s;
|
||||||
|
|
||||||
public interface Vec4l extends Vecl
|
public interface Vec4l extends Vecl
|
||||||
{
|
{
|
||||||
public static final Vec4l ZERO = newVec();
|
public static final Vec4l ZERO = of();
|
||||||
public static final Vec4l MINUS_ONE = newVec(-1L);
|
public static final Vec4l MINUS_ONE = of(-1L);
|
||||||
public static final Vec4l ONE = newVec(1L);
|
public static final Vec4l ONE = of(1L);
|
||||||
|
|
||||||
public static Vec4l newMutable(){return new Vec4lMutable();}
|
public static Vec4l mutable(){return new Vec4lMutable();}
|
||||||
public static Vec4l newMutable(long value){return new Vec4lMutable(value);}
|
public static Vec4l mutable(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 mutable(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(Vec4l vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public static Vec4l newVec(){return new Vec4lImmutable();}
|
public static Vec4l of(){return new Vec4lImmutable();}
|
||||||
public static Vec4l newVec(long value){return new Vec4lImmutable(value);}
|
public static Vec4l of(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 of(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(Vec4l vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public long getX();
|
public long getX();
|
||||||
public long getY();
|
public long getY();
|
||||||
|
@ -137,22 +137,22 @@ public interface Vec4l extends Vecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec4l asMutable(){return isMutable() ? this : newMutable(this);}
|
public default Vec4l asMutable(){return isMutable() ? this : mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4l asImmutable(){return isMutable() ? newVec(this) : this;}
|
public default Vec4l asImmutable(){return isMutable() ? of(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4l copyAsMutable(){return newMutable(this);}
|
public default Vec4l copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4l copyAsImmutable(){return newVec(this);}
|
public default Vec4l copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,37 +66,37 @@ public class Vec4lImmutable implements Vec4l
|
||||||
@Override
|
@Override
|
||||||
public Vec4l setX(long x)
|
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
|
@Override
|
||||||
public Vec4l setY(long y)
|
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
|
@Override
|
||||||
public Vec4l setZ(long z)
|
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
|
@Override
|
||||||
public Vec4l setW(long w)
|
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
|
@Override
|
||||||
public Vec4l copy()
|
public Vec4l copy()
|
||||||
{
|
{
|
||||||
return Vec4l.newVec(this);
|
return Vec4l.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec4l set(long x, long y, long z, long w)
|
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
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class Vec4lMutable implements Vec4l
|
||||||
@Override
|
@Override
|
||||||
public Vec4l copy()
|
public Vec4l copy()
|
||||||
{
|
{
|
||||||
return Vec4l.newMutable(this);
|
return Vec4l.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,9 +13,9 @@ import speiger.src.coreengine.math.vector.quaternion.Quaternion;
|
||||||
|
|
||||||
public class Matrix4f
|
public class Matrix4f
|
||||||
{
|
{
|
||||||
static final Vec3f X_ROTATION = Vec3f.newVec(1F, 0F, 0F);
|
static final Vec3f X_ROTATION = Vec3f.of(1F, 0F, 0F);
|
||||||
static final Vec3f Y_ROTATION = Vec3f.newVec(0F, 1F, 0F);
|
static final Vec3f Y_ROTATION = Vec3f.of(0F, 1F, 0F);
|
||||||
static final Vec3f Z_ROTATION = Vec3f.newVec(0F, 0F, 1F);
|
static final Vec3f Z_ROTATION = Vec3f.of(0F, 0F, 1F);
|
||||||
|
|
||||||
float[] data = new float[16];
|
float[] data = new float[16];
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,20 @@ import speiger.src.coreengine.math.vector.matrix.Matrix4f;
|
||||||
|
|
||||||
public interface Quaternion
|
public interface Quaternion
|
||||||
{
|
{
|
||||||
public static final Quaternion ZERO = newQuat(0F, 0F, 0F, 0F);
|
public static final Quaternion ZERO = of(0F, 0F, 0F, 0F);
|
||||||
public static final Quaternion IDENTITY = newQuat();
|
public static final Quaternion IDENTITY = of();
|
||||||
|
|
||||||
public static Quaternion newQuat(){return new QuaternionImmutable();}
|
public static Quaternion mutable(){return new QuaternionMutable();}
|
||||||
public static Quaternion newQuat(Quaternion source){return newQuat(source.getX(), source.getY(), source.getZ(), source.getW());}
|
public static Quaternion mutable(Quaternion source){return mutable(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 mutable(float x, float y, float z, float w){return new QuaternionMutable(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 mutableRad(float x, float y, float z, float angle){return mutable().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 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 of(){return new QuaternionImmutable();}
|
||||||
public static Quaternion newMutable(Quaternion source){return newMutable(source.getX(), source.getY(), source.getZ(), source.getW());}
|
public static Quaternion of(Quaternion source){return of(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 of(float x, float y, float z, float w){return new QuaternionImmutable(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 ofRad(float x, float y, float z, float angle){return ZERO.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 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));}
|
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 double lengthSquared(){return (getX() * getX()) + (getY() * getY()) + (getZ() * getZ()) + (getW() * getW());}
|
||||||
|
|
||||||
public default Matrix4f asRotationMatrix(){return new Matrix4f().rotate(this);}
|
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)
|
public default Vec4f toAxisDegreeRotation(Vec4f input)
|
||||||
{
|
{
|
||||||
double invSqrt = 1.0D / Math.sqrt(1.0D - getW() * getW());
|
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));
|
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)
|
public default Vec4f toAxisRotation(Vec4f input)
|
||||||
{
|
{
|
||||||
double invSqrt = 1.0D / Math.sqrt(1.0D - getW() * getW());
|
double invSqrt = 1.0D / Math.sqrt(1.0D - getW() * getW());
|
||||||
|
@ -209,8 +209,8 @@ public interface Quaternion
|
||||||
|
|
||||||
public Quaternion copy();
|
public Quaternion copy();
|
||||||
public boolean isMutable();
|
public boolean isMutable();
|
||||||
public default Quaternion asMutable(){return isMutable() ? this : newQuat(this);}
|
public default Quaternion asMutable(){return isMutable() ? this : of(this);}
|
||||||
public default Quaternion asImmutable(){return isMutable() ? newMutable(this) : this;}
|
public default Quaternion asImmutable(){return isMutable() ? mutable(this) : this;}
|
||||||
public default Quaternion copyAsMutable(){return newMutable(this);}
|
public default Quaternion copyAsMutable(){return mutable(this);}
|
||||||
public default Quaternion copyAsImmutable(){return newQuat(this);}
|
public default Quaternion copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,13 @@ public class QuaternionImmutable implements Quaternion
|
||||||
@Override
|
@Override
|
||||||
public Quaternion set(float x, float y, float z, float w)
|
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
|
@Override
|
||||||
public Quaternion copy()
|
public Quaternion copy()
|
||||||
{
|
{
|
||||||
return Quaternion.newQuat(this);
|
return Quaternion.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class QuaternionMutable implements Quaternion
|
||||||
@Override
|
@Override
|
||||||
public Quaternion copy()
|
public Quaternion copy()
|
||||||
{
|
{
|
||||||
return Quaternion.newMutable(this);
|
return Quaternion.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.longs.Vec2l;
|
||||||
|
|
||||||
public interface Vec2s extends Vecs
|
public interface Vec2s extends Vecs
|
||||||
{
|
{
|
||||||
public static final Vec2s ZERO = newVec();
|
public static final Vec2s ZERO = of();
|
||||||
public static final Vec2s MINUS_ONE = newVec((short)-1);
|
public static final Vec2s MINUS_ONE = of((short)-1);
|
||||||
public static final Vec2s ONE = newVec((short)1);
|
public static final Vec2s ONE = of((short)1);
|
||||||
|
|
||||||
public static Vec2s newMutable(){return new Vec2sMutable();}
|
public static Vec2s mutable(){return new Vec2sMutable();}
|
||||||
public static Vec2s newMutable(short value){return new Vec2sMutable(value);}
|
public static Vec2s mutable(short value){return new Vec2sMutable(value);}
|
||||||
public static Vec2s newMutable(short x, short y){return new Vec2sMutable(x, y);}
|
public static Vec2s mutable(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(Vec2s value){return mutable(value.getX(), value.getY());}
|
||||||
|
|
||||||
public static Vec2s newVec(){return new Vec2sImmutable();}
|
public static Vec2s of(){return new Vec2sImmutable();}
|
||||||
public static Vec2s newVec(short value){return new Vec2sImmutable(value);}
|
public static Vec2s of(short value){return new Vec2sImmutable(value);}
|
||||||
public static Vec2s newVec(short x, short y){return new Vec2sImmutable(x, y);}
|
public static Vec2s of(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(Vec2s value){return of(value.getX(), value.getY());}
|
||||||
|
|
||||||
public short getX();
|
public short getX();
|
||||||
public short getY();
|
public short getY();
|
||||||
|
@ -141,22 +141,22 @@ public interface Vec2s extends Vecs
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec2s asMutable(){return isMutable() ? this : newVec(this);}
|
public default Vec2s asMutable(){return isMutable() ? this : of(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2s asImmutable(){return isMutable() ? newMutable(this) : this;}
|
public default Vec2s asImmutable(){return isMutable() ? mutable(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2s copyAsMutable(){return newMutable(this);}
|
public default Vec2s copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec2s copyAsImmutable(){return newVec(this);}
|
public default Vec2s copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,25 @@ public class Vec2sImmutable implements Vec2s
|
||||||
@Override
|
@Override
|
||||||
public Vec2s setX(short x)
|
public Vec2s setX(short x)
|
||||||
{
|
{
|
||||||
return this.x == x ? this : Vec2s.newVec(x, y);
|
return this.x == x ? this : Vec2s.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2s setY(short y)
|
public Vec2s setY(short y)
|
||||||
{
|
{
|
||||||
return this.y == y ? this : Vec2s.newVec(x, y);
|
return this.y == y ? this : Vec2s.of(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2s copy()
|
public Vec2s copy()
|
||||||
{
|
{
|
||||||
return Vec2s.newVec(this);
|
return Vec2s.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2s set(short x, short y)
|
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
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Vec2sMutable implements Vec2s
|
||||||
@Override
|
@Override
|
||||||
public Vec2s copy()
|
public Vec2s copy()
|
||||||
{
|
{
|
||||||
return Vec2s.newMutable(this);
|
return Vec2s.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.longs.Vec3l;
|
||||||
|
|
||||||
public interface Vec3s extends Vecs
|
public interface Vec3s extends Vecs
|
||||||
{
|
{
|
||||||
public static final Vec3s ZERO = newVec();
|
public static final Vec3s ZERO = of();
|
||||||
public static final Vec3s MINUS_ONE = newVec((short)-1);
|
public static final Vec3s MINUS_ONE = of((short)-1);
|
||||||
public static final Vec3s ONE = newVec((short)1);
|
public static final Vec3s ONE = of((short)1);
|
||||||
|
|
||||||
public static Vec3s newMutable(){return new Vec3sMutable();}
|
public static Vec3s mutable(){return new Vec3sMutable();}
|
||||||
public static Vec3s newMutable(short value){return new Vec3sMutable(value);}
|
public static Vec3s mutable(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 mutable(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(Vec3s vec){return mutable(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public static Vec3s newVec(){return new Vec3sImmutable();}
|
public static Vec3s of(){return new Vec3sImmutable();}
|
||||||
public static Vec3s newVec(short value){return new Vec3sImmutable(value);}
|
public static Vec3s of(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 of(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(Vec3s vec){return of(vec.getX(), vec.getY(), vec.getZ());}
|
||||||
|
|
||||||
public short getX();
|
public short getX();
|
||||||
public short getY();
|
public short getY();
|
||||||
|
@ -134,23 +134,23 @@ public interface Vec3s extends Vecs
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec3s asMutable(){return isMutable() ? this : newVec(this);}
|
public default Vec3s asMutable(){return isMutable() ? this : of(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3s asImmutable(){return isMutable() ? newMutable(this) : this;}
|
public default Vec3s asImmutable(){return isMutable() ? mutable(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3s copyAsMutable(){return newMutable(this);}
|
public default Vec3s copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec3s copyAsImmutable(){return newVec(this);}
|
public default Vec3s copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,31 +56,31 @@ public class Vec3sImmutable implements Vec3s
|
||||||
@Override
|
@Override
|
||||||
public Vec3s setX(short x)
|
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
|
@Override
|
||||||
public Vec3s setY(short y)
|
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
|
@Override
|
||||||
public Vec3s setZ(short z)
|
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
|
@Override
|
||||||
public Vec3s copy()
|
public Vec3s copy()
|
||||||
{
|
{
|
||||||
return Vec3s.newVec(this);
|
return Vec3s.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3s set(short x, short y, short z)
|
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
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class Vec3sMutable implements Vec3s
|
||||||
@Override
|
@Override
|
||||||
public Vec3s copy()
|
public Vec3s copy()
|
||||||
{
|
{
|
||||||
return Vec3s.newMutable(this);
|
return Vec3s.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,19 +12,19 @@ import speiger.src.coreengine.math.vector.longs.Vec4l;
|
||||||
|
|
||||||
public interface Vec4s extends Vecs
|
public interface Vec4s extends Vecs
|
||||||
{
|
{
|
||||||
public static final Vec4s ZERO = newVec();
|
public static final Vec4s ZERO = of();
|
||||||
public static final Vec4s MINUS_ONE = newVec((short)-1);
|
public static final Vec4s MINUS_ONE = of((short)-1);
|
||||||
public static final Vec4s ONE = newVec((short)1);
|
public static final Vec4s ONE = of((short)1);
|
||||||
|
|
||||||
public static Vec4s newMutable(){return new Vec4sMutable();}
|
public static Vec4s mutable(){return new Vec4sMutable();}
|
||||||
public static Vec4s newMutable(short value){return new Vec4sMutable(value);}
|
public static Vec4s mutable(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 mutable(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(Vec4s vec){return mutable(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public static Vec4s newVec(){return new Vec4sImmutable();}
|
public static Vec4s of(){return new Vec4sImmutable();}
|
||||||
public static Vec4s newVec(short value){return new Vec4sImmutable(value);}
|
public static Vec4s of(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 of(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(Vec4s vec){return of(vec.getX(), vec.getY(), vec.getZ(), vec.getW());}
|
||||||
|
|
||||||
public short getX();
|
public short getX();
|
||||||
public short getY();
|
public short getY();
|
||||||
|
@ -137,23 +137,23 @@ public interface Vec4s extends Vecs
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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
|
@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
|
@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
|
@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
|
@Override
|
||||||
public default Vec4s asMutable(){return isMutable() ? this : newVec(this);}
|
public default Vec4s asMutable(){return isMutable() ? this : of(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4s asImmutable(){return isMutable() ? newMutable(this) : this;}
|
public default Vec4s asImmutable(){return isMutable() ? mutable(this) : this;}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4s copyAsMutable(){return newMutable(this);}
|
public default Vec4s copyAsMutable(){return mutable(this);}
|
||||||
@Override
|
@Override
|
||||||
public default Vec4s copyAsImmutable(){return newVec(this);}
|
public default Vec4s copyAsImmutable(){return of(this);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,37 +66,37 @@ public class Vec4sImmutable implements Vec4s
|
||||||
@Override
|
@Override
|
||||||
public Vec4s setX(short x)
|
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
|
@Override
|
||||||
public Vec4s setY(short y)
|
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
|
@Override
|
||||||
public Vec4s setZ(short z)
|
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
|
@Override
|
||||||
public Vec4s setW(short w)
|
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
|
@Override
|
||||||
public Vec4s copy()
|
public Vec4s copy()
|
||||||
{
|
{
|
||||||
return Vec4s.newVec(this);
|
return Vec4s.of(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec4s set(short x, short y, short z, short w)
|
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
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class Vec4sMutable implements Vec4s
|
||||||
@Override
|
@Override
|
||||||
public Vec4s copy()
|
public Vec4s copy()
|
||||||
{
|
{
|
||||||
return Vec4s.newMutable(this);
|
return Vec4s.mutable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.base.IKeyComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.Align;
|
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.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.helper.constrains.Constrain;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.FontRenderer;
|
import speiger.src.coreengine.rendering.gui.renderer.FontRenderer;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
||||||
|
@ -73,17 +73,17 @@ public abstract class GuiBase
|
||||||
|
|
||||||
public <T extends GuiComponent> T addComponent(T comp, Constrain xPos, Constrain yPos, Constrain width, Constrain height)
|
public <T extends GuiComponent> 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 extends GuiComponent> T addComponent(int id, T comp, Constrain xPos, Constrain yPos, Constrain width, Constrain height)
|
public <T extends GuiComponent> 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 extends GuiComponent> T addComponent(T comp, ComponentConstrains contrains);
|
public abstract <T extends GuiComponent> T addComponent(T comp, Constrains contrains);
|
||||||
|
|
||||||
public abstract <T extends GuiComponent> T addComponent(int id, T comp, ComponentConstrains contrains);
|
public abstract <T extends GuiComponent> T addComponent(int id, T comp, Constrains contrains);
|
||||||
|
|
||||||
public <T extends GuiComponent> T centerComponent(T comp)
|
public <T extends GuiComponent> T centerComponent(T comp)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ public abstract class GuiBase
|
||||||
|
|
||||||
public abstract void removeKeyListener(IKeyComponent listener);
|
public abstract void removeKeyListener(IKeyComponent listener);
|
||||||
|
|
||||||
protected void addConstrains(GuiComponent comp, ComponentConstrains contrains)
|
protected void addConstrains(GuiComponent comp, Constrains contrains)
|
||||||
{
|
{
|
||||||
comp.constraints = contrains;
|
comp.constraints = contrains;
|
||||||
if(contrains != null)
|
if(contrains != null)
|
||||||
|
|
|
@ -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.animations.Animator;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.GuiBox;
|
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.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.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.FontRenderer;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.IComponentRenderer;
|
import speiger.src.coreengine.rendering.gui.renderer.IComponentRenderer;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
||||||
|
@ -59,7 +59,7 @@ public abstract class GuiComponent extends FlagHolder
|
||||||
final IGuiBox box;
|
final IGuiBox box;
|
||||||
GuiBase owner;
|
GuiBase owner;
|
||||||
GuiComponent parent;
|
GuiComponent parent;
|
||||||
ComponentConstrains constraints = null;
|
Constrains constraints = null;
|
||||||
Animator animation = null;
|
Animator animation = null;
|
||||||
KeyBindAction binding = null;
|
KeyBindAction binding = null;
|
||||||
IComponentRenderer<GuiComponent> customRenderer;
|
IComponentRenderer<GuiComponent> customRenderer;
|
||||||
|
@ -303,9 +303,10 @@ public abstract class GuiComponent extends FlagHolder
|
||||||
return isVisible() && (parent == null || parent.isVisible());
|
return isVisible() && (parent == null || parent.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setMassChanging()
|
public final GuiComponent setMassChanging()
|
||||||
{
|
{
|
||||||
setFlag(FLAG_MASS_CHANGE);
|
setFlag(FLAG_MASS_CHANGE);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final <T extends GuiComponent> T setMassChanging(Class<T> clz)
|
public final <T extends GuiComponent> T setMassChanging(Class<T> clz)
|
||||||
|
@ -364,7 +365,7 @@ public abstract class GuiComponent extends FlagHolder
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent setScissorsTest(boolean value)
|
public final GuiComponent setScissorsTest(boolean value)
|
||||||
{
|
{
|
||||||
setFlag(FLAG_TEST_SCISSORS, value);
|
setFlag(FLAG_TEST_SCISSORS, value);
|
||||||
return this;
|
return this;
|
||||||
|
@ -480,10 +481,10 @@ public abstract class GuiComponent extends FlagHolder
|
||||||
|
|
||||||
public <T extends GuiComponent> T addChild(T comp, Constrain xPos, Constrain yPos, Constrain width, Constrain height)
|
public <T extends GuiComponent> 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 extends GuiComponent> T addChild(T comp, ComponentConstrains constrains)
|
public <T extends GuiComponent> T addChild(T comp, Constrains constrains)
|
||||||
{
|
{
|
||||||
comp.constraints = constrains;
|
comp.constraints = constrains;
|
||||||
comp.parent = this;
|
comp.parent = this;
|
||||||
|
@ -516,7 +517,7 @@ public abstract class GuiComponent extends FlagHolder
|
||||||
return popup;
|
return popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addConstrains(GuiComponent comp, ComponentConstrains constrains)
|
protected void addConstrains(GuiComponent comp, Constrains constrains)
|
||||||
{
|
{
|
||||||
comp.constraints = constrains;
|
comp.constraints = constrains;
|
||||||
if(constrains != null)
|
if(constrains != null)
|
||||||
|
@ -1140,6 +1141,5 @@ public abstract class GuiComponent extends FlagHolder
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import speiger.src.coreengine.math.misc.ColorUtils;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiBase;
|
import speiger.src.coreengine.rendering.gui.GuiBase;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.TooltipPanel;
|
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.rendering.gui.renderer.UIRenderer;
|
||||||
import speiger.src.coreengine.utils.collections.iterators.IterableWrapper;
|
import speiger.src.coreengine.utils.collections.iterators.IterableWrapper;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class GuiScreenBase extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends GuiComponent> T addComponent(T comp, ComponentConstrains contrains)
|
public <T extends GuiComponent> T addComponent(T comp, Constrains contrains)
|
||||||
{
|
{
|
||||||
components.add(comp);
|
components.add(comp);
|
||||||
renderOrder.addAndMoveToLast(comp);
|
renderOrder.addAndMoveToLast(comp);
|
||||||
|
@ -78,7 +78,7 @@ public class GuiScreenBase extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends GuiComponent> T addComponent(int id, T comp, ComponentConstrains contrains)
|
public <T extends GuiComponent> T addComponent(int id, T comp, Constrains contrains)
|
||||||
{
|
{
|
||||||
getters.put(id, comp);
|
getters.put(id, comp);
|
||||||
return addComponent(comp, contrains);
|
return addComponent(comp, contrains);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package speiger.src.coreengine.rendering.gui.components;
|
||||||
|
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.base.IButtonComponent;
|
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
|
public class ButtonComponent extends GuiComponent implements IButtonComponent
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ public class ButtonComponent extends GuiComponent implements IButtonComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addChild(text, Constraints.getParentConstrains());
|
addChild(text, Constrains.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent getText()
|
public TextComponent getText()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package speiger.src.coreengine.rendering.gui.components;
|
package speiger.src.coreengine.rendering.gui.components;
|
||||||
|
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
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
|
public class LabelComponent extends GuiComponent
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ public class LabelComponent extends GuiComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addChild(text, Constraints.getParentConstrains());
|
addChild(text, Constrains.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.base.IButtonComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.list.IListEntry;
|
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.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.UIRenderer;
|
||||||
import speiger.src.coreengine.rendering.input.Keyboard;
|
import speiger.src.coreengine.rendering.input.Keyboard;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class ListComponent<T extends IListEntry> extends GuiComponent
|
||||||
protected float cachedWidth = 0F;
|
protected float cachedWidth = 0F;
|
||||||
protected ScrollBarComponent verticalBar = new ScrollBarComponent(ColorUtils.LIGHT_GRAY);
|
protected ScrollBarComponent verticalBar = new ScrollBarComponent(ColorUtils.LIGHT_GRAY);
|
||||||
protected ScrollBarComponent horizontalBar = new ScrollBarComponent(ColorUtils.LIGHT_GRAY).setHorizontal(true);
|
protected ScrollBarComponent horizontalBar = new ScrollBarComponent(ColorUtils.LIGHT_GRAY).setHorizontal(true);
|
||||||
protected Vec2i lastMouse = Vec2i.newMutable();
|
protected Vec2i lastMouse = Vec2i.mutable();
|
||||||
|
|
||||||
public ListComponent()
|
public ListComponent()
|
||||||
{
|
{
|
||||||
|
@ -79,8 +79,8 @@ public class ListComponent<T extends IListEntry> extends GuiComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addChild(horizontalBar, Constraints.getScrollbarConstraints(verticalBar::isInUse, true, 5F));
|
addChild(horizontalBar, Constrains.scrollBar(verticalBar::isInUse, true, 5F));
|
||||||
addChild(verticalBar, Constraints.getScrollbarConstraints(horizontalBar::isInUse, false, 5F));
|
addChild(verticalBar, Constrains.scrollBar(horizontalBar::isInUse, false, 5F));
|
||||||
for(int i = 0, m = entries.size();i < m;i++)
|
for(int i = 0, m = entries.size();i < m;i++)
|
||||||
{
|
{
|
||||||
entries.get(i).init(this, getGui());
|
entries.get(i).init(this, getGui());
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.util.function.IntSupplier;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
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.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;
|
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
||||||
|
|
||||||
public class ProgressBarComponent extends GuiComponent
|
public class ProgressBarComponent extends GuiComponent
|
||||||
|
@ -49,7 +49,7 @@ public class ProgressBarComponent extends GuiComponent
|
||||||
addBox(inner);
|
addBox(inner);
|
||||||
text.setZOffset(0.1F);
|
text.setZOffset(0.1F);
|
||||||
text.setText(stringify());
|
text.setText(stringify());
|
||||||
addChild(text, Constraints.getParentConstrains());
|
addChild(text, Constrains.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent getText()
|
public TextComponent getText()
|
||||||
|
|
|
@ -3,8 +3,8 @@ package speiger.src.coreengine.rendering.gui.components;
|
||||||
import speiger.src.coreengine.math.misc.ColorUtils;
|
import speiger.src.coreengine.math.misc.ColorUtils;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
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.ConditionalConstraint;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains;
|
||||||
|
|
||||||
public class ScrollPanelComponent extends GuiComponent
|
public class ScrollPanelComponent extends GuiComponent
|
||||||
{
|
{
|
||||||
|
@ -28,19 +28,19 @@ public class ScrollPanelComponent extends GuiComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addChild(horizontalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
addChild(horizontalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
||||||
addChild(verticalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F));
|
addChild(verticalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F));
|
||||||
viewPort.addChild(container);
|
viewPort.addChild(container);
|
||||||
container.addChangeListener(this::recalculateSize);
|
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)
|
public ScrollPanelComponent setForcedCorner(boolean value)
|
||||||
{
|
{
|
||||||
if(setFlag(FLAG_CORNER, value) && getGui() != null)
|
if(setFlag(FLAG_CORNER, value) && getGui() != null)
|
||||||
{
|
{
|
||||||
addConstrains(horizontalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
addConstrains(horizontalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
||||||
addConstrains(verticalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F));
|
addConstrains(verticalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, false, 5F));
|
||||||
onChanged(false);
|
onChanged(false);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package speiger.src.coreengine.rendering.gui.components;
|
||||||
import speiger.src.coreengine.math.misc.ColorUtils;
|
import speiger.src.coreengine.math.misc.ColorUtils;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
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.ConditionalConstraint;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.Constraints;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrains;
|
||||||
|
|
||||||
public class ScrollWindowComponent extends WindowComponent
|
public class ScrollWindowComponent extends WindowComponent
|
||||||
{
|
{
|
||||||
|
@ -28,11 +28,11 @@ public class ScrollWindowComponent extends WindowComponent
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
super.init();
|
super.init();
|
||||||
addChild(horizontalBar.addChangeListener(minimizedListener), Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
addChild(horizontalBar.addChangeListener(minimizedListener), Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
||||||
addChild(verticalBar.addChangeListener(minimizedListener), Constraints.getVerticalScrollbar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F));
|
addChild(verticalBar.addChangeListener(minimizedListener), Constrains.verticalScrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F));
|
||||||
viewPort.addChild(container);
|
viewPort.addChild(container);
|
||||||
container.addChangeListener(this::recalculateSize).addChangeListener(minimizedListener);
|
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 extends GuiComponent> T addComponent(T comp)
|
public <T extends GuiComponent> T addComponent(T comp)
|
||||||
|
@ -40,7 +40,7 @@ public class ScrollWindowComponent extends WindowComponent
|
||||||
return container.addChild(comp);
|
return container.addChild(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends GuiComponent> T addComponent(T comp, ComponentConstrains constraints)
|
public <T extends GuiComponent> T addComponent(T comp, Constrains constraints)
|
||||||
{
|
{
|
||||||
return container.addChild(comp, constraints);
|
return container.addChild(comp, constraints);
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,8 @@ public class ScrollWindowComponent extends WindowComponent
|
||||||
{
|
{
|
||||||
if(setFlag(FLAG_CORNER, value) && getGui() != null)
|
if(setFlag(FLAG_CORNER, value) && getGui() != null)
|
||||||
{
|
{
|
||||||
addConstrains(horizontalBar, Constraints.getScrollbarConstraints(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
addConstrains(horizontalBar, Constrains.scrollBar(isFlagSet(FLAG_CORNER) ? () -> true : verticalBar::isInUse, true, 5F));
|
||||||
addConstrains(verticalBar, Constraints.getVerticalScrollbar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F));
|
addConstrains(verticalBar, Constrains.verticalScrollBar(isFlagSet(FLAG_CORNER) ? () -> true : horizontalBar::isInUse, 7.5F, 5F));
|
||||||
onChanged(false);
|
onChanged(false);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -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.components.list.SelectionEntry;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.Align;
|
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.IGuiBox;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain.Target;
|
||||||
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;
|
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer;
|
import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer;
|
||||||
import speiger.src.coreengine.rendering.tesselation.Tesselator;
|
import speiger.src.coreengine.rendering.tesselation.Tesselator;
|
||||||
|
@ -71,8 +70,8 @@ public class SelectionComponent extends GuiComponent implements IButtonComponent
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
list.setEntryHeight(getGui().getFont().height()).addUserActionListener(this);
|
list.setEntryHeight(getGui().getFont().height()).addUserActionListener(this);
|
||||||
addChild(text, Constraints.getParentConstrains(21F, 0F, 10.5F, 0F));
|
addChild(text, Constrains.parent(21F, 0F, 10.5F, 0F));
|
||||||
addChild(list, new ComponentConstrains(new ParentConstrain(), new ParentConstrain().invert(), new ParentConstrain(), null));
|
addChild(list, Constrains.parent(Target.X).invParent(Target.Y).parent(Target.WIDTH).build());
|
||||||
addCloseListener(buffer = getRenderer().createBuffer());
|
addCloseListener(buffer = getRenderer().createBuffer());
|
||||||
createArrow();
|
createArrow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import speiger.src.coreengine.math.misc.Facing;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.base.IButtonComponent;
|
import speiger.src.coreengine.rendering.gui.base.IButtonComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.UIShapes;
|
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;
|
import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer;
|
||||||
|
|
||||||
public class SliderComponent extends GuiComponent implements IButtonComponent
|
public class SliderComponent extends GuiComponent implements IButtonComponent
|
||||||
|
@ -43,7 +43,7 @@ public class SliderComponent extends GuiComponent implements IButtonComponent
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
text.setTextScale(0.35F);
|
text.setTextScale(0.35F);
|
||||||
addChild(text, Constraints.getParentConstrains());
|
addChild(text, Constrains.parent());
|
||||||
createArrow();
|
createArrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package speiger.src.coreengine.rendering.gui.components;
|
||||||
|
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.Align;
|
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;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
||||||
|
|
||||||
public class TabbedWindowComponent extends WindowComponent
|
public class TabbedWindowComponent extends WindowComponent
|
||||||
|
@ -23,9 +23,10 @@ public class TabbedWindowComponent extends WindowComponent
|
||||||
public static class Tab extends GuiComponent
|
public static class Tab extends GuiComponent
|
||||||
{
|
{
|
||||||
String name;
|
String name;
|
||||||
|
float width = -1F;
|
||||||
boolean closeable;
|
boolean closeable;
|
||||||
TextComponent comp;
|
TextComponent comp;
|
||||||
|
|
||||||
public Tab(String name)
|
public Tab(String name)
|
||||||
{
|
{
|
||||||
super(0F, 7F, 100F, 10F);
|
super(0F, 7F, 100F, 10F);
|
||||||
|
@ -36,7 +37,8 @@ public class TabbedWindowComponent extends WindowComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addChild(comp, Constraints.getParentConstrains());
|
width = getFont().width(name);
|
||||||
|
addChild(comp, Constrains.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package speiger.src.coreengine.rendering.gui.components;
|
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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain;
|
||||||
|
@ -37,7 +37,7 @@ public class TextCheckBoxComponent extends CheckBoxComponent
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
super.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()
|
public TextComponent getText()
|
||||||
|
|
|
@ -355,94 +355,83 @@ public class TextComponent extends GuiComponent
|
||||||
|
|
||||||
public final TextComponent italic(float value)
|
public final TextComponent italic(float value)
|
||||||
{
|
{
|
||||||
if(italic == value)
|
if(italic != value)
|
||||||
{
|
{
|
||||||
return this;
|
italic = value;
|
||||||
|
onChanged(true);
|
||||||
}
|
}
|
||||||
italic = value;
|
|
||||||
onChanged(true);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent align(Align horizontal, Align vertical)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent horizontal(Align horizontal)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent vertical(Align vertical)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent setText(String text)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent textColor(int color)
|
public TextComponent textColor(int color)
|
||||||
{
|
{
|
||||||
if(textColor == color)
|
if(textColor != color)
|
||||||
{
|
{
|
||||||
return this;
|
textColor = color;
|
||||||
|
onChanged(true);
|
||||||
}
|
}
|
||||||
textColor = color;
|
|
||||||
onChanged(true);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent backgroundColor(int color)
|
public TextComponent backgroundColor(int color)
|
||||||
{
|
{
|
||||||
if(backGroundColor == color)
|
if(backGroundColor != color)
|
||||||
{
|
{
|
||||||
return this;
|
backGroundColor = color;
|
||||||
|
onChanged(true);
|
||||||
}
|
}
|
||||||
backGroundColor = color;
|
|
||||||
onChanged(true);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent setFont(FontRenderer font)
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.Align;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
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.box.ParentBox;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.ComponentConstrains;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain.Target;
|
||||||
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.DynamicConstrain;
|
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
|
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.TextMetadata;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.lexer.Word;
|
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<String> validator)
|
public TextFieldComponent setValidator(Predicate<String> validator)
|
||||||
|
|
|
@ -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.base.IKeyComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.Align;
|
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.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.UIRenderer;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.lexer.Line;
|
import speiger.src.coreengine.rendering.gui.renderer.lexer.Line;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.lexer.TextMetadata;
|
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();
|
TextComponent text = new TextComponent().align(Align.LEFT_TOP, Align.LEFT_TOP).singleLine(true).special(false).cast();
|
||||||
int color;
|
int color;
|
||||||
int curserPosition = 0;
|
int curserPosition = 0;
|
||||||
Vec2i curserPos = Vec2i.newMutable();
|
Vec2i curserPos = Vec2i.mutable();
|
||||||
int selectionPosition = 0;
|
int selectionPosition = 0;
|
||||||
Vec2i selectionPos = Vec2i.newMutable();
|
Vec2i selectionPos = Vec2i.mutable();
|
||||||
long lastClickTime = 0;
|
long lastClickTime = 0;
|
||||||
int maxTextLength = 64;
|
int maxTextLength = 64;
|
||||||
int clickCount = 0;
|
int clickCount = 0;
|
||||||
|
@ -51,7 +51,7 @@ public class TextPanelComponent extends GuiComponent implements IButtonComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addChild(text, Constraints.getParentConstrains(1F));
|
addChild(text, Constrains.parent(1F));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextPanelComponent setValidator(Predicate<String> validator)
|
public TextPanelComponent setValidator(Predicate<String> validator)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import speiger.src.coreengine.math.misc.ColorUtils;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
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.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.MenuConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class TooltipPanel extends PanelComponent
|
||||||
{
|
{
|
||||||
renderedTooltips.put(entry.getKey(), entry.getValue());
|
renderedTooltips.put(entry.getKey(), entry.getValue());
|
||||||
indexedComponents.add(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[] data = new float[]{
|
||||||
Float.MAX_VALUE,
|
Float.MAX_VALUE,
|
||||||
|
|
|
@ -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.components.tree.ITreeEntry;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.UIShapes;
|
import speiger.src.coreengine.rendering.gui.helper.UIShapes;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
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.UIRenderer;
|
||||||
import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer;
|
import speiger.src.coreengine.rendering.gui.renderer.buffer.RenderBuffer;
|
||||||
import speiger.src.coreengine.rendering.input.Keyboard;
|
import speiger.src.coreengine.rendering.input.Keyboard;
|
||||||
|
@ -46,7 +46,7 @@ public class TreeComponent<T extends ITreeEntry> extends GuiComponent implements
|
||||||
int hoverIndex = -1;
|
int hoverIndex = -1;
|
||||||
int dragIndex = -1;
|
int dragIndex = -1;
|
||||||
int movement;
|
int movement;
|
||||||
Vec2i lastMouse = Vec2i.newMutable();
|
Vec2i lastMouse = Vec2i.mutable();
|
||||||
IButtonComponent customButton;
|
IButtonComponent customButton;
|
||||||
protected ObjectSet<T> openNodes = new ObjectOpenHashSet<>();
|
protected ObjectSet<T> openNodes = new ObjectOpenHashSet<>();
|
||||||
protected ObjectSet<T> selectedNodes = new ObjectOpenHashSet<>();
|
protected ObjectSet<T> selectedNodes = new ObjectOpenHashSet<>();
|
||||||
|
@ -98,8 +98,8 @@ public class TreeComponent<T extends ITreeEntry> extends GuiComponent implements
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
addCloseListener(buffer = getRenderer().createBuffer());
|
addCloseListener(buffer = getRenderer().createBuffer());
|
||||||
addChild(horizontalBar, Constraints.getScrollbarConstraints(verticalBar::isInUse, true, 5F));
|
addChild(horizontalBar, Constrains.scrollBar(verticalBar::isInUse, true, 5F));
|
||||||
addChild(verticalBar, Constraints.getScrollbarConstraints(horizontalBar::isInUse, false, 5F));
|
addChild(verticalBar, Constrains.scrollBar(horizontalBar::isInUse, false, 5F));
|
||||||
List<T> entries = new ObjectArrayList<T>();
|
List<T> entries = new ObjectArrayList<T>();
|
||||||
getNodes(node, entries, false);
|
getNodes(node, entries, false);
|
||||||
for(int i = 0, m = entries.size();i < m;i++)
|
for(int i = 0, m = entries.size();i < m;i++)
|
||||||
|
|
|
@ -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.components.icon.LineIcon;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.Align;
|
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.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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
||||||
import speiger.src.coreengine.rendering.utils.Cursor;
|
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<GuiComponent>
|
public class WindowComponent extends PanelComponent implements IButtonComponent, ObjIntConsumer<GuiComponent>
|
||||||
{
|
{
|
||||||
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_MINIMIZED = 1 << 20;
|
||||||
public static final int FLAG_RESIZEABLE = 1 << 21;
|
public static final int FLAG_RESIZEABLE = 1 << 21;
|
||||||
public static final int FLAG_MOVEABLE = 1 << 22;
|
public static final int FLAG_MOVEABLE = 1 << 22;
|
||||||
|
@ -49,8 +49,8 @@ public class WindowComponent extends PanelComponent implements IButtonComponent,
|
||||||
FacingList facing = null;
|
FacingList facing = null;
|
||||||
String name;
|
String name;
|
||||||
int color = ColorUtils.WINDOW_DEFAULT_BACKGROUND;
|
int color = ColorUtils.WINDOW_DEFAULT_BACKGROUND;
|
||||||
Vec2f lastSize = Vec2f.newMutable();
|
Vec2f lastSize = Vec2f.mutable();
|
||||||
Vec2i lastClick = Vec2i.newMutable();
|
Vec2i lastClick = Vec2i.mutable();
|
||||||
IValue animation = null;
|
IValue animation = null;
|
||||||
protected final Consumer<GuiComponent> closeListener = new ConsumerConverter<GuiComponent>(0, this);
|
protected final Consumer<GuiComponent> closeListener = new ConsumerConverter<GuiComponent>(0, this);
|
||||||
protected final Consumer<GuiComponent> minimizedListener = new ConsumerConverter<GuiComponent>(2, this);
|
protected final Consumer<GuiComponent> minimizedListener = new ConsumerConverter<GuiComponent>(2, this);
|
||||||
|
@ -71,16 +71,16 @@ public class WindowComponent extends PanelComponent implements IButtonComponent,
|
||||||
super.init();
|
super.init();
|
||||||
LabelComponent label = new LabelComponent(name, ColorUtils.DARK_GRAY);
|
LabelComponent label = new LabelComponent(name, ColorUtils.DARK_GRAY);
|
||||||
label.getText().setTextScale(0.4F).horizontal(Align.LEFT_TOP).singleLine(true);
|
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;
|
float offset = 9F;
|
||||||
if((flags & WINDOW_FLAG_CLOSEABLE) != 0)
|
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;
|
offset += 7.5F;
|
||||||
}
|
}
|
||||||
if((flags & WINDOW_FLAG_MINIMIZEABLE) != 0)
|
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())
|
if(canMoveIntoForground())
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import speiger.src.collections.objects.lists.ObjectArrayList;
|
import speiger.src.collections.objects.lists.ObjectArrayList;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
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.MenuConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
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.PixelConstrain;
|
||||||
|
@ -74,7 +74,7 @@ public class MenuBarComponent extends GuiComponent
|
||||||
{
|
{
|
||||||
menuItems.add(item);
|
menuItems.add(item);
|
||||||
item.setMenuColor(color);
|
item.setMenuColor(color);
|
||||||
addChild(item, new ComponentConstrains(new MenuConstrain<MenuItemComponent>(menuItems), new PixelConstrain(), item.createWidthConstriain(), new ParentConstrain()));
|
addChild(item, new Constrains(new MenuConstrain<MenuItemComponent>(menuItems), new PixelConstrain(), item.createWidthConstriain(), new ParentConstrain()));
|
||||||
item.setZOffset(0.3F);
|
item.setZOffset(0.3F);
|
||||||
item.setTextScale(scale);
|
item.setTextScale(scale);
|
||||||
item.onChanged(false);
|
item.onChanged(false);
|
||||||
|
|
|
@ -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.components.misc.ICheckBox;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.UIShapes;
|
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.Constrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain;
|
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.ParentConstrain;
|
||||||
|
@ -43,7 +43,7 @@ public class MenuCheckBoxComponent extends MenuItemComponent implements ICheckBo
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
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());
|
addCloseListener(buffer = getRenderer().createBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.function.Consumer;
|
||||||
|
|
||||||
import speiger.src.collections.objects.lists.ObjectArrayList;
|
import speiger.src.collections.objects.lists.ObjectArrayList;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
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.Constrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.MenuConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.MenuConstrain;
|
||||||
|
@ -133,10 +133,10 @@ public class MenuComponent extends MenuItemComponent implements Consumer<GuiComp
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ComponentConstrains createConstrains(MenuItemComponent comp)
|
protected Constrains createConstrains(MenuItemComponent comp)
|
||||||
{
|
{
|
||||||
Constrain constraint = isFlagSet(FLAG_SUB_MENU) ? new DynamicConstrain(() -> Math.max(getBox().getBaseWidth(), boxWidth / getBox().getScale())) : new PixelConstrain();
|
Constrain constraint = isFlagSet(FLAG_SUB_MENU) ? new DynamicConstrain(() -> Math.max(getBox().getBaseWidth(), boxWidth / getBox().getScale())) : new PixelConstrain();
|
||||||
return new ComponentConstrains(constraint, new MenuConstrain<MenuItemComponent>(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<MenuItemComponent>(components, isFlagSet(FLAG_SUB_MENU) ? MenuConstrain.DEFAULT : () -> getBox().getBaseHeight() + 0.1F).setPadding(0.01F), comp.createWidthConstriain(), new PixelConstrain(entryHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.base.IButtonComponent;
|
import speiger.src.coreengine.rendering.gui.base.IButtonComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.TextComponent;
|
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.Constrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.ParentConstrain;
|
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.PixelConstrain;
|
||||||
|
@ -77,7 +77,7 @@ public class MenuItemComponent extends GuiComponent implements IButtonComponent
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
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
|
@Override
|
||||||
|
|
|
@ -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.ScrollBarComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.TextFieldComponent;
|
import speiger.src.coreengine.rendering.gui.components.TextFieldComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.list.TextListEntry;
|
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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
||||||
|
@ -52,8 +52,8 @@ public class ConsoleComponent extends GuiComponent implements IKeyComponent
|
||||||
chat.addUserActionListener(this::onEnter);
|
chat.addUserActionListener(this::onEnter);
|
||||||
list.setSelectionMode(ListComponent.SELECTION_MODE_DISABLE);
|
list.setSelectionMode(ListComponent.SELECTION_MODE_DISABLE);
|
||||||
list.setStartAtBottom(true);
|
list.setStartAtBottom(true);
|
||||||
addChild(chat, new ComponentConstrains(new ParentConstrain(), new ParentConstrain(12F).invert(), new ParentConstrain(), new PixelConstrain(12F)));
|
addChild(chat, new Constrains(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(list, new Constrains(new ParentConstrain(), new ParentConstrain(100).invert(), new RelativeConstrain(0.8F), new PixelConstrain(88)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.components.icon.TexturedIcon;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.GuiBox;
|
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.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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
||||||
import speiger.src.coreengine.utils.functions.Functions;
|
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(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(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(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, "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 ComponentConstrains(new RelativeConstrain(0.5F), 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]);
|
setColor(hsv[0], hsv[1], hsv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.TextComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.WindowComponent;
|
import speiger.src.coreengine.rendering.gui.components.WindowComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.Align;
|
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.Constrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.DynamicConstrain;
|
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.ParentConstrain;
|
||||||
|
@ -61,18 +61,18 @@ public class PieProfilerWindowComponent extends WindowComponent
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
super.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[0] = createButton(0, "Client");
|
||||||
buttons[1] = createButton(1, "GPU");
|
buttons[1] = createButton(1, "GPU");
|
||||||
buttons[2] = createButton(2, "Server");
|
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] = 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));
|
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");
|
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");
|
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
|
@Override
|
||||||
public Vec2f getMinimumBounds()
|
public Vec2f getMinimumBounds()
|
||||||
{
|
{
|
||||||
return Vec2f.newVec(80F, 80F + (textInUse * 5.5F));
|
return Vec2f.of(80F, 80F + (textInUse * 5.5F));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
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));
|
comp.addChangeListener(T -> T.setVisible(!isMinimized() && index < textInUse));
|
||||||
Constrain xPos = column == 0 ? null : (column == 1 ? new PixelConstrain(38F).setInverted() : new PixelConstrain(19F).setInverted());
|
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;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ public class PieProfilerWindowComponent extends WindowComponent
|
||||||
ButtonComponent button = new ButtonComponent(name, ColorUtils.GRAY);
|
ButtonComponent button = new ButtonComponent(name, ColorUtils.GRAY);
|
||||||
button.getText().setTextScale(0.3F);
|
button.getText().setTextScale(0.3F);
|
||||||
button.addChangeListener(minimizedListener).addUserActionListener(T -> setProfiler(getProfiler(index), getRoot(index)));
|
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;
|
return button;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.TreeComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.WindowComponent;
|
import speiger.src.coreengine.rendering.gui.components.WindowComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.tree.ProfilerTreeEntry;
|
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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
||||||
|
@ -43,7 +43,7 @@ public class TreeProfilerWindowComponent extends WindowComponent
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
super.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[0] = createButton(0, "Client");
|
||||||
buttons[1] = createButton(1, "GPU");
|
buttons[1] = createButton(1, "GPU");
|
||||||
buttons[2] = createButton(2, "Server");
|
buttons[2] = createButton(2, "Server");
|
||||||
|
@ -172,13 +172,13 @@ public class TreeProfilerWindowComponent extends WindowComponent
|
||||||
ButtonComponent button = new ButtonComponent(name, ColorUtils.GRAY);
|
ButtonComponent button = new ButtonComponent(name, ColorUtils.GRAY);
|
||||||
button.getText().setTextScale(0.3F);
|
button.getText().setTextScale(0.3F);
|
||||||
button.addChangeListener(minimizedListener).addUserActionListener(T -> setProfiler(getProfiler(index), PieProfilerWindowComponent.getRoot(index)));
|
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;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec2f getMinimumBounds()
|
public Vec2f getMinimumBounds()
|
||||||
{
|
{
|
||||||
return Vec2f.newVec(100F, 50F);
|
return Vec2f.of(100F, 50F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ButtonComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.TextComponent;
|
import speiger.src.coreengine.rendering.gui.components.TextComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.WindowComponent;
|
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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.RelativeConstrain;
|
||||||
|
@ -46,9 +46,9 @@ public class ChoiceComponent extends WindowComponent
|
||||||
super.init();
|
super.init();
|
||||||
yesButton.getText().setTextScale(0.5F);
|
yesButton.getText().setTextScale(0.5F);
|
||||||
noButton.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(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 ComponentConstrains(new RelativeConstrain(0.5F), 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 ComponentConstrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message)));
|
addChild(message, new Constrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message)));
|
||||||
getBox().setHeight(25F + message.getMetadata().getMaxHeight());
|
getBox().setHeight(25F + message.getMetadata().getMaxHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.ButtonComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.TextComponent;
|
import speiger.src.coreengine.rendering.gui.components.TextComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.components.WindowComponent;
|
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.ParentConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.PixelConstrain;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain;
|
import speiger.src.coreengine.rendering.gui.helper.constrains.TextConstrain;
|
||||||
|
@ -61,8 +61,8 @@ public class MessageComponent extends WindowComponent
|
||||||
{
|
{
|
||||||
super.init();
|
super.init();
|
||||||
resultButton.getText().setTextScale(0.5F);
|
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(resultButton.addChangeListener(minimizedListener).addUserActionListener(closeListener), new Constrains(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(message, new Constrains(new PixelConstrain(10F), new PixelConstrain(11F), new ParentConstrain(10F), TextConstrain.height(message)));
|
||||||
getBox().setHeight(25F + message.getMetadata().getMaxHeight());
|
getBox().setHeight(25F + message.getMetadata().getMaxHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class FontBuilder
|
||||||
result.getValue().add(new WrittenChar(pair.getLetter(), entry.getX(), entry.getY(), entry.getWidth(), entry.getHeight(), pair.isBold()));
|
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())));
|
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();
|
graphics.dispose();
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import speiger.src.coreengine.utils.functions.FloatSupplier;
|
||||||
|
|
||||||
public class CenterConstrain extends Constrain
|
public class CenterConstrain extends Constrain
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply()
|
public void apply()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,7 +14,12 @@ public class ConditionalConstraint extends Constrain
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.target = target;
|
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
|
@Override
|
||||||
public void apply()
|
public void apply()
|
||||||
{
|
{
|
||||||
|
@ -22,7 +27,7 @@ public class ConditionalConstraint extends Constrain
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setComponents(GuiComponent owner, GuiComponent parent, ConstrainTarget target)
|
public void setComponents(GuiComponent owner, GuiComponent parent, Target target)
|
||||||
{
|
{
|
||||||
super.setComponents(owner, parent, target);
|
super.setComponents(owner, parent, target);
|
||||||
for(int i = 0,m=this.target.length;i<m;i++)
|
for(int i = 0,m=this.target.length;i<m;i++)
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
package speiger.src.coreengine.rendering.gui.helper.constrains;
|
package speiger.src.coreengine.rendering.gui.helper.constrains;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import speiger.src.collections.objects.utils.ObjectArrays;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiBase;
|
import speiger.src.coreengine.rendering.gui.GuiBase;
|
||||||
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
|
||||||
|
|
||||||
public abstract class Constrain
|
public abstract class Constrain
|
||||||
{
|
{
|
||||||
protected ConstrainTarget target;
|
protected Target target;
|
||||||
protected GuiComponent owner;
|
protected GuiComponent owner;
|
||||||
protected GuiComponent parent;
|
protected GuiComponent parent;
|
||||||
|
|
||||||
public void setComponents(GuiComponent owner, GuiComponent parent, ConstrainTarget target)
|
public void setComponents(GuiComponent owner, GuiComponent parent, Target target)
|
||||||
{
|
{
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
@ -24,12 +27,12 @@ public abstract class Constrain
|
||||||
target.set(owner.getBox(), value);
|
target.set(owner.getBox(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final float get(ConstrainTarget target)
|
protected final float get(Target target)
|
||||||
{
|
{
|
||||||
return parent != null ? target.get(parent.getBox()) : target.get(owner.getGui());
|
return parent != null ? target.get(parent.getBox()) : target.get(owner.getGui());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final float getOwner(ConstrainTarget target)
|
protected final float getOwner(Target target)
|
||||||
{
|
{
|
||||||
return target.get(owner.getBox());
|
return target.get(owner.getBox());
|
||||||
}
|
}
|
||||||
|
@ -39,24 +42,41 @@ public abstract class Constrain
|
||||||
return parent != null ? parent.getBox().getScale() : 1F;
|
return parent != null ? parent.getBox().getScale() : 1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum ConstrainTarget
|
public static enum Target
|
||||||
{
|
{
|
||||||
X_POS,
|
X,
|
||||||
Y_POS,
|
Y,
|
||||||
WIDTH,
|
WIDTH,
|
||||||
HEIGHT;
|
HEIGHT;
|
||||||
|
|
||||||
public boolean isPosition()
|
static final Target[] BY_INDEX = create();
|
||||||
|
|
||||||
|
public static Target by(int index)
|
||||||
{
|
{
|
||||||
return this == X_POS || this == Y_POS;
|
return BY_INDEX[index & 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstrainTarget toWidth()
|
public static Target pos(boolean x)
|
||||||
|
{
|
||||||
|
return x ? X : Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Target bounds(boolean x)
|
||||||
|
{
|
||||||
|
return x ? WIDTH : HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPosition()
|
||||||
|
{
|
||||||
|
return this == X || this == Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Target toWidth()
|
||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
{
|
{
|
||||||
case X_POS: return WIDTH;
|
case X: return WIDTH;
|
||||||
case Y_POS: return HEIGHT;
|
case Y: return HEIGHT;
|
||||||
default: return this;
|
default: return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,8 +85,8 @@ public abstract class Constrain
|
||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
{
|
{
|
||||||
case X_POS: return 0F;
|
case X: return 0F;
|
||||||
case Y_POS: return 0F;
|
case Y: return 0F;
|
||||||
case WIDTH: return gui.width;
|
case WIDTH: return gui.width;
|
||||||
case HEIGHT: return gui.height;
|
case HEIGHT: return gui.height;
|
||||||
default: return 0F;
|
default: return 0F;
|
||||||
|
@ -77,8 +97,8 @@ public abstract class Constrain
|
||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
{
|
{
|
||||||
case X_POS: return box.getMinX();
|
case X: return box.getMinX();
|
||||||
case Y_POS: return box.getMinY();
|
case Y: return box.getMinY();
|
||||||
case WIDTH: return box.getBaseWidth();
|
case WIDTH: return box.getBaseWidth();
|
||||||
case HEIGHT: return box.getBaseHeight();
|
case HEIGHT: return box.getBaseHeight();
|
||||||
default: return 0F;
|
default: return 0F;
|
||||||
|
@ -89,10 +109,10 @@ public abstract class Constrain
|
||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
{
|
{
|
||||||
case X_POS:
|
case X:
|
||||||
box.setX(value);
|
box.setX(value);
|
||||||
break;
|
break;
|
||||||
case Y_POS:
|
case Y:
|
||||||
box.setY(value);
|
box.setY(value);
|
||||||
break;
|
break;
|
||||||
case WIDTH:
|
case WIDTH:
|
||||||
|
@ -103,5 +123,11 @@ public abstract class Constrain
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Target[] create() {
|
||||||
|
Target[] value = values();
|
||||||
|
ObjectArrays.stableSort(value, Comparator.comparingInt(Target::ordinal));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
package speiger.src.coreengine.rendering.gui.helper.constrains;
|
||||||
|
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
|
import speiger.src.coreengine.rendering.gui.GuiComponent;
|
||||||
|
import speiger.src.coreengine.rendering.gui.helper.constrains.Constrain.Target;
|
||||||
|
import speiger.src.coreengine.utils.functions.FloatSupplier;
|
||||||
|
|
||||||
|
public class Constrains
|
||||||
|
{
|
||||||
|
Constrain[] constrains = new Constrain[4];
|
||||||
|
|
||||||
|
private Constrains(Constrain[] array)
|
||||||
|
{
|
||||||
|
System.arraycopy(array, 0, constrains, 0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Constrains(Constrain xPos, Constrain yPos, Constrain width, Constrain height)
|
||||||
|
{
|
||||||
|
constrains[0] = xPos;
|
||||||
|
constrains[1] = yPos;
|
||||||
|
constrains[2] = width;
|
||||||
|
constrains[3] = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(GuiComponent owner, GuiComponent parent)
|
||||||
|
{
|
||||||
|
for(int i = 0;i<4;i++) {
|
||||||
|
if(constrains[i] != null) {
|
||||||
|
constrains[i].setComponents(owner, parent, Target.by(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onComponentChanged()
|
||||||
|
{
|
||||||
|
for(int i = 0;i<4;i++) {
|
||||||
|
if(constrains[i] != null) constrains[i].apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Constrains parent() { return new Constrains(new ParentConstrain(), new ParentConstrain(), new ParentConstrain(), new ParentConstrain()); }
|
||||||
|
public static Constrains parent(float padding) { return new Constrains(new ParentConstrain(padding), new ParentConstrain(padding), new ParentConstrain(padding), new ParentConstrain(padding)); }
|
||||||
|
public static Constrains parent(float xPadding, float yPadding) { return new Constrains(new ParentConstrain(xPadding), new ParentConstrain(yPadding), new ParentConstrain(xPadding), new ParentConstrain(yPadding)); }
|
||||||
|
public static Constrains parent(float x, float y, float width, float height) { return new Constrains(new ParentConstrain(x), new ParentConstrain(y), new ParentConstrain(width), new ParentConstrain(height)); }
|
||||||
|
|
||||||
|
public static Constrains scrollBar(BooleanSupplier supply, boolean horizontal, float barSize) {
|
||||||
|
Constrain bounds = new ConditionalConstraint(supply, new ParentConstrain(), new ParentConstrain(barSize / 2F));
|
||||||
|
return horizontal ? new Constrains(new PixelConstrain(), new ParentConstrain(barSize).invert(), bounds, new PixelConstrain(barSize)) : new Constrains(new ParentConstrain(barSize).invert(), new PixelConstrain(), new PixelConstrain(barSize), bounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Constrains verticalScrollBar(BooleanSupplier supply, float offset, float barSize) { return invParent(barSize, Target.X).yPos(offset).width(barSize).height(new ConditionalConstraint(supply, new ParentConstrain(offset * 0.5F), new ParentConstrain((barSize + offset) * 0.5F))).build(); }
|
||||||
|
|
||||||
|
public static ConstrainBuilder xPos(Constrain xPos) { return new ConstrainBuilder().set(xPos, Target.X); }
|
||||||
|
public static ConstrainBuilder yPos(Constrain yPos) { return new ConstrainBuilder().set(yPos, Target.Y); }
|
||||||
|
public static ConstrainBuilder width(Constrain width) { return new ConstrainBuilder().set(width, Target.WIDTH); }
|
||||||
|
public static ConstrainBuilder height(Constrain height) { return new ConstrainBuilder().set(height, Target.HEIGHT); }
|
||||||
|
|
||||||
|
public static ConstrainBuilder xPos(float xPos) { return new ConstrainBuilder().set(new PixelConstrain(xPos), Target.X); }
|
||||||
|
public static ConstrainBuilder yPos(float yPos) { return new ConstrainBuilder().set(new PixelConstrain(yPos), Target.Y); }
|
||||||
|
public static ConstrainBuilder width(float width) { return new ConstrainBuilder().set(new PixelConstrain(width), Target.WIDTH); }
|
||||||
|
public static ConstrainBuilder height(float height) { return new ConstrainBuilder().set(new PixelConstrain(height), Target.HEIGHT); }
|
||||||
|
|
||||||
|
public static ConstrainBuilder xPosR(float xPos) { return new ConstrainBuilder().set(new RelativeConstrain(xPos), Target.X); }
|
||||||
|
public static ConstrainBuilder yPosR(float yPos) { return new ConstrainBuilder().set(new RelativeConstrain(yPos), Target.Y); }
|
||||||
|
public static ConstrainBuilder widthR(float width) { return new ConstrainBuilder().set(new RelativeConstrain(width), Target.WIDTH); }
|
||||||
|
public static ConstrainBuilder heightR(float height) { return new ConstrainBuilder().set(new RelativeConstrain(height), Target.HEIGHT); }
|
||||||
|
|
||||||
|
public static ConstrainBuilder parent(Target target) { return new ConstrainBuilder().set(new ParentConstrain(), target); }
|
||||||
|
public static ConstrainBuilder invParent(Target target) { return new ConstrainBuilder().set(new ParentConstrain().invert(), target); }
|
||||||
|
public static ConstrainBuilder parent(float padding, Target target) { return new ConstrainBuilder().set(new ParentConstrain(padding), target); }
|
||||||
|
public static ConstrainBuilder invParent(float padding, Target target) { return new ConstrainBuilder().set(new ParentConstrain(padding).invert(), target); }
|
||||||
|
public static ConstrainBuilder center(Target target) { return new ConstrainBuilder().set(new CenterConstrain(), target); }
|
||||||
|
public static ConstrainBuilder dynamic(FloatSupplier provider, Target target) { return new ConstrainBuilder().set(new DynamicConstrain(provider), target); }
|
||||||
|
|
||||||
|
public static class ConstrainBuilder
|
||||||
|
{
|
||||||
|
Constrain[] constrains = new Constrain[4];
|
||||||
|
|
||||||
|
public ConstrainBuilder set(Constrain value, Target target) {
|
||||||
|
constrains[target.ordinal()] = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConstrainBuilder xPos(Constrain xPos) { return set(xPos, Target.X); }
|
||||||
|
public ConstrainBuilder yPos(Constrain yPos) { return set(yPos, Target.Y); }
|
||||||
|
public ConstrainBuilder width(Constrain width) { return set(width, Target.WIDTH); }
|
||||||
|
public ConstrainBuilder height(Constrain height) { return set(height, Target.HEIGHT); }
|
||||||
|
|
||||||
|
public ConstrainBuilder xPos(float xPos) { return set(new PixelConstrain(xPos), Target.X); }
|
||||||
|
public ConstrainBuilder yPos(float yPos) { return set(new PixelConstrain(yPos), Target.Y); }
|
||||||
|
public ConstrainBuilder width(float width) { return set(new PixelConstrain(width), Target.WIDTH); }
|
||||||
|
public ConstrainBuilder height(float height) { return set(new PixelConstrain(height), Target.HEIGHT); }
|
||||||
|
|
||||||
|
public ConstrainBuilder xPosR(float xPos) { return set(new RelativeConstrain(xPos), Target.X); }
|
||||||
|
public ConstrainBuilder yPosR(float yPos) { return set(new RelativeConstrain(yPos), Target.Y); }
|
||||||
|
public ConstrainBuilder widthR(float width) { return set(new RelativeConstrain(width), Target.WIDTH); }
|
||||||
|
public ConstrainBuilder heightR(float height) { return set(new RelativeConstrain(height), Target.HEIGHT); }
|
||||||
|
|
||||||
|
public ConstrainBuilder parent(Target target) { return set(new ParentConstrain(), target); }
|
||||||
|
public ConstrainBuilder invParent(Target target) { return set(new ParentConstrain().invert(), target); }
|
||||||
|
public ConstrainBuilder parent(float padding, Target target) { return set(new ParentConstrain(padding), target); }
|
||||||
|
public ConstrainBuilder invParent(float padding, Target target) { return set(new ParentConstrain(padding).invert(), target); }
|
||||||
|
public ConstrainBuilder center(Target target) { return set(new CenterConstrain(), target); }
|
||||||
|
public ConstrainBuilder dynamic(FloatSupplier provider, Target target) { return set(new DynamicConstrain(provider), target); }
|
||||||
|
|
||||||
|
public Constrains build()
|
||||||
|
{
|
||||||
|
return new Constrains(constrains);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue