Increased terrain tool radius max. Fixed terrain smooth tool invalid-height values on terrain edge.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11014 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
bre..om 11 years ago
parent fa845e33c8
commit 6f28e6e98b
  1. 12
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/SmoothTerrainToolAction.java
  2. 4
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/TerrainTool.java

@ -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)

@ -75,7 +75,7 @@ public abstract class TerrainTool {
protected Geometry markerSecondary; protected Geometry markerSecondary;
protected float radius; protected float radius;
protected float weight; protected float weight;
protected float maxToolSize = 20; // override in sub classes protected float maxToolSize = 50; // override in sub classes
private boolean doStraightline = false; private boolean doStraightline = false;
private Vector3f startPress; private Vector3f startPress;
private Vector3f axis; private Vector3f axis;
@ -212,7 +212,7 @@ public abstract class TerrainTool {
} }
/** /**
* Changes the appearence of the markers according to the {@code mesh} param. * Changes the appearance of the markers according to the {@code mesh} param.
* @param mesh possible values are: {@code sphere, box}. * @param mesh possible values are: {@code sphere, box}.
*/ */
public void setMesh(Meshes mesh) { public void setMesh(Meshes mesh) {

Loading…
Cancel
Save