From b99e5a9bfbf1712a6d9eecf0c381c30ed0d91230 Mon Sep 17 00:00:00 2001 From: "Sha..om" Date: Sat, 3 Mar 2012 05:07:12 +0000 Subject: [PATCH] * 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 --- .../src/core-plugins/com/jme3/scene/plugins/OBJLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java b/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java index 3ce7f5210..47165f687 100644 --- a/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java +++ b/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java @@ -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();