Browse Source

Clean up.

Mr.doob 9 years ago
parent
commit
546c91c615

+ 1 - 1
docs/index.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">

+ 10 - 10
docs/scenes/bones-browser.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">
@@ -57,7 +57,7 @@
 				camera.position.y = 30;
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );				
+				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				document.body.appendChild( renderer.domElement );
 
@@ -74,7 +74,7 @@
 
 				lights[ 0 ].position.set( 0, 200, 0 );
 				lights[ 1 ].position.set( 100, 200, 100 );
-				lights[ 2 ].position.set( -100, -200, -100 );
+				lights[ 2 ].position.set( - 100, - 200, - 100 );
 
 				scene.add( lights[ 0 ] );
 				scene.add( lights[ 1 ] );
@@ -128,7 +128,7 @@
 
 				var prevBone = new THREE.Bone();
 				bones.push( prevBone );
-				prevBone.position.y = -sizing.halfHeight;
+				prevBone.position.y = - sizing.halfHeight;
 
 				for ( var i = 0; i < sizing.segmentCount; i ++ ) {
 
@@ -187,13 +187,13 @@
 
 					folder = gui.addFolder( "Bone " + i );
 
-					folder.add( bone.position, 'x', -10 + bone.position.x, 10 + bone.position.x );
-					folder.add( bone.position, 'y', -10 + bone.position.y, 10 + bone.position.y );
-					folder.add( bone.position, 'z', -10 + bone.position.z, 10 + bone.position.z );
+					folder.add( bone.position, 'x', - 10 + bone.position.x, 10 + bone.position.x );
+					folder.add( bone.position, 'y', - 10 + bone.position.y, 10 + bone.position.y );
+					folder.add( bone.position, 'z', - 10 + bone.position.z, 10 + bone.position.z );
 
-					folder.add( bone.rotation, 'x', -Math.PI * 0.5, Math.PI * 0.5 );
-					folder.add( bone.rotation, 'y', -Math.PI * 0.5, Math.PI * 0.5 );
-					folder.add( bone.rotation, 'z', -Math.PI * 0.5, Math.PI * 0.5 );
+					folder.add( bone.rotation, 'x', - Math.PI * 0.5, Math.PI * 0.5 );
+					folder.add( bone.rotation, 'y', - Math.PI * 0.5, Math.PI * 0.5 );
+					folder.add( bone.rotation, 'z', - Math.PI * 0.5, Math.PI * 0.5 );
 
 					folder.add( bone.scale, 'x', 0, 2 );
 					folder.add( bone.scale, 'y', 0, 2 );

+ 21 - 19
docs/scenes/geometry-browser.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">
@@ -42,11 +42,11 @@
 
 		<script>
 
-			document.getElementById('newWindow').href += window.location.hash;
+			document.getElementById( 'newWindow' ).href += window.location.hash;
 
 			var gui = new dat.GUI();
 			var scene = new THREE.Scene();
-			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 50 );
+			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 );
 			camera.position.z = 30;
 
 			var renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -61,17 +61,17 @@
 			scene.add( ambientLight );
 
 			var lights = [];
-			lights[0] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[1] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[2] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 0 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 1 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 2 ] = new THREE.PointLight( 0xffffff, 1, 0 );
 
-			lights[0].position.set( 0, 200, 0 );
-			lights[1].position.set( 100, 200, 100 );
-			lights[2].position.set( -100, -200, -100 );
+			lights[ 0 ].position.set( 0, 200, 0 );
+			lights[ 1 ].position.set( 100, 200, 100 );
+			lights[ 2 ].position.set( - 100, - 200, - 100 );
 
-			scene.add( lights[0] );
-			scene.add( lights[1] );
-			scene.add( lights[2] );
+			scene.add( lights[ 0 ] );
+			scene.add( lights[ 1 ] );
+			scene.add( lights[ 2 ] );
 
 			var mesh = new THREE.Object3D()
 
@@ -79,26 +79,26 @@
 
 				new THREE.Geometry(),
 
