I’ve been lurking around here for a few weeks. I’ve decided that I want to have a go at learning OpenGL so I’ve finally registered. jME seems to be quite a powerful scene graph, hopefully it will help me achieve my goal. As a welcome present from me I give you an implementation of the Hill heightmap generation algorithm by Bob Nystrom.
It extends AbstractHeightMap so using it shouldn’t cause any problems. The parameters of the class are explained in the JavaDoc comments but anyway:
- size: should be obvious, the same as in all AbstractHeightMap implementations
- iterations: number of hills to be generated, depends on the size of the map, usually LARGE values
- minRadius: minimum radius of a hill, depends on what you want, play with it
- maxRadius: maximum radius of a hill, depends on what you want, play with it
- flattening: amound of flattening done, one means none, flattening makes the valleys more prominent, usually very low values (e.g. 2)
- seed: optional parameter, use it if you want to generate the same heightmap again without having to store it
The following code is an example. It requires the textures grassb.png, dirt.png, highest.png and Detail.jpg to be in the same directory. These textures can be found in jmetest/data/texture.
* <code>TestHillHeightmap</code> demonstrates the usage of <code>HillHeightMap</code>.
* @author Frederik B