Package com.jme3.terrain.heightmap
Class ParticleDepositionHeightMap
java.lang.Object
com.jme3.terrain.heightmap.AbstractHeightMap
com.jme3.terrain.heightmap.ParticleDepositionHeightMap
- All Implemented Interfaces:
- HeightMap
ParticleDepositionHeightMap creates a heightmap based on the
 Particle Deposition algorithm based on Jason Shankel's paper from
 "Game Programming Gems". A heightmap is created using a Molecular beam
 epitaxy, or MBE, for depositing thin layers of atoms on a substrate.
 We drop a sequence of particles and simulate their flow across a surface
 of previously dropped particles. This creates a few high peaks, for further
 realism we can define a caldera. Similar to the way volcano's form
 islands, rock is deposited via lava, when the lava cools, it recedes
 into the volcano, creating the caldera.- 
Field SummaryFields inherited from class com.jme3.terrain.heightmap.AbstractHeightMapfilter, heightData, heightScale, NORMALIZE_RANGE, size
- 
Constructor SummaryConstructorsConstructorDescriptionParticleDepositionHeightMap(int size, int jumps, int peakWalk, int minParticles, int maxParticles, float caldera) Constructor sets the attributes of the Particle Deposition Height Map and then generates the map.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanload()loadgenerates the heightfield using the Particle Deposition algorithm.voidsetCaldera(float caldera) setCalderasets the level at which a peak will be inverted.voidsetJumps(int jumps) setJumpssets the number of jumps or peaks that will be created during the next call toload.voidsetMaxParticles(int maxParticles) setMaxParticlessets the maximum number of particles for a single jump.voidsetMinParticles(int minParticles) setMinParticlessets the minimum number of particles for a single jump.voidsetPeakWalk(int peakWalk) setPeakWalksets how often the jump point will be agitated.Methods inherited from class com.jme3.terrain.heightmap.AbstractHeightMaperodeTerrain, findMinMaxHeights, flatten, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getScaledHeightMap, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, smooth, smooth, unloadHeightMap
- 
Constructor Details- 
ParticleDepositionHeightMappublic ParticleDepositionHeightMap(int size, int jumps, int peakWalk, int minParticles, int maxParticles, float caldera) throws Exception Constructor sets the attributes of the Particle Deposition Height Map and then generates the map.- Parameters:
- size- the size of the terrain where the area is size x size.
- jumps- number of areas to drop particles. Can also think of it as the number of peaks.
- peakWalk- determines how much to agitate the drop point during a creation of a single peak. The lower the number the more the drop point will be agitated. 1 will insure agitation every round.
- minParticles- defines the minimum number of particles to drop during a single jump.
- maxParticles- defines the maximum number of particles to drop during a single jump.
- caldera- defines the altitude to invert a peak. This is represented as a percentage, where 0.0 will not invert anything, and 1.0 will invert all.
- Throws:
- Exception- if any value is less than zero, and if caldera is not between 0 and 1. If minParticles is greater than max particles as well.
 
 
- 
- 
Method Details- 
loadpublic boolean load()loadgenerates the heightfield using the Particle Deposition algorithm.loaduses the latest attributes, so a call toloadis recommended if attributes have changed using the set methods.- Returns:
- true if the load was successful, false otherwise.
 
- 
setJumpssetJumpssets the number of jumps or peaks that will be created during the next call toload.- Parameters:
- jumps- the number of jumps to use for next load.
- Throws:
- Exception- if jumps is less than zero.
 
- 
setPeakWalksetPeakWalksets how often the jump point will be agitated. The lower the peakWalk, the more often the point will be agitated.- Parameters:
- peakWalk- the amount to agitate the jump point.
- Throws:
- Exception- if peakWalk is negative or zero.
 
- 
setCalderasetCalderasets the level at which a peak will be inverted.- Parameters:
- caldera- the level at which a peak will be inverted. This must be between 0 and 1, as it is represented as a percentage.
- Throws:
- Exception- if caldera is not between 0 and 1.
 
- 
setMaxParticlespublic void setMaxParticles(int maxParticles) setMaxParticlessets the maximum number of particles for a single jump.- Parameters:
- maxParticles- the maximum number of particles for a single jump.
 
- 
setMinParticlessetMinParticlessets the minimum number of particles for a single jump.- Parameters:
- minParticles- the minimum number of particles for a single jump.
- Throws:
- Exception- if minParticles are greater than the current maxParticles;
 
 
-