-				new THREE.LineBasicMaterial({
+				new THREE.LineBasicMaterial( {
 					color: 0xffffff,
 					transparent: true,
 					opacity: 0.5
-				})
+				} )
 
-			));
+			) );
 
 			mesh.add( new THREE.Mesh(
 
 				new THREE.Geometry(),
 
-				new THREE.MeshPhongMaterial({
+				new THREE.MeshPhongMaterial( {
 					color: 0x156289,
 					emissive: 0x072534,
 					side: THREE.DoubleSide,
 					shading: THREE.FlatShading
-				})
+				} )
 
-			));
+			) );
 
 			var options = chooseFromHash( mesh );
 
@@ -112,9 +112,11 @@
 
 				var time = Date.now() * 0.001;
 
-				if( !options.fixed ) {
+				if ( ! options.fixed ) {
+
 					mesh.rotation.x += 0.005;
 					mesh.rotation.y += 0.005;
+
 				}
 
 				renderer.render( scene, camera );

+ 12 - 12
docs/scenes/material-browser.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">
@@ -40,11 +40,11 @@
 
 		<script>
 
-			document.getElementById('newWindow').href += window.location.hash;
+			document.getElementById( 'newWindow' ).href += window.location.hash;
 
 			var gui = new dat.GUI();
 			var scene = new THREE.Scene();
-			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 50 );
+			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 );
 			camera.position.z = 30;
 
 			var renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -56,17 +56,17 @@
 			scene.add( ambientLight );
 
 			var lights = [];
-			lights[0] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[1] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[2] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 0 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 1 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 2 ] = new THREE.PointLight( 0xffffff, 1, 0 );
 
-			lights[0].position.set( 0, 200, 0 );
-			lights[1].position.set( 100, 200, 100 );
-			lights[2].position.set( -100, -200, -100 );
+			lights[ 0 ].position.set( 0, 200, 0 );
+			lights[ 1 ].position.set( 100, 200, 100 );
+			lights[ 2 ].position.set( - 100, - 200, - 100 );
 
-			scene.add( lights[0] );
-			scene.add( lights[1] );
-			scene.add( lights[2] );
+			scene.add( lights[ 0 ] );
+			scene.add( lights[ 1 ] );
+			scene.add( lights[ 2 ] );
 
 			guiScene( gui, scene, camera );
 

+ 4 - 4
examples/webgl_loader_msgpack.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <!--
 Requires msgpack-js.js
 
@@ -22,7 +22,7 @@ https://github.com/creationix/msgpack-js-browser
 				background: #1b1c1e;
 				background-image: linear-gradient(#7d8fa3, #1b1c1e);
 			}
-		
+
 			#info {
 				color: #fff;
 				position: absolute;
@@ -43,13 +43,13 @@ https://github.com/creationix/msgpack-js-browser
 	</head>
 	<body>
 		<div id='info'>
-			<p>Robo Pigeon, from <a href='http://www.tearsofsteel.org' target='_blank'>Tears of Steel</a>, is licensed under 
+			<p>Robo Pigeon, from <a href='http://www.tearsofsteel.org' target='_blank'>Tears of Steel</a>, is licensed under
 			<a href='http://creativecommons.org/licenses/by/3.0/' target='_blank'>Creative Commons Attribution 3.0</a>.
 			</p>
 		</div>
 		<div id='viewport'></div>
 		<script>
-			
+
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 			requirejs.config( { baseUrl: 'js/libs' } );

+ 1 - 1
examples/webgl_materials_nodes.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<title>WebGL NodeMaterial</title>

+ 52 - 34
examples/webgl_morphtargets_human.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<title>three.js webgl - morph target - human</title>
@@ -29,7 +29,7 @@
 	</head>
 
 	<body>
-		
+
 		<div id="container"></div>
 
 		<div id="info">
@@ -37,17 +37,17 @@
 		</div>
 
 		<script src="../build/three.min.js"></script>
-		
+
 		<script src="js/UCSCharacter.js"></script>
 
 		<script src="js/Detector.js"></script>
