Browse Source

codestyle fixes

gero3 10 years ago
parent
commit
fe8493157e
100 changed files with 1336 additions and 1338 deletions
  1. 5 5
      editor/js/Sidebar.Material.js
  2. 1 1
      editor/js/Storage.js
  3. 1 1
      examples/js/AudioObject.js
  4. 3 3
      examples/js/BlendCharacter.js
  5. 3 3
      examples/js/Car.js
  6. 26 26
      examples/js/Cloth.js
  7. 1 1
      examples/js/CurveExtras.js
  8. 1 1
      examples/js/Detector.js
  9. 10 10
      examples/js/ImprovedNoise.js
  10. 1 1
      examples/js/MD2Character.js
  11. 3 3
      examples/js/MD2CharacterComplex.js
  12. 23 23
      examples/js/MarchingCubes.js
  13. 6 6
      examples/js/Ocean.js
  14. 43 43
      examples/js/Octree.js
  15. 3 3
      examples/js/ParametricGeometries.js
  16. 1 1
      examples/js/ShaderTerrain.js
  17. 127 127
      examples/js/SimplexNoise.js
  18. 2 2
      examples/js/SimulationRenderer.js
  19. 21 21
      examples/js/Sparks.js
  20. 5 5
      examples/js/TypedArrayUtils.js
  21. 1 1
      examples/js/cameras/CombinedCamera.js
  22. 3 3
      examples/js/controls/EditorControls.js
  23. 2 2
      examples/js/controls/FirstPersonControls.js
  24. 1 1
      examples/js/controls/FlyControls.js
  25. 2 2
      examples/js/controls/OrbitControls.js
  26. 5 5
      examples/js/controls/OrthographicTrackballControls.js
  27. 7 7
      examples/js/controls/TrackballControls.js
  28. 27 27
      examples/js/controls/TransformControls.js
  29. 6 6
      examples/js/crossfade/scenes.js
  30. 12 12
      examples/js/crossfade/transition.js
  31. 1 1
      examples/js/curves/NURBSCurve.js
  32. 2 2
      examples/js/curves/NURBSSurface.js
  33. 29 29
      examples/js/curves/NURBSUtils.js
  34. 13 13
      examples/js/effects/AsciiEffect.js
  35. 19 19
      examples/js/effects/VREffect.js
  36. 1 1
      examples/js/exporters/SceneExporter.js
  37. 10 10
      examples/js/geometries/ConvexGeometry.js
  38. 21 21
      examples/js/geometries/DecalGeometry.js
  39. 1 1
      examples/js/geometries/hilbert2D.js
  40. 1 1
      examples/js/geometries/hilbert3D.js
  41. 58 58
      examples/js/loaders/AWDLoader.js
  42. 27 27
      examples/js/loaders/AssimpJSONLoader.js
  43. 56 56
      examples/js/loaders/BinaryLoader.js
  44. 82 82
      examples/js/loaders/ColladaLoader.js
  45. 13 13
      examples/js/loaders/DDSLoader.js
  46. 3 3
      examples/js/loaders/MTLLoader.js
  47. 1 3
      examples/js/loaders/PDBLoader.js
  48. 10 10
      examples/js/loaders/PLYLoader.js
  49. 8 8
      examples/js/loaders/PVRLoader.js
  50. 30 30
      examples/js/loaders/RGBELoader.js
  51. 10 10
      examples/js/loaders/STLLoader.js
  52. 14 14
      examples/js/loaders/TGALoader.js
  53. 55 55
      examples/js/loaders/UTF8Loader.js
  54. 18 18
      examples/js/loaders/VRMLLoader.js
  55. 1 1
      examples/js/loaders/ctm/CTMLoader.js
  56. 101 101
      examples/js/loaders/ctm/ctm.js
  57. 109 109
      examples/js/loaders/ctm/lzma.js
  58. 1 1
      examples/js/loaders/deprecated/SceneLoader.js
  59. 11 11
      examples/js/loaders/gltf/glTF-parser.js
  60. 5 5
      examples/js/loaders/gltf/glTFAnimation.js
  61. 55 55
      examples/js/loaders/gltf/glTFLoader.js
  62. 8 8
      examples/js/loaders/gltf/glTFLoaderUtils.js
  63. 10 10
      examples/js/math/Lut.js
  64. 8 8
      examples/js/modifiers/SubdivisionModifier.js
  65. 2 2
      examples/js/postprocessing/AdaptiveToneMappingPass.js
  66. 32 32
      examples/js/postprocessing/GlitchPass.js
  67. 2 2
      examples/js/renderers/SVGRenderer.js
  68. 62 62
      examples/js/renderers/SoftwareRenderer.js
  69. 4 4
      examples/js/renderers/plugins/DepthPassPlugin.js
  70. 1 1
      examples/js/shaders/BokehShader2.js
  71. 2 2
      examples/js/shaders/ConvolutionShader.js
  72. 1 1
      examples/js/shaders/FXAAShader.js
  73. 1 1
      examples/js/shaders/NormalDisplacementShader.js
  74. 1 1
      examples/js/shaders/TriangleBlurShader.js
  75. 3 3
      examples/js/utils/UVsDebug.js
  76. 22 22
      examples/js/wip/ProxyGeometry.js
  77. 2 2
      examples/js/wip/benchmark/BoxGeometry2.js
  78. 1 1
      examples/js/wip/benchmark/Geometry4.js
  79. 1 1
      examples/js/wip/proxies/MultiColor.js
  80. 1 1
      examples/js/wip/proxies/MultiVector3.js
  81. 2 2
      src/core/Object3D.js
  82. 2 2
      src/extras/FontUtils.js
  83. 1 1
      src/extras/ImageUtils.js
  84. 2 2
      src/extras/animation/Animation.js
  85. 4 4
      src/extras/core/Curve.js
  86. 1 1
      src/extras/core/CurvePath.js
  87. 2 2
      src/extras/core/Path.js
  88. 12 12
      src/extras/core/Shape.js
  89. 2 2
      src/extras/curves/SplineCurve.js
  90. 8 8
      src/extras/geometries/ExtrudeGeometry.js
  91. 6 6
      src/extras/geometries/TubeGeometry.js
  92. 1 1
      src/lights/DirectionalLight.js
  93. 1 1
      src/loaders/BinaryTextureLoader.js
  94. 1 1
      src/math/Ray.js
  95. 1 1
      src/math/Sphere.js
  96. 2 2
      src/objects/LensFlare.js
  97. 1 1
      src/objects/Line.js
  98. 2 2
      src/objects/Mesh.js
  99. 1 1
      src/objects/PointCloud.js
  100. 2 2
      src/objects/SkinnedMesh.js

+ 5 - 5
editor/js/Sidebar.Material.js

@@ -463,7 +463,7 @@ Sidebar.Material = function ( editor ) {
 
 				var mapEnabled = materialMapEnabled.getValue() === true;
 
-				if ( objectHasUvs )  {
+				if ( objectHasUvs ) {
 
 					material.map = mapEnabled ? materialMap.getValue() : null;
 					material.needsUpdate = true;
@@ -480,7 +480,7 @@ Sidebar.Material = function ( editor ) {
 
 				var mapEnabled = materialAlphaMapEnabled.getValue() === true;
 
-				if ( objectHasUvs )  {
+				if ( objectHasUvs ) {
 
 					material.alphaMap = mapEnabled ? materialAlphaMap.getValue() : null;
 					material.needsUpdate = true;
@@ -516,7 +516,7 @@ Sidebar.Material = function ( editor ) {
 
 				var bumpMapEnabled = materialBumpMapEnabled.getValue() === true;
 
-				if ( objectHasUvs )  {
+				if ( objectHasUvs ) {
 
 					material.bumpMap = bumpMapEnabled ? materialBumpMap.getValue() : null;
 					material.bumpScale = materialBumpScale.getValue();
@@ -534,7 +534,7 @@ Sidebar.Material = function ( editor ) {
 
 				var normalMapEnabled = materialNormalMapEnabled.getValue() === true;
 
-				if ( objectHasUvs )  {
+				if ( objectHasUvs ) {
 
 					material.normalMap = normalMapEnabled ? materialNormalMap.getValue() : null;
 					material.needsUpdate = true;
@@ -551,7 +551,7 @@ Sidebar.Material = function ( editor ) {
 
 				var specularMapEnabled = materialSpecularMapEnabled.getValue() === true;
 
-				if ( objectHasUvs )  {
+				if ( objectHasUvs ) {
 
 					material.specularMap = specularMapEnabled ? materialSpecularMap.getValue() : null;
 					material.needsUpdate = true;

+ 1 - 1
editor/js/Storage.js

@@ -8,7 +8,7 @@ var Storage = function () {
 
 	if ( indexedDB === undefined  ) {
 		console.warn( 'Storage: IndexedDB not available.' );
-		return { init: function (){}, get: function (){}, set: function (){}, clear: function (){} };
+		return { init: function () {}, get: function () {}, set: function () {}, clear: function () {} };
 	}
 
 	var name = 'threejs-editor';

+ 1 - 1
examples/js/AudioObject.js

@@ -40,7 +40,7 @@ THREE.AudioObject = function ( url, volume, playbackRate, loop ) {
 
 			THREE.AudioObject.prototype.context = new webkitAudioContext();
 
-		} catch( error ) {
+		} catch ( error ) {
 
 			console.warn( "THREE.AudioObject: webkitAudioContext not found" );
 			return this;

+ 3 - 3
examples/js/BlendCharacter.js

@@ -22,7 +22,7 @@ THREE.BlendCharacter = function () {
 
 			// Create the animations
 
-			for ( var i = 0; i < geometry.animations.length; ++i ) {
+			for ( var i = 0; i < geometry.animations.length; ++ i ) {
 
 				var animName = geometry.animations[ i ].name;
 				scope.animations[ animName ] = new THREE.Animation( scope, geometry.animations[ i ] );
@@ -46,7 +46,7 @@ THREE.BlendCharacter = function () {
 
 	this.update = function( dt ) {
 
-		for ( var i = this.weightSchedule.length - 1; i >= 0; --i ) {
+		for ( var i = this.weightSchedule.length - 1; i >= 0; -- i ) {
 
 			var data = this.weightSchedule[ i ];
 			data.timeElapsed += dt;
@@ -87,7 +87,7 @@ THREE.BlendCharacter = function () {
 		// lengths match. This is useful for smoothing out transitions that get out of
 		// phase such as between a walk and run cycle
 
-		for ( var i = this.warpSchedule.length - 1; i >= 0; --i ) {
+		for ( var i = this.warpSchedule.length - 1; i >= 0; -- i ) {
 
 			var data = this.warpSchedule[ i ];
 			data.timeElapsed += dt;

+ 3 - 3
examples/js/Car.js

@@ -195,7 +195,7 @@ THREE.Car = function () {
 
 		var forwardDelta = this.speed * delta;
 
-		this.carOrientation += ( forwardDelta * this.STEERING_RADIUS_RATIO )* this.wheelOrientation;
+		this.carOrientation += ( forwardDelta * this.STEERING_RADIUS_RATIO ) * this.wheelOrientation;
 
 		// displacement
 
@@ -363,8 +363,8 @@ THREE.Car = function () {
 	};
 
 	function quadraticEaseOut( k ) { return - k * ( k - 2 ); }
-	function cubicEaseOut( k ) { return --k * k * k + 1; }
-	function circularEaseOut( k ) { return Math.sqrt( 1 - --k * k ); }
+	function cubicEaseOut( k ) { return -- k * k * k + 1; }
+	function circularEaseOut( k ) { return Math.sqrt( 1 - -- k * k ); }
 	function sinusoidalEaseOut( k ) { return Math.sin( k * Math.PI / 2 ); }
 	function exponentialEaseOut( k ) { return k === 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; }
 

+ 26 - 26
examples/js/Cloth.js

@@ -48,8 +48,8 @@ var lastTime;
 function plane(width, height) {
 
 	return function(u, v) {
-		var x = (u-0.5) * width;
-		var y = (v+0.5) * height;
+		var x = (u - 0.5) * width;
+		var y = (v + 0.5) * height;
 		var z = 0;
 
 		return new THREE.Vector3(x, y, z);
@@ -94,8 +94,8 @@ var diff = new THREE.Vector3();
 function satisifyConstrains(p1, p2, distance) {
 	diff.subVectors(p2.position, p1.position);
 	var currentDist = diff.length();
-	if (currentDist==0) return; // prevents division by 0
-	var correction = diff.multiplyScalar(1 - distance/currentDist);
+	if (currentDist == 0) return; // prevents division by 0
+	var correction = diff.multiplyScalar(1 - distance / currentDist);
 	var correctionHalf = correction.multiplyScalar(0.5);
 	p1.position.add(correctionHalf);
 	p2.position.sub(correctionHalf);
@@ -114,47 +114,47 @@ function Cloth(w, h) {
 	var u, v;
 
 	// Create particles
-	for (v=0;v<=h;v++) {
-		for (u=0;u<=w;u++) {
+	for (v = 0; v <= h; v ++) {
+		for (u = 0; u <= w; u ++) {
 			particles.push(
-				new Particle(u/w, v/h, 0, MASS)
+				new Particle(u / w, v / h, 0, MASS)
 			);
 		}
 	}
 
 	// Structural
 
-	for (v=0;v<h;v++) {
-		for (u=0;u<w;u++) {
+	for (v = 0; v < h; v ++) {
+		for (u = 0; u < w; u ++) {
 
 			constrains.push([
 				particles[index(u, v)],
-				particles[index(u, v+1)],
+				particles[index(u, v + 1)],
 				restDistance
 			]);
 
 			constrains.push([
 				particles[index(u, v)],
-				particles[index(u+1, v)],
+				particles[index(u + 1, v)],
 				restDistance
 			]);
 
 		}
 	}
 
-	for (u=w, v=0;v<h;v++) {
+	for (u = w, v = 0; v < h; v ++) {
 		constrains.push([
 			particles[index(u, v)],
-			particles[index(u, v+1)],
+			particles[index(u, v + 1)],
 			restDistance
 
 		]);
 	}
 
-	for (v=h, u=0;u<w;u++) {
+	for (v = h, u = 0; u < w; u ++) {
 		constrains.push([
 			particles[index(u, v)],
-			particles[index(u+1, v)],
+			particles[index(u + 1, v)],
 			restDistance
 		]);
 	}
@@ -211,7 +211,7 @@ function simulate(time) {
 
 		particles = cloth.particles;
 
-		for (i=0,il=faces.length;i<il;i++) {
+		for (i = 0,il = faces.length; i < il; i ++) {
 			face = faces[i];
 			normal = face.normal;
 
@@ -222,8 +222,8 @@ function simulate(time) {
 		}
 	}
 	
-	for (particles = cloth.particles, i=0, il = particles.length
-			;i<il;i++) {
+	for (particles = cloth.particles, i = 0, il = particles.length
+			; i < il; i ++) {
 		particle = particles[i];
 		particle.addForce(gravity);
 
@@ -234,7 +234,7 @@ function simulate(time) {
 
 	constrains = cloth.constrains,
 	il = constrains.length;
-	for (i=0;i<il;i++) {
+	for (i = 0; i < il; i ++) {
 		constrain = constrains[i];
 		satisifyConstrains(constrain[0], constrain[1], constrain[2]);
 	}
@@ -242,12 +242,12 @@ function simulate(time) {
 	// Ball Constrains
 
 
-	ballPosition.z = -Math.sin(Date.now()/600) * 90 ; //+ 40;
-	ballPosition.x = Math.cos(Date.now()/400) * 70
+	ballPosition.z = -Math.sin(Date.now() / 600) * 90 ; //+ 40;
+	ballPosition.x = Math.cos(Date.now() / 400) * 70
 
 	if (sphere.visible)
-	for (particles = cloth.particles, i=0, il = particles.length
-			;i<il;i++) {
+	for (particles = cloth.particles, i = 0, il = particles.length
+			; i < il; i ++) {
 		particle = particles[i];
 		pos = particle.position;
 		diff.subVectors(pos, ballPosition);
@@ -259,8 +259,8 @@ function simulate(time) {
 	}
 
 	// Floor Constains
-	for (particles = cloth.particles, i=0, il = particles.length
-			;i<il;i++) {
+	for (particles = cloth.particles, i = 0, il = particles.length
+			; i < il; i ++) {
 		particle = particles[i];
 		pos = particle.position;
 		if (pos.y < -250) {
@@ -269,7 +269,7 @@ function simulate(time) {
 	}
 
 	// Pin Constrains
-	for (i=0, il=pins.length;i<il;i++) {
+	for (i = 0, il = pins.length; i < il; i ++) {
 		var xy = pins[i];
 		var p = particles[xy];
 		p.position.copy(p.original);

+ 1 - 1
examples/js/CurveExtras.js

@@ -15,7 +15,7 @@
 THREE.Curves = {};
 
 
- THREE.Curves.GrannyKnot = THREE.Curve.create( function(){},
+ THREE.Curves.GrannyKnot = THREE.Curve.create( function() {},
 
 	 function(t) {
 	    t = 2 * Math.PI * t;

+ 1 - 1
examples/js/Detector.js

@@ -6,7 +6,7 @@
 var Detector = {
 
 	canvas: !! window.CanvasRenderingContext2D,
-	webgl: ( function () { try { var canvas = document.createElement( 'canvas' ); return !! ( window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ) ); } catch( e ) { return false; } } )(),
+	webgl: ( function () { try { var canvas = document.createElement( 'canvas' ); return !! ( window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ) ); } catch ( e ) { return false; } } )(),
 	workers: !! window.Worker,
 	fileapi: window.File && window.FileReader && window.FileList && window.Blob,
 

+ 10 - 10
examples/js/ImprovedNoise.js

@@ -2,7 +2,7 @@
 
 var ImprovedNoise = function () {
 
-	var p = [151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,
+	var p = [ 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,
 		 23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,
 		 174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,
 		 133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,
@@ -11,11 +11,11 @@ var ImprovedNoise = function () {
 		 248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,
 		 178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,
 		 14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,
-		 93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];
+		 93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 ];
 
-	for (var i=0; i < 256 ; i++) {
+	for (var i = 0; i < 256 ; i ++) {
 
-		p[256+i] = p[i];
+		p[256 + i] = p[i];
 
 	}
 
@@ -51,20 +51,20 @@ var ImprovedNoise = function () {
 			y -= floorY;
 			z -= floorZ;
 
-			var xMinus1 = x -1, yMinus1 = y - 1, zMinus1 = z - 1;
+			var xMinus1 = x - 1, yMinus1 = y - 1, zMinus1 = z - 1;
 
 			var u = fade(x), v = fade(y), w = fade(z);
 
-			var A = p[X]+Y, AA = p[A]+Z, AB = p[A+1]+Z, B = p[X+1]+Y, BA = p[B]+Z, BB = p[B+1]+Z;
+			var A = p[X] + Y, AA = p[A] + Z, AB = p[A + 1] + Z, B = p[X + 1] + Y, BA = p[B] + Z, BB = p[B + 1] + Z;
 
 			return lerp(w, lerp(v, lerp(u, grad(p[AA], x, y, z), 
 							grad(p[BA], xMinus1, y, z)),
 						lerp(u, grad(p[AB], x, yMinus1, z),
 							grad(p[BB], xMinus1, yMinus1, z))),
-					lerp(v, lerp(u, grad(p[AA+1], x, y, zMinus1),
-							grad(p[BA+1], xMinus1, y, z-1)),
-						lerp(u, grad(p[AB+1], x, yMinus1, zMinus1),
-							grad(p[BB+1], xMinus1, yMinus1, zMinus1))));
+					lerp(v, lerp(u, grad(p[AA + 1], x, y, zMinus1),
+							grad(p[BA + 1], xMinus1, y, z - 1)),
+						lerp(u, grad(p[AB + 1], x, yMinus1, zMinus1),
+							grad(p[BB + 1], xMinus1, yMinus1, zMinus1))));
 
 		}
 	}

+ 1 - 1
examples/js/MD2Character.js

@@ -210,7 +210,7 @@ THREE.MD2Character = function () {
 		//
 
 		var mesh = new THREE.MorphAnimMesh( geometry, materialTexture );
-		mesh.rotation.y = -Math.PI/2;
+		mesh.rotation.y = -Math.PI / 2;
 
 		mesh.castShadow = true;
 		mesh.receiveShadow = true;

+ 3 - 3
examples/js/MD2CharacterComplex.js

@@ -402,7 +402,7 @@ THREE.MD2CharacterComplex = function () {
 
 		if ( controls.moveForward ) {
 
-			if ( this.meshBody )   {
+			if ( this.meshBody ) {
 
 				this.meshBody.setAnimationDirectionForward( this.activeAnimation );
 				this.meshBody.setAnimationDirectionForward( this.oldAnimation );
@@ -445,7 +445,7 @@ THREE.MD2CharacterComplex = function () {
 		// speed based on controls
 
 		if ( controls.crouch ) 	this.maxSpeed = this.crouchSpeed;
-		else  					this.maxSpeed = this.walkSpeed;
+		else this.maxSpeed = this.walkSpeed;
 
 		this.maxReverseSpeed = -this.maxSpeed;
 
@@ -533,7 +533,7 @@ THREE.MD2CharacterComplex = function () {
 		//
 
 		var mesh = new THREE.MorphBlendMesh( geometry, materialTexture );
-		mesh.rotation.y = -Math.PI/2;
+		mesh.rotation.y = -Math.PI / 2;
 
 		//
 

+ 23 - 23
examples/js/MarchingCubes.js

@@ -224,7 +224,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 
 		// bottom of the cube
 
-		if ( bits & 16 )  {
+		if ( bits & 16 ) {
 
 			this.compNorm( qz );
 			this.compNorm( q1z );
@@ -232,7 +232,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 
 		};
 
-		if ( bits & 32 )  {
+		if ( bits & 32 ) {
 
 			this.compNorm( q1z );
 			this.compNorm( q1yz );
@@ -485,22 +485,22 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 
 		var x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val;
 
-		for ( z = min_z; z < max_z; z++ ) {
+		for ( z = min_z; z < max_z; z ++ ) {
 
 			z_offset = this.size2 * z,
 			fz = z / this.size - ballz,
 			fz2 = fz * fz;
 
-			for ( y = min_y; y < max_y; y++ ) {
+			for ( y = min_y; y < max_y; y ++ ) {
 
 				y_offset = z_offset + this.size * y;
 				fy = y / this.size - bally;
 				fy2 = fy * fy;
 
-				for ( x = min_x; x < max_x; x++ ) {
+				for ( x = min_x; x < max_x; x ++ ) {
 
 					fx = x / this.size - ballx;
-					val = strength / ( 0.000001 + fx*fx + fy2 + fz2 ) - subtract;
+					val = strength / ( 0.000001 + fx * fx + fy2 + fz2 ) - subtract;
 					if ( val > 0.0 ) this.field[ y_offset + x ] += val;
 
 				}
@@ -763,38 +763,38 @@ THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
 // who in turn got them from Cory Gene Bloyd.
 
 THREE.edgeTable = new Int32Array([
-0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
+0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
-0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
+0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
-0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c,
+0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,
 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
-0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac,
+0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,
 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
-0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c,
+0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,
 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
-0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc,
+0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,
 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
-0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c,
+0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,
 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
-0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc ,
+0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,
 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
-0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
+0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
-0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
+0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
-0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
+0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
-0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460,
+0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,
 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
-0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0,
+0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,
 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
-0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230,
+0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,
 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
-0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190,
+0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,
 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
-0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0])
+0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ])
 
 THREE.triTable = new Int32Array([
 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -1052,4 +1052,4 @@ THREE.triTable = new Int32Array([
 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
--1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]);
+-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ]);

+ 6 - 6
examples/js/Ocean.js

@@ -20,8 +20,8 @@
 		return value !== undefined ? value : defaultValue;
 	};
 	options = options || {};
-	this.clearColor = optionalParameter(options.CLEAR_COLOR, [1.0, 1.0, 1.0, 0.0]);
-	this.geometryOrigin = optionalParameter(options.GEOMETRY_ORIGIN, [-1000.0, -1000.0]);
+	this.clearColor = optionalParameter(options.CLEAR_COLOR, [ 1.0, 1.0, 1.0, 0.0 ]);
+	this.geometryOrigin = optionalParameter(options.GEOMETRY_ORIGIN, [ -1000.0, -1000.0 ]);
 	this.sunDirectionX = optionalParameter(options.SUN_DIRECTION[0], -1.0);
 	this.sunDirectionY = optionalParameter(options.SUN_DIRECTION[1], 1.0);
 	this.sunDirectionZ = optionalParameter(options.SUN_DIRECTION[2], 1.0);
@@ -228,8 +228,8 @@ THREE.Ocean.prototype.generateSeedPhaseTexture = function() {
 	// Setup the seed texture
 	this.pingPhase = true;
 	var phaseArray = new window.Float32Array(this.resolution * this.resolution * 4);
-	for (var i = 0; i < this.resolution; i++) {
-		for (var j = 0; j < this.resolution; j++) {
+	for (var i = 0; i < this.resolution; i ++) {
+		for (var j = 0; j < this.resolution; j ++) {
 			phaseArray[i * this.resolution * 4 + j * 4] =  Math.random() * 2.0 * Math.PI;
 			phaseArray[i * this.resolution * 4 + j * 4 + 1] = 0.0;
 			phaseArray[i * this.resolution * 4 + j * 4 + 2] = 0.0;
@@ -283,7 +283,7 @@ THREE.Ocean.prototype.renderSpectrumFFT = function() {
 	
 	this.scene.overrideMaterial = this.materialOceanHorizontal;
 
-	for (var i = 0; i < iterations; i++) {
+	for (var i = 0; i < iterations; i ++) {
 		if (i === 0) {
 			this.materialOceanHorizontal.uniforms.u_input.value = this.spectrumFramebuffer;
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow(2, (i % (iterations)) + 1);
@@ -301,7 +301,7 @@ THREE.Ocean.prototype.renderSpectrumFFT = function() {
 		}
 	}
 	this.scene.overrideMaterial = this.materialOceanVertical;
-	for (var i = iterations; i < iterations*2; i++) {
+	for (var i = iterations; i < iterations * 2; i ++) {
 		if (i === iterations * 2 - 1) {
 			this.materialOceanVertical.uniforms.u_input.value = (iterations % 2 === 0) ? this.pingTransformFramebuffer : this.pongTransformFramebuffer;
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow(2, (i % (iterations)) + 1);

+ 43 - 43
examples/js/Octree.js

@@ -29,7 +29,7 @@
 	
 	function indexOfValue( array, value ) {
 		
-		for ( var i = 0, il = array.length; i < il; i++ ) {
+		for ( var i = 0, il = array.length; i < il; i ++ ) {
 			
 			if ( array[ i ] === value ) {
 				
@@ -45,7 +45,7 @@
 	
 	function indexOfPropertyWithValue( array, property, value ) {
 		
-		for ( var i = 0, il = array.length; i < il; i++ ) {
+		for ( var i = 0, il = array.length; i < il; i ++ ) {
 			
 			if ( array[ i ][ property ] === value ) {
 				
@@ -140,7 +140,7 @@
 			
 			if ( this.objectsDeferred.length > 0 ) {
 				
-				for ( var i = 0, il = this.objectsDeferred.length; i < il; i++ ) {
+				for ( var i = 0, il = this.objectsDeferred.length; i < il; i ++ ) {
 					
 					var deferred = this.objectsDeferred[ i ];
 					
@@ -221,7 +221,7 @@
 					geometry = object.geometry;
 					vertices = geometry.vertices;
 					
-					for ( i = 0, l = vertices.length; i < l; i++ ) {
+					for ( i = 0, l = vertices.length; i < l; i ++ ) {
 						
 						this.addObjectData( object, vertices[ i ] );
 						
@@ -232,7 +232,7 @@
 					geometry = object.geometry;
 					faces = geometry.faces;
 					
-					for ( i = 0, l = faces.length; i < l; i++ ) {
+					for ( i = 0, l = faces.length; i < l; i ++ ) {
 						
 						this.addObjectData( object, faces[ i ] );
 						
@@ -297,7 +297,7 @@
 					
 					// remove from objects data list
 					
-					for ( i = 0, l = objectsDataRemoved.length; i < l; i++ ) {
+					for ( i = 0, l = objectsDataRemoved.length; i < l; i ++ ) {
 						
 						objectData = objectsDataRemoved[ i ];
 						
@@ -341,7 +341,7 @@
 				
 				objectsData = octree.objectsData;
 				
-				for ( i = 0, l = objectsData.length; i < l; i++ ) {
+				for ( i = 0, l = objectsData.length; i < l; i ++ ) {
 					
 					objectData = objectsData[ i ];
 					
@@ -366,7 +366,7 @@
 			// check all object data for changes in position
 			// assumes all object matrices are up to date
 			
-			for ( i = 0, l = this.objectsData.length; i < l; i++ ) {
+			for ( i = 0, l = this.objectsData.length; i < l; i ++ ) {
 				
 				objectData = this.objectsData[ i ];
 				
@@ -402,7 +402,7 @@
 			
 			// update changed objects
 			
-			for ( i = 0, l = objectsUpdate.length; i < l; i++ ) {
+			for ( i = 0, l = objectsUpdate.length; i < l; i ++ ) {
 				
 				objectData = objectsUpdate[ i ];
 				
@@ -429,14 +429,14 @@
 			
 			parent = object.parent;
 			
-			while( parent ) {
+			while ( parent ) {
 				
 				parentCascade.push( parent );
 				parent = parent.parent;
 				
 			}
 			
-			for ( i = 0, l = parentCascade.length; i < l; i++ ) {
+			for ( i = 0, l = parentCascade.length; i < l; i ++ ) {
 				
 				parent = parentCascade[ i ];
 				
@@ -494,7 +494,7 @@
 			
 			// search each node of root
 			
-			for ( i = 0, l = this.root.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.root.nodesIndices.length; i < l; i ++ ) {
 				
 				node = this.root.nodesByIndex[ this.root.nodesIndices[ i ] ];
 				
@@ -511,7 +511,7 @@
 				
 				// for each object data found
 				
-				for ( i = 0, l = objects.length; i < l; i++ ) {
+				for ( i = 0, l = objects.length; i < l; i ++ ) {
 					
 					objectData = objects[ i ];
 					object = objectData.object;
@@ -739,7 +739,7 @@
 		
 		// basic properties
 		
-		this.id = this.tree.nodeCount++;
+		this.id = this.tree.nodeCount ++;
 		this.position = parameters.position instanceof THREE.Vector3 ? parameters.position : new THREE.Vector3();
 		this.radius = parameters.radius > 0 ? parameters.radius : 1;
 		this.indexOctant = parameters.indexOctant;
@@ -811,7 +811,7 @@
 			
 			// cascade
 			
-			for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				this.nodesByIndex[ this.nodesIndices[ i ] ].updateProperties();
 				
@@ -832,7 +832,7 @@
 			
 			// unset parent in nodes
 			
-			for ( i = 0, l = nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = nodesIndices.length; i < l; i ++ ) {
 				
 				node = nodesByIndex[ nodesIndices[ i ] ];
 				
@@ -949,7 +949,7 @@
 			var i, l,
 				object;
 
-			for ( i = 0, l = objects.length; i < l; i++ ) {
+			for ( i = 0, l = objects.length; i < l; i ++ ) {
 				
 				object = objects[ i ];
 				
@@ -977,7 +977,7 @@
 			
 			if ( nodesRemovedFrom.length > 0 ) {
 				
-				for ( i = 0, l = nodesRemovedFrom.length; i < l; i++ ) {
+				for ( i = 0, l = nodesRemovedFrom.length; i < l; i ++ ) {
 					
 					nodesRemovedFrom[ i ].shrink();
 					
@@ -1021,7 +1021,7 @@
 			
 				// search each object data for object and remove (slow)
 				
-				for ( i = this.objects.length - 1; i >= 0; i-- ) {
+				for ( i = this.objects.length - 1; i >= 0; i -- ) {
 					
 					objectData = this.objects[ i ];
 					
@@ -1059,7 +1059,7 @@
 			
 			if ( removeData.searchComplete !== true ) {
 				
-				for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+				for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 					
 					node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 					
@@ -1106,7 +1106,7 @@
 			
 			// for each object
 			
-			for ( i = 0, l = this.objects.length; i < l; i++ ) {
+			for ( i = 0, l = this.objects.length; i < l; i ++ ) {
 				
 				object = this.objects[ i ];
 				
@@ -1183,7 +1183,7 @@
 				
 				// for each object
 				
-				for ( i = 0, l = objects.length; i < l; i++ ) {
+				for ( i = 0, l = objects.length; i < l; i ++ ) {
 					
 					object = objects[ i ];
 					
@@ -1314,7 +1314,7 @@
 				
 				// reset counts
 				
-				for ( i = 0, l = iom.length; i < l; i++ ) {
+				for ( i = 0, l = iom.length; i < l; i ++ ) {
 					
 					iom[ i ].count = 0;
 					
@@ -1322,7 +1322,7 @@
 				
 				// for all outside objects, find outside octants containing most objects
 				
-				for ( i = 0, l = objects.length; i < l; i++ ) {
+				for ( i = 0, l = objects.length; i < l; i ++ ) {
 					
 					object = objects[ i ];
 					
@@ -1344,11 +1344,11 @@
 						
 						if ( flagsOutside & this.tree.FLAG_POS_X ) {
 							
-							iom[ this.tree.INDEX_OUTSIDE_POS_X ].count++;
+							iom[ this.tree.INDEX_OUTSIDE_POS_X ].count ++;
 							
 						} else if ( flagsOutside & this.tree.FLAG_NEG_X ) {
 							
-							iom[ this.tree.INDEX_OUTSIDE_NEG_X ].count++;
+							iom[ this.tree.INDEX_OUTSIDE_NEG_X ].count ++;
 							
 						}
 						
@@ -1356,11 +1356,11 @@
 						
 						if ( flagsOutside & this.tree.FLAG_POS_Y ) {
 							
-							iom[ this.tree.INDEX_OUTSIDE_POS_Y ].count++;
+							iom[ this.tree.INDEX_OUTSIDE_POS_Y ].count ++;
 							
 						} else if ( flagsOutside & this.tree.FLAG_NEG_Y ) {
 							
-							iom[ this.tree.INDEX_OUTSIDE_NEG_Y ].count++;
+							iom[ this.tree.INDEX_OUTSIDE_NEG_Y ].count ++;
 							
 						}
 						
@@ -1368,11 +1368,11 @@
 						
 						if ( flagsOutside & this.tree.FLAG_POS_Z ) {
 							
-							iom[ this.tree.INDEX_OUTSIDE_POS_Z ].count++;
+							iom[ this.tree.INDEX_OUTSIDE_POS_Z ].count ++;
 							
 						} else if ( flagsOutside & this.tree.FLAG_NEG_Z ) {
 							
-							iom[ this.tree.INDEX_OUTSIDE_NEG_Z ].count++;
+							iom[ this.tree.INDEX_OUTSIDE_NEG_Z ].count ++;
 							
 						}
 						
@@ -1474,7 +1474,7 @@
 					
 					// add all expand objects to parent
 					
-					for ( i = 0, l = objectsExpand.length; i < l; i++ ) {
+					for ( i = 0, l = objectsExpand.length; i < l; i ++ ) {
 						
 						this.tree.root.addObject( objectsExpand[ i ] );
 						
@@ -1546,7 +1546,7 @@
 			
 			nodes = toArray( nodes );
 			
-			for ( i = 0, l = nodes.length; i < l; i++ ) {
+			for ( i = 0, l = nodes.length; i < l; i ++ ) {
 				
 				node = nodes[ i ];
 				
@@ -1586,7 +1586,7 @@
 				nodeHeaviestObjectsCount = 0;
 				outsideHeaviestObjectsCount = this.objects.length;
 				
-				for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+				for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 					
 					node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 					
@@ -1625,7 +1625,7 @@
 			
 			// handle all nodes
 			
-			for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 				
@@ -1848,7 +1848,7 @@
 				
 				// search subtree
 				
-				for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+				for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 					
 					node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 					
@@ -1917,7 +1917,7 @@
 			tmin = Math.max( Math.max( Math.min( t1, t2), Math.min( t3, t4)), Math.min( t5, t6));
 			
 			// if tmin > tmax or tmin > ray distance, ray doesn't intersect AABB
-			if( tmin > tmax || tmin > distance ) {
+			if ( tmin > tmax || tmin > distance ) {
 				return false;
 			}
 			
@@ -1932,7 +1932,7 @@
 
 			if ( this.nodesIndices.length > 0 ) {
 				
-				for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+				for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 
 					node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 
@@ -1961,7 +1961,7 @@
 			var i, l,
 				count = this.nodesIndices.length;
 			
-			for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				count += this.nodesByIndex[ this.nodesIndices[ i ] ].getNodeCountRecursive();
 				
@@ -1978,7 +1978,7 @@
 			
 			objects = ( objects || [] ).concat( this.objects );
 			
-			for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 				
@@ -1995,7 +1995,7 @@
 			var i, l,
 				count = this.objects.length;
 			
-			for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				count += this.nodesByIndex[ this.nodesIndices[ i ] ].getObjectCountEnd();
 				
@@ -2010,7 +2010,7 @@
 			var count = this.objects.length,
 				parent = this.parent;
 			
-			while( parent instanceof THREE.OctreeNode ) {
+			while ( parent instanceof THREE.OctreeNode ) {
 				
 				count += parent.objects.length;
 				parent = parent.parent;
@@ -2033,7 +2033,7 @@
 			console.log( ( this.parent ? space + ' ' : ' ' ), '+ objects ( ', this.objects.length, ' ) ', this.objects );
 			console.log( ( this.parent ? space + ' ' : ' ' ), '+ children ( ', this.nodesIndices.length, ' )', this.nodesIndices, this.nodesByIndex );
 			
-			for ( i = 0, l = this.nodesIndices.length; i < l; i++ ) {
+			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				node = this.nodesByIndex[ this.nodesIndices[ i ] ];
 				
@@ -2101,7 +2101,7 @@
 		var i, il,
 			intersects = [];
 		
-		for ( i = 0, il = objects.length; i < il; i++ ) {
+		for ( i = 0, il = objects.length; i < il; i ++ ) {
 			
 			intersects = intersects.concat( this.intersectOctreeObject( objects[ i ], recursive ) );
 		

+ 3 - 3
examples/js/ParametricGeometries.js

@@ -48,9 +48,9 @@ THREE.ParametricGeometries = {
 		var x, y, z;
 
 		var a = 2;
-		x = Math.cos(v) * (a + u * Math.cos(v/2));
-		y = Math.sin(v) * (a + u * Math.cos(v/2));
-		z = u * Math.sin(v/2);
+		x = Math.cos(v) * (a + u * Math.cos(v / 2));
+		y = Math.sin(v) * (a + u * Math.cos(v / 2));
+		z = u * Math.sin(v / 2);
 		return new THREE.Vector3(x, y, z);
 
 	},

+ 1 - 1
examples/js/ShaderTerrain.js

@@ -217,7 +217,7 @@ THREE.ShaderTerrain = {
 				"#if MAX_HEMI_LIGHTS > 0",
 
 					"vec3 hemiDiffuse  = vec3( 0.0 );",
-					"vec3 hemiSpecular = vec3( 0.0 );" ,
+					"vec3 hemiSpecular = vec3( 0.0 );",
 
 					"for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
 

+ 127 - 127
examples/js/SimplexNoise.js

@@ -13,72 +13,72 @@
  */
 var SimplexNoise = function(r) {
 	if (r == undefined) r = Math;
-  this.grad3 = [[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0], 
-                                 [1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1], 
-                                 [0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]]; 
+  this.grad3 = [[ 1,1,0 ],[ -1,1,0 ],[ 1,-1,0 ],[ -1,-1,0 ], 
+                                 [ 1,0,1 ],[ -1,0,1 ],[ 1,0,-1 ],[ -1,0,-1 ], 
+                                 [ 0,1,1 ],[ 0,-1,1 ],[ 0,1,-1 ],[ 0,-1,-1 ]]; 
 
-  this.grad4 = [[0,1,1,1], [0,1,1,-1], [0,1,-1,1], [0,1,-1,-1],
-	     [0,-1,1,1], [0,-1,1,-1], [0,-1,-1,1], [0,-1,-1,-1],
-	     [1,0,1,1], [1,0,1,-1], [1,0,-1,1], [1,0,-1,-1],
-	     [-1,0,1,1], [-1,0,1,-1], [-1,0,-1,1], [-1,0,-1,-1],
-	     [1,1,0,1], [1,1,0,-1], [1,-1,0,1], [1,-1,0,-1],
-	     [-1,1,0,1], [-1,1,0,-1], [-1,-1,0,1], [-1,-1,0,-1],
-	     [1,1,1,0], [1,1,-1,0], [1,-1,1,0], [1,-1,-1,0],
-	     [-1,1,1,0], [-1,1,-1,0], [-1,-1,1,0], [-1,-1,-1,0]];
+  this.grad4 = [[ 0,1,1,1 ], [ 0,1,1,-1 ], [ 0,1,-1,1 ], [ 0,1,-1,-1 ],
+	     [ 0,-1,1,1 ], [ 0,-1,1,-1 ], [ 0,-1,-1,1 ], [ 0,-1,-1,-1 ],
+	     [ 1,0,1,1 ], [ 1,0,1,-1 ], [ 1,0,-1,1 ], [ 1,0,-1,-1 ],
+	     [ -1,0,1,1 ], [ -1,0,1,-1 ], [ -1,0,-1,1 ], [ -1,0,-1,-1 ],
+	     [ 1,1,0,1 ], [ 1,1,0,-1 ], [ 1,-1,0,1 ], [ 1,-1,0,-1 ],
+	     [ -1,1,0,1 ], [ -1,1,0,-1 ], [ -1,-1,0,1 ], [ -1,-1,0,-1 ],
+	     [ 1,1,1,0 ], [ 1,1,-1,0 ], [ 1,-1,1,0 ], [ 1,-1,-1,0 ],
+	     [ -1,1,1,0 ], [ -1,1,-1,0 ], [ -1,-1,1,0 ], [ -1,-1,-1,0 ]];
 
   this.p = [];
-  for (var i=0; i<256; i++) {
-	  this.p[i] = Math.floor(r.random()*256);
+  for (var i = 0; i < 256; i ++) {
+	  this.p[i] = Math.floor(r.random() * 256);
   }
   // To remove the need for index wrapping, double the permutation table length 
   this.perm = []; 
-  for(var i=0; i<512; i++) {
-		this.perm[i]=this.p[i & 255];
+  for (var i = 0; i < 512; i ++) {
+		this.perm[i] = this.p[i & 255];
 	} 
 
   // A lookup table to traverse the simplex around a given point in 4D. 
   // Details can be found where this table is used, in the 4D noise method. 
   this.simplex = [ 
-    [0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0], 
-    [0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0], 
-    [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0], 
-    [1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0], 
-    [1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0], 
-    [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0], 
-    [2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0], 
-    [2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]; 
+    [ 0,1,2,3 ],[ 0,1,3,2 ],[ 0,0,0,0 ],[ 0,2,3,1 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 1,2,3,0 ], 
+    [ 0,2,1,3 ],[ 0,0,0,0 ],[ 0,3,1,2 ],[ 0,3,2,1 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 1,3,2,0 ], 
+    [ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ], 
+    [ 1,2,0,3 ],[ 0,0,0,0 ],[ 1,3,0,2 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 2,3,0,1 ],[ 2,3,1,0 ], 
+    [ 1,0,2,3 ],[ 1,0,3,2 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 2,0,3,1 ],[ 0,0,0,0 ],[ 2,1,3,0 ], 
+    [ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ], 
+    [ 2,0,1,3 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 3,0,1,2 ],[ 3,0,2,1 ],[ 0,0,0,0 ],[ 3,1,2,0 ], 
+    [ 2,1,0,3 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 0,0,0,0 ],[ 3,1,0,2 ],[ 0,0,0,0 ],[ 3,2,0,1 ],[ 3,2,1,0 ]]; 
 };
 
 SimplexNoise.prototype.dot = function(g, x, y) { 
-	return g[0]*x + g[1]*y;
+	return g[0] * x + g[1] * y;
 };
 
 SimplexNoise.prototype.dot3 = function(g, x, y, z) {
-  return g[0]*x + g[1]*y + g[2]*z; 
+  return g[0] * x + g[1] * y + g[2] * z; 
 }
 
 SimplexNoise.prototype.dot4 = function(g, x, y, z, w) {
-  return g[0]*x + g[1]*y + g[2]*z + g[3]*w;
+  return g[0] * x + g[1] * y + g[2] * z + g[3] * w;
 };
 
 SimplexNoise.prototype.noise = function(xin, yin) { 
   var n0, n1, n2; // Noise contributions from the three corners 
   // Skew the input space to determine which simplex cell we're in 
-  var F2 = 0.5*(Math.sqrt(3.0)-1.0); 
-  var s = (xin+yin)*F2; // Hairy factor for 2D 
-  var i = Math.floor(xin+s); 
-  var j = Math.floor(yin+s); 
-  var G2 = (3.0-Math.sqrt(3.0))/6.0; 
-  var t = (i+j)*G2; 
-  var X0 = i-t; // Unskew the cell origin back to (x,y) space 
-  var Y0 = j-t; 
-  var x0 = xin-X0; // The x,y distances from the cell origin 
-  var y0 = yin-Y0; 
+  var F2 = 0.5 * (Math.sqrt(3.0) - 1.0); 
+  var s = (xin + yin) * F2; // Hairy factor for 2D 
+  var i = Math.floor(xin + s); 
+  var j = Math.floor(yin + s); 
+  var G2 = (3.0 - Math.sqrt(3.0)) / 6.0; 
+  var t = (i + j) * G2; 
+  var X0 = i - t; // Unskew the cell origin back to (x,y) space 
+  var Y0 = j - t; 
+  var x0 = xin - X0; // The x,y distances from the cell origin 
+  var y0 = yin - Y0; 
   // For the 2D case, the simplex shape is an equilateral triangle. 
   // Determine which simplex we are in. 
   var i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords 
-  if(x0>y0) {i1=1; j1=0;} // lower triangle, XY order: (0,0)->(1,0)->(1,1) 
-  else {i1=0; j1=1;}      // upper triangle, YX order: (0,0)->(0,1)->(1,1) 
+  if (x0 > y0) {i1 = 1; j1 = 0;} // lower triangle, XY order: (0,0)->(1,0)->(1,1) 
+  else {i1 = 0; j1 = 1;}      // upper triangle, YX order: (0,0)->(0,1)->(1,1) 
   // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and 
   // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where 
   // c = (3-sqrt(3))/6 
@@ -89,24 +89,24 @@ SimplexNoise.prototype.noise = function(xin, yin) {
   // Work out the hashed gradient indices of the three simplex corners 
   var ii = i & 255; 
   var jj = j & 255; 
-  var gi0 = this.perm[ii+this.perm[jj]] % 12; 
-  var gi1 = this.perm[ii+i1+this.perm[jj+j1]] % 12; 
-  var gi2 = this.perm[ii+1+this.perm[jj+1]] % 12; 
+  var gi0 = this.perm[ii + this.perm[jj]] % 12; 
+  var gi1 = this.perm[ii + i1 + this.perm[jj + j1]] % 12; 
+  var gi2 = this.perm[ii + 1 + this.perm[jj + 1]] % 12; 
   // Calculate the contribution from the three corners 
-  var t0 = 0.5 - x0*x0-y0*y0; 
-  if(t0<0) n0 = 0.0; 
+  var t0 = 0.5 - x0 * x0 - y0 * y0; 
+  if (t0 < 0) n0 = 0.0; 
   else { 
     t0 *= t0; 
     n0 = t0 * t0 * this.dot(this.grad3[gi0], x0, y0);  // (x,y) of grad3 used for 2D gradient 
   } 
-  var t1 = 0.5 - x1*x1-y1*y1; 
-  if(t1<0) n1 = 0.0; 
+  var t1 = 0.5 - x1 * x1 - y1 * y1; 
+  if (t1 < 0) n1 = 0.0; 
   else { 
     t1 *= t1; 
     n1 = t1 * t1 * this.dot(this.grad3[gi1], x1, y1); 
   }
-  var t2 = 0.5 - x2*x2-y2*y2; 
-  if(t2<0) n2 = 0.0; 
+  var t2 = 0.5 - x2 * x2 - y2 * y2; 
+  if (t2 < 0) n2 = 0.0; 
   else { 
     t2 *= t2; 
     n2 = t2 * t2 * this.dot(this.grad3[gi2], x2, y2); 
@@ -120,33 +120,33 @@ SimplexNoise.prototype.noise = function(xin, yin) {
 SimplexNoise.prototype.noise3d = function(xin, yin, zin) { 
   var n0, n1, n2, n3; // Noise contributions from the four corners 
   // Skew the input space to determine which simplex cell we're in 
-  var F3 = 1.0/3.0; 
-  var s = (xin+yin+zin)*F3; // Very nice and simple skew factor for 3D 
-  var i = Math.floor(xin+s); 
-  var j = Math.floor(yin+s); 
-  var k = Math.floor(zin+s); 
-  var G3 = 1.0/6.0; // Very nice and simple unskew factor, too 
-  var t = (i+j+k)*G3; 
-  var X0 = i-t; // Unskew the cell origin back to (x,y,z) space 
-  var Y0 = j-t; 
-  var Z0 = k-t; 
-  var x0 = xin-X0; // The x,y,z distances from the cell origin 
-  var y0 = yin-Y0; 
-  var z0 = zin-Z0; 
+  var F3 = 1.0 / 3.0; 
+  var s = (xin + yin + zin) * F3; // Very nice and simple skew factor for 3D 
+  var i = Math.floor(xin + s); 
+  var j = Math.floor(yin + s); 
+  var k = Math.floor(zin + s); 
+  var G3 = 1.0 / 6.0; // Very nice and simple unskew factor, too 
+  var t = (i + j + k) * G3; 
+  var X0 = i - t; // Unskew the cell origin back to (x,y,z) space 
+  var Y0 = j - t; 
+  var Z0 = k - t; 
+  var x0 = xin - X0; // The x,y,z distances from the cell origin 
+  var y0 = yin - Y0; 
+  var z0 = zin - Z0; 
   // For the 3D case, the simplex shape is a slightly irregular tetrahedron. 
   // Determine which simplex we are in. 
   var i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords 
   var i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords 
-  if(x0>=y0) { 
-    if(y0>=z0) 
-      { i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } // X Y Z order 
-      else if(x0>=z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } // X Z Y order 
-      else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } // Z X Y order 
+  if (x0 >= y0) { 
+    if (y0 >= z0) 
+      { i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 1; k2 = 0; } // X Y Z order 
+      else if (x0 >= z0) { i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 0; k2 = 1; } // X Z Y order 
+      else { i1 = 0; j1 = 0; k1 = 1; i2 = 1; j2 = 0; k2 = 1; } // Z X Y order 
     } 
   else { // x0<y0 
-    if(y0<z0) { i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; } // Z Y X order 
-    else if(x0<z0) { i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; } // Y Z X order 
-    else { i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; } // Y X Z order 
+    if (y0 < z0) { i1 = 0; j1 = 0; k1 = 1; i2 = 0; j2 = 1; k2 = 1; } // Z Y X order 
+    else if (x0 < z0) { i1 = 0; j1 = 1; k1 = 0; i2 = 0; j2 = 1; k2 = 1; } // Y Z X order 
+    else { i1 = 0; j1 = 1; k1 = 0; i2 = 1; j2 = 1; k2 = 0; } // Y X Z order 
   } 
   // A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z), 
   // a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and 
@@ -155,48 +155,48 @@ SimplexNoise.prototype.noise3d = function(xin, yin, zin) {
   var x1 = x0 - i1 + G3; // Offsets for second corner in (x,y,z) coords 
   var y1 = y0 - j1 + G3; 
   var z1 = z0 - k1 + G3; 
-  var x2 = x0 - i2 + 2.0*G3; // Offsets for third corner in (x,y,z) coords 
-  var y2 = y0 - j2 + 2.0*G3; 
-  var z2 = z0 - k2 + 2.0*G3; 
-  var x3 = x0 - 1.0 + 3.0*G3; // Offsets for last corner in (x,y,z) coords 
-  var y3 = y0 - 1.0 + 3.0*G3; 
-  var z3 = z0 - 1.0 + 3.0*G3; 
+  var x2 = x0 - i2 + 2.0 * G3; // Offsets for third corner in (x,y,z) coords 
+  var y2 = y0 - j2 + 2.0 * G3; 
+  var z2 = z0 - k2 + 2.0 * G3; 
+  var x3 = x0 - 1.0 + 3.0 * G3; // Offsets for last corner in (x,y,z) coords 
+  var y3 = y0 - 1.0 + 3.0 * G3; 
+  var z3 = z0 - 1.0 + 3.0 * G3; 
   // Work out the hashed gradient indices of the four simplex corners 
   var ii = i & 255; 
   var jj = j & 255; 
   var kk = k & 255; 
-  var gi0 = this.perm[ii+this.perm[jj+this.perm[kk]]] % 12; 
-  var gi1 = this.perm[ii+i1+this.perm[jj+j1+this.perm[kk+k1]]] % 12; 
-  var gi2 = this.perm[ii+i2+this.perm[jj+j2+this.perm[kk+k2]]] % 12; 
-  var gi3 = this.perm[ii+1+this.perm[jj+1+this.perm[kk+1]]] % 12; 
+  var gi0 = this.perm[ii + this.perm[jj + this.perm[kk]]] % 12; 
+  var gi1 = this.perm[ii + i1 + this.perm[jj + j1 + this.perm[kk + k1]]] % 12; 
+  var gi2 = this.perm[ii + i2 + this.perm[jj + j2 + this.perm[kk + k2]]] % 12; 
+  var gi3 = this.perm[ii + 1 + this.perm[jj + 1 + this.perm[kk + 1]]] % 12; 
   // Calculate the contribution from the four corners 
-  var t0 = 0.6 - x0*x0 - y0*y0 - z0*z0; 
-  if(t0<0) n0 = 0.0; 
+  var t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0; 
+  if (t0 < 0) n0 = 0.0; 
   else { 
     t0 *= t0; 
     n0 = t0 * t0 * this.dot3(this.grad3[gi0], x0, y0, z0); 
   }
-  var t1 = 0.6 - x1*x1 - y1*y1 - z1*z1; 
-  if(t1<0) n1 = 0.0; 
+  var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1; 
+  if (t1 < 0) n1 = 0.0; 
   else { 
     t1 *= t1; 
     n1 = t1 * t1 * this.dot3(this.grad3[gi1], x1, y1, z1); 
   } 
-  var t2 = 0.6 - x2*x2 - y2*y2 - z2*z2; 
-  if(t2<0) n2 = 0.0; 
+  var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2; 
+  if (t2 < 0) n2 = 0.0; 
   else { 
     t2 *= t2; 
     n2 = t2 * t2 * this.dot3(this.grad3[gi2], x2, y2, z2); 
   } 
-  var t3 = 0.6 - x3*x3 - y3*y3 - z3*z3; 
-  if(t3<0) n3 = 0.0; 
+  var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3; 
+  if (t3 < 0) n3 = 0.0; 
   else { 
     t3 *= t3; 
     n3 = t3 * t3 * this.dot3(this.grad3[gi3], x3, y3, z3); 
   } 
   // Add contributions from each corner to get the final noise value. 
   // The result is scaled to stay just inside [-1,1] 
-  return 32.0*(n0 + n1 + n2 + n3); 
+  return 32.0 * (n0 + n1 + n2 + n3); 
 };
 
 // 4D simplex noise
@@ -207,8 +207,8 @@ SimplexNoise.prototype.noise4d = function( x, y, z, w ) {
 	var perm = this.perm;
 	
    // The skewing and unskewing factors are hairy again for the 4D case
-   var F4 = (Math.sqrt(5.0)-1.0)/4.0;
-   var G4 = (5.0-Math.sqrt(5.0))/20.0;
+   var F4 = (Math.sqrt(5.0) - 1.0) / 4.0;
+   var G4 = (5.0 - Math.sqrt(5.0)) / 20.0;
    var n0, n1, n2, n3, n4; // Noise contributions from the five corners
    // Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in
    var s = (x + y + z + w) * F4; // Factor for 4D skewing
@@ -249,72 +249,72 @@ SimplexNoise.prototype.noise4d = function( x, y, z, w ) {
    // impossible. Only the 24 indices which have non-zero entries make any sense.
    // We use a thresholding to set the coordinates in turn from the largest magnitude.
    // The number 3 in the "simplex" array is at the position of the largest coordinate.
-   i1 = simplex[c][0]>=3 ? 1 : 0;
-   j1 = simplex[c][1]>=3 ? 1 : 0;
-   k1 = simplex[c][2]>=3 ? 1 : 0;
-   l1 = simplex[c][3]>=3 ? 1 : 0;
+   i1 = simplex[c][0] >= 3 ? 1 : 0;
+   j1 = simplex[c][1] >= 3 ? 1 : 0;
+   k1 = simplex[c][2] >= 3 ? 1 : 0;
+   l1 = simplex[c][3] >= 3 ? 1 : 0;
    // The number 2 in the "simplex" array is at the second largest coordinate.
-   i2 = simplex[c][0]>=2 ? 1 : 0;
-   j2 = simplex[c][1]>=2 ? 1 : 0;    k2 = simplex[c][2]>=2 ? 1 : 0;
-   l2 = simplex[c][3]>=2 ? 1 : 0;
+   i2 = simplex[c][0] >= 2 ? 1 : 0;
+   j2 = simplex[c][1] >= 2 ? 1 : 0;    k2 = simplex[c][2] >= 2 ? 1 : 0;
+   l2 = simplex[c][3] >= 2 ? 1 : 0;
    // The number 1 in the "simplex" array is at the second smallest coordinate.
-   i3 = simplex[c][0]>=1 ? 1 : 0;
-   j3 = simplex[c][1]>=1 ? 1 : 0;
-   k3 = simplex[c][2]>=1 ? 1 : 0;
-   l3 = simplex[c][3]>=1 ? 1 : 0;
+   i3 = simplex[c][0] >= 1 ? 1 : 0;
+   j3 = simplex[c][1] >= 1 ? 1 : 0;
+   k3 = simplex[c][2] >= 1 ? 1 : 0;
+   l3 = simplex[c][3] >= 1 ? 1 : 0;
    // The fifth corner has all coordinate offsets = 1, so no need to look that up.
    var x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords
    var y1 = y0 - j1 + G4;
    var z1 = z0 - k1 + G4;
    var w1 = w0 - l1 + G4;
-   var x2 = x0 - i2 + 2.0*G4; // Offsets for third corner in (x,y,z,w) coords
-   var y2 = y0 - j2 + 2.0*G4;
-   var z2 = z0 - k2 + 2.0*G4;
-   var w2 = w0 - l2 + 2.0*G4;
-   var x3 = x0 - i3 + 3.0*G4; // Offsets for fourth corner in (x,y,z,w) coords
-   var y3 = y0 - j3 + 3.0*G4;
-   var z3 = z0 - k3 + 3.0*G4;
-   var w3 = w0 - l3 + 3.0*G4;
-   var x4 = x0 - 1.0 + 4.0*G4; // Offsets for last corner in (x,y,z,w) coords
-   var y4 = y0 - 1.0 + 4.0*G4;
-   var z4 = z0 - 1.0 + 4.0*G4;
-   var w4 = w0 - 1.0 + 4.0*G4;
+   var x2 = x0 - i2 + 2.0 * G4; // Offsets for third corner in (x,y,z,w) coords
+   var y2 = y0 - j2 + 2.0 * G4;
+   var z2 = z0 - k2 + 2.0 * G4;
+   var w2 = w0 - l2 + 2.0 * G4;
+   var x3 = x0 - i3 + 3.0 * G4; // Offsets for fourth corner in (x,y,z,w) coords
+   var y3 = y0 - j3 + 3.0 * G4;
+   var z3 = z0 - k3 + 3.0 * G4;
+   var w3 = w0 - l3 + 3.0 * G4;
+   var x4 = x0 - 1.0 + 4.0 * G4; // Offsets for last corner in (x,y,z,w) coords
+   var y4 = y0 - 1.0 + 4.0 * G4;
+   var z4 = z0 - 1.0 + 4.0 * G4;
+   var w4 = w0 - 1.0 + 4.0 * G4;
    // Work out the hashed gradient indices of the five simplex corners
    var ii = i & 255;
    var jj = j & 255;
    var kk = k & 255;
    var ll = l & 255;
-   var gi0 = perm[ii+perm[jj+perm[kk+perm[ll]]]] % 32;
-   var gi1 = perm[ii+i1+perm[jj+j1+perm[kk+k1+perm[ll+l1]]]] % 32;
-   var gi2 = perm[ii+i2+perm[jj+j2+perm[kk+k2+perm[ll+l2]]]] % 32;
-   var gi3 = perm[ii+i3+perm[jj+j3+perm[kk+k3+perm[ll+l3]]]] % 32;
-   var gi4 = perm[ii+1+perm[jj+1+perm[kk+1+perm[ll+1]]]] % 32;
+   var gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32;
+   var gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32;
+   var gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32;
+   var gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32;
+   var gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32;
    // Calculate the contribution from the five corners
-   var t0 = 0.6 - x0*x0 - y0*y0 - z0*z0 - w0*w0;
-   if(t0<0) n0 = 0.0;
+   var t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
+   if (t0 < 0) n0 = 0.0;
    else {
      t0 *= t0;
      n0 = t0 * t0 * this.dot4(grad4[gi0], x0, y0, z0, w0);
    }
-  var t1 = 0.6 - x1*x1 - y1*y1 - z1*z1 - w1*w1;
-   if(t1<0) n1 = 0.0;
+  var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
+   if (t1 < 0) n1 = 0.0;
    else {
      t1 *= t1;
      n1 = t1 * t1 * this.dot4(grad4[gi1], x1, y1, z1, w1);
    }
-  var t2 = 0.6 - x2*x2 - y2*y2 - z2*z2 - w2*w2;
-   if(t2<0) n2 = 0.0;
+  var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
+   if (t2 < 0) n2 = 0.0;
    else {
      t2 *= t2;
      n2 = t2 * t2 * this.dot4(grad4[gi2], x2, y2, z2, w2);
-   }   var t3 = 0.6 - x3*x3 - y3*y3 - z3*z3 - w3*w3;
-   if(t3<0) n3 = 0.0;
+   }   var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
+   if (t3 < 0) n3 = 0.0;
    else {
      t3 *= t3;
      n3 = t3 * t3 * this.dot4(grad4[gi3], x3, y3, z3, w3);
    }
-  var t4 = 0.6 - x4*x4 - y4*y4 - z4*z4 - w4*w4;
-   if(t4<0) n4 = 0.0;
+  var t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
+   if (t4 < 0) n4 = 0.0;
    else {
      t4 *= t4;
      n4 = t4 * t4 * this.dot4(grad4[gi4], x4, y4, z4, w4);

+ 2 - 2
examples/js/SimulationRenderer.js

@@ -19,12 +19,12 @@ function SimulationRenderer(WIDTH, renderer) {
 	// Init RTT stuff
 	gl = renderer.getContext();
 
-	if( !gl.getExtension( "OES_texture_float" )) {
+	if ( !gl.getExtension( "OES_texture_float" )) {
 		alert( "No OES_texture_float support for float textures!" );
 		return;
 	}
 
-	if( gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS) == 0) {
+	if ( gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS) == 0) {
 		alert( "No support for vertex shader textures!" );
 		return;
 	}

+ 21 - 21
examples/js/Sparks.js

@@ -77,14 +77,14 @@ SPARKS.Emitter.prototype = {
 				elapsed = maxBlock;
 			}
 
-			while(elapsed >= emitter._TIMESTEP) {
+			while (elapsed >= emitter._TIMESTEP) {
 				emitter.update(emitter._TIMESTEP / 1000);
 				elapsed -= emitter._TIMESTEP;
 			}
 			emitter._lastTime = time - elapsed;
 
 		} else {
-			emitter.update(elapsed/1000);
+			emitter.update(elapsed / 1000);
 			emitter._lastTime = time;
 		}
 
@@ -103,13 +103,13 @@ SPARKS.Emitter.prototype = {
         var len = this._counter.updateEmitter( this, time );
 
         // Create particles
-        for( i = 0; i < len; i++ ) {
+        for ( i = 0; i < len; i ++ ) {
             this.createParticle();
         }
 
         // Update activities
         len = this._activities.length;
-        for ( i = 0; i < len; i++ )
+        for ( i = 0; i < len; i ++ )
         {
             this._activities[i].update( this, time );
         }
@@ -121,10 +121,10 @@ SPARKS.Emitter.prototype = {
 		var action;
         var len2 = this._particles.length;
 
-        for( j = 0; j < len; j++ )
+        for ( j = 0; j < len; j ++ )
         {
             action = this._actions[j];
-            for ( i = 0; i < len2; ++i )
+            for ( i = 0; i < len2; ++ i )
             {
                 particle = this._particles[i];
                 action.update( this, particle, time );
@@ -133,7 +133,7 @@ SPARKS.Emitter.prototype = {
 
 
         // remove dead particles
-        for ( i = len2; i--; )
+        for ( i = len2; i --; )
         {
             particle = this._particles[i];
             if ( particle.isDead )
@@ -158,7 +158,7 @@ SPARKS.Emitter.prototype = {
         // In future, use a Particle Factory
         var len = this._initializers.length, i;
 
-        for ( i = 0; i < len; i++ ) {
+        for ( i = 0; i < len; i ++ ) {
             this._initializers[i].initialize( this, particle );
         }
 
@@ -300,9 +300,9 @@ SPARKS.Particle = function() {
      * For 3D
      */
 
-     this.position = SPARKS.VectorPool.get().set(0,0,0); //new THREE.Vector3( 0, 0, 0 );
-     this.velocity = SPARKS.VectorPool.get().set(0,0,0); //new THREE.Vector3( 0, 0, 0 );
-	this._oldvelocity = SPARKS.VectorPool.get().set(0,0,0);
+     this.position = SPARKS.VectorPool.get().set(0, 0, 0); //new THREE.Vector3( 0, 0, 0 );
+     this.velocity = SPARKS.VectorPool.get().set(0, 0, 0); //new THREE.Vector3( 0, 0, 0 );
+	this._oldvelocity = SPARKS.VectorPool.get().set(0, 0, 0);
      // rotation vec3
      // angVelocity vec3
      // faceAxis vec3
@@ -327,7 +327,7 @@ SPARKS.Age = function(easing) {
 
 SPARKS.Age.prototype.update = function (emitter, particle, time) {
     particle.age += time;
-    if( particle.age >= particle.lifetime )
+    if ( particle.age >= particle.lifetime )
     {
         particle.energy = 0;
         particle.isDead = true;
@@ -451,7 +451,7 @@ SPARKS.AccelerateFactor.prototype.update = function(emitter, particle, time) {
     var v = particle.velocity;
 	var len = v.length();
 	var adjFactor;
-    if (len>0) {
+    if (len > 0) {
 
 		adjFactor = factor * time / len;
 		adjFactor += 1;
@@ -595,17 +595,17 @@ SPARKS.CubeZone.prototype.contains = function(position) {
 	var y = this.y; // depth
 	var z = this.z; // height
 
-	if (x<0) {
+	if (x < 0) {
 		startX += x;
 		x = Math.abs(x);
 	}
 
-	if (y<0) {
+	if (y < 0) {
 		startY += y;
 		y = Math.abs(y);
 	}
 
-	if (z<0) {
+	if (z < 0) {
 		startZ += z;
 		z = Math.abs(z);
 	}
@@ -683,7 +683,7 @@ SPARKS.SphereCapZone = function(x, y, z, minr, maxr, angle) {
 };
 
 SPARKS.SphereCapZone.prototype.getLocation = function() {
-    var theta = Math.PI *2  * SPARKS.Utils.random();
+    var theta = Math.PI * 2  * SPARKS.Utils.random();
     var r = SPARKS.Utils.random();
 
     //new THREE.Vector3
@@ -691,7 +691,7 @@ SPARKS.SphereCapZone.prototype.getLocation = function() {
 
     //v.length = StardustMath.interpolate(0, _minRadius, 1, _maxRadius, Math.random());
 
-    var i = this.minr - ((this.minr-this.maxr) *  Math.random() );
+    var i = this.minr - ((this.minr - this.maxr) *  Math.random() );
     v.multiplyScalar(i);
 
 	v.__markedForReleased = true;
@@ -769,7 +769,7 @@ SPARKS.VectorPool = {
 
 	// Get a new Vector
 	get: function() {
-		if (this.__pools.length>0) {
+		if (this.__pools.length > 0) {
 			return this.__pools.pop();
 		}
 
@@ -786,7 +786,7 @@ SPARKS.VectorPool = {
 	_addToPool: function() {
 		//console.log("creating some pools");
 
-		for (var i=0, size = 100; i < size; i++) {
+		for (var i = 0, size = 100; i < size; i ++) {
 			this.__pools.push(new THREE.Vector3());
 		}
 
@@ -821,7 +821,7 @@ SPARKS.Utils = {
 
 	getPerpendicular: function( v )
 	{
-		if( v.x == 0 )
+		if ( v.x == 0 )
 		{
 			return new THREE.Vector3D( 1, 0, 0 );
 		}

+ 5 - 5
examples/js/TypedArrayUtils.js

@@ -33,8 +33,8 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		for ( y = 0; y < eleSize; y ++ ) {
 
 			tmp = arr[ a + y ];
-			arr[ a + y ]=arr[ b + y ];
-			arr[ b + y ]=tmp;
+			arr[ a + y ] = arr[ b + y ];
+			arr[ b + y ] = tmp;
 
 		}
 
@@ -46,7 +46,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 		if ( right - left <= 25 ) {
 
-			for ( j= left + 1; j <= right; j ++ ) {
+			for ( j = left + 1; j <= right; j ++ ) {
 
 				for ( x = 0; x < eleSize; x ++ ) {
 			
@@ -214,7 +214,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		
 		median = Math.floor( plength / 2 );
 		
-		node = new self.Node( getPointSet( points, median ) , depth, parent, median + pos );
+		node = new self.Node( getPointSet( points, median ), depth, parent, median + pos );
 		node.left = buildTree( points.subarray( 0, median * eleSize), depth + 1, node, pos );
 		node.right = buildTree( points.subarray( ( median + 1 ) * eleSize, points.length ), depth + 1, node, pos + median + 1 );
 
@@ -226,7 +226,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		
 	this.getMaxDepth = function () { return maxDepth; };
 	
-	this.nearest = function ( point, maxNodes , maxDistance ) {
+	this.nearest = function ( point, maxNodes, maxDistance ) {
 	
 		 /* point: array of size eleSize 
 			maxNodes: max amount of nodes to return 

+ 1 - 1
examples/js/cameras/CombinedCamera.js

@@ -29,7 +29,7 @@ THREE.CombinedCamera = function ( width, height, fov, near, far, orthoNear, orth
 
 	this.toPerspective();
 
-	var aspect = width/height;
+	var aspect = width / height;
 
 };
 

+ 3 - 3
examples/js/controls/EditorControls.js

@@ -262,7 +262,7 @@ THREE.EditorControls = function ( object, domElement ) {
 			case 1:
 				touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 );
 				touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 );
-				scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ] ,prevTouches ) ).multiplyScalar( - 0.005 ) );
+				scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - 0.005 ) );
 				break;
 
 			case 2:
@@ -273,8 +273,8 @@ THREE.EditorControls = function ( object, domElement ) {
 				prevDistance = distance;
 
 
-				var offset0 = touches[ 0 ].clone().sub( getClosest( touches[ 0 ] ,prevTouches ) );
-				var offset1 = touches[ 1 ].clone().sub( getClosest( touches[ 1 ] ,prevTouches ) );
+				var offset0 = touches[ 0 ].clone().sub( getClosest( touches[ 0 ], prevTouches ) );
+				var offset1 = touches[ 1 ].clone().sub( getClosest( touches[ 1 ], prevTouches ) );
 				offset0.x = -offset0.x;
 				offset1.x = -offset1.x;
 

+ 2 - 2
examples/js/controls/FirstPersonControls.js

@@ -163,7 +163,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 	this.onKeyUp = function ( event ) {
 
-		switch( event.keyCode ) {
+		switch ( event.keyCode ) {
 
 			case 38: /*up*/
 			case 87: /*W*/ this.moveForward = false; break;
@@ -229,7 +229,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 		}
 
 		this.lon += this.mouseX * actualLookSpeed;
-		if( this.lookVertical ) this.lat -= this.mouseY * actualLookSpeed * verticalLookRatio;
+		if ( this.lookVertical ) this.lat -= this.mouseY * actualLookSpeed * verticalLookRatio;
 
 		this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
 		this.phi = THREE.Math.degToRad( 90 - this.lat );

+ 1 - 1
examples/js/controls/FlyControls.js

@@ -80,7 +80,7 @@ THREE.FlyControls = function ( object, domElement ) {
 
 	this.keyup = function( event ) {
 
-		switch( event.keyCode ) {
+		switch ( event.keyCode ) {
 
 			case 16: /* shift */ this.movementSpeedMultiplier = 1; break;
 

+ 2 - 2
examples/js/controls/OrbitControls.js

@@ -121,8 +121,8 @@ THREE.OrbitControls = function ( object, domElement ) {
 	// events
 
 	var changeEvent = { type: 'change' };
-	var startEvent = { type: 'start'};
-	var endEvent = { type: 'end'};
+	var startEvent = { type: 'start' };
+	var endEvent = { type: 'end' };
 
 	this.rotateLeft = function ( angle ) {
 

+ 5 - 5
examples/js/controls/OrthographicTrackballControls.js

@@ -73,8 +73,8 @@ THREE.OrthographicTrackballControls = function ( object, domElement ) {
 	// events
 
 	var changeEvent = { type: 'change' };
-	var startEvent = { type: 'start'};
-	var endEvent = { type: 'end'};
+	var startEvent = { type: 'start' };
+	var endEvent = { type: 'end' };
 
 
 	// methods
@@ -156,7 +156,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement ) {
 
 				if ( length < Math.SQRT1_2 ) {
 
-					mouseOnBall.z = Math.sqrt( 1.0 - length*length );
+					mouseOnBall.z = Math.sqrt( 1.0 - length * length );
 
 				} else {
 
@@ -186,7 +186,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement ) {
 
 	}() );
 
-	this.rotateCamera = (function(){
+	this.rotateCamera = (function() {
 
 		var axis = new THREE.Vector3(),
 			quaternion = new THREE.Quaternion();
@@ -264,7 +264,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement ) {
 
 	};
 
-	this.panCamera = (function(){
+	this.panCamera = (function() {
 
 		var mouseChange = new THREE.Vector2(),
 			objectUp = new THREE.Vector3(),

+ 7 - 7
examples/js/controls/TrackballControls.js

@@ -68,8 +68,8 @@ THREE.TrackballControls = function ( object, domElement ) {
 	// events
 
 	var changeEvent = { type: 'change' };
-	var startEvent = { type: 'start'};
-	var endEvent = { type: 'end'};
+	var startEvent = { type: 'start' };
+	var endEvent = { type: 'end' };
 
 
 	// methods
@@ -133,8 +133,8 @@ THREE.TrackballControls = function ( object, domElement ) {
 		return function ( pageX, pageY ) {
 
 			mouseOnBall.set(
-				( pageX - _this.screen.width * 0.5 - _this.screen.left ) / (_this.screen.width*.5),
-				( _this.screen.height * 0.5 + _this.screen.top - pageY ) / (_this.screen.height*.5),
+				( pageX - _this.screen.width * 0.5 - _this.screen.left ) / (_this.screen.width * .5),
+				( _this.screen.height * 0.5 + _this.screen.top - pageY ) / (_this.screen.height * .5),
 				0.0
 			);
 
@@ -144,7 +144,7 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 				if ( length < Math.SQRT1_2 ) {
 
-					mouseOnBall.z = Math.sqrt( 1.0 - length*length );
+					mouseOnBall.z = Math.sqrt( 1.0 - length * length );
 
 				} else {
 
@@ -174,7 +174,7 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	}() );
 
-	this.rotateCamera = (function(){
+	this.rotateCamera = (function() {
 
 		var axis = new THREE.Vector3(),
 			quaternion = new THREE.Quaternion();
@@ -245,7 +245,7 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 	};
 
-	this.panCamera = (function(){
+	this.panCamera = (function() {
 
 		var mouseChange = new THREE.Vector2(),
 			objectUp = new THREE.Vector3(),

+ 27 - 27
examples/js/controls/TransformControls.js

@@ -110,8 +110,8 @@
 
 			this.activePlane = planes["XYZE"];
 
-			planes["YZ"].rotation.set( 0, Math.PI/2, 0 );
-			planes["XZ"].rotation.set( -Math.PI/2, 0, 0 );
+			planes["YZ"].rotation.set( 0, Math.PI / 2, 0 );
+			planes["XZ"].rotation.set( -Math.PI / 2, 0, 0 );
 
 			for (var i in planes) {
 				planes[i].name = i;
@@ -126,7 +126,7 @@
 
 				for ( var name in gizmoMap ) {
 
-					for ( i = gizmoMap[name].length; i--;) {
+					for ( i = gizmoMap[name].length; i --;) {
 
 						var object = gizmoMap[name][i][0];
 						var position = gizmoMap[name][i][1];
@@ -183,7 +183,7 @@
 
 		this.highlight = function ( axis ) {
 			this.traverse(function( child ) {
-				if ( child.material && child.material.highlight ){
+				if ( child.material && child.material.highlight ) {
 					if ( child.name == axis ) {
 						child.material.highlight( true );
 					} else {
@@ -236,7 +236,7 @@
 
 		this.handleGizmos = {
 			X: [
-				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0xff0000 } ) ), [ 0.5, 0, 0 ], [ 0, 0, -Math.PI/2 ] ],
+				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0xff0000 } ) ), [ 0.5, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ],
 				[ new THREE.Line( lineXGeometry, new GizmoLineMaterial( { color: 0xff0000 } ) ) ]
 			],
 			Y: [
@@ -244,7 +244,7 @@
 				[	new THREE.Line( lineYGeometry, new GizmoLineMaterial( { color: 0x00ff00 } ) ) ]
 			],
 			Z: [
-				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0x0000ff } ) ), [ 0, 0, 0.5 ], [ Math.PI/2, 0, 0 ] ],
+				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0x0000ff } ) ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ] ],
 				[ new THREE.Line( lineZGeometry, new GizmoLineMaterial( { color: 0x0000ff } ) ) ]
 			],
 			XYZ: [
@@ -254,22 +254,22 @@
 				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.29, 0.29 ), new GizmoMaterial( { color: 0xffff00, opacity: 0.25 } ) ), [ 0.15, 0.15, 0 ] ]
 			],
 			YZ: [
-				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.29, 0.29 ), new GizmoMaterial( { color: 0x00ffff, opacity: 0.25 } ) ), [ 0, 0.15, 0.15 ], [ 0, Math.PI/2, 0 ] ]
+				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.29, 0.29 ), new GizmoMaterial( { color: 0x00ffff, opacity: 0.25 } ) ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ] ]
 			],
 			XZ: [
-				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.29, 0.29 ), new GizmoMaterial( { color: 0xff00ff, opacity: 0.25 } ) ), [ 0.15, 0, 0.15 ], [ -Math.PI/2, 0, 0 ] ]
+				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.29, 0.29 ), new GizmoMaterial( { color: 0xff00ff, opacity: 0.25 } ) ), [ 0.15, 0, 0.15 ], [ -Math.PI / 2, 0, 0 ] ]
 			]
 		};
 
 		this.pickerGizmos = {
 			X: [
-				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0xff0000, opacity: 0.25 } ) ), [ 0.6, 0, 0 ], [ 0, 0, -Math.PI/2 ] ]
+				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0xff0000, opacity: 0.25 } ) ), [ 0.6, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ]
 			],
 			Y: [
 				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0x00ff00, opacity: 0.25 } ) ), [ 0, 0.6, 0 ] ]
 			],
 			Z: [
-				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0x0000ff, opacity: 0.25 } ) ), [ 0, 0, 0.6 ], [ Math.PI/2, 0, 0 ] ]
+				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0x0000ff, opacity: 0.25 } ) ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ] ]
 			],
 			XYZ: [
 				[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.2, 0 ), new GizmoMaterial( { color: 0xffffff, opacity: 0.25 } ) ) ]
@@ -278,10 +278,10 @@
 				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), new GizmoMaterial( { color: 0xffff00, opacity: 0.25 } ) ), [ 0.2, 0.2, 0 ] ]
 			],
 			YZ: [
-				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), new GizmoMaterial( { color: 0x00ffff, opacity: 0.25 } ) ), [ 0, 0.2, 0.2 ], [ 0, Math.PI/2, 0 ] ]
+				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), new GizmoMaterial( { color: 0x00ffff, opacity: 0.25 } ) ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ] ]
 			],
 			XZ: [
-				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), new GizmoMaterial( { color: 0xff00ff, opacity: 0.25 } ) ), [ 0.2, 0, 0.2 ], [ -Math.PI/2, 0, 0 ] ]
+				[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), new GizmoMaterial( { color: 0xff00ff, opacity: 0.25 } ) ), [ 0.2, 0, 0.2 ], [ -Math.PI / 2, 0, 0 ] ]
 			]
 		};
 
@@ -295,12 +295,12 @@
 				if ( Math.abs(eye.y) > Math.abs(eye.z) ) this.activePlane = this.planes[ "XZ" ];
 			}
 
-			if ( axis == "Y" ){
+			if ( axis == "Y" ) {
 				this.activePlane = this.planes[ "XY" ];
 				if ( Math.abs(eye.x) > Math.abs(eye.z) ) this.activePlane = this.planes[ "YZ" ];
 			}
 
-			if ( axis == "Z" ){
+			if ( axis == "Z" ) {
 				this.activePlane = this.planes[ "XZ" ];
 				if ( Math.abs(eye.x) > Math.abs(eye.y) ) this.activePlane = this.planes[ "YZ" ];
 			}
@@ -333,7 +333,7 @@
 
 				var geometry = new THREE.Geometry();
 				arc = arc ? arc : 1;
-				for ( var i = 0; i <= 64 * arc; ++i ) {
+				for ( var i = 0; i <= 64 * arc; ++ i ) {
 					if ( facing == 'x' ) geometry.vertices.push( new THREE.Vector3( 0, Math.cos( i / 32 * Math.PI ), Math.sin( i / 32 * Math.PI ) ).multiplyScalar(radius) );
 					if ( facing == 'y' ) geometry.vertices.push( new THREE.Vector3( Math.cos( i / 32 * Math.PI ), 0, Math.sin( i / 32 * Math.PI ) ).multiplyScalar(radius) );
 					if ( facing == 'z' ) geometry.vertices.push( new THREE.Vector3( Math.sin( i / 32 * Math.PI ), Math.cos( i / 32 * Math.PI ), 0 ).multiplyScalar(radius) );
@@ -362,13 +362,13 @@
 
 		this.pickerGizmos = {
 			X: [
-				[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.12, 4, 12, Math.PI ), new GizmoMaterial( { color: 0xff0000, opacity: 0.25 } ) ), [ 0, 0, 0 ], [ 0, -Math.PI/2, -Math.PI/2 ] ]
+				[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.12, 4, 12, Math.PI ), new GizmoMaterial( { color: 0xff0000, opacity: 0.25 } ) ), [ 0, 0, 0 ], [ 0, -Math.PI / 2, -Math.PI / 2 ] ]
 			],
 			Y: [
-				[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.12, 4, 12, Math.PI ), new GizmoMaterial( { color: 0x00ff00, opacity: 0.25 } ) ), [ 0, 0, 0 ], [ Math.PI/2, 0, 0 ] ]
+				[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.12, 4, 12, Math.PI ), new GizmoMaterial( { color: 0x00ff00, opacity: 0.25 } ) ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ] ]
 			],
 			Z: [
-				[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.12, 4, 12, Math.PI ), new GizmoMaterial( { color: 0x0000ff, opacity: 0.25 } ) ), [ 0, 0, 0 ], [ 0, 0, -Math.PI/2 ] ]
+				[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.12, 4, 12, Math.PI ), new GizmoMaterial( { color: 0x0000ff, opacity: 0.25 } ) ), [ 0, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ]
 			],
 			E: [
 				[ new THREE.Mesh( new THREE.TorusGeometry( 1.25, 0.12, 2, 24 ), new GizmoMaterial( { color: 0xffff00, opacity: 0.25 } ) ) ]
@@ -474,7 +474,7 @@
 
 		this.handleGizmos = {
 			X: [
-				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0xff0000 } ) ), [ 0.5, 0, 0 ], [ 0, 0, -Math.PI/2 ] ],
+				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0xff0000 } ) ), [ 0.5, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ],
 				[ new THREE.Line( lineXGeometry, new GizmoLineMaterial( { color: 0xff0000 } ) ) ]
 			],
 			Y: [
@@ -482,7 +482,7 @@
 				[ new THREE.Line( lineYGeometry, new GizmoLineMaterial( { color: 0x00ff00 } ) ) ]
 			],
 			Z: [
-				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0x0000ff } ) ), [ 0, 0, 0.5 ], [ Math.PI/2, 0, 0 ] ],
+				[ new THREE.Mesh( arrowGeometry, new GizmoMaterial( { color: 0x0000ff } ) ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ] ],
 				[ new THREE.Line( lineZGeometry, new GizmoLineMaterial( { color: 0x0000ff } ) ) ]
 			],
 			XYZ: [
@@ -492,13 +492,13 @@
 
 		this.pickerGizmos = {
 			X: [
-				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0xff0000, opacity: 0.25 } ) ), [ 0.6, 0, 0 ], [ 0, 0, -Math.PI/2 ] ]
+				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0xff0000, opacity: 0.25 } ) ), [ 0.6, 0, 0 ], [ 0, 0, -Math.PI / 2 ] ]
 			],
 			Y: [
 				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0x00ff00, opacity: 0.25 } ) ), [ 0, 0.6, 0 ] ]
 			],
 			Z: [
-				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0x0000ff, opacity: 0.25 } ) ), [ 0, 0, 0.6 ], [ Math.PI/2, 0, 0 ] ]
+				[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), new GizmoMaterial( { color: 0x0000ff, opacity: 0.25 } ) ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ] ]
 			],
 			XYZ: [
 				[ new THREE.Mesh( new THREE.BoxGeometry( 0.4, 0.4, 0.4 ), new GizmoMaterial( { color: 0xffffff, opacity: 0.25 } ) ) ]
@@ -515,12 +515,12 @@
 				if ( Math.abs(eye.y) > Math.abs(eye.z) ) this.activePlane = this.planes[ "XZ" ];
 			}
 
-			if ( axis == "Y" ){
+			if ( axis == "Y" ) {
 				this.activePlane = this.planes[ "XY" ];
 				if ( Math.abs(eye.x) > Math.abs(eye.z) ) this.activePlane = this.planes[ "YZ" ];
 			}
 
-			if ( axis == "Z" ){
+			if ( axis == "Z" ) {
 				this.activePlane = this.planes[ "XZ" ];
 				if ( Math.abs(eye.x) > Math.abs(eye.y) ) this.activePlane = this.planes[ "YZ" ];
 			}
@@ -775,7 +775,7 @@
 
 					scope.gizmo[_mode].setActivePlane( scope.axis, eye );
 
-					var planeIntersect = intersectObjects( pointer, [scope.gizmo[_mode].activePlane] );
+					var planeIntersect = intersectObjects( pointer, [ scope.gizmo[_mode].activePlane ] );
 
 					oldPosition.copy( scope.object.position );
 					oldScale.copy( scope.object.scale );
@@ -803,9 +803,9 @@
 			event.preventDefault();
 			event.stopPropagation();
 
-			var pointer = event.changedTouches? event.changedTouches[0] : event;
+			var pointer = event.changedTouches ? event.changedTouches[0] : event;
 
-			var planeIntersect = intersectObjects( pointer, [scope.gizmo[_mode].activePlane] );
+			var planeIntersect = intersectObjects( pointer, [ scope.gizmo[_mode].activePlane ] );
 
 			point.copy( planeIntersect.point );
 

+ 6 - 6
examples/js/crossfade/scenes.js

@@ -8,7 +8,7 @@ function generateGeometry(objectType, numObjects) {
 
 			var n = ( f instanceof THREE.Face3 ) ? 3 : 4;
 
-			for( var j = 0; j < n; j ++ ) {
+			for ( var j = 0; j < n; j ++ ) {
 
 				f.vertexColors[ j ] = c;
 
@@ -43,13 +43,13 @@ function generateGeometry(objectType, numObjects) {
 			geom = new THREE.BoxGeometry( 1, 1, 1 );
 			scale.y = Math.random() * 200 + 100;
 			scale.z = Math.random() * 200 + 100;
-			color.setRGB( 0, 0, Math.random()+0.1 );
+			color.setRGB( 0, 0, Math.random() + 0.1 );
 		}
 		else if ( objectType == "sphere" )
 		{
 			geom = new THREE.IcosahedronGeometry( 1, 1 )
 			scale.y = scale.z = scale.x;
-			color.setRGB( Math.random()+0.1, 0, 0 );
+			color.setRGB( Math.random() + 0.1, 0, 0 );
 		}
 
 		// give the geom's vertices a random color, to be displayed
@@ -94,9 +94,9 @@ function Scene ( type, numObjects, cameraZ, fov, rotationSpeed, clearColor ) {
 
 	this.render = function( delta, rtt ) {
 
-		this.mesh.rotation.x += delta*this.rotationSpeed.x;
-		this.mesh.rotation.y += delta*this.rotationSpeed.y;
-		this.mesh.rotation.z += delta*this.rotationSpeed.z;
+		this.mesh.rotation.x += delta * this.rotationSpeed.x;
+		this.mesh.rotation.y += delta * this.rotationSpeed.y;
+		this.mesh.rotation.z += delta * this.rotationSpeed.z;
 
 		renderer.setClearColor( this.clearColor );
 

+ 12 - 12
examples/js/crossfade/transition.js

@@ -5,8 +5,8 @@ function Transition ( sceneA, sceneB ) {
 	this.cameraOrtho = new THREE.OrthographicCamera(window.innerWidth / -2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / -2, -10, 10);
 
 	this.textures = [];
-	for (var i=0;i<6;i++)
-		this.textures[i]=new THREE.ImageUtils.loadTexture('textures/transition/transition'+(i+1)+'.png');
+	for (var i = 0; i < 6; i ++)
+		this.textures[i] = new THREE.ImageUtils.loadTexture('textures/transition/transition' + (i + 1) + '.png');
 				
 	this.quadmaterial = new THREE.ShaderMaterial({
 
@@ -101,13 +101,13 @@ function Transition ( sceneA, sceneB ) {
 	
 	this.setTextureThreshold = function ( value ) {
 	
-		this.quadmaterial.uniforms.threshold.value=value;
+		this.quadmaterial.uniforms.threshold.value = value;
 
 	}
 	
 	this.useTexture = function ( value ) {
 	
-		this.quadmaterial.uniforms.useTexture.value = value?1:0;
+		this.quadmaterial.uniforms.useTexture.value = value ? 1 : 0;
 
 	}
 	
@@ -122,32 +122,32 @@ function Transition ( sceneA, sceneB ) {
 		// Transition animation
 		if (transitionParams.animateTransition)
 		{
-			var t=(1+Math.sin(transitionParams.transitionSpeed*clock.getElapsedTime()/Math.PI))/2;
-			transitionParams.transition=THREE.Math.smoothstep(t,0.3,0.7);
+			var t = (1 + Math.sin(transitionParams.transitionSpeed * clock.getElapsedTime() / Math.PI)) / 2;
+			transitionParams.transition = THREE.Math.smoothstep(t, 0.3, 0.7);
 			
 			// Change the current alpha texture after each transition
-			if (transitionParams.loopTexture && (transitionParams.transition==0 || transitionParams.transition==1))
+			if (transitionParams.loopTexture && (transitionParams.transition == 0 || transitionParams.transition == 1))
 			{
 				if (this.needChange)
 				{
-					transitionParams.texture=(transitionParams.texture+1)%this.textures.length;
+					transitionParams.texture = (transitionParams.texture + 1)%this.textures.length;
 					this.quadmaterial.uniforms.tMixTexture.value = this.textures[transitionParams.texture];
-					this.needChange=false;
+					this.needChange = false;
 				}
 			}	
 			else
-				this.needChange=true;
+				this.needChange = true;
 				
 		}
 		
 		this.quadmaterial.uniforms.mixRatio.value = transitionParams.transition;
 
 		// Prevent render both scenes when it's not necessary
-		if (transitionParams.transition==0) {
+		if (transitionParams.transition == 0) {
 			
 			this.sceneB.render( delta, false );
 		
-		} else if (transitionParams.transition==1) {
+		} else if (transitionParams.transition == 1) {
 		
 			this.sceneA.render( delta, false );
 			

+ 1 - 1
examples/js/curves/NURBSCurve.js

@@ -18,7 +18,7 @@ THREE.NURBSCurve = function ( degree, knots /* array of reals */, controlPoints
 	this.degree = degree;
 	this.knots = knots;
 	this.controlPoints = [];
-	for (var i = 0; i < controlPoints.length; ++i) { // ensure Vector4 for control points
+	for (var i = 0; i < controlPoints.length; ++ i) { // ensure Vector4 for control points
 		var point = controlPoints[i];
 		this.controlPoints[i] = new THREE.Vector4(point.x, point.y, point.z, point.w);
 	}

+ 2 - 2
examples/js/curves/NURBSSurface.js

@@ -23,9 +23,9 @@ THREE.NURBSSurface = function ( degree1, degree2, knots1, knots2 /* arrays of re
 	var len2 = knots2.length - degree2 - 1;
 
 	// ensure Vector4 for control points
-	for (var i = 0; i < len1; ++i) {
+	for (var i = 0; i < len1; ++ i) {
 		this.controlPoints[i] = []
-		for (var j = 0; j < len2; ++j) {
+		for (var j = 0; j < len2; ++ j) {
 			var point = controlPoints[i][j];
 			this.controlPoints[i][j] = new THREE.Vector4(point.x, point.y, point.z, point.w);
 		}

+ 29 - 29
examples/js/curves/NURBSUtils.js

@@ -68,14 +68,14 @@ THREE.NURBSUtils = {
 		var right = [];
 		N[0] = 1.0;
 
-		for (var j = 1; j <= p; ++j) {
+		for (var j = 1; j <= p; ++ j) {
 	   
 			left[j] = u - U[span + 1 - j];
 			right[j] = U[span + j] - u;
 
 			var saved = 0.0;
 
-			for (var r = 0; r < j; ++r) {
+			for (var r = 0; r < j; ++ r) {
 
 				var rv = right[r + 1];
 				var lv = left[j - r];
@@ -106,7 +106,7 @@ THREE.NURBSUtils = {
 		var N = this.calcBasisFunctions(span, u, p, U);
 		var C = new THREE.Vector4(0, 0, 0, 0);
 
-		for (var j = 0; j <= p; ++j) {
+		for (var j = 0; j <= p; ++ j) {
 			var point = P[span - p + j];
 			var Nj = N[j];
 			var wNj = point.w * Nj;
@@ -134,15 +134,15 @@ THREE.NURBSUtils = {
 	calcBasisFunctionDerivatives: function( span,  u,  p,  n,  U ) {
 
 		var zeroArr = [];
-		for (var i = 0; i <= p; ++i)
+		for (var i = 0; i <= p; ++ i)
 			zeroArr[i] = 0.0;
 
 		var ders = [];
-		for (var i = 0; i <= n; ++i)
+		for (var i = 0; i <= n; ++ i)
 			ders[i] = zeroArr.slice(0);
 
 		var ndu = [];
-		for (var i = 0; i <= p; ++i)
+		for (var i = 0; i <= p; ++ i)
 			ndu[i] = zeroArr.slice(0);
 
 		ndu[0][0] = 1.0;
@@ -150,13 +150,13 @@ THREE.NURBSUtils = {
 		var left = zeroArr.slice(0);
 		var right = zeroArr.slice(0);
 
-		for (var j = 1; j <= p; ++j) {
+		for (var j = 1; j <= p; ++ j) {
 			left[j] = u - U[span + 1 - j];
 			right[j] = U[span + j] - u;
 
 			var saved = 0.0;
 
-			for (var r = 0; r < j; ++r) {
+			for (var r = 0; r < j; ++ r) {
 				var rv = right[r + 1];
 				var lv = left[j - r];
 				ndu[j][r] = rv + lv;
@@ -169,21 +169,21 @@ THREE.NURBSUtils = {
 			ndu[j][j] = saved;
 		}
 
-		for (var j = 0; j <= p; ++j) {
+		for (var j = 0; j <= p; ++ j) {
 			ders[0][j] = ndu[j][p];
 		}
 
-		for (var r = 0; r <= p; ++r) {
+		for (var r = 0; r <= p; ++ r) {
 			var s1 = 0;
 			var s2 = 1;
 
 			var a = [];
-			for (var i = 0; i <= p; ++i) {
+			for (var i = 0; i <= p; ++ i) {
 				a[i] = zeroArr.slice(0);
 			}
 			a[0][0] = 1.0;
 
-			for (var k = 1; k <= n; ++k) {
+			for (var k = 1; k <= n; ++ k) {
 				var d = 0.0;
 				var rk = r - k;
 				var pk = p - k;
@@ -196,7 +196,7 @@ THREE.NURBSUtils = {
 				var j1 = (rk >= -1) ? 1 : -rk;
 				var j2 = (r - 1 <= pk) ? k - 1 :  p - r;
 
-				for (var j = j1; j <= j2; ++j) {
+				for (var j = j1; j <= j2; ++ j) {
 					a[s2][j] = (a[s1][j] - a[s1][j - 1]) / ndu[pk + 1][rk + j];
 					d += a[s2][j] * ndu[rk + j][pk];
 				}
@@ -216,8 +216,8 @@ THREE.NURBSUtils = {
 
 		var r = p;
 
-		for (var k = 1; k <= n; ++k) {
-			for (var j = 0; j <= p; ++j) {
+		for (var k = 1; k <= n; ++ k) {
+			for (var j = 0; j <= p; ++ j) {
 				ders[k][j] *= r;
 			}
 			r *= p - k;
@@ -245,7 +245,7 @@ THREE.NURBSUtils = {
 		var nders = this.calcBasisFunctionDerivatives(span, u, p, du, U);
 		var Pw = [];
 
-		for (var i = 0; i < P.length; ++i) {
+		for (var i = 0; i < P.length; ++ i) {
 			var point = P[i].clone();
 			var w = point.w;
 
@@ -255,17 +255,17 @@ THREE.NURBSUtils = {
 
 			Pw[i] = point;
 		}
-		for (var k = 0; k <= du; ++k) {
+		for (var k = 0; k <= du; ++ k) {
 			var point = Pw[span - p].clone().multiplyScalar(nders[k][0]);
 
-			for (var j = 1; j <= p; ++j) {
+			for (var j = 1; j <= p; ++ j) {
 				point.add(Pw[span - p + j].clone().multiplyScalar(nders[k][j]));
 			}
 
 			CK[k] = point;
 		}
 
-		for (var k = du + 1; k <= nd + 1; ++k) {
+		for (var k = du + 1; k <= nd + 1; ++ k) {
 			CK[k] = new THREE.Vector4(0, 0, 0);
 		}
 
@@ -281,17 +281,17 @@ THREE.NURBSUtils = {
 	calcKoverI: function( k, i ) {
 		var nom = 1;
 
-		for (var j = 2; j <= k; ++j) {
+		for (var j = 2; j <= k; ++ j) {
 			nom *= j;
 		}
 
 		var denom = 1;
 
-		for (var j = 2; j <= i; ++j) {
+		for (var j = 2; j <= i; ++ j) {
 			denom *= j;
 		}
 
-		for (var j = 2; j <= k - i; ++j) {
+		for (var j = 2; j <= k - i; ++ j) {
 			denom *= j;
 		}
 
@@ -311,7 +311,7 @@ THREE.NURBSUtils = {
 		var Aders = [];
 		var wders = [];
 
-		for (var i = 0; i < nd; ++i) {
+		for (var i = 0; i < nd; ++ i) {
 			var point = Pders[i];
 			Aders[i] = new THREE.Vector3(point.x, point.y, point.z);
 			wders[i] = point.w;
@@ -319,11 +319,11 @@ THREE.NURBSUtils = {
 
 		var CK = [];
 
-		for (var k = 0; k < nd; ++k) {
+		for (var k = 0; k < nd; ++ k) {
 			var v = Aders[k].clone();
 
-			for (var i = 1; i <= k; ++i) {
-				v.sub(CK[k - i].clone().multiplyScalar(this.calcKoverI(k,i) * wders[i]));
+			for (var i = 1; i <= k; ++ i) {
+				v.sub(CK[k - i].clone().multiplyScalar(this.calcKoverI(k, i) * wders[i]));
 			}
 
 			CK[k] = v.divideScalar(wders[0]);
@@ -367,9 +367,9 @@ THREE.NURBSUtils = {
 		var Nv = this.calcBasisFunctions(vspan, v, q, V);
 		var temp = [];
 
-		for (var l = 0; l <= q; ++l) {
+		for (var l = 0; l <= q; ++ l) {
 			temp[l] = new THREE.Vector4(0, 0, 0, 0);
-			for (var k = 0; k <= p; ++k) {
+			for (var k = 0; k <= p; ++ k) {
 				var point = P[uspan - p + k][vspan - q + l].clone();
 				var w = point.w;
 				point.x *= w;
@@ -380,7 +380,7 @@ THREE.NURBSUtils = {
 		}
 
 		var Sw = new THREE.Vector4(0, 0, 0, 0);
-		for (var l = 0; l <= q; ++l) {
+		for (var l = 0; l <= q; ++ l) {
 			Sw.add(temp[l].multiplyScalar(Nv[l]));
 		}
 

+ 13 - 13
examples/js/effects/AsciiEffect.js

@@ -96,8 +96,8 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 
 		var oStyle = oAscii.style;
 		oStyle.display = "inline";
-		oStyle.width = Math.round(iWidth/fResolution*iScale) + "px";
-		oStyle.height = Math.round(iHeight/fResolution*iScale) + "px";
+		oStyle.width = Math.round(iWidth / fResolution * iScale) + "px";
+		oStyle.height = Math.round(iHeight / fResolution * iScale) + "px";
 		oStyle.whiteSpace = "pre";
 		oStyle.margin = "0px";
 		oStyle.padding = "0px";
@@ -144,8 +144,8 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 
 	// Setup dom
 
-	var fFontSize = (2/fResolution)*iScale;
-	var fLineHeight = (2/fResolution)*iScale;
+	var fFontSize = (2 / fResolution) * iScale;
+	var fLineHeight = (2 / fResolution) * iScale;
 
 	// adjust letter-spacing for all combinations of scale and resolution to get it to fit the image width.
 
@@ -204,9 +204,9 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 
 		// console.time('rendering');
 
-		for (var y=0;y<iHeight;y+=2) {
-			for (var x=0;x<iWidth;x++) {
-				var iOffset = (y*iWidth + x) * 4;
+		for (var y = 0; y < iHeight; y+=2) {
+			for (var x = 0; x < iWidth; x ++) {
+				var iOffset = (y * iWidth + x) * 4;
 
 				var iRed = oImgData[iOffset];
 				var iGreen = oImgData[iOffset + 1];
@@ -216,7 +216,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 
 				var fBrightness;
 
-				fBrightness = (0.3*iRed + 0.59*iGreen + 0.11*iBlue) / 255;
+				fBrightness = (0.3 * iRed + 0.59 * iGreen + 0.11 * iBlue) / 255;
 				// fBrightness = (0.3*iRed + 0.5*iGreen + 0.3*iBlue) / 255;
 
 				if (iAlpha == 0) {
@@ -226,7 +226,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 
 				}
 
-				iCharIdx = Math.floor((1-fBrightness) * (aCharList.length-1));
+				iCharIdx = Math.floor((1 - fBrightness) * (aCharList.length - 1));
 
 				if (bInvert) {
 					iCharIdx = aCharList.length - iCharIdx - 1;
@@ -238,14 +238,14 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 
 				var strThisChar = aCharList[iCharIdx];
 
-				if (strThisChar===undefined || strThisChar == " ")
+				if (strThisChar === undefined || strThisChar == " ")
 					strThisChar = "&nbsp;";
 
 				if (bColor) {
 					strChars += "<span style='"
-						+ "color:rgb("+iRed+","+iGreen+","+iBlue+");"
-						+ (bBlock ? "background-color:rgb("+iRed+","+iGreen+","+iBlue+");" : "")
-						+ (bAlpha ? "opacity:" + (iAlpha/255) + ";" : "")
+						+ "color:rgb(" + iRed + "," + iGreen + "," + iBlue + ");"
+						+ (bBlock ? "background-color:rgb(" + iRed + "," + iGreen + "," + iBlue + ");" : "")
+						+ (bAlpha ? "opacity:" + (iAlpha / 255) + ";" : "")
 						+ "'>" + strThisChar + "</span>";
 				} else {
 					strChars += strThisChar;

+ 19 - 19
examples/js/effects/VREffect.js

@@ -43,7 +43,7 @@ THREE.VREffect = function ( renderer, done ) {
 		function gotVRDevices( devices ) {
 			var vrHMD;
 			var error;
-			for ( var i = 0; i < devices.length; ++i ) {
+			for ( var i = 0; i < devices.length; ++ i ) {
 				if ( devices[i] instanceof HMDVRDevice ) {
 					vrHMD = devices[i];
 					self._vrHMD = vrHMD;
@@ -155,7 +155,7 @@ THREE.VREffect = function ( renderer, done ) {
 		var vrHMD = this._vrHMD;
 		var canvas = renderer.domElement;
 		var fullScreenChange =
-			canvas.mozRequestFullScreen? 'mozfullscreenchange' : 'webkitfullscreenchange';
+			canvas.mozRequestFullScreen ? 'mozfullscreenchange' : 'webkitfullscreenchange';
 
 		document.addEventListener( fullScreenChange, onFullScreenChanged, false );
 		function onFullScreenChanged() {
@@ -175,7 +175,7 @@ THREE.VREffect = function ( renderer, done ) {
 		var pxoffset = (fov.leftTan - fov.rightTan) * pxscale * 0.5;
 		var pyscale = 2.0 / (fov.upTan + fov.downTan);
 		var pyoffset = (fov.upTan - fov.downTan) * pyscale * 0.5;
-		return { scale: [pxscale, pyscale], offset: [pxoffset, pyoffset] };
+		return { scale: [ pxscale, pyscale ], offset: [ pxoffset, pyoffset ] };
 	};
 
 	this.FovPortToProjection = function( fov, rightHanded /* = true */, zNear /* = 0.01 */, zFar /* = 10000.0 */ )
@@ -194,30 +194,30 @@ THREE.VREffect = function ( renderer, done ) {
 		var scaleAndOffset = this.FovToNDCScaleOffset(fov);
 
 		// X result, map clip edges to [-w,+w]
-		m[0*4+0] = scaleAndOffset.scale[0];
-		m[0*4+1] = 0.0;
-		m[0*4+2] = scaleAndOffset.offset[0] * handednessScale;
-		m[0*4+3] = 0.0;
+		m[0 * 4 + 0] = scaleAndOffset.scale[0];
+		m[0 * 4 + 1] = 0.0;
+		m[0 * 4 + 2] = scaleAndOffset.offset[0] * handednessScale;
+		m[0 * 4 + 3] = 0.0;
 
 		// Y result, map clip edges to [-w,+w]
 		// Y offset is negated because this proj matrix transforms from world coords with Y=up,
 		// but the NDC scaling has Y=down (thanks D3D?)
-		m[1*4+0] = 0.0;
-		m[1*4+1] = scaleAndOffset.scale[1];
-		m[1*4+2] = -scaleAndOffset.offset[1] * handednessScale;
-		m[1*4+3] = 0.0;
+		m[1 * 4 + 0] = 0.0;
+		m[1 * 4 + 1] = scaleAndOffset.scale[1];
+		m[1 * 4 + 2] = -scaleAndOffset.offset[1] * handednessScale;
+		m[1 * 4 + 3] = 0.0;
 
 		// Z result (up to the app)
-		m[2*4+0] = 0.0;
-		m[2*4+1] = 0.0;
-		m[2*4+2] = zFar / (zNear - zFar) * -handednessScale;
-		m[2*4+3] = (zFar * zNear) / (zNear - zFar);
+		m[2 * 4 + 0] = 0.0;
+		m[2 * 4 + 1] = 0.0;
+		m[2 * 4 + 2] = zFar / (zNear - zFar) * -handednessScale;
+		m[2 * 4 + 3] = (zFar * zNear) / (zNear - zFar);
 
 		// W result (= Z in)
-		m[3*4+0] = 0.0;
-		m[3*4+1] = 0.0;
-		m[3*4+2] = handednessScale;
-		m[3*4+3] = 0.0;
+		m[3 * 4 + 0] = 0.0;
+		m[3 * 4 + 1] = 0.0;
+		m[3 * 4 + 2] = handednessScale;
+		m[3 * 4 + 3] = 0.0;
 
 		mobj.transpose();
 

+ 1 - 1
examples/js/exporters/SceneExporter.js

@@ -182,7 +182,7 @@ THREE.SceneExporter.prototype = {
 
 		function NumConstantString( c ) {
 
-			var constants = [ "NearestFilter", "NearestMipMapNearestFilter" , "NearestMipMapLinearFilter",
+			var constants = [ "NearestFilter", "NearestMipMapNearestFilter", "NearestMipMapLinearFilter",
 							  "LinearFilter", "LinearMipMapNearestFilter", "LinearMipMapLinearFilter" ];
 
 			for ( var i = 0; i < constants.length; i ++ ) {

+ 10 - 10
examples/js/geometries/ConvexGeometry.js

@@ -23,7 +23,7 @@ THREE.ConvexGeometry = function( vertices ) {
 
 	var faces = [ [ 0, 1, 2 ], [ 0, 2, 1 ] ]; 
 
-	for ( var i = 3; i < vertices.length; i++ ) {
+	for ( var i = 3; i < vertices.length; i ++ ) {
 
 		addPoint( i );
 
@@ -49,13 +49,13 @@ THREE.ConvexGeometry = function( vertices ) {
 			// then we try to add the face's edges into the hole.
 			if ( visible( face, vertex ) ) {
 
-				for ( var e = 0; e < 3; e++ ) {
+				for ( var e = 0; e < 3; e ++ ) {
 
 					var edge = [ face[ e ], face[ ( e + 1 ) % 3 ] ];
 					var boundary = true;
 
 					// remove duplicated edges.
-					for ( var h = 0; h < hole.length; h++ ) {
+					for ( var h = 0; h < hole.length; h ++ ) {
 
 						if ( equalEdge( hole[ h ], edge ) ) {
 
@@ -82,13 +82,13 @@ THREE.ConvexGeometry = function( vertices ) {
 
 			} else { // not visible
 
-				f++;
+				f ++;
 
 			}
 		}
 
 		// construct the new faces formed by the edges of the hole and the vertex
-		for ( var h = 0; h < hole.length; h++ ) {
+		for ( var h = 0; h < hole.length; h ++ ) {
 
 			faces.push( [ 
 				hole[ h ][ 0 ],
@@ -170,15 +170,15 @@ THREE.ConvexGeometry = function( vertices ) {
 	var id = 0;
 	var newId = new Array( vertices.length ); // map from old vertex id to new id
 
-	for ( var i = 0; i < faces.length; i++ ) {
+	for ( var i = 0; i < faces.length; i ++ ) {
 
 		 var face = faces[ i ];
 
-		 for ( var j = 0; j < 3; j++ ) {
+		 for ( var j = 0; j < 3; j ++ ) {
 
 				if ( newId[ face[ j ] ] === undefined ) {
 
-						newId[ face[ j ] ] = id++;
+						newId[ face[ j ] ] = id ++;
 						this.vertices.push( vertices[ face[ j ] ] );
 
 				}
@@ -190,7 +190,7 @@ THREE.ConvexGeometry = function( vertices ) {
 	}
 
 	// Convert faces into instances of THREE.Face3
-	for ( var i = 0; i < faces.length; i++ ) {
+	for ( var i = 0; i < faces.length; i ++ ) {
 
 		this.faces.push( new THREE.Face3( 
 				faces[ i ][ 0 ],
@@ -201,7 +201,7 @@ THREE.ConvexGeometry = function( vertices ) {
 	}
 
 	// Compute UVs
-	for ( var i = 0; i < this.faces.length; i++ ) {
+	for ( var i = 0; i < this.faces.length; i ++ ) {
 
 		var face = this.faces[ i ];
 

+ 21 - 21
examples/js/geometries/DecalGeometry.js

@@ -15,7 +15,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
 	THREE.Geometry.call( this );
 
-	if( check === undefined ) check = null;
+	if ( check === undefined ) check = null;
 	check = check || new THREE.Vector3( 1, 1, 1 );
 
 	this.uvs = [];
@@ -60,10 +60,10 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
 		}
 
-		if( inVertices.length === 0 ) return [];
+		if ( inVertices.length === 0 ) return [];
 		var outVertices = [];
 
-		for( var j = 0; j < inVertices.length; j += 3 ) {
+		for ( var j = 0; j < inVertices.length; j += 3 ) {
 
 			var v1Out, v2Out, v3Out, total = 0;
 
@@ -75,24 +75,24 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 			v2Out = d2 > 0;
 			v3Out = d3 > 0;
 
-			total = ( v1Out?1:0 ) + ( v2Out?1:0 ) + ( v3Out?1:0 );
+			total = ( v1Out ? 1 : 0 ) + ( v2Out ? 1 : 0 ) + ( v3Out ? 1 : 0 );
 
-			switch( total ) {
-				case 0:{
+			switch ( total ) {
+				case 0: {
 					outVertices.push( inVertices[ j ] );
 					outVertices.push( inVertices[ j + 1 ] );
 					outVertices.push( inVertices[ j + 2 ] );
 					break;
 				}
-				case 1:{
+				case 1: {
 					var nV1, nV2, nV3;
-					if( v1Out ) {
+					if ( v1Out ) {
 						nV1 = inVertices[ j + 1 ]; 
 						nV2 = inVertices[ j + 2 ];
 						nV3 = clip( inVertices[ j ], nV1, plane );
 						nV4 = clip( inVertices[ j ], nV2, plane );
 					}
-					if( v2Out ) { 
+					if ( v2Out ) { 
 						nV1 = inVertices[ j ]; 
 						nV2 = inVertices[ j + 2 ];
 						nV3 = clip( inVertices[ j + 1 ], nV1, plane );
@@ -107,7 +107,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 						outVertices.push( nV4 );
 						break;
 					}
-					if( v3Out ) { 
+					if ( v3Out ) { 
 						nV1 = inVertices[ j ]; 
 						nV2 = inVertices[ j + 1 ];
 						nV3 = clip( inVertices[ j + 2 ], nV1, plane );
@@ -126,7 +126,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 				}
 				case 2: {
 					var nV1, nV2, nV3;
-					if( !v1Out ) { 
+					if ( !v1Out ) { 
 						nV1 = inVertices[ j ].clone();
 						nV2 = clip( nV1, inVertices[ j + 1 ], plane );
 						nV3 = clip( nV1, inVertices[ j + 2 ], plane ); 
@@ -134,7 +134,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 						outVertices.push( nV2 );
 						outVertices.push( nV3 );
 					}
-					if( !v2Out ) { 
+					if ( !v2Out ) { 
 						nV1 = inVertices[ j + 1 ].clone();
 						nV2 = clip( nV1, inVertices[ j + 2 ], plane );
 						nV3 = clip( nV1, inVertices[ j ], plane );
@@ -142,7 +142,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 						outVertices.push( nV2 );
 						outVertices.push( nV3 );
 					}
-					if( !v3Out ) {
+					if ( !v3Out ) {
 						nV1 = inVertices[ j + 2 ].clone();
 						nV2 = clip( nV1, inVertices[ j ], plane );
 						nV3 = clip( nV1, inVertices[ j + 1 ], plane );
@@ -164,7 +164,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
 	}
 
-	this.pushVertex = function( vertices, id, n ){
+	this.pushVertex = function( vertices, id, n ) {
 
 		var v = mesh.geometry.vertices[ id ].clone();
 		v.applyMatrix4( mesh.matrix );
@@ -177,7 +177,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
 		var finalVertices = [];
 
-		for( var i = 0; i < mesh.geometry.faces.length; i++ ) {
+		for ( var i = 0; i < mesh.geometry.faces.length; i ++ ) {
 
 			var f = mesh.geometry.faces[ i ];
 			var vertices = [];
@@ -186,20 +186,20 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 			this.pushVertex( vertices, f[ this.faceIndices[ 1 ] ], f.vertexNormals[ 1 ] );
 			this.pushVertex( vertices, f[ this.faceIndices[ 2 ] ], f.vertexNormals[ 2 ] );
 
-			if( check.x ) {
+			if ( check.x ) {
 				vertices = this.clipFace( vertices, new THREE.Vector3( 1, 0, 0 ) );
 				vertices = this.clipFace( vertices, new THREE.Vector3( -1, 0, 0 ) );
 			}
-			if( check.y ) {
+			if ( check.y ) {
 			   	vertices = this.clipFace( vertices, new THREE.Vector3( 0, 1, 0 ) );
 			   	vertices = this.clipFace( vertices, new THREE.Vector3( 0, -1, 0 ) );
 			}
-			if( check.z ) {
+			if ( check.z ) {
 				vertices = this.clipFace( vertices, new THREE.Vector3( 0, 0, 1 ) );
 				vertices = this.clipFace( vertices, new THREE.Vector3( 0, 0, -1 ) );
 			}
 
-			for( var j = 0; j < vertices.length; j++ ) {
+			for ( var j = 0; j < vertices.length; j ++ ) {
 
 				var v = vertices[ j ];
 
@@ -212,13 +212,13 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
 			}
 
-			if( vertices.length === 0 ) continue;
+			if ( vertices.length === 0 ) continue;
 
 			finalVertices = finalVertices.concat( vertices );
 
 		}
 
-		for( var k = 0; k < finalVertices.length; k += 3 ) {
+		for ( var k = 0; k < finalVertices.length; k += 3 ) {
 			
 			this.vertices.push(
 				finalVertices[ k ].vertex,

+ 1 - 1
examples/js/geometries/hilbert2D.js

@@ -42,7 +42,7 @@ function hilbert2D (center, size, iterations, v0, v1, v2, v3) {
 	];
 
 	// Recurse iterations
-	if (0 <= --iterations) {
+	if (0 <= -- iterations) {
 		var tmp = [];
 
 		Array.prototype.push.apply( tmp, hilbert2D ( vec[ 0 ], half, iterations, v0, v3, v2, v1 ) );

+ 1 - 1
examples/js/geometries/hilbert3D.js

@@ -63,7 +63,7 @@ function hilbert3D(center, size, iterations, v0, v1, v2, v3, v4, v5, v6, v7) {
 	];
 
 	// Recurse iterations
-	if( --iterations >= 0 ) {
+	if ( -- iterations >= 0 ) {
 		var tmp = [];
 
 		Array.prototype.push.apply( tmp, hilbert3D ( vec[ 0 ], half, iterations, v0, v3, v4, v7, v6, v5, v2, v1 ) );

+ 58 - 58
examples/js/loaders/AWDLoader.js

@@ -3,7 +3,7 @@
  * Date: 09/12/2013 17:21
  */
 
-THREE.AWDLoader = (function (){
+THREE.AWDLoader = (function () {
 
 
 
@@ -51,9 +51,9 @@ THREE.AWDLoader = (function (){
   // ResourcesLoader
   // =============
   // handle loading for external resources
-  function ResourcesLoader( awdUrl ){
+  function ResourcesLoader( awdUrl ) {
 
-    this._baseDir = awdUrl.substr( 0, awdUrl.lastIndexOf( '/' )+1 );
+    this._baseDir = awdUrl.substr( 0, awdUrl.lastIndexOf( '/' ) + 1 );
 
     this._loadingManager = new THREE.LoadingManager();
 
@@ -61,12 +61,12 @@ THREE.AWDLoader = (function (){
 
   ResourcesLoader.prototype = {
 
-    loadTexture : function( path ){
+    loadTexture : function( path ) {
       var tex = new THREE.Texture();
 
       var loader = new THREE.ImageLoader( this._loadingManager );
 
-      loader.load( this._baseDir+path, function( image ) {
+      loader.load( this._baseDir + path, function( image ) {
         tex.image = image;
         tex.needsUpdate = true;
       });
@@ -78,7 +78,7 @@ THREE.AWDLoader = (function (){
 
 
 
-  function Block(){
+  function Block() {
     this.id = 0;
     this.data = null;
   }
@@ -158,12 +158,12 @@ THREE.AWDLoader = (function (){
 
     this._parseHeader( );
 
-    if( this._compression != 0  ) {
+    if ( this._compression != 0  ) {
       console.error( 'compressed AWD not supported' );
     }
 
     if (!this._streaming && this._bodylen != data.byteLength - this._ptr ) {
-      console.error('AWDLoader: body len does not match file length', this._bodylen ,  blen - this._ptr);
+      console.error('AWDLoader: body len does not match file length', this._bodylen,  blen - this._ptr);
     }
 
     while ( this._ptr < blen ) {
@@ -251,7 +251,7 @@ THREE.AWDLoader = (function (){
         |   ( this.readU8()<<8 )
         |     this.readU8();
 
-    if( awdmagic != 4282180 )
+    if ( awdmagic != 4282180 )
       throw new Error( "AWDLoader - bad magic" );
 
     version[0] = this.readU8();
@@ -328,7 +328,7 @@ THREE.AWDLoader = (function (){
     materials = [];
     materials_parsed = 0;
 
-    for ( i = 0; i < num_materials; i++) {
+    for ( i = 0; i < num_materials; i ++) {
       mat_id = this.readU32();
       mat = this.getBlock( mat_id );
       materials.push( mat );
@@ -341,9 +341,9 @@ THREE.AWDLoader = (function (){
 
     // TODO : BufferGeometry don't support "geometryGroups" for now.
     // so we create sub meshes for each groups
-    if( meshLen  > 1 ) {
+    if ( meshLen  > 1 ) {
       mesh = new THREE.Object3D()
-      for ( i = 0; i < meshLen; i++) {
+      for ( i = 0; i < meshLen; i ++) {
         var sm = new THREE.Mesh( geometries[i] );
         meshes.push( sm );
         mesh.add( sm );
@@ -364,7 +364,7 @@ THREE.AWDLoader = (function (){
 
     var matLen = materials.length;
     var maxLen = Math.max( meshLen, matLen);
-    for( i = 0; i< maxLen; i++ )
+    for ( i = 0; i < maxLen; i ++ )
       meshes[ i%meshLen ].material = materials[ i % matLen ];
 
 
@@ -405,7 +405,7 @@ THREE.AWDLoader = (function (){
 
     methods_parsed = 0;
 
-    while( methods_parsed < num_methods ) {
+    while ( methods_parsed < num_methods ) {
       var method_type = this.readU16();
       this.parseProperties( null );
       this.parseUserAttributes();
@@ -413,9 +413,9 @@ THREE.AWDLoader = (function (){
 
     attributes = this.parseUserAttributes();
 
-    if( this.materialFactory !== undefined ) {
+    if ( this.materialFactory !== undefined ) {
       mat = this.materialFactory( name );
-      if( mat ) return mat;
+      if ( mat ) return mat;
     }
 
     mat = new THREE.MeshPhongMaterial();
@@ -466,7 +466,7 @@ THREE.AWDLoader = (function (){
 
   AWDLoader.prototype.loadTexture = function( url ) {
 
-    if( null === this._resourceLoader )
+    if ( null === this._resourceLoader )
       this._resourceLoader = new ResourcesLoader( this._url );
 
     return this._resourceLoader.loadTexture( url );
@@ -500,7 +500,7 @@ THREE.AWDLoader = (function (){
       this.parseUserAttributes();
 
       skeleton.push(joint);
-      joints_parsed++;
+      joints_parsed ++;
     }
 
     // Discard attributes for now
@@ -542,7 +542,7 @@ THREE.AWDLoader = (function (){
         mtx_data = new THREE.Matrix4();
       }
       pose[joints_parsed] = mtx_data;
-      joints_parsed++;
+      joints_parsed ++;
     }
     // Skip attributes for now
     this.parseUserAttributes();
@@ -580,7 +580,7 @@ THREE.AWDLoader = (function (){
         duration : frame_dur
       } );
 
-      frames_parsed++;
+      frames_parsed ++;
     }
     if (clip.length == 0) {
       // debug("Could not this SkeletonClipNode, because no Frames where set.");
@@ -598,14 +598,14 @@ THREE.AWDLoader = (function (){
     var poseBlockAdress,
         name           = this.readUTF(),
         num_frames     = this.readU16(),
-        props          = this.parseProperties({1:UINT16}),
+        props          = this.parseProperties({ 1:UINT16 }),
         frames_parsed  = 0,
         skeletonFrames = [];
 
     while (frames_parsed < num_frames) {
       poseBlockAdress = this.readU32();
       skeletonFrames.push(this._blocks[poseBlockAdress].data);
-      frames_parsed++;
+      frames_parsed ++;
     }
 
     this.parseUserAttributes();
@@ -626,14 +626,14 @@ THREE.AWDLoader = (function (){
     var name = this.readUTF();
     var type = this.readU16();
 
-    var props = this.parseProperties({1:BADDR});
+    var props = this.parseProperties({ 1:BADDR });
 
     animSetBlockAdress = this.readU32();
     var targetMeshLength = this.readU16();
 
     var meshAdresses = []; //:Vector.<uint> = new Vector.<uint>;
 
-    for (var i = 0; i < targetMeshLength; i++)
+    for (var i = 0; i < targetMeshLength; i ++)
       meshAdresses.push( this.readU32() );
 
     var activeState = this.readU16();
@@ -644,7 +644,7 @@ THREE.AWDLoader = (function (){
     var returnedArray;
     var targetMeshes = []; //:Vector.<Mesh> = new Vector.<Mesh>;
 
-    for (i = 0; i < meshAdresses.length; i++) {
+    for (i = 0; i < meshAdresses.length; i ++) {
 //      returnedArray = getAssetByID(meshAdresses[i], [AssetType.MESH]);
 //      if (returnedArray[0])
         targetMeshes.push(this._blocks[meshAdresses[i]].data);
@@ -666,7 +666,7 @@ THREE.AWDLoader = (function (){
     }
 
 
-    for (i = 0; i < targetMeshes.length; i++) {
+    for (i = 0; i < targetMeshes.length; i ++) {
         targetMeshes[i].animator = thisAnimator;
     }
     // debug("Parsed a Animator: Name = " + name);
@@ -716,7 +716,7 @@ THREE.AWDLoader = (function (){
 
 
       // Ignore for now
-      this.parseProperties({1:this._geoNrType, 2:this._geoNrType});
+      this.parseProperties({ 1:this._geoNrType, 2:this._geoNrType });
 
       // Loop through data streams
       while ( this._ptr < sm_end ) {
@@ -744,8 +744,8 @@ THREE.AWDLoader = (function (){
 
           while (this._ptr < str_end) {
             buffer[idx]   = -this.readF32();
-            buffer[idx+1] = this.readF32();
-            buffer[idx+2] = this.readF32();
+            buffer[idx + 1] = this.readF32();
+            buffer[idx + 2] = this.readF32();
             idx+=3;
           }
         }
@@ -762,15 +762,15 @@ THREE.AWDLoader = (function (){
           geom.offsets.push({
             start: 0,
             index: 0,
-            count: str_len/2
+            count: str_len / 2
           });
 
           idx = 0;
 
           while (this._ptr < str_end) {
-            buffer[idx+1]   = this.readU16();
+            buffer[idx + 1]   = this.readU16();
             buffer[idx]     = this.readU16();
-            buffer[idx+2]   = this.readU16();
+            buffer[idx + 2]   = this.readU16();
             idx+=3;
           }
         }
@@ -787,7 +787,7 @@ THREE.AWDLoader = (function (){
 
           while (this._ptr < str_end) {
             buffer[idx]   = this.readF32();
-            buffer[idx+1] = 1.0-this.readF32();
+            buffer[idx + 1] = 1.0 - this.readF32();
             idx+=2;
           }
         }
@@ -802,8 +802,8 @@ THREE.AWDLoader = (function (){
 
           while (this._ptr < str_end) {
             buffer[idx]   = -this.readF32();
-            buffer[idx+1] = this.readF32();
-            buffer[idx+2] = this.readF32();
+            buffer[idx + 1] = this.readF32();
+            buffer[idx + 2] = this.readF32();
             idx+=3;
           }
 
@@ -840,7 +840,7 @@ THREE.AWDLoader = (function (){
 
 
       geom.computeBoundingSphere();
-      subs_parsed++;
+      subs_parsed ++;
     }
 
 
@@ -903,9 +903,9 @@ THREE.AWDLoader = (function (){
     streamsParsed = 0;
     while (streamsParsed < num_Streams) {
       streamtypes.push(this.readU16());
-      streamsParsed++;
+      streamsParsed ++;
     }
-    props = this.parseProperties({1:BOOL, 2:BOOL});
+    props = this.parseProperties({ 1:BOOL, 2:BOOL });
 
     clip.looping = props.get(1, true);
     clip.stitchFinalFrame = props.get(2, false);
@@ -928,7 +928,7 @@ THREE.AWDLoader = (function (){
           if (streamtypes[streamsParsed] == 1) {
 
             //geom.addAttribute( 'morphTarget'+frames_parsed, Float32Array, str_len/12, 3 );
-            var buffer = new Float32Array(str_len/4);
+            var buffer = new Float32Array(str_len / 4);
             geom.morphTargets.push( {
               array : buffer
             });
@@ -938,21 +938,21 @@ THREE.AWDLoader = (function (){
 
             while ( this._ptr < str_end ) {
               buffer[idx]     = this.readF32();
-              buffer[idx+1]   = this.readF32();
-              buffer[idx+2]   = this.readF32();
+              buffer[idx + 1]   = this.readF32();
+              buffer[idx + 2]   = this.readF32();
               idx += 3;
             }
 
 
-            subMeshParsed++;
+            subMeshParsed ++;
           } else
             this._ptr = str_end;
-          streamsParsed++;
+          streamsParsed ++;
         }
       }
 
 
-      frames_parsed++;
+      frames_parsed ++;
     }
     this.parseUserAttributes();
 
@@ -1009,15 +1009,15 @@ THREE.AWDLoader = (function (){
 
     var props = new AWDProperties();
 
-    if( expected ) {
+    if ( expected ) {
 
-      while( this._ptr < list_end ) {
+      while ( this._ptr < list_end ) {
 
         var key = this.readU16();
         var len = this.readU32();
         var type;
 
-        if( expected.hasOwnProperty( key ) ) {
+        if ( expected.hasOwnProperty( key ) ) {
           type = expected[ key ];
           props.set( key, this.parseAttrValue( type, len ) );
         } else {
@@ -1102,7 +1102,7 @@ THREE.AWDLoader = (function (){
 
       while (num_read < num_elems) {
         list.push(read_func.call( this ) );
-        num_read++;
+        num_read ++;
       }
 
       return list;
@@ -1115,10 +1115,10 @@ THREE.AWDLoader = (function (){
 
 
   AWDLoader.prototype.readU8 = function () {
-    return this._data.getUint8( this._ptr++ );
+    return this._data.getUint8( this._ptr ++ );
   }
   AWDLoader.prototype.readI8 = function () {
-    return this._data.getInt8( this._ptr++ );
+    return this._data.getInt8( this._ptr ++ );
   }
 
   AWDLoader.prototype.readU16 = function () {
@@ -1178,16 +1178,16 @@ THREE.AWDLoader = (function (){
     var out = [], c = 0;
 
     while ( out.length < len ) {
-      var c1 = this._data.getUint8( this._ptr++, littleEndian );
+      var c1 = this._data.getUint8( this._ptr ++, littleEndian );
       if (c1 < 128) {
-        out[c++] = String.fromCharCode(c1);
+        out[c ++] = String.fromCharCode(c1);
       } else if (c1 > 191 && c1 < 224) {
-        var c2 = this._data.getUint8( this._ptr++, littleEndian );
-        out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);
+        var c2 = this._data.getUint8( this._ptr ++, littleEndian );
+        out[c ++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);
       } else {
-        var c2 = this._data.getUint8( this._ptr++, littleEndian );
-        var c3 = this._data.getUint8( this._ptr++, littleEndian );
-        out[c++] = String.fromCharCode(
+        var c2 = this._data.getUint8( this._ptr ++, littleEndian );
+        var c3 = this._data.getUint8( this._ptr ++, littleEndian );
+        out[c ++] = String.fromCharCode(
             (c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63
         );
       }
@@ -1203,7 +1203,7 @@ THREE.AWDLoader = (function (){
 
 
 
-  AWDProperties = function(){}
+  AWDProperties = function() {}
 
   AWDProperties.prototype = {
 

+ 27 - 27
examples/js/loaders/AssimpJSONLoader.js

@@ -74,7 +74,7 @@ THREE.AssimpJSONLoader.prototype = {
 
 	parseList : function(json, handler) {
 		var meshes = new Array(json.length);
-		for(var i = 0; i < json.length; ++i) {
+		for (var i = 0; i < json.length; ++ i) {
 			meshes[i] = handler.call(this, json[i]);
 		}
 		return meshes;
@@ -87,13 +87,13 @@ THREE.AssimpJSONLoader.prototype = {
 		geometry = new THREE.Geometry();
 
 		// read vertex positions
-		for(in_data = json.vertices, i = 0, e = in_data.length; i < e; ) {
-			geometry.vertices.push( new THREE.Vector3( in_data[ i++ ], in_data[ i++ ], in_data[ i++ ] ) );
+		for (in_data = json.vertices, i = 0, e = in_data.length; i < e; ) {
+			geometry.vertices.push( new THREE.Vector3( in_data[ i ++ ], in_data[ i ++ ], in_data[ i ++ ] ) );
 		}
 
 		// read faces
 		var cnt = 0;
-		for(in_data = json.faces, i = 0, e = in_data.length; i < e; ++i) {
+		for (in_data = json.faces, i = 0, e = in_data.length; i < e; ++ i) {
 			face = new THREE.Face3();
 			src = in_data[i];
 			face.a = src[0];
@@ -106,12 +106,12 @@ THREE.AssimpJSONLoader.prototype = {
 
 		// read texture coordinates - three.js attaches them to its faces
 		json.texturecoords = json.texturecoords || [];
-		for(i = 0, e = json.texturecoords.length; i < e; ++i) {
+		for (i = 0, e = json.texturecoords.length; i < e; ++ i) {
 
 			function convertTextureCoords(in_uv, out_faces, out_vertex_uvs) {
 				var i, e, face, a, b, c;
 
-				for(i = 0, e = out_faces.length; i < e; ++i) {
+				for (i = 0, e = out_faces.length; i < e; ++ i) {
 					face = out_faces[i];
 					a = face.a * 2;
 					b = face.b * 2;
@@ -128,12 +128,12 @@ THREE.AssimpJSONLoader.prototype = {
 		}
 
 		// read normals - three.js also attaches them to its faces
-		if(json.normals) {
+		if (json.normals) {
 
 			function convertNormals(in_nor, out_faces) {
 				var i, e, face, a, b, c;
 
-				for(i = 0, e = out_faces.length; i < e; ++i) {
+				for (i = 0, e = out_faces.length; i < e; ++ i) {
 					face = out_faces[i];
 					a = face.a * 3;
 					b = face.b * 3;
@@ -150,7 +150,7 @@ THREE.AssimpJSONLoader.prototype = {
 		}
 
 		// read vertex colors - three.js also attaches them to its faces
-		if(json.colors && json.colors[0]) {
+		if (json.colors && json.colors[0]) {
 
 			function convertColors(in_color, out_faces) {
 				var i, e, face, a, b, c;
@@ -162,7 +162,7 @@ THREE.AssimpJSONLoader.prototype = {
 					return col;
 				}
 
-				for(i = 0, e = out_faces.length; i < e; ++i) {
+				for (i = 0, e = out_faces.length; i < e; ++ i) {
 					face = out_faces[i];
 					a = face.a * 4;
 					b = face.b * 4;
@@ -198,7 +198,7 @@ THREE.AssimpJSONLoader.prototype = {
 
 		function toColor(value_arr) {
 			var col = new THREE.Color();
-			col.setRGB(value_arr[0],value_arr[1],value_arr[2]);
+			col.setRGB(value_arr[0], value_arr[1], value_arr[2]);
 			return col;
 		}
 
@@ -212,28 +212,28 @@ THREE.AssimpJSONLoader.prototype = {
 		for (var i in json.properties) {
 			prop = json.properties[i];
 
-			if(prop.key === '$tex.file') {
+			if (prop.key === '$tex.file') {
 				// prop.semantic gives the type of the texture
 				// 1: diffuse
 				// 2: specular mao
 				// 5: height map (bumps)
 				// 6: normal map
 				// more values (i.e. emissive, environment) are known by assimp and may be relevant
-				if(prop.semantic === 1 || prop.semantic === 5 || prop.semantic === 6 || prop.semantic === 2) {
+				if (prop.semantic === 1 || prop.semantic === 5 || prop.semantic === 6 || prop.semantic === 2) {
 					(function(semantic) {
 						var loader = new THREE.TextureLoader(scope.manager),
 						keyname;
 
-						if(semantic === 1) {
+						if (semantic === 1) {
 							keyname = 'map';
 						}
-						else if(semantic === 5) {
+						else if (semantic === 5) {
 							keyname = 'bumpMap';
 						}
-						else if(semantic === 6) {
+						else if (semantic === 6) {
 							keyname = 'normalMap';
 						}
-						else if(semantic === 2) {
+						else if (semantic === 2) {
 							keyname = 'specularMap';
 						}
 
@@ -243,7 +243,7 @@ THREE.AssimpJSONLoader.prototype = {
 						var material_url = scope.texturePath + '/' + prop.value
 						material_url = material_url.replace(/\\/g, '/');
 						loader.load(material_url, function(tex) {
-							if(tex) {
+							if (tex) {
 								// TODO: read texture settings from assimp.
 								// Wrapping is the default, though.
 								tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
@@ -255,19 +255,19 @@ THREE.AssimpJSONLoader.prototype = {
 					})(prop.semantic);
 				}
 			}
-			else if(prop.key === '?mat.name') {
+			else if (prop.key === '?mat.name') {
 				init_props.name = prop.value;
 			}
-			else if(prop.key === '$clr.diffuse') {
+			else if (prop.key === '$clr.diffuse') {
 				init_props.color = toColor(prop.value);
 			}
-			else if(prop.key === '$clr.specular') {
+			else if (prop.key === '$clr.specular') {
 				init_props.specular = toColor(prop.value);
 			}
-			else if(prop.key === '$clr.emissive') {
+			else if (prop.key === '$clr.emissive') {
 				init_props.emissive = toColor(prop.value);
 			}
-			else if(prop.key === '$mat.shadingm') {
+			else if (prop.key === '$mat.shadingm') {
 				// aiShadingMode_Flat
 				if (prop.value === 1) {
 					init_props.shading = THREE.FlatShading;
@@ -281,8 +281,8 @@ THREE.AssimpJSONLoader.prototype = {
 		// note: three.js does not like it when a texture is added after the geometry
 		// has been rendered once, see http://stackoverflow.com/questions/16531759/.
 		// for this reason we fill all slots upfront with default textures
-		if(has_textures.length) {
-			for(i = has_textures.length-1; i >= 0; --i) {
+		if (has_textures.length) {
+			for (i = has_textures.length - 1; i >= 0; -- i) {
 				init_props[has_textures[i]] = defaultTexture();
 			}
 		}
@@ -301,12 +301,12 @@ THREE.AssimpJSONLoader.prototype = {
 		obj.matrix = new THREE.Matrix4().fromArray(node.transformation).transpose();
 		obj.matrix.decompose( obj.position, obj.quaternion, obj.scale );
 
-		for(i = 0; node.meshes && i < node.meshes.length; ++i) {
+		for (i = 0; node.meshes && i < node.meshes.length; ++ i) {
 			idx = node.meshes[i];
 			obj.add(new THREE.Mesh( meshes[idx], materials[json.meshes[idx].materialindex] ));
 		}
 
-		for(i = 0; node.children && i < node.children.length; ++i) {
+		for (i = 0; node.children && i < node.children.length; ++ i) {
 			obj.add(this.parseObject(json, node.children[i], meshes, materials));
 		}
 

+ 56 - 56
examples/js/loaders/BinaryLoader.js

@@ -192,7 +192,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 		start_quad_flat     = start_tri_smooth_uv + len_tri_smooth_uv  + handlePadding( md.ntri_smooth_uv * 2 );
 		start_quad_smooth   = start_quad_flat     + len_quad_flat	   + handlePadding( md.nquad_flat * 2 );
 		start_quad_flat_uv  = start_quad_smooth   + len_quad_smooth    + handlePadding( md.nquad_smooth * 2 );
-		start_quad_smooth_uv= start_quad_flat_uv  + len_quad_flat_uv   + handlePadding( md.nquad_flat_uv * 2 );
+		start_quad_smooth_uv = start_quad_flat_uv  + len_quad_flat_uv   + handlePadding( md.nquad_flat_uv * 2 );
 
 		// have to first process faces with uvs
 		// so that face and uv indices match
@@ -236,18 +236,18 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 				'material_index_bytes'    :parseUChar8( data, offset + 19 ),
 
 				'nvertices'    :parseUInt32( data, offset + 20 ),
-				'nnormals'     :parseUInt32( data, offset + 20 + 4*1 ),
-				'nuvs'         :parseUInt32( data, offset + 20 + 4*2 ),
+				'nnormals'     :parseUInt32( data, offset + 20 + 4 * 1 ),
+				'nuvs'         :parseUInt32( data, offset + 20 + 4 * 2 ),
 
-				'ntri_flat'      :parseUInt32( data, offset + 20 + 4*3 ),
-				'ntri_smooth'    :parseUInt32( data, offset + 20 + 4*4 ),
-				'ntri_flat_uv'   :parseUInt32( data, offset + 20 + 4*5 ),
-				'ntri_smooth_uv' :parseUInt32( data, offset + 20 + 4*6 ),
+				'ntri_flat'      :parseUInt32( data, offset + 20 + 4 * 3 ),
+				'ntri_smooth'    :parseUInt32( data, offset + 20 + 4 * 4 ),
+				'ntri_flat_uv'   :parseUInt32( data, offset + 20 + 4 * 5 ),
+				'ntri_smooth_uv' :parseUInt32( data, offset + 20 + 4 * 6 ),
 
-				'nquad_flat'      :parseUInt32( data, offset + 20 + 4*7 ),
-				'nquad_smooth'    :parseUInt32( data, offset + 20 + 4*8 ),
-				'nquad_flat_uv'   :parseUInt32( data, offset + 20 + 4*9 ),
-				'nquad_smooth_uv' :parseUInt32( data, offset + 20 + 4*10 )
+				'nquad_flat'      :parseUInt32( data, offset + 20 + 4 * 7 ),
+				'nquad_smooth'    :parseUInt32( data, offset + 20 + 4 * 8 ),
+				'nquad_flat_uv'   :parseUInt32( data, offset + 20 + 4 * 9 ),
+				'nquad_smooth_uv' :parseUInt32( data, offset + 20 + 4 * 10 )
 
 			};
 /*
@@ -336,7 +336,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			var i, x, y, z;
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				x = coordArray[ i * 3 ];
 				y = coordArray[ i * 3 + 1 ];
@@ -360,13 +360,13 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 				var i, x, y, z;
 
-				for( i = 0; i < nElements; i ++ ) {
+				for ( i = 0; i < nElements; i ++ ) {
 
 					x = normalArray[ i * 3 ];
 					y = normalArray[ i * 3 + 1 ];
 					z = normalArray[ i * 3 + 2 ];
 
-					normals.push( x/127, y/127, z/127 );
+					normals.push( x / 127, y / 127, z / 127 );
 
 				}
 
@@ -386,7 +386,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 				var i, u, v;
 
-				for( i = 0; i < nElements; i ++ ) {
+				for ( i = 0; i < nElements; i ++ ) {
 
 					u = uvArray[ i * 2 ];
 					v = uvArray[ i * 2 + 1 ];
@@ -407,20 +407,20 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			var uvIndexBuffer = new Uint32Array( data, offset, 3 * nElements );
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				uva = uvIndexBuffer[ i * 3 ];
 				uvb = uvIndexBuffer[ i * 3 + 1 ];
 				uvc = uvIndexBuffer[ i * 3 + 2 ];
 
-				u1 = uvs[ uva*2 ];
-				v1 = uvs[ uva*2 + 1 ];
+				u1 = uvs[ uva * 2 ];
+				v1 = uvs[ uva * 2 + 1 ];
 
-				u2 = uvs[ uvb*2 ];
-				v2 = uvs[ uvb*2 + 1 ];
+				u2 = uvs[ uvb * 2 ];
+				v2 = uvs[ uvb * 2 + 1 ];
 
-				u3 = uvs[ uvc*2 ];
-				v3 = uvs[ uvc*2 + 1 ];
+				u3 = uvs[ uvc * 2 ];
+				v3 = uvs[ uvc * 2 + 1 ];
 
 				scope.faceVertexUvs[ 0 ].push( [
 					new THREE.Vector2( u1, v1 ),
@@ -438,24 +438,24 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			var uvIndexBuffer = new Uint32Array( data, offset, 4 * nElements );
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				uva = uvIndexBuffer[ i * 4 ];
 				uvb = uvIndexBuffer[ i * 4 + 1 ];
 				uvc = uvIndexBuffer[ i * 4 + 2 ];
 				uvd = uvIndexBuffer[ i * 4 + 3 ];
 
-				u1 = uvs[ uva*2 ];
-				v1 = uvs[ uva*2 + 1 ];
+				u1 = uvs[ uva * 2 ];
+				v1 = uvs[ uva * 2 + 1 ];
 
-				u2 = uvs[ uvb*2 ];
-				v2 = uvs[ uvb*2 + 1 ];
+				u2 = uvs[ uvb * 2 ];
+				v2 = uvs[ uvb * 2 + 1 ];
 
-				u3 = uvs[ uvc*2 ];
-				v3 = uvs[ uvc*2 + 1 ];
+				u3 = uvs[ uvc * 2 ];
+				v3 = uvs[ uvc * 2 + 1 ];
 
-				u4 = uvs[ uvd*2 ];
-				v4 = uvs[ uvd*2 + 1 ];
+				u4 = uvs[ uvd * 2 ];
+				v4 = uvs[ uvd * 2 + 1 ];
 
 				scope.faceVertexUvs[ 0 ].push( [
 					new THREE.Vector2( u1, v1 ),
@@ -480,7 +480,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 			var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 3 * nElements );
 			var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				a = vertexIndexBuffer[ i * 3 ];
 				b = vertexIndexBuffer[ i * 3 + 1 ];
@@ -501,7 +501,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 			var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 4 * nElements );
 			var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				a = vertexIndexBuffer[ i * 4 ];
 				b = vertexIndexBuffer[ i * 4 + 1 ];
@@ -526,7 +526,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 			var normalIndexBuffer = new Uint32Array( data, offsetNormals, 3 * nElements );
 			var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				a = vertexIndexBuffer[ i * 3 ];
 				b = vertexIndexBuffer[ i * 3 + 1 ];
@@ -538,17 +538,17 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 				m = materialIndexBuffer[ i ];
 
-				var nax = normals[ na*3     ],
-					nay = normals[ na*3 + 1 ],
-					naz = normals[ na*3 + 2 ],
+				var nax = normals[ na * 3     ],
+					nay = normals[ na * 3 + 1 ],
+					naz = normals[ na * 3 + 2 ],
 
-					nbx = normals[ nb*3     ],
-					nby = normals[ nb*3 + 1 ],
-					nbz = normals[ nb*3 + 2 ],
+					nbx = normals[ nb * 3     ],
+					nby = normals[ nb * 3 + 1 ],
+					nbz = normals[ nb * 3 + 2 ],
 
-					ncx = normals[ nc*3     ],
-					ncy = normals[ nc*3 + 1 ],
-					ncz = normals[ nc*3 + 2 ];
+					ncx = normals[ nc * 3     ],
+					ncy = normals[ nc * 3 + 1 ],
+					ncz = normals[ nc * 3 + 2 ];
 
 				scope.faces.push( new THREE.Face3( a, b, c, [
 					new THREE.Vector3( nax, nay, naz ),
@@ -569,7 +569,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 			var normalIndexBuffer = new Uint32Array( data, offsetNormals, 4 * nElements );
 			var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
 
-			for( i = 0; i < nElements; i ++ ) {
+			for ( i = 0; i < nElements; i ++ ) {
 
 				a = vertexIndexBuffer[ i * 4 ];
 				b = vertexIndexBuffer[ i * 4 + 1 ];
@@ -583,21 +583,21 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 				m = materialIndexBuffer[ i ];
 
-				var nax = normals[ na*3     ],
-					nay = normals[ na*3 + 1 ],
-					naz = normals[ na*3 + 2 ],
+				var nax = normals[ na * 3     ],
+					nay = normals[ na * 3 + 1 ],
+					naz = normals[ na * 3 + 2 ],
 
-					nbx = normals[ nb*3     ],
-					nby = normals[ nb*3 + 1 ],
-					nbz = normals[ nb*3 + 2 ],
+					nbx = normals[ nb * 3     ],
+					nby = normals[ nb * 3 + 1 ],
+					nbz = normals[ nb * 3 + 2 ],
 
-					ncx = normals[ nc*3     ],
-					ncy = normals[ nc*3 + 1 ],
-					ncz = normals[ nc*3 + 2 ],
+					ncx = normals[ nc * 3     ],
+					ncy = normals[ nc * 3 + 1 ],
+					ncz = normals[ nc * 3 + 2 ],
 
-					ndx = normals[ nd*3     ],
-					ndy = normals[ nd*3 + 1 ],
-					ndz = normals[ nd*3 + 2 ];
+					ndx = normals[ nd * 3     ],
+					ndy = normals[ nd * 3 + 1 ],
+					ndz = normals[ nd * 3 + 2 ];
 
 				scope.faces.push( new THREE.Face3( a, b, d, [
 					new THREE.Vector3( nax, nay, naz ),

+ 82 - 82
examples/js/loaders/ColladaLoader.js

@@ -66,9 +66,9 @@ THREE.ColladaLoader = function () {
 
 			request.onreadystatechange = function() {
 
-				if( request.readyState === 4 ) {
+				if ( request.readyState === 4 ) {
 
-					if( request.status === 0 || request.status === 200 ) {
+					if ( request.status === 0 || request.status === 200 ) {
 
 
 						if ( request.responseXML ) {
@@ -334,7 +334,7 @@ THREE.ColladaLoader = function () {
 
 			animData.push(newData);
 
-			for ( var i = 0, il = n.keys.length; i < il; i++ ) {
+			for ( var i = 0, il = n.keys.length; i < il; i ++ ) {
 
 				newData.length = Math.max( newData.length, n.keys[i].time );
 
@@ -351,7 +351,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-		for ( var i = 0, il = node.children.length; i < il; i++ ) {
+		for ( var i = 0, il = node.children.length; i < il; i ++ ) {
 
 			var d = recurseHierarchy( node.children[i] );
 
@@ -505,7 +505,7 @@ THREE.ColladaLoader = function () {
 
 				node.world.copy( m );
 				node.localworld.copy(m);
-				if(frame === 0)
+				if (frame === 0)
 					node.matrix.copy(m);
 			}
 
@@ -599,24 +599,24 @@ THREE.ColladaLoader = function () {
 			bone.name = node.sid;
 			bone.parent = parentid;
 			bone.matrix = node.matrix;
-			var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()];
-			bone.matrix.decompose(data[0],data[1],data[2]);
+			var data = [ new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3() ];
+			bone.matrix.decompose(data[0], data[1], data[2]);
 
-			bone.pos = [data[0].x,data[0].y,data[0].z];
+			bone.pos = [ data[0].x,data[0].y,data[0].z ];
 
-			bone.scl = [data[2].x,data[2].y,data[2].z];
-			bone.rotq = [data[1].x,data[1].y,data[1].z,data[1].w];
+			bone.scl = [ data[2].x,data[2].y,data[2].z ];
+			bone.rotq = [ data[1].x,data[1].y,data[1].z,data[1].w ];
 			list.push(bone);
 
-			for(var i in node.nodes) {
+			for (var i in node.nodes) {
 
-				walk(node.sid,node.nodes[i],list);
+				walk(node.sid, node.nodes[i], list);
 
 			}
 
 		};
 
-		walk(-1,skeleton,list);
+		walk(-1, skeleton, list);
 		return list;
 
 	}
@@ -630,7 +630,7 @@ THREE.ColladaLoader = function () {
 		v = new THREE.Vector3();
 		var skinned = [];
 
-		for(var i =0; i < geometry.vertices.length; i++) {
+		for (var i = 0; i < geometry.vertices.length; i ++) {
 
 			skinned.push(new THREE.Vector3());
 
@@ -662,7 +662,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-		for(var i =0; i < geometry.vertices.length; i++) {
+		for (var i = 0; i < geometry.vertices.length; i ++) {
 
 			geometry.vertices[i] = skinned[i];
 
@@ -700,11 +700,11 @@ THREE.ColladaLoader = function () {
 
 		//sort that list so that the order reflects the order in the joint list
 		var sortedbones = [];
-		for(var i = 0; i < joints.length; i++) {
+		for (var i = 0; i < joints.length; i ++) {
 
-			for(var j =0; j < bonelist.length; j++) {
+			for (var j = 0; j < bonelist.length; j ++) {
 
-				if(bonelist[j].name === joints[i]) {
+				if (bonelist[j].name === joints[i]) {
 
 					sortedbones[i] = bonelist[j];
 
@@ -715,11 +715,11 @@ THREE.ColladaLoader = function () {
 		}
 
 		//hook up the parents by index instead of name
-		for(var i = 0; i < sortedbones.length; i++) {
+		for (var i = 0; i < sortedbones.length; i ++) {
 
-			for(var j =0; j < sortedbones.length; j++) {
+			for (var j = 0; j < sortedbones.length; j ++) {
 
-				if(sortedbones[i].parent === sortedbones[j].name) {
+				if (sortedbones[i].parent === sortedbones[j].name) {
 
 					sortedbones[i].parent = j;
 
@@ -744,10 +744,10 @@ THREE.ColladaLoader = function () {
 
 		//hook up the skin weights
 		// TODO -  this might be a good place to choose greatest 4 weights
-		for(var i =0; i < weights.length; i++) {
+		for (var i = 0; i < weights.length; i ++) {
 
-			var indicies = new THREE.Vector4(weights[i][0]?weights[i][0].joint:0,weights[i][1]?weights[i][1].joint:0,weights[i][2]?weights[i][2].joint:0,weights[i][3]?weights[i][3].joint:0);
-			var weight = new THREE.Vector4(weights[i][0]?weights[i][0].weight:0,weights[i][1]?weights[i][1].weight:0,weights[i][2]?weights[i][2].weight:0,weights[i][3]?weights[i][3].weight:0);
+			var indicies = new THREE.Vector4(weights[i][0] ? weights[i][0].joint : 0,weights[i][1] ? weights[i][1].joint : 0,weights[i][2] ? weights[i][2].joint : 0,weights[i][3] ? weights[i][3].joint : 0);
+			var weight = new THREE.Vector4(weights[i][0] ? weights[i][0].weight : 0,weights[i][1] ? weights[i][1].weight : 0,weights[i][2] ? weights[i][2].weight : 0,weights[i][3] ? weights[i][3].weight : 0);
 
 			skinIndices.push(indicies);
 			skinWeights.push(weight);
@@ -761,11 +761,11 @@ THREE.ColladaLoader = function () {
 
 		//create an animation for the animated bones
 		//NOTE: this has no effect when using morphtargets
-		var animationdata = {"name":animationBounds.ID,"fps":30,"length":animationBounds.frames/30,"hierarchy":[]};
+		var animationdata = { "name":animationBounds.ID,"fps":30,"length":animationBounds.frames / 30,"hierarchy":[] };
 
-		for(var j =0; j < sortedbones.length; j++) {
+		for (var j = 0; j < sortedbones.length; j ++) {
 
-			animationdata.hierarchy.push({parent:sortedbones[j].parent, name:sortedbones[j].name, keys:[]});
+			animationdata.hierarchy.push({ parent:sortedbones[j].parent, name:sortedbones[j].name, keys:[] });
 
 		}
 
@@ -773,7 +773,7 @@ THREE.ColladaLoader = function () {
 
 
 
-		skinToBindPose(geometry,skeleton,skinController);
+		skinToBindPose(geometry, skeleton, skinController);
 
 
 		for ( frame = 0; frame < animationBounds.frames; frame ++ ) {
@@ -786,25 +786,25 @@ THREE.ColladaLoader = function () {
 			setupSkeleton( skeleton, bones, frame );
 			setupSkinningMatrices( bones, skinController.skin );
 
-			for(var i = 0; i < bones.length; i ++) {
+			for (var i = 0; i < bones.length; i ++) {
 
-				for(var j = 0; j < animationdata.hierarchy.length; j ++) {
+				for (var j = 0; j < animationdata.hierarchy.length; j ++) {
 
-					if(animationdata.hierarchy[j].name === bones[i].sid) {
+					if (animationdata.hierarchy[j].name === bones[i].sid) {
 
 						var key = {};
-						key.time = (frame/30);
+						key.time = (frame / 30);
 						key.matrix = bones[i].animatrix;
 
-						if(frame === 0)
+						if (frame === 0)
 							bones[i].matrix = key.matrix;
 
-						var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()];
-						key.matrix.decompose(data[0],data[1],data[2]);
+						var data = [ new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3() ];
+						key.matrix.decompose(data[0], data[1], data[2]);
 
-						key.pos = [data[0].x,data[0].y,data[0].z];
+						key.pos = [ data[0].x,data[0].y,data[0].z ];
 
-						key.scl = [data[2].x,data[2].y,data[2].z];
+						key.scl = [ data[2].x,data[2].y,data[2].z ];
 						key.rot = data[1];
 
 						animationdata.hierarchy[j].keys.push(key);
@@ -897,7 +897,7 @@ THREE.ColladaLoader = function () {
 
 						var matrix = new THREE.Matrix4();
 
-						for (i = 0; i < transforms.length; i++ ) {
+						for (i = 0; i < transforms.length; i ++ ) {
 
 							var transform = transforms[ i ];
 
@@ -1345,7 +1345,7 @@ THREE.ColladaLoader = function () {
 
         var nodes = COLLADA.querySelectorAll('library_nodes node');
 
-        for ( var i = 0; i < nodes.length; i++ ) {
+        for ( var i = 0; i < nodes.length; i ++ ) {
 
             var attObj = nodes[i].attributes.getNamedItem('id');
             if ( attObj && attObj.value === id ) {
@@ -1495,7 +1495,7 @@ THREE.ColladaLoader = function () {
 			var keys = [],
 				sids = [];
 
-			for ( var i = 0, il = node.channels.length; i < il; i++ ) {
+			for ( var i = 0, il = node.channels.length; i < il; i ++ ) {
 
 				var channel = node.channels[i],
 					fullSid = channel.fullSid,
@@ -1508,7 +1508,7 @@ THREE.ColladaLoader = function () {
 
 					member = [];
 
-					for ( var j = 0, jl = channel.arrIndices.length; j < jl; j++ ) {
+					for ( var j = 0, jl = channel.arrIndices.length; j < jl; j ++ ) {
 
 						member[ j ] = getConvertedIndex( channel.arrIndices[ j ] );
 
@@ -1528,7 +1528,7 @@ THREE.ColladaLoader = function () {
 
 					}
 
-					for ( var j = 0, jl = input.length; j < jl; j++ ) {
+					for ( var j = 0, jl = input.length; j < jl; j ++ ) {
 
 						var time = input[j],
 							data = sampler.getData( transform.type, j, member ),
@@ -1555,11 +1555,11 @@ THREE.ColladaLoader = function () {
 			}
 
 			// post process
-			for ( var i = 0; i < sids.length; i++ ) {
+			for ( var i = 0; i < sids.length; i ++ ) {
 
 				var sid = sids[ i ];
 
-				for ( var j = 0; j < keys.length; j++ ) {
+				for ( var j = 0; j < keys.length; j ++ ) {
 
 					var key = keys[ j ];
 
@@ -1584,7 +1584,7 @@ THREE.ColladaLoader = function () {
 
 		var retVal = null;
 
-		for ( var i = 0, il = keys.length; i < il && retVal === null; i++ ) {
+		for ( var i = 0, il = keys.length; i < il && retVal === null; i ++ ) {
 
 			var key = keys[i];
 
@@ -1608,7 +1608,7 @@ THREE.ColladaLoader = function () {
 
 		var ndx = -1;
 
-		for ( var i = 0, il = keys.length; i < il && ndx === -1; i++ ) {
+		for ( var i = 0, il = keys.length; i < il && ndx === -1; i ++ ) {
 
 			var key = keys[i];
 
@@ -1626,8 +1626,8 @@ THREE.ColladaLoader = function () {
 
 	function interpolateKeys ( keys, key, ndx, fullSid ) {
 
-		var prevKey = getPrevKeyWith( keys, fullSid, ndx ? ndx-1 : 0 ),
-			nextKey = getNextKeyWith( keys, fullSid, ndx+1 );
+		var prevKey = getPrevKeyWith( keys, fullSid, ndx ? ndx - 1 : 0 ),
+			nextKey = getNextKeyWith( keys, fullSid, ndx + 1 );
 
 		if ( prevKey && nextKey ) {
 
@@ -1645,7 +1645,7 @@ THREE.ColladaLoader = function () {
 
 				data = [];
 
-				for ( var i = 0; i < prevData.length; ++i ) {
+				for ( var i = 0; i < prevData.length; ++ i ) {
 
 					data[ i ] = prevData[ i ] + ( nextData[ i ] - prevData[ i ] ) * scale;
 
@@ -1667,7 +1667,7 @@ THREE.ColladaLoader = function () {
 
 	function getNextKeyWith( keys, fullSid, ndx ) {
 
-		for ( ; ndx < keys.length; ndx++ ) {
+		for ( ; ndx < keys.length; ndx ++ ) {
 
 			var key = keys[ ndx ];
 
@@ -1689,7 +1689,7 @@ THREE.ColladaLoader = function () {
 
 		ndx = ndx >= 0 ? ndx : ndx + keys.length;
 
-		for ( ; ndx >= 0; ndx-- ) {
+		for ( ; ndx >= 0; ndx -- ) {
 
 			var key = keys[ ndx ];
 
@@ -1748,7 +1748,7 @@ THREE.ColladaLoader = function () {
 		this.name = element.getAttribute('name');
 		this.type = "none";
 
-		for ( var i = 0; i < element.childNodes.length; i++ ) {
+		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
 			var child = element.childNodes[ i ];
 
@@ -2011,7 +2011,7 @@ THREE.ColladaLoader = function () {
 			var numBones = vcount[i];
 			var vertex_weights = [];
 
-			for ( var j = 0; j < numBones; j++ ) {
+			for ( var j = 0; j < numBones; j ++ ) {
 
 				var influence = {};
 
@@ -2633,7 +2633,7 @@ THREE.ColladaLoader = function () {
 
 					var instances = child.querySelectorAll('instance_material');
 
-					for ( var j = 0; j < instances.length; j ++ ){
+					for ( var j = 0; j < instances.length; j ++ ) {
 
 						var instance = instances[j];
 						this.instance_material.push( (new InstanceMaterial()).parse(instance) );
@@ -2862,7 +2862,7 @@ THREE.ColladaLoader = function () {
 			input = inputs[ j ];
 
 			var offset = input.offset + 1;
-			maxOffset = (maxOffset < offset)? offset : maxOffset;
+			maxOffset = (maxOffset < offset) ? offset : maxOffset;
 
 			switch ( input.semantic ) {
 
@@ -2874,7 +2874,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-		for ( var pCount = 0; pCount < pList.length; ++pCount ) {
+		for ( var pCount = 0; pCount < pList.length; ++ pCount ) {
 
 			var p = pList[ pCount ], i = 0;
 
@@ -2956,7 +2956,7 @@ THREE.ColladaLoader = function () {
 						source = sources[ input.source ];
 						numParams = source.accessor.params.length;
 
-						for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) {
+						for ( var ndx = 0, len = vs.length; ndx < len; ndx ++ ) {
 
 							ns.push( getConvertedVec3( source.data, vs[ ndx ] * numParams ) );
 
@@ -2982,7 +2982,7 @@ THREE.ColladaLoader = function () {
 						source = sources[ input.source ];
 						numParams = source.accessor.params.length;
 
-						for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) {
+						for ( var ndx = 0, len = vs.length; ndx < len; ndx ++ ) {
 
 							idx32 = vs[ ndx ] * numParams;
 							if ( ts[ input.set ] === undefined ) ts[ input.set ] = [ ];
@@ -3005,7 +3005,7 @@ THREE.ColladaLoader = function () {
 						source = sources[ input.source ];
 						numParams = source.accessor.params.length;
 
-						for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) {
+						for ( var ndx = 0, len = vs.length; ndx < len; ndx ++ ) {
 
 							idx32 = vs[ ndx ] * numParams;
 							cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) );
@@ -3024,9 +3024,9 @@ THREE.ColladaLoader = function () {
 
 				} else if ( vcount === 4 ) {
 
-					faces.push( new THREE.Face3( vs[0], vs[1], vs[3], [ns[0], ns[1], ns[3]], cs.length ? [cs[0], cs[1], cs[3]] : new THREE.Color() ) );
+					faces.push( new THREE.Face3( vs[0], vs[1], vs[3], [ ns[0], ns[1], ns[3]], cs.length ? [ cs[0], cs[1], cs[3]] : new THREE.Color() ) );
 
-					faces.push( new THREE.Face3( vs[1], vs[2], vs[3], [ns[1], ns[2], ns[3]], cs.length ? [cs[1], cs[2], cs[3]] : new THREE.Color() ) );
+					faces.push( new THREE.Face3( vs[1], vs[2], vs[3], [ ns[1], ns[2], ns[3]], cs.length ? [ cs[1], cs[2], cs[3]] : new THREE.Color() ) );
 
 				} else if ( vcount > 4 && options.subdivideFaces ) {
 
@@ -3039,7 +3039,7 @@ THREE.ColladaLoader = function () {
 
 						// FIXME: normals don't seem to be quite right
 
-						faces.push( new THREE.Face3( vs[0], vs[k], vs[k+1], [ ns[0], ns[k++], ns[k] ],  clr ) );
+						faces.push( new THREE.Face3( vs[0], vs[k], vs[k + 1], [ ns[0], ns[k ++], ns[k] ],  clr ) );
 
 					}
 
@@ -3053,14 +3053,14 @@ THREE.ColladaLoader = function () {
 						face.daeMaterial = primitive.material;
 						geom.faces.push( face );
 
-						for ( k = 0; k < texture_sets.length; k++ ) {
+						for ( k = 0; k < texture_sets.length; k ++ ) {
 
 							uv = ts[ texture_sets[k] ];
 
 							if ( vcount > 4 ) {
 
 								// Grab the right UVs for the vertices in this face
-								uvArr = [ uv[0], uv[ndx+1], uv[ndx+2] ];
+								uvArr = [ uv[0], uv[ndx + 1], uv[ndx + 2] ];
 
 							} else if ( vcount === 4 ) {
 
@@ -3661,7 +3661,7 @@ THREE.ColladaLoader = function () {
 
 		var keys = {
 			'diffuse':'map',
-			'ambient':'lightMap' ,
+			'ambient':'lightMap',
 			'specular':'specularMap',
 			'emission':'emissionMap',
 			'bump':'bumpMap',
@@ -3758,7 +3758,7 @@ THREE.ColladaLoader = function () {
 				case 'reflectivity':
 
 					props[ prop ] = this[ prop ];
-					if( props[ prop ] > 0.0 ) props['envMap'] = options.defaultEnvMap;
+					if ( props[ prop ] > 0.0 ) props['envMap'] = options.defaultEnvMap;
 					props['combine'] = THREE.MixOperation;	//mix regular shading with reflective component
 					break;
 
@@ -4051,7 +4051,7 @@ THREE.ColladaLoader = function () {
 
 	};
 
-	Effect.prototype.parseTechnique= function ( element ) {
+	Effect.prototype.parseTechnique = function ( element ) {
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
@@ -4100,7 +4100,7 @@ THREE.ColladaLoader = function () {
 
 	};
 
-	Effect.prototype.parseExtraTechnique= function ( element ) {
+	Effect.prototype.parseExtraTechnique = function ( element ) {
 
 		for ( var i = 0; i < element.childNodes.length; i ++ ) {
 
@@ -4384,7 +4384,7 @@ THREE.ColladaLoader = function () {
 			data = [];
 			ndx *= this.strideOut;
 
-			for ( var i = 0; i < this.strideOut; ++i ) {
+			for ( var i = 0; i < this.strideOut; ++ i ) {
 
 				data[ i ] = this.output[ ndx + i ];
 
@@ -4447,7 +4447,7 @@ THREE.ColladaLoader = function () {
 
 	Key.prototype.apply = function ( opt_sid ) {
 
-		for ( var i = 0; i < this.targets.length; ++i ) {
+		for ( var i = 0; i < this.targets.length; ++ i ) {
 
 			var target = this.targets[ i ];
 
@@ -4463,7 +4463,7 @@ THREE.ColladaLoader = function () {
 
 	Key.prototype.getTarget = function ( fullSid ) {
 
-		for ( var i = 0; i < this.targets.length; ++i ) {
+		for ( var i = 0; i < this.targets.length; ++ i ) {
 
 			if ( this.targets[ i ].sid === fullSid ) {
 
@@ -4479,7 +4479,7 @@ THREE.ColladaLoader = function () {
 
 	Key.prototype.hasTarget = function ( fullSid ) {
 
-		for ( var i = 0; i < this.targets.length; ++i ) {
+		for ( var i = 0; i < this.targets.length; ++ i ) {
 
 			if ( this.targets[ i ].sid === fullSid ) {
 
@@ -4515,7 +4515,7 @@ THREE.ColladaLoader = function () {
 
 					data = [];
 
-					for ( var j = 0; j < prevData.length; ++j ) {
+					for ( var j = 0; j < prevData.length; ++ j ) {
 
 						data[ j ] = prevData[ j ] + ( nextData[ j ] - prevData[ j ] ) * scale;
 
@@ -4753,7 +4753,7 @@ THREE.ColladaLoader = function () {
 
 							case 'quadratic_attenuation':
 								var f = parseFloat( child.textContent );
-								this.distance = f ? Math.sqrt( 1/f ) : 0;
+								this.distance = f ? Math.sqrt( 1 / f ) : 0;
 						}
 
 					}
@@ -4819,7 +4819,7 @@ THREE.ColladaLoader = function () {
 		this.joints = [];
 		this.links = [];
 
-		for (var i = 0; i < element.childNodes.length; i++ ) {
+		for (var i = 0; i < element.childNodes.length; i ++ ) {
 
 			var child = element.childNodes[ i ];
 			if ( child.nodeType != 1 ) continue;
@@ -4844,7 +4844,7 @@ THREE.ColladaLoader = function () {
 
 	KinematicsModel.prototype.parseCommon = function( element ) {
 
-		for (var i = 0; i < element.childNodes.length; i++ ) {
+		for (var i = 0; i < element.childNodes.length; i ++ ) {
 
 			var child = element.childNodes[ i ];
 			if ( child.nodeType != 1 ) continue;
@@ -4912,8 +4912,8 @@ THREE.ColladaLoader = function () {
 			max: max
 		};
 
-		var jointTypes = ['prismatic', 'revolute'];
-		for (var i = 0; i < jointTypes.length; i++ ) {
+		var jointTypes = [ 'prismatic', 'revolute' ];
+		for (var i = 0; i < jointTypes.length; i ++ ) {
 
 			var type = jointTypes[ i ];
 
@@ -4955,7 +4955,7 @@ THREE.ColladaLoader = function () {
 		this.transforms = [];
 		this.attachments = [];
 
-		for (var i = 0; i < element.childNodes.length; i++ ) {
+		for (var i = 0; i < element.childNodes.length; i ++ ) {
 
 			var child = element.childNodes[ i ];
 			if ( child.nodeType != 1 ) continue;
@@ -4998,7 +4998,7 @@ THREE.ColladaLoader = function () {
 		this.joint = element.getAttribute('joint').split('/').pop();
 		this.links = [];
 
-		for (var i = 0; i < element.childNodes.length; i++ ) {
+		for (var i = 0; i < element.childNodes.length; i ++ ) {
 
 			var child = element.childNodes[ i ];
 			if ( child.nodeType != 1 ) continue;
@@ -5175,7 +5175,7 @@ THREE.ColladaLoader = function () {
 		var parts = f.toString().split( '.' );
 		parts[ 1 ] = parts.length > 1 ? parts[ 1 ].substr( 0, num ) : "0";
 
-		while( parts[ 1 ].length < num ) {
+		while ( parts[ 1 ].length < num ) {
 
 			parts[ 1 ] += '0';
 
@@ -5401,7 +5401,7 @@ THREE.ColladaLoader = function () {
 
 		if ( index > -1 && index < 3 ) {
 
-			var members = ['X', 'Y', 'Z'],
+			var members = [ 'X', 'Y', 'Z' ],
 				indices = { X: 0, Y: 1, Z: 2 };
 
 			index = getConvertedMember( members[ index ] );

+ 13 - 13
examples/js/loaders/DDSLoader.js

@@ -70,21 +70,21 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 	}
 
 	function loadARGBMip( buffer, dataOffset, width, height ) {
-		var dataLength = width*height*4;
+		var dataLength = width * height * 4;
 		var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength );
 		var byteArray = new Uint8Array( dataLength );
 		var dst = 0;
 		var src = 0;
-		for ( var y = 0; y < height; y++ ) {
-			for ( var x = 0; x < width; x++ ) {
-				var b = srcBuffer[src]; src++;
-				var g = srcBuffer[src]; src++;
-				var r = srcBuffer[src]; src++;
-				var a = srcBuffer[src]; src++;
-				byteArray[dst] = r; dst++;	//r
-				byteArray[dst] = g; dst++;	//g
-				byteArray[dst] = b; dst++;	//b
-				byteArray[dst] = a; dst++;	//a
+		for ( var y = 0; y < height; y ++ ) {
+			for ( var x = 0; x < width; x ++ ) {
+				var b = srcBuffer[src]; src ++;
+				var g = srcBuffer[src]; src ++;
+				var r = srcBuffer[src]; src ++;
+				var a = srcBuffer[src]; src ++;
+				byteArray[dst] = r; dst ++;	//r
+				byteArray[dst] = g; dst ++;	//g
+				byteArray[dst] = b; dst ++;	//b
+				byteArray[dst] = a; dst ++;	//a
 			}
 		}
 		return byteArray;
@@ -166,7 +166,7 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 
 		default:
 
-			if( header[off_RGBBitCount] ==32 
+			if ( header[off_RGBBitCount] == 32 
 				&& header[off_RBitMask]&0xff0000
 				&& header[off_GBitMask]&0xff00 
 				&& header[off_BBitMask]&0xff
@@ -208,7 +208,7 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 
 		for ( var i = 0; i < dds.mipmapCount; i ++ ) {
 
-			if( isRGBAUncompressed ) {
+			if ( isRGBAUncompressed ) {
 				var byteArray = loadARGBMip( buffer, dataOffset, width, height );
 				var dataLength = byteArray.length;
 			} else {

+ 3 - 3
examples/js/loaders/MTLLoader.js

@@ -121,8 +121,8 @@ THREE.MTLLoader.MaterialCreator = function( baseUrl, options ) {
 	this.materialsArray = [];
 	this.nameLookup = {};
 
-	this.side = ( this.options && this.options.side )? this.options.side: THREE.FrontSide;
-	this.wrap = ( this.options && this.options.wrap )? this.options.wrap: THREE.RepeatWrapping;
+	this.side = ( this.options && this.options.side ) ? this.options.side : THREE.FrontSide;
+	this.wrap = ( this.options && this.options.wrap ) ? this.options.wrap : THREE.RepeatWrapping;
 
 };
 
@@ -426,7 +426,7 @@ THREE.MTLLoader.ensurePowerOfTwo_ = function ( image ) {
 
 THREE.MTLLoader.nextHighestPowerOfTwo_ = function( x ) {
 
-	--x;
+	-- x;
 
 	for ( var i = 1; i < 32; i <<= 1 ) {
 

File diff suppressed because it is too large
+ 1 - 3
examples/js/loaders/PDBLoader.js


+ 10 - 10
examples/js/loaders/PLYLoader.js

@@ -80,7 +80,7 @@ THREE.PLYLoader.prototype = {
 
 		var array_buffer = new Uint8Array(buf);
 		var str = '';
-		for(var i = 0; i < buf.byteLength; i++) {
+		for (var i = 0; i < buf.byteLength; i ++) {
 			str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian
 		}
 
@@ -88,7 +88,7 @@ THREE.PLYLoader.prototype = {
 
 	},
 
-	isASCII: function( data ){
+	isASCII: function( data ) {
 
 		var header = this.parseHeader( this.bin2str( data ) );
 
@@ -167,7 +167,7 @@ THREE.PLYLoader.prototype = {
 			lineType = lineValues.shift()
 			line = lineValues.join(" ")
 
-			switch( lineType ) {
+			switch ( lineType ) {
 
 			case "format":
 
@@ -224,7 +224,7 @@ THREE.PLYLoader.prototype = {
 
 	parseASCIINumber: function ( n, type ) {
 
-		switch( type ) {
+		switch ( type ) {
 
 		case 'char': case 'uchar': case 'short': case 'ushort': case 'int': case 'uint':
 		case 'int8': case 'uint8': case 'int16': case 'uint16': case 'int32': case 'uint32':
@@ -301,7 +301,7 @@ THREE.PLYLoader.prototype = {
 
 			if ( currentElementCount >= header.elements[currentElement].count ) {
 
-				currentElement++;
+				currentElement ++;
 				currentElementCount = 0;
 
 			}
@@ -310,7 +310,7 @@ THREE.PLYLoader.prototype = {
 
 			this.handleElement( geometry, header.elements[currentElement].name, element );
 
-			currentElementCount++;
+			currentElementCount ++;
 
 		}
 
@@ -385,7 +385,7 @@ THREE.PLYLoader.prototype = {
 
 	binaryRead: function ( dataview, at, type, little_endian ) {
 
-		switch( type ) {
+		switch ( type ) {
 
 			// corespondences for non-specific length types here match rply:
 		case 'int8':		case 'char':	 return [ dataview.getInt8( at ), 1 ];
@@ -419,13 +419,13 @@ THREE.PLYLoader.prototype = {
 
 				var list = [];
 
-				result = this.binaryRead( dataview, at+read, properties[i].countType, little_endian );
+				result = this.binaryRead( dataview, at + read, properties[i].countType, little_endian );
 				var n = result[0];
 				read += result[1];
 
 				for ( j = 0; j < n; j ++ ) {
 
-					result = this.binaryRead( dataview, at+read, properties[i].itemType, little_endian );
+					result = this.binaryRead( dataview, at + read, properties[i].itemType, little_endian );
 					list.push( result[0] );
 					read += result[1];
 
@@ -435,7 +435,7 @@ THREE.PLYLoader.prototype = {
 
 			} else {
 
-				result = this.binaryRead( dataview, at+read, properties[i].type, little_endian );
+				result = this.binaryRead( dataview, at + read, properties[i].type, little_endian );
 				element[ properties[i].name ] = result[0];
 				read += result[1];
 

+ 8 - 8
examples/js/loaders/PVRLoader.js

@@ -28,11 +28,11 @@ THREE.PVRLoader.parse = function ( buffer, loadMipmaps ) {
 	};
 
 	// PVR v3
-	if( header[0] === 0x03525650 ) {
+	if ( header[0] === 0x03525650 ) {
 		return THREE.PVRLoader._parseV3( pvrDatas );
 	} 
 	// PVR v2
-	else if( header[11] === 0x21525650) {
+	else if ( header[11] === 0x21525650) {
 		return THREE.PVRLoader._parseV2( pvrDatas );
 
 	} else {
@@ -55,7 +55,7 @@ THREE.PVRLoader._parseV3 = function ( pvrDatas ) {
 		numFaces      =  header[10],
 		numMipmaps    =  header[11];
 
-	switch( pixelFormat ) {
+	switch ( pixelFormat ) {
 		case 0 : // PVRTC 2bpp RGB
 			bpp = 2;
 			format = THREE.RGB_PVRTC_2BPPV1_Format;
@@ -73,7 +73,7 @@ THREE.PVRLoader._parseV3 = function ( pvrDatas ) {
 			format = THREE.RGBA_PVRTC_4BPPV1_Format;
 			break;
 		default :
-			throw new Error( "pvrtc - unsupported PVR format "+pixelFormat);
+			throw new Error( "pvrtc - unsupported PVR format " + pixelFormat);
 	}
 
 	pvrDatas.dataPtr 	 = 52 + metaLen;
@@ -123,12 +123,12 @@ THREE.PVRLoader._parseV2 = function ( pvrDatas ) {
 		format = _hasAlpha ? THREE.RGBA_PVRTC_4BPPV1_Format : THREE.RGB_PVRTC_4BPPV1_Format;
 		bpp = 4;
 	}
-	else if( formatFlags === PVRTC_2) {
+	else if ( formatFlags === PVRTC_2) {
 		format = _hasAlpha ? THREE.RGBA_PVRTC_2BPPV1_Format : THREE.RGB_PVRTC_2BPPV1_Format;
 		bpp = 2;
 	}
 	else
-		throw new Error( "pvrtc - unknown format "+formatFlags);
+		throw new Error( "pvrtc - unknown format " + formatFlags);
 	
 
 
@@ -195,7 +195,7 @@ THREE.PVRLoader._extract = function ( pvrDatas ) {
 
 
 
-	if( bpp === 2 ){
+	if ( bpp === 2 ) {
 		blockWidth = 8;
 		blockHeight = 4;
 	} else {
@@ -243,7 +243,7 @@ THREE.PVRLoader._extract = function ( pvrDatas ) {
 
 		}
 
-		mipLevel++;
+		mipLevel ++;
 
 	}
 

+ 30 - 30
examples/js/loaders/RGBELoader.js

@@ -60,13 +60,13 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 			lineLimit = !lineLimit ? 1024 : lineLimit;
 			var p = buffer.pos,
 				i = -1, len = 0, s = '', chunkSize = 128,
-				chunk = String.fromCharCode.apply(null, new Uint16Array( buffer.subarray( p, p+chunkSize ) ) )
+				chunk = String.fromCharCode.apply(null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) )
 			;
-			while ( (0 > (i=chunk.indexOf( NEWLINE ))) && (len < lineLimit) && (p < buffer.byteLength) ) {
+			while ( (0 > (i = chunk.indexOf( NEWLINE ))) && (len < lineLimit) && (p < buffer.byteLength) ) {
 
 				s += chunk; len += chunk.length;
 				p += chunkSize;
-				chunk += String.fromCharCode.apply(null, new Uint16Array( buffer.subarray( p, p+chunkSize ) ) );
+				chunk += String.fromCharCode.apply(null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
 
 			}
 
@@ -78,7 +78,7 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 					else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2;
 					if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate
 				}*/
-				if ( false !== consume ) buffer.pos += len+i+1;
+				if ( false !== consume ) buffer.pos += len + i + 1;
 				return s + chunk.slice(0, i);
 
 			}
@@ -122,11 +122,11 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 				}
 			;
 
-			if ( buffer.pos >= buffer.byteLength || !( line=fgets( buffer ) ) ) {
+			if ( buffer.pos >= buffer.byteLength || !( line = fgets( buffer ) ) ) {
 				return rgbe_error( rgbe_read_error, "no header found" );
 			}
 			/* if you want to require the magic token then uncomment the next line */
-			if ( !(match=line.match(magic_token_re)) ) {
+			if ( !(match = line.match(magic_token_re)) ) {
 				return rgbe_error( rgbe_format_error, "bad initial token" );
 			}
 			header.valid |= RGBE_VALID_PROGRAMTYPE;
@@ -144,17 +144,17 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 					continue; // comment line
 				}
 
-				if ( match=line.match(gamma_re) ) {
+				if ( match = line.match(gamma_re) ) {
 					header.gamma = parseFloat(match[1], 10);
 				}
-				if ( match=line.match(exposure_re) ) {
+				if ( match = line.match(exposure_re) ) {
 					header.exposure = parseFloat(match[1], 10);
 				}
-				if ( match=line.match(format_re) ) {
+				if ( match = line.match(format_re) ) {
 					header.valid |= RGBE_VALID_FORMAT;
 					header.format = match[1];//'32-bit_rle_rgbe';
 				}
-				if ( match=line.match(dimensions_re) ) {
+				if ( match = line.match(dimensions_re) ) {
 					header.valid |= RGBE_VALID_DIMENSIONS;
 					header.height = parseInt(match[1], 10);
 					header.width = parseInt(match[2], 10);
@@ -193,29 +193,29 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 				return rgbe_error(rgbe_format_error, "wrong scanline width");
 			}
 
-			data_rgba = new Uint8Array( 4*w*h );
+			data_rgba = new Uint8Array( 4 * w * h );
 
 			if ( !data_rgba || !data_rgba.length ) {
 				return rgbe_error(rgbe_memory_error, "unable to allocate buffer space");
 			}
 
-			offset = 0; pos = 0; ptr_end = 4*scanline_width;
+			offset = 0; pos = 0; ptr_end = 4 * scanline_width;
 			rgbeStart = new Uint8Array( 4 );
 			scanline_buffer = new Uint8Array( ptr_end );
 
 			// read in each successive scanline
-			while( (num_scanlines > 0) && (pos < buffer.byteLength) ) {
+			while ( (num_scanlines > 0) && (pos < buffer.byteLength) ) {
 
-				if ( pos+4 > buffer.byteLength ) {
+				if ( pos + 4 > buffer.byteLength ) {
 
 					return rgbe_error( rgbe_read_error );
 
 				}
 
-				rgbeStart[0] = buffer[pos++];
-				rgbeStart[1] = buffer[pos++];
-				rgbeStart[2] = buffer[pos++];
-				rgbeStart[3] = buffer[pos++];
+				rgbeStart[0] = buffer[pos ++];
+				rgbeStart[1] = buffer[pos ++];
+				rgbeStart[2] = buffer[pos ++];
+				rgbeStart[3] = buffer[pos ++];
 
 				if ( (2 != rgbeStart[0]) || (2 != rgbeStart[1]) || (((rgbeStart[2]<<8) | rgbeStart[3]) != scanline_width) ) {
 
@@ -228,11 +228,11 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 				ptr = 0;
 				while ( (ptr < ptr_end) && (pos < buffer.byteLength) ) {
 
-					count = buffer[ pos++ ];
+					count = buffer[ pos ++ ];
 					isEncodedRun = count > 128;
 					if ( isEncodedRun ) count -= 128;
 
-					if ( (0 === count) || (ptr+count > ptr_end) ) {
+					if ( (0 === count) || (ptr + count > ptr_end) ) {
 
 						return rgbe_error(rgbe_format_error, "bad scanline data");
 
@@ -240,15 +240,15 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 
 					if ( isEncodedRun ) {
 						// a (encoded) run of the same value
-						byteValue = buffer[ pos++ ];
-						for (i=0; i<count; i++) {
-							scanline_buffer[ ptr++ ] = byteValue;
+						byteValue = buffer[ pos ++ ];
+						for (i = 0; i < count; i ++) {
+							scanline_buffer[ ptr ++ ] = byteValue;
 						}
 						//ptr += count;
 
 					} else {
 						// a literal-run
-						scanline_buffer.set( buffer.subarray(pos, pos+count), ptr );
+						scanline_buffer.set( buffer.subarray(pos, pos + count), ptr );
 						ptr += count; pos += count;
 					}
 				}
@@ -257,19 +257,19 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 				// now convert data from buffer into rgba
 				// first red, then green, then blue, then exponent (alpha)
 				l = scanline_width; //scanline_buffer.byteLength;
-				for (i=0; i<l; i++) {
+				for (i = 0; i < l; i ++) {
 					off = 0;
-					data_rgba[offset] = scanline_buffer[i+off];
+					data_rgba[offset] = scanline_buffer[i + off];
 					off += scanline_width; //1;
-					data_rgba[offset+1] = scanline_buffer[i+off];
+					data_rgba[offset + 1] = scanline_buffer[i + off];
 					off += scanline_width; //1;
-					data_rgba[offset+2] = scanline_buffer[i+off];
+					data_rgba[offset + 2] = scanline_buffer[i + off];
 					off += scanline_width; //1;
-					data_rgba[offset+3] = scanline_buffer[i+off];
+					data_rgba[offset + 3] = scanline_buffer[i + off];
 					offset += 4;
 				}
 
-				num_scanlines--;
+				num_scanlines --;
 			}
 
 			return data_rgba;

+ 10 - 10
examples/js/loaders/STLLoader.js

@@ -59,7 +59,7 @@ THREE.STLLoader.prototype = {
 			var expect, face_size, n_faces, reader;
 			reader = new DataView( binData );
 			face_size = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);
-			n_faces = reader.getUint32(80,true);
+			n_faces = reader.getUint32(80, true);
 			expect = 80 + (32 / 8) + (n_faces * face_size);
 			
 			if ( expect === reader.byteLength ) {
@@ -231,10 +231,10 @@ THREE.STLLoader.prototype = {
 
 	ensureString: function ( buf ) {
 
-		if (typeof buf !== "string"){
+		if (typeof buf !== "string") {
 			var array_buffer = new Uint8Array(buf);
 			var str = '';
-			for(var i = 0; i < buf.byteLength; i++) {
+			for (var i = 0; i < buf.byteLength; i ++) {
 				str += String.fromCharCode(array_buffer[i]); // implicitly assumes little-endian
 			}
 			return str;
@@ -246,9 +246,9 @@ THREE.STLLoader.prototype = {
 
 	ensureBinary: function ( buf ) {
 
-		if (typeof buf === "string"){
+		if (typeof buf === "string") {
 			var array_buffer = new Uint8Array(buf.length);
-			for(var i = 0; i < buf.length; i++) {
+			for (var i = 0; i < buf.length; i ++) {
 				array_buffer[i] = buf.charCodeAt(i) & 0xff; // implicitly assumes little-endian
 			}
 			return array_buffer.buffer || array_buffer;
@@ -260,9 +260,9 @@ THREE.STLLoader.prototype = {
 
 };
 
-if ( typeof DataView === 'undefined'){
+if ( typeof DataView === 'undefined') {
 
-	DataView = function(buffer, byteOffset, byteLength){
+	DataView = function(buffer, byteOffset, byteLength) {
 
 		this.buffer = buffer;
 		this.byteOffset = byteOffset || 0;
@@ -273,12 +273,12 @@ if ( typeof DataView === 'undefined'){
 
 	DataView.prototype = {
 
-		_getCharCodes:function(buffer,start,length){
+		_getCharCodes:function(buffer,start,length) {
 			start = start || 0;
 			length = length || buffer.length;
 			var end = start + length;
 			var codes = [];
-			for (var i = start; i < end; i++) {
+			for (var i = start; i < end; i ++) {
 				codes.push(buffer.charCodeAt(i) & 0xff);
 			}
 			return codes;
@@ -325,7 +325,7 @@ if ( typeof DataView === 'undefined'){
 
 			}
 
-			if (this.isString){
+			if (this.isString) {
 
 				result = this._getCharCodes(this.buffer, byteOffset, byteOffset + length);
 

+ 14 - 14
examples/js/loaders/TGALoader.js

@@ -57,7 +57,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 	function tgaCheckHeader( header ) {
 
-		switch( header.image_type ) {
+		switch ( header.image_type ) {
 
 			// Check indexed type
 			case TGA_TYPE_INDEXED:
@@ -83,12 +83,12 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 			// Invalid type ?
 			default:
-				console.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type " '+ header.image_type + '"');
+				console.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type " ' + header.image_type + '"');
 
 		}
 
 		// Check image width and height
-		if ( header.width <= 0 || header.height <=0 ) {
+		if ( header.width <= 0 || header.height <= 0 ) {
 			console.error( 'THREE.TGALoader.parse.tgaCheckHeader: Invalid image size' );
 		}
 
@@ -171,18 +171,18 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			var pixels = new Uint8Array(pixel_size);
 
 			while (shift < pixel_total) {
-				c     = data[offset++];
+				c     = data[offset ++];
 				count = (c & 0x7f) + 1;
 
 				// RLE pixels.
 				if (c & 0x80) {
 					// Bind pixel tmp array
-					for (i = 0; i < pixel_size; ++i) {
-							pixels[i] = data[offset++];
+					for (i = 0; i < pixel_size; ++ i) {
+							pixels[i] = data[offset ++];
 					}
 
 					// Copy pixel array
-					for (i = 0; i < count; ++i) {
+					for (i = 0; i < count; ++ i) {
 							pixel_data.set(pixels, shift + i * pixel_size);
 					}
 
@@ -191,8 +191,8 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 				} else {
 					// Raw pixels.
 					count *= pixel_size;
-					for (i = 0; i < count; ++i) {
-							pixel_data[shift + i] = data[offset++];
+					for (i = 0; i < count; ++ i) {
+							pixel_data[shift + i] = data[offset ++];
 					}
 					shift += count;
 				}
@@ -217,7 +217,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 				var width = header.width;
 
 		for (y = y_start; y !== y_end; y += y_step) {
-			for (x = x_start; x !== x_end; x += x_step, i++) {
+			for (x = x_start; x !== x_end; x += x_step, i ++) {
 				color = image[i];
 				imageData[(x + width * y) * 4 + 3] = 255;
 				imageData[(x + width * y) * 4 + 2] = colormap[(color * 3) + 0];
@@ -291,7 +291,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 		var width = header.width;
 
 		for (y = y_start; y !== y_end; y += y_step) {
-			for (x = x_start; x !== x_end; x += x_step, i++) {
+			for (x = x_start; x !== x_end; x += x_step, i ++) {
 				color = image[i];
 				imageData[(x + width * y) * 4 + 0] = color;
 				imageData[(x + width * y) * 4 + 1] = color;
@@ -332,7 +332,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			y_end,
 			data = new Uint8Array(width * height * 4);
 
-		switch( (header.flags & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT ) {
+		switch ( (header.flags & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT ) {
 			default:
 			case TGA_ORIGIN_UL:
 				x_start = 0;
@@ -374,7 +374,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		if ( use_grey ) {
 
-			switch( header.pixel_size ) {
+			switch ( header.pixel_size ) {
 				case 8:
 					tgaGetImageDataGrey8bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image );
 					break;
@@ -388,7 +388,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		} else {
 
-			switch( header.pixel_size ) {
+			switch ( header.pixel_size ) {
 				case 8:
 					tgaGetImageData8bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image, palette );
 					break;

+ 55 - 55
examples/js/loaders/UTF8Loader.js

@@ -50,15 +50,15 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 	j = 0;
 	offset = 0;
 
-	for( i = offset; i < end; i += stride ) {
+	for ( i = offset; i < end; i += stride ) {
 
 		x = attribArray[ i ];
 		y = attribArray[ i + 1 ];
 		z = attribArray[ i + 2 ];
 
-		positions[ j++ ] = x;
-		positions[ j++ ] = y;
-		positions[ j++ ] = z;
+		positions[ j ++ ] = x;
+		positions[ j ++ ] = y;
+		positions[ j ++ ] = z;
 
 	}
 
@@ -67,13 +67,13 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 	j = 0;
 	offset = 3;
 
-	for( i = offset; i < end; i += stride ) {
+	for ( i = offset; i < end; i += stride ) {
 
 		u = attribArray[ i ];
 		v = attribArray[ i + 1 ];
 
-		uvs[ j++ ] = u;
-		uvs[ j++ ] = v;
+		uvs[ j ++ ] = u;
+		uvs[ j ++ ] = v;
 
 	}
 
@@ -82,15 +82,15 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 	j = 0;
 	offset = 5;
 
-	for( i = offset; i < end; i += stride ) {
+	for ( i = offset; i < end; i += stride ) {
 
 		x = attribArray[ i ];
 		y = attribArray[ i + 1 ];
 		z = attribArray[ i + 2 ];
 
-		normals[ j++ ] = x;
-		normals[ j++ ] = y;
-		normals[ j++ ] = z;
+		normals[ j ++ ] = x;
+		normals[ j ++ ] = y;
+		normals[ j ++ ] = z;
 
 	}
 
@@ -133,8 +133,8 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 
 var DEFAULT_DECODE_PARAMS = {
 
-    decodeOffsets: [-4095, -4095, -4095, 0, 0, -511, -511, -511],
-    decodeScales: [1/8191, 1/8191, 1/8191, 1/1023, 1/1023, 1/1023, 1/1023, 1/1023]
+    decodeOffsets: [ -4095, -4095, -4095, 0, 0, -511, -511, -511 ],
+    decodeScales: [ 1 / 8191, 1 / 8191, 1 / 8191, 1 / 1023, 1 / 1023, 1 / 1023, 1 / 1023, 1 / 1023 ]
 
     // TODO: normal decoding? (see walt.js)
     // needs to know: input, output (from vertex format!)
@@ -212,13 +212,13 @@ THREE.UTF8Loader.prototype.decompressAABBs_ = function ( str, inputStart, numBBo
         var radiusY = (str.charCodeAt(i + 4) + 1) >> 1;
         var radiusZ = (str.charCodeAt(i + 5) + 1) >> 1;
 
-        bboxen[ outputStart++ ] = decodeScales[0] * (minX + radiusX);
-        bboxen[ outputStart++ ] = decodeScales[1] * (minY + radiusY);
-        bboxen[ outputStart++ ] = decodeScales[2] * (minZ + radiusZ);
+        bboxen[ outputStart ++ ] = decodeScales[0] * (minX + radiusX);
+        bboxen[ outputStart ++ ] = decodeScales[1] * (minY + radiusY);
+        bboxen[ outputStart ++ ] = decodeScales[2] * (minZ + radiusZ);
 
-        bboxen[ outputStart++ ] = decodeScales[0] * radiusX;
-        bboxen[ outputStart++ ] = decodeScales[1] * radiusY;
-        bboxen[ outputStart++ ] = decodeScales[2] * radiusZ;
+        bboxen[ outputStart ++ ] = decodeScales[0] * radiusX;
+        bboxen[ outputStart ++ ] = decodeScales[1] * radiusY;
+        bboxen[ outputStart ++ ] = decodeScales[2] * radiusZ;
 
     }
 
@@ -300,7 +300,7 @@ THREE.UTF8Loader.prototype.decodeAttrib2 = function ( str, stride, decodeOffsets
 
     for ( var j = 0; j < 5; j ++ ) {
 
-        var code = str.charCodeAt( deltaStart + numVerts*j + index );
+        var code = str.charCodeAt( deltaStart + numVerts * j + index );
         var delta = ( code >> 1) ^ (-(code & 1));
 
         lastAttrib[ j ] += delta;
@@ -312,17 +312,17 @@ THREE.UTF8Loader.prototype.decodeAttrib2 = function ( str, stride, decodeOffsets
 
 THREE.UTF8Loader.prototype.accumulateNormal = function ( i0, i1, i2, attribsOutFixed, crosses ) {
 
-    var p0x = attribsOutFixed[ 8*i0 ];
-    var p0y = attribsOutFixed[ 8*i0 + 1 ];
-    var p0z = attribsOutFixed[ 8*i0 + 2 ];
+    var p0x = attribsOutFixed[ 8 * i0 ];
+    var p0y = attribsOutFixed[ 8 * i0 + 1 ];
+    var p0z = attribsOutFixed[ 8 * i0 + 2 ];
 
-    var p1x = attribsOutFixed[ 8*i1 ];
-    var p1y = attribsOutFixed[ 8*i1 + 1 ];
-    var p1z = attribsOutFixed[ 8*i1 + 2 ];
+    var p1x = attribsOutFixed[ 8 * i1 ];
+    var p1y = attribsOutFixed[ 8 * i1 + 1 ];
+    var p1z = attribsOutFixed[ 8 * i1 + 2 ];
 
-    var p2x = attribsOutFixed[ 8*i2 ];
-    var p2y = attribsOutFixed[ 8*i2 + 1 ];
-    var p2z = attribsOutFixed[ 8*i2 + 2 ];
+    var p2x = attribsOutFixed[ 8 * i2 ];
+    var p2y = attribsOutFixed[ 8 * i2 + 1 ];
+    var p2z = attribsOutFixed[ 8 * i2 + 2 ];
 
     p1x -= p0x;
     p1y -= p0y;
@@ -332,21 +332,21 @@ THREE.UTF8Loader.prototype.accumulateNormal = function ( i0, i1, i2, attribsOutF
     p2y -= p0y;
     p2z -= p0z;
 
-    p0x = p1y*p2z - p1z*p2y;
-    p0y = p1z*p2x - p1x*p2z;
-    p0z = p1x*p2y - p1y*p2x;
+    p0x = p1y * p2z - p1z * p2y;
+    p0y = p1z * p2x - p1x * p2z;
+    p0z = p1x * p2y - p1y * p2x;
 
-    crosses[ 3*i0 ]     += p0x;
-    crosses[ 3*i0 + 1 ] += p0y;
-    crosses[ 3*i0 + 2 ] += p0z;
+    crosses[ 3 * i0 ]     += p0x;
+    crosses[ 3 * i0 + 1 ] += p0y;
+    crosses[ 3 * i0 + 2 ] += p0z;
 
-    crosses[ 3*i1 ]     += p0x;
-    crosses[ 3*i1 + 1 ] += p0y;
-    crosses[ 3*i1 + 2 ] += p0z;
+    crosses[ 3 * i1 ]     += p0x;
+    crosses[ 3 * i1 + 1 ] += p0y;
+    crosses[ 3 * i1 + 2 ] += p0z;
 
-    crosses[ 3*i2 ]     += p0x;
-    crosses[ 3*i2 + 1 ] += p0y;
-    crosses[ 3*i2 + 2 ] += p0z;
+    crosses[ 3 * i2 ]     += p0x;
+    crosses[ 3 * i2 + 1 ] += p0y;
+    crosses[ 3 * i2 + 2 ] += p0z;
 
 };
 
@@ -435,9 +435,9 @@ THREE.UTF8Loader.prototype.decompressMesh2 = function( str, meshParams, decodePa
                     var deltaCode = str.charCodeAt( deltaStart + numVerts * j + highest );
 
                     var prediction = ((deltaCode >> 1) ^ (-(deltaCode & 1))) +
-                        attribsOutFixed[stride*i0 + j] +
-                        attribsOutFixed[stride*i1 + j] -
-                        attribsOutFixed[stride*i2 + j];
+                        attribsOutFixed[stride * i0 + j] +
+                        attribsOutFixed[stride * i1 + j] -
+                        attribsOutFixed[stride * i2 + j];
 
                     lastAttrib[j] = prediction;
 
@@ -524,19 +524,19 @@ THREE.UTF8Loader.prototype.decompressMesh2 = function( str, meshParams, decodePa
 
     for ( var i = 0; i < numVerts; i ++ ) {
 
-        var nx = crosses[ 3*i ];
-        var ny = crosses[ 3*i + 1 ];
-        var nz = crosses[ 3*i + 2 ];
+        var nx = crosses[ 3 * i ];
+        var ny = crosses[ 3 * i + 1 ];
+        var nz = crosses[ 3 * i + 2 ];
 
-        var norm = 511.0 / Math.sqrt( nx*nx + ny*ny + nz*nz );
+        var norm = 511.0 / Math.sqrt( nx * nx + ny * ny + nz * nz );
 
-        var cx = str.charCodeAt( deltaStart + 5*numVerts + i );
-        var cy = str.charCodeAt( deltaStart + 6*numVerts + i );
-        var cz = str.charCodeAt( deltaStart + 7*numVerts + i );
+        var cx = str.charCodeAt( deltaStart + 5 * numVerts + i );
+        var cy = str.charCodeAt( deltaStart + 6 * numVerts + i );
+        var cz = str.charCodeAt( deltaStart + 7 * numVerts + i );
 
-        attribsOut[ stride*i + 5 ] = norm*nx + ((cx >> 1) ^ (-(cx & 1)));
-        attribsOut[ stride*i + 6 ] = norm*ny + ((cy >> 1) ^ (-(cy & 1)));
-        attribsOut[ stride*i + 7 ] = norm*nz + ((cz >> 1) ^ (-(cz & 1)));
+        attribsOut[ stride * i + 5 ] = norm * nx + ((cx >> 1) ^ (-(cx & 1)));
+        attribsOut[ stride * i + 6 ] = norm * ny + ((cy >> 1) ^ (-(cy & 1)));
+        attribsOut[ stride * i + 7 ] = norm * nz + ((cz >> 1) ^ (-(cz & 1)));
     }
 
     callback( name, idx, attribsOut, indicesOut, undefined, meshParams );
@@ -573,7 +573,7 @@ THREE.UTF8Loader.prototype.downloadMesh = function ( path, name, meshEntry, deco
                 loader.decompressMesh2( req.responseText, meshParams, decodeParams, name, idx, callback );
             }
 
-            ++idx;
+            ++ idx;
 
         }
 

+ 18 - 18
examples/js/loaders/VRMLLoader.js

@@ -123,7 +123,7 @@ THREE.VRMLLoader.prototype = {
 
 				var coord = [ ], aColor, bColor, t = 1, A = {}, B = {}, applyColor = false, colorIndex;
 
-				for ( var k = 0; k < angles.length; k++ ) {
+				for ( var k = 0; k < angles.length; k ++ ) {
 
 					var vec = { };
 
@@ -137,19 +137,19 @@ THREE.VRMLLoader.prototype = {
 				}
 
 				// painting the colors on the faces
-				for ( var i = 0; i < geometry.faces.length ; i++ ) {
+				for ( var i = 0; i < geometry.faces.length ; i ++ ) {
 
 					f  = geometry.faces[ i ];
 
 					n = ( f instanceof THREE.Face3 ) ? 3 : 4;
 
-					for ( var j = 0; j < n; j++ ) {
+					for ( var j = 0; j < n; j ++ ) {
 
 						vertexIndex = f[ faceIndices[ j ] ];
 
 						p = geometry.vertices[ vertexIndex ];
 
-						for ( var index = 0; index < colors.length; index++ ) {
+						for ( var index = 0; index < colors.length; index ++ ) {
 
 							// linear interpolation between aColor and bColor, calculate proportion
 							// A is previous point (angle)
@@ -160,8 +160,8 @@ THREE.VRMLLoader.prototype = {
 
 							} else {
 
-								A.x = coord[ index-1 ].x;
-								A.y = coord[ index-1 ].y;
+								A.x = coord[ index - 1 ].x;
+								A.y = coord[ index - 1 ].y;
 
 							}
 
@@ -188,7 +188,7 @@ THREE.VRMLLoader.prototype = {
 								}
 
 							} else if ( undefined === f.vertexColors[ j ] ) {
-								colorIndex = directionIsDown ? colors.length -1 : 0;
+								colorIndex = directionIsDown ? colors.length - 1 : 0;
 								f.vertexColors[ j ] = colors[ colorIndex ];
 
 							}
@@ -250,7 +250,7 @@ THREE.VRMLLoader.prototype = {
 					if (parts.length > 0) {
 						index = [];
 
-						for (var ind = 0;ind < parts.length; ind++) {
+						for (var ind = 0; ind < parts.length; ind ++) {
 
 							// the part should either be positive integer or -1
 							if (!/(-?\d+)/.test( parts[ind]) ) {
@@ -301,7 +301,7 @@ THREE.VRMLLoader.prototype = {
 					// the parts hold the angles as strings
 					if ( parts.length > 0 ) {
 
-						for ( var ind = 0;ind < parts.length; ind++ ) {
+						for ( var ind = 0; ind < parts.length; ind ++ ) {
 
 							// the part should be a float
 							if ( ! float_pattern.test( parts[ind] ) ) {
@@ -321,7 +321,7 @@ THREE.VRMLLoader.prototype = {
 
 				} else if (this.isRecordingColors) {
 
-					while( null !== ( parts = float3_pattern.exec(line) ) ) {
+					while ( null !== ( parts = float3_pattern.exec(line) ) ) {
 
 						color = {
 							r: parseFloat(parts[1]),
@@ -339,7 +339,7 @@ THREE.VRMLLoader.prototype = {
 						node[this.recordingFieldname] = this.colors;
 					}
 
-				} else if ( parts[parts.length -1] !== 'NULL' && fieldName !== 'children') {
+				} else if ( parts[parts.length - 1] !== 'NULL' && fieldName !== 'children') {
 
 					switch (fieldName) {
 
@@ -466,7 +466,7 @@ THREE.VRMLLoader.prototype = {
 
 					if ( matches = /([^\s]*){1}\s?{/.exec( line ) ) { // first subpattern should match the Node name
 
-						var block = { 'nodeType' : matches[1], 'string': line, 'parent': current, 'children': [],'comment' : comment};
+						var block = { 'nodeType' : matches[1], 'string': line, 'parent': current, 'children': [],'comment' : comment };
 						current.children.push( block );
 						current = block;
 
@@ -528,7 +528,7 @@ THREE.VRMLLoader.prototype = {
 									parent.material.side = THREE.DoubleSide;
 								}
 
-							} else if (defineKey){
+							} else if (defineKey) {
 
 								var object = defines[ defineKey ].clone();
 								parent.add( object );
@@ -660,7 +660,7 @@ THREE.VRMLLoader.prototype = {
 
 						var indexes;
 
-						for ( var i = 0, j = data.children.length; i < j; i++ ) {
+						for ( var i = 0, j = data.children.length; i < j; i ++ ) {
 
 							var child = data.children[ i ];
 
@@ -668,7 +668,7 @@ THREE.VRMLLoader.prototype = {
 
 							if ( 'Coordinate' === child.nodeType ) {
 
-								for ( var k = 0, l = child.points.length; k < l; k++ ) {
+								for ( var k = 0, l = child.points.length; k < l; k ++ ) {
 
 									var point = child.points[ k ];
 
@@ -684,7 +684,7 @@ THREE.VRMLLoader.prototype = {
 						var skip = 0;
 
 						// read this: http://math.hws.edu/eck/cs424/notes2013/16_Threejs_Advanced.html
-						for ( var i = 0, j = data.coordIndex.length; i < j; i++ ) {
+						for ( var i = 0, j = data.coordIndex.length; i < j; i ++ ) {
 
 							indexes = data.coordIndex[i];
 
@@ -694,7 +694,7 @@ THREE.VRMLLoader.prototype = {
 							// todo: this is the time to check if the faces are ordered ccw or not (cw)
 
 							// Face3 only works with triangles, but IndexedFaceSet allows shapes with more then three vertices, build them of triangles
-							while ( indexes.length >= 3 && skip < ( indexes.length -2 ) ) {
+							while ( indexes.length >= 3 && skip < ( indexes.length - 2 ) ) {
 
 								var face = new THREE.Face3(
 									indexes[0],
@@ -704,7 +704,7 @@ THREE.VRMLLoader.prototype = {
 									// todo: pass in the color, if a color index is present
 								);
 
-								skip++;
+								skip ++;
 
 								geometry.faces.push( face );
 

+ 1 - 1
examples/js/loaders/ctm/CTMLoader.js

@@ -126,7 +126,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 							scope.createModel( ctmFile, callback );
 
 							var e = Date.now();
-							console.log( "model load time [worker]: " + (e-e1) + " ms, total: " + (e-s));
+							console.log( "model load time [worker]: " + (e - e1) + " ms, total: " + (e - s));
 
 						}
 

+ 101 - 101
examples/js/loaders/ctm/ctm.js

@@ -45,11 +45,11 @@ CTM.Flags = {
   NORMALS: 0x00000001
 };
 
-CTM.File = function(stream){
+CTM.File = function(stream) {
   this.load(stream);
 };
 
-CTM.File.prototype.load = function(stream){
+CTM.File.prototype.load = function(stream) {
   this.header = new CTM.FileHeader(stream);
 
   this.body = new CTM.FileBody(this.header);
@@ -57,10 +57,10 @@ CTM.File.prototype.load = function(stream){
   this.getReader().read(stream, this.body);
 };
 
-CTM.File.prototype.getReader = function(){
+CTM.File.prototype.getReader = function() {
   var reader;
 
-  switch(this.header.compressionMethod){
+  switch (this.header.compressionMethod){
     case CTM.CompressionMethod.RAW:
       reader = new CTM.ReaderRAW();
       break;
@@ -75,7 +75,7 @@ CTM.File.prototype.getReader = function(){
   return reader;
 };
 
-CTM.FileHeader = function(stream){
+CTM.FileHeader = function(stream) {
   stream.readInt32(); //magic "OCTM"
   this.fileFormat = stream.readInt32();
   this.compressionMethod = stream.readInt32();
@@ -87,14 +87,14 @@ CTM.FileHeader = function(stream){
   this.comment = stream.readString();
 };
 
-CTM.FileHeader.prototype.hasNormals = function(){
+CTM.FileHeader.prototype.hasNormals = function() {
   return this.flags & CTM.Flags.NORMALS;
 };
 
-CTM.FileBody = function(header){
+CTM.FileBody = function(header) {
   var i = header.triangleCount * 3,
       v = header.vertexCount * 3,
-      n = header.hasNormals()? header.vertexCount * 3: 0,
+      n = header.hasNormals() ? header.vertexCount * 3 : 0,
       u = header.vertexCount * 2,
       a = header.vertexCount * 4,
       j = 0;
@@ -106,28 +106,28 @@ CTM.FileBody = function(header){
 
   this.vertices = new Float32Array(data, i * 4, v);
 
-  if ( header.hasNormals() ){
+  if ( header.hasNormals() ) {
     this.normals = new Float32Array(data, (i + v) * 4, n);
   }
   
-  if (header.uvMapCount){
+  if (header.uvMapCount) {
     this.uvMaps = [];
-    for (j = 0; j < header.uvMapCount; ++ j){
-      this.uvMaps[j] = {uv: new Float32Array(data,
+    for (j = 0; j < header.uvMapCount; ++ j) {
+      this.uvMaps[j] = { uv: new Float32Array(data,
         (i + v + n + (j * u) ) * 4, u) };
     }
   }
   
-  if (header.attrMapCount){
+  if (header.attrMapCount) {
     this.attrMaps = [];
-    for (j = 0; j < header.attrMapCount; ++ j){
-      this.attrMaps[j] = {attr: new Float32Array(data,
+    for (j = 0; j < header.attrMapCount; ++ j) {
+      this.attrMaps[j] = { attr: new Float32Array(data,
         (i + v + n + (u * header.uvMapCount) + (j * a) ) * 4, a) };
     }
   }
 };
 
-CTM.FileMG2Header = function(stream){
+CTM.FileMG2Header = function(stream) {
   stream.readInt32(); //magic "MG2H"
   this.vertexPrecision = stream.readFloat32();
   this.normalPrecision = stream.readFloat32();
@@ -146,42 +146,42 @@ CTM.FileMG2Header = function(stream){
   this.sizez = (this.higherBoundz - this.lowerBoundz) / this.divz;
 };
 
-CTM.ReaderRAW = function(){
+CTM.ReaderRAW = function() {
 };
 
-CTM.ReaderRAW.prototype.read = function(stream, body){
+CTM.ReaderRAW.prototype.read = function(stream, body) {
   this.readIndices(stream, body.indices);
   this.readVertices(stream, body.vertices);
   
-  if (body.normals){
+  if (body.normals) {
     this.readNormals(stream, body.normals);
   }
-  if (body.uvMaps){
+  if (body.uvMaps) {
     this.readUVMaps(stream, body.uvMaps);
   }
-  if (body.attrMaps){
+  if (body.attrMaps) {
     this.readAttrMaps(stream, body.attrMaps);
   }
 };
 
-CTM.ReaderRAW.prototype.readIndices = function(stream, indices){
+CTM.ReaderRAW.prototype.readIndices = function(stream, indices) {
   stream.readInt32(); //magic "INDX"
   stream.readArrayInt32(indices);
 };
 
-CTM.ReaderRAW.prototype.readVertices = function(stream, vertices){
+CTM.ReaderRAW.prototype.readVertices = function(stream, vertices) {
   stream.readInt32(); //magic "VERT"
   stream.readArrayFloat32(vertices);
 };
 
-CTM.ReaderRAW.prototype.readNormals = function(stream, normals){
+CTM.ReaderRAW.prototype.readNormals = function(stream, normals) {
   stream.readInt32(); //magic "NORM"
   stream.readArrayFloat32(normals);
 };
 
-CTM.ReaderRAW.prototype.readUVMaps = function(stream, uvMaps){
+CTM.ReaderRAW.prototype.readUVMaps = function(stream, uvMaps) {
   var i = 0;
-  for (; i < uvMaps.length; ++ i){
+  for (; i < uvMaps.length; ++ i) {
     stream.readInt32(); //magic "TEXC"
 
     uvMaps[i].name = stream.readString();
@@ -190,9 +190,9 @@ CTM.ReaderRAW.prototype.readUVMaps = function(stream, uvMaps){
   }
 };
 
-CTM.ReaderRAW.prototype.readAttrMaps = function(stream, attrMaps){
+CTM.ReaderRAW.prototype.readAttrMaps = function(stream, attrMaps) {
   var i = 0;
-  for (; i < attrMaps.length; ++ i){
+  for (; i < attrMaps.length; ++ i) {
     stream.readInt32(); //magic "ATTR"
 
     attrMaps[i].name = stream.readString();
@@ -200,25 +200,25 @@ CTM.ReaderRAW.prototype.readAttrMaps = function(stream, attrMaps){
   }
 };
 
-CTM.ReaderMG1 = function(){
+CTM.ReaderMG1 = function() {
 };
 
-CTM.ReaderMG1.prototype.read = function(stream, body){
+CTM.ReaderMG1.prototype.read = function(stream, body) {
   this.readIndices(stream, body.indices);
   this.readVertices(stream, body.vertices);
   
-  if (body.normals){
+  if (body.normals) {
     this.readNormals(stream, body.normals);
   }
-  if (body.uvMaps){
+  if (body.uvMaps) {
     this.readUVMaps(stream, body.uvMaps);
   }
-  if (body.attrMaps){
+  if (body.attrMaps) {
     this.readAttrMaps(stream, body.attrMaps);
   }
 };
 
-CTM.ReaderMG1.prototype.readIndices = function(stream, indices){
+CTM.ReaderMG1.prototype.readIndices = function(stream, indices) {
   stream.readInt32(); //magic "INDX"
   stream.readInt32(); //packed size
   
@@ -228,7 +228,7 @@ CTM.ReaderMG1.prototype.readIndices = function(stream, indices){
   CTM.restoreIndices(indices, indices.length);
 };
 
-CTM.ReaderMG1.prototype.readVertices = function(stream, vertices){
+CTM.ReaderMG1.prototype.readVertices = function(stream, vertices) {
   stream.readInt32(); //magic "VERT"
   stream.readInt32(); //packed size
   
@@ -236,7 +236,7 @@ CTM.ReaderMG1.prototype.readVertices = function(stream, vertices){
   LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
 };
 
-CTM.ReaderMG1.prototype.readNormals = function(stream, normals){
+CTM.ReaderMG1.prototype.readNormals = function(stream, normals) {
   stream.readInt32(); //magic "NORM"
   stream.readInt32(); //packed size
 
@@ -244,9 +244,9 @@ CTM.ReaderMG1.prototype.readNormals = function(stream, normals){
   LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
 };
 
-CTM.ReaderMG1.prototype.readUVMaps = function(stream, uvMaps){
+CTM.ReaderMG1.prototype.readUVMaps = function(stream, uvMaps) {
   var i = 0;
-  for (; i < uvMaps.length; ++ i){
+  for (; i < uvMaps.length; ++ i) {
     stream.readInt32(); //magic "TEXC"
 
     uvMaps[i].name = stream.readString();
@@ -259,9 +259,9 @@ CTM.ReaderMG1.prototype.readUVMaps = function(stream, uvMaps){
   }
 };
 
-CTM.ReaderMG1.prototype.readAttrMaps = function(stream, attrMaps){
+CTM.ReaderMG1.prototype.readAttrMaps = function(stream, attrMaps) {
   var i = 0;
-  for (; i < attrMaps.length; ++ i){
+  for (; i < attrMaps.length; ++ i) {
     stream.readInt32(); //magic "ATTR"
 
     attrMaps[i].name = stream.readString();
@@ -273,27 +273,27 @@ CTM.ReaderMG1.prototype.readAttrMaps = function(stream, attrMaps){
   }
 };
 
-CTM.ReaderMG2 = function(){
+CTM.ReaderMG2 = function() {
 };
 
-CTM.ReaderMG2.prototype.read = function(stream, body){
+CTM.ReaderMG2.prototype.read = function(stream, body) {
   this.MG2Header = new CTM.FileMG2Header(stream);
   
   this.readVertices(stream, body.vertices);
   this.readIndices(stream, body.indices);
   
-  if (body.normals){
+  if (body.normals) {
     this.readNormals(stream, body);
   }
-  if (body.uvMaps){
+  if (body.uvMaps) {
     this.readUVMaps(stream, body.uvMaps);
   }
-  if (body.attrMaps){
+  if (body.attrMaps) {
     this.readAttrMaps(stream, body.attrMaps);
   }
 };
 
-CTM.ReaderMG2.prototype.readVertices = function(stream, vertices){
+CTM.ReaderMG2.prototype.readVertices = function(stream, vertices) {
   stream.readInt32(); //magic "VERT"
   stream.readInt32(); //packed size
 
@@ -305,7 +305,7 @@ CTM.ReaderMG2.prototype.readVertices = function(stream, vertices){
   CTM.restoreVertices(vertices, this.MG2Header, gridIndices, this.MG2Header.vertexPrecision);
 };
 
-CTM.ReaderMG2.prototype.readGridIndices = function(stream, vertices){
+CTM.ReaderMG2.prototype.readGridIndices = function(stream, vertices) {
   stream.readInt32(); //magic "GIDX"
   stream.readInt32(); //packed size
   
@@ -319,7 +319,7 @@ CTM.ReaderMG2.prototype.readGridIndices = function(stream, vertices){
   return gridIndices;
 };
 
-CTM.ReaderMG2.prototype.readIndices = function(stream, indices){
+CTM.ReaderMG2.prototype.readIndices = function(stream, indices) {
   stream.readInt32(); //magic "INDX"
   stream.readInt32(); //packed size
 
@@ -329,7 +329,7 @@ CTM.ReaderMG2.prototype.readIndices = function(stream, indices){
   CTM.restoreIndices(indices, indices.length);
 };
 
-CTM.ReaderMG2.prototype.readNormals = function(stream, body){
+CTM.ReaderMG2.prototype.readNormals = function(stream, body) {
   stream.readInt32(); //magic "NORM"
   stream.readInt32(); //packed size
 
@@ -341,9 +341,9 @@ CTM.ReaderMG2.prototype.readNormals = function(stream, body){
   CTM.restoreNormals(body.normals, smooth, this.MG2Header.normalPrecision);
 };
 
-CTM.ReaderMG2.prototype.readUVMaps = function(stream, uvMaps){
+CTM.ReaderMG2.prototype.readUVMaps = function(stream, uvMaps) {
   var i = 0;
-  for (; i < uvMaps.length; ++ i){
+  for (; i < uvMaps.length; ++ i) {
     stream.readInt32(); //magic "TEXC"
 
     uvMaps[i].name = stream.readString();
@@ -360,9 +360,9 @@ CTM.ReaderMG2.prototype.readUVMaps = function(stream, uvMaps){
   }
 };
 
-CTM.ReaderMG2.prototype.readAttrMaps = function(stream, attrMaps){
+CTM.ReaderMG2.prototype.readAttrMaps = function(stream, attrMaps) {
   var i = 0;
-  for (; i < attrMaps.length; ++ i){
+  for (; i < attrMaps.length; ++ i) {
     stream.readInt32(); //magic "ATTR"
 
     attrMaps[i].name = stream.readString();
@@ -378,18 +378,18 @@ CTM.ReaderMG2.prototype.readAttrMaps = function(stream, attrMaps){
   }
 };
 
-CTM.restoreIndices = function(indices, len){
+CTM.restoreIndices = function(indices, len) {
   var i = 3;
-  if (len > 0){
+  if (len > 0) {
     indices[2] += indices[0];
     indices[1] += indices[0];
   }
-  for (; i < len; i += 3){
+  for (; i < len; i += 3) {
     indices[i] += indices[i - 3];
     
-    if (indices[i] === indices[i - 3]){
+    if (indices[i] === indices[i - 3]) {
       indices[i + 1] += indices[i - 2];
-    }else{
+    }else {
       indices[i + 1] += indices[i];
     }
 
@@ -397,21 +397,21 @@ CTM.restoreIndices = function(indices, len){
   }
 };
 
-CTM.restoreGridIndices = function(gridIndices, len){
+CTM.restoreGridIndices = function(gridIndices, len) {
   var i = 1;
-  for (; i < len; ++ i){
+  for (; i < len; ++ i) {
     gridIndices[i] += gridIndices[i - 1];
   }
 };
 
-CTM.restoreVertices = function(vertices, grid, gridIndices, precision){
+CTM.restoreVertices = function(vertices, grid, gridIndices, precision) {
   var gridIdx, delta, x, y, z,
       intVertices = new Uint32Array(vertices.buffer, vertices.byteOffset, vertices.length),
       ydiv = grid.divx, zdiv = ydiv * grid.divy,
       prevGridIdx = 0x7fffffff, prevDelta = 0,
       i = 0, j = 0, len = gridIndices.length;
 
-  for (; i < len; j += 3){
+  for (; i < len; j += 3) {
     x = gridIdx = gridIndices[i ++];
     
     z = ~~(x / zdiv);
@@ -420,7 +420,7 @@ CTM.restoreVertices = function(vertices, grid, gridIndices, precision){
     x -= ~~(y * ydiv);
 
     delta = intVertices[j];
-    if (gridIdx === prevGridIdx){
+    if (gridIdx === prevGridIdx) {
       delta += prevDelta;
     }
 
@@ -436,26 +436,26 @@ CTM.restoreVertices = function(vertices, grid, gridIndices, precision){
   }
 };
 
-CTM.restoreNormals = function(normals, smooth, precision){
+CTM.restoreNormals = function(normals, smooth, precision) {
   var ro, phi, theta, sinPhi,
       nx, ny, nz, by, bz, len,
       intNormals = new Uint32Array(normals.buffer, normals.byteOffset, normals.length),
       i = 0, k = normals.length,
       PI_DIV_2 = 3.141592653589793238462643 * 0.5;
 
-  for (; i < k; i += 3){
+  for (; i < k; i += 3) {
     ro = intNormals[i] * precision;
     phi = intNormals[i + 1];
 
-    if (phi === 0){
+    if (phi === 0) {
       normals[i]     = smooth[i]     * ro;
       normals[i + 1] = smooth[i + 1] * ro;
       normals[i + 2] = smooth[i + 2] * ro;
-    }else{
+    }else {
       
-      if (phi <= 4){
+      if (phi <= 4) {
         theta = (intNormals[i + 2] - 2) * PI_DIV_2;
-      }else{
+      }else {
         theta = ( (intNormals[i + 2] * 4 / phi) - 2) * PI_DIV_2;
       }
       
@@ -470,7 +470,7 @@ CTM.restoreNormals = function(normals, smooth, precision){
       by = smooth[i] - smooth[i + 2];
 
       len = Math.sqrt(2 * bz * bz + by * by);
-      if (len > 1e-20){
+      if (len > 1e-20) {
         by /= len;
         bz /= len;
       }
@@ -485,31 +485,31 @@ CTM.restoreNormals = function(normals, smooth, precision){
   }
 };
 
-CTM.restoreMap = function(map, count, precision){
+CTM.restoreMap = function(map, count, precision) {
   var delta, value,
       intMap = new Uint32Array(map.buffer, map.byteOffset, map.length),
       i = 0, j, len = map.length;
 
-  for (; i < count; ++ i){
+  for (; i < count; ++ i) {
     delta = 0;
 
-    for (j = i; j < len; j += count){
+    for (j = i; j < len; j += count) {
       value = intMap[j];
       
-      delta += value & 1? -( (value + 1) >> 1): value >> 1;
+      delta += value & 1 ? -( (value + 1) >> 1) : value >> 1;
       
       map[j] = delta * precision;
     }
   }
 };
 
-CTM.calcSmoothNormals = function(indices, vertices){
+CTM.calcSmoothNormals = function(indices, vertices) {
   var smooth = new Float32Array(vertices.length),
       indx, indy, indz, nx, ny, nz,
       v1x, v1y, v1z, v2x, v2y, v2z, len,
       i, k;
 
-  for (i = 0, k = indices.length; i < k;){
+  for (i = 0, k = indices.length; i < k;) {
     indx = indices[i ++] * 3;
     indy = indices[i ++] * 3;
     indz = indices[i ++] * 3;
@@ -526,7 +526,7 @@ CTM.calcSmoothNormals = function(indices, vertices){
     nz = v1x * v2y - v1y * v2x;
     
     len = Math.sqrt(nx * nx + ny * ny + nz * nz);
-    if (len > 1e-10){
+    if (len > 1e-10) {
       nx /= len;
       ny /= len;
       nz /= len;
@@ -543,12 +543,12 @@ CTM.calcSmoothNormals = function(indices, vertices){
     smooth[indz + 2] += nz;
   }
 
-  for (i = 0, k = smooth.length; i < k; i += 3){
+  for (i = 0, k = smooth.length; i < k; i += 3) {
     len = Math.sqrt(smooth[i] * smooth[i] + 
       smooth[i + 1] * smooth[i + 1] +
       smooth[i + 2] * smooth[i + 2]);
 
-    if(len > 1e-10){
+    if (len > 1e-10) {
       smooth[i]     /= len;
       smooth[i + 1] /= len;
       smooth[i + 2] /= len;
@@ -558,7 +558,7 @@ CTM.calcSmoothNormals = function(indices, vertices){
   return smooth;
 };
 
-CTM.isLittleEndian = (function(){
+CTM.isLittleEndian = (function() {
   var buffer = new ArrayBuffer(2),
       bytes = new Uint8Array(buffer),
       ints = new Uint16Array(buffer);
@@ -568,28 +568,28 @@ CTM.isLittleEndian = (function(){
   return ints[0] === 1;
 }());
 
-CTM.InterleavedStream = function(data, count){
+CTM.InterleavedStream = function(data, count) {
   this.data = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
-  this.offset = CTM.isLittleEndian? 3: 0;
+  this.offset = CTM.isLittleEndian ? 3 : 0;
   this.count = count * 4;
   this.len = this.data.length;
 };
 
-CTM.InterleavedStream.prototype.writeByte = function(value){
+CTM.InterleavedStream.prototype.writeByte = function(value) {
   this.data[this.offset] = value;
   
   this.offset += this.count;
-  if (this.offset >= this.len){
+  if (this.offset >= this.len) {
   
     this.offset -= this.len - 4;
-    if (this.offset >= this.count){
+    if (this.offset >= this.count) {
     
-      this.offset -= this.count + (CTM.isLittleEndian? 1: -1);
+      this.offset -= this.count + (CTM.isLittleEndian ? 1 : -1);
     }
   }
 };
 
-CTM.Stream = function(data){
+CTM.Stream = function(data) {
   this.data = data;
   this.offset = 0;
 };
@@ -598,18 +598,18 @@ CTM.Stream.prototype.TWO_POW_MINUS23 = Math.pow(2, -23);
 
 CTM.Stream.prototype.TWO_POW_MINUS126 = Math.pow(2, -126);
 
-CTM.Stream.prototype.readByte = function(){
+CTM.Stream.prototype.readByte = function() {
   return this.data[this.offset ++] & 0xff;
 };
 
-CTM.Stream.prototype.readInt32 = function(){
+CTM.Stream.prototype.readInt32 = function() {
   var i = this.readByte();
   i |= this.readByte() << 8;
   i |= this.readByte() << 16;
   return i | (this.readByte() << 24);
 };
 
-CTM.Stream.prototype.readFloat32 = function(){
+CTM.Stream.prototype.readFloat32 = function() {
   var m = this.readByte();
   m += this.readByte() << 8;
 
@@ -618,42 +618,42 @@ CTM.Stream.prototype.readFloat32 = function(){
 
   m += (b1 & 0x7f) << 16; 
   var e = ( (b2 & 0x7f) << 1) | ( (b1 & 0x80) >>> 7);
-  var s = b2 & 0x80? -1: 1;
+  var s = b2 & 0x80 ? -1 : 1;
 
-  if (e === 255){
-    return m !== 0? NaN: s * Infinity;
+  if (e === 255) {
+    return m !== 0 ? NaN : s * Infinity;
   }
-  if (e > 0){
+  if (e > 0) {
     return s * (1 + (m * this.TWO_POW_MINUS23) ) * Math.pow(2, e - 127);
   }
-  if (m !== 0){
+  if (m !== 0) {
     return s * m * this.TWO_POW_MINUS126;
   }
   return s * 0;
 };
 
-CTM.Stream.prototype.readString = function(){
+CTM.Stream.prototype.readString = function() {
   var len = this.readInt32();
 
   this.offset += len;
 
-  return String.fromCharCode.apply(null,this.data.subarray(this.offset - len, this.offset));
+  return String.fromCharCode.apply(null, this.data.subarray(this.offset - len, this.offset));
 };
 
-CTM.Stream.prototype.readArrayInt32 = function(array){
+CTM.Stream.prototype.readArrayInt32 = function(array) {
   var i = 0, len = array.length;
   
-  while(i < len){
+  while (i < len) {
     array[i ++] = this.readInt32();
   }
 
   return array;
 };
 
-CTM.Stream.prototype.readArrayFloat32 = function(array){
+CTM.Stream.prototype.readArrayFloat32 = function(array) {
   var i = 0, len = array.length;
 
-  while(i < len){
+  while (i < len) {
     array[i ++] = this.readFloat32();
   }
 

+ 109 - 109
examples/js/loaders/ctm/lzma.js

@@ -8,12 +8,12 @@ if ( typeof module === 'object' ) {
 
 }
 
-LZMA.OutWindow = function(){
+LZMA.OutWindow = function() {
   this._windowSize = 0;
 };
 
-LZMA.OutWindow.prototype.create = function(windowSize){
-  if ( (!this._buffer) || (this._windowSize !== windowSize) ){
+LZMA.OutWindow.prototype.create = function(windowSize) {
+  if ( (!this._buffer) || (this._windowSize !== windowSize) ) {
     this._buffer = [];
   }
   this._windowSize = windowSize;
@@ -21,99 +21,99 @@ LZMA.OutWindow.prototype.create = function(windowSize){
   this._streamPos = 0;
 };
 
-LZMA.OutWindow.prototype.flush = function(){
+LZMA.OutWindow.prototype.flush = function() {
   var size = this._pos - this._streamPos;
-  if (size !== 0){
-    while(size --){
+  if (size !== 0) {
+    while (size --) {
       this._stream.writeByte(this._buffer[this._streamPos ++]);
     }
-    if (this._pos >= this._windowSize){
+    if (this._pos >= this._windowSize) {
       this._pos = 0;
     }
     this._streamPos = this._pos;
   }
 };
 
-LZMA.OutWindow.prototype.releaseStream = function(){
+LZMA.OutWindow.prototype.releaseStream = function() {
   this.flush();
   this._stream = null;
 };
 
-LZMA.OutWindow.prototype.setStream = function(stream){
+LZMA.OutWindow.prototype.setStream = function(stream) {
   this.releaseStream();
   this._stream = stream;
 };
 
-LZMA.OutWindow.prototype.init = function(solid){
-  if (!solid){
+LZMA.OutWindow.prototype.init = function(solid) {
+  if (!solid) {
     this._streamPos = 0;
     this._pos = 0;
   }
 };
 
-LZMA.OutWindow.prototype.copyBlock = function(distance, len){
+LZMA.OutWindow.prototype.copyBlock = function(distance, len) {
   var pos = this._pos - distance - 1;
-  if (pos < 0){
+  if (pos < 0) {
     pos += this._windowSize;
   }
-  while(len --){
-    if (pos >= this._windowSize){
+  while (len --) {
+    if (pos >= this._windowSize) {
       pos = 0;
     }
     this._buffer[this._pos ++] = this._buffer[pos ++];
-    if (this._pos >= this._windowSize){
+    if (this._pos >= this._windowSize) {
       this.flush();
     }
   }
 };
 
-LZMA.OutWindow.prototype.putByte = function(b){
+LZMA.OutWindow.prototype.putByte = function(b) {
   this._buffer[this._pos ++] = b;
-  if (this._pos >= this._windowSize){
+  if (this._pos >= this._windowSize) {
     this.flush();
   }
 };
 
-LZMA.OutWindow.prototype.getByte = function(distance){
+LZMA.OutWindow.prototype.getByte = function(distance) {
   var pos = this._pos - distance - 1;
-  if (pos < 0){
+  if (pos < 0) {
     pos += this._windowSize;
   }
   return this._buffer[pos];
 };
 
-LZMA.RangeDecoder = function(){
+LZMA.RangeDecoder = function() {
 };
 
-LZMA.RangeDecoder.prototype.setStream = function(stream){
+LZMA.RangeDecoder.prototype.setStream = function(stream) {
   this._stream = stream;
 };
 
-LZMA.RangeDecoder.prototype.releaseStream = function(){
+LZMA.RangeDecoder.prototype.releaseStream = function() {
   this._stream = null;
 };
 
-LZMA.RangeDecoder.prototype.init = function(){
+LZMA.RangeDecoder.prototype.init = function() {
   var i = 5;
 
   this._code = 0;
   this._range = -1;
   
-  while(i --){
+  while (i --) {
     this._code = (this._code << 8) | this._stream.readByte();
   }
 };
 
-LZMA.RangeDecoder.prototype.decodeDirectBits = function(numTotalBits){
+LZMA.RangeDecoder.prototype.decodeDirectBits = function(numTotalBits) {
   var result = 0, i = numTotalBits, t;
 
-  while(i --){
+  while (i --) {
     this._range >>>= 1;
     t = (this._code - this._range) >>> 31;
     this._code -= this._range & (t - 1);
     result = (result << 1) | (1 - t);
 
-    if ( (this._range & 0xff000000) === 0){
+    if ( (this._range & 0xff000000) === 0) {
       this._code = (this._code << 8) | this._stream.readByte();
       this._range <<= 8;
     }
@@ -122,14 +122,14 @@ LZMA.RangeDecoder.prototype.decodeDirectBits = function(numTotalBits){
   return result;
 };
 
-LZMA.RangeDecoder.prototype.decodeBit = function(probs, index){
+LZMA.RangeDecoder.prototype.decodeBit = function(probs, index) {
   var prob = probs[index],
       newBound = (this._range >>> 11) * prob;
 
-  if ( (this._code ^ 0x80000000) < (newBound ^ 0x80000000) ){
+  if ( (this._code ^ 0x80000000) < (newBound ^ 0x80000000) ) {
     this._range = newBound;
     probs[index] += (2048 - prob) >>> 5;
-    if ( (this._range & 0xff000000) === 0){
+    if ( (this._range & 0xff000000) === 0) {
       this._code = (this._code << 8) | this._stream.readByte();
       this._range <<= 8;
     }
@@ -139,41 +139,41 @@ LZMA.RangeDecoder.prototype.decodeBit = function(probs, index){
   this._range -= newBound;
   this._code -= newBound;
   probs[index] -= prob >>> 5;
-  if ( (this._range & 0xff000000) === 0){
+  if ( (this._range & 0xff000000) === 0) {
     this._code = (this._code << 8) | this._stream.readByte();
     this._range <<= 8;
   }
   return 1;
 };
 
-LZMA.initBitModels = function(probs, len){
-  while(len --){
+LZMA.initBitModels = function(probs, len) {
+  while (len --) {
     probs[len] = 1024;
   }
 };
 
-LZMA.BitTreeDecoder = function(numBitLevels){
+LZMA.BitTreeDecoder = function(numBitLevels) {
   this._models = [];
   this._numBitLevels = numBitLevels;
 };
 
-LZMA.BitTreeDecoder.prototype.init = function(){
+LZMA.BitTreeDecoder.prototype.init = function() {
   LZMA.initBitModels(this._models, 1 << this._numBitLevels);
 };
 
-LZMA.BitTreeDecoder.prototype.decode = function(rangeDecoder){
+LZMA.BitTreeDecoder.prototype.decode = function(rangeDecoder) {
   var m = 1, i = this._numBitLevels;
 
-  while(i --){
+  while (i --) {
     m = (m << 1) | rangeDecoder.decodeBit(this._models, m);
   }
   return m - (1 << this._numBitLevels);
 };
 
-LZMA.BitTreeDecoder.prototype.reverseDecode = function(rangeDecoder){
+LZMA.BitTreeDecoder.prototype.reverseDecode = function(rangeDecoder) {
   var m = 1, symbol = 0, i = 0, bit;
 
-  for (; i < this._numBitLevels; ++ i){
+  for (; i < this._numBitLevels; ++ i) {
     bit = rangeDecoder.decodeBit(this._models, m);
     m = (m << 1) | bit;
     symbol |= bit << i;
@@ -181,10 +181,10 @@ LZMA.BitTreeDecoder.prototype.reverseDecode = function(rangeDecoder){
   return symbol;
 };
 
-LZMA.reverseDecode2 = function(models, startIndex, rangeDecoder, numBitLevels){
+LZMA.reverseDecode2 = function(models, startIndex, rangeDecoder, numBitLevels) {
   var m = 1, symbol = 0, i = 0, bit;
 
-  for (; i < numBitLevels; ++ i){
+  for (; i < numBitLevels; ++ i) {
     bit = rangeDecoder.decodeBit(models, startIndex + m);
     m = (m << 1) | bit;
     symbol |= bit << i;
@@ -192,7 +192,7 @@ LZMA.reverseDecode2 = function(models, startIndex, rangeDecoder, numBitLevels){
   return symbol;
 };
 
-LZMA.LenDecoder = function(){
+LZMA.LenDecoder = function() {
   this._choice = [];
   this._lowCoder = [];
   this._midCoder = [];
@@ -200,79 +200,79 @@ LZMA.LenDecoder = function(){
   this._numPosStates = 0;
 };
 
-LZMA.LenDecoder.prototype.create = function(numPosStates){
-  for (; this._numPosStates < numPosStates; ++ this._numPosStates){
+LZMA.LenDecoder.prototype.create = function(numPosStates) {
+  for (; this._numPosStates < numPosStates; ++ this._numPosStates) {
     this._lowCoder[this._numPosStates] = new LZMA.BitTreeDecoder(3);
     this._midCoder[this._numPosStates] = new LZMA.BitTreeDecoder(3);
   }
 };
 
-LZMA.LenDecoder.prototype.init = function(){
+LZMA.LenDecoder.prototype.init = function() {
   var i = this._numPosStates;
   LZMA.initBitModels(this._choice, 2);
-  while(i --){
+  while (i --) {
     this._lowCoder[i].init();
     this._midCoder[i].init();
   }
   this._highCoder.init();
 };
 
-LZMA.LenDecoder.prototype.decode = function(rangeDecoder, posState){
-  if (rangeDecoder.decodeBit(this._choice, 0) === 0){
+LZMA.LenDecoder.prototype.decode = function(rangeDecoder, posState) {
+  if (rangeDecoder.decodeBit(this._choice, 0) === 0) {
     return this._lowCoder[posState].decode(rangeDecoder);
   }
-  if (rangeDecoder.decodeBit(this._choice, 1) === 0){
+  if (rangeDecoder.decodeBit(this._choice, 1) === 0) {
     return 8 + this._midCoder[posState].decode(rangeDecoder);
   }
   return 16 + this._highCoder.decode(rangeDecoder);
 };
 
-LZMA.Decoder2 = function(){
+LZMA.Decoder2 = function() {
   this._decoders = [];
 };
 
-LZMA.Decoder2.prototype.init = function(){
+LZMA.Decoder2.prototype.init = function() {
   LZMA.initBitModels(this._decoders, 0x300);
 };
 
-LZMA.Decoder2.prototype.decodeNormal = function(rangeDecoder){
+LZMA.Decoder2.prototype.decodeNormal = function(rangeDecoder) {
   var symbol = 1;
 
-  do{
+  do {
     symbol = (symbol << 1) | rangeDecoder.decodeBit(this._decoders, symbol);
-  }while(symbol < 0x100);
+  }while (symbol < 0x100);
 
   return symbol & 0xff;
 };
 
-LZMA.Decoder2.prototype.decodeWithMatchByte = function(rangeDecoder, matchByte){
+LZMA.Decoder2.prototype.decodeWithMatchByte = function(rangeDecoder, matchByte) {
   var symbol = 1, matchBit, bit;
 
-  do{
+  do {
     matchBit = (matchByte >> 7) & 1;
     matchByte <<= 1;
     bit = rangeDecoder.decodeBit(this._decoders, ( (1 + matchBit) << 8) + symbol);
     symbol = (symbol << 1) | bit;
-    if (matchBit !== bit){
-      while(symbol < 0x100){
+    if (matchBit !== bit) {
+      while (symbol < 0x100) {
         symbol = (symbol << 1) | rangeDecoder.decodeBit(this._decoders, symbol);
       }
       break;
     }
-  }while(symbol < 0x100);
+  }while (symbol < 0x100);
 
   return symbol & 0xff;
 };
 
-LZMA.LiteralDecoder = function(){
+LZMA.LiteralDecoder = function() {
 };
 
-LZMA.LiteralDecoder.prototype.create = function(numPosBits, numPrevBits){
+LZMA.LiteralDecoder.prototype.create = function(numPosBits, numPrevBits) {
   var i;
 
   if (this._coders
     && (this._numPrevBits === numPrevBits)
-    && (this._numPosBits === numPosBits) ){
+    && (this._numPosBits === numPosBits) ) {
     return;
   }
   this._numPosBits = numPosBits;
@@ -282,24 +282,24 @@ LZMA.LiteralDecoder.prototype.create = function(numPosBits, numPrevBits){
   this._coders = [];
 
   i = 1 << (this._numPrevBits + this._numPosBits);
-  while(i --){
+  while (i --) {
     this._coders[i] = new LZMA.Decoder2();
   }
 };
 
-LZMA.LiteralDecoder.prototype.init = function(){
+LZMA.LiteralDecoder.prototype.init = function() {
   var i = 1 << (this._numPrevBits + this._numPosBits);
-  while(i --){
+  while (i --) {
     this._coders[i].init();
   }
 };
 
-LZMA.LiteralDecoder.prototype.getDecoder = function(pos, prevByte){
+LZMA.LiteralDecoder.prototype.getDecoder = function(pos, prevByte) {
   return this._coders[( (pos & this._posMask) << this._numPrevBits)
     + ( (prevByte & 0xff) >>> (8 - this._numPrevBits) )];
 };
 
-LZMA.Decoder = function(){
+LZMA.Decoder = function() {
   this._outWindow = new LZMA.OutWindow();
   this._rangeDecoder = new LZMA.RangeDecoder();
   this._isMatchDecoders = [];
@@ -323,11 +323,11 @@ LZMA.Decoder = function(){
   this._posSlotDecoder[3] = new LZMA.BitTreeDecoder(6);
 };
 
-LZMA.Decoder.prototype.setDictionarySize = function(dictionarySize){
-  if (dictionarySize < 0){
+LZMA.Decoder.prototype.setDictionarySize = function(dictionarySize) {
+  if (dictionarySize < 0) {
     return false;
   }
-  if (this._dictionarySize !== dictionarySize){
+  if (this._dictionarySize !== dictionarySize) {
     this._dictionarySize = dictionarySize;
     this._dictionarySizeCheck = Math.max(this._dictionarySize, 1);
     this._outWindow.create( Math.max(this._dictionarySizeCheck, 4096) );
@@ -335,10 +335,10 @@ LZMA.Decoder.prototype.setDictionarySize = function(dictionarySize){
   return true;
 };
 
-LZMA.Decoder.prototype.setLcLpPb = function(lc, lp, pb){
+LZMA.Decoder.prototype.setLcLpPb = function(lc, lp, pb) {
   var numPosStates = 1 << pb;
 
-  if (lc > 8 || lp > 4 || pb > 4){
+  if (lc > 8 || lp > 4 || pb > 4) {
     return false;
   }
 
@@ -351,7 +351,7 @@ LZMA.Decoder.prototype.setLcLpPb = function(lc, lp, pb){
   return true;
 };
 
-LZMA.Decoder.prototype.init = function(){
+LZMA.Decoder.prototype.init = function() {
   var i = 4;
 
   this._outWindow.init(false);
@@ -366,7 +366,7 @@ LZMA.Decoder.prototype.init = function(){
 
   this._literalDecoder.init();
 
-  while(i --){
+  while (i --) {
     this._posSlotDecoder[i].init();
   }
 
@@ -376,7 +376,7 @@ LZMA.Decoder.prototype.init = function(){
   this._rangeDecoder.init();
 };
 
-LZMA.Decoder.prototype.decode = function(inStream, outStream, outSize){
+LZMA.Decoder.prototype.decode = function(inStream, outStream, outSize) {
   var state = 0, rep0 = 0, rep1 = 0, rep2 = 0, rep3 = 0, nowPos64 = 0, prevByte = 0,
       posState, decoder2, len, distance, posSlot, numDirectBits;
 
@@ -385,37 +385,37 @@ LZMA.Decoder.prototype.decode = function(inStream, outStream, outSize){
 
   this.init();
 
-  while(outSize < 0 || nowPos64 < outSize){
+  while (outSize < 0 || nowPos64 < outSize) {
     posState = nowPos64 & this._posStateMask;
 
-    if (this._rangeDecoder.decodeBit(this._isMatchDecoders, (state << 4) + posState) === 0){
+    if (this._rangeDecoder.decodeBit(this._isMatchDecoders, (state << 4) + posState) === 0) {
       decoder2 = this._literalDecoder.getDecoder(nowPos64 ++, prevByte);
 
-      if (state >= 7){
+      if (state >= 7) {
         prevByte = decoder2.decodeWithMatchByte(this._rangeDecoder, this._outWindow.getByte(rep0) );
-      }else{
+      }else {
         prevByte = decoder2.decodeNormal(this._rangeDecoder);
       }
       this._outWindow.putByte(prevByte);
 
-      state = state < 4? 0: state - (state < 10? 3: 6);
+      state = state < 4 ? 0 : state - (state < 10 ? 3 : 6);
 
-    }else{
+    }else {
 
-      if (this._rangeDecoder.decodeBit(this._isRepDecoders, state) === 1){
+      if (this._rangeDecoder.decodeBit(this._isRepDecoders, state) === 1) {
         len = 0;
-        if (this._rangeDecoder.decodeBit(this._isRepG0Decoders, state) === 0){
-          if (this._rangeDecoder.decodeBit(this._isRep0LongDecoders, (state << 4) + posState) === 0){
-            state = state < 7? 9: 11;
+        if (this._rangeDecoder.decodeBit(this._isRepG0Decoders, state) === 0) {
+          if (this._rangeDecoder.decodeBit(this._isRep0LongDecoders, (state << 4) + posState) === 0) {
+            state = state < 7 ? 9 : 11;
             len = 1;
           }
-        }else{
-          if (this._rangeDecoder.decodeBit(this._isRepG1Decoders, state) === 0){
+        }else {
+          if (this._rangeDecoder.decodeBit(this._isRepG1Decoders, state) === 0) {
             distance = rep1;
-          }else{
-            if (this._rangeDecoder.decodeBit(this._isRepG2Decoders, state) === 0){
+          }else {
+            if (this._rangeDecoder.decodeBit(this._isRepG2Decoders, state) === 0) {
               distance = rep2;
-            }else{
+            }else {
               distance = rep3;
               rep3 = rep2;
             }
@@ -424,43 +424,43 @@ LZMA.Decoder.prototype.decode = function(inStream, outStream, outSize){
           rep1 = rep0;
           rep0 = distance;
         }
-        if (len === 0){
+        if (len === 0) {
           len = 2 + this._repLenDecoder.decode(this._rangeDecoder, posState);
-          state = state < 7? 8: 11;
+          state = state < 7 ? 8 : 11;
         }
-      }else{
+      }else {
         rep3 = rep2;
         rep2 = rep1;
         rep1 = rep0;
 
         len = 2 + this._lenDecoder.decode(this._rangeDecoder, posState);
-        state = state < 7? 7: 10;
+        state = state < 7 ? 7 : 10;
 
-        posSlot = this._posSlotDecoder[len <= 5? len - 2: 3].decode(this._rangeDecoder);
-        if (posSlot >= 4){
+        posSlot = this._posSlotDecoder[len <= 5 ? len - 2 : 3].decode(this._rangeDecoder);
+        if (posSlot >= 4) {
 
           numDirectBits = (posSlot >> 1) - 1;
           rep0 = (2 | (posSlot & 1) ) << numDirectBits;
 
-          if (posSlot < 14){
+          if (posSlot < 14) {
             rep0 += LZMA.reverseDecode2(this._posDecoders,
                 rep0 - posSlot - 1, this._rangeDecoder, numDirectBits);
-          }else{
+          }else {
             rep0 += this._rangeDecoder.decodeDirectBits(numDirectBits - 4) << 4;
             rep0 += this._posAlignDecoder.reverseDecode(this._rangeDecoder);
-            if (rep0 < 0){
-              if (rep0 === -1){
+            if (rep0 < 0) {
+              if (rep0 === -1) {
                 break;
               }
               return false;
             }
           }
-        }else{
+        }else {
           rep0 = posSlot;
         }
       }
 
-      if (rep0 >= nowPos64 || rep0 >= this._dictionarySizeCheck){
+      if (rep0 >= nowPos64 || rep0 >= this._dictionarySizeCheck) {
         return false;
       }
 
@@ -477,10 +477,10 @@ LZMA.Decoder.prototype.decode = function(inStream, outStream, outSize){
   return true;
 };
 
-LZMA.Decoder.prototype.setDecoderProperties = function(properties){
+LZMA.Decoder.prototype.setDecoderProperties = function(properties) {
   var value, lc, lp, pb, dictionarySize;
 
-  if (properties.size < 5){
+  if (properties.size < 5) {
     return false;
   }
 
@@ -490,7 +490,7 @@ LZMA.Decoder.prototype.setDecoderProperties = function(properties){
   lp = value % 5;
   pb = ~~(value / 5);
 
-  if ( !this.setLcLpPb(lc, lp, pb) ){
+  if ( !this.setLcLpPb(lc, lp, pb) ) {
     return false;
   }
 
@@ -502,14 +502,14 @@ LZMA.Decoder.prototype.setDecoderProperties = function(properties){
   return this.setDictionarySize(dictionarySize);
 };
 
-LZMA.decompress = function(properties, inStream, outStream, outSize){
+LZMA.decompress = function(properties, inStream, outStream, outSize) {
   var decoder = new LZMA.Decoder();
 
-  if ( !decoder.setDecoderProperties(properties) ){
+  if ( !decoder.setDecoderProperties(properties) ) {
     throw "Incorrect stream properties";
   }
 
-  if ( !decoder.decode(inStream, outStream, outSize) ){
+  if ( !decoder.decode(inStream, outStream, outSize) ) {
     throw "Error in data stream";
   }
 

+ 1 - 1
examples/js/loaders/deprecated/SceneLoader.js

@@ -891,7 +891,7 @@ THREE.SceneLoader.prototype = {
 
 				counter_textures += textureJSON.url.length;
 
-				for( var n = 0; n < textureJSON.url.length; n ++ ) {
+				for ( var n = 0; n < textureJSON.url.length; n ++ ) {
 
 					scope.onLoadStart();
 

+ 11 - 11
examples/js/loaders/gltf/glTF-parser.js

@@ -66,7 +66,7 @@ var global = window;
 }(this, function (root) {
     "use strict";
 
-    var categoriesDepsOrder = ["buffers", "bufferViews", "images",  "videos", "samplers", "textures", "shaders", "programs", "techniques", "materials", "accessors", "meshes", "cameras", "lights", "skins", "nodes", "scenes", "animations"];
+    var categoriesDepsOrder = [ "buffers", "bufferViews", "images",  "videos", "samplers", "textures", "shaders", "programs", "techniques", "materials", "accessors", "meshes", "cameras", "lights", "skins", "nodes", "scenes", "animations" ];
 
     var glTFParser = Object.create(Object.prototype, {
 
@@ -86,7 +86,7 @@ var global = window;
         //detect absolute path following the same protocol than window.location
         _isAbsolutePath: {
             value: function(path) {
-                var isAbsolutePathRegExp = new RegExp("^"+window.location.protocol, "i");
+                var isAbsolutePathRegExp = new RegExp("^" + window.location.protocol, "i");
 
                 return path.match(isAbsolutePathRegExp) ? true : false;
             }
@@ -130,7 +130,7 @@ var global = window;
             set: function(value) {
                 if (this._json !== value) {
                     this._json = value;
-                    this._resolvePathsForCategories(["buffers", "shaders", "images", "videos"]);
+                    this._resolvePathsForCategories([ "buffers", "shaders", "images", "videos" ]);
                 }
             }
         },
@@ -147,7 +147,7 @@ var global = window;
                 var category = entryType;
                 entries = this.rootDescription[category];
                 if (!entries) {
-                    console.log("ERROR:CANNOT find expected category named:"+category);
+                    console.log("ERROR:CANNOT find expected category named:" + category);
                     return null;
                 }
 
@@ -177,7 +177,7 @@ var global = window;
                     return false;
                 }
 
-                categoryState.index++;
+                categoryState.index ++;
                 categoryState.keys = null;
                 if (categoryState.index >= keys.length) {
                     return this._stepToNextCategory();
@@ -237,7 +237,7 @@ var global = window;
                     var description = this.getEntryDescription(entryID, type);
                     if (!description) {
                         if (this.handleError) {
-                            this.handleError("INCONSISTENCY ERROR: no description found for entry "+entryID);
+                            this.handleError("INCONSISTENCY ERROR: no description found for entry " + entryID);
                             success = false;
                             break;
                         }
@@ -266,7 +266,7 @@ var global = window;
             value: function(callback) {
                 var self = this;
                 //FIXME: handle error
-                if (!this._json)  {
+                if (!this._json) {
                     var jsonPath = this._path;
                     var i = jsonPath.lastIndexOf("/");
                     this.baseURL = (i !== 0) ? jsonPath.substring(0, i + 1) : '';
@@ -306,7 +306,7 @@ var global = window;
         _getEntryType: {
             value: function(entryID) {
                 var rootKeys = categoriesDepsOrder;
-                for (var i = 0 ;  i < rootKeys.length ; i++) {
+                for (var i = 0 ; i < rootKeys.length ; i ++) {
                     var rootValues = this.rootDescription[rootKeys[i]];
                     if (rootValues) {
                         return rootKeys[i];
@@ -318,7 +318,7 @@ var global = window;
 
         getNextCategoryIndex: {
             value: function(currentIndex) {
-                for (var i = currentIndex ; i < categoriesDepsOrder.length ; i++) {
+                for (var i = currentIndex ; i < categoriesDepsOrder.length ; i ++) {
                     if (this.hasCategory(categoriesDepsOrder[i])) {
                         return i;
                     }
@@ -333,7 +333,7 @@ var global = window;
             value: function(userInfo, options) {
                 var self = this;
                 this._buildLoader(function loaderReady(reader) {
-                    var startCategory = self.getNextCategoryIndex.call(self,0);
+                    var startCategory = self.getNextCategoryIndex.call(self, 0);
                     if (startCategory !== -1) {
                         self._state = { "userInfo" : userInfo,
                                         "options" : options,
@@ -379,7 +379,7 @@ var global = window;
 
     });
 
-    if(root) {
+    if (root) {
         root.glTFParser = glTFParser;
     }
 

+ 5 - 5
examples/js/loaders/gltf/glTFAnimation.js

@@ -24,7 +24,7 @@ THREE.glTFAnimator = ( function () {
 
 		update : function()
 		{
-			for (i = 0; i < animators.length; i++)
+			for (i = 0; i < animators.length; i ++)
 			{
 				animators[i].update();
 			}
@@ -50,7 +50,7 @@ THREE.glTFAnimation = function(interps)
 THREE.glTFAnimation.prototype.createInterpolators = function(interps)
 {
 	var i, len = interps.length;
-	for (i = 0; i < len; i++)
+	for (i = 0; i < len; i ++)
 	{
 		var interp = new THREE.glTFInterpolator(interps[i]);
 		this.interps.push(interp);
@@ -90,7 +90,7 @@ THREE.glTFAnimation.prototype.update = function()
 	{
 		this.running = false;
 		var i, len = this.interps.length;
-		for (i = 0; i < len; i++)
+		for (i = 0; i < len; i ++)
 		{
 			this.interps[i].interp(this.duration);
 		}
@@ -100,7 +100,7 @@ THREE.glTFAnimation.prototype.update = function()
 	else
 	{
 		var i, len = this.interps.length;
-		for (i = 0; i < len; i++)
+		for (i = 0; i < len; i ++)
 		{
 			this.interps[i].interp(t);
 		}
@@ -202,7 +202,7 @@ THREE.glTFInterpolator.prototype.interp = function(t)
 	}
 	else
 	{
-		for (i = 0; i < this.count - 1; i++)
+		for (i = 0; i < this.count - 1; i ++)
 		{
 			var key1 = this.keys[i];
 			var key2 = this.keys[i + 1];

+ 55 - 55
examples/js/loaders/gltf/glTFLoader.js

@@ -25,7 +25,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	// Utilities
 
     function RgbArraytoHex(colorArray) {
-        if(!colorArray) return 0xFFFFFFFF;
+        if (!colorArray) return 0xFFFFFFFF;
         var r = Math.floor(colorArray[0] * 255),
             g = Math.floor(colorArray[1] * 255),
             b = Math.floor(colorArray[2] * 255),
@@ -43,7 +43,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
     	var euler = new THREE.Vector3;
     	
     	var i;
-    	for (i = 0; i < count; i++) {
+    	for (i = 0; i < count; i ++) {
     		axis.set(rotations[i * 4], rotations[i * 4 + 1],
     				rotations[i * 4 + 2]).normalize();
     		var angle = rotations[i * 4 + 3];
@@ -76,7 +76,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
     function LoadTexture(src) {
-        if(!src) { return null; }
+        if (!src) { return null; }
         return THREE.ImageUtils.loadTexture(src);
     }
 
@@ -110,13 +110,13 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
     }
     
     ClassicGeometry.prototype.checkFinished = function() {
-        if(this.indexArray && this.loadedAttributes === this.totalAttributes) {
+        if (this.indexArray && this.loadedAttributes === this.totalAttributes) {
         	
         	this.buildBufferGeometry();
         	
             this.finished = true;
 
-            if(this.onload) {
+            if (this.onload) {
                 this.onload();
             }
         }
@@ -127,7 +127,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     IndicesDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-        console.log("ERROR(IndicesDelegate):"+errorCode+":"+info);
+        console.log("ERROR(IndicesDelegate):" + errorCode + ":" + info);
     };
 
     IndicesDelegate.prototype.convert = function(resource, ctx) {
@@ -153,7 +153,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     VertexAttributeDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-        console.log("ERROR(VertexAttributeDelegate):"+errorCode+":"+info);
+        console.log("ERROR(VertexAttributeDelegate):" + errorCode + ":" + info);
     };
 
     VertexAttributeDelegate.prototype.convert = function(resource, ctx) {
@@ -170,37 +170,37 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         var i, l;
         //FIXME: Float32 is assumed here, but should be checked.
 
-        if(semantic == "POSITION") {
+        if (semantic == "POSITION") {
             // TODO: Should be easy to take strides into account here
             floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type));
-            for(i = 0, l = floatArray.length; i < l; i += 3) {
-                geom.geometry.vertices.push( new THREE.Vector3( floatArray[i], floatArray[i+1], floatArray[i+2] ) );
+            for (i = 0, l = floatArray.length; i < l; i += 3) {
+                geom.geometry.vertices.push( new THREE.Vector3( floatArray[i], floatArray[i + 1], floatArray[i + 2] ) );
             }
-        } else if(semantic == "NORMAL") {
+        } else if (semantic == "NORMAL") {
             geom.geometry.normals = [];
             floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type));
-            for(i = 0, l = floatArray.length; i < l; i += 3) {
-                geom.geometry.normals.push( new THREE.Vector3( floatArray[i], floatArray[i+1], floatArray[i+2] ) );
+            for (i = 0, l = floatArray.length; i < l; i += 3) {
+                geom.geometry.normals.push( new THREE.Vector3( floatArray[i], floatArray[i + 1], floatArray[i + 2] ) );
             }
         } else if ((semantic == "TEXCOORD_0") || (semantic == "TEXCOORD" )) {
         	geom.uvs = [];
             floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type));
-            for(i = 0, l = floatArray.length; i < l; i += 2) {
-                geom.uvs.push( new THREE.Vector2( floatArray[i], 1.0 - floatArray[i+1] ) );
+            for (i = 0, l = floatArray.length; i < l; i += 2) {
+                geom.uvs.push( new THREE.Vector2( floatArray[i], 1.0 - floatArray[i + 1] ) );
             }
         }
         else if (semantic == "WEIGHT") {
         	nComponents = componentsPerElementForGLType(attribute.type);
             floatArray = new Float32Array(glResource, 0, attribute.count * nComponents);
-            for(i = 0, l = floatArray.length; i < l; i += 4) {
-            	geom.geometry.skinWeights.push( new THREE.Vector4( floatArray[i], floatArray[i+1], floatArray[i+2], floatArray[i+3] ) );
+            for (i = 0, l = floatArray.length; i < l; i += 4) {
+            	geom.geometry.skinWeights.push( new THREE.Vector4( floatArray[i], floatArray[i + 1], floatArray[i + 2], floatArray[i + 3] ) );
             }
         }
         else if (semantic == "JOINT") {
         	nComponents = componentsPerElementForGLType(attribute.type);
             floatArray = new Float32Array(glResource, 0, attribute.count * nComponents);
-            for(i = 0, l = floatArray.length; i < l; i += 4) {
-            	geom.geometry.skinIndices.push( new THREE.Vector4( floatArray[i], floatArray[i+1], floatArray[i+2], floatArray[i+3] ) );
+            for (i = 0, l = floatArray.length; i < l; i += 4) {
+            	geom.geometry.skinIndices.push( new THREE.Vector4( floatArray[i], floatArray[i + 1], floatArray[i + 2], floatArray[i + 3] ) );
             }
         }
     }
@@ -214,11 +214,11 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         var nComponents;
         //FIXME: Float32 is assumed here, but should be checked.
 
-        if(semantic == "POSITION") {
+        if (semantic == "POSITION") {
             // TODO: Should be easy to take strides into account here
             floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type));
             geom.geometry.addAttribute( 'position', new THREE.BufferAttribute( floatArray, 3 ) );
-        } else if(semantic == "NORMAL") {
+        } else if (semantic == "NORMAL") {
             floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type));
             geom.geometry.addAttribute( 'normal', new THREE.BufferAttribute( floatArray, 3 ) );
         } else if ((semantic == "TEXCOORD_0") || (semantic == "TEXCOORD" )) {
@@ -226,8 +226,8 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         	nComponents = componentsPerElementForGLType(attribute.type);
             floatArray = new Float32Array(glResource, 0, attribute.count * nComponents);
             // N.B.: flip Y value... should we just set texture.flipY everywhere?
-            for (i = 0; i < floatArray.length / 2; i++) {
-            	floatArray[i*2+1] = 1.0 - floatArray[i*2+1];
+            for (i = 0; i < floatArray.length / 2; i ++) {
+            	floatArray[i * 2 + 1] = 1.0 - floatArray[i * 2 + 1];
             }
             geom.geometry.addAttribute( 'uv', new THREE.BufferAttribute( floatArray, nComponents ) );
         }
@@ -248,7 +248,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
     	this.bufferResourceAvailable(glResource, ctx);
     	
         var geom = ctx.geometry;
-        geom.loadedAttributes++;
+        geom.loadedAttributes ++;
         geom.checkFinished();
         return true;
     };
@@ -272,7 +272,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         
     	var self = this;
         geometry.onload = function() {
-            self.loadedGeometry++;
+            self.loadedGeometry ++;
             self.checkComplete();
         };
         
@@ -290,7 +290,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     Mesh.prototype.checkComplete = function() {
         var self = this;
-        if(this.onCompleteCallbacks.length && this.primitives.length == this.loadedGeometry) {
+        if (this.onCompleteCallbacks.length && this.primitives.length == this.loadedGeometry) {
             this.onCompleteCallbacks.forEach(function(callback) {
                 callback(self);
             });
@@ -325,7 +325,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     AnimationParameterDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-        console.log("ERROR(AnimationParameterDelegate):"+errorCode+":"+info);
+        console.log("ERROR(AnimationParameterDelegate):" + errorCode + ":" + info);
     };
 
     AnimationParameterDelegate.prototype.convert = function(resource, ctx) {
@@ -377,12 +377,12 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     Animation.prototype.handleParameterLoaded = function(parameter) {
     	this.parameters[parameter.name] = parameter;
-    	this.loadedParameters++;
+    	this.loadedParameters ++;
     	this.checkFinished();
     };
     
     Animation.prototype.checkFinished = function() {
-        if(this.loadedParameters === this.totalParameters) {
+        if (this.loadedParameters === this.totalParameters) {
             // Build animation
             this.finishedLoading = true;
 
@@ -397,7 +397,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     InverseBindMatricesDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-        console.log("ERROR(InverseBindMatricesDelegate):"+errorCode+":"+info);
+        console.log("ERROR(InverseBindMatricesDelegate):" + errorCode + ":" + info);
     };
 
     InverseBindMatricesDelegate.prototype.convert = function(resource, ctx) {
@@ -433,7 +433,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
     ShaderDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-        console.log("ERROR(ShaderDelegate):"+errorCode+":"+info);
+        console.log("ERROR(ShaderDelegate):" + errorCode + ":" + info);
     };
 
     ShaderDelegate.prototype.convert = function(resource, ctx) {
@@ -441,7 +441,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
     }
     
     ShaderDelegate.prototype.resourceAvailable = function(data, ctx) {
-        theLoader.shadersLoaded++;
+        theLoader.shadersLoaded ++;
         theLoader.shaders[ctx.id] = data;
         return true;
     };
@@ -472,7 +472,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         }
 
         if (this._entries[entryID]) {
-            console.warn("entry["+entryID+"] is being overwritten");
+            console.warn("entry[" + entryID + "] is being overwritten");
         }
     
         this._entries[entryID] = new ResourceEntry(entryID, object, description );
@@ -562,7 +562,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
                 var shaderContext = new ShaderContext(entryID, description.path);
 
-                theLoader.shadersRequested++;
+                theLoader.shadersRequested ++;
         		THREE.GLTFLoaderUtils.getFile(shaderRequest, shaderDelegate, shaderContext);
         		
                 return true;
@@ -825,11 +825,11 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                 var primitivesDescription = description.primitives;
                 if (!primitivesDescription) {
                     //FIXME: not implemented in delegate
-                    console.log("MISSING_PRIMITIVES for mesh:"+ entryID);
+                    console.log("MISSING_PRIMITIVES for mesh:" + entryID);
                     return false;
                 }
 
-                for (var i = 0 ; i < primitivesDescription.length ; i++) {
+                for (var i = 0 ; i < primitivesDescription.length ; i ++) {
                     var primitiveDescription = primitivesDescription[i];
                     
                     if (primitiveDescription.primitive === WebGLRenderingContext.TRIANGLES) {
@@ -858,7 +858,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                         // Load Vertex Attributes
                         var allAttributes = Object.keys(primitiveDescription.attributes);
                         allAttributes.forEach( function(semantic) {
-                            geometry.totalAttributes++;
+                            geometry.totalAttributes ++;
 
                             var attribute;
                             var attributeID = primitiveDescription.attributes[semantic];
@@ -1013,7 +1013,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                 this.resources.setEntry(entryID, threeNode, description);
 
                 var m = description.matrix;
-                if(m) {
+                if (m) {
                     threeNode.applyMatrix(new THREE.Matrix4().fromArray( m ));
                     threeNode.matrixAutoUpdate = false;
                     threeNode.matrixWorldNeedsUpdate = true;
@@ -1047,10 +1047,10 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                 var meshEntry;
                 if (description.mesh) {
                     meshEntry = this.resources.getEntry(description.mesh);
-                    theLoader.meshesRequested++;
+                    theLoader.meshesRequested ++;
                     meshEntry.object.onComplete(function(mesh) {
                     	self.addPendingMesh(mesh, threeNode);
-                        theLoader.meshesLoaded++;
+                        theLoader.meshesLoaded ++;
                         theLoader.checkComplete();
                     });
                 }
@@ -1058,10 +1058,10 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                 if (description.meshes) {
                     description.meshes.forEach( function(meshID) {
                         meshEntry = this.resources.getEntry(meshID);
-                        theLoader.meshesRequested++;
+                        theLoader.meshesRequested ++;
                         meshEntry.object.onComplete(function(mesh) {
                         	self.addPendingMesh(mesh, threeNode);
-                            theLoader.meshesLoaded++;
+                            theLoader.meshesLoaded ++;
                             theLoader.checkComplete();
                         });
                     }, this);
@@ -1081,11 +1081,11 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                 		skin.meshes = [];
                         sources.forEach( function(meshID) {
                             meshEntry = this.resources.getEntry(meshID);
-                            theLoader.meshesRequested++;
+                            theLoader.meshesRequested ++;
                             meshEntry.object.onComplete(function(mesh) {
                             	
                             	skin.meshes.push(mesh);
-                                theLoader.meshesLoaded++;
+                                theLoader.meshesLoaded ++;
                                 theLoader.checkComplete();
                             });
                         }, this);
@@ -1144,7 +1144,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                             var dobones = true;
 
                             var i, len = skin.meshes.length;
-                            for (i = 0; i < len; i++) {
+                            for (i = 0; i < len; i ++) {
                             	var mesh = skin.meshes[i];
                             	var threeMesh = null;
                                 mesh.primitives.forEach(function(primitive) {
@@ -1167,7 +1167,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                                     else if (geometry.attributes.position) {
                                     	var a = geometry.attributes.position.array;
                                     	var v = new THREE.Vector3;
-	                            		for ( j = 0; j < a.length / 3; j++ ) {
+	                            		for ( j = 0; j < a.length / 3; j ++ ) {
 	                            			v.set(a[j * 3], a[j * 3 + 1], a[j * 3 + 2]);
 	                            			v.applyMatrix4( skin.bindShapeMatrix );
 	                            			a[j * 3] = v.x;
@@ -1185,7 +1185,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         	                            var bones = [];
         	                            var boneInverses = [];
         	                            var i, len = jointsIds.length;
-        	                            for (i = 0; i < len; i++) {
+        	                            for (i = 0; i < len; i ++) {
         	                            	var jointId = jointsIds[i];
         	                                var nodeForJoint = this.joints[jointId];
         	                                var joint = this.resources.getEntry(nodeForJoint).object;
@@ -1204,7 +1204,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         	                                    boneInverses.push(mat);
         	                                    
         	                                } else {
-        	                                    console.log("WARNING: jointId:"+jointId+" cannot be found in skeleton:"+skeleton);
+        	                                    console.log("WARNING: jointId:" + jointId + " cannot be found in skeleton:" + skeleton);
         	                                }
         	                            }
 
@@ -1310,7 +1310,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         	
         		var interps = [];
 	            var i, len = animation.channels.length;
-	            for (i = 0; i < len; i++) {
+	            for (i = 0; i < len; i ++) {
 	            	
 	            	var channel = animation.channels[i];
 	            	var sampler = animation.samplers[channel.sampler];
@@ -1356,12 +1356,12 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
             value: function(entryID, description, userInfo) {
         	
         		var self = this;
-	            theLoader.animationsRequested++;
+	            theLoader.animationsRequested ++;
 	            var animation = new Animation();
                 animation.name = entryID;
 	            animation.onload = function() {
 	            	// self.buildAnimation(animation);
-	            	theLoader.animationsLoaded++;
+	            	theLoader.animationsLoaded ++;
 	            	theLoader.animations.push(animation);
                     theLoader.checkComplete();
 	            };	            
@@ -1372,7 +1372,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	            var parameters = description.parameters;
 	            if (!parameters) {
 	                //FIXME: not implemented in delegate
-	                console.log("MISSING_PARAMETERS for animation:"+ entryID);
+	                console.log("MISSING_PARAMETERS for animation:" + entryID);
 	                return false;
 	            }
 	
@@ -1380,7 +1380,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
                 var params = Object.keys(parameters);
                 params.forEach( function(param) {
 
-                	animation.totalParameters++;
+                	animation.totalParameters ++;
                     var parameter = parameters[param];
                     var accessor = this.resources.getEntry(parameter);
                     if (!accessor)
@@ -1535,12 +1535,12 @@ THREE.glTFLoader.prototype.checkComplete = function() {
 			&& this.animationsLoaded == this.animationsRequested)
 	{
 		
-		for (var i = 0; i < this.pendingMeshes.length; i++) {
+		for (var i = 0; i < this.pendingMeshes.length; i ++) {
 			var pending = this.pendingMeshes[i];
 			pending.mesh.attachToNode(pending.node);
 		}
 		
-		for (var i = 0; i < this.animationsLoaded; i++) {
+		for (var i = 0; i < this.animationsLoaded; i ++) {
 			var animation = this.animations[i];
 			this.loader.buildAnimation(animation);
 		}

+ 8 - 8
examples/js/loaders/gltf/glTFLoaderUtils.js

@@ -48,7 +48,7 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
             }
 
             if (this._containsResource[resourceID]) {
-                console.log("WARNING: resource:"+resourceID+" is already stored, overriding");
+                console.log("WARNING: resource:" + resourceID + " is already stored, overriding");
             }
 
            this._resources[resourceID] = resource;
@@ -100,7 +100,7 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
             var resourceStatus = this._resourcesStatus[request.id];
             if (resourceStatus)
             {
-            	this._resourcesStatus[request.id]++;
+            	this._resourcesStatus[request.id] ++;
             }
             else
             {
@@ -114,7 +114,7 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
                 return;
             }
             
-            this._streamsStatus[request.path] = { status : "loading", requests : [request] };
+            this._streamsStatus[request.path] = { status : "loading", requests : [ request ] };
     		
             var self = this;
             var processResourceDelegate = {};
@@ -127,7 +127,7 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
                     var convertedResource = req_.delegate.convert(subArray, req_.ctx);
                     self._storeResource(req_.id, convertedResource);
                     req_.delegate.resourceAvailable(convertedResource, req_.ctx);
-                    --self._resourcesStatus[req_.id];
+                    -- self._resourcesStatus[req_.id];
 
                 }, this);
             	
@@ -174,9 +174,9 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
             var bufferView = wrappedBufferView.bufferView;
             var buffer = bufferView.buffer;
             var byteOffset = wrappedBufferView.byteOffset + bufferView.description.byteOffset;
-            var range = [byteOffset , (this._elementSizeForGLType(wrappedBufferView.type) * wrappedBufferView.count) + byteOffset];
+            var range = [ byteOffset, (this._elementSizeForGLType(wrappedBufferView.type) * wrappedBufferView.count) + byteOffset ];
 
-            this._handleRequest({   "id" : wrappedBufferView.id,
+            this._handleRequest({ "id" : wrappedBufferView.id,
                                     "range" : range,
                                     "type" : buffer.description.type,
                                     "path" : buffer.description.path,
@@ -207,9 +207,9 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
     		request.delegate = delegate;
     		request.ctx = ctx;
 
-            this._handleRequest({   "id" : request.id,
+            this._handleRequest({ "id" : request.id,
                 "path" : request.path,
-                "range" : [0],
+                "range" : [ 0 ],
                 "type" : "text",
                 "delegate" : delegate,
                 "ctx" : ctx }, null);

+ 10 - 10
examples/js/math/Lut.js

@@ -42,7 +42,7 @@ THREE.Lut.prototype = {
 
 	constructor: THREE.Lut,
 
-	lut: [], map: [], mapname: 'rainbow' , n: 256, minV: 0, maxV: 1, legend: null,
+	lut: [], map: [], mapname: 'rainbow', n: 256, minV: 0, maxV: 1, legend: null,
 
 	set: function ( value ) {
 
@@ -167,7 +167,7 @@ THREE.Lut.prototype = {
 
 		for ( var i = 1; i >= 0; i-=step ) {
 
-			for ( var j = this.map.length - 1; j >= 0; j-- ) {
+			for ( var j = this.map.length - 1; j >= 0; j -- ) {
 
 				if ( i < this.map[ j ][ 0 ] && i >= this.map[ j - 1 ][ 0 ]  ) {
 
@@ -194,7 +194,7 @@ THREE.Lut.prototype = {
 		this.legend.ctx.putImageData( imageData, 0, 0 );
 		this.legend.texture.needsUpdate = true;
 
-		this.legend.legendGeometry = new THREE.PlaneBufferGeometry( this.legend.dimensions.width , this.legend.dimensions.height );
+		this.legend.legendGeometry = new THREE.PlaneBufferGeometry( this.legend.dimensions.width, this.legend.dimensions.height );
 		this.legend.legendMaterial = new THREE.MeshBasicMaterial( { map : this.legend.texture, side : THREE.DoubleSide } );
 
 		this.legend.mesh = new THREE.Mesh( this.legend.legendGeometry, this.legend.legendMaterial );
@@ -269,7 +269,7 @@ THREE.Lut.prototype = {
 
 		this.legend.labels.title = parameters.hasOwnProperty( 'title' ) ? parameters[ 'title' ] : '';
 
-		this.legend.labels.um = parameters.hasOwnProperty( 'um' ) ? ' [ '+ parameters[ 'um' ] + ' ]': '';
+		this.legend.labels.um = parameters.hasOwnProperty( 'um' ) ? ' [ ' + parameters[ 'um' ] + ' ]' : '';
 
 		this.legend.labels.ticks = parameters.hasOwnProperty( 'ticks' ) ? parameters[ 'ticks' ] : 0;
 
@@ -340,7 +340,7 @@ THREE.Lut.prototype = {
 
 			}
 
-			for ( var i = 0; i < this.legend.labels.ticks; i++ ) {
+			for ( var i = 0; i < this.legend.labels.ticks; i ++ ) {
 
 				var value = ( this.maxV - this.minV ) / ( this.legend.labels.ticks - 1  ) * i ;
 
@@ -429,7 +429,7 @@ THREE.Lut.prototype = {
 
 					var linePosition = ( this.legend.position.y - ( this.legend.dimensions.height * 0.5 ) + 0.01 ) + ( this.legend.dimensions.height ) * ( value / ( this.maxV - this.minV ) * 0.99 );
 
-					geometry.vertices.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.55, linePosition , this.legend.position.z  ) );
+					geometry.vertices.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.55, linePosition, this.legend.position.z  ) );
 
 					geometry.vertices.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.7, linePosition, this.legend.position.z  ) );
 
@@ -463,9 +463,9 @@ THREE.Lut.prototype = {
 
 THREE.ColorMapKeywords = {
 
-  "rainbow":    [ [ 0.0, '0x0000FF' ], [ 0.2, '0x00FFFF' ], [ 0.5, '0x00FF00' ], [ 0.8, '0xFFFF00'],  [1.0, '0xFF0000' ] ],
-  "cooltowarm": [ [ 0.0, '0x3C4EC2' ], [ 0.2, '0x9BBCFF' ], [ 0.5, '0xDCDCDC' ], [ 0.8, '0xF6A385'],  [1.0, '0xB40426' ] ],
-  "blackbody" : [ [ 0.0, '0x000000' ], [ 0.2, '0x780000' ], [ 0.5, '0xE63200' ], [ 0.8, '0xFFFF00'],  [1.0, '0xFFFFFF' ] ],
-  "grayscale" : [ [ 0.0, '0x000000' ], [ 0.2, '0x404040' ], [ 0.5, '0x7F7F80' ], [ 0.8, '0xBFBFBF'],  [1.0, '0xFFFFFF' ] ]
+  "rainbow":    [ [ 0.0, '0x0000FF' ], [ 0.2, '0x00FFFF' ], [ 0.5, '0x00FF00' ], [ 0.8, '0xFFFF00' ],  [ 1.0, '0xFF0000' ] ],
+  "cooltowarm": [ [ 0.0, '0x3C4EC2' ], [ 0.2, '0x9BBCFF' ], [ 0.5, '0xDCDCDC' ], [ 0.8, '0xF6A385' ],  [ 1.0, '0xB40426' ] ],
+  "blackbody" : [ [ 0.0, '0x000000' ], [ 0.2, '0x780000' ], [ 0.5, '0xE63200' ], [ 0.8, '0xFFFF00' ],  [ 1.0, '0xFFFFFF' ] ],
+  "grayscale" : [ [ 0.0, '0x000000' ], [ 0.2, '0x404040' ], [ 0.5, '0x7F7F80' ], [ 0.8, '0xBFBFBF' ],  [ 1.0, '0xFFFFFF' ] ]
 
 };

+ 8 - 8
examples/js/modifiers/SubdivisionModifier.js

@@ -26,7 +26,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 	var repeats = this.subdivisions;
 
-	while ( repeats-- > 0 ) {
+	while ( repeats -- > 0 ) {
 		this.smooth( geometry );
 	}
 
@@ -101,11 +101,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 		var i, il, face, edge;
 
-		for ( i = 0, il = vertices.length; i < il; i++ ) {
+		for ( i = 0, il = vertices.length; i < il; i ++ ) {
 			metaVertices[ i ] = { edges: [] };
 		}
 		
-		for ( i = 0, il = faces.length; i < il; i++ ) {
+		for ( i = 0, il = faces.length; i < il; i ++ ) {
 			face = faces[ i ];
 
 			processEdge( face.a, face.b, vertices, edges, face, metaVertices );
@@ -194,11 +194,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 			tmp.set( 0, 0, 0 );
 
-			for ( j = 0; j < connectedFaces; j++ ) {
+			for ( j = 0; j < connectedFaces; j ++ ) {
 
 				face = currentEdge.faces[ j ];
 				
-				for ( k = 0; k < 3; k++ ) {
+				for ( k = 0; k < 3; k ++ ) {
 
 					other = oldVertices[ face[ ABC[k] ] ];
 					if (other !== currentEdge.a && other !== currentEdge.b ) break;
@@ -229,7 +229,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 		var connectingEdge, connectingEdges, oldVertex, newSourceVertex;
 		newSourceVertices = [];
 
-		for ( i = 0, il = oldVertices.length; i < il; i++ ) {
+		for ( i = 0, il = oldVertices.length; i < il; i ++ ) {
 
 			oldVertex = oldVertices[ i ];
 
@@ -284,7 +284,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 			tmp.set( 0, 0, 0 );
 
-			for ( j=0; j < n; j++ ) {
+			for ( j = 0; j < n; j ++ ) {
 
 				connectingEdge = connectingEdges[ j ];
 				other = connectingEdge.a !== oldVertex ? connectingEdge.a : connectingEdge.b;
@@ -312,7 +312,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 		var sl = newSourceVertices.length, edge1, edge2, edge3;
 		newFaces = [];
 
-		for ( i = 0, il = oldFaces.length; i < il; i++ ) {
+		for ( i = 0, il = oldFaces.length; i < il; i ++ ) {
 
 			face = oldFaces[ i ];
 

+ 2 - 2
examples/js/postprocessing/AdaptiveToneMappingPass.js

@@ -11,7 +11,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 
 	this.resolution = ( resolution !== undefined ) ? resolution : 256;
 	this.needsInit = true;
-	this.adaptive = adaptive !== undefined? !!adaptive : true;
+	this.adaptive = adaptive !== undefined ? !!adaptive : true;
 
 	this.luminanceRT = null;
 	this.previousLuminanceRT = null;
@@ -190,7 +190,7 @@ THREE.AdaptiveToneMappingPass.prototype = {
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT;
 		}
 		//Put something in the adaptive luminance texture so that the scene can render initially
-		this.quad.material = new THREE.MeshBasicMaterial( {color: 0x777777 });
+		this.quad.material = new THREE.MeshBasicMaterial( { color: 0x777777 });
 		this.materialLuminance.needsUpdate = true;
 		this.materialAdaptiveLum.needsUpdate = true;
 		this.materialToneMap.needsUpdate = true;

+ 32 - 32
examples/js/postprocessing/GlitchPass.js

@@ -9,10 +9,10 @@ THREE.GlitchPass = function ( dt_size ) {
 	var shader = THREE.DigitalGlitch;
 	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-	if(dt_size==undefined) dt_size=64;
+	if (dt_size == undefined) dt_size = 64;
 	
 	
-	this.uniforms[ "tDisp"].value=this.generateHeightmap(dt_size);
+	this.uniforms[ "tDisp"].value = this.generateHeightmap(dt_size);
 	
 
 	this.material = new THREE.ShaderMaterial({
@@ -34,8 +34,8 @@ THREE.GlitchPass = function ( dt_size ) {
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.scene.add( this.quad );
 	
-	this.goWild=false;
-	this.curF=0;
+	this.goWild = false;
+	this.curF = 0;
 	this.generateTrigger();
 	
 };
@@ -45,34 +45,34 @@ THREE.GlitchPass.prototype = {
 	render: function ( renderer, writeBuffer, readBuffer, delta ) 
 	{
 		this.uniforms[ "tDiffuse" ].value = readBuffer;
-		this.uniforms[ 'seed' ].value=Math.random();//default seeding
-		this.uniforms[ 'byp' ].value=0;
+		this.uniforms[ 'seed' ].value = Math.random();//default seeding
+		this.uniforms[ 'byp' ].value = 0;
 		
-		if(this.curF % this.randX ==0 || this.goWild==true)
+		if (this.curF % this.randX == 0 || this.goWild == true)
 		{
-			this.uniforms[ 'amount' ].value=Math.random()/30;
-			this.uniforms[ 'angle' ].value=THREE.Math.randFloat(-Math.PI,Math.PI);
-			this.uniforms[ 'seed_x' ].value=THREE.Math.randFloat(-1,1);
-			this.uniforms[ 'seed_y' ].value=THREE.Math.randFloat(-1,1);
-			this.uniforms[ 'distortion_x' ].value=THREE.Math.randFloat(0,1);
-			this.uniforms[ 'distortion_y' ].value=THREE.Math.randFloat(0,1);
-			this.curF=0;
+			this.uniforms[ 'amount' ].value = Math.random() / 30;
+			this.uniforms[ 'angle' ].value = THREE.Math.randFloat(-Math.PI, Math.PI);
+			this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat(-1, 1);
+			this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat(-1, 1);
+			this.uniforms[ 'distortion_x' ].value = THREE.Math.randFloat(0, 1);
+			this.uniforms[ 'distortion_y' ].value = THREE.Math.randFloat(0, 1);
+			this.curF = 0;
 			this.generateTrigger();
 		}
-		else if(this.curF % this.randX <this.randX/5)
+		else if (this.curF % this.randX < this.randX / 5)
 		{
-			this.uniforms[ 'amount' ].value=Math.random()/90;
-			this.uniforms[ 'angle' ].value=THREE.Math.randFloat(-Math.PI,Math.PI);
-			this.uniforms[ 'distortion_x' ].value=THREE.Math.randFloat(0,1);
-			this.uniforms[ 'distortion_y' ].value=THREE.Math.randFloat(0,1);
-			this.uniforms[ 'seed_x' ].value=THREE.Math.randFloat(-0.3,0.3);
-			this.uniforms[ 'seed_y' ].value=THREE.Math.randFloat(-0.3,0.3);
+			this.uniforms[ 'amount' ].value = Math.random() / 90;
+			this.uniforms[ 'angle' ].value = THREE.Math.randFloat(-Math.PI, Math.PI);
+			this.uniforms[ 'distortion_x' ].value = THREE.Math.randFloat(0, 1);
+			this.uniforms[ 'distortion_y' ].value = THREE.Math.randFloat(0, 1);
+			this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat(-0.3, 0.3);
+			this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat(-0.3, 0.3);
 		}
-		else if(this.goWild==false)
+		else if (this.goWild == false)
 		{
-			this.uniforms[ 'byp' ].value=1;
+			this.uniforms[ 'byp' ].value = 1;
 		}
-		this.curF++;
+		this.curF ++;
 		
 		this.quad.material = this.material;
 		if ( this.renderToScreen ) 
@@ -86,20 +86,20 @@ THREE.GlitchPass.prototype = {
 	},
 	generateTrigger:function()
 	{
-		this.randX=THREE.Math.randInt(120,240);
+		this.randX = THREE.Math.randInt(120, 240);
 	},
 	generateHeightmap:function(dt_size)
 	{
-		var data_arr = new Float32Array( dt_size*dt_size * 3 );
+		var data_arr = new Float32Array( dt_size * dt_size * 3 );
 		console.log(dt_size);
-		var length=dt_size*dt_size;
+		var length = dt_size * dt_size;
 		
-		for ( var i = 0; i < length; i++) 
+		for ( var i = 0; i < length; i ++) 
 		{
-			var val=THREE.Math.randFloat(0,1);
-			data_arr[ i*3 + 0 ] = val;
-			data_arr[ i*3 + 1 ] = val;
-			data_arr[ i*3 + 2 ] = val;
+			var val = THREE.Math.randFloat(0, 1);
+			data_arr[ i * 3 + 0 ] = val;
+			data_arr[ i * 3 + 1 ] = val;
+			data_arr[ i * 3 + 2 ] = val;
 		}
 		
 		var texture = new THREE.DataTexture( data_arr, dt_size, dt_size, THREE.RGBFormat, THREE.FloatType );

+ 2 - 2
examples/js/renderers/SVGRenderer.js

@@ -68,7 +68,7 @@ THREE.SVGRenderer = function () {
 
 	this.setQuality = function( quality ) {
 
-		switch(quality) {
+		switch (quality) {
 
 			case "high": _quality = 1; break;
 			case "low": _quality = 0; break;
@@ -232,7 +232,7 @@ THREE.SVGRenderer = function () {
 		_directionalLights.setRGB( 0, 0, 0 );
 		_pointLights.setRGB( 0, 0, 0 );
 
-		for ( var l = 0, ll = lights.length; l < ll; l++ ) {
+		for ( var l = 0, ll = lights.length; l < ll; l ++ ) {
 
 			var light = lights[ l ];
 			var lightColor = light.color;

+ 62 - 62
examples/js/renderers/SoftwareRenderer.js

@@ -292,9 +292,9 @@ THREE.SoftwareRenderer = function ( parameters ) {
 		for ( var i = 0; i < size; i+=4 ) {
 
 			data[ i ] = clearColor.r * 255 | 0;
-			data[ i+1 ] = clearColor.g * 255 | 0;
-			data[ i+2 ] = clearColor.b * 255 | 0;
-			data[ i+3 ] = 255;
+			data[ i + 1 ] = clearColor.g * 255 | 0;
+			data[ i + 2 ] = clearColor.b * 255 | 0;
+			data[ i + 3 ] = 255;
 		}
 
 		context.fillStyle = clearColor.getStyle();
@@ -306,31 +306,31 @@ THREE.SoftwareRenderer = function ( parameters ) {
 		var diffuseR = material.color.r * 255;
 		var diffuseG = material.color.g * 255;
 		var diffuseB = material.color.b * 255;
-		var palette = new Uint8Array(256*3);
+		var palette = new Uint8Array(256 * 3);
 
 		if ( bSimulateSpecular ) {
 
-			while(i < 204) {
-				palette[j++] = Math.min( i * diffuseR / 204, 255 );
-				palette[j++] = Math.min( i * diffuseG / 204, 255 );
-				palette[j++] = Math.min( i * diffuseB / 204, 255 );
-				++i;
+			while (i < 204) {
+				palette[j ++] = Math.min( i * diffuseR / 204, 255 );
+				palette[j ++] = Math.min( i * diffuseG / 204, 255 );
+				palette[j ++] = Math.min( i * diffuseB / 204, 255 );
+				++ i;
 			}
 
-			while(i < 256) { // plus specular highlight
-				palette[j++] = Math.min( diffuseR + (i - 204) * (255 - diffuseR) / 82, 255 );
-				palette[j++] = Math.min( diffuseG + (i - 204) * (255 - diffuseG) / 82, 255 );
-				palette[j++] = Math.min( diffuseB + (i - 204) * (255 - diffuseB) / 82, 255 );
-				++i;
+			while (i < 256) { // plus specular highlight
+				palette[j ++] = Math.min( diffuseR + (i - 204) * (255 - diffuseR) / 82, 255 );
+				palette[j ++] = Math.min( diffuseG + (i - 204) * (255 - diffuseG) / 82, 255 );
+				palette[j ++] = Math.min( diffuseB + (i - 204) * (255 - diffuseB) / 82, 255 );
+				++ i;
 			}
 
 		} else {
 
-			while(i < 256) {
-				palette[j++] = Math.min( i * diffuseR / 255, 255 );
-				palette[j++] = Math.min( i * diffuseG / 255, 255 );
-				palette[j++] = Math.min( i * diffuseB / 255, 255 );
-				++i;
+			while (i < 256) {
+				palette[j ++] = Math.min( i * diffuseR / 255, 255 );
+				palette[j ++] = Math.min( i * diffuseG / 255, 255 );
+				palette[j ++] = Math.min( i * diffuseB / 255, 255 );
+				++ i;
 			}
 
 		}
@@ -355,17 +355,17 @@ THREE.SoftwareRenderer = function ( parameters ) {
 
 		if ( !isTransparent ) {
 			buffer[ colorOffset ] = tdata[tIndex];
-			buffer[ colorOffset + 1 ] = tdata[tIndex+1];
-			buffer[ colorOffset + 2 ] = tdata[tIndex+2];
+			buffer[ colorOffset + 1 ] = tdata[tIndex + 1];
+			buffer[ colorOffset + 2 ] = tdata[tIndex + 2];
 			buffer[ colorOffset + 3 ] = material.opacity * 255;
 			depthBuf[ offset ] = depth;
 		}
 		else {
-			var opaci = tdata[tIndex+3] * material.opacity;
-			var texel = (tdata[tIndex] << 16) + (tdata[tIndex+1] << 8) + tdata[tIndex+2];
-			if(opaci < 250) {
+			var opaci = tdata[tIndex + 3] * material.opacity;
+			var texel = (tdata[tIndex] << 16) + (tdata[tIndex + 1] << 8) + tdata[tIndex + 2];
+			if (opaci < 250) {
 				var backColor = (buffer[colorOffset] << 16) + (buffer[colorOffset + 1] << 8) + buffer[colorOffset + 2];
-				texel = texel * opaci + backColor * (1-opaci);
+				texel = texel * opaci + backColor * (1 - opaci);
 			}
 
 			buffer[ colorOffset ] = (texel & 0xff0000) >> 16;
@@ -393,19 +393,19 @@ THREE.SoftwareRenderer = function ( parameters ) {
 
 		if ( !isTransparent ) {
 			buffer[ colorOffset ] = (material.palette[cIndex] * tdata[tIndex]) >> 8;
-			buffer[ colorOffset + 1 ] = (material.palette[cIndex+1] * tdata[tIndex+1]) >> 8;
-			buffer[ colorOffset + 2 ] = (material.palette[cIndex+2] * tdata[tIndex+2]) >> 8;
+			buffer[ colorOffset + 1 ] = (material.palette[cIndex + 1] * tdata[tIndex + 1]) >> 8;
+			buffer[ colorOffset + 2 ] = (material.palette[cIndex + 2] * tdata[tIndex + 2]) >> 8;
 			buffer[ colorOffset + 3 ] = material.opacity * 255;
 			depthBuf[ offset ] = depth;
 		} else {
-			var opaci = tdata[tIndex+3] * material.opacity;
+			var opaci = tdata[tIndex + 3] * material.opacity;
 			var foreColor = ((material.palette[cIndex] * tdata[tIndex]) << 16)
-							+ ((material.palette[cIndex+1] * tdata[tIndex+1]) << 8 )
-							+ (material.palette[cIndex+2] * tdata[tIndex+2]);
+							+ ((material.palette[cIndex + 1] * tdata[tIndex + 1]) << 8 )
+							+ (material.palette[cIndex + 2] * tdata[tIndex + 2]);
 
-			if(opaci < 250) {
+			if (opaci < 250) {
 			var backColor = buffer[ colorOffset ] << 24 + buffer[ colorOffset + 1 ] << 16 + buffer[ colorOffset + 2 ] << 8;
-			foreColor = foreColor * opaci + backColor * (1-opaci);
+			foreColor = foreColor * opaci + backColor * (1 - opaci);
 			}
 
 			buffer[ colorOffset ] = (foreColor & 0xff0000) >> 16;
@@ -587,11 +587,11 @@ THREE.SoftwareRenderer = function ( parameters ) {
 			bHasUV = true;
 
 			tu1 = uv1.x;
-			tv1 = 1-uv1.y;
+			tv1 = 1 - uv1.y;
 			tu2 = uv2.x;
-			tv2 = 1-uv2.y;
+			tv2 = 1 - uv2.y;
 			tu3 = uv3.x;
-			tv3 = 1-uv3.y;
+			tv3 = 1 - uv3.y;
 		}
 
 		// Normal values
@@ -660,9 +660,9 @@ THREE.SoftwareRenderer = function ( parameters ) {
 		// Z interpolation setup
 
 		var dz12 = z1 - z2, dz31 = z3 - z1;
-		var invDet = 1.0 / (dx12*dy31 - dx31*dy12);
-		var dzdx = (invDet * (dz12*dy31 - dz31*dy12)); // dz per one subpixel step in x
-		var dzdy = (invDet * (dz12*dx31 - dx12*dz31)); // dz per one subpixel step in y
+		var invDet = 1.0 / (dx12 * dy31 - dx31 * dy12);
+		var dzdx = (invDet * (dz12 * dy31 - dz31 * dy12)); // dz per one subpixel step in x
+		var dzdy = (invDet * (dz12 * dx31 - dx12 * dz31)); // dz per one subpixel step in y
 
 		// Z at top/left corner of rast area
 
@@ -678,11 +678,11 @@ THREE.SoftwareRenderer = function ( parameters ) {
 		if ( bHasUV ) {
 			// UV interpolation setup
 			var dtu12 = tu1 - tu2, dtu31 = tu3 - tu1;
-			var dtudx = (invDet * (dtu12*dy31 - dtu31*dy12)); // dtu per one subpixel step in x
-			var dtudy = (invDet * (dtu12*dx31 - dx12*dtu31)); // dtu per one subpixel step in y
+			var dtudx = (invDet * (dtu12 * dy31 - dtu31 * dy12)); // dtu per one subpixel step in x
+			var dtudy = (invDet * (dtu12 * dx31 - dx12 * dtu31)); // dtu per one subpixel step in y
 			var dtv12 = tv1 - tv2, dtv31 = tv3 - tv1;
-			dtvdx = (invDet * (dtv12*dy31 - dtv31*dy12)); // dtv per one subpixel step in x
-			dtvdy = (invDet * (dtv12*dx31 - dx12*dtv31)); // dtv per one subpixel step in y
+			dtvdx = (invDet * (dtv12 * dy31 - dtv31 * dy12)); // dtv per one subpixel step in x
+			dtvdy = (invDet * (dtv12 * dx31 - dx12 * dtv31)); // dtv per one subpixel step in y
 
 			// UV at top/left corner of rast area
 			cbtu = ( tu1 + (minXfixscale - x1) * dtudx + (minYfixscale - y1) * dtudy );
@@ -699,8 +699,8 @@ THREE.SoftwareRenderer = function ( parameters ) {
 		if ( bHasNormal ) {
 			 // Normal interpolation setup
 			var dnz12 = nz1 - nz2, dnz31 = nz3 - nz1;
-			var dnzdx = (invDet * (dnz12*dy31 - dnz31*dy12)); // dnz per one subpixel step in x
-			var dnzdy = (invDet * (dnz12*dx31 - dx12*dnz31)); // dnz per one subpixel step in y
+			var dnzdx = (invDet * (dnz12 * dy31 - dnz31 * dy12)); // dnz per one subpixel step in x
+			var dnzdy = (invDet * (dnz12 * dx31 - dx12 * dnz31)); // dnz per one subpixel step in y
 
 			// Normal at top/left corner of rast area
 			cbnz = ( nz1 + (minXfixscale - x1) * dnzdx + (minYfixscale - y1) * dnzdy );
@@ -716,14 +716,14 @@ THREE.SoftwareRenderer = function ( parameters ) {
 		var nmin2 = 0, nmax2 = 0;
 		var nmin3 = 0, nmax3 = 0;
 		var nminz = 0, nmaxz = 0;
-		if (dx12 >= 0) nmax1 -= qm1*dx12; else nmin1 -= qm1*dx12;
-		if (dy12 >= 0) nmax1 -= qm1*dy12; else nmin1 -= qm1*dy12;
-		if (dx23 >= 0) nmax2 -= qm1*dx23; else nmin2 -= qm1*dx23;
-		if (dy23 >= 0) nmax2 -= qm1*dy23; else nmin2 -= qm1*dy23;
-		if (dx31 >= 0) nmax3 -= qm1*dx31; else nmin3 -= qm1*dx31;
-		if (dy31 >= 0) nmax3 -= qm1*dy31; else nmin3 -= qm1*dy31;
-		if (dzdx >= 0) nmaxz += qm1*dzdx; else nminz += qm1*dzdx;
-		if (dzdy >= 0) nmaxz += qm1*dzdy; else nminz += qm1*dzdy;
+		if (dx12 >= 0) nmax1 -= qm1 * dx12; else nmin1 -= qm1 * dx12;
+		if (dy12 >= 0) nmax1 -= qm1 * dy12; else nmin1 -= qm1 * dy12;
+		if (dx23 >= 0) nmax2 -= qm1 * dx23; else nmin2 -= qm1 * dx23;
+		if (dy23 >= 0) nmax2 -= qm1 * dy23; else nmin2 -= qm1 * dy23;
+		if (dx31 >= 0) nmax3 -= qm1 * dx31; else nmin3 -= qm1 * dx31;
+		if (dy31 >= 0) nmax3 -= qm1 * dy31; else nmin3 -= qm1 * dy31;
+		if (dzdx >= 0) nmaxz += qm1 * dzdx; else nminz += qm1 * dzdx;
+		if (dzdy >= 0) nmaxz += qm1 * dzdy; else nminz += qm1 * dzdy;
 
 		// Loop through blocks
 		var linestep = canvasWidth - q;
@@ -894,7 +894,7 @@ THREE.SoftwareRenderer = function ( parameters ) {
 								cxnz += dnzdx;
 							}
 
-							offset++;
+							offset ++;
 
 						}
 
@@ -978,7 +978,7 @@ THREE.SoftwareRenderer = function ( parameters ) {
 								cxnz += dnzdx;
 							}
 
-							offset++;
+							offset ++;
 
 						}
 
@@ -1005,18 +1005,18 @@ THREE.SoftwareRenderer = function ( parameters ) {
 			}
 
 			// Advance to next row of blocks
-			cb1 += q*dx12;
-			cb2 += q*dx23;
-			cb3 += q*dx31;
-			cbz += q*dzdy;
+			cb1 += q * dx12;
+			cb2 += q * dx23;
+			cb3 += q * dx31;
+			cbz += q * dzdy;
 
 			if ( bHasUV ) {
-				cbtu += q*dtudy;
-				cbtv += q*dtvdy;
+				cbtu += q * dtudy;
+				cbtv += q * dtvdy;
 			}
 
 			if ( bHasNormal ) {
-				cbnz += q*dnzdy;
+				cbnz += q * dnzdy;
 			}
 
 		}
@@ -1081,7 +1081,7 @@ THREE.SoftwareRenderer.Texture = function() {
 
 	this.fromImage = function( image ) {
 
-		if( !image || image.width <= 0 || image.height <= 0 )
+		if ( !image || image.width <= 0 || image.height <= 0 )
 			return;
 
 		if ( canvas === undefined ) {

+ 4 - 4
examples/js/renderers/plugins/DepthPassPlugin.js

@@ -107,7 +107,7 @@ THREE.DepthPassPlugin = function () {
 		// set object matrices & frustum culling
 		
 		_renderList.length = 0;
-		projectObject(scene,scene,camera);
+		projectObject(scene, scene, camera);
 
 		// render regular objects
 
@@ -189,7 +189,7 @@ THREE.DepthPassPlugin = function () {
 
 	};
 	
-	function projectObject(scene, object,camera){
+	function projectObject(scene, object,camera) {
 		
 		if ( object.visible ) {
 	
@@ -198,7 +198,7 @@ THREE.DepthPassPlugin = function () {
 			if (webglObjects && (object.frustumCulled === false || _frustum.intersectsObject( object ) === true) ) {
 		
 		
-				for (var i = 0, l = webglObjects.length; i < l; i++){
+				for (var i = 0, l = webglObjects.length; i < l; i ++) {
 			
 					var webglObject = webglObjects[i];
 					
@@ -208,7 +208,7 @@ THREE.DepthPassPlugin = function () {
 				}
 			}
 	
-			for(var i = 0, l = object.children.length; i < l; i++) {
+			for (var i = 0, l = object.children.length; i < l; i ++) {
 				
 				projectObject(scene, object.children[i], camera);
 			}

+ 1 - 1
examples/js/shaders/BokehShader2.js

@@ -44,7 +44,7 @@ THREE.BokehShader = {
 		"pentagon": { type: "i", value: 0 },
 
 		"shaderFocus":  { type: "i", value: 1 },
-		"focusCoords":  { type: "v2", value: new THREE.Vector2()},
+		"focusCoords":  { type: "v2", value: new THREE.Vector2() },
 
 
 	},

+ 2 - 2
examples/js/shaders/ConvolutionShader.js

@@ -83,7 +83,7 @@ THREE.ConvolutionShader = {
 
 		values = new Array( kernelSize );
 		sum = 0.0;
-		for ( i = 0; i < kernelSize; ++i ) {
+		for ( i = 0; i < kernelSize; ++ i ) {
 
 			values[ i ] = gauss( i - halfWidth, sigma );
 			sum += values[ i ];
@@ -92,7 +92,7 @@ THREE.ConvolutionShader = {
 
 		// normalize the kernel
 
-		for ( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
+		for ( i = 0; i < kernelSize; ++ i ) values[ i ] /= sum;
 
 		return values;
 

+ 1 - 1
examples/js/shaders/FXAAShader.js

@@ -13,7 +13,7 @@ THREE.FXAAShader = {
 	uniforms: {
 
 		"tDiffuse":   { type: "t", value: null },
-		"resolution": { type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 )  }
+		"resolution": { type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 ) }
 
 	},
 

+ 1 - 1
examples/js/shaders/NormalDisplacementShader.js

@@ -350,7 +350,7 @@ THREE.NormalDisplacementShader = {
 		"	#if MAX_HEMI_LIGHTS > 0",
 
 		"		vec3 hemiDiffuse = vec3( 0.0 );",
-		"		vec3 hemiSpecular = vec3( 0.0 );" ,
+		"		vec3 hemiSpecular = vec3( 0.0 );",
 
 		"		for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
 

+ 1 - 1
examples/js/shaders/TriangleBlurShader.js

@@ -15,7 +15,7 @@ THREE.TriangleBlurShader = {
 	uniforms : {
 
 		"texture": { type: "t", value: null },
-		"delta":   { type: "v2", value:new THREE.Vector2( 1, 1 )  }
+		"delta":   { type: "v2", value:new THREE.Vector2( 1, 1 ) }
 
 	},
 

+ 3 - 3
examples/js/utils/UVsDebug.js

@@ -44,7 +44,7 @@ THREE.UVsDebug = function( geometry, size ) {
     ctx.fillStyle = 'rgba( 255, 255, 255, 1.0 )';
     ctx.fillRect( 0, 0, width, height );
 
-    for ( i = 0, il = uvs.length; i < il; i++ ) {
+    for ( i = 0, il = uvs.length; i < il; i ++ ) {
 
         uv = uvs[ i ];
 
@@ -54,7 +54,7 @@ THREE.UVsDebug = function( geometry, size ) {
 
         a.set( 0, 0 );
 
-        for ( j = 0, jl = uv.length; j < jl; j++ ) {
+        for ( j = 0, jl = uv.length; j < jl; j ++ ) {
 
             u = uv[ j ];
 
@@ -95,7 +95,7 @@ THREE.UVsDebug = function( geometry, size ) {
 
         // label uv edge orders
 
-        for ( j = 0, jl = uv.length; j < jl; j++ ) {
+        for ( j = 0, jl = uv.length; j < jl; j ++ ) {
 
             u = uv[ j ];
             b.addVectors( a, u ).divideScalar( 2 );

+ 22 - 22
examples/js/wip/ProxyGeometry.js

@@ -56,17 +56,17 @@ Object.defineProperties(THREE.ProxyGeometry.prototype, {
 
 	verticesNeedUpdate: {
 		enumerable: true,	
-		get: function() { if (this.attributes[ 'position' ]) return this.attributes[ 'position' ].needsUpdate; } ,
+		get: function() { if (this.attributes[ 'position' ]) return this.attributes[ 'position' ].needsUpdate; },
 		set: function(v) { if (this.attributes[ 'position' ]) this.attributes[ 'position' ].needsUpdate = v; } 
 	},
 	colorsNeedUpdate: {
 		enumerable: true,	
-		get: function() { if (this.attributes[ 'color' ]) return this.attributes[ 'color' ].needsUpdate; } ,
+		get: function() { if (this.attributes[ 'color' ]) return this.attributes[ 'color' ].needsUpdate; },
 		set: function(v) { if (this.attributes[ 'color' ]) this.attributes[ 'color' ].needsUpdate = v; } 
 	},
 	normalsNeedUpdate: {
 		enumerable: true,	
-		get: function() { if (this.attributes[ 'normal' ]) return this.attributes[ 'normal' ].needsUpdate; } ,
+		get: function() { if (this.attributes[ 'normal' ]) return this.attributes[ 'normal' ].needsUpdate; },
 		set: function(v) { if (this.attributes[ 'normal' ]) this.attributes[ 'normal' ].needsUpdate = v; } 
 	},
 });
@@ -95,7 +95,7 @@ THREE.ProxyGeometry.prototype.createVertexProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0; i < values.length; i++) {
+		for (var i = 0; i < values.length; i ++) {
 
 			this.vertices[i].copy(values[i]);
 
@@ -166,7 +166,7 @@ THREE.ProxyGeometry.prototype.createFaceProxies = function(values) {
 		for ( var i = 0, l = positionarray.length / 3; i < l; i += 3 ) {
 
 			var o = i * 3;
-			var v1 = i, v2 = i+1, v3 = i+2;
+			var v1 = i, v2 = i + 1, v3 = i + 2;
 
 			var face = new THREE.ProxyFace3( v1, v2, v3 );
 			faces.push(face);
@@ -179,7 +179,7 @@ THREE.ProxyGeometry.prototype.createFaceProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0, l = values.length; i < l; i++) {
+		for (var i = 0, l = values.length; i < l; i ++) {
 
 			var f = faces[i],
 			    v = values[i];
@@ -222,7 +222,7 @@ THREE.ProxyGeometry.prototype.createFaceVertexNormalProxies = function(values) {
 
 		var normalarray = this.attributes[ 'normal' ].array;
 
-		for (var i = 0, l = this.faces.length; i < l; i++) {
+		for (var i = 0, l = this.faces.length; i < l; i ++) {
 
 			var f = this.faces[i];
 
@@ -240,14 +240,14 @@ THREE.ProxyGeometry.prototype.createFaceVertexNormalProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0, l = values.length; i < l; i++) {
+		for (var i = 0, l = values.length; i < l; i ++) {
 
 			var f = this.faces[i],
 			    v = values[i];
 
 			if (v.vertexNormals.length > 0) {
 
-				for (var j = 0, l2 = f.vertexNormals.length; j < l2; j++) {
+				for (var j = 0, l2 = f.vertexNormals.length; j < l2; j ++) {
 
 					f.vertexNormals[j].copy(v.vertexNormals[j]);
 
@@ -271,7 +271,7 @@ THREE.ProxyGeometry.prototype.createFaceVertexColorProxies = function(values) {
 
 		var colorarray = this.attributes[ 'color' ].array;
 
-		for (var i = 0, l = this.faces.length; i < l; i++) {
+		for (var i = 0, l = this.faces.length; i < l; i ++) {
 			var f = this.faces[i];
 
 			if ( this.attributes[ 'index' ] ) {
@@ -298,12 +298,12 @@ THREE.ProxyGeometry.prototype.createFaceVertexColorProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0, l = values.length; i < l; i++) {
+		for (var i = 0, l = values.length; i < l; i ++) {
 
 			var f = this.faces[i],
 			    v = values[i];
 
-			for (var j = 0, l2 = f.vertexColors.length; j < l2; j++) {
+			for (var j = 0, l2 = f.vertexColors.length; j < l2; j ++) {
 
 				if (v.vertexColors.length > 0) {
 
@@ -329,7 +329,7 @@ THREE.ProxyGeometry.prototype.createFaceVertexTangentProxies = function(values)
 
 		var tangentarray = this.attributes[ 'tangent' ].array;
 
-		for (var i = 0, l = this.faces.length; i < l; i++) {
+		for (var i = 0, l = this.faces.length; i < l; i ++) {
 
 			var f = this.faces[i];
 
@@ -346,14 +346,14 @@ THREE.ProxyGeometry.prototype.createFaceVertexTangentProxies = function(values)
 
 	if (values) {
 
-		for (var i = 0, l = values.length; i < l; i++) {
+		for (var i = 0, l = values.length; i < l; i ++) {
 
 			var f = this.faces[i],
 			    v = values[i];
 
 			if (v.vertexTangents.length > 0) {
 
-				for (var j = 0, l2 = f.vertexTangents.length; j < l2; j++) {
+				for (var j = 0, l2 = f.vertexTangents.length; j < l2; j ++) {
 
 					f.vertexTangents[j].copy(v.vertexTangents[j]);
 
@@ -384,7 +384,7 @@ THREE.ProxyGeometry.prototype.createUvProxies = function(values) {
 		var faces = this.faces;
 		var uvarray = this.attributes[ 'uv' ].array;
 
-		for (var i = 0, l = faces.length; i < l; i++) {
+		for (var i = 0, l = faces.length; i < l; i ++) {
 			var f = faces[i];
 
 			this.faceVertexUvs[0][i] = [];
@@ -408,9 +408,9 @@ THREE.ProxyGeometry.prototype.createUvProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0, l = values.length; i < l; i++) {
+		for (var i = 0, l = values.length; i < l; i ++) {
 
-			for (var j = 0, l2 = values[i].length; j < l2; j++) {
+			for (var j = 0, l2 = values[i].length; j < l2; j ++) {
 
 				var uv = values[i][j];
 				this.faceVertexUvs[0][i][j].copy(uv);
@@ -445,7 +445,7 @@ THREE.ProxyGeometry.prototype.createSkinIndexProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0; i < values.length; i++) {
+		for (var i = 0; i < values.length; i ++) {
 
 			this.skinIndices[i].copy(values[i]);
 
@@ -477,7 +477,7 @@ THREE.ProxyGeometry.prototype.createSkinWeightProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0; i < values.length; i++) {
+		for (var i = 0; i < values.length; i ++) {
 
 			this.skinWeights[i].copy(values[i]);
 
@@ -509,7 +509,7 @@ THREE.ProxyGeometry.prototype.createColorProxies = function(values) {
 
 	if (values) {
 
-		for (var i = 0; i < values.length; i++) {
+		for (var i = 0; i < values.length; i ++) {
 
 			this.colors[i].copy(values[i]);
 
@@ -585,7 +585,7 @@ THREE.ProxyGeometry.prototype.mergeVertices = function () {
 	// have to remove them from the geometry.
 	var faceIndicesToRemove = [];
 
-	for( i = 0, il = this.faces.length; i < il; i ++ ) {
+	for ( i = 0, il = this.faces.length; i < il; i ++ ) {
 
 		face = this.faces[ i ];
 

+ 2 - 2
examples/js/wip/benchmark/BoxGeometry2.js

@@ -86,9 +86,9 @@ THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegme
 
 		}
 
-		for ( iy = 0; iy < gridY; iy++ ) {
+		for ( iy = 0; iy < gridY; iy ++ ) {
 
-			for ( ix = 0; ix < gridX; ix++ ) {
+			for ( ix = 0; ix < gridX; ix ++ ) {
 
 				var a = ix + gridX1 * iy;
 				var b = ix + gridX1 * ( iy + 1 );

+ 1 - 1
examples/js/wip/benchmark/Geometry4.js

@@ -24,7 +24,7 @@ THREE.VectorArrayProxy = function(attribute) {
 
         this.attribute = attribute;
 
-        for (var i = 0, l = this.attribute.array.length / this.attribute.itemSize; i < l; i++)  {
+        for (var i = 0, l = this.attribute.array.length / this.attribute.itemSize; i < l; i ++) {
 
                 Object.defineProperty(this, i, {
                         get: (function(i) { return function() { return this.getValue(i); }})(i),

+ 1 - 1
examples/js/wip/proxies/MultiColor.js

@@ -12,7 +12,7 @@ THREE.MultiColor.prototype.constructor = THREE.MultiColor;
 
 THREE.MultiColor.prototype.setAll = function(axis, value) {
 
-	for (var i = 0, l = this.links.length; i < l; i++) {
+	for (var i = 0, l = this.links.length; i < l; i ++) {
 
 		this.links[i][axis] = value;
 

+ 1 - 1
examples/js/wip/proxies/MultiVector3.js

@@ -12,7 +12,7 @@ THREE.MultiVector3.prototype.constructor = THREE.MultiVector3;
 
 THREE.MultiVector3.prototype.setAll = function(axis, value) {
 
-	for (var i = 0, l = this.links.length; i < l; i++) {
+	for (var i = 0, l = this.links.length; i < l; i ++) {
 
 		this.links[i][axis] = value;
 

+ 2 - 2
src/core/Object3D.js

@@ -302,7 +302,7 @@ THREE.Object3D.prototype = {
 
 		if ( arguments.length > 1 ) {
 
-			for ( var i = 0; i < arguments.length; i++ ) {
+			for ( var i = 0; i < arguments.length; i ++ ) {
 
 				this.add( arguments[ i ] );
 
@@ -346,7 +346,7 @@ THREE.Object3D.prototype = {
 
 		if ( arguments.length > 1 ) {
 
-			for ( var i = 0; i < arguments.length; i++ ) {
+			for ( var i = 0; i < arguments.length; i ++ ) {
 
 				this.remove( arguments[ i ] );
 

+ 2 - 2
src/extras/FontUtils.js

@@ -156,7 +156,7 @@ THREE.FontUtils = {
 
 					x = outline[ i ++ ] * scaleX + offset;
 					y = outline[ i ++ ] * scaleY;
-					path.lineTo( x,y );
+					path.lineTo( x, y );
 					break;
 
 				case 'q':
@@ -367,7 +367,7 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
 
 				/* remove v from the remaining polygon */
 
-				for ( s = v, t = v + 1; t < nv; s++, t++ ) {
+				for ( s = v, t = v + 1; t < nv; s ++, t ++ ) {
 
 					verts[ s ] = verts[ t ];
 

+ 1 - 1
src/extras/ImageUtils.js

@@ -144,7 +144,7 @@ THREE.ImageUtils = {
 				points.push( [ - 1, 0, data[ ( y * width + lx ) * 4 ] / 255 * depth ] );
 				points.push( [ - 1, - 1, data[ ( ly * width + lx ) * 4 ] / 255 * depth ] );
 				points.push( [ 0, - 1, data[ ( ly * width + x ) * 4 ] / 255 * depth ] );
-				points.push( [  1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] );
+				points.push( [ 1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] );
 				points.push( [ 1, 0, data[ ( y * width + ux ) * 4 ] / 255 * depth ] );
 				points.push( [ 1, 1, data[ ( uy * width + ux ) * 4 ] / 255 * depth ] );
 				points.push( [ 0, 1, data[ ( uy * width + x ) * 4 ] / 255 * depth ] );

+ 2 - 2
src/extras/animation/Animation.js

@@ -28,7 +28,7 @@ THREE.Animation.prototype.keyTypes = [ "pos", "rot", "scl" ];
 THREE.Animation.prototype.play = function ( startTime, weight ) {
 
 	this.currentTime = startTime !== undefined ? startTime : 0;
-	this.weight = weight !== undefined ? weight: 1;
+	this.weight = weight !== undefined ? weight : 1;
 
 	this.isPlaying = true;
 
@@ -119,7 +119,7 @@ THREE.Animation.prototype.resetBlendWeights = function () {
 
 };
 
-THREE.Animation.prototype.update = (function(){
+THREE.Animation.prototype.update = (function() {
 
 	var points = [];
 	var target = new THREE.Vector3();

+ 4 - 4
src/extras/core/Curve.js

@@ -107,7 +107,7 @@ THREE.Curve.prototype.getLength = function () {
 
 THREE.Curve.prototype.getLengths = function ( divisions ) {
 
-	if ( ! divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions): 200;
+	if ( ! divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions) : 200;
 
 	if ( this.cacheArcLengths
 		&& ( this.cacheArcLengths.length == divisions + 1 )
@@ -222,7 +222,7 @@ THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
 
     // add that fractional amount to t
 
-    var t = ( i + segmentFraction ) / ( il -1 );
+    var t = ( i + segmentFraction ) / ( il - 1 );
 
 	return t;
 
@@ -281,8 +281,8 @@ THREE.Curve.Utils = {
 	tangentCubicBezier: function (t, p0, p1, p2, p3 ) {
 
 		return - 3 * p0 * (1 - t) * (1 - t)  +
-			3 * p1 * (1 - t) * (1-t) - 6 *t *p1 * (1-t) +
-			6 * t *  p2 * (1-t) - 3 * t * t * p2 +
+			3 * p1 * (1 - t) * (1 - t) - 6 * t * p1 * (1 - t) +
+			6 * t *  p2 * (1 - t) - 3 * t * t * p2 +
 			3 * t * t * p3;
 
 	},

+ 1 - 1
src/extras/core/CurvePath.js

@@ -36,7 +36,7 @@ THREE.CurvePath.prototype.closePath = function() {
 	// and verify for vector3 (needs to implement equals)
 	// Add a line curve if start and end of lines are not connected
 	var startPoint = this.curves[0].getPoint(0);
-	var endPoint = this.curves[this.curves.length-1].getPoint(1);
+	var endPoint = this.curves[this.curves.length - 1].getPoint(1);
 	
 	if (! startPoint.equals(endPoint)) {
 		this.curves.push( new THREE.LineCurve(endPoint, startPoint) );

+ 2 - 2
src/extras/core/Path.js

@@ -228,7 +228,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 		action = item.action;
 		args = item.args;
 
-		switch( action ) {
+		switch ( action ) {
 
 		case THREE.PathActions.MOVE_TO:
 
@@ -520,7 +520,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 		//  with the horizontal line through inPt, left of inPt
 		//  not counting lowerY endpoints of edges and whole edges on that line
 		var inside = false;
-		for( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
+		for ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
 			var edgeLowPt  = inPolygon[ p ];
 			var edgeHighPt = inPolygon[ q ];
 

+ 12 - 12
src/extras/core/Shape.js

@@ -173,16 +173,16 @@ THREE.Shape.Utils = {
 				if ( perpSeg2 == 0 ) {
 					if ( ( inExcludeAdjacentSegs ) &&
 						 ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) )		return [];
-					return  [ inSeg1Pt1 ];
+					return [ inSeg1Pt1 ];
 				}
 				if ( perpSeg2 == limit ) {
 					if ( ( inExcludeAdjacentSegs ) &&
 						 ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) )		return [];
-					return  [ inSeg1Pt2 ];
+					return [ inSeg1Pt2 ];
 				}
 				// intersection at endpoint of segment#2?
-				if ( perpSeg1 == 0 )		return  [ inSeg2Pt1 ];
-				if ( perpSeg1 == limit )	return  [ inSeg2Pt2 ];
+				if ( perpSeg1 == 0 )		return [ inSeg2Pt1 ];
+				if ( perpSeg1 == limit )	return [ inSeg2Pt2 ];
 
 				// return real intersection point
 				var factorSeg1 = perpSeg2 / limit;
@@ -200,17 +200,17 @@ THREE.Shape.Utils = {
 				if ( seg1Pt && seg2Pt ) {
 					if ( (inSeg1Pt1.x != inSeg2Pt1.x) ||
 						 (inSeg1Pt1.y != inSeg2Pt1.y) )		return [];   	// they are distinct  points
-					return  [ inSeg1Pt1 ];                 					// they are the same point
+					return [ inSeg1Pt1 ];                 					// they are the same point
 				}
 				// segment#1  is a single point
 				if ( seg1Pt ) {
 					if (! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) )		return [];		// but not in segment#2
-					return  [ inSeg1Pt1 ];
+					return [ inSeg1Pt1 ];
 				}
 				// segment#2  is a single point
 				if ( seg2Pt ) {
 					if (! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) )		return [];		// but not in segment#1
-					return  [ inSeg2Pt1 ];
+					return [ inSeg2Pt1 ];
 				}
 
 				// they are collinear segments, which might overlap
@@ -341,7 +341,7 @@ THREE.Shape.Utils = {
 				// checks for intersections with shape edges
 				var sIdx, nextIdx, intersection;
 				for ( sIdx = 0; sIdx < shape.length; sIdx ++ ) {
-					nextIdx = sIdx+1; nextIdx %= shape.length;
+					nextIdx = sIdx + 1; nextIdx %= shape.length;
 					intersection = intersect_segments_2D( inShapePt, inHolePt, shape[sIdx], shape[nextIdx], true );
 					if ( intersection.length > 0 )		return	true;
 				}
@@ -358,7 +358,7 @@ THREE.Shape.Utils = {
 				for ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx ++ ) {
 					chkHole = holes[indepHoles[ihIdx]];
 					for ( hIdx = 0; hIdx < chkHole.length; hIdx ++ ) {
-						nextIdx = hIdx+1; nextIdx %= chkHole.length;
+						nextIdx = hIdx + 1; nextIdx %= chkHole.length;
 						intersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[hIdx], chkHole[nextIdx], true );
 						if ( intersection.length > 0 )		return	true;
 					}
@@ -410,12 +410,12 @@ THREE.Shape.Utils = {
 							if ( intersectsHoleEdge( shapePt, holePt ) )		continue;
 
 							holeIndex = h2;
-							indepHoles.splice(h,1);
+							indepHoles.splice(h, 1);
 
-							tmpShape1 = shape.slice( 0, shapeIndex+1 );
+							tmpShape1 = shape.slice( 0, shapeIndex + 1 );
 							tmpShape2 = shape.slice( shapeIndex );
 							tmpHole1 = hole.slice( holeIndex );
-							tmpHole2 = hole.slice( 0, holeIndex+1 );
+							tmpHole2 = hole.slice( 0, holeIndex + 1 );
 
 							shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );
 

+ 2 - 2
src/extras/curves/SplineCurve.js

@@ -21,8 +21,8 @@ THREE.SplineCurve.prototype.getPoint = function ( t ) {
 
 	var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ]
 	var point1 = points[ intPoint ]
-	var point2 = points[ intPoint > points.length - 2 ? points.length -1 : intPoint + 1 ]
-	var point3 = points[ intPoint > points.length - 3 ? points.length -1 : intPoint + 2 ]
+	var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]
+	var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]
 
 	var vector = new THREE.Vector2();
 

+ 8 - 8
src/extras/geometries/ExtrudeGeometry.js

@@ -163,7 +163,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 
 	var contour = vertices; // vertices has all points but contour has only points of circumference
 
-	for ( h = 0, hl = holes.length;  h < hl; h ++ ) {
+	for ( h = 0, hl = holes.length; h < hl; h ++ ) {
 
 		ahole = holes[ h ];
 
@@ -296,7 +296,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		var pt_j = contour[ j ];
 		var pt_k = contour[ k ];
 
-		contourMovements[ i ]= getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
+		contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
 
 	}
 
@@ -314,7 +314,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 			if ( k === il ) k = 0;
 
 			//  (j)---(i)---(k)
-			oneHoleMovements[ i ]= getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
+			oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
 
 		}
 
@@ -333,7 +333,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		z = bevelThickness * ( 1 - t );
 
 		//z = bevelThickness * t;
-		bs = bevelSize * ( Math.sin ( t * Math.PI/2 ) ) ; // curved
+		bs = bevelSize * ( Math.sin ( t * Math.PI / 2 ) ) ; // curved
 		//bs = bevelSize * t ; // linear
 
 		// contract shape
@@ -433,7 +433,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		t = b / bevelSegments;
 		z = bevelThickness * ( 1 - t );
 		//bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );
-		bs = bevelSize * Math.sin ( t * Math.PI/2 ) ;
+		bs = bevelSize * Math.sin ( t * Math.PI / 2 ) ;
 
 		// contract shape
 
@@ -496,7 +496,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 			for ( i = 0; i < flen; i ++ ) {
 
 				face = faces[ i ];
-				f3( face[ 2 ]+ offset, face[ 1 ]+ offset, face[ 0 ] + offset );
+				f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );
 
 			}
 
@@ -543,7 +543,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		sidewalls( contour, layeroffset );
 		layeroffset += contour.length;
 
-		for ( h = 0, hl = holes.length;  h < hl; h ++ ) {
+		for ( h = 0, hl = holes.length; h < hl; h ++ ) {
 
 			ahole = holes[ h ];
 			sidewalls( ahole, layeroffset );
@@ -560,7 +560,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		var j, k;
 		i = contour.length;
 
-		while ( --i >= 0 ) {
+		while ( -- i >= 0 ) {
 
 			j = i;
 			k = i - 1;

+ 6 - 6
src/extras/geometries/TubeGeometry.js

@@ -252,17 +252,17 @@ THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
 
 	for ( i = 1; i < numpoints; i ++ ) {
 
-		normals[ i ] = normals[ i-1 ].clone();
+		normals[ i ] = normals[ i - 1 ].clone();
 
-		binormals[ i ] = binormals[ i-1 ].clone();
+		binormals[ i ] = binormals[ i - 1 ].clone();
 
-		vec.crossVectors( tangents[ i-1 ], tangents[ i ] );
+		vec.crossVectors( tangents[ i - 1 ], tangents[ i ] );
 
 		if ( vec.length() > epsilon ) {
 
 			vec.normalize();
 
-			theta = Math.acos( THREE.Math.clamp( tangents[ i-1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
+			theta = Math.acos( THREE.Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
 
 			normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );
 
@@ -277,10 +277,10 @@ THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
 
 	if ( closed ) {
 
-		theta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints-1 ] ), - 1, 1 ) );
+		theta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints - 1 ] ), - 1, 1 ) );
 		theta /= ( numpoints - 1 );
 
-		if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints-1 ] ) ) > 0 ) {
+		if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints - 1 ] ) ) > 0 ) {
 
 			theta = - theta;
 

+ 1 - 1
src/lights/DirectionalLight.js

@@ -47,7 +47,7 @@ THREE.DirectionalLight = function ( color, intensity ) {
 	this.shadowCascadeHeight = [ 512, 512, 512 ];
 
 	this.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ];
-	this.shadowCascadeFarZ  = [  0.990, 0.998, 1.000 ];
+	this.shadowCascadeFarZ  = [ 0.990, 0.998, 1.000 ];
 
 	this.shadowCascadeArray = [];
 

+ 1 - 1
src/loaders/BinaryTextureLoader.js

@@ -34,7 +34,7 @@ THREE.BinaryTextureLoader.prototype = {
 
 				texture.image = texData.image;
 
-			} else if ( undefined !== texData.data ){
+			} else if ( undefined !== texData.data ) {
 
 				texture.image.width = texData.width;
 				texture.image.height = texData.height;

+ 1 - 1
src/math/Ray.js

@@ -345,7 +345,7 @@ THREE.Ray.prototype = {
 
 	}(),
 
-	intersectBox: function ( box , optionalTarget ) {
+	intersectBox: function ( box, optionalTarget ) {
 
 		// http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/
 

+ 1 - 1
src/math/Sphere.js

@@ -26,7 +26,7 @@ THREE.Sphere.prototype = {
 
 		var box = new THREE.Box3();
 
-		return function ( points, optionalCenter )  {
+		return function ( points, optionalCenter ) {
 
 			var center = this.center;
 

+ 2 - 2
src/objects/LensFlare.js

@@ -12,7 +12,7 @@ THREE.LensFlare = function ( texture, size, distance, blending, color ) {
 	this.positionScreen = new THREE.Vector3();
 	this.customUpdateCallback = undefined;
 
-	if( texture !== undefined ) {
+	if ( texture !== undefined ) {
 
 		this.add( texture, size, distance, blending, color );
 
@@ -64,7 +64,7 @@ THREE.LensFlare.prototype.updateLensFlares = function () {
 	var vecX = - this.positionScreen.x * 2;
 	var vecY = - this.positionScreen.y * 2;
 
-	for( f = 0; f < fl; f ++ ) {
+	for ( f = 0; f < fl; f ++ ) {
 
 		flare = this.lensFlares[ f ];
 

+ 1 - 1
src/objects/Line.js

@@ -72,7 +72,7 @@ THREE.Line.prototype.raycast = ( function () {
 
 				}
 
-				for ( var oi = 0; oi < offsets.length; oi++){
+				for ( var oi = 0; oi < offsets.length; oi ++) {
 
 					var start = offsets[ oi ].start;
 					var count = offsets[ oi ].count;

+ 2 - 2
src/objects/Mesh.js

@@ -90,7 +90,7 @@ THREE.Mesh.prototype.raycast = ( function () {
 
 		if ( geometry.boundingBox !== null ) {
 
-			if ( ray.isIntersectionBox( geometry.boundingBox ) === false )  {
+			if ( ray.isIntersectionBox( geometry.boundingBox ) === false ) {
 
 				return;
 
@@ -121,7 +121,7 @@ THREE.Mesh.prototype.raycast = ( function () {
 
 				}
 
-				for ( var oi = 0, ol = offsets.length; oi < ol; ++oi ) {
+				for ( var oi = 0, ol = offsets.length; oi < ol; ++ oi ) {
 
 					var start = offsets[ oi ].start;
 					var count = offsets[ oi ].count;

+ 1 - 1
src/objects/PointCloud.js

@@ -91,7 +91,7 @@ THREE.PointCloud.prototype.raycast = ( function () {
 
 				}
 
-				for ( var oi = 0, ol = offsets.length; oi < ol; ++oi ) {
+				for ( var oi = 0, ol = offsets.length; oi < ol; ++ oi ) {
 
 					var start = offsets[ oi ].start;
 					var count = offsets[ oi ].count;

+ 2 - 2
src/objects/SkinnedMesh.js

@@ -25,7 +25,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {
 
 		var bone, gbone, p, q, s;
 
-		for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++b ) {
+		for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) {
 
 			gbone = this.geometry.bones[ b ];
 
@@ -52,7 +52,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {
 
 		}
 
-		for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++b ) {
+		for ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) {
 
 			gbone = this.geometry.bones[ b ];
 

Some files were not shown because too many files changed in this diff