public TerrainQuad getTerrainQuadAt(Vector3f location) { HeightMap heightMapAt = getHeightMapAt(location); TerrainQuad q = new TerrainQuad("Quad" + location, patchSize, quadSize, heightMapAt == null ? null : heightMapAt.getHeightMap()); return q; }
public TerrainQuad getTerrainQuadAt(Vector3f location) { HeightMap heightMapAt = getHeightMapAt(location); TerrainQuad q = new TerrainQuad("Quad" + location, patchSize, quadSize, heightMapAt == null ? null : heightMapAt.getHeightMap()); return q; }
public TerrainQuad getTerrainQuadAt(Vector3f location) { String modelName = assetPath + "/" + name + "_" + Math.round(location.x) + "_" + Math.round(location.y) + "_" + Math.round(location.z) + ".j3o"; Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Load terrain grid tile: {0}", modelName); TerrainQuad quad = null; try { quad = (TerrainQuad) manager.loadModel(modelName); } catch (Exception e) { // e.printStackTrace(); } if (quad == null) { Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Could not load terrain grid tile: {0}", modelName); quad = createNewQuad(location); } else { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Loaded terrain grid tile: {0}", modelName); } return quad; }
private HeightMap getHeightMapAt(Vector3f location) { AbstractHeightMap heightmap = null; FloatBuffer buffer = this.base.getBuffer(location.x * (this.quadSize - 1), location.z * (this.quadSize - 1), 0, this.quadSize); float[] arr = buffer.array(); for (int i = 0; i < arr.length; i++) { arr[i] = arr[i] * this.heightScale; } heightmap = new FloatBufferHeightMap(buffer); heightmap.load(); return heightmap; }
this.terrain = new TerrainGrid("terrain", 65, 257, new FractalTileLoader(ground, 256f));
AssetTileLoader grid = new AssetTileLoader(assetManager, "testgrid", "TerrainGrid"); this.terrain = new TerrainGrid("terrain", 65, 257, grid);
this.terrain = new TerrainGrid("terrain", 65, 257, new ImageTileLoader(assetManager, new Namer() {
public TerrainQuad getTerrainQuadAt(Vector3f location) { HeightMap heightMapAt = getHeightMapAt(location); TerrainQuad q = new TerrainQuad("Quad" + location, patchSize, quadSize, heightMapAt == null ? null : heightMapAt.getHeightMap()); return q; }
public TerrainQuad getTerrainQuadAt(Vector3f location) { HeightMap heightMapAt = getHeightMapAt(location); TerrainQuad q = new TerrainQuad("Quad" + location, patchSize, quadSize, heightMapAt == null ? null : heightMapAt.getHeightMap()); return q; }
private HeightMap getHeightMapAt(Vector3f location) { AbstractHeightMap heightmap = null; FloatBuffer buffer = this.base.getBuffer(location.x * (this.quadSize - 1), location.z * (this.quadSize - 1), 0, this.quadSize); float[] arr = buffer.array(); for (int i = 0; i < arr.length; i++) { arr[i] = arr[i] * this.heightScale; } heightmap = new FloatBufferHeightMap(buffer); heightmap.load(); return heightmap; }
public TerrainQuad getTerrainQuadAt(Vector3f location) { String modelName = assetPath + "/" + name + "_" + Math.round(location.x) + "_" + Math.round(location.y) + "_" + Math.round(location.z) + ".j3o"; Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Load terrain grid tile: {0}", modelName); TerrainQuad quad = null; try { quad = (TerrainQuad) manager.loadModel(modelName); } catch (Exception e) { // e.printStackTrace(); } if (quad == null) { Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Could not load terrain grid tile: {0}", modelName); quad = createNewQuad(location); } else { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Loaded terrain grid tile: {0}", modelName); } return quad; }
this.terrain = new TerrainGrid("terrain", 33, 129, new FractalTileLoader(ground, 256f));
this.terrain = new TerrainGrid("terrain", 33, 257, new FractalTileLoader(ground, 256)); this.terrain.setMaterial(this.material);