Render Row of HexagonTerrainTiles

This commit is contained in:
Sebastian Böckelmann 2024-03-21 16:50:58 +01:00
parent ac3e0a1b0e
commit 7bed6d5d01
2 changed files with 17 additions and 5 deletions

View File

@ -122,6 +122,14 @@ public class Engine {
Light light = new Light(new Vector3f(0,0,-20), new Vector3f(1,1,1)); Light light = new Light(new Vector3f(0,0,-20), new Vector3f(1,1,1));
HexagonModel hexagonModel = new HexagonModel();
RawModel hexagonRawModel = loader.loadToVAO(hexagonModel.getVertices(), hexagonModel.getTextureCoords(), hexagonModel.getNormals(), hexagonModel.getIndices());
ModelTexture hexagonTexture = new ModelTexture(loader.loadTexture("white"));
TexturedModel hexagontexturedModel = new TexturedModel(hexagonRawModel, hexagonTexture);
//Entity entity = new Entity(hexagontexturedModel, new Vector3f(1.7319988f,0,0), 0,0,0,1f);
// Run the rendering loop until the user has attempted to close // Run the rendering loop until the user has attempted to close
// the window or has pressed the ESCAPE key. // the window or has pressed the ESCAPE key.
MasterRenderer renderer = new MasterRenderer(); MasterRenderer renderer = new MasterRenderer();
@ -204,12 +212,13 @@ public class Engine {
public void invoke(long window, int key, int scancode, int action, int mods) { public void invoke(long window, int key, int scancode, int action, int mods) {
if(key == GLFW_KEY_A) { if(key == GLFW_KEY_A) {
//move camera to left //move camera to left
/*entity.increasePosition(0.001f, 0, 0);
System.out.println(entity.getPosition());*/
} }
if(key == GLFW_KEY_D) { if(key == GLFW_KEY_D) {
//move camera to right /*entity.increasePosition(-0.001f, 0, 0);
camera.moveRight(); System.out.println(entity.getPosition());*/
} }
if(key == GLFW_KEY_W) { if(key == GLFW_KEY_W) {

View File

@ -26,9 +26,12 @@ public class Terrain {
ModelTexture hexagonTexture = new ModelTexture(loader.loadTexture("white")); ModelTexture hexagonTexture = new ModelTexture(loader.loadTexture("white"));
TexturedModel hexagontexturedModel = new TexturedModel(hexagonRawModel, hexagonTexture); TexturedModel hexagontexturedModel = new TexturedModel(hexagonRawModel, hexagonTexture);
TerrainTile terrainTile = new TerrainTile(hexagontexturedModel, new Vector3f(1.3f,0,0.68f), 0,0,0,0.075f);
List<TerrainTile> generatedTerrainTiles = new ArrayList<>(); List<TerrainTile> generatedTerrainTiles = new ArrayList<>();
generatedTerrainTiles.add(terrainTile); for(int x=-16; x<16; x++) {
generatedTerrainTiles.add(new TerrainTile(hexagontexturedModel, new Vector3f(x * 1.7319988f , 0, 0), 0, 0, 0,1));
}
System.out.println(31 * 1.7319988f);
return new Terrain(generatedTerrainTiles); return new Terrain(generatedTerrainTiles);
} }