mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Rotation opts
This commit is contained in:
parent
8a4208ab18
commit
0a08b4b0b9
@ -21,15 +21,15 @@ import lombok.experimental.Accessors;
|
|||||||
public class IrisAxisRotationClamp
|
public class IrisAxisRotationClamp
|
||||||
{
|
{
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
|
|
||||||
@Desc("Should this axis be rotated at all?")
|
@Desc("Should this axis be rotated at all?")
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
|
private transient boolean forceLock = false;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@DependsOn({"max"})
|
@DependsOn({"max"})
|
||||||
@MinNumber(-360)
|
@MinNumber(-360)
|
||||||
@MaxNumber(360)
|
@MaxNumber(360)
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
||||||
private double min = 0;
|
private double min = 0;
|
||||||
@ -38,7 +38,6 @@ public class IrisAxisRotationClamp
|
|||||||
@DependsOn({"min"})
|
@DependsOn({"min"})
|
||||||
@MinNumber(-360)
|
@MinNumber(-360)
|
||||||
@MaxNumber(360)
|
@MaxNumber(360)
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
||||||
private double max = 0;
|
private double max = 0;
|
||||||
@ -48,7 +47,6 @@ public class IrisAxisRotationClamp
|
|||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(360)
|
@MaxNumber(360)
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
|
|
||||||
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
|
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
|
||||||
private double interval = 0;
|
private double interval = 0;
|
||||||
|
|
||||||
@ -56,6 +54,7 @@ public class IrisAxisRotationClamp
|
|||||||
{
|
{
|
||||||
min = fd;
|
min = fd;
|
||||||
max = fd;
|
max = fd;
|
||||||
|
forceLock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnlimited()
|
public boolean isUnlimited()
|
||||||
@ -70,6 +69,11 @@ public class IrisAxisRotationClamp
|
|||||||
|
|
||||||
public double getRadians(int rng)
|
public double getRadians(int rng)
|
||||||
{
|
{
|
||||||
|
if(forceLock)
|
||||||
|
{
|
||||||
|
return Math.toRadians(max);
|
||||||
|
}
|
||||||
|
|
||||||
if(isUnlimited())
|
if(isUnlimited())
|
||||||
{
|
{
|
||||||
if(interval < 1)
|
if(interval < 1)
|
||||||
|
@ -32,7 +32,7 @@ public class IrisObjectRotation
|
|||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("The y axis rotation")
|
@Desc("The y axis rotation")
|
||||||
private IrisAxisRotationClamp yAxis = new IrisAxisRotationClamp(true, 0, 0, 90);
|
private IrisAxisRotationClamp yAxis = new IrisAxisRotationClamp(true, false, 0, 0, 90);
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("The z axis rotation")
|
@Desc("The z axis rotation")
|
||||||
@ -82,19 +82,23 @@ public class IrisObjectRotation
|
|||||||
|
|
||||||
public static IrisObjectRotation of(double x, double y, double z) {
|
public static IrisObjectRotation of(double x, double y, double z) {
|
||||||
IrisObjectRotation rt = new IrisObjectRotation();
|
IrisObjectRotation rt = new IrisObjectRotation();
|
||||||
rt.setEnabled(true);
|
|
||||||
IrisAxisRotationClamp rtx = new IrisAxisRotationClamp();
|
IrisAxisRotationClamp rtx = new IrisAxisRotationClamp();
|
||||||
rtx.setEnabled(x != 0);
|
|
||||||
rtx.setMax(x);
|
|
||||||
rt.setXAxis(rtx);
|
|
||||||
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
|
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
|
||||||
rty.setEnabled(y != 0);
|
|
||||||
rty.setMax(y);
|
|
||||||
rt.setXAxis(rty);
|
|
||||||
IrisAxisRotationClamp rtz = new IrisAxisRotationClamp();
|
IrisAxisRotationClamp rtz = new IrisAxisRotationClamp();
|
||||||
|
rt.setEnabled(x != 0 || y != 0 || z != 0);
|
||||||
|
rt.setXAxis(rtx);
|
||||||
|
rt.setYAxis(rty);
|
||||||
|
rt.setZAxis(rtz);
|
||||||
|
rtx.setEnabled(x != 0);
|
||||||
|
rty.setEnabled(y != 0);
|
||||||
rtz.setEnabled(z != 0);
|
rtz.setEnabled(z != 0);
|
||||||
rtz.setMax(z);
|
rtx.setInterval(90);
|
||||||
rt.setXAxis(rtz);
|
rty.setInterval(90);
|
||||||
|
rtz.setInterval(90);
|
||||||
|
rtx.minMax(x);
|
||||||
|
rty.minMax(y);
|
||||||
|
rtz.minMax(z);
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,32 +311,94 @@ public class IrisObjectRotation
|
|||||||
|
|
||||||
if(canRotateX())
|
if(canRotateX())
|
||||||
{
|
{
|
||||||
v.rotateAroundX(getXRotation(spinx));
|
if(getXAxis().isLocked())
|
||||||
|
{
|
||||||
|
if(Math.abs(getXAxis().getMax())%360D == 180D)
|
||||||
|
{
|
||||||
|
v.setZ(-v.getZ());
|
||||||
|
v.setY(-v.getY());
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(getXAxis().getMax()%360D == 90D || getXAxis().getMax()%360D == -270D)
|
||||||
|
{
|
||||||
|
double z = v.getZ();
|
||||||
|
v.setZ(v.getY());
|
||||||
|
v.setY(-z);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(getXAxis().getMax() == -90D || getXAxis().getMax()%360D == 270D)
|
||||||
|
{
|
||||||
|
double z = v.getZ();
|
||||||
|
v.setZ(-v.getY());
|
||||||
|
v.setY(z);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v.rotateAroundX(getXRotation(spinx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v.rotateAroundX(getXRotation(spinx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canRotateZ())
|
if(canRotateZ())
|
||||||
{
|
{
|
||||||
v.rotateAroundZ(getZRotation(spinz));
|
if(getZAxis().isLocked())
|
||||||
|
{
|
||||||
|
if(Math.abs(getZAxis().getMax())%360D == 180D)
|
||||||
|
{
|
||||||
|
v.setY(-v.getY());
|
||||||
|
v.setX(-v.getX());
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(getZAxis().getMax()%360D == 90D || getZAxis().getMax()%360D == -270D)
|
||||||
|
{
|
||||||
|
double y = v.getY();
|
||||||
|
v.setY(v.getX());
|
||||||
|
v.setX(-y);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(getZAxis().getMax() == -90D || getZAxis().getMax()%360D == 270D)
|
||||||
|
{
|
||||||
|
double y = v.getY();
|
||||||
|
v.setY(-v.getX());
|
||||||
|
v.setX(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v.rotateAroundZ(getZRotation(spinz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v.rotateAroundY(getZRotation(spinz));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canRotateY())
|
if(canRotateY())
|
||||||
{
|
{
|
||||||
if(getYAxis().isLocked())
|
if(getYAxis().isLocked())
|
||||||
{
|
{
|
||||||
if(Math.abs(getYAxis().getMax()) == 180D)
|
if(Math.abs(getYAxis().getMax())%360D == 180D)
|
||||||
{
|
{
|
||||||
v.setX(-v.getX());
|
v.setX(-v.getX());
|
||||||
v.setZ(-v.getZ());
|
v.setZ(-v.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(getYAxis().getMax() == 90D || getYAxis().getMax() == -270D)
|
else if(getYAxis().getMax()%360D == 90D || getYAxis().getMax()%360D == -270D)
|
||||||
{
|
{
|
||||||
double x = v.getX();
|
double x = v.getX();
|
||||||
v.setX(v.getZ());
|
v.setX(v.getZ());
|
||||||
v.setZ(-x);
|
v.setZ(-x);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(getYAxis().getMax() == -90D || getYAxis().getMax() == 270D)
|
else if(getYAxis().getMax() == -90D || getYAxis().getMax()%360D == 270D)
|
||||||
{
|
{
|
||||||
double x = v.getX();
|
double x = v.getX();
|
||||||
v.setX(-v.getZ());
|
v.setX(-v.getZ());
|
||||||
@ -351,6 +417,7 @@ public class IrisObjectRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user