Terrain Errosion?

i've been messing with the jME terrain classes i must say they are pretty nice, however i would like to use the erodeTerrain method to errode the terrain but have been unable to figure out how to use it, since it expects a float[][] and the terrain is stored by default as a float[] and not a float[][] so how would i got about applying that to a terrain?

thanks :smiley:

Conversion from a one dimensional array into two dimensional is:

array[ x ][ y ] = array[y + (x * size)] so you can create a temp buffer to use there.

However, after looking through the heightmap generation stuff, it's apparent that there needs to be some clean-up.

  1. height array doesn't really need to be an int, and it just removes smoothing
  2. those methods could and probably should operate on the internal heightdata rather than taking in a temp.
  3. there is no reason why some is two dimensional and some is one.

    So, these should be improved by someone, sometime. Until then, you'll have to generate your own temp array (sorry). Take a look at FaultFractal or ParticleDepostiion to see how they use it.

making the heightmapdata a one dimensional float array would be niceโ€ฆ