2
0
Эх сурвалжийг харах

Distributed evenly the drain across time.

yomboprime 6 жил өмнө
parent
commit
7b0966cbb4

+ 3 - 11
examples/webgl_gpgpu_water.html

@@ -664,22 +664,14 @@
 				
 					heightCompensation = - readWaterLevel();
 
-				}
-
-				// Apply gradually height compensation to reset water level
-				if ( heightCompensation !== 0 ) {
-				
-					var decremHeight = Math.min( 0.2, Math.abs( heightCompensation ) ) * Math.sign( heightCompensation );
-					heightCompensation -= decremHeight;
-					heightmapVariable.material.uniforms.heightCompensation.value = decremHeight;
-					
 				}
 				else {
+
+					// Apply gradually height compensation to reset water level
 				
-					heightmapVariable.material.uniforms.heightCompensation.value = 0;
+					heightmapVariable.material.uniforms.heightCompensation.value = heightCompensation / 120;
 
 				}
-				
 
 				// Do the gpu computation
 				gpuCompute.compute();