Hi all,
I am trying to generate a terrain using cubes using heightmaps.
The code from this tutorial works fine, however whenever I try a different heightmap image no voxels are displayed on screen.
This is my code:
package mygame;
import com.cubes.BlockTerrainControl;
import com.cubes.Vector3Int;
import com.cubes.test.CubesTestAssets;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.terrain.geomipmap.TerrainQuad;
public class Main extends SimpleApplication {
private TerrainQuad terrain;
Material mat_terrain;
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
CubesTestAssets.registerBlocks();
BlockTerrainControl blockTerrain = new BlockTerrainControl(CubesTestAssets.getSettings(this), new Vector3Int(7, 1, 7));
//Specify location, heightmap filepath, maximum height and the block class
//(See the heightmap at the right)
blockTerrain.setBlocksFromHeightmap(new Vector3Int(0, 0, 0), "Textures/Terrain/tamriel.png, 20, CubesTestAssets.BLOCK_GRASS);
//The terrain is a jME-Control, you can add it
//to a node of the scenegraph to display it
Node terrainNode = new Node();
terrainNode.addControl(blockTerrain);
rootNode.attachChild(terrainNode);
cam.setLocation(new Vector3f(-10, 10, 16));
cam.lookAtDirection(new Vector3f(1, -0.56f, -1), Vector3f.UNIT_Y);
flyCam.setMoveSpeed(50);
}
}
What am I doing wrong? This is the image I’m using for the heightmap tamriel