more obj loader

pull/1/head
hYdos 2020-02-23 14:14:29 +10:00
parent 2a04b8e8a9
commit 433a6dc773
4 changed files with 7 additions and 11 deletions

View File

@ -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);

View File

@ -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);