made pom work with linux and fixed some file stuff for shaders

This commit is contained in:
0x01FE committed 2024-09-23 11:34:35 -05:00
1 parent 71f51f41f2
commit 82a654f9fa
3 files changed
+52 -15

No files matched your search

+37 -12
View File
@@ -13,7 +13,6 @@
<maven.compiler.target>22</maven.compiler.target> <maven.compiler.target>22</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lwjgl.version>3.3.4</lwjgl.version> <lwjgl.version>3.3.4</lwjgl.version>
<lwjgl.natives>natives-windows</lwjgl.natives>
</properties> </properties>
<repositories> <repositories>
@@ -23,6 +22,34 @@
</repository> </repository>
</repositories> </repositories>
<profiles>
<profile>
<id>lwjgl-natives-linux-amd64</id>
<activation>
<os>
<family>unix</family>
<name>linux</name>
<arch>amd64</arch>
</os>
</activation>
<properties>
<lwjgl.natives>natives-linux</lwjgl.natives>
</properties>
</profile>
<profile>
<id>lwjgl-natives-windows-amd64</id>
<activation>
<os>
<family>windows</family>
<arch>amd64</arch>
</os>
</activation>
<properties>
<lwjgl.natives>natives-windows</lwjgl.natives>
</properties>
</profile>
</profiles>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
@@ -36,8 +63,6 @@
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<!-- Bunch of Graphics stuff LWJGL -->
<dependency> <dependency>
<groupId>org.lwjgl</groupId> <groupId>org.lwjgl</groupId>
<artifactId>lwjgl</artifactId> <artifactId>lwjgl</artifactId>
@@ -162,10 +187,10 @@
<groupId>org.lwjgl</groupId> <groupId>org.lwjgl</groupId>
<artifactId>lwjgl-opus</artifactId> <artifactId>lwjgl-opus</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.lwjgl</groupId> <!-- <groupId>org.lwjgl</groupId>-->
<artifactId>lwjgl-ovr</artifactId> <!-- <artifactId>lwjgl-ovr</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.lwjgl</groupId> <groupId>org.lwjgl</groupId>
<artifactId>lwjgl-par</artifactId> <artifactId>lwjgl-par</artifactId>
@@ -351,11 +376,11 @@
<artifactId>lwjgl-opus</artifactId> <artifactId>lwjgl-opus</artifactId>
<classifier>${lwjgl.natives}</classifier> <classifier>${lwjgl.natives}</classifier>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.lwjgl</groupId> <!-- <groupId>org.lwjgl</groupId>-->
<artifactId>lwjgl-ovr</artifactId> <!-- <artifactId>lwjgl-ovr</artifactId>-->
<classifier>${lwjgl.natives}</classifier> <!-- <classifier>${lwjgl.natives}</classifier>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.lwjgl</groupId> <groupId>org.lwjgl</groupId>
<artifactId>lwjgl-par</artifactId> <artifactId>lwjgl-par</artifactId>
+14 -2
View File
@@ -35,10 +35,14 @@ public class Entity
model.getTexCoords().size(), model.getTexCoords().size(),
model.getObjects().size())); model.getObjects().size()));
} catch (Exception e) { } catch (Exception e) {
System.out.println("ERROR Parsing obj");
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} }
vaoId = 0;
vboId = 0;
// Load Shaders // Load Shaders
try { try {
this.shader = new ShaderProgram(); this.shader = new ShaderProgram();
@@ -48,7 +52,7 @@ public class Entity
} }
try { try {
String vertex_shader_code = new Scanner(new File(vertex_shader_path)).useDelimiter("\\Z").next(); String vertex_shader_code = new Scanner(this.getClass().getResourceAsStream(vertex_shader_path)).useDelimiter("\\Z").next();
this.shader.createVertexShader(vertex_shader_code); this.shader.createVertexShader(vertex_shader_code);
} catch (Exception e) { } catch (Exception e) {
System.out.println("ERROR Initializing the vertex shader"); System.out.println("ERROR Initializing the vertex shader");
@@ -56,7 +60,7 @@ public class Entity
} }
try { try {
String fragment_shader_code = new Scanner(new File(fragment_shader_path)).useDelimiter("\\Z").next(); String fragment_shader_code = new Scanner(this.getClass().getResourceAsStream(fragment_shader_path)).useDelimiter("\\Z").next();
this.shader.createFragmentShader(fragment_shader_code); this.shader.createFragmentShader(fragment_shader_code);
} catch (Exception e) } catch (Exception e)
{ {
@@ -64,4 +68,12 @@ public class Entity
e.printStackTrace(); e.printStackTrace();
} }
} }
public int getVaoId() {
return vaoId;
}
public int getVboId() {
return vboId;
}
} }
+1 -1
View File
@@ -100,7 +100,7 @@ public class Game
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// Add stuff to world // Add stuff to world
world.addEntity(new Entity("/obs/cube.obj", "/shaders/shader.fraq", "/shaders/shader.vert")); world.addEntity(new Entity("/objs/cube.obj", "/shaders/shader.frag", "/shaders/shader.vert"));
// Main loop or something // Main loop or something
while ( !glfwWindowShouldClose(window) ) while ( !glfwWindowShouldClose(window) )