|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2009-2021 jMonkeyEngine
|
|
|
|
|
|
+ * Copyright (c) 2009-2023 jMonkeyEngine
|
|
* All rights reserved.
|
|
* All rights reserved.
|
|
*
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -62,18 +62,43 @@ public class FbxBindPose extends FbxObject<Map<FbxId, Matrix4f>> {
|
|
if (e.id.equals("Node")) {
|
|
if (e.id.equals("Node")) {
|
|
node = FbxId.create(e.properties.get(0));
|
|
node = FbxId.create(e.properties.get(0));
|
|
} else if (e.id.equals("Matrix")) {
|
|
} else if (e.id.equals("Matrix")) {
|
|
- double[] matDataDoubles = (double[]) e.properties.get(0);
|
|
|
|
-
|
|
|
|
- if (matDataDoubles.length != 16) {
|
|
|
|
- // corrupt
|
|
|
|
- throw new UnsupportedOperationException("Bind pose matrix "
|
|
|
|
- + "must have 16 doubles, but it has "
|
|
|
|
- + matDataDoubles.length + ". Data is corrupt");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
matData = new float[16];
|
|
matData = new float[16];
|
|
- for (int i = 0; i < matDataDoubles.length; i++) {
|
|
|
|
- matData[i] = (float) matDataDoubles[i];
|
|
|
|
|
|
+ int numProperties = e.propertiesTypes.length;
|
|
|
|
+ if (numProperties == 1) {
|
|
|
|
+ char propertyType = e.propertiesTypes[0];
|
|
|
|
+ if (propertyType != 'd') {
|
|
|
|
+ throw new UnsupportedOperationException(
|
|
|
|
+ "Bind-pose matrix should have property type 'd',"
|
|
|
|
+ + "but found '" + propertyType + "'");
|
|
|
|
+ }
|
|
|
|
+ double[] array = (double[]) e.properties.get(0);
|
|
|
|
+ int length = array.length;
|
|
|
|
+ if (length != 16) {
|
|
|
|
+ throw new UnsupportedOperationException(
|
|
|
|
+ "Bind-pose matrix should have 16 elements,"
|
|
|
|
+ + "but found " + length);
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < length; ++i) {
|
|
|
|
+ matData[i] = (float) array[i];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (numProperties == 16) {
|
|
|
|
+ for (int i = 0; i < numProperties; ++i) {
|
|
|
|
+ char propertyType = e.propertiesTypes[i];
|
|
|
|
+ if (propertyType != 'D') {
|
|
|
|
+ throw new UnsupportedOperationException(
|
|
|
|
+ "Bind-pose matrix should have properties of type 'D',"
|
|
|
|
+ + "but found '" + propertyType + "'");
|
|
|
|
+ }
|
|
|
|
+ double d = (Double) e.properties.get(i);
|
|
|
|
+ matData[i] = (float) d;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ throw new UnsupportedOperationException(
|
|
|
|
+ "Bind pose matrix should have either "
|
|
|
|
+ + "1 or 16 properties, but found "
|
|
|
|
+ + numProperties);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|