Browse Source

GPGPU birds: removed dead code.

Mr.doob 11 years ago
parent
commit
7b50d8aebd
1 changed files with 6 additions and 91 deletions
  1. 6 91
      examples/webgl_gpgpu_birds.html

+ 6 - 91
examples/webgl_gpgpu_birds.html

@@ -455,10 +455,8 @@
 
 				this.applyMatrix( new THREE.Matrix4().makeScale( 0.2, 0.2, 0.2 ) );
 
-
 			}
 
-
 			THREE.BirdGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); // Geometry2
 
 
@@ -489,24 +487,12 @@
 			}
 			document.getElementById('options').innerHTML = options;
 
-			var debug;
-			var data, texture;
-
-			var spline = new THREE.SplineCurve3();
-
-
-			var timer = 0;
-			var paused = false;
-
 			var last = performance.now();
-			var delta, now, t = 0;
-
 
 			var simulator;
 
 			init();
 			animate();
-			onMouseDown();
 
 			function init() {
 
@@ -522,43 +508,18 @@
 
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
 				renderer.setClearColor( scene.fog.color, 1 );
-				renderer.autoClear = true;
+				container.appendChild( renderer.domElement );
 
-				////////
 				simulator = new SimulationRenderer(WIDTH, renderer);
-
 				simulator.init();
 
-				/////////
-
-
-		
-				plane = new THREE.PlaneGeometry( BOUNDS, BOUNDS, 1, 1 );
-				// new THREE.BoxGeometry( BOUNDS, BOUNDS, BOUNDS),
-
-				cube = new THREE.Mesh(
-					plane,
-					new THREE.MeshBasicMaterial( {color: 0xdddddd, wireframe: true, depthWrite: false} )
-				);
-
-				cube.rotation.x = -Math.PI / 2;
-				cube.position.y = -400;
-				// scene.add(cube);
-
-
-
-
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
 				stats.domElement.style.top = '0px';
 				container.appendChild( stats.domElement );
 
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-				// document.addEventListener( 'mousedown', onMouseDown, false );
-				document.addEventListener( 'mouseup', onMouseUp, false );
 				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
 				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
 
@@ -593,32 +554,16 @@
 				gui.add( effectController, "seperation", 0.0, 100.0, 1.0 ).onChange( valuesChanger );
 				gui.add( effectController, "alignment", 0.0, 100, 0.001 ).onChange( valuesChanger );
 				gui.add( effectController, "cohesion", 0.0, 100, 0.025 ).onChange( valuesChanger );
-				// gui.add( effectController, "freedom", 0.0, 1.0, 0.025 ).onChange( valuesChanger );
 				gui.close();
 
 				initBirds();
-
-
-				// var ambient = new THREE.AmbientLight( 0x444444 );
-				// scene.add( ambient );
-
-				// light = new THREE.DirectionalLight( 0xffffff );
-				// light.position.set( 1, 1, 1 );
-				// scene.add( light );
-
-
-				// light = new THREE.DirectionalLight( 0xffffff );
-				// light.position.set( -1, -1, -1 );
-				// scene.add( light );
 				
-
-
 			}
 
 
 			function initBirds() {
-				var geometry = new THREE.BirdGeometry( );
 
+				var geometry = new THREE.BirdGeometry();
 
 				// For Vertex Shaders
 				birdAttributes = {
@@ -650,14 +595,10 @@
 
 				});
 
-				// geometry.dynamic = false;
-
 
 				// var 
 				birdMesh = new THREE.Mesh( geometry, shaderMaterial );
 				birdMesh.rotation.y = Math.PI / 2;
-				birdMesh.sortObjects = false;
-
 				birdMesh.matrixAutoUpdate = false;
 				birdMesh.updateMatrix();
 
@@ -722,8 +663,9 @@
 			}
 
 			function render() {
-				now = performance.now()
-				delta = (now - last) / 1000;
+
+				var now = performance.now()
+				var delta = (now - last) / 1000;
 
 				if (delta > 1) delta = 1; // safety cap on large deltas
 				last = now;
@@ -731,25 +673,9 @@
 				birdUniforms.time.value = now;
 				birdUniforms.delta.value = delta;
 
-				// if ( paused ) {
-				// 	camera.position.x += ( mouseX * 2 - camera.position.x ) * 0.05;
-				// 	camera.position.y += ( - mouseY * 2 - camera.position.y ) * 0.05;
-
-				// 	camera.lookAt( scene.position );
-				// 	delta = 0.0001;
-				// }
-
-				if (!paused) {
-					simulator.simulate( delta );
-
-					birdUniforms.texturePosition.value = simulator.currentPosition;
-					birdUniforms.textureVelocity.value = simulator.currentVelocity;
-				}
-
-
+				simulator.simulate( delta );
 				simulator.velocityUniforms.predator.value.set( mouseX / windowHalfX, -mouseY / windowHalfY, 0 );
 
-
 				mouseX = 10000;
 				mouseY = 10000;
 
@@ -757,17 +683,6 @@
 
 			}
 
-			function onMouseDown() {
-				// simulator.velocityUniforms.testing.value = 0;
-			}
-
-			function onMouseUp() {
-				// simulator.velocityUniforms.testing.value = 1;
-			}
-
-
-
-
 		</script>
 	</body>
 </html>