From 433a6dc773f3315a3de63bb29c9a42ba1bf09dd8 Mon Sep 17 00:00:00 2001 From: hYdos Date: Sun, 23 Feb 2020 14:14:29 +1000 Subject: [PATCH] more obj loader --- .../java/io/github/hydos/ginger/Example.java | 4 ++-- .../ginger/engine/obj/OBJFileLoader.java | 14 +++++--------- .../io/github/hydos/ginger/Example.class | Bin 11103 -> 11102 bytes .../ginger/engine/obj/OBJFileLoader.class | Bin 5003 -> 4990 bytes 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/hydos/ginger/Example.java b/src/main/java/io/github/hydos/ginger/Example.java index 446a205..cc221c5 100644 --- a/src/main/java/io/github/hydos/ginger/Example.java +++ b/src/main/java/io/github/hydos/ginger/Example.java @@ -61,7 +61,7 @@ public class Example { Window.setBackgroundColour(0.2f, 0.2f, 0.8f); - TexturedModel tModel = ModelLoader.loadModel("Zebra.obj", "stallTexture.png"); + TexturedModel tModel = ModelLoader.loadModel("stall.obj", "stallTexture.png"); tModel.getTexture().setReflectivity(1f); tModel.getTexture().setShineDamper(7f); Player entity = new Player(tModel, new Vector3f(0,0,-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f)); @@ -86,7 +86,7 @@ public class Example { - TexturedModel dragonMdl = ModelLoader.loadModel("dragon.obj", "stallTexture.png"); + TexturedModel dragonMdl = ModelLoader.loadModel("Zebra.obj", "stallTexture.png"); dragonMdl.getTexture().setReflectivity(4f); dragonMdl.getTexture().setShineDamper(2f); diff --git a/src/main/java/io/github/hydos/ginger/engine/obj/OBJFileLoader.java b/src/main/java/io/github/hydos/ginger/engine/obj/OBJFileLoader.java index 8fcfcd2..a78ba0f 100644 --- a/src/main/java/io/github/hydos/ginger/engine/obj/OBJFileLoader.java +++ b/src/main/java/io/github/hydos/ginger/engine/obj/OBJFileLoader.java @@ -80,15 +80,11 @@ public class OBJFileLoader { float y = vertex.getPosition().y; float z = vertex.getPosition().z; - verticies[i] = x; - i++; - verticies[i] = y; - i++; - verticies[i] = z; - i++; - textureCoords[j] = vertex.getTextureIndex().x; - j++; - textureCoords[j] = vertex.getTextureIndex().y; + verticies[i++] = x; + verticies[i++] = y; + verticies[i++] = z; + textureCoords[j++] = vertex.getTextureIndex().x; + textureCoords[j++] = vertex.getTextureIndex().y; } return new ModelData(verticies, textureCoords, new float[normals.sizeof()], indicesList, i); diff --git a/target/classes/io/github/hydos/ginger/Example.class b/target/classes/io/github/hydos/ginger/Example.class index cf5f5e7e9161ccfce665ce1d8201997fadf9626b..d55aa9f41c0436a5988f47db4bc8b416cfc091c0 100644 GIT binary patch delta 30 mcmcZ~b}wwhd1lt)lEj>x%~zNkIoLR(Qj>}jH^=ZW%L4$+?h9l9 delta 31 ncmcZ?c0X*xd1ltA)TE-s%~zNkIoP>UiW1ZF^EOBGFv|k~*5C`k diff --git a/target/classes/io/github/hydos/ginger/engine/obj/OBJFileLoader.class b/target/classes/io/github/hydos/ginger/engine/obj/OBJFileLoader.class index d068054ac9118c846419c28e184427f55bc9d60f..fe39e291b592988904ca8282adb69af2d37ad2ab 100644 GIT binary patch delta 253 zcmeBH|EIR$v>@jM26hHM1_p+OldlLWGNw)bCaB@m!p11h9jGhH24e8Q7`%a!ETXI} ztc;TE+Zb+cVYrLNzZclT!6?ch%DM3W%*nAra?ExN{FCd1RO@kP26hHM1_p+CldlLWGA2*{Ca7UA&K=mo#;7aGCe8z6@PZhUETXKE z?AsV_Zeh3^*usj;zZclT!6?ch%DM3WoXH77a?E}V!jl_?RO@{iLKp%VLK(t