-		
+
 		<script src='js/libs/dat.gui.min.js'></script>
-				
+
 		<script src="js/controls/OrbitControls.js"></script>
-		
+
 		<script>
-			
+
 			var SCREEN_WIDTH = window.innerWidth;
 			var SCREEN_HEIGHT = window.innerHeight;
 
@@ -55,7 +55,7 @@
 
 			var camera, scene;
 			var renderer;
-			
+
 			var mesh;
 
 			var mouseX = 0, mouseY = 0;
@@ -64,9 +64,9 @@
 			var windowHalfY = window.innerHeight / 2;
 
 			var clock = new THREE.Clock();
-			
+
 			var gui, skinConfig, morphConfig;
-				
+
 			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 
 			init();
@@ -92,7 +92,7 @@
 				//
 
 				var light = new THREE.DirectionalLight( 0xffffff, 1 );
-				light.position.set( 0, -1, 0 );
+				light.position.set( 0, - 1, 0 );
 				scene.add( light );
 
 				// RENDERER
@@ -106,7 +106,8 @@
 				// CHARACTER
 
 				character = new THREE.UCSCharacter();
-				character.onLoadComplete = function() {
+				character.onLoadComplete = function () {
+
 					console.log( "Load Complete" );
 					console.log( character.numSkins + " skins and " + character.numMorphs + " morphtargets loaded." );
 					gui = new dat.GUI();
@@ -114,10 +115,11 @@
 					setupMorphsGUI();
 					gui.width = 300;
 					gui.open();
+
 				};
-				
+
 				var loader = new THREE.XHRLoader();
-				loader.load("models/skinned/UCS_config.json", function ( text ) {
+				loader.load( 'models/skinned/UCS_config.json', function ( text ) {
 
 					var config = JSON.parse( text );
 					character.loadParts( config );
@@ -126,65 +128,81 @@
 				} );
 
 				window.addEventListener( 'resize', onWindowResize, false );
-				
+
 				controls = new THREE.OrbitControls( camera, renderer.domElement );
-				controls.center.set( 0, 3000, 0);
+				controls.center.set( 0, 3000, 0 );
 
 				controls.addEventListener( 'change', render );
 
 			}
-			
+
 			function setupSkinsGUI() {
-			
+
 				var skinGui = gui.addFolder( "Skins" );
-				
+
 				skinConfig = {
 					wireframe: false
 				};
-				
-				var skinCallback = function( index ) {
+
+				var skinCallback = function ( index ) {
+
 					return function () {
+
 						character.setSkin( index );
+
 					};
+
 				};
 
-				for ( var i = 0; i < character.numSkins; i++ ) {
+				for ( var i = 0; i < character.numSkins; i ++ ) {
+
 					var name = character.skins[ i ].name;
 					skinConfig[ name ] = skinCallback( i );
+
 				}
-				
-				for ( var i = 0; i < character.numSkins; i++ ) {
-					skinGui.add( skinConfig, character.skins[i].name );
+
+				for ( var i = 0; i < character.numSkins; i ++ ) {
+
+					skinGui.add( skinConfig, character.skins[ i ].name );
+
 				}
-				
+
 				skinGui.open();
 
 			}
-			
+
 			function setupMorphsGUI() {
-				
+
 				var morphGui = gui.addFolder( "Morphs" );
-				
+
 				morphConfig = {
 				};
-				
+
 				var morphCallback = function( index ) {
+
 					return function () {
+
 						character.updateMorphs( morphConfig );
+
 					}
+
 				};
-				
+
 				for ( var i = 0; i < character.numMorphs; i ++ ) {
+
 					var morphName = character.morphs[ i ];
 					morphConfig[ morphName ] = 0;
+
 				}
-				
+
 				for ( var i = 0; i < character.numMorphs; i ++ ) {
+
 					morphGui.add( morphConfig, character.morphs[ i ] ).min( 0 ).max( 100 ).onChange( morphCallback( i ) );
+
 				}
-				
+
 				morphGui.open();
-			
+
 			}
 
 			function onWindowResize() {