|
@@ -13,8 +13,8 @@ import java.util.HashMap;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
-public class ReadOBJ {
|
|
|
|
- public ArrayList<Vector4f> getPoints(File OBJFile) throws FileNotFoundException {
|
|
|
|
|
|
+public class OBJReader {
|
|
|
|
+ public static ArrayList<Vector4f> getPoints(File OBJFile) throws FileNotFoundException {
|
|
BufferedReader reader = new BufferedReader(new FileReader(OBJFile));
|
|
BufferedReader reader = new BufferedReader(new FileReader(OBJFile));
|
|
ArrayList<Vector4f> Points = new ArrayList<>();
|
|
ArrayList<Vector4f> Points = new ArrayList<>();
|
|
reader.lines().forEach(l -> {
|
|
reader.lines().forEach(l -> {
|
|
@@ -31,14 +31,14 @@ public class ReadOBJ {
|
|
return Points;
|
|
return Points;
|
|
}
|
|
}
|
|
|
|
|
|
- public ArrayList<Face> getFace(File OBJFile, File MTLFile) throws FileNotFoundException {
|
|
|
|
|
|
+ public static ArrayList<Face> getFace(File OBJFile, File MTLFile) throws FileNotFoundException {
|
|
BufferedReader reader = new BufferedReader(new FileReader(OBJFile));
|
|
BufferedReader reader = new BufferedReader(new FileReader(OBJFile));
|
|
ArrayList<Face> Faces = new ArrayList<>();
|
|
ArrayList<Face> Faces = new ArrayList<>();
|
|
AtomicReference<HashMap<String, Color>> materials = new AtomicReference<>(new HashMap<>());
|
|
AtomicReference<HashMap<String, Color>> materials = new AtomicReference<>(new HashMap<>());
|
|
AtomicReference<Color> color = new AtomicReference<>(new Color(0, 0, 0));
|
|
AtomicReference<Color> color = new AtomicReference<>(new Color(0, 0, 0));
|
|
reader.lines().forEach(l -> {
|
|
reader.lines().forEach(l -> {
|
|
try {
|
|
try {
|
|
- materials.set(ReadMTL.getColors(MTLFile));
|
|
|
|
|
|
+ materials.set(MTLReader.getColors(MTLFile));
|
|
} catch (FileNotFoundException e) {
|
|
} catch (FileNotFoundException e) {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
@@ -78,14 +78,14 @@ public class ReadOBJ {
|
|
return Faces;
|
|
return Faces;
|
|
}
|
|
}
|
|
|
|
|
|
- public ArrayList<Face> getFaceAnimation(File OBJFile, File MTLFile) throws FileNotFoundException {
|
|
|
|
|
|
+ public static ArrayList<Face> getFaceAnimation(File OBJFile, File MTLFile) throws FileNotFoundException {
|
|
BufferedReader reader = new BufferedReader(new FileReader(OBJFile));
|
|
BufferedReader reader = new BufferedReader(new FileReader(OBJFile));
|
|
ArrayList<Face> Faces = new ArrayList<>();
|
|
ArrayList<Face> Faces = new ArrayList<>();
|
|
AtomicReference<HashMap<String, Color>> materials = new AtomicReference<>(new HashMap<>());
|
|
AtomicReference<HashMap<String, Color>> materials = new AtomicReference<>(new HashMap<>());
|
|
AtomicReference<Color> color = new AtomicReference<>(new Color(0, 0, 0));
|
|
AtomicReference<Color> color = new AtomicReference<>(new Color(0, 0, 0));
|
|
reader.lines().forEach(l -> {
|
|
reader.lines().forEach(l -> {
|
|
try {
|
|
try {
|
|
- materials.set(ReadMTL.getColors(MTLFile));
|
|
|
|
|
|
+ materials.set(MTLReader.getColors(MTLFile));
|
|
} catch (FileNotFoundException e) {
|
|
} catch (FileNotFoundException e) {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|