Prechádzať zdrojové kódy

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
bre..om 11 rokov pred
rodič
commit
fa84a7e1d1

+ 8 - 4
jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/SmoothTerrainToolAction.java

@@ -113,19 +113,19 @@ public class SmoothTerrainToolAction extends AbstractTerrainToolAction {
                     float down = terrain.getHeightmapHeight(new Vector2f(terrainLoc.x, terrainLoc.y-1));
                     int count = 1;
                     float amount = center;
-                    if (left != Float.NaN) {
+                    if ( !isNaN(left) ) {
                         amount += left;
                         count++;
                     }
-                    if (right != Float.NaN) {
+                    if ( !isNaN(right) ) {
                         amount += right;
                         count++;
                     }
-                    if (up != Float.NaN) {
+                    if ( !isNaN(up) ) {
                         amount += up;
                         count++;
                     }
-                    if (down != Float.NaN) {
+                    if ( !isNaN(down) ) {
                         amount += down;
                         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
     }
     
+    private boolean isNaN(float val) {
+        return val != val;
+    }
+    
     private void resetHeight(Terrain terrain, List<Vector2f> undoLocs, List<Float> undoHeights) {
         List<Float> neg = new ArrayList<Float>();
         for (Float f : undoHeights)

+ 2 - 2
jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/TerrainTool.java

@@ -75,7 +75,7 @@ public abstract class TerrainTool {
     protected Geometry markerSecondary;
     protected float radius;
     protected float weight;
-    protected float maxToolSize = 20; // override in sub classes
+    protected float maxToolSize = 50; // override in sub classes
     private boolean doStraightline = false;
     private Vector3f startPress;
     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}.
      */
     public void setMesh(Meshes mesh) {