Selaa lähdekoodia

made model loading 5x faster

____tbvns____ 5 kuukautta sitten
vanhempi
commit
2add2154bd
1 muutettua tiedostoa jossa 3 lisäystä ja 7 poistoa
  1. 3 7
      PowerGDEditor/src/main/java/xyz/tbvns/Models/OBJReader.java

+ 3 - 7
PowerGDEditor/src/main/java/xyz/tbvns/Models/OBJReader.java

@@ -37,6 +37,7 @@ public class OBJReader {
         ArrayList<Face> Faces = new ArrayList<>();
         AtomicReference<HashMap<String, Color>> materials = new AtomicReference<>(new HashMap<>());
         AtomicReference<Color> color = new AtomicReference<>(new Color(0, 0, 0));
+        List<Vector4f> p = getPoints(OBJFile);
         reader.lines().forEach(l -> {
             try {
                 materials.set(MTLReader.getColors(MTLFile));
@@ -72,13 +73,8 @@ public class OBJReader {
                 } else {
                     log.error("A face had more than 4 point, ignoring it");
                 }
-                try {
-                    List<Vector4f> p = getPoints(OBJFile);
-                    for (Integer index : face.pointsIndex) {
-                        face.points.add(p.get(index-1));
-                    }
-                } catch (FileNotFoundException e) {
-                    throw new RuntimeException(e);
+                for (Integer index : face.pointsIndex) {
+                    face.points.add(p.get(index-1));
                 }
             }
         });