ソースを参照

Add enableParallax option for terrain

ShiroSmith 6 年 前
コミット
1b904800b3
2 ファイル変更6 行追加5 行削除
  1. 2 1
      hrt/prefab/terrain/TerrainMesh.hx
  2. 4 4
      hrt/prefab/terrain/Tile.hx

+ 2 - 1
hrt/prefab/terrain/TerrainMesh.hx

@@ -17,6 +17,7 @@ class TerrainMesh extends h3d.scene.Object {
 	public var showChecker : Bool;
 	public var showComplexity : Bool;
 	#end
+	public var enableParallax : Bool = true;
 	public var parallaxAmount : Float;
 	public var parallaxMinStep : Int;
 	public var parallaxMaxStep : Int;
@@ -147,7 +148,7 @@ class TerrainMesh extends h3d.scene.Object {
 	}
 
 	public function refreshAllTex() {
-		for( tile in tiles ) 
+		for( tile in tiles )
 			tile.refreshTex();
 	}
 

+ 4 - 4
hrt/prefab/terrain/Tile.hx

@@ -612,7 +612,7 @@ class Tile extends h3d.scene.Mesh {
 		shader.COMPLEXITY = #if editor terrain.showComplexity #else false #end;
 		shader.VERTEX_DISPLACEMENT = bigPrim == null;
 		shader.SURFACE_COUNT = terrain.surfaceArray.surfaceCount;
-		shader.PARALLAX = terrain.parallaxAmount != 0;
+		shader.PARALLAX = terrain.enableParallax && terrain.parallaxAmount != 0;
 
 		shader.heightMapSize = heightMap != null ? heightMap.width : 0;
 		shader.primSize = terrain.tileSize;
@@ -633,7 +633,7 @@ class Tile extends h3d.scene.Mesh {
 		shader.maxStep = terrain.parallaxMaxStep;
 		shader.heightBlendStrength = terrain.heightBlendStrength;
 		shader.blendSharpness = terrain.blendSharpness;
-		
+
 	}
 
 	function isReadyForDraw() {
@@ -643,9 +643,9 @@ class Tile extends h3d.scene.Mesh {
 		if( bigPrim == null && (heightMap == null || heightMap.isDisposed()) )
 			return false;
 
-		if( !shader.CHECKER && (shader.weightTextures == null || shader.weightTextures.isDisposed()) ) 
+		if( !shader.CHECKER && (shader.weightTextures == null || shader.weightTextures.isDisposed()) )
 			return false;
-		
+
 		if( !shader.CHECKER && !shader.COMPLEXITY ) {
 			if( shader.albedoTextures == null || shader.albedoTextures.isDisposed() ) return false;
 			if( shader.normalTextures == null || shader.normalTextures.isDisposed() ) return false;