diff --git a/core/src/se/cookery/CookeryClient.java b/core/src/se/cookery/CookeryClient.java index b8f80d6..5a30a3a 100644 --- a/core/src/se/cookery/CookeryClient.java +++ b/core/src/se/cookery/CookeryClient.java @@ -111,6 +111,8 @@ public class CookeryClient extends SimpleApplication { CollisionResults results = new CollisionResults(); rootNode.collideWith(ray, results); + System.out.println("Click registered:"); + // (Print the results so we see what is going on:) for (int i = 0; i < results.size(); i++) { System.out.println("Selection #" + i + ": " + @@ -118,7 +120,6 @@ public class CookeryClient extends SimpleApplication { "Contact: " + results.getCollision(i).getContactPoint() + ", " + "Distance: " + results.getCollision(i).getDistance() + " WU"); } - System.out.println(); // Use the results -- we rotate the selected geometry. if (results.size() > 0) { diff --git a/core/src/se/cookery/gfx/terrain/BlockHeightMap.java b/core/src/se/cookery/gfx/terrain/BlockHeightMap.java index add4333..f708056 100644 --- a/core/src/se/cookery/gfx/terrain/BlockHeightMap.java +++ b/core/src/se/cookery/gfx/terrain/BlockHeightMap.java @@ -13,12 +13,7 @@ public class BlockHeightMap implements TerrainHeightMap { @Override - public int getSquareCountWidth() { - return Block.BLOCK_SIZE; - } - - @Override - public int getSquareCountHeight() { - return Block.BLOCK_SIZE; + public float getHeight(float x, float z) { + return 0; } } diff --git a/core/src/se/cookery/gfx/terrain/TerrainHeightMap.java b/core/src/se/cookery/gfx/terrain/TerrainHeightMap.java index a275bfb..7f80cbe 100644 --- a/core/src/se/cookery/gfx/terrain/TerrainHeightMap.java +++ b/core/src/se/cookery/gfx/terrain/TerrainHeightMap.java @@ -2,14 +2,5 @@ package se.cookery.gfx.terrain; public interface TerrainHeightMap { - - /** - * @return the number of squares on the width that make a single TerrainMesh instance. - */ - int getSquareCountWidth(); - - /** - * @return the number of squares on the height that make a single TerrainMesh instance. - */ - int getSquareCountHeight(); + float getHeight(float x, float z); } diff --git a/core/src/se/cookery/gfx/terrain/TerrainManager.java b/core/src/se/cookery/gfx/terrain/TerrainManager.java index fe2719d..b9ff75a 100644 --- a/core/src/se/cookery/gfx/terrain/TerrainManager.java +++ b/core/src/se/cookery/gfx/terrain/TerrainManager.java @@ -1,11 +1,9 @@ package se.cookery.gfx.terrain; import com.jme3.material.Material; -import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.Node; -import se.cookery.gfx.util.MaterialUtil; /** * This class represents a infinite terrain object (using multiple buffered TerrainMesh objects) @@ -13,8 +11,8 @@ import se.cookery.gfx.util.MaterialUtil; public class TerrainManager { protected static final int BUFFER_SIZE = 3; - private float squareWidth; - private float squareHeight; + private float squareLength; + private int squareCount; private TerrainHeightMap heightMap; private Geometry[][] terrainBuffer; @@ -24,26 +22,27 @@ public class TerrainManager { /** * Create a new instance of TerrainManager * - * @param squareWidth is the width of a single square - * @param squareHeight is the height of a single square - * @param heightMap is the height map for the terrain + * @param squareLength is the width of a single square + * @param squareCount is the height of a single square + * @param heightMap is the height map for the terrain */ - public TerrainManager(float squareWidth, float squareHeight, TerrainHeightMap heightMap, Material material) { - this.squareWidth = squareWidth; - this.squareHeight = squareHeight; + public TerrainManager(float squareLength, int squareCount, TerrainHeightMap heightMap, Material material) { + this.squareLength = squareLength; + this.squareCount = squareCount; this.heightMap = heightMap; this.terrainBuffer = new Geometry[BUFFER_SIZE][BUFFER_SIZE]; for (int x=0; x