Răsfoiți Sursa

whitespace/coding style tidy

aardgoose 8 ani în urmă
părinte
comite
0f982be2c1
1 a modificat fișierele cu 25 adăugiri și 12 ștergeri
  1. 25 12
      examples/webgl_gpgpu_protoplanet.html

+ 25 - 12
examples/webgl_gpgpu_protoplanet.html

@@ -67,7 +67,7 @@
 				}
 
 				// Dynamics
-			        pos += vel * delta;
+				pos += vel * delta;
 
 				gl_FragColor = vec4( pos, 1.0 );
 
@@ -107,7 +107,6 @@
 				float mass = tmpVel.w;
 
 				if ( mass > 0.0 ) {
-				    
 
 					float radius = radiusFromMass( mass );
 
@@ -283,18 +282,24 @@
 
 			document.getElementById( 'protoplanets' ).innerText = PARTICLES;
 
-			function change(n) {
+			function change( n ) {
+
 				location.hash = n;
 				location.reload();
 				return false;
+
 			}
 
 
 			var options = '';
+
 			for ( var i = 1; i < 8; i++ ) {
+
 				var j = Math.pow( 2, i );
 				options += '<a href="#" onclick="return change(' + j + ')">' + ( j * j ) + '</a> ';
+
 			}
+
 			document.getElementById( 'options' ).innerHTML = options;
 
 			var last = performance.now();
@@ -342,7 +347,6 @@
 					velocity: 70,
 					velocityExponent: 0.2,
 					randVelocity: 0.001
-
 				};
 
 				initComputeRenderer();
@@ -362,7 +366,7 @@
 
 			function initComputeRenderer() {
 
-    				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
+				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
 				var dtPosition = gpuCompute.createTexture();
 				var dtVelocity = gpuCompute.createTexture();
@@ -382,8 +386,11 @@
 				velocityUniforms.density = { value: 0.0 };
 
 				var error = gpuCompute.init();
+
 				if ( error !== null ) {
-				    console.error( error );
+
+					console.error( error );
+
 				}
 
 			}
@@ -408,23 +415,27 @@
 
 				var positions = new Float32Array( PARTICLES * 3 );
 				var p = 0;
+
 				for ( var i = 0; i < PARTICLES; i++ ) {
 
 					positions[ p++ ] = ( Math.random() * 2 - 1 ) * effectController.radius;
-					positions[ p++ ] = 0;//( Math.random() * 2 - 1 ) * effectController.radius;
+					positions[ p++ ] = 0; //( Math.random() * 2 - 1 ) * effectController.radius;
 					positions[ p++ ] = ( Math.random() * 2 - 1 ) * effectController.radius;
 
 				}
 
 				var uvs = new Float32Array( PARTICLES * 2 );
 				p = 0;
+
 				for ( var j = 0; j < WIDTH; j++ ) {
+
 					for ( var i = 0; i < WIDTH; i++ ) {
 
 						uvs[ p++ ] = i / ( WIDTH - 1 );
 						uvs[ p++ ] = j / ( WIDTH - 1 );
 
 					}
+
 				}
 
 				geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
@@ -443,6 +454,7 @@
 					vertexShader:   document.getElementById( 'particleVertexShader' ).textContent,
 					fragmentShader: document.getElementById( 'particleFragmentShader' ).textContent
 				} );
+
 				material.extensions.drawBuffers = true;
 
 				var particles = new THREE.Points( geometry, material );
@@ -472,9 +484,11 @@
 					var x, y, z, rr;
 
 					do {
+
 						x = ( Math.random() * 2 - 1 );
 						z = ( Math.random() * 2 - 1 );
 						rr = x * x + z * z;
+
 					} while ( rr > 1 );
 
 					rr = Math.sqrt( rr );
@@ -518,7 +532,7 @@
 
 				particleUniforms.cameraConstant.value = getCameraConstant( camera );
 
-    			}
+			}
 
 			function dynamicValuesChanger() {
 
@@ -530,7 +544,7 @@
 
 			function initGUI() {
 
-  				var gui = new dat.GUI();
+				var gui = new dat.GUI();
 
 				var folder1 = gui.addFolder( 'Dynamic parameters' );
 
@@ -548,10 +562,9 @@
 				folder2.add( effectController, "randVelocity", 0.0, 50.0, 0.1 );
 
 				var buttonRestart = {
-				    restartSimulation: function() {
-					restartSimulation();
-				    }
+					restartSimulation: function() { restartSimulation(); }
 				};
+
 				folder2.add( buttonRestart, 'restartSimulation' );
 
 				folder1.open();