fixed an issue with transform matrix reading

fix-456
Nehon 8 years ago committed by Rémy Bouquet
parent ad03eab01d
commit 01b48e0357
  1. 2
      jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java
  2. 4
      jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java

@ -285,7 +285,7 @@ public class GltfLoader implements AssetLoader {
for (int i = 0; i < tmpArray.length; i++) { for (int i = 0; i < tmpArray.length; i++) {
tmpArray[i] = matrix.get(i).getAsFloat(); tmpArray[i] = matrix.get(i).getAsFloat();
} }
Matrix4f mat = new Matrix4f(tmpArray); Matrix4f mat = toRowMajor(tmpArray);
transform.fromTransformMatrix(mat); transform.fromTransformMatrix(mat);
return transform; return transform;
} }

@ -496,6 +496,10 @@ public class GltfUtils {
return new Matrix4f(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33); return new Matrix4f(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33);
} }
public static Matrix4f toRowMajor(float[] a) {
return new Matrix4f(a[0], a[4], a[8], a[12], a[1], a[5], a[9], a[13], a[2], a[5], a[10], a[14], a[3], a[7], a[11], a[15]);
}
public static GltfModelKey getKey(AssetInfo info) { public static GltfModelKey getKey(AssetInfo info) {
if (info.getKey() instanceof GltfModelKey) { if (info.getKey() instanceof GltfModelKey) {
return (GltfModelKey) info.getKey(); return (GltfModelKey) info.getKey();

Loading…
Cancel
Save