Browse Source

* OBJ loader now supports loading models that use negative indices in the face statement

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9724 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Sha..rd 13 years ago
parent
commit
1ddb7903db
1 changed files with 10 additions and 0 deletions
  1. 10 0
      engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java

+ 10 - 0
engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java

@@ -255,6 +255,16 @@ public final class OBJLoader implements AssetLoader {
                 v = Integer.parseInt(split[0].trim());
                 vn = Integer.parseInt(split[2].trim());
             }
+            
+            if (v < 0) {
+                v = verts.size() + v + 1;
+            }
+            if (vt < 0) {
+                vt = texCoords.size() + vt + 1;
+            }
+            if (vn < 0) {
+                vn = norms.size() + vn + 1;
+            }
 
             Vertex vx = new Vertex();
             vx.v = verts.get(v - 1);