diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/BinDataKey.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/BinDataKey.java index c84678751..505ca29c3 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/BinDataKey.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/BinDataKey.java @@ -1,6 +1,7 @@ package com.jme3.scene.plugins.gltf; import com.jme3.asset.AssetKey; +import com.jme3.asset.cache.AssetCache; /** * Created by Nehon on 09/09/2017. @@ -9,4 +10,9 @@ class BinDataKey extends AssetKey { public BinDataKey(String name) { super(name); } + + @Override + public Class getCacheType() { + return null; + } } diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java index 01371bee9..0c6e98f72 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java @@ -140,6 +140,8 @@ public class GltfLoader implements AssetLoader { return rootNode; } catch (Exception e) { throw new AssetLoadException("An error occurred loading " + assetInfo.getKey().getName(), e); + } finally { + stream.close(); } } @@ -529,6 +531,7 @@ public class GltfLoader implements AssetLoader { data = new byte[bufferLength]; DataInputStream dataStream = new DataInputStream(input); dataStream.readFully(data); + dataStream.close(); } } else { //no URI this should not happen in a gltf file, only in glb files. @@ -1147,6 +1150,25 @@ public class GltfLoader implements AssetLoader { float[] weights; public void update() { + if (translations == null) { + translations = new Vector3f[times.length]; + for (int i = 0; i < translations.length; i++) { + translations[i] = new Vector3f(); + } + } + if (rotations == null) { + rotations = new Quaternion[times.length]; + for (int i = 0; i < rotations.length; i++) { + rotations[i] = new Quaternion(); + } + } + if (scales == null) { + scales = new Vector3f[times.length]; + for (int i = 0; i < scales.length; i++) { + scales[i] = new Vector3f().set(Vector3f.UNIT_XYZ); + } + } + if (times[0] > 0) { //Anim doesn't start at 0, JME can't handle that and will interpolate transforms linearly from 0 to the first frame of the anim. //we need to add a frame at 0 that copies the first real frame