added a second example to HelloTerrain test
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9538 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
d3452297ce
commit
656c129de8
@ -38,6 +38,7 @@ import com.jme3.terrain.geomipmap.TerrainLodControl;
|
|||||||
import com.jme3.terrain.geomipmap.TerrainQuad;
|
import com.jme3.terrain.geomipmap.TerrainQuad;
|
||||||
import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
|
import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
|
||||||
import com.jme3.terrain.heightmap.AbstractHeightMap;
|
import com.jme3.terrain.heightmap.AbstractHeightMap;
|
||||||
|
import com.jme3.terrain.heightmap.HillHeightMap; // second example
|
||||||
import com.jme3.terrain.heightmap.ImageBasedHeightMap;
|
import com.jme3.terrain.heightmap.ImageBasedHeightMap;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.texture.Texture.WrapMode;
|
import com.jme3.texture.Texture.WrapMode;
|
||||||
@ -85,11 +86,21 @@ public class HelloTerrain extends SimpleApplication {
|
|||||||
mat_terrain.setTexture("Tex3", rock);
|
mat_terrain.setTexture("Tex3", rock);
|
||||||
mat_terrain.setFloat("Tex3Scale", 128f);
|
mat_terrain.setFloat("Tex3Scale", 128f);
|
||||||
|
|
||||||
/** 2. Create the height map */
|
/** 2.a Create a custom height map from an image */
|
||||||
AbstractHeightMap heightmap = null;
|
AbstractHeightMap heightmap = null;
|
||||||
Texture heightMapImage = assetManager.loadTexture(
|
Texture heightMapImage = assetManager.loadTexture(
|
||||||
"Textures/Terrain/splat/mountains512.png");
|
"Textures/Terrain/splat/mountains512.png");
|
||||||
heightmap = new ImageBasedHeightMap(heightMapImage.getImage());
|
heightmap = new ImageBasedHeightMap(heightMapImage.getImage());
|
||||||
|
|
||||||
|
/** 2.b Create a random height map */
|
||||||
|
// HillHeightMap heightmap = null;
|
||||||
|
// HillHeightMap.NORMALIZE_RANGE = 100;
|
||||||
|
// try {
|
||||||
|
// heightmap = new HillHeightMap(513, 1000, 50, 100, (byte) 3);
|
||||||
|
// } catch (Exception ex) {
|
||||||
|
// ex.printStackTrace();
|
||||||
|
// }
|
||||||
|
|
||||||
heightmap.load();
|
heightmap.load();
|
||||||
|
|
||||||
/** 3. We have prepared material and heightmap.
|
/** 3. We have prepared material and heightmap.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user