Gltf fix data reading

This commit is contained in:
Rémy Bouquet 2017-09-24 15:55:46 +02:00
parent ad2a9e6230
commit 7b2f1094b1

View File

@ -367,6 +367,7 @@ public class GltfLoader implements AssetLoader {
buffs.weights = readAccessorData(entry.getValue().getAsInt(), new FloatArrayPopulator()); buffs.weights = readAccessorData(entry.getValue().getAsInt(), new FloatArrayPopulator());
} else { } else {
VertexBuffer vb = readAccessorData(entry.getValue().getAsInt(), new VertexBufferPopulator(getVertexBufferType(bufferType))); VertexBuffer vb = readAccessorData(entry.getValue().getAsInt(), new VertexBufferPopulator(getVertexBufferType(bufferType)));
System.err.println(bufferType);
if (vb != null) { if (vb != null) {
mesh.setBuffer(vb); mesh.setBuffer(vb);
} }
@ -527,7 +528,8 @@ public class GltfLoader implements AssetLoader {
BinDataKey key = new BinDataKey(info.getKey().getFolder() + uri); BinDataKey key = new BinDataKey(info.getKey().getFolder() + uri);
InputStream input = (InputStream) info.getManager().loadAsset(key); InputStream input = (InputStream) info.getManager().loadAsset(key);
data = new byte[bufferLength]; data = new byte[bufferLength];
input.read(data); DataInputStream dataStream = new DataInputStream(input);
dataStream.readFully(data);
} }
} else { } else {
//no URI this should not happen in a gltf file, only in glb files. //no URI this should not happen in a gltf file, only in glb files.