[1.12.x] [Animation API] Add rotation origin variable (#4466)

This commit is contained in:
Matthew Mirvish authored and mezz committed 2017-10-20 22:27:35 -07:00
1 parent f2adf0100c
commit e283d51e28
6 files changed
+270 -5

No files matched your search

@@ -329,6 +329,7 @@ public class ModelBlockAnimation
time -= Math.floor(time);
Vector3f translation = new Vector3f(0, 0, 0);
Vector3f scale = new Vector3f(1, 1, 1);
Vector3f origin = new Vector3f(0, 0, 0);
AxisAngle4f rotation = new AxisAngle4f(0, 0, 0, 0);
for(MBVariableClip var : variables)
{
@@ -393,11 +394,24 @@ public class ModelBlockAnimation
case ZS:
scale.z = value;
break;
case XORIGIN:
origin.x = value - 0.5F;
break;
case YORIGIN:
origin.y = value - 0.5F;
break;
case ZORIGIN:
origin.z = value - 0.5F;
break;
}
}
Quat4f rot = new Quat4f();
rot.set(rotation);
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(translation, rot, scale, null));
TRSRTransformation base = new TRSRTransformation(translation, rot, scale, null);
Vector3f negOrigin = new Vector3f(origin);
negOrigin.negate();
base = new TRSRTransformation(origin, null, null, null).compose(base).compose(new TRSRTransformation(negOrigin, null, null, null));
return TRSRTransformation.blockCenterToCorner(base);
}
}
}
@@ -503,7 +517,13 @@ public class ModelBlockAnimation
@SerializedName("scale_y")
YS,
@SerializedName("scale_z")
ZS;
ZS,
@SerializedName("origin_x")
XORIGIN,
@SerializedName("origin_y")
YORIGIN,
@SerializedName("origin_z")
ZORIGIN;
}
public static enum Type