|
|
@ -113,19 +113,19 @@ public class SmoothTerrainToolAction extends AbstractTerrainToolAction { |
|
|
|
float down = terrain.getHeightmapHeight(new Vector2f(terrainLoc.x, terrainLoc.y-1)); |
|
|
|
float down = terrain.getHeightmapHeight(new Vector2f(terrainLoc.x, terrainLoc.y-1)); |
|
|
|
int count = 1; |
|
|
|
int count = 1; |
|
|
|
float amount = center; |
|
|
|
float amount = center; |
|
|
|
if (left != Float.NaN) { |
|
|
|
if ( !isNaN(left) ) { |
|
|
|
amount += left; |
|
|
|
amount += left; |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (right != Float.NaN) { |
|
|
|
if ( !isNaN(right) ) { |
|
|
|
amount += right; |
|
|
|
amount += right; |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (up != Float.NaN) { |
|
|
|
if ( !isNaN(up) ) { |
|
|
|
amount += up; |
|
|
|
amount += up; |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (down != Float.NaN) { |
|
|
|
if ( !isNaN(down) ) { |
|
|
|
amount += down; |
|
|
|
amount += down; |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
@ -151,6 +151,10 @@ public class SmoothTerrainToolAction extends AbstractTerrainToolAction { |
|
|
|
((Node)terrain).updateModelBound(); // or else we won't collide with it where we just edited
|
|
|
|
((Node)terrain).updateModelBound(); // or else we won't collide with it where we just edited
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isNaN(float val) { |
|
|
|
|
|
|
|
return val != val; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void resetHeight(Terrain terrain, List<Vector2f> undoLocs, List<Float> undoHeights) { |
|
|
|
private void resetHeight(Terrain terrain, List<Vector2f> undoLocs, List<Float> undoHeights) { |
|
|
|
List<Float> neg = new ArrayList<Float>(); |
|
|
|
List<Float> neg = new ArrayList<Float>(); |
|
|
|
for (Float f : undoHeights) |
|
|
|
for (Float f : undoHeights) |
|
|
|