Waht is collision
parent
c1877e900e
commit
3ac06e30b1
|
@ -41,7 +41,7 @@ public class Example extends Game{
|
||||||
//TODO: block register class to register blockzz
|
//TODO: block register class to register blockzz
|
||||||
//TODO: could also probally pull the mesh from 1 place to lower memory usage in the future
|
//TODO: could also probally pull the mesh from 1 place to lower memory usage in the future
|
||||||
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/soil/dirt.png");
|
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/soil/dirt.png");
|
||||||
TexturedModel grassModel = ModelLoader.loadGenericCube("block/cubes/soil/dirt.png");
|
TexturedModel grassModel = ModelLoader.loadGenericCube("block/cubes/soil/gravel.png");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,16 +56,16 @@ public class Example extends Game{
|
||||||
ginger3D.setup(new MasterRenderer(data.camera), data);
|
ginger3D.setup(new MasterRenderer(data.camera), data);
|
||||||
|
|
||||||
|
|
||||||
float blockSpacing = 1.2f;
|
float blockSpacing = 1f;
|
||||||
float blockLineSpacing = 1.2f;
|
float blockLineSpacing = 1f;
|
||||||
float blockUpwardsSpacing = 1.2f;
|
float blockUpwardsSpacing = 1f;
|
||||||
|
|
||||||
//TODO: rename entity class to object class because not just entities
|
//TODO: rename entity class to object class because not just entities
|
||||||
List<Block> chunk = new ArrayList<Block>();
|
List<Block> chunk = new ArrayList<Block>();
|
||||||
//Basic chunk generation
|
//Basic chunk generation
|
||||||
TexturedModel activeModel = dirtModel;
|
TexturedModel activeModel = dirtModel;
|
||||||
for(int k = 0; k<8;k++) {
|
for(int k = 0; k<8;k++) {
|
||||||
if(k == 8) {
|
if(k == 7) {
|
||||||
activeModel = grassModel;
|
activeModel = grassModel;
|
||||||
}
|
}
|
||||||
for(int i = 0; i<8;i++) {
|
for(int i = 0; i<8;i++) {
|
||||||
|
@ -92,8 +92,6 @@ public class Example extends Game{
|
||||||
GUIText text = new GUIText("LiteCraft", 3, font, new Vector2f(0,0), 1f, true);
|
GUIText text = new GUIText("LiteCraft", 3, font, new Vector2f(0,0), 1f, true);
|
||||||
text.setColour(0, 0, 0);
|
text.setColour(0, 0, 0);
|
||||||
|
|
||||||
Terrain terrain = handleFlatTerrain();
|
|
||||||
|
|
||||||
Light sun = new Light(new Vector3f(100,105,-100), new Vector3f(1.3f, 1.3f, 1.3f), new Vector3f(0.0001f, 0.0001f, 0.0001f));
|
Light sun = new Light(new Vector3f(100,105,-100), new Vector3f(1.3f, 1.3f, 1.3f), new Vector3f(0.0001f, 0.0001f, 0.0001f));
|
||||||
data.lights.add(sun);
|
data.lights.add(sun);
|
||||||
|
|
||||||
|
@ -117,7 +115,7 @@ public class Example extends Game{
|
||||||
ginger3D.masterRenderer.renderShadowMap(data.entities, sun);
|
ginger3D.masterRenderer.renderShadowMap(data.entities, sun);
|
||||||
|
|
||||||
camera.move();
|
camera.move();
|
||||||
player.move(terrain);
|
player.move(null);
|
||||||
|
|
||||||
system.generateParticles(new Vector3f(0,-2,0));
|
system.generateParticles(new Vector3f(0,-2,0));
|
||||||
|
|
||||||
|
@ -157,18 +155,18 @@ public class Example extends Game{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Terrain handleFlatTerrain() {
|
// private Terrain handleFlatTerrain() {
|
||||||
TerrainTexture backgroundTexture = Loader.loadTerrainTexture("grass.png");
|
// TerrainTexture backgroundTexture = Loader.loadTerrainTexture("grass.png");
|
||||||
TerrainTexture rTexture = Loader.loadTerrainTexture("mud.png");
|
// TerrainTexture rTexture = Loader.loadTerrainTexture("mud.png");
|
||||||
TerrainTexture gTexture = Loader.loadTerrainTexture("grassFlowers.png");
|
// TerrainTexture gTexture = Loader.loadTerrainTexture("grassFlowers.png");
|
||||||
TerrainTexture bTexture = Loader.loadTerrainTexture("path.png");
|
// TerrainTexture bTexture = Loader.loadTerrainTexture("path.png");
|
||||||
TerrainTexturePack texturePack = new TerrainTexturePack(backgroundTexture, rTexture, gTexture, bTexture);
|
// TerrainTexturePack texturePack = new TerrainTexturePack(backgroundTexture, rTexture, gTexture, bTexture);
|
||||||
|
//
|
||||||
TerrainTexture blendMap = Loader.loadTerrainTexture("blendMap.png");
|
// TerrainTexture blendMap = Loader.loadTerrainTexture("blendMap.png");
|
||||||
|
//
|
||||||
Terrain terrain = new Terrain(-0.5f, -0.5f, texturePack, blendMap, "heightmap.png");
|
// Terrain terrain = new Terrain(-0.5f, -0.5f, texturePack, blendMap, "heightmap.png");
|
||||||
data.flatTerrains.add(terrain);
|
// data.flatTerrains.add(terrain);
|
||||||
return terrain;
|
// return terrain;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,12 @@ public class Player extends RenderObject{
|
||||||
|
|
||||||
public void move(Terrain t) {
|
public void move(Terrain t) {
|
||||||
checkInputs();
|
checkInputs();
|
||||||
|
super.increaseRotation(0, (float) ((currentTurn) * Window.getTime() ), 0);
|
||||||
|
float distance = (float) ((currentSpeed) * (Window.getTime()));
|
||||||
|
float dx = (float) (distance * Math.sin(Math.toRadians(super.getRotY())));
|
||||||
|
float dz = (float) (distance * Math.cos(Math.toRadians(super.getRotY())));
|
||||||
|
super.increasePosition(dx, 0, dz);
|
||||||
if(t != null) {
|
if(t != null) {
|
||||||
super.increaseRotation(0, (float) ((currentTurn) * Window.getTime() ), 0);
|
|
||||||
float distance = (float) ((currentSpeed) * (Window.getTime()));
|
|
||||||
float dx = (float) (distance * Math.sin(Math.toRadians(super.getRotY())));
|
|
||||||
float dz = (float) (distance * Math.cos(Math.toRadians(super.getRotY())));
|
|
||||||
super.increasePosition(dx, 0, dz);
|
|
||||||
super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime())), 0);
|
super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime())), 0);
|
||||||
terrainHeight = t.getHeightOfTerrain(super.getPosition().x, super.getPosition().z);
|
terrainHeight = t.getHeightOfTerrain(super.getPosition().x, super.getPosition().z);
|
||||||
upwardsSpeed += Constants.gravity * Window.getTime();
|
upwardsSpeed += Constants.gravity * Window.getTime();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import io.github.hydos.ginger.engine.render.models.TexturedModel;
|
||||||
public class Block extends RenderObject{
|
public class Block extends RenderObject{
|
||||||
|
|
||||||
public Block(TexturedModel blockModel, Vector3f position) {
|
public Block(TexturedModel blockModel, Vector3f position) {
|
||||||
super(blockModel, position, 0, 0, 0, new Vector3f(0.2f,0.2f,0.2f));
|
super(blockModel, position, 0, 0, 0, new Vector3f(1f,1f,1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue