* Prevent exception when loading OBJ file without normals or texcoords

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9228 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
Sha..om 2012-03-03 05:07:12 +00:00
parent 92b97d38d8
commit b99e5a9bfb

View File

@ -454,9 +454,11 @@ public final class OBJLoader implements AssetLoader {
if (hasNormals){
normBuf = BufferUtils.createFloatBuffer(vertIndexMap.size() * 3);
m.setBuffer(VertexBuffer.Type.Normal, 3, normBuf);
}
if (hasTexCoord){
tcBuf = BufferUtils.createFloatBuffer(vertIndexMap.size() * 2);
m.setBuffer(VertexBuffer.Type.TexCoord, 2, tcBuf);
}
IndexBuffer indexBuf = null;
@ -517,9 +519,7 @@ public final class OBJLoader implements AssetLoader {
}
m.setBuffer(VertexBuffer.Type.Position, 3, posBuf);
m.setBuffer(VertexBuffer.Type.Normal, 3, normBuf);
m.setBuffer(VertexBuffer.Type.TexCoord, 2, tcBuf);
// index buffer was set on creation
// index buffer and others were set on creation
m.setStatic();
m.updateBound();