|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright (c) 2009-2012 jMonkeyEngine |
|
|
|
* Copyright (c) 2009-2018 jMonkeyEngine |
|
|
|
* All rights reserved. |
|
|
|
* All rights reserved. |
|
|
|
* |
|
|
|
* |
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
@ -37,7 +37,7 @@ import java.util.logging.Level; |
|
|
|
import java.util.logging.Logger; |
|
|
|
import java.util.logging.Logger; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <code>MidpointDisplacementHeightMap</code> generates an heightmap based on |
|
|
|
* <code>MidpointDisplacementHeightMap</code> generates a heightmap based on |
|
|
|
* the midpoint displacement algorithm. See Constructor javadoc for more info. |
|
|
|
* the midpoint displacement algorithm. See Constructor javadoc for more info. |
|
|
|
* @author cghislai |
|
|
|
* @author cghislai |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -50,7 +50,7 @@ public class MidpointDisplacementHeightMap extends AbstractHeightMap { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The constructor generates the heightmap. After the first 4 corners are |
|
|
|
* The constructor generates the heightmap. After the first 4 corners are |
|
|
|
* randomly given an height, the center will be heighted to the average of |
|
|
|
* randomly given a height, the center will be heighted to the average of |
|
|
|
* the 4 corners to which a random value is added. Then other passes fill |
|
|
|
* the 4 corners to which a random value is added. Then other passes fill |
|
|
|
* the heightmap by the same principle. |
|
|
|
* the heightmap by the same principle. |
|
|
|
* The random value is generated between the values <code>-range</code> |
|
|
|
* The random value is generated between the values <code>-range</code> |
|
|
@ -87,7 +87,7 @@ public class MidpointDisplacementHeightMap extends AbstractHeightMap { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The constructor generates the heightmap. After the first 4 corners are |
|
|
|
* The constructor generates the heightmap. After the first 4 corners are |
|
|
|
* randomly given an height, the center will be heighted to the average of |
|
|
|
* randomly given a height, the center will be heighted to the average of |
|
|
|
* the 4 corners to which a random value is added. Then other passes fill |
|
|
|
* the 4 corners to which a random value is added. Then other passes fill |
|
|
|
* the heightmap by the same principle. |
|
|
|
* the heightmap by the same principle. |
|
|
|
* The random value is generated between the values <code>-range</code> |
|
|
|
* The random value is generated between the values <code>-range</code> |
|
|
@ -156,10 +156,10 @@ public class MidpointDisplacementHeightMap extends AbstractHeightMap { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Will fill the value at (coords[0]+stepSize/2, coords[1]+stepSize/2) with |
|
|
|
* Will fill the value at (coords[0]+stepSize/2, coords[1]+stepSize/2) with |
|
|
|
* the average from the corners of the square with topleft corner at (coords[0],coords[1]) |
|
|
|
* the average from the corners of the square with top, left corner at (coords[0],coords[1]) |
|
|
|
* and width of stepSize. |
|
|
|
* and width of stepSize. |
|
|
|
* @param tempBuffer the temprary heightmap |
|
|
|
* @param tempBuffer the temporary heightmap |
|
|
|
* @param coords an int array of lenght 2 with the x coord in position 0 |
|
|
|
* @param coords an int array of length 2 with the x coord in position 0 |
|
|
|
* @param stepSize the size of the square |
|
|
|
* @param stepSize the size of the square |
|
|
|
* @param offsetRange the offset range within a random value is picked and added to the average |
|
|
|
* @param offsetRange the offset range within a random value is picked and added to the average |
|
|
|
* @param random the random generator |
|
|
|
* @param random the random generator |
|
|
|