shit idiot brain fungus the sequel

This commit is contained in:
George Paton 2025-03-07 16:49:56 +11:00
parent 1238933bca
commit 1afe84a871
2 changed files with 12 additions and 30 deletions

View File

@ -69,7 +69,7 @@ public class AnimationLoader {
if(json.has("rotmode")) {
for(Map.Entry<String, JsonElement> root : json.getAsJsonObject("rotmode").entrySet()) {
String mode = root.getValue().getAsString();
double[] rotMode = new double[3];
rotMode[0] = getRot(mode.charAt(2));
rotMode[1] = getRot(mode.charAt(0));
@ -115,45 +115,27 @@ public class AnimationLoader {
if(json.has("location")) {
JsonObject location = json.getAsJsonObject("location");
if(location.has("x")) {
addToSequence(sequence, Dimension.TX, location.getAsJsonArray("x"));
}
if(location.has("y")) {
addToSequence(sequence, Dimension.TY, location.getAsJsonArray("y"));
}
if(location.has("z")) {
addToSequence(sequence, Dimension.TZ, location.getAsJsonArray("z"));
}
if(location.has("x")) addToSequence(sequence, Dimension.TX, location.getAsJsonArray("x"));
if(location.has("y")) addToSequence(sequence, Dimension.TY, location.getAsJsonArray("y"));
if(location.has("z")) addToSequence(sequence, Dimension.TZ, location.getAsJsonArray("z"));
}
// Rotation fcurves, only euler at the moment
if(json.has("rotation_euler")) {
JsonObject rotation = json.getAsJsonObject("rotation_euler");
if(rotation.has("x")) {
addToSequence(sequence, Dimension.RX, rotation.getAsJsonArray("x"));
}
if(rotation.has("y")) {
addToSequence(sequence, Dimension.RY, rotation.getAsJsonArray("y"));
}
if(rotation.has("z")) {
addToSequence(sequence, Dimension.RZ, rotation.getAsJsonArray("z"));
}
if(rotation.has("x")) addToSequence(sequence, Dimension.RX, rotation.getAsJsonArray("x"));
if(rotation.has("y")) addToSequence(sequence, Dimension.RY, rotation.getAsJsonArray("y"));
if(rotation.has("z")) addToSequence(sequence, Dimension.RZ, rotation.getAsJsonArray("z"));
}
// Scale fcurves
if(json.has("scale")) {
JsonObject scale = json.getAsJsonObject("scale");
if(scale.has("x")) {
addToSequence(sequence, Dimension.SX, scale.getAsJsonArray("x"));
}
if(scale.has("y")) {
addToSequence(sequence, Dimension.SY, scale.getAsJsonArray("y"));
}
if(scale.has("z")) {
addToSequence(sequence, Dimension.SZ, scale.getAsJsonArray("z"));
}
if(scale.has("x")) addToSequence(sequence, Dimension.SX, scale.getAsJsonArray("x"));
if(scale.has("y")) addToSequence(sequence, Dimension.SY, scale.getAsJsonArray("y"));
if(scale.has("z")) addToSequence(sequence, Dimension.SZ, scale.getAsJsonArray("z"));
}
sequence.offset = offset;

View File

@ -236,12 +236,12 @@ public class BusAnimationKeyframe {
// Blender bezier solvers, but rewritten (pain)
private double solveCubic(double c0, double c1, double c2, double c3) {
if(c3 > 0.000001) {
if(c3 > 0.000001 || c3 < -0.000001) {
double a = c2 / c3;
double b = c1 / c3;
double c = c0 / c3;
a = a / 3;
double p = b / 3 - a * a;
double q = (2 * a * a * a - a * b + c) / 2;
double d = q * q + p * p * p;