Browse Source

Update Terrain

ShiroSmith 6 years ago
parent
commit
a081f005d8
2 changed files with 8 additions and 5 deletions
  1. 5 2
      hide/prefab/terrain/Terrain.hx
  2. 3 3
      hide/prefab/terrain/TerrainEditor.hx

+ 5 - 2
hide/prefab/terrain/Terrain.hx

@@ -8,7 +8,8 @@ typedef SurfaceProps = {
 	tilling : Float,
 	angle : Float,
 	offsetX : Float,
-	offsetY : Float
+	offsetY : Float,
+	heightBias : Float
 };
 
 class Terrain extends Object3D {
@@ -80,7 +81,8 @@ class Terrain extends Object3D {
 				tilling : surface.tilling,
 				angle : surface.angle,
 				offsetX : surface.offset.x,
-				offsetY : surface.offset.y
+				offsetY : surface.offset.y,
+				heightBias : surface.heightBias
 			};
 			surfacesProps.push(surfaceProps);
 		}
@@ -185,6 +187,7 @@ class Terrain extends Object3D {
 				surface.offset.y = surfaceProps.offsetY;
 				surface.angle = surfaceProps.angle;
 				surface.tilling = surfaceProps.tilling;
+				surface.heightBias = surfaceProps.heightBias;
 				albedo.dispose();
 				normal.dispose();
 				pbr.dispose();

+ 3 - 3
hide/prefab/terrain/TerrainEditor.hx

@@ -97,7 +97,7 @@ class TerrainEditor {
 		|| propName == "editor.currentSurface.offset.x"
 		|| propName == "editor.currentSurface.offset.y"
 		|| propName == "editor.currentSurface.angle"
-		|| propName == "editor.currentSurface.heightScale")
+		|| propName == "editor.currentSurface.heightBias")
 			terrainPrefab.terrain.updateSurfaceParams();
 		autoCreateTile = terrainPrefab.autoCreateTile;
 		if(propName == "editor.renderMode") updateRender();
@@ -821,7 +821,7 @@ class TerrainEditor {
 			setRange("editor.currentSurface.offset.x", currentSurface.offset.x, ctx);
 			setRange("editor.currentSurface.offset.y", currentSurface.offset.y, ctx);
 			setRange("editor.currentSurface.angle", currentSurface.angle, ctx);
-			setRange("editor.currentSurface.heightScale", currentSurface.heightScale, ctx);
+			setRange("editor.currentSurface.heightBias", currentSurface.heightBias, ctx);
 		}
 	}
 
@@ -890,7 +890,7 @@ class TerrainEditor {
 			<dt>Offset X</dt><dd><input type="range" min="0" max="1" field="editor.currentSurface.offset.x"/></dd>
 			<dt>Offset Y</dt><dd><input type="range" min="0" max="1" field="editor.currentSurface.offset.y"/></dd>
 			<dt>Rotate</dt><dd><input type="range" min="0" max="360" field="editor.currentSurface.angle"/></dd>
-			<dt>Height Scale</dt><dd><input type="range" min="0" max="1" field="editor.currentSurface.heightScale"/></dd>
+			<dt>Height Bias</dt><dd><input type="range" min="0" max="1" field="editor.currentSurface.heightBias"/></dd>
 		</div>
 	</div>';