glTF: Fixes a crash when attached nodes contains skinned meshes
This commit is contained in:
parent
806663990d
commit
cfaaec5418
@ -685,6 +685,47 @@ public class GltfUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void dumpArray(Object[] array) {
|
||||||
|
if (array == null) {
|
||||||
|
System.err.println("null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < array.length; i++) {
|
||||||
|
Object o = array[i];
|
||||||
|
System.err.print(i + ": ");
|
||||||
|
if (o instanceof Quaternion) {
|
||||||
|
Quaternion q = (Quaternion) o;
|
||||||
|
System.err.print("(");
|
||||||
|
if (q.getX() > 0.00001) System.err.print(q.getX() + ", ");
|
||||||
|
else System.err.print("0.0, ");
|
||||||
|
if (q.getY() > 0.00001) System.err.print(q.getY() + ", ");
|
||||||
|
else System.err.print("0.0, ");
|
||||||
|
if (q.getZ() > 0.00001) System.err.print(q.getZ() + ", ");
|
||||||
|
else System.err.print("0.0, ");
|
||||||
|
if (q.getW() > 0.00001) System.err.print(q.getW() + ", ");
|
||||||
|
else System.err.print("0.0, ");
|
||||||
|
System.err.println(")");
|
||||||
|
} else {
|
||||||
|
System.err.println(o.toString() + ", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.err.println("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void dumpArray(float[] array) {
|
||||||
|
if (array == null) {
|
||||||
|
System.err.println("null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < array.length; i++) {
|
||||||
|
float o = array[i];
|
||||||
|
System.err.println(i + ": " + o);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.err.println("");
|
||||||
|
}
|
||||||
|
|
||||||
public static Spatial findCommonAncestor(List<Spatial> spatials) {
|
public static Spatial findCommonAncestor(List<Spatial> spatials) {
|
||||||
Map<Spatial, List<Spatial>> flatParents = new HashMap<>();
|
Map<Spatial, List<Spatial>> flatParents = new HashMap<>();
|
||||||
|
|
||||||
@ -704,6 +745,9 @@ public class GltfUtils {
|
|||||||
while (true) {
|
while (true) {
|
||||||
for (Spatial spatial : flatParents.keySet()) {
|
for (Spatial spatial : flatParents.keySet()) {
|
||||||
List<Spatial> parents = flatParents.get(spatial);
|
List<Spatial> parents = flatParents.get(spatial);
|
||||||
|
if (parents.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (index == parents.size()) {
|
if (index == parents.size()) {
|
||||||
//we reached the end of a spatial hierarchy let's return;
|
//we reached the end of a spatial hierarchy let's return;
|
||||||
return lastCommonParent;
|
return lastCommonParent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user