fixed model loading maybe
This commit is contained in:
1 parent
60457309ae
commit
719e6993df
3 files changed
+6
-4
No files matched your search
@@ -83,7 +83,7 @@ public class Obj {
|
||||
|
||||
// look for vertex
|
||||
for (int b = 0; b < 3; b++)
|
||||
if (temp_n_vbo.get(a + b) != v.get(vertex_index + b)) {
|
||||
if (temp_v_vbo.get(a + b) != v.get(vertex_index + b)) {
|
||||
vertex_found = false;
|
||||
break;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class Obj {
|
||||
|
||||
if (vertex_found && normal_found)
|
||||
{
|
||||
i.add(a / 6);
|
||||
i.add(a / 3);
|
||||
vbo_el_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ public class Mesh {
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
|
||||
|
||||
// Bind Normals into a VBO
|
||||
System.out.println(this.normals.length);
|
||||
FloatBuffer normals_buffer = stack.callocFloat(this.normals.length);
|
||||
normals_buffer.put(0, this.normals);
|
||||
vbo_id = glGenBuffers();
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Main implements GameLogic {
|
||||
|
||||
@Override
|
||||
public void init(Window window, World world, Render render) {
|
||||
Entity cube = new Entity("resources/objs/cube.obj", "resources/shaders/shader.frag", "resources/shaders/shader.vert");
|
||||
Entity cube = new Entity("resources/objs/sphere.obj", "resources/shaders/shader.frag", "resources/shaders/shader.vert");
|
||||
cube.model = new Matrix4f().identity().translate(0, 0, -10);
|
||||
|
||||
System.out.println(cube.model.toString());
|
||||
@@ -39,7 +39,8 @@ public class Main implements GameLogic {
|
||||
world.entities.get(0).model = new Matrix4f()
|
||||
.identity()
|
||||
.translate(0, 0, -5)
|
||||
.rotate(ang, 0,1, 0);
|
||||
.rotate(ang, 0,1, 0)
|
||||
.rotate(ang * 2, 0, 0, 1);
|
||||
ang += 1.0f/100.0f;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user