finished game-engine-terrain-generation #2

Merged
sebastian merged 9 commits from game-engine-terrain-generation into game-engine 2023-10-05 14:00:29 +02:00
3 changed files with 6 additions and 2 deletions
Showing only changes of commit 88099c41c0 - Show all commits

View File

@ -128,7 +128,7 @@ public class Engine {
//Create Hexagon //Create Hexagon
HexagonModel hexagonModel = new HexagonModel(); HexagonModel hexagonModel = new HexagonModel();
RawModel hexagonRawModel = loader.loadToVAO(hexagonModel.getVertices(), hexagonModel.getTextureCoords(), hexagonModel.getNormals(), hexagonModel.getIndices()); RawModel hexagonRawModel = loader.loadHexagon(hexagonModel);
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);
Entity hexagonEntity = new Entity(hexagontexturedModel, new Vector3f(0,1,0), 0,0,0,1); Entity hexagonEntity = new Entity(hexagontexturedModel, new Vector3f(0,1,0), 0,0,0,1);

View File

@ -1,5 +1,6 @@
package core.engine; package core.engine;
import core.engine.model.HexagonModel;
import core.engine.model.RawModel; import core.engine.model.RawModel;
import core.engine.textures.Texture; import core.engine.textures.Texture;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
@ -29,6 +30,10 @@ public class Loader {
return new RawModel(vaoID, indices.length); return new RawModel(vaoID, indices.length);
} }
public RawModel loadHexagon(HexagonModel hexagonModel) {
return loadToVAO(hexagonModel.getVertices(), hexagonModel.getTextureCoords(), hexagonModel.getNormals(), hexagonModel.getIndices());
}
public int loadTexture(String fileName) { public int loadTexture(String fileName) {
Texture texture = new Texture("res/" + fileName + ".png"); Texture texture = new Texture("res/" + fileName + ".png");
int textureID = texture.getTextureID(); int textureID = texture.getTextureID();

View File

@ -9,7 +9,6 @@ import java.util.List;
public class Terrain { public class Terrain {
private List<TerrainTile> terrainTiles = new ArrayList<>(); private List<TerrainTile> terrainTiles = new ArrayList<>();
public Terrain(Loader loader, ModelTexture modelTexture) { public Terrain(Loader loader, ModelTexture modelTexture) {