started custom mesh class
This commit is contained in:
1 parent
82a654f9fa
commit
65d844ca2a
3 files changed
+52
No files matched your search
Whitespace-only changes.
@@ -20,6 +20,15 @@
|
|||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<name>Default Repository</name>
|
||||||
|
<layout>default</layout>
|
||||||
|
<url>https://repo1.maven.org/maven2</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class Mesh {
|
||||||
|
private final int vaoId;
|
||||||
|
private final int vboId;
|
||||||
|
|
||||||
|
public Mesh() {
|
||||||
|
this.vaoId = 0;
|
||||||
|
this.vboId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadObj(String file_path) {
|
||||||
|
Scanner scanner;
|
||||||
|
File obj;
|
||||||
|
ArrayList<Float> vertices;
|
||||||
|
ArrayList<Float> normals;
|
||||||
|
|
||||||
|
String line;
|
||||||
|
String[] face_data_temp;
|
||||||
|
int[] face_data = new int[3];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Try to open the file
|
||||||
|
try {
|
||||||
|
obj = new File(file_path);
|
||||||
|
scanner = new Scanner(obj);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
System.out.println("ERROR: OBJ File \"" + file_path + "\" not found.");
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user