Browse Source

Merge remote-tracking branch 'upstream/dev' into dev7

Mugen87 7 years ago
parent
commit
560d1219b4
59 changed files with 1523 additions and 1241 deletions
  1. 143 35
      build/three.js
  2. 304 304
      build/three.min.js
  3. 143 35
      build/three.module.js
  4. 1 1
      docs/api/geometries/CircleBufferGeometry.html
  5. 2 2
      docs/api/geometries/ConeBufferGeometry.html
  6. 3 3
      docs/api/geometries/CylinderBufferGeometry.html
  7. 3 3
      docs/api/geometries/RingBufferGeometry.html
  8. 1 1
      docs/api/geometries/SphereBufferGeometry.html
  9. 2 2
      docs/api/geometries/TorusBufferGeometry.html
  10. 2 2
      docs/api/geometries/TorusKnotBufferGeometry.html
  11. 7 0
      docs/api/math/Box3.html
  12. 8 1
      docs/api/math/Triangle.html
  13. 12 1
      docs/api/objects/Sprite.html
  14. 1 1
      docs/api/renderers/WebGLRenderTarget.html
  15. 5 4
      docs/examples/loaders/MTLLoader.html
  16. 217 281
      docs/scenes/js/geometry.js
  17. 174 173
      docs/scenes/js/material.js
  18. 1 1
      editor/js/Editor.js
  19. 3 3
      editor/js/Viewport.Info.js
  20. 13 22
      editor/js/Viewport.js
  21. 2 37
      editor/js/libs/tern-threejs/threejs.js
  22. 12 13
      examples/js/AnimationClipCreator.js
  23. 20 20
      examples/js/GPUParticleSystem.js
  24. 1 1
      examples/js/exporters/GLTFExporter.js
  25. 1 1
      examples/js/loaders/FBXLoader.js
  26. 4 2
      examples/js/loaders/MTLLoader.js
  27. 1 1
      examples/webgl_lights_rectarealight.html
  28. 5 8
      examples/webgl_points_dynamic.html
  29. 10 10
      examples/webgl_sprites.html
  30. 217 166
      examples/webgl_tiled_forward.html
  31. 2 2
      examples/webvr_cubes.html
  32. 2 2
      examples/webvr_daydream.html
  33. 2 2
      examples/webvr_gearvr.html
  34. 2 2
      examples/webvr_panorama.html
  35. 2 2
      examples/webvr_rollercoaster.html
  36. 2 2
      examples/webvr_sandbox.html
  37. 2 2
      examples/webvr_video.html
  38. 2 2
      examples/webvr_vive.html
  39. 2 2
      examples/webvr_vive_dragging.html
  40. 2 2
      examples/webvr_vive_paint.html
  41. 2 2
      examples/webvr_vive_sculpt.html
  42. 1 1
      package.json
  43. 3 3
      src/Three.Legacy.js
  44. 1 37
      src/extras/core/Font.js
  45. 2 2
      src/lights/PointLight.js
  46. 2 2
      src/lights/SpotLight.js
  47. 0 1
      src/loaders/ObjectLoader.js
  48. 101 0
      src/math/Box3.js
  49. 3 1
      src/math/Quaternion.js
  50. 6 0
      src/math/Triangle.js
  51. 14 0
      src/objects/Sprite.js
  52. 4 2
      src/renderers/WebGLRenderer.js
  53. 8 1
      src/renderers/webgl/WebGLSpriteRenderer.js
  54. 1 0
      test/three.example.unit.js
  55. 0 2
      test/three.source.unit.js
  56. 1 1
      test/unit/example/objects/LensFlare.tests.js
  57. 18 0
      test/unit/src/math/Box3.tests.js
  58. 18 0
      test/unit/src/math/Triangle.tests.js
  59. 0 32
      test/unit/src/renderers/webgl/WebGLFlareRenderer.tests.js

+ 143 - 35
build/three.js

@@ -2281,7 +2281,9 @@
 
 		inverse: function () {
 
-			return this.conjugate().normalize();
+			// quaternion is assumed to have unit length
+
+			return this.conjugate();
 
 		},
 
@@ -6714,6 +6716,7 @@
 				uvScale: gl.getUniformLocation( program, 'uvScale' ),
 
 				rotation: gl.getUniformLocation( program, 'rotation' ),
+				center: gl.getUniformLocation( program, 'center' ),
 				scale: gl.getUniformLocation( program, 'scale' ),
 
 				color: gl.getUniformLocation( program, 'color' ),
@@ -6830,6 +6833,7 @@
 			// render all sprites
 
 			var scale = [];
+			var center = [];
 
 			for ( var i = 0, l = sprites.length; i < l; i ++ ) {
 
@@ -6848,6 +6852,9 @@
 				scale[ 0 ] = spriteScale.x;
 				scale[ 1 ] = spriteScale.y;
 
+				center[ 0 ] = sprite.center.x - 0.5;
+				center[ 1 ] = sprite.center.y - 0.5;
+
 				var fogType = 0;
 
 				if ( scene.fog && material.fog ) {
@@ -6879,6 +6886,7 @@
 				gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b );
 
 				gl.uniform1f( uniforms.rotation, material.rotation );
+				gl.uniform2fv( uniforms.center, center );
 				gl.uniform2fv( uniforms.scale, scale );
 
 				state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );
@@ -6918,6 +6926,7 @@
 				'uniform mat4 modelViewMatrix;',
 				'uniform mat4 projectionMatrix;',
 				'uniform float rotation;',
+				'uniform vec2 center;',
 				'uniform vec2 scale;',
 				'uniform vec2 uvOffset;',
 				'uniform vec2 uvScale;',
@@ -6932,7 +6941,7 @@
 
 				'	vUV = uvOffset + uv * uvScale;',
 
-				'	vec2 alignedPosition = position * scale;',
+				'	vec2 alignedPosition = ( position - center ) * scale;',
 
 				'	vec2 rotatedPosition;',
 				'	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;',
@@ -7930,6 +7939,107 @@
 
 		},
 
+		intersectsTriangle: ( function () {
+
+			// triangle centered vertices
+			var v0 = new Vector3();
+			var v1 = new Vector3();
+			var v2 = new Vector3();
+
+			// triangle edge vectors
+			var f0 = new Vector3();
+			var f1 = new Vector3();
+			var f2 = new Vector3();
+
+			var testAxis = new Vector3();
+
+			var center = new Vector3();
+			var extents = new Vector3();
+
+			var triangleNormal = new Vector3();
+
+			function satForAxes( axes ) {
+
+				var i, j;
+
+				for ( i = 0, j = axes.length - 3; i <= j; i += 3 ) {
+
+					testAxis.fromArray( axes, i );
+					// project the aabb onto the seperating axis
+					var r = extents.x * Math.abs( testAxis.x ) + extents.y * Math.abs( testAxis.y ) + extents.z * Math.abs( testAxis.z );
+					// project all 3 vertices of the triangle onto the seperating axis
+					var p0 = v0.dot( testAxis );
+					var p1 = v1.dot( testAxis );
+					var p2 = v2.dot( testAxis );
+					// actual test, basically see if either of the most extreme of the triangle points intersects r
+					if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
+
+						// points of the projected triangle are outside the projected half-length of the aabb
+						// the axis is seperating and we can exit
+						return false;
+
+					}
+
+				}
+
+				return true;
+
+			}
+
+			return function intersectsTriangle( triangle ) {
+
+				if ( this.isEmpty() ) {
+
+					return false;
+
+				}
+
+				// compute box center and extents
+				this.getCenter( center );
+				extents.subVectors( this.max, center );
+
+				// translate triangle to aabb origin
+				v0.subVectors( triangle.a, center );
+				v1.subVectors( triangle.b, center );
+				v2.subVectors( triangle.c, center );
+
+				// compute edge vectors for triangle
+				f0.subVectors( v1, v0 );
+				f1.subVectors( v2, v1 );
+				f2.subVectors( v0, v2 );
+
+				// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
+				// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
+				// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
+				var axes = [
+					0, - f0.z, f0.y, 0, - f1.z, f1.y, 0, - f2.z, f2.y,
+					f0.z, 0, - f0.x, f1.z, 0, - f1.x, f2.z, 0, - f2.x,
+					- f0.y, f0.x, 0, - f1.y, f1.x, 0, - f2.y, f2.x, 0
+				];
+				if ( ! satForAxes( axes ) ) {
+
+					return false;
+
+				}
+
+				// test 3 face normals from the aabb
+				axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
+				if ( ! satForAxes( axes ) ) {
+
+					return false;
+
+				}
+
+				// finally testing the face normal of the triangle
+				// use already existing triangle edge vectors here
+				triangleNormal.crossVectors( f0, f1 );
+				axes = [ triangleNormal.x, triangleNormal.y, triangleNormal.z ];
+				return satForAxes( axes );
+
+			};
+
+		} )(),
+
 		clampPoint: function ( point, optionalTarget ) {
 
 			var result = optionalTarget || new Vector3();
@@ -15319,6 +15429,12 @@
 
 		},
 
+		intersectsBox: function ( box ) {
+
+			return box.intersectsTriangle( this );
+
+		},
+
 		closestPointToPoint: function () {
 
 			var plane = new Plane();
@@ -20779,7 +20895,7 @@
 
 		};
 
-		function resetInfo () {
+		function resetInfo() {
 
 			_infoRender.frame ++;
 			_infoRender.calls = 0;
@@ -21357,7 +21473,7 @@
 
 			//
 
-			var dataCount = 0;
+			var dataCount = Infinity;
 
 			if ( index !== null ) {
 
@@ -21813,7 +21929,7 @@
 
 			state.setPolygonOffset( false );
 
-			scene.onAfterRender( _this, scene, camera, renderTarget );
+			scene.onAfterRender( _this, scene, camera );
 
 			if ( vr.enabled ) {
 
@@ -21823,6 +21939,8 @@
 
 			// _gl.finish();
 
+			currentRenderList = null;
+
 		};
 
 		/*
@@ -23355,6 +23473,8 @@
 
 		this.material = ( material !== undefined ) ? material : new SpriteMaterial();
 
+		this.center = new Vector2( 0.5, 0.5 );
+
 	}
 
 	Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
@@ -23400,8 +23520,19 @@
 
 			return new this.constructor( this.material ).copy( this );
 
+		},
+
+		copy: function ( source ) {
+
+			Object3D.prototype.copy.call( this, source );
+
+			if ( source.center !== undefined ) this.center.copy( source.center );
+
+			return this;
+
 		}
 
+
 	} );
 
 	/**
@@ -32928,14 +33059,14 @@
 			get: function () {
 
 				// intensity = power per solid angle.
-				// ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+				// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 				return this.intensity * Math.PI;
 
 			},
 			set: function ( power ) {
 
 				// intensity = power per solid angle.
-				// ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+				// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 				this.intensity = power / Math.PI;
 
 			}
@@ -32990,14 +33121,14 @@
 			get: function () {
 
 				// intensity = power per solid angle.
-				// ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+				// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 				return this.intensity * 4 * Math.PI;
 
 			},
 			set: function ( power ) {
 
 				// intensity = power per solid angle.
-				// ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+				// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 				this.intensity = power / ( 4 * Math.PI );
 
 			}
@@ -37360,8 +37491,7 @@
 
 		var path = new ShapePath();
 
-		var pts = [];
-		var x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, laste;
+		var x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
 
 		if ( glyph.o ) {
 
@@ -37400,17 +37530,6 @@
 
 						path.quadraticCurveTo( cpx1, cpy1, cpx, cpy );
 
-						laste = pts[ pts.length - 1 ];
-
-						if ( laste ) {
-
-							cpx0 = laste.x;
-							cpy0 = laste.y;
-
-							
-
-						}
-
 						break;
 
 					case 'b': // bezierCurveTo
@@ -37424,17 +37543,6 @@
 
 						path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );
 
-						laste = pts[ pts.length - 1 ];
-
-						if ( laste ) {
-
-							cpx0 = laste.x;
-							cpy0 = laste.y;
-
-							
-
-						}
-
 						break;
 
 				}
@@ -44745,7 +44853,7 @@
 				return undefined;
 
 			},
-			set: function ( value ) {
+			set: function ( /* value */ ) {
 
 				console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );
 
@@ -44762,7 +44870,7 @@
 				return undefined;
 
 			},
-			set: function ( cullFace ) {
+			set: function ( /* cullFace */ ) {
 
 				console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );
 

File diff suppressed because it is too large
+ 304 - 304
build/three.min.js


+ 143 - 35
build/three.module.js

@@ -2275,7 +2275,9 @@ Object.assign( Quaternion.prototype, {
 
 	inverse: function () {
 
-		return this.conjugate().normalize();
+		// quaternion is assumed to have unit length
+
+		return this.conjugate();
 
 	},
 
@@ -6708,6 +6710,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			uvScale: gl.getUniformLocation( program, 'uvScale' ),
 
 			rotation: gl.getUniformLocation( program, 'rotation' ),
+			center: gl.getUniformLocation( program, 'center' ),
 			scale: gl.getUniformLocation( program, 'scale' ),
 
 			color: gl.getUniformLocation( program, 'color' ),
@@ -6824,6 +6827,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 		// render all sprites
 
 		var scale = [];
+		var center = [];
 
 		for ( var i = 0, l = sprites.length; i < l; i ++ ) {
 
@@ -6842,6 +6846,9 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			scale[ 0 ] = spriteScale.x;
 			scale[ 1 ] = spriteScale.y;
 
+			center[ 0 ] = sprite.center.x - 0.5;
+			center[ 1 ] = sprite.center.y - 0.5;
+
 			var fogType = 0;
 
 			if ( scene.fog && material.fog ) {
@@ -6873,6 +6880,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b );
 
 			gl.uniform1f( uniforms.rotation, material.rotation );
+			gl.uniform2fv( uniforms.center, center );
 			gl.uniform2fv( uniforms.scale, scale );
 
 			state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );
@@ -6912,6 +6920,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			'uniform mat4 modelViewMatrix;',
 			'uniform mat4 projectionMatrix;',
 			'uniform float rotation;',
+			'uniform vec2 center;',
 			'uniform vec2 scale;',
 			'uniform vec2 uvOffset;',
 			'uniform vec2 uvScale;',
@@ -6926,7 +6935,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 
 			'	vUV = uvOffset + uv * uvScale;',
 
-			'	vec2 alignedPosition = position * scale;',
+			'	vec2 alignedPosition = ( position - center ) * scale;',
 
 			'	vec2 rotatedPosition;',
 			'	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;',
@@ -7924,6 +7933,107 @@ Object.assign( Box3.prototype, {
 
 	},
 
+	intersectsTriangle: ( function () {
+
+		// triangle centered vertices
+		var v0 = new Vector3();
+		var v1 = new Vector3();
+		var v2 = new Vector3();
+
+		// triangle edge vectors
+		var f0 = new Vector3();
+		var f1 = new Vector3();
+		var f2 = new Vector3();
+
+		var testAxis = new Vector3();
+
+		var center = new Vector3();
+		var extents = new Vector3();
+
+		var triangleNormal = new Vector3();
+
+		function satForAxes( axes ) {
+
+			var i, j;
+
+			for ( i = 0, j = axes.length - 3; i <= j; i += 3 ) {
+
+				testAxis.fromArray( axes, i );
+				// project the aabb onto the seperating axis
+				var r = extents.x * Math.abs( testAxis.x ) + extents.y * Math.abs( testAxis.y ) + extents.z * Math.abs( testAxis.z );
+				// project all 3 vertices of the triangle onto the seperating axis
+				var p0 = v0.dot( testAxis );
+				var p1 = v1.dot( testAxis );
+				var p2 = v2.dot( testAxis );
+				// actual test, basically see if either of the most extreme of the triangle points intersects r
+				if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
+
+					// points of the projected triangle are outside the projected half-length of the aabb
+					// the axis is seperating and we can exit
+					return false;
+
+				}
+
+			}
+
+			return true;
+
+		}
+
+		return function intersectsTriangle( triangle ) {
+
+			if ( this.isEmpty() ) {
+
+				return false;
+
+			}
+
+			// compute box center and extents
+			this.getCenter( center );
+			extents.subVectors( this.max, center );
+
+			// translate triangle to aabb origin
+			v0.subVectors( triangle.a, center );
+			v1.subVectors( triangle.b, center );
+			v2.subVectors( triangle.c, center );
+
+			// compute edge vectors for triangle
+			f0.subVectors( v1, v0 );
+			f1.subVectors( v2, v1 );
+			f2.subVectors( v0, v2 );
+
+			// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
+			// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
+			// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
+			var axes = [
+				0, - f0.z, f0.y, 0, - f1.z, f1.y, 0, - f2.z, f2.y,
+				f0.z, 0, - f0.x, f1.z, 0, - f1.x, f2.z, 0, - f2.x,
+				- f0.y, f0.x, 0, - f1.y, f1.x, 0, - f2.y, f2.x, 0
+			];
+			if ( ! satForAxes( axes ) ) {
+
+				return false;
+
+			}
+
+			// test 3 face normals from the aabb
+			axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
+			if ( ! satForAxes( axes ) ) {
+
+				return false;
+
+			}
+
+			// finally testing the face normal of the triangle
+			// use already existing triangle edge vectors here
+			triangleNormal.crossVectors( f0, f1 );
+			axes = [ triangleNormal.x, triangleNormal.y, triangleNormal.z ];
+			return satForAxes( axes );
+
+		};
+
+	} )(),
+
 	clampPoint: function ( point, optionalTarget ) {
 
 		var result = optionalTarget || new Vector3();
@@ -15313,6 +15423,12 @@ Object.assign( Triangle.prototype, {
 
 	},
 
+	intersectsBox: function ( box ) {
+
+		return box.intersectsTriangle( this );
+
+	},
+
 	closestPointToPoint: function () {
 
 		var plane = new Plane();
@@ -20773,7 +20889,7 @@ function WebGLRenderer( parameters ) {
 
 	};
 
-	function resetInfo () {
+	function resetInfo() {
 
 		_infoRender.frame ++;
 		_infoRender.calls = 0;
@@ -21351,7 +21467,7 @@ function WebGLRenderer( parameters ) {
 
 		//
 
-		var dataCount = 0;
+		var dataCount = Infinity;
 
 		if ( index !== null ) {
 
@@ -21807,7 +21923,7 @@ function WebGLRenderer( parameters ) {
 
 		state.setPolygonOffset( false );
 
-		scene.onAfterRender( _this, scene, camera, renderTarget );
+		scene.onAfterRender( _this, scene, camera );
 
 		if ( vr.enabled ) {
 
@@ -21817,6 +21933,8 @@ function WebGLRenderer( parameters ) {
 
 		// _gl.finish();
 
+		currentRenderList = null;
+
 	};
 
 	/*
@@ -23349,6 +23467,8 @@ function Sprite( material ) {
 
 	this.material = ( material !== undefined ) ? material : new SpriteMaterial();
 
+	this.center = new Vector2( 0.5, 0.5 );
+
 }
 
 Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
@@ -23394,8 +23514,19 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return new this.constructor( this.material ).copy( this );
 
+	},
+
+	copy: function ( source ) {
+
+		Object3D.prototype.copy.call( this, source );
+
+		if ( source.center !== undefined ) this.center.copy( source.center );
+
+		return this;
+
 	}
 
+
 } );
 
 /**
@@ -32922,14 +33053,14 @@ function SpotLight( color, intensity, distance, angle, penumbra, decay ) {
 		get: function () {
 
 			// intensity = power per solid angle.
-			// ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			return this.intensity * Math.PI;
 
 		},
 		set: function ( power ) {
 
 			// intensity = power per solid angle.
-			// ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			this.intensity = power / Math.PI;
 
 		}
@@ -32984,14 +33115,14 @@ function PointLight( color, intensity, distance, decay ) {
 		get: function () {
 
 			// intensity = power per solid angle.
-			// ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			return this.intensity * 4 * Math.PI;
 
 		},
 		set: function ( power ) {
 
 			// intensity = power per solid angle.
-			// ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			this.intensity = power / ( 4 * Math.PI );
 
 		}
@@ -37354,8 +37485,7 @@ function createPath( char, divisions, scale, offsetX, offsetY, data ) {
 
 	var path = new ShapePath();
 
-	var pts = [];
-	var x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, laste;
+	var x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
 
 	if ( glyph.o ) {
 
@@ -37394,17 +37524,6 @@ function createPath( char, divisions, scale, offsetX, offsetY, data ) {
 
 					path.quadraticCurveTo( cpx1, cpy1, cpx, cpy );
 
-					laste = pts[ pts.length - 1 ];
-
-					if ( laste ) {
-
-						cpx0 = laste.x;
-						cpy0 = laste.y;
-
-						
-
-					}
-
 					break;
 
 				case 'b': // bezierCurveTo
@@ -37418,17 +37537,6 @@ function createPath( char, divisions, scale, offsetX, offsetY, data ) {
 
 					path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );
 
-					laste = pts[ pts.length - 1 ];
-
-					if ( laste ) {
-
-						cpx0 = laste.x;
-						cpy0 = laste.y;
-
-						
-
-					}
-
 					break;
 
 			}
@@ -44739,7 +44847,7 @@ Object.defineProperties( WebGLRenderer.prototype, {
 			return undefined;
 
 		},
-		set: function ( value ) {
+		set: function ( /* value */ ) {
 
 			console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );
 
@@ -44756,7 +44864,7 @@ Object.defineProperties( WebGLShadowMap.prototype, {
 			return undefined;
 
 		},
-		set: function ( cullFace ) {
+		set: function ( /* cullFace */ ) {
 
 			console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );
 

+ 1 - 1
docs/api/geometries/CircleBufferGeometry.html

@@ -45,7 +45,7 @@
 
 		<h3>[name]([page:Float radius], [page:Integer segments], [page:Float thetaStart], [page:Float thetaLength])</h3>
 		<div>
-		radius — Radius of the circle, default = 50.<br />
+		radius — Radius of the circle, default = 1.<br />
 		segments — Number of segments (triangles), minimum = 3, default = 8.<br />
 		thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
 		thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle.

+ 2 - 2
docs/api/geometries/ConeBufferGeometry.html

@@ -44,8 +44,8 @@
 
 		<h3>[name]([page:Float radius], [page:Float height], [page:Integer radialSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
 		<div>
-		radius — Radius of the cone base. Default is 20.<br />
-		height — Height of the cone. Default is 100.<br />
+		radius — Radius of the cone base. Default is 1.<br />
+		height — Height of the cone. Default is 1.<br />
 		radialSegments — Number of segmented faces around the circumference of the cone. Default is 8<br />
 		heightSegments — Number of rows of faces along the height of the cone. Default is 1.<br />
 		openEnded — A Boolean indicating whether the base of the cone is open or capped. Default is false, meaning capped.<br />

+ 3 - 3
docs/api/geometries/CylinderBufferGeometry.html

@@ -44,9 +44,9 @@
 
 		<h3>[name]([page:Float radiusTop], [page:Float radiusBottom], [page:Float height], [page:Integer radialSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
 		<div>
-		radiusTop — Radius of the cylinder at the top. Default is 20.<br />
-		radiusBottom — Radius of the cylinder at the bottom. Default is 20.<br />
-		height — Height of the cylinder. Default is 100.<br />
+		radiusTop — Radius of the cylinder at the top. Default is 1.<br />
+		radiusBottom — Radius of the cylinder at the bottom. Default is 1.<br />
+		height — Height of the cylinder. Default is 1.<br />
 		radialSegments — Number of segmented faces around the circumference of the cylinder. Default is 8<br />
 		heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.<br />
 		openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.<br />

+ 3 - 3
docs/api/geometries/RingBufferGeometry.html

@@ -44,10 +44,10 @@
 
 		<h3>[name]([page:Float innerRadius], [page:Float outerRadius], [page:Integer thetaSegments], [page:Integer phiSegments], [page:Float thetaStart], [page:Float thetaLength])</h3>
 		<div>
-		innerRadius — Default is 20. <br />
-		outerRadius — Default is 50. <br />
+		innerRadius — Default is 0.5. <br />
+		outerRadius — Default is 1. <br />
 		thetaSegments — Number of segments.  A higher number means the ring will be more round.  Minimum is 3.  Default is 8. <br />
-		phiSegments — Minimum is 1.  Default is 8.<br />
+		phiSegments — Minimum is 1.  Default is 1.<br />
 		thetaStart — Starting angle. Default is 0. <br />
 		thetaLength — Central angle.  Default is Math.PI * 2.
 		</div>

+ 1 - 1
docs/api/geometries/SphereBufferGeometry.html

@@ -45,7 +45,7 @@
 		<h3>[name]([page:Float radius], [page:Integer widthSegments], [page:Integer heightSegments], [page:Float phiStart], [page:Float phiLength], [page:Float thetaStart], [page:Float thetaLength])</h3>
 
 		<div>
-		radius — sphere radius. Default is 50.<br />
+		radius — sphere radius. Default is 1.<br />
 		widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8.<br />
 		heightSegments — number of vertical segments. Minimum value is 2, and the default is 6.<br />
 		phiStart — specify horizontal starting angle. Default is 0.<br />

+ 2 - 2
docs/api/geometries/TorusBufferGeometry.html

@@ -44,8 +44,8 @@
 
 		<h3>[name]([page:Float radius], [page:Float tube], [page:Integer radialSegments], [page:Integer tubularSegments], [page:Float arc])</h3>
 		<div>
-		radius — Default is 100. <br />
-		tube — Diameter of the tube.  Default is 40. <br />
+		radius — Default is 1. <br />
+		tube — Diameter of the tube.  Default is 0.4. <br />
 		radialSegments — Default is 8 <br />
 		tubularSegments — Default is 6. <br />
 		arc — Central angle.  Default is Math.PI * 2.

+ 2 - 2
docs/api/geometries/TorusKnotBufferGeometry.html

@@ -45,8 +45,8 @@
 		<h3>[name]([page:Float radius], [page:Float tube], [page:Integer tubularSegments], [page:Integer radialSegments], [page:Integer p], [page:Integer q])</h3>
 		<div>
 			<ul>
-				<li>radius — Default is 100.</li>
-				<li>tube — Diameter of the tube. Default is 40.</li>
+				<li>radius — Default is 1.</li>
+				<li>tube — Diameter of the tube. Default is 0.4.</li>
 				<li>tubularSegments — Default is 64.</li>
 				<li>radialSegments — Default is 8.</li>
 				<li>p — This value determines, how many times the geometry winds around its axis of rotational symmetry. Default is 2.</li>

+ 7 - 0
docs/api/math/Box3.html

@@ -209,6 +209,13 @@
 		Determines whether or not this box intersects [page:Sphere sphere].
 		</div>
 
+		<h3>[method:Boolean intersectsTriangle]( [page:Triangle triangle] )</h3>
+		<div>
+		[page:Triangle triangle] - [page:Triangle] to check for intersection against.<br /><br />
+
+		Determines whether or not this box intersects [page:Triangle triangle].
+		</div>
+
 		<h3>[method:Boolean isEmpty]()</h3>
 		<div>
 		Returns true if this box includes zero points within its bounds.<br>

+ 8 - 1
docs/api/math/Triangle.html

@@ -79,7 +79,7 @@
 		<div>
 		[page:Vector3 point] - [page:Vector3] to check.<br /><br />
 
-		Returns true if the passed vector is within the triangle.
+		Returns true if the passed point, when projected onto the plane of the triangle, lies within the triangle.
 		</div>
 
 		<h3>[method:Triangle copy]( [page:Triangle triangle] )</h3>
@@ -93,6 +93,13 @@
 		Returns true if the two triangles have identical [page:.a a], [page:.b b] and [page:.c c] properties.
 		</div>
 
+		<h3>[method:Boolean intersectsBox]( [page:Box3 box] )</h3>
+		<div>
+		[page:Box3 box] - Box to check for intersection against.<br /><br />
+
+		Determines whether or not this triangle intersects [page:Box3 box].
+		</div>
+
 		<h3>[method:Vector3 midpoint]( [page:Vector3 optionalTarget] )</h3>
 		<div>
 			[page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />

+ 12 - 1
docs/api/objects/Sprite.html

@@ -57,7 +57,13 @@ scene.add( sprite );
 		</div>
 
 
- 		<h2>Methods</h2>
+		<h3>[property:Vector2 center]</h3>
+		<div>
+		The sprite's anchor point, and the point around which the sprite rotates. A value of (0.5, 0.5) corresponds to the midpoint of the sprite.
+		A value of (0, 0) corresponds to the lower left corner of the sprite. The default is (0.5, 0.5).
+		</div>
+
+		<h2>Methods</h2>
 		<div>See the base [page:Object3D] class for common methods.</div>
 
 		<h3>[method:Sprite clone]()</h3>
@@ -65,6 +71,11 @@ scene.add( sprite );
 		Returns a clone of this Sprite object and any descendants.
 		</div>
 
+		<h3>[method:Sprite copy]( [page:Sprite sprite] )</h3>
+		<div>
+		Copies the properties of the passed sprite to this one.
+		</div>
+
 		<h3>[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )</h3>
 		<div>
 		Get intersections between a casted ray and this sprite.

+ 1 - 1
docs/api/renderers/WebGLRenderTarget.html

@@ -11,7 +11,7 @@
 		<h1>[name]</h1>
 
 		<div class="desc">
-			A [link:https://msdn.microsoft.com/en-us/library/bb976073.aspx render target] is a buffer
+			A [link:https://msdn.microsoft.com/en-us/library/ff604997.aspx render target] is a buffer
 			where the video card draws pixels for a scene that	is being rendered in the background.
 			It is used in different effects, such as applying postprocessing to a rendered image
 			before displaying it on the screen.

+ 5 - 4
docs/examples/loaders/MTLLoader.html

@@ -13,7 +13,7 @@
 
 		<div class="desc">A loader for loading an <em>.mtl</em> resource, used internaly by [page:OBJLoader] and [page:UTF8Loader].<br />
 		The Material Template Library format (MTL) or .MTL File Format is a companion file format to .OBJ that describes surface shading
-		(material) properties of objects within one or more .OBJ files. 		
+		(material) properties of objects within one or more .OBJ files.
 		</div>
 
 		<h2>Constructor</h2>
@@ -69,7 +69,7 @@
 		<div>
 			Set to true if you need to load textures from a different origin.
 		</div>
-	
+
 
 		<h3>[method:null setMaterialOptions]( [page:Object options] )</h3>
 		<div>
@@ -79,12 +79,13 @@
 				<li>wrap: What type of wrapping to apply for textures. THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping</li>
 				<li>normalizeRGB: RGBs need to be normalized to 0-1 from 0-255. Default: false, assumed to be already normalized</li>
 				<li>ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. Default: false</li>
+				<li>invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj exported from 3ds MAX, vcglib or meshlab. Default: false</li>
 			</ul>
 		</div>
 		<div>
 			Set of options on how to construct the materials
 		</div>
-	
+
 
 		<h3>[method:MTLLoaderMaterialCreator parse]( [page:String text] )</h3>
 		<div>
@@ -93,7 +94,7 @@
 		<div>
 			Parse a <em>mtl</em> text structure and return a [page:MTLLoaderMaterialCreator] instance.<br />
 		</div>
-		
+
 
 		<h2>Source</h2>
 

+ 217 - 281
docs/scenes/js/geometry.js

@@ -4,74 +4,6 @@
 
 var twoPi = Math.PI * 2;
 
-var constants = {
-
-	combine: {
-
-		"THREE.MultiplyOperation" : THREE.MultiplyOperation,
-		"THREE.MixOperation" : THREE.MixOperation,
-		"THREE.AddOperation" : THREE.AddOperation
-
-	},
-
-	side : {
-
-		"THREE.FrontSide" : THREE.FrontSide,
-		"THREE.BackSide" : THREE.BackSide,
-		"THREE.DoubleSide" : THREE.DoubleSide
-
-	},
-
-	colors : {
-
-		"THREE.NoColors" : THREE.NoColors,
-		"THREE.FaceColors" : THREE.FaceColors,
-		"THREE.VertexColors" : THREE.VertexColors
-
-	},
-
-	blendingMode : {
-
-		"THREE.NoBlending" : THREE.NoBlending,
-		"THREE.NormalBlending" : THREE.NormalBlending,
-		"THREE.AdditiveBlending" : THREE.AdditiveBlending,
-		"THREE.SubtractiveBlending" : THREE.SubtractiveBlending,
-		"THREE.MultiplyBlending" : THREE.MultiplyBlending,
-		"THREE.CustomBlending" : THREE.CustomBlending
-
-	},
-
-	equations : {
-
-		"THREE.AddEquation" : THREE.AddEquation,
-		"THREE.SubtractEquation" : THREE.SubtractEquation,
-		"THREE.ReverseSubtractEquation" : THREE.ReverseSubtractEquation
-
-	},
-
-	destinationFactors : {
-
-		"THREE.ZeroFactor" : THREE.ZeroFactor,
-		"THREE.OneFactor" : THREE.OneFactor,
-		"THREE.SrcColorFactor" : THREE.SrcColorFactor,
-		"THREE.OneMinusSrcColorFactor" : THREE.OneMinusSrcColorFactor,
-		"THREE.SrcAlphaFactor" : THREE.SrcAlphaFactor,
-		"THREE.OneMinusSrcAlphaFactor" : THREE.OneMinusSrcAlphaFactor,
-		"THREE.DstAlphaFactor" : THREE.DstAlphaFactor,
-		"THREE.OneMinusDstAlphaFactor" : THREE.OneMinusDstAlphaFactor
-
-	},
-
-	sourceFactors : {
-
-		"THREE.DstColorFactor" : THREE.DstColorFactor,
-		"THREE.OneMinusDstColorFactor" : THREE.OneMinusDstColorFactor,
-		"THREE.SrcAlphaSaturateFactor" : THREE.SrcAlphaSaturateFactor
-
-	}
-
-};
-
 function updateGroupGeometry( mesh, geometry ) {
 
 	mesh.children[ 0 ].geometry.dispose();
@@ -113,7 +45,7 @@ var heartShape = new THREE.Shape();
 
 heartShape.moveTo( x + 5, y + 5 );
 heartShape.bezierCurveTo( x + 5, y + 5, x + 4, y, x, y );
-heartShape.bezierCurveTo( x - 6, y, x - 6, y + 7,x - 6, y + 7 );
+heartShape.bezierCurveTo( x - 6, y, x - 6, y + 7, x - 6, y + 7 );
 heartShape.bezierCurveTo( x - 6, y + 11, x - 3, y + 15.4, x + 5, y + 19 );
 heartShape.bezierCurveTo( x + 12, y + 15.4, x + 16, y + 11, x + 16, y + 7 );
 heartShape.bezierCurveTo( x + 16, y + 7, x + 16, y, x + 10, y );
@@ -121,15 +53,15 @@ heartShape.bezierCurveTo( x + 7, y, x + 5, y + 5, x + 5, y + 5 );
 
 var guis = {
 
-	BoxBufferGeometry : function( mesh ) {
+	BoxBufferGeometry: function ( mesh ) {
 
 		var data = {
-			width : 15,
-			height : 15,
-			depth : 15,
-			widthSegments : 1,
-			heightSegments : 1,
-			depthSegments : 1
+			width: 15,
+			height: 15,
+			depth: 15,
+			widthSegments: 1,
+			heightSegments: 1,
+			depthSegments: 1
 		};
 
 		function generateGeometry() {
@@ -155,15 +87,15 @@ var guis = {
 
 	},
 
-	BoxGeometry : function( mesh ) {
+	BoxGeometry: function ( mesh ) {
 
 		var data = {
-			width : 15,
-			height : 15,
-			depth : 15,
-			widthSegments : 1,
-			heightSegments : 1,
-			depthSegments : 1
+			width: 15,
+			height: 15,
+			depth: 15,
+			widthSegments: 1,
+			heightSegments: 1,
+			depthSegments: 1
 		};
 
 		function generateGeometry() {
@@ -189,17 +121,17 @@ var guis = {
 
 	},
 
-	CylinderBufferGeometry : function( mesh ) {
+	CylinderBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radiusTop : 5,
-			radiusBottom : 5,
-			height : 10,
-			radiusSegments : 8,
-			heightSegments : 1,
-			openEnded : false,
-			thetaStart : 0,
-			thetaLength : twoPi
+			radiusTop: 5,
+			radiusBottom: 5,
+			height: 10,
+			radiusSegments: 8,
+			heightSegments: 1,
+			openEnded: false,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -235,17 +167,17 @@ var guis = {
 
 	},
 
-	CylinderGeometry : function( mesh ) {
+	CylinderGeometry: function ( mesh ) {
 
 		var data = {
-			radiusTop : 5,
-			radiusBottom : 5,
-			height : 10,
-			radiusSegments : 8,
-			heightSegments : 1,
-			openEnded : false,
-			thetaStart : 0,
-			thetaLength : twoPi
+			radiusTop: 5,
+			radiusBottom: 5,
+			height: 10,
+			radiusSegments: 8,
+			heightSegments: 1,
+			openEnded: false,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -281,16 +213,16 @@ var guis = {
 
 	},
 
-	ConeBufferGeometry : function( mesh ) {
+	ConeBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 5,
-			height : 10,
-			radiusSegments : 8,
-			heightSegments : 1,
-			openEnded : false,
-			thetaStart : 0,
-			thetaLength : twoPi
+			radius: 5,
+			height: 10,
+			radiusSegments: 8,
+			heightSegments: 1,
+			openEnded: false,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -324,16 +256,16 @@ var guis = {
 
 	},
 
-	ConeGeometry : function( mesh ) {
+	ConeGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 5,
-			height : 10,
-			radiusSegments : 8,
-			heightSegments : 1,
-			openEnded : false,
-			thetaStart : 0,
-			thetaLength : twoPi
+			radius: 5,
+			height: 10,
+			radiusSegments: 8,
+			heightSegments: 1,
+			openEnded: false,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -368,13 +300,13 @@ var guis = {
 	},
 
 
-	CircleBufferGeometry : function( mesh ) {
+	CircleBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			segments : 32,
-			thetaStart : 0,
-			thetaLength : twoPi
+			radius: 10,
+			segments: 32,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -398,13 +330,13 @@ var guis = {
 
 	},
 
-	CircleGeometry : function( mesh ) {
+	CircleGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			segments : 32,
-			thetaStart : 0,
-			thetaLength : twoPi
+			radius: 10,
+			segments: 32,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -428,11 +360,11 @@ var guis = {
 
 	},
 
-	DodecahedronGeometry : function() {
+	DodecahedronGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -454,11 +386,11 @@ var guis = {
 
 	},
 
-	DodecahedronBufferGeometry : function() {
+	DodecahedronBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -480,11 +412,11 @@ var guis = {
 
 	},
 
-	IcosahedronGeometry : function() {
+	IcosahedronGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -506,11 +438,11 @@ var guis = {
 
 	},
 
-	IcosahedronBufferGeometry : function() {
+	IcosahedronBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -532,7 +464,7 @@ var guis = {
 
 	},
 
-	LatheBufferGeometry : function() {
+	LatheBufferGeometry: function ( mesh ) {
 
 		var points = [];
 
@@ -543,9 +475,9 @@ var guis = {
 		}
 
 		var data = {
-			segments : 12,
-			phiStart : 0,
-			phiLength : twoPi
+			segments: 12,
+			phiStart: 0,
+			phiLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -568,7 +500,7 @@ var guis = {
 
 	},
 
-	LatheGeometry : function() {
+	LatheGeometry: function ( mesh ) {
 
 		var points = [];
 
@@ -579,9 +511,9 @@ var guis = {
 		}
 
 		var data = {
-			segments : 12,
-			phiStart : 0,
-			phiLength : twoPi
+			segments: 12,
+			phiStart: 0,
+			phiLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -604,11 +536,11 @@ var guis = {
 
 	},
 
-	OctahedronGeometry : function() {
+	OctahedronGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -630,11 +562,11 @@ var guis = {
 
 	},
 
-	OctahedronBufferGeometry : function() {
+	OctahedronBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -656,13 +588,13 @@ var guis = {
 
 	},
 
-	PlaneBufferGeometry : function( mesh ) {
+	PlaneBufferGeometry: function ( mesh ) {
 
 		var data = {
-			width : 10,
-			height : 10,
-			widthSegments : 1,
-			heightSegments : 1
+			width: 10,
+			height: 10,
+			widthSegments: 1,
+			heightSegments: 1
 		};
 
 		function generateGeometry() {
@@ -686,13 +618,13 @@ var guis = {
 
 	},
 
-	PlaneGeometry : function( mesh ) {
+	PlaneGeometry: function ( mesh ) {
 
 		var data = {
-			width : 10,
-			height : 10,
-			widthSegments : 1,
-			heightSegments : 1
+			width: 10,
+			height: 10,
+			widthSegments: 1,
+			heightSegments: 1
 		};
 
 		function generateGeometry() {
@@ -716,15 +648,15 @@ var guis = {
 
 	},
 
-	RingBufferGeometry : function( mesh ) {
+	RingBufferGeometry: function ( mesh ) {
 
 		var data = {
-			innerRadius : 5,
-			outerRadius : 10,
-			thetaSegments : 8,
-			phiSegments : 8,
-			thetaStart : 0,
-			thetaLength : twoPi
+			innerRadius: 5,
+			outerRadius: 10,
+			thetaSegments: 8,
+			phiSegments: 8,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -750,15 +682,15 @@ var guis = {
 
 	},
 
-	RingGeometry : function( mesh ) {
+	RingGeometry: function ( mesh ) {
 
 		var data = {
-			innerRadius : 5,
-			outerRadius : 10,
-			thetaSegments : 8,
-			phiSegments : 8,
-			thetaStart : 0,
-			thetaLength : twoPi
+			innerRadius: 5,
+			outerRadius: 10,
+			thetaSegments: 8,
+			phiSegments: 8,
+			thetaStart: 0,
+			thetaLength: twoPi
 		};
 
 		function generateGeometry() {
@@ -784,16 +716,16 @@ var guis = {
 
 	},
 
-	SphereBufferGeometry : function( mesh ) {
+	SphereBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 15,
-			widthSegments : 8,
-			heightSegments : 6,
-			phiStart : 0,
-			phiLength : twoPi,
-			thetaStart : 0,
-			thetaLength : Math.PI
+			radius: 15,
+			widthSegments: 8,
+			heightSegments: 6,
+			phiStart: 0,
+			phiLength: twoPi,
+			thetaStart: 0,
+			thetaLength: Math.PI
 		};
 
 		function generateGeometry() {
@@ -820,16 +752,16 @@ var guis = {
 
 	},
 
-	SphereGeometry : function( mesh ) {
+	SphereGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 15,
-			widthSegments : 8,
-			heightSegments : 6,
-			phiStart : 0,
-			phiLength : twoPi,
-			thetaStart : 0,
-			thetaLength : Math.PI
+			radius: 15,
+			widthSegments: 8,
+			heightSegments: 6,
+			phiStart: 0,
+			phiLength: twoPi,
+			thetaStart: 0,
+			thetaLength: Math.PI
 		};
 
 		function generateGeometry() {
@@ -856,11 +788,11 @@ var guis = {
 
 	},
 
-	TetrahedronGeometry : function() {
+	TetrahedronGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -882,11 +814,11 @@ var guis = {
 
 	},
 
-	TetrahedronBufferGeometry : function() {
+	TetrahedronBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			detail : 0
+			radius: 10,
+			detail: 0
 		};
 
 		function generateGeometry() {
@@ -908,19 +840,19 @@ var guis = {
 
 	},
 
-	TextGeometry : function( mesh ) {
+	TextGeometry: function ( mesh ) {
 
 		var data = {
-			text : "TextGeometry",
-			size : 5,
-			height : 2,
-			curveSegments : 12,
-			font : "helvetiker",
-			weight : "regular",
-			bevelEnabled : false,
-			bevelThickness : 1,
-			bevelSize : 0.5,
-			bevelSegments : 3
+			text: "TextGeometry",
+			size: 5,
+			height: 2,
+			curveSegments: 12,
+			font: "helvetiker",
+			weight: "regular",
+			bevelEnabled: false,
+			bevelThickness: 1,
+			bevelSize: 0.5,
+			bevelSegments: 3
 		};
 
 		var fonts = [
@@ -977,19 +909,19 @@ var guis = {
 
 	},
 
-	TextBufferGeometry : function( mesh ) {
+	TextBufferGeometry: function ( mesh ) {
 
 		var data = {
-			text : "TextBufferGeometry",
-			size : 5,
-			height : 2,
-			curveSegments : 12,
-			font : "helvetiker",
-			weight : "regular",
-			bevelEnabled : false,
-			bevelThickness : 1,
-			bevelSize : 0.5,
-			bevelSegments : 3
+			text: "TextBufferGeometry",
+			size: 5,
+			height: 2,
+			curveSegments: 12,
+			font: "helvetiker",
+			weight: "regular",
+			bevelEnabled: false,
+			bevelThickness: 1,
+			bevelSize: 0.5,
+			bevelSegments: 3
 		};
 
 		var fonts = [
@@ -1046,14 +978,14 @@ var guis = {
 
 	},
 
-	TorusBufferGeometry : function( mesh ) {
+	TorusBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			tube : 3,
-			radialSegments : 16,
-			tubularSegments : 100,
-			arc : twoPi
+			radius: 10,
+			tube: 3,
+			radialSegments: 16,
+			tubularSegments: 100,
+			arc: twoPi
 		};
 
 		function generateGeometry() {
@@ -1078,14 +1010,14 @@ var guis = {
 
 	},
 
-	TorusGeometry : function( mesh ) {
+	TorusGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			tube : 3,
-			radialSegments : 16,
-			tubularSegments : 100,
-			arc : twoPi
+			radius: 10,
+			tube: 3,
+			radialSegments: 16,
+			tubularSegments: 100,
+			arc: twoPi
 		};
 
 		function generateGeometry() {
@@ -1110,15 +1042,15 @@ var guis = {
 
 	},
 
-	TorusKnotBufferGeometry : function( mesh ) {
+	TorusKnotBufferGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			tube : 3,
-			tubularSegments : 64,
-			radialSegments : 8,
-			p : 2,
-			q : 3
+			radius: 10,
+			tube: 3,
+			tubularSegments: 64,
+			radialSegments: 8,
+			p: 2,
+			q: 3
 		};
 
 		function generateGeometry() {
@@ -1145,15 +1077,15 @@ var guis = {
 
 	},
 
-	TorusKnotGeometry : function( mesh ) {
+	TorusKnotGeometry: function ( mesh ) {
 
 		var data = {
-			radius : 10,
-			tube : 3,
-			tubularSegments : 64,
-			radialSegments : 8,
-			p : 2,
-			q : 3
+			radius: 10,
+			tube: 3,
+			tubularSegments: 64,
+			radialSegments: 8,
+			p: 2,
+			q: 3
 		};
 
 		function generateGeometry() {
@@ -1180,11 +1112,11 @@ var guis = {
 
 	},
 
-	ParametricBufferGeometry : function( mesh ) {
+	ParametricBufferGeometry: function ( mesh ) {
 
 		var data = {
-			slices : 25,
-			stacks : 25
+			slices: 25,
+			stacks: 25
 		};
 
 		function generateGeometry() {
@@ -1204,11 +1136,11 @@ var guis = {
 
 	},
 
-	ParametricGeometry : function( mesh ) {
+	ParametricGeometry: function ( mesh ) {
 
 		var data = {
-			slices : 25,
-			stacks : 25
+			slices: 25,
+			stacks: 25
 		};
 
 		function generateGeometry() {
@@ -1228,11 +1160,11 @@ var guis = {
 
 	},
 
-	TubeGeometry : function( mesh ) {
+	TubeGeometry: function ( mesh ) {
 
 		var data = {
-			segments : 20,
-			radius : 2,
+			segments: 20,
+			radius: 2,
 			radiusSegments: 8
 		};
 
@@ -1256,11 +1188,11 @@ var guis = {
 
 	},
 
-	TubeBufferGeometry : function( mesh ) {
+	TubeBufferGeometry: function ( mesh ) {
 
 		var data = {
-			segments : 20,
-			radius : 2,
+			segments: 20,
+			radius: 2,
 			radiusSegments: 8
 		};
 
@@ -1284,17 +1216,18 @@ var guis = {
 
 	},
 
-	ShapeGeometry: function( mesh ) {
+	ShapeGeometry: function ( mesh ) {
 
 		var data = {
-			segments : 12
+			segments: 12
 		};
 
 		function generateGeometry() {
 
-			updateGroupGeometry( mesh,
-				new THREE.ShapeGeometry( heartShape, data.segments )
-			);
+			var geometry = new THREE.ShapeGeometry( heartShape, data.segments );
+			geometry.center();
+
+			updateGroupGeometry( mesh, geometry );
 
 		}
 
@@ -1305,17 +1238,18 @@ var guis = {
 
 	},
 
-	ShapeBufferGeometry: function( mesh ) {
+	ShapeBufferGeometry: function ( mesh ) {
 
 		var data = {
-			segments : 12
+			segments: 12
 		};
 
 		function generateGeometry() {
 
-			updateGroupGeometry( mesh,
-				new THREE.ShapeBufferGeometry( heartShape, data.segments )
-			);
+			var geometry = new THREE.ShapeBufferGeometry( heartShape, data.segments );
+			geometry.center();
+
+			updateGroupGeometry( mesh, geometry );
 
 		}
 
@@ -1326,7 +1260,7 @@ var guis = {
 
 	},
 
-	ExtrudeGeometry: function( mesh ) {
+	ExtrudeGeometry: function ( mesh ) {
 
 		var data = {
 			steps: 2,
@@ -1340,7 +1274,7 @@ var guis = {
 		var length = 12, width = 8;
 
 		var shape = new THREE.Shape();
-		shape.moveTo( 0,0 );
+		shape.moveTo( 0, 0 );
 		shape.lineTo( 0, width );
 		shape.lineTo( length, width );
 		shape.lineTo( length, 0 );
@@ -1348,9 +1282,10 @@ var guis = {
 
 		function generateGeometry() {
 
-			updateGroupGeometry( mesh,
-				new THREE.ExtrudeGeometry( shape, data )
-			);
+			var geometry = new THREE.ExtrudeGeometry( shape, data );
+			geometry.center();
+
+			updateGroupGeometry( mesh, geometry );
 
 		}
 
@@ -1366,7 +1301,7 @@ var guis = {
 
 	},
 
-	ExtrudeBufferGeometry: function( mesh ) {
+	ExtrudeBufferGeometry: function ( mesh ) {
 
 		var data = {
 			steps: 2,
@@ -1380,7 +1315,7 @@ var guis = {
 		var length = 12, width = 8;
 
 		var shape = new THREE.Shape();
-		shape.moveTo( 0,0 );
+		shape.moveTo( 0, 0 );
 		shape.lineTo( 0, width );
 		shape.lineTo( length, width );
 		shape.lineTo( length, 0 );
@@ -1388,9 +1323,10 @@ var guis = {
 
 		function generateGeometry() {
 
-			updateGroupGeometry( mesh,
-				new THREE.ExtrudeBufferGeometry( shape, data )
-			);
+			var geometry = new THREE.ExtrudeBufferGeometry( shape, data );
+			geometry.center();
+
+			updateGroupGeometry( mesh, geometry );
 
 		}
 
@@ -1408,7 +1344,7 @@ var guis = {
 
 };
 
-function chooseFromHash ( mesh ) {
+function chooseFromHash( mesh ) {
 
 	var selectedGeometry = window.location.hash.substring( 1 ) || "TorusGeometry";
 
@@ -1420,7 +1356,7 @@ function chooseFromHash ( mesh ) {
 
 	if ( selectedGeometry === 'TextGeometry' || selectedGeometry === 'TextBufferGeometry' ) {
 
-		return { fixed : true };
+		return { fixed: true };
 
 	}
 

+ 174 - 173
docs/scenes/js/material.js

@@ -6,65 +6,65 @@ var constants = {
 
 	combine: {
 
-		"THREE.MultiplyOperation" : THREE.MultiplyOperation,
-		"THREE.MixOperation" : THREE.MixOperation,
-		"THREE.AddOperation" : THREE.AddOperation
+		'THREE.MultiplyOperation': THREE.MultiplyOperation,
+		'THREE.MixOperation': THREE.MixOperation,
+		'THREE.AddOperation': THREE.AddOperation
 
 	},
 
-	side : {
+	side: {
 
-		"THREE.FrontSide" : THREE.FrontSide,
-		"THREE.BackSide" : THREE.BackSide,
-		"THREE.DoubleSide" : THREE.DoubleSide
+		'THREE.FrontSide': THREE.FrontSide,
+		'THREE.BackSide': THREE.BackSide,
+		'THREE.DoubleSide': THREE.DoubleSide
 
 	},
 
-	colors : {
+	colors: {
 
-		"THREE.NoColors" : THREE.NoColors,
-		"THREE.FaceColors" : THREE.FaceColors,
-		"THREE.VertexColors" : THREE.VertexColors
+		'THREE.NoColors': THREE.NoColors,
+		'THREE.FaceColors': THREE.FaceColors,
+		'THREE.VertexColors': THREE.VertexColors
 
 	},
 
-	blendingMode : {
+	blendingMode: {
 
-		"THREE.NoBlending" : THREE.NoBlending,
-		"THREE.NormalBlending" : THREE.NormalBlending,
-		"THREE.AdditiveBlending" : THREE.AdditiveBlending,
-		"THREE.SubtractiveBlending" : THREE.SubtractiveBlending,
-		"THREE.MultiplyBlending" : THREE.MultiplyBlending,
-		"THREE.CustomBlending" : THREE.CustomBlending
+		'THREE.NoBlending': THREE.NoBlending,
+		'THREE.NormalBlending': THREE.NormalBlending,
+		'THREE.AdditiveBlending': THREE.AdditiveBlending,
+		'THREE.SubtractiveBlending': THREE.SubtractiveBlending,
+		'THREE.MultiplyBlending': THREE.MultiplyBlending,
+		'THREE.CustomBlending': THREE.CustomBlending
 
 	},
 
-	equations : {
+	equations: {
 
-		"THREE.AddEquation" : THREE.AddEquation,
-		"THREE.SubtractEquation" : THREE.SubtractEquation,
-		"THREE.ReverseSubtractEquation" : THREE.ReverseSubtractEquation
+		'THREE.AddEquation': THREE.AddEquation,
+		'THREE.SubtractEquation': THREE.SubtractEquation,
+		'THREE.ReverseSubtractEquation': THREE.ReverseSubtractEquation
 
 	},
 
-	destinationFactors : {
+	destinationFactors: {
 
-		"THREE.ZeroFactor" : THREE.ZeroFactor,
-		"THREE.OneFactor" : THREE.OneFactor,
-		"THREE.SrcColorFactor" : THREE.SrcColorFactor,
-		"THREE.OneMinusSrcColorFactor" : THREE.OneMinusSrcColorFactor,
-		"THREE.SrcAlphaFactor" : THREE.SrcAlphaFactor,
-		"THREE.OneMinusSrcAlphaFactor" : THREE.OneMinusSrcAlphaFactor,
-		"THREE.DstAlphaFactor" : THREE.DstAlphaFactor,
-		"THREE.OneMinusDstAlphaFactor" : THREE.OneMinusDstAlphaFactor
+		'THREE.ZeroFactor': THREE.ZeroFactor,
+		'THREE.OneFactor': THREE.OneFactor,
+		'THREE.SrcColorFactor': THREE.SrcColorFactor,
+		'THREE.OneMinusSrcColorFactor': THREE.OneMinusSrcColorFactor,
+		'THREE.SrcAlphaFactor': THREE.SrcAlphaFactor,
+		'THREE.OneMinusSrcAlphaFactor': THREE.OneMinusSrcAlphaFactor,
+		'THREE.DstAlphaFactor': THREE.DstAlphaFactor,
+		'THREE.OneMinusDstAlphaFactor': THREE.OneMinusDstAlphaFactor
 
 	},
 
-	sourceFactors : {
+	sourceFactors: {
 
-		"THREE.DstColorFactor" : THREE.DstColorFactor,
-		"THREE.OneMinusDstColorFactor" : THREE.OneMinusDstColorFactor,
-		"THREE.SrcAlphaSaturateFactor" : THREE.SrcAlphaSaturateFactor
+		'THREE.DstColorFactor': THREE.DstColorFactor,
+		'THREE.OneMinusDstColorFactor': THREE.OneMinusDstColorFactor,
+		'THREE.SrcAlphaSaturateFactor': THREE.SrcAlphaSaturateFactor
 
 	}
 
@@ -85,11 +85,12 @@ function getObjectsKeys( obj ) {
 	}
 
 	return keys;
+
 }
 
-var envMaps = (function () {
+var envMaps = ( function () {
 
-	var path = "../../examples/textures/cube/SwedishRoyalCastle/";
+	var path = '../../examples/textures/cube/SwedishRoyalCastle/';
 	var format = '.jpg';
 	var urls = [
 		path + 'px' + format, path + 'nx' + format,
@@ -105,47 +106,47 @@ var envMaps = (function () {
 	refractionCube.format = THREE.RGBFormat;
 
 	return {
-		none : null,
-		reflection : reflectionCube,
-		refraction : refractionCube
+		none: null,
+		reflection: reflectionCube,
+		refraction: refractionCube
 	};
 
-})();
+} )();
 
 var envMapKeys = getObjectsKeys( envMaps );
 
-var textureMaps = (function () {
+var textureMaps = ( function () {
 
 	return {
-		none : null,
-		grass : new THREE.TextureLoader().load( "../../examples/textures/terrain/grasslight-thin.jpg" )
+		none: null,
+		grass: new THREE.TextureLoader().load( '../../examples/textures/terrain/grasslight-thin.jpg' )
 	};
 
-})();
+} )();
 
 var textureMapKeys = getObjectsKeys( textureMaps );
 
-function generateVertexColors ( geometry ) {
+function generateVertexColors( geometry ) {
 
-	for ( var i=0, il = geometry.faces.length; i < il; i++ ) {
+	for ( var i = 0, il = geometry.faces.length; i < il; i ++ ) {
 
-		geometry.faces[i].vertexColors.push( new THREE.Color().setHSL(
+		geometry.faces[ i ].vertexColors.push( new THREE.Color().setHSL(
 			i / il * Math.random(),
 			0.5,
 			0.5
 		) );
-		geometry.faces[i].vertexColors.push( new THREE.Color().setHSL(
+		geometry.faces[ i ].vertexColors.push( new THREE.Color().setHSL(
 			i / il * Math.random(),
 			0.5,
 			0.5
 		) );
-		geometry.faces[i].vertexColors.push( new THREE.Color().setHSL(
+		geometry.faces[ i ].vertexColors.push( new THREE.Color().setHSL(
 			i / il * Math.random(),
 			0.5,
 			0.5
 		) );
 
-		geometry.faces[i].color = new THREE.Color().setHSL(
+		geometry.faces[ i ].color = new THREE.Color().setHSL(
 			i / il * Math.random(),
 			0.5,
 			0.5
@@ -155,11 +156,11 @@ function generateVertexColors ( geometry ) {
 
 }
 
-function generateMorphTargets ( mesh, geometry ) {
+function generateMorphTargets( mesh, geometry ) {
 
 	var vertices = [], scale;
 
-	for ( var i = 0; i < geometry.vertices.length; i++ ) {
+	for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 
 		vertices.push( geometry.vertices[ i ].clone() );
 
@@ -171,32 +172,32 @@ function generateMorphTargets ( mesh, geometry ) {
 
 	}
 
-	geometry.morphTargets.push( { name: "target1", vertices: vertices } );
+	geometry.morphTargets.push( { name: 'target1', vertices: vertices } );
 
 }
 
-function handleColorChange ( color ) {
+function handleColorChange( color ) {
 
-	return function ( value ){
+	return function ( value ) {
 
-		if (typeof value === "string") {
+		if ( typeof value === 'string' ) {
 
-			value = value.replace('#', '0x');
+			value = value.replace( '#', '0x' );
 
 		}
 
 		color.setHex( value );
 
-    };
+	};
 
 }
 
-function needsUpdate ( material, geometry ) {
+function needsUpdate( material, geometry ) {
 
 	return function () {
 
-		material.vertexColors = +material.vertexColors; //Ensure number
-		material.side = +material.side; //Ensure number
+		material.vertexColors = + material.vertexColors; //Ensure number
+		material.side = + material.side; //Ensure number
 		material.needsUpdate = true;
 		geometry.verticesNeedUpdate = true;
 		geometry.normalsNeedUpdate = true;
@@ -206,7 +207,7 @@ function needsUpdate ( material, geometry ) {
 
 }
 
-function updateMorphs ( torus, material ) {
+function updateMorphs( torus, material ) {
 
 	return function () {
 
@@ -217,30 +218,30 @@ function updateMorphs ( torus, material ) {
 
 }
 
-function updateTexture ( material, materialKey, textures ) {
+function updateTexture( material, materialKey, textures ) {
 
 	return function ( key ) {
 
-		material[materialKey] = textures[key];
+		material[ materialKey ] = textures[ key ];
 		material.needsUpdate = true;
 
 	};
 
 }
 
-function guiScene ( gui, scene ) {
+function guiScene( gui, scene ) {
 
-	var folder = gui.addFolder('Scene');
+	var folder = gui.addFolder( 'Scene' );
 
 	var data = {
-		background : "#000000",
-		"ambient light" : ambientLight.color.getHex()
+		background: '#000000',
+		'ambient light': ambientLight.color.getHex()
 	};
 
 	var color = new THREE.Color();
 	var colorConvert = handleColorChange( color );
 
-	folder.addColor( data, "background" ).onChange( function ( value ) {
+	folder.addColor( data, 'background' ).onChange( function ( value ) {
 
 		colorConvert( value );
 
@@ -248,22 +249,22 @@ function guiScene ( gui, scene ) {
 
 	} );
 
-	folder.addColor( data, "ambient light" ).onChange( handleColorChange( ambientLight.color ) );
+	folder.addColor( data, 'ambient light' ).onChange( handleColorChange( ambientLight.color ) );
 
 	guiSceneFog( folder, scene );
 
 }
 
-function guiSceneFog ( folder, scene ) {
+function guiSceneFog( folder, scene ) {
 
-	var fogFolder = folder.addFolder('scene.fog');
+	var fogFolder = folder.addFolder( 'scene.fog' );
 
 	var fog = new THREE.Fog( 0x3f7b9d, 0, 60 );
 
 	var data = {
-		fog : {
-			"THREE.Fog()" : false,
-			"scene.fog.color" : fog.color.getHex()
+		fog: {
+			'THREE.Fog()': false,
+			'scene.fog.color': fog.color.getHex()
 		}
 	};
 
@@ -281,13 +282,13 @@ function guiSceneFog ( folder, scene ) {
 
 	} );
 
-	fogFolder.addColor( data.fog, 'scene.fog.color').onChange( handleColorChange( fog.color ) );
+	fogFolder.addColor( data.fog, 'scene.fog.color' ).onChange( handleColorChange( fog.color ) );
 
 }
 
-function guiMaterial ( gui, mesh, material, geometry ) {
+function guiMaterial( gui, mesh, material, geometry ) {
 
-	var folder = gui.addFolder('THREE.Material');
+	var folder = gui.addFolder( 'THREE.Material' );
 
 	folder.add( material, 'transparent' );
 	folder.add( material, 'opacity', 0, 1 );
@@ -307,22 +308,22 @@ function guiMaterial ( gui, mesh, material, geometry ) {
 
 }
 
-function guiMeshBasicMaterial ( gui, mesh, material, geometry ) {
+function guiMeshBasicMaterial( gui, mesh, material, geometry ) {
 
 	var data = {
-		color : material.color.getHex(),
-		envMaps : envMapKeys,
-		map : textureMapKeys,
-		specularMap : textureMapKeys,
-		alphaMap : textureMapKeys
+		color: material.color.getHex(),
+		envMaps: envMapKeys,
+		map: textureMapKeys,
+		specularMap: textureMapKeys,
+		alphaMap: textureMapKeys
 	};
 
-	var folder = gui.addFolder('THREE.MeshBasicMaterial');
+	var folder = gui.addFolder( 'THREE.MeshBasicMaterial' );
 
 	folder.addColor( data, 'color' ).onChange( handleColorChange( material.color ) );
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
-	folder.add( material, 'vertexColors', constants.colors).onChange( needsUpdate( material, geometry ) );
+	folder.add( material, 'vertexColors', constants.colors ).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'fog' );
 
 	folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
@@ -333,13 +334,12 @@ function guiMeshBasicMaterial ( gui, mesh, material, geometry ) {
 	folder.add( material, 'combine', constants.combine ).onChange( updateMorphs( mesh, material ) );
 	folder.add( material, 'reflectivity', 0, 1 );
 	folder.add( material, 'refractionRatio', 0, 1 );
-	//folder.add( material, 'skinning' );
 
 }
 
-function guiMeshDepthMaterial ( gui, mesh, material, geometry ) {
+function guiMeshDepthMaterial( gui, mesh, material, geometry ) {
 
-	var folder = gui.addFolder('THREE.MeshDepthMaterial');
+	var folder = gui.addFolder( 'THREE.MeshDepthMaterial' );
 
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
@@ -347,9 +347,9 @@ function guiMeshDepthMaterial ( gui, mesh, material, geometry ) {
 
 }
 
-function guiMeshNormalMaterial ( gui, mesh, material, geometry ) {
+function guiMeshNormalMaterial( gui, mesh, material, geometry ) {
 
-	var folder = gui.addFolder('THREE.MeshNormalMaterial');
+	var folder = gui.addFolder( 'THREE.MeshNormalMaterial' );
 
 	folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'wireframe' );
@@ -358,37 +358,37 @@ function guiMeshNormalMaterial ( gui, mesh, material, geometry ) {
 
 }
 
-function guiLineBasicMaterial ( gui, mesh, material, geometry ) {
+function guiLineBasicMaterial( gui, mesh, material, geometry ) {
 
 	var data = {
-		color : material.color.getHex()
+		color: material.color.getHex()
 	};
 
-	var folder = gui.addFolder('THREE.LineBasicMaterial');
+	var folder = gui.addFolder( 'THREE.LineBasicMaterial' );
 
 	folder.addColor( data, 'color' ).onChange( handleColorChange( material.color ) );
 	folder.add( material, 'linewidth', 0, 10 );
-	folder.add( material, 'linecap', ["butt", "round", "square"] );
-	folder.add( material, 'linejoin', ["round", "bevel", "miter"] );
-	folder.add( material, 'vertexColors', constants.colors).onChange( needsUpdate( material, geometry ) );
+	folder.add( material, 'linecap', [ 'butt', 'round', 'square' ] );
+	folder.add( material, 'linejoin', [ 'round', 'bevel', 'miter' ] );
+	folder.add( material, 'vertexColors', constants.colors ).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'fog' );
 
 }
 
-function guiMeshLambertMaterial ( gui, mesh, material, geometry ) {
+function guiMeshLambertMaterial( gui, mesh, material, geometry ) {
 
 	var data = {
-		color : material.color.getHex(),
-		emissive : material.emissive.getHex(),
-		envMaps : envMapKeys,
-		map : textureMapKeys,
-		specularMap : textureMapKeys,
-		alphaMap : textureMapKeys
+		color: material.color.getHex(),
+		emissive: material.emissive.getHex(),
+		envMaps: envMapKeys,
+		map: textureMapKeys,
+		specularMap: textureMapKeys,
+		alphaMap: textureMapKeys
 	};
 
 	var envObj = {};
 
-	var folder = gui.addFolder('THREE.MeshLambertMaterial');
+	var folder = gui.addFolder( 'THREE.MeshLambertMaterial' );
 
 	folder.addColor( data, 'color' ).onChange( handleColorChange( material.color ) );
 	folder.addColor( data, 'emissive' ).onChange( handleColorChange( material.emissive ) );
@@ -410,30 +410,30 @@ function guiMeshLambertMaterial ( gui, mesh, material, geometry ) {
 
 }
 
-function guiMeshPhongMaterial ( gui, mesh, material, geometry ) {
+function guiMeshPhongMaterial( gui, mesh, material, geometry ) {
 
 	var data = {
-		color : material.color.getHex(),
-		emissive : material.emissive.getHex(),
-		specular : material.specular.getHex(),
-		envMaps : envMapKeys,
-		map : textureMapKeys,
-		lightMap : textureMapKeys,
-		specularMap : textureMapKeys,
-		alphaMap : textureMapKeys
+		color: material.color.getHex(),
+		emissive: material.emissive.getHex(),
+		specular: material.specular.getHex(),
+		envMaps: envMapKeys,
+		map: textureMapKeys,
+		lightMap: textureMapKeys,
+		specularMap: textureMapKeys,
+		alphaMap: textureMapKeys
 	};
 
-	var folder = gui.addFolder('THREE.MeshPhongMaterial');
+	var folder = gui.addFolder( 'THREE.MeshPhongMaterial' );
 
 	folder.addColor( data, 'color' ).onChange( handleColorChange( material.color ) );
 	folder.addColor( data, 'emissive' ).onChange( handleColorChange( material.emissive ) );
 	folder.addColor( data, 'specular' ).onChange( handleColorChange( material.specular ) );
 
-	folder.add( material, 'shininess', 0, 100);
+	folder.add( material, 'shininess', 0, 100 );
 	folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
-	folder.add( material, 'vertexColors', constants.colors);
+	folder.add( material, 'vertexColors', constants.colors );
 	folder.add( material, 'fog' );
 	folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 	folder.add( data, 'map', textureMapKeys ).onChange( updateTexture( material, 'map', textureMaps ) );
@@ -443,19 +443,19 @@ function guiMeshPhongMaterial ( gui, mesh, material, geometry ) {
 
 }
 
-function guiMeshStandardMaterial ( gui, mesh, material, geometry ) {
+function guiMeshStandardMaterial( gui, mesh, material, geometry ) {
 
 	var data = {
-		color : material.color.getHex(),
-		emissive : material.emissive.getHex(),
-		envMaps : envMapKeys,
-		map : textureMapKeys,
-		lightMap : textureMapKeys,
-		specularMap : textureMapKeys,
-		alphaMap : textureMapKeys
+		color: material.color.getHex(),
+		emissive: material.emissive.getHex(),
+		envMaps: envMapKeys,
+		map: textureMapKeys,
+		lightMap: textureMapKeys,
+		specularMap: textureMapKeys,
+		alphaMap: textureMapKeys
 	};
 
-	var folder = gui.addFolder('THREE.MeshStandardMaterial');
+	var folder = gui.addFolder( 'THREE.MeshStandardMaterial' );
 
 	folder.addColor( data, 'color' ).onChange( handleColorChange( material.color ) );
 	folder.addColor( data, 'emissive' ).onChange( handleColorChange( material.emissive ) );
@@ -465,7 +465,7 @@ function guiMeshStandardMaterial ( gui, mesh, material, geometry ) {
 	folder.add( material, 'flatShading' ).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
-	folder.add( material, 'vertexColors', constants.colors);
+	folder.add( material, 'vertexColors', constants.colors );
 	folder.add( material, 'fog' );
 	folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 	folder.add( data, 'map', textureMapKeys ).onChange( updateTexture( material, 'map', textureMaps ) );
@@ -476,82 +476,83 @@ function guiMeshStandardMaterial ( gui, mesh, material, geometry ) {
 
 }
 
-function chooseFromHash ( gui, mesh, geometry ) {
+function chooseFromHash( gui, mesh, geometry ) {
 
-	var selectedMaterial = window.location.hash.substring(1) || "MeshBasicMaterial";
+	var selectedMaterial = window.location.hash.substring( 1 ) || 'MeshBasicMaterial';
 	var material;
 
-	switch (selectedMaterial) {
+	switch ( selectedMaterial ) {
+
+		case 'MeshBasicMaterial' :
 
-	case "MeshBasicMaterial" :
+			material = new THREE.MeshBasicMaterial( { color: 0x2194CE } );
+			guiMaterial( gui, mesh, material, geometry );
+			guiMeshBasicMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.MeshBasicMaterial({color: 0x2194CE});
-		guiMaterial( gui, mesh, material, geometry );
-		guiMeshBasicMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
+		case 'MeshLambertMaterial' :
 
-	case "MeshLambertMaterial" :
+			material = new THREE.MeshLambertMaterial( { color: 0x2194CE } );
+			guiMaterial( gui, mesh, material, geometry );
+			guiMeshLambertMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.MeshLambertMaterial({color: 0x2194CE});
-		guiMaterial( gui, mesh, material, geometry );
-		guiMeshLambertMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
+		case 'MeshPhongMaterial' :
 
-	case "MeshPhongMaterial" :
+			material = new THREE.MeshPhongMaterial( { color: 0x2194CE } );
+			guiMaterial( gui, mesh, material, geometry );
+			guiMeshPhongMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.MeshPhongMaterial({color: 0x2194CE});
-		guiMaterial( gui, mesh, material, geometry );
-		guiMeshPhongMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
+		case 'MeshStandardMaterial' :
 
-	case "MeshStandardMaterial" :
+			material = new THREE.MeshStandardMaterial( { color: 0x2194CE } );
+			guiMaterial( gui, mesh, material, geometry );
+			guiMeshStandardMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.MeshStandardMaterial({color: 0x2194CE});
-		guiMaterial( gui, mesh, material, geometry );
-		guiMeshStandardMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
+		case 'MeshDepthMaterial' :
 
-	case "MeshDepthMaterial" :
+			material = new THREE.MeshDepthMaterial();
+			guiMaterial( gui, mesh, material, geometry );
+			guiMeshDepthMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.MeshDepthMaterial();
-		guiMaterial( gui, mesh, material, geometry );
-		guiMeshDepthMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
+		case 'MeshNormalMaterial' :
 
-	case "MeshNormalMaterial" :
+			material = new THREE.MeshNormalMaterial();
+			guiMaterial( gui, mesh, material, geometry );
+			guiMeshNormalMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.MeshNormalMaterial();
-		guiMaterial( gui, mesh, material, geometry );
-		guiMeshNormalMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
+		case 'LineBasicMaterial' :
 
-	case "LineBasicMaterial" :
+			material = new THREE.LineBasicMaterial( { color: 0x2194CE } );
+			guiMaterial( gui, mesh, material, geometry );
+			guiLineBasicMaterial( gui, mesh, material, geometry );
 
-		material = new THREE.LineBasicMaterial({color: 0x2194CE});
-		guiMaterial( gui, mesh, material, geometry );
-		guiLineBasicMaterial( gui, mesh, material, geometry );
+			return material;
 
-		return material;
+			break;
 
-		break;
 	}
 
 }

+ 1 - 1
editor/js/Editor.js

@@ -6,7 +6,7 @@ var Editor = function () {
 
 	this.DEFAULT_CAMERA = new THREE.PerspectiveCamera( 50, 1, 0.01, 1000 );
 	this.DEFAULT_CAMERA.name = 'Camera';
-	this.DEFAULT_CAMERA.position.set( 20, 10, 20 );
+	this.DEFAULT_CAMERA.position.set( 0, 5, 10 );
 	this.DEFAULT_CAMERA.lookAt( new THREE.Vector3() );
 
 	var Signal = signals.Signal;

+ 3 - 3
editor/js/Viewport.Info.js

@@ -53,14 +53,14 @@ Viewport.Info = function ( editor ) {
 
 					} else if ( geometry instanceof THREE.BufferGeometry ) {
 
+						vertices += geometry.attributes.position.count;
+
 						if ( geometry.index !== null ) {
 
-							vertices += geometry.index.count * 3;
-							triangles += geometry.index.count;
+							triangles += geometry.index.count / 3;
 
 						} else {
 
-							vertices += geometry.attributes.position.count;
 							triangles += geometry.attributes.position.count / 3;
 
 						}

+ 13 - 22
editor/js/Viewport.js

@@ -24,9 +24,21 @@ var Viewport = function ( editor ) {
 
 	// helpers
 
-	var grid = new THREE.GridHelper( 60, 60 );
+	var grid = new THREE.GridHelper( 30, 30, 0x444444, 0x888888 );
 	sceneHelpers.add( grid );
 
+	var array = grid.geometry.attributes.color.array;
+
+	for ( var i = 0; i < array.length; i += 60 ) {
+
+		for ( var j = 0; j < 12; j ++ ) {
+
+			array[ i + j ] = 0.26;
+
+		}
+
+	}
+
 	//
 
 	var box = new THREE.Box3();
@@ -271,27 +283,6 @@ var Viewport = function ( editor ) {
 
 	} );
 
-	signals.themeChanged.add( function ( value ) {
-
-		switch ( value ) {
-
-			case 'css/light.css':
-				sceneHelpers.remove( grid );
-				grid = new THREE.GridHelper( 60, 60, 0x444444, 0x888888 );
-				sceneHelpers.add( grid );
-				break;
-			case 'css/dark.css':
-				sceneHelpers.remove( grid );
-				grid = new THREE.GridHelper( 60, 60, 0xbbbbbb, 0x888888 );
-				sceneHelpers.add( grid );
-				break;
-
-		}
-
-		render();
-
-	} );
-
 	signals.transformModeChanged.add( function ( mode ) {
 
 		transformControls.setMode( mode );

+ 2 - 37
editor/js/libs/tern-threejs/threejs.js

@@ -4348,30 +4348,6 @@
       "!doc": "todo",
       "!type": "fn()"
     },
-    "LensFlare": {
-      "!url": "http://threejs.org/docs/#Reference/objects/LensFlare",
-      "prototype": {
-        "!proto": "THREE.Object3D.prototype",
-        "lensFlares": {
-          "!type": "array",
-          "!doc": "todo"
-        },
-        "positionScreen": {
-          "!type": "+THREE.Vector3",
-          "!doc": "todo"
-        },
-        "customUpdateCallback": {
-          "!type": "todo",
-          "!doc": "todo"
-        },
-        "updateLensFlares": {
-          "!type": "fn() -> todo",
-          "!doc": "todo"
-        }
-      },
-      "!doc": "todo",
-      "!type": "fn(texture: todo, size: todo, distance: todo, blending: todo, color: todo)"
-    },
     "Line": {
       "!url": "http://threejs.org/docs/#Reference/objects/Line",
       "prototype": {
@@ -4941,23 +4917,12 @@
       "prototype": {},
       "!doc": "todo"
     },
-    "LensFlarePlugin": {
-      "!url": "http://threejs.org/docs/#Reference/renderers/webgl/plugins/LensFlarePlugin",
-      "prototype": {
-        "render": {
-          "!type": "fn(scene: +THREE.Scene, camera: +THREE.Camera, viewportWidth: number, viewportHeight: number)",
-          "!doc": "Renders the lensflares defined in the scene. This gets automatically called as post render function to draw the lensflares."
-        }
-      },
-      "!doc": "The Webglrenderer plugin class that allows lensflares to be rendered in the WebglRenderer. This plugin is automatically loaded in the Webglrenderer.",
-      "!type": "fn()"
-    },
     "ShadowMapPlugin": {
       "!url": "http://threejs.org/docs/#Reference/renderers/webgl/plugins/ShadowMapPlugin",
       "prototype": {
         "render": {
           "!type": "fn(scene: +THREE.Scene, camera: +THREE.Camera)",
-          "!doc": "Prepares the shadowmaps to be rendered defined in the scene. This gets automatically called as pre render function to draw the lensflares."
+          "!doc": "Prepares the shadowmaps to be rendered defined in the scene."
         }
       },
       "!doc": "The Webglrenderer plugin class that allows shadowmaps to be rendered in the WebglRenderer. This plugin is automatically loaded in the Webglrenderer.",
@@ -4968,7 +4933,7 @@
       "prototype": {
         "render": {
           "!type": "fn(scene: +THREE.Scene, camera: +THREE.Camera)",
-          "!doc": "Renders the sprites defined in the scene. This gets automatically called as post-render function to draw the lensflares."
+          "!doc": "Renders the sprites defined in the scene."
         }
       },
       "!doc": "The Webglrenderer plugin class that allows Sprites to be rendered in the WebglRenderer. This plugin is automatically loaded in the Webglrenderer.",

+ 12 - 13
examples/js/AnimationClipCreator.js

@@ -6,10 +6,9 @@
  * @author David Sarno / http://lighthaus.us/
  */
 
-THREE.AnimationClipCreator = function() {
-};
+THREE.AnimationClipCreator = function () {};
 
-THREE.AnimationClipCreator.CreateRotationAnimation = function( period, axis ) {
+THREE.AnimationClipCreator.CreateRotationAnimation = function ( period, axis ) {
 
 	var times = [ 0, period ], values = [ 0, 360 ];
 
@@ -22,7 +21,7 @@ THREE.AnimationClipCreator.CreateRotationAnimation = function( period, axis ) {
 
 };
 
-THREE.AnimationClipCreator.CreateScaleAxisAnimation = function( period, axis ) {
+THREE.AnimationClipCreator.CreateScaleAxisAnimation = function ( period, axis ) {
 
 	var times = [ 0, period ], values = [ 0, 1 ];
 
@@ -35,11 +34,11 @@ THREE.AnimationClipCreator.CreateScaleAxisAnimation = function( period, axis ) {
 
 };
 
-THREE.AnimationClipCreator.CreateShakeAnimation = function( duration, shakeScale ) {
+THREE.AnimationClipCreator.CreateShakeAnimation = function ( duration, shakeScale ) {
 
 	var times = [], values = [], tmp = new THREE.Vector3();
 
-	for( var i = 0; i < duration * 10; i ++ ) {
+	for ( var i = 0; i < duration * 10; i ++ ) {
 
 		times.push( i / 10 );
 
@@ -58,11 +57,11 @@ THREE.AnimationClipCreator.CreateShakeAnimation = function( duration, shakeScale
 };
 
 
-THREE.AnimationClipCreator.CreatePulsationAnimation = function( duration, pulseScale ) {
+THREE.AnimationClipCreator.CreatePulsationAnimation = function ( duration, pulseScale ) {
 
 	var times = [], values = [], tmp = new THREE.Vector3();
 
-	for( var i = 0; i < duration * 10; i ++ ) {
+	for ( var i = 0; i < duration * 10; i ++ ) {
 
 		times.push( i / 10 );
 
@@ -74,14 +73,14 @@ THREE.AnimationClipCreator.CreatePulsationAnimation = function( duration, pulseS
 
 	var trackName = '.scale';
 
-	var track = new THREE.VectorKeyframeTrack( trackName, keys );
+	var track = new THREE.VectorKeyframeTrack( trackName, times, values );
 
 	return new THREE.AnimationClip( null, duration, [ track ] );
 
 };
 
 
-THREE.AnimationClipCreator.CreateVisibilityAnimation = function( duration ) {
+THREE.AnimationClipCreator.CreateVisibilityAnimation = function ( duration ) {
 
 	var times = [ 0, duration / 2, duration ], values = [ true, false, true ];
 
@@ -94,14 +93,14 @@ THREE.AnimationClipCreator.CreateVisibilityAnimation = function( duration ) {
 };
 
 
-THREE.AnimationClipCreator.CreateMaterialColorAnimation = function( duration, colors, loop ) {
+THREE.AnimationClipCreator.CreateMaterialColorAnimation = function ( duration, colors ) {
 
 	var times = [], values = [],
 		timeStep = duration / colors.length;
 
-	for( var i = 0; i <= colors.length; i ++ ) {
+	for ( var i = 0; i <= colors.length; i ++ ) {
 
-		timees.push( i * timeStep );
+		times.push( i * timeStep );
 		values.push( colors[ i % colors.length ] );
 
 	}

+ 20 - 20
examples/js/GPUParticleSystem.js

@@ -15,7 +15,7 @@
  *
  */
 
-THREE.GPUParticleSystem = function( options ) {
+THREE.GPUParticleSystem = function ( options ) {
 
 	THREE.Object3D.apply( this, arguments );
 
@@ -158,13 +158,13 @@ THREE.GPUParticleSystem = function( options ) {
 
 	var i;
 
-	for ( i = 1e5; i > 0; i-- ) {
+	for ( i = 1e5; i > 0; i -- ) {
 
 		this.rand.push( Math.random() - 0.5 );
 
 	}
 
-	this.random = function() {
+	this.random = function () {
 
 		return ++ i >= this.rand.length ? this.rand[ i = 1 ] : this.rand[ i ];
 
@@ -205,7 +205,7 @@ THREE.GPUParticleSystem = function( options ) {
 	this.particleShaderMat.defaultAttributeValues.particlePositionsStartTime = [ 0, 0, 0, 0 ];
 	this.particleShaderMat.defaultAttributeValues.particleVelColSizeLife = [ 0, 0, 0, 0 ];
 
-	this.init = function() {
+	this.init = function () {
 
 		for ( var i = 0; i < this.PARTICLE_CONTAINERS; i ++ ) {
 
@@ -217,7 +217,7 @@ THREE.GPUParticleSystem = function( options ) {
 
 	};
 
-	this.spawnParticle = function( options ) {
+	this.spawnParticle = function ( options ) {
 
 		this.PARTICLE_CURSOR ++;
 
@@ -233,7 +233,7 @@ THREE.GPUParticleSystem = function( options ) {
 
 	};
 
-	this.update = function( time ) {
+	this.update = function ( time ) {
 
 		for ( var i = 0; i < this.PARTICLE_CONTAINERS; i ++ ) {
 
@@ -243,7 +243,7 @@ THREE.GPUParticleSystem = function( options ) {
 
 	};
 
-	this.dispose = function() {
+	this.dispose = function () {
 
 		this.particleShaderMat.dispose();
 		this.particleNoiseTex.dispose();
@@ -267,7 +267,7 @@ THREE.GPUParticleSystem.prototype.constructor = THREE.GPUParticleSystem;
 
 // Subclass for particle containers, allows for very large arrays to be spread out
 
-THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
+THREE.GPUParticleContainer = function ( maxParticles, particleSystem ) {
 
 	THREE.Object3D.apply( this, arguments );
 
@@ -301,7 +301,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
 	var velocity = new THREE.Vector3();
 	var color = new THREE.Color();
 
-	this.spawnParticle = function( options ) {
+	this.spawnParticle = function ( options ) {
 
 		var positionStartAttribute = this.particleShaderGeo.getAttribute( 'positionStart' );
 		var startTimeAttribute = this.particleShaderGeo.getAttribute( 'startTime' );
@@ -402,7 +402,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
 
 	};
 
-	this.init = function() {
+	this.init = function () {
 
 		this.particleSystem = new THREE.Points( this.particleShaderGeo, this.particleShaderMat );
 		this.particleSystem.frustumCulled = false;
@@ -410,7 +410,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
 
 	};
 
-	this.update = function( time ) {
+	this.update = function ( time ) {
 
 		this.time = time;
 		this.particleShaderMat.uniforms.uTime.value = time;
@@ -419,7 +419,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
 
 	};
 
-	this.geometryUpdate = function() {
+	this.geometryUpdate = function () {
 
 		if ( this.particleUpdate === true ) {
 
@@ -462,13 +462,13 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
 				lifeTimeAttribute.updateRange.offset = 0;
 
 				// Use -1 to update the entire buffer, see #11476
-				positionStartAttribute.updateRange.count = -1;
-				startTimeAttribute.updateRange.count = -1;
-				velocityAttribute.updateRange.count = -1;
-				turbulenceAttribute.updateRange.count = -1;
-				colorAttribute.updateRange.count = -1;
-				sizeAttribute.updateRange.count = -1;
-				lifeTimeAttribute.updateRange.count = -1;
+				positionStartAttribute.updateRange.count = - 1;
+				startTimeAttribute.updateRange.count = - 1;
+				velocityAttribute.updateRange.count = - 1;
+				turbulenceAttribute.updateRange.count = - 1;
+				colorAttribute.updateRange.count = - 1;
+				sizeAttribute.updateRange.count = - 1;
+				lifeTimeAttribute.updateRange.count = - 1;
 
 			}
 
@@ -487,7 +487,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {
 
 	};
 
-	this.dispose = function() {
+	this.dispose = function () {
 
 		this.particleShaderGeo.dispose();
 

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

@@ -938,7 +938,7 @@ THREE.GLTFExporter.prototype = {
 
 					input: processAccessor( new THREE.BufferAttribute( track.times, inputItemSize ) ),
 					output: processAccessor( new THREE.BufferAttribute( track.values, outputItemSize ) ),
-					interpolation: track.interpolation === THREE.InterpolateDiscrete ? 'STEP' : 'LINEAR'
+					interpolation: track.getInterpolation() === THREE.InterpolateDiscrete ? 'STEP' : 'LINEAR'
 
 				} );
 

+ 1 - 1
examples/js/loaders/FBXLoader.js

@@ -1476,7 +1476,7 @@
 
 		} );
 
-		bindSkeleton( FBXTree, skeletons, geometryMap, modelMap, connections, sceneGraph );
+		bindSkeleton( FBXTree, skeletons, geometryMap, modelMap, connections );
 
 		addAnimations( FBXTree, connections, sceneGraph );
 

+ 4 - 2
examples/js/loaders/MTLLoader.js

@@ -462,9 +462,11 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 				case 'tr':
 					n = parseFloat( value );
 
-					if ( n > 0 ) {
+					if ( this.options && this.options.invertTrProperty ) n = 1 - n;
 
-						params.opacity = 1 - n;
+					if ( n < 1 ) {
+
+						params.opacity = n;
 						params.transparent = true;
 
 					}

+ 1 - 1
examples/webgl_lights_rectarealight.html

@@ -53,7 +53,7 @@
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
-			var renerer, scene, camera;
+			var renderer, scene, camera;
 
 			var origin = new THREE.Vector3();
 

+ 5 - 8
examples/webgl_points_dynamic.html

@@ -57,24 +57,21 @@
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
-			var camera, scene, renderer, mesh, directionalLight;
+			var camera, scene, renderer, mesh;
 
 			var parent, meshes = [], clonemeshes = [];
 
-			var p;
-
 			var composer, effectFocus;
 
 			var clock = new THREE.Clock();
 
+			var stats;
+
 			init();
 			animate();
 
 			function init() {
 
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
 				camera = new THREE.PerspectiveCamera( 20, window.innerWidth / window.innerHeight, 1, 50000 );
 				camera.position.set( 0, 700, 7000 );
 
@@ -193,9 +190,9 @@
 
 					if ( child.isMesh ) {
 
-						buffer = child.geometry.attributes[ bufferName ];
+						var buffer = child.geometry.attributes[ bufferName ];
 
-						combined.set(buffer.array, offset);
+						combined.set( buffer.array, offset );
 						offset += buffer.array.length;
 
 					}

+ 10 - 10
examples/webgl_sprites.html

@@ -119,22 +119,27 @@
 				var height = material.map.image.height;
 
 				spriteTL = new THREE.Sprite( material );
+				spriteTL.center.set( 0.0, 1.0 );
 				spriteTL.scale.set( width, height, 1 );
 				sceneOrtho.add( spriteTL );
 
 				spriteTR = new THREE.Sprite( material );
+				spriteTR.center.set( 1.0, 1.0 );
 				spriteTR.scale.set( width, height, 1 );
 				sceneOrtho.add( spriteTR );
 
 				spriteBL = new THREE.Sprite( material );
+				spriteBL.center.set( 0.0, 0.0 );
 				spriteBL.scale.set( width, height, 1 );
 				sceneOrtho.add( spriteBL );
 
 				spriteBR = new THREE.Sprite( material );
+				spriteBR.center.set( 1.0, 0.0 );
 				spriteBR.scale.set( width, height, 1 );
 				sceneOrtho.add( spriteBR );
 
 				spriteC = new THREE.Sprite( material );
+				spriteC.center.set( 0.5, 0.5 );
 				spriteC.scale.set( width, height, 1 );
 				sceneOrtho.add( spriteC );
 
@@ -147,16 +152,11 @@
 				var width = window.innerWidth / 2;
 				var height = window.innerHeight / 2;
 
-				var material = spriteTL.material;
-
-				var imageWidth = material.map.image.width / 2;
-				var imageHeight = material.map.image.height / 2;
-
-				spriteTL.position.set( - width + imageWidth,   height - imageHeight, 1 ); // top left
-				spriteTR.position.set(   width - imageWidth,   height - imageHeight, 1 ); // top right
-				spriteBL.position.set( - width + imageWidth, - height + imageHeight, 1 ); // bottom left
-				spriteBR.position.set(   width - imageWidth, - height + imageHeight, 1 ); // bottom right
-				spriteC.position.set( 0, 0, 1 ); // center
+				spriteTL.position.set( - width,   height, 1 ); // top left
+				spriteTR.position.set(   width,   height, 1 ); // top right
+				spriteBL.position.set( - width, - height, 1 ); // bottom left
+				spriteBR.position.set(   width, - height, 1 ); // bottom right
+				spriteC.position.set(        0,        0, 1 ); // center
 
 			}
 

+ 217 - 166
examples/webgl_tiled_forward.html

@@ -45,139 +45,157 @@
 		<script src="js/libs/stats.min.js"></script>
 
 		<script>
-		
-		// Simple form of tiled forward lighting 
+
+		// Simple form of tiled forward lighting
 		// using texels as bitmasks of 32 lights
 
 		var RADIUS = 75;
 
-		THREE.ShaderChunk["lights_pars"] += [
-			"#if defined TILED_FORWARD",
-			"uniform vec4 tileData;",
-			"uniform sampler2D tileTexture;",
-			"uniform sampler2D lightTexture;",
-			"#endif"
-		].join("\n");
-
-		THREE.ShaderChunk["lights_template"] += [
-			"",
-			"#if defined TILED_FORWARD",
-			"vec2 tUv = floor(gl_FragCoord.xy / tileData.xy * 32.) / 32. + tileData.zw;",
-			"vec4 tile = texture2D(tileTexture, tUv);",
-			"for (int i=0; i < 4; i++) {",
-			"	float tileVal = tile.x * 255.;",	
-			"  	tile.xyzw = tile.yzwx;",
-			"	if(tileVal == 0.){ continue; }",
-			"  	float tileDiv = 128.;",
-			"	for (int j=0; j < 8; j++) {",
-			"  		if (tileVal < tileDiv) {  tileDiv *= 0.5; continue; }",
-			"		tileVal -= tileDiv;",
-			"		tileDiv *= 0.5;",
-			"  		PointLight pointlight;",
-			"		float uvx = (float(8 * i + j) + 0.5) / 32.;",
-			"  		vec4 lightData = texture2D(lightTexture, vec2(uvx, 0.));",
-			"  		vec4 lightColor = texture2D(lightTexture, vec2(uvx, 1.));",
-			"  		pointlight.position = lightData.xyz;",
-			"  		pointlight.distance = lightData.w;",
-			"  		pointlight.color = lightColor.rgb;",
-			"  		pointlight.decay = lightColor.a;",
-			"  		getPointDirectLightIrradiance( pointlight, geometry, directLight );",
-			"		RE_Direct( directLight, geometry, material, reflectedLight );",
-			"	}",
-			"}",
-			"#endif"
-		].join("\n");
+		THREE.ShaderChunk[ 'lights_pars' ] += [
+			'#if defined TILED_FORWARD',
+			'uniform vec4 tileData;',
+			'uniform sampler2D tileTexture;',
+			'uniform sampler2D lightTexture;',
+			'#endif'
+		].join( '\n' );
+
+		THREE.ShaderChunk[ 'lights_template' ] += [
+			'',
+			'#if defined TILED_FORWARD',
+			'vec2 tUv = floor(gl_FragCoord.xy / tileData.xy * 32.) / 32. + tileData.zw;',
+			'vec4 tile = texture2D(tileTexture, tUv);',
+			'for (int i=0; i < 4; i++) {',
+			'	float tileVal = tile.x * 255.;',
+			'  	tile.xyzw = tile.yzwx;',
+			'	if(tileVal == 0.){ continue; }',
+			'  	float tileDiv = 128.;',
+			'	for (int j=0; j < 8; j++) {',
+			'  		if (tileVal < tileDiv) {  tileDiv *= 0.5; continue; }',
+			'		tileVal -= tileDiv;',
+			'		tileDiv *= 0.5;',
+			'  		PointLight pointlight;',
+			'		float uvx = (float(8 * i + j) + 0.5) / 32.;',
+			'  		vec4 lightData = texture2D(lightTexture, vec2(uvx, 0.));',
+			'  		vec4 lightColor = texture2D(lightTexture, vec2(uvx, 1.));',
+			'  		pointlight.position = lightData.xyz;',
+			'  		pointlight.distance = lightData.w;',
+			'  		pointlight.color = lightColor.rgb;',
+			'  		pointlight.decay = lightColor.a;',
+			'  		getPointDirectLightIrradiance( pointlight, geometry, directLight );',
+			'		RE_Direct( directLight, geometry, material, reflectedLight );',
+			'	}',
+			'}',
+			'#endif'
+		].join( '\n' );
 
 		var lights = [], objects = [];
 
 		var State = {
-			rows:0,
-			cols:0,
+			rows: 0,
+			cols: 0,
 			width: 0,
 			height: 0,
-			tileData : { type: "v4", value: null },
-			tileTexture: { type: "t", value: null },
+			tileData: { type: 'v4', value: null },
+			tileTexture: { type: 't', value: null },
 			lightTexture: {
-				type: "t", 
-				value: new THREE.DataTexture(new Float32Array(32 * 2 * 4), 32, 2, THREE.RGBAFormat, THREE.FloatType)
+				type: 't',
+				value: new THREE.DataTexture( new Float32Array( 32 * 2 * 4 ), 32, 2, THREE.RGBAFormat, THREE.FloatType )
 			},
 		};
 
 		function resizeTiles() {
+
 			var width = window.innerWidth;
 			var height = window.innerHeight;
-			
+
 			State.width = width;
 			State.height = height;
-			State.cols = Math.ceil(width / 32);
-			State.rows = Math.ceil(height / 32);
-			State.tileData.value = [ width, height, 0.5 / Math.ceil( width / 32), 0.5 / Math.ceil( height / 32) ];
-			State.tileTexture.value = new THREE.DataTexture( new Uint8Array(State.cols * State.rows * 4), State.cols, State.rows);
+			State.cols = Math.ceil( width / 32 );
+			State.rows = Math.ceil( height / 32 );
+			State.tileData.value = [ width, height, 0.5 / Math.ceil( width / 32 ), 0.5 / Math.ceil( height / 32 ) ];
+			State.tileTexture.value = new THREE.DataTexture( new Uint8Array( State.cols * State.rows * 4 ), State.cols, State.rows );
+
 		}
 
 		// Generate the light bitmasks and store them in the tile texture
-		function tileLights(renderer, scene, camera) {
-			if(!camera.projectionMatrix) return;
-			
+		function tileLights( renderer, scene, camera ) {
+
+			if ( ! camera.projectionMatrix ) return;
+
 			var d = State.tileTexture.value.image.data;
 			var ld = State.lightTexture.value.image.data;
-			
+
 			var viewMatrix = camera.matrixWorldInverse;
-			
-			d.fill(0);
-			
+
+			d.fill( 0 );
+
 			var vector = new THREE.Vector3();
 
-			lights.forEach(function (light, index) {
+			lights.forEach( function ( light, index ) {
 
 				vector.setFromMatrixPosition( light.matrixWorld );
-				
-				var bs = lightBounds(camera, vector, light._light.radius);
-				
+
+				var bs = lightBounds( camera, vector, light._light.radius );
+
 				vector.applyMatrix4( viewMatrix );
-				vector.toArray(ld, 4 * index);
-				ld[4 * index + 3] = light._light.radius;
-				light._light.color.toArray(ld,32 * 4 + 4 * index);
-				ld[32 * 4 + 4 * index + 3] = light._light.decay;
-
-				if(bs[1] < 0 || bs[0] > State.width || bs[3] < 0 || bs[2] > State.height) return;
-				if(bs[0] < 0) bs[0] = 0;
-				if(bs[1] > State.width) bs[1] = State.width;
-				if(bs[2] < 0) bs[2] = 0;
-				if(bs[3] > State.height) bs[3] = State.height;
-				
-				var i4 = Math.floor(index / 8), i8 = 7 - (index % 8);
-				for (var i = Math.floor(bs[2] / 32); i <= Math.ceil(bs[3]/32); i++) {
-					for(var j = Math.floor(bs[0]/32); j <= Math.ceil(bs[1]/32); j++) {
-						d[(State.cols * i + j) * 4 + i4] |= 1 << i8;
+				vector.toArray( ld, 4 * index );
+				ld[ 4 * index + 3 ] = light._light.radius;
+				light._light.color.toArray( ld, 32 * 4 + 4 * index );
+				ld[ 32 * 4 + 4 * index + 3 ] = light._light.decay;
+
+				if ( bs[ 1 ] < 0 || bs[ 0 ] > State.width || bs[ 3 ] < 0 || bs[ 2 ] > State.height ) return;
+				if ( bs[ 0 ] < 0 ) bs[ 0 ] = 0;
+				if ( bs[ 1 ] > State.width ) bs[ 1 ] = State.width;
+				if ( bs[ 2 ] < 0 ) bs[ 2 ] = 0;
+				if ( bs[ 3 ] > State.height ) bs[ 3 ] = State.height;
+
+				var i4 = Math.floor( index / 8 ), i8 = 7 - ( index % 8 );
+
+				for ( var i = Math.floor( bs[ 2 ] / 32 ); i <= Math.ceil( bs[ 3 ] / 32 ); i ++ ) {
+
+					for ( var j = Math.floor( bs[ 0 ] / 32 ); j <= Math.ceil( bs[ 1 ] / 32 ); j ++ ) {
+
+						d[ ( State.cols * i + j ) * 4 + i4 ] |= 1 << i8;
+
 					}
-				}        
-			});
+
+				}
+
+			} );
 
 			State.tileTexture.value.needsUpdate = true;
 			State.lightTexture.value.needsUpdate = true;
+
 		}
 
 		// Screen rectangle bounds from light sphere's world AABB
-		var lightBounds = function (){
+		var lightBounds = function () {
+
 			v = new THREE.Vector3();
-			return function (camera, pos, r) {
+			return function ( camera, pos, r ) {
+
 				var minX = State.width, maxX = 0, minY = State.height, maxY = 0, hw = State.width / 2, hh = State.height / 2;
-				for(var i = 0; i < 8; i++){
-					v.copy(pos);
-					v.x += i & 1 ? r : -r;
-					v.y += i & 2 ? r : -r;
-					v.z += i & 4 ? r : -r;
-					var vector = v.project(camera);
-					var x = (vector.x * hw) + hw;
-					var y = (vector.y * hh) + hh;
-					minX = Math.min(minX, x);
-					maxX = Math.max(maxX, x);
-					minY = Math.min(minY, y);
-					maxY = Math.max(maxY, y);
-				}	
-				return [minX, maxX, minY, maxY];
-			}
+
+				for ( var i = 0; i < 8; i ++ ) {
+
+					v.copy( pos );
+					v.x += i & 1 ? r : - r;
+					v.y += i & 2 ? r : - r;
+					v.z += i & 4 ? r : - r;
+					var vector = v.project( camera );
+					var x = ( vector.x * hw ) + hw;
+					var y = ( vector.y * hh ) + hh;
+					minX = Math.min( minX, x );
+					maxX = Math.max( maxX, x );
+					minY = Math.min( minY, y );
+					maxY = Math.max( maxY, y );
+
+				}
+
+				return [ minX, maxX, minY, maxY ];
+
+		};
+
 		}();
 
 
@@ -193,15 +211,15 @@
 		var renderer = new THREE.WebGLRenderer( { antialias: false } );
 		renderer.toneMapping = THREE.LinearToneMapping;
 		container.appendChild( renderer.domElement );
-		
+
 		var renderTarget = new THREE.WebGLRenderTarget();
 
 		scene.add( new THREE.AmbientLight( 0xffffff, 0.33 ) );
-		// At least one regular Pointlight is needed to activate light support 
-		scene.add(new THREE.PointLight( 0xff0000, 0.1, 0.1 ));
-		
+		// At least one regular Pointlight is needed to activate light support
+		scene.add( new THREE.PointLight( 0xff0000, 0.1, 0.1 ) );
+
 		var bloom = new THREE.UnrealBloomPass( new THREE.Vector2(), 0.8, 0.6, 0.8 );
-		bloom.renderToScreen = true;				
+		bloom.renderToScreen = true;
 
 		var stats = new Stats();
 		container.appendChild( stats.dom );
@@ -209,104 +227,129 @@
 		controls = new THREE.OrbitControls( camera, renderer.domElement );
 		controls.minDistance = 120;
 		controls.maxDistance = 320;
-			
+
 		var materials = [];
 
 		var Heads = [
-			{ type: "physical", uniforms: { diffuse: 0x888888, metalness: 1.0, roughness: 0.66}, defines: {} },
-			{ type: "standard", uniforms: { diffuse: 0x666666, metalness: 0.1, roughness: 0.33}, defines: {} },
-			{ type: "phong", uniforms: { diffuse: 0x777777, shininess: 20}, defines: {} },
-			{ type: "phong", uniforms: { diffuse: 0x555555, shininess: 10}, defines: { TOON: 1} }
+			{ type: 'physical', uniforms: { diffuse: 0x888888, metalness: 1.0, roughness: 0.66 }, defines: {} },
+			{ type: 'standard', uniforms: { diffuse: 0x666666, metalness: 0.1, roughness: 0.33 }, defines: {} },
+			{ type: 'phong', uniforms: { diffuse: 0x777777, shininess: 20 }, defines: {} },
+			{ type: 'phong', uniforms: { diffuse: 0x555555, shininess: 10 }, defines: { TOON: 1 } }
 		];
 
-		function init (geom) {
+		function init( geom ) {
+
 			var sphereGeom = new THREE.SphereBufferGeometry( 0.5, 32, 32 );
-			var tIndex = Math.round(Math.random() * 3);
-			Object.keys(Heads).forEach(function(t, index) {
+			var tIndex = Math.round( Math.random() * 3 );
+			Object.keys( Heads ).forEach( function ( t, index ) {
+
 				var g = new THREE.Group();
-				var conf = Heads[t];
-				var ml = THREE.ShaderLib[conf.type];
-				var mtl = new THREE.ShaderMaterial({
+				var conf = Heads[ t ];
+				var ml = THREE.ShaderLib[ conf.type ];
+				var mtl = new THREE.ShaderMaterial( {
 					lights: true,
 					fragmentShader: ml.fragmentShader,
 					vertexShader: ml.vertexShader,
-					uniforms: THREE.UniformsUtils.clone(ml.uniforms),
+					uniforms: THREE.UniformsUtils.clone( ml.uniforms ),
 					defines: conf.defines,
 					transparent: tIndex === index ? true : false,
 
-				});
+				} );
+
 				mtl.uniforms.opacity.value = tIndex === index ? 0.9 : 1;
 				mtl.uniforms.tileData = State.tileData;
 				mtl.uniforms.tileTexture = State.tileTexture;
 				mtl.uniforms.lightTexture = State.lightTexture;
-				for( var u in conf.uniforms ) {
-					var vu = conf.uniforms[u];
-					if(mtl.uniforms[u].value.set) {
-						mtl.uniforms[u].value.set(vu);
+
+				for ( var u in conf.uniforms ) {
+
+					var vu = conf.uniforms[ u ];
+
+					if ( mtl.uniforms[ u ].value.set ) {
+
+						mtl.uniforms[ u ].value.set( vu );
+
 					} else {
-						mtl.uniforms[u].value = vu;
+
+						mtl.uniforms[ u ].value = vu;
+
 					}
+
 				}
-				mtl.defines["TILED_FORWARD"] = 1;
-				materials.push(mtl);
-				var obj = new THREE.Mesh(geom, mtl);
+
+				mtl.defines[ 'TILED_FORWARD' ] = 1;
+				materials.push( mtl );
+				var obj = new THREE.Mesh( geom, mtl );
 				mtl.side = tIndex === index ? THREE.FrontSide : THREE.DoubleSide;
-				
+
 				g.rotation.y = index * Math.PI / 2;
-				g.position.x = Math.sin(index * Math.PI / 2) * RADIUS;
-				g.position.z = Math.cos(index * Math.PI / 2) * RADIUS;
-				g.add(obj);
+				g.position.x = Math.sin( index * Math.PI / 2 ) * RADIUS;
+				g.position.z = Math.cos( index * Math.PI / 2 ) * RADIUS;
+				g.add( obj );
+
+				for ( var i = 0; i < 8; i ++ ) {
 
-				for(var i=0; i < 8; i++) {
-					var sat = Math.floor(33 + 33 * Math.random());
-					var chroma = Math.random() * 100; 
+					var color = new THREE.Color().setHSL( Math.random(), 1.0, 0.5 );
 					var l = new THREE.Group();
 
-					l.add(new THREE.Mesh(
-						sphereGeom, 
-						new THREE.MeshBasicMaterial( { color: new THREE.Color("hsl(" + chroma + ", " + sat + "%, 50%)") } )
-					));
-					l.add(new THREE.Mesh(
-						sphereGeom, 
-						new THREE.MeshBasicMaterial( { 
-							color: new THREE.Color("hsl(" + chroma + ", " + sat + "%, 50%)"), 
+					l.add( new THREE.Mesh(
+						sphereGeom,
+						new THREE.MeshBasicMaterial( {
+							color: color
+						} )
+					) );
+
+					l.add( new THREE.Mesh(
+						sphereGeom,
+						new THREE.MeshBasicMaterial( {
+							color: color,
 							transparent: true,
 							opacity: 0.033
 						} )
-					));
-					l.children[1].scale.set(6.66,6.66,6.66);
+					) );
+
+					l.children[ 1 ].scale.set( 6.66, 6.66, 6.66 );
 
 					l._light = {
-						color: new THREE.Color("hsl(" + chroma + ", " + sat + "%, 50%)"),
+						color: color,
 						radius: RADIUS,
 						decay: 1,
 						sy: Math.random(),
 						sr: Math.random(),
-						sc: Math.random() ,
-						py: Math.random() * Math.PI ,
-						pr: Math.random() * Math.PI ,
-						pc: Math.random() * Math.PI ,
-						dir: Math.random() > 0.5 ? 1:-1
+						sc: Math.random(),
+						py: Math.random() * Math.PI,
+						pr: Math.random() * Math.PI,
+						pc: Math.random() * Math.PI,
+						dir: Math.random() > 0.5 ? 1 : - 1
 					};
 
-					lights.push(l);
-					g.add(l);
+					lights.push( l );
+					g.add( l );
+
 				}
-				scene.add(g);
-			});
+
+				scene.add( g );
+
+			} );
+
 		}
 
-		function update(now) {
-			lights.forEach(function (l) {
+		function update( now ) {
+
+			lights.forEach( function ( l ) {
+
 				var ld = l._light;
-				var radius = 0.8 + 0.2 * Math.sin(ld.pr + (0.6 + 0.3 * ld.sr) * now);
-				l.position.x =(Math.sin(ld.pc + (0.8 + 0.2 * ld.sc) * now * ld.dir)) * radius * RADIUS;
-				l.position.z =(Math.cos(ld.pc + (0.8 + 0.2 * ld.sc) * now * ld.dir)) * radius * RADIUS;
-				l.position.y = Math.sin(ld.py + (0.8 + 0.2 * ld.sy) * now) * radius * 32;
-			});
+				var radius = 0.8 + 0.2 * Math.sin( ld.pr + ( 0.6 + 0.3 * ld.sr ) * now );
+				l.position.x = ( Math.sin( ld.pc + ( 0.8 + 0.2 * ld.sc ) * now * ld.dir ) ) * radius * RADIUS;
+				l.position.z = ( Math.cos( ld.pc + ( 0.8 + 0.2 * ld.sc ) * now * ld.dir ) ) * radius * RADIUS;
+				l.position.y = Math.sin( ld.py + ( 0.8 + 0.2 * ld.sy ) * now ) * radius * 32;
+
+			} );
+
 		}
 
 		function resize() {
+
 			renderer.setPixelRatio( window.devicePixelRatio );
 			renderer.setSize( window.innerWidth, window.innerHeight );
 			renderTarget.setSize( window.innerWidth, window.innerHeight );
@@ -314,10 +357,13 @@
 			camera.aspect = window.innerWidth / window.innerHeight;
 			camera.updateProjectionMatrix();
 			resizeTiles();
+
 		}
 
-		function postEffect(renderer, camera, scene, renderTarget) {
-			bloom.render(renderer, null, renderTarget);
+		function postEffect( renderer, scene, camera ) {
+
+			bloom.render( renderer, null, renderTarget );
+
 		}
 
 		scene.onBeforeRender = tileLights;
@@ -326,18 +372,23 @@
 
 		var loader = new THREE.JSONLoader();
 
-		loader.load('./obj/walt/WaltHead_slim.js', function(geometry) {
-			window.addEventListener("resize", resize);
-			init(geometry);
+		loader.load( './obj/walt/WaltHead_slim.js', function ( geometry ) {
+
+			window.addEventListener( 'resize', resize );
+			init( geometry );
 			resize();
-			
-			renderer.animate( function(time) {
-				update(time/1000);
+
+			renderer.animate( function ( time ) {
+
+				update( time / 1000 );
 				stats.begin();
-				renderer.render(scene, camera, renderTarget); 
+				renderer.render( scene, camera, renderTarget );
 				stats.end();
-			});
-		});
+
+			} );
+
+		} );
+
 		</script>
 	</body>
-</html>
+</html>

+ 2 - 2
examples/webvr_cubes.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - cubes</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_daydream.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - daydream</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_gearvr.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - gear vr</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_panorama.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - panorama</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			html, body {
 				background-color: #000;

+ 2 - 2
examples/webvr_rollercoaster.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - roller coaster</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				margin: 0px;

+ 2 - 2
examples/webvr_sandbox.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - sandbox</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				margin: 0px;

+ 2 - 2
examples/webvr_video.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - video</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_vive.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - htc vive</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_vive_dragging.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - htc vive - dragging</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_vive_paint.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - htc vive - paint</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 2 - 2
examples/webvr_vive_sculpt.html

@@ -4,8 +4,8 @@
 		<title>three.js webvr - htc vive - sculpt</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-01-21 -->
-		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-01-21" content="Ap+tmQjuEXRrzmu+ZuReB/eY8fZmTEOybJ2hME1RgEZAPzhZ4/IAKEHRebiTp6o4LoZOMBexL4GAL7flIkAUlQYAAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxNjUzODYxMX0=">
+		<!-- Origin Trial Token, feature = WebVR (For Chrome M62+), origin = https://threejs.org, expires = 2018-02-26 -->
+		<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M62+)" data-expires="2018-02-26" content="ApUnsKNm8cOce0NnJY05mJWYKGaTC2dw9o/+zbrmpEZk/ePiOfxjvcRnKlJUo6zYOrltLnYMcvdWjPTMCJzR1g4AAABQeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMU02MiIsImV4cGlyeSI6MTUxOTY0ODk5MX0=">
 		<style>
 			body {
 				font-family: Monospace;

+ 1 - 1
package.json

@@ -49,7 +49,7 @@
   "bugs": {
     "url": "https://github.com/mrdoob/three.js/issues"
   },
-  "homepage": "http://threejs.org/",
+  "homepage": "https://threejs.org/",
   "devDependencies": {
     "concurrently": "^3.5.0",
     "electron": "1.7.8",

+ 3 - 3
src/Three.Legacy.js

@@ -5,7 +5,7 @@
 import { Audio } from './audio/Audio.js';
 import { AudioAnalyser } from './audio/AudioAnalyser.js';
 import { PerspectiveCamera } from './cameras/PerspectiveCamera.js';
-import { CullFaceFront, CullFaceBack, FlatShading } from './constants.js';
+import { FlatShading } from './constants.js';
 import {
 	Float64BufferAttribute,
 	Float32BufferAttribute,
@@ -1372,7 +1372,7 @@ Object.defineProperties( WebGLRenderer.prototype, {
 			return undefined;
 
 		},
-		set: function ( value ) {
+		set: function ( /* value */ ) {
 
 			console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );
 
@@ -1389,7 +1389,7 @@ Object.defineProperties( WebGLShadowMap.prototype, {
 			return undefined;
 
 		},
-		set: function ( cullFace ) {
+		set: function ( /* cullFace */ ) {
 
 			console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );
 

+ 1 - 37
src/extras/core/Font.js

@@ -3,7 +3,6 @@
  * @author mrdoob / http://mrdoob.com/
  */
 
-import { QuadraticBezier, CubicBezier } from './Interpolations.js';
 import { ShapePath } from './ShapePath.js';
 
 
@@ -80,8 +79,7 @@ function createPath( char, divisions, scale, offsetX, offsetY, data ) {
 
 	var path = new ShapePath();
 
-	var pts = [];
-	var x, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2, laste;
+	var x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
 
 	if ( glyph.o ) {
 
@@ -120,23 +118,6 @@ function createPath( char, divisions, scale, offsetX, offsetY, data ) {
 
 					path.quadraticCurveTo( cpx1, cpy1, cpx, cpy );
 
-					laste = pts[ pts.length - 1 ];
-
-					if ( laste ) {
-
-						cpx0 = laste.x;
-						cpy0 = laste.y;
-
-						for ( var i2 = 1; i2 <= divisions; i2 ++ ) {
-
-							var t = i2 / divisions;
-							QuadraticBezier( t, cpx0, cpx1, cpx );
-							QuadraticBezier( t, cpy0, cpy1, cpy );
-
-						}
-
-					}
-
 					break;
 
 				case 'b': // bezierCurveTo
@@ -150,23 +131,6 @@ function createPath( char, divisions, scale, offsetX, offsetY, data ) {
 
 					path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );
 
-					laste = pts[ pts.length - 1 ];
-
-					if ( laste ) {
-
-						cpx0 = laste.x;
-						cpy0 = laste.y;
-
-						for ( var i2 = 1; i2 <= divisions; i2 ++ ) {
-
-							var t = i2 / divisions;
-							CubicBezier( t, cpx0, cpx1, cpx2, cpx );
-							CubicBezier( t, cpy0, cpy1, cpy2, cpy );
-
-						}
-
-					}
-
 					break;
 
 			}

+ 2 - 2
src/lights/PointLight.js

@@ -17,14 +17,14 @@ function PointLight( color, intensity, distance, decay ) {
 		get: function () {
 
 			// intensity = power per solid angle.
-			// ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			return this.intensity * 4 * Math.PI;
 
 		},
 		set: function ( power ) {
 
 			// intensity = power per solid angle.
-			// ref: equation (15) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			this.intensity = power / ( 4 * Math.PI );
 
 		}

+ 2 - 2
src/lights/SpotLight.js

@@ -21,14 +21,14 @@ function SpotLight( color, intensity, distance, angle, penumbra, decay ) {
 		get: function () {
 
 			// intensity = power per solid angle.
-			// ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			return this.intensity * Math.PI;
 
 		},
 		set: function ( power ) {
 
 			// intensity = power per solid angle.
-			// ref: equation (17) from http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 			this.intensity = power / Math.PI;
 
 		}

+ 0 - 1
src/loaders/ObjectLoader.js

@@ -20,7 +20,6 @@ import {
 	LinearMipMapLinearFilter
 } from '../constants.js';
 import { Color } from '../math/Color.js';
-import { Matrix4 } from '../math/Matrix4.js';
 import { Object3D } from '../core/Object3D.js';
 import { Group } from '../objects/Group.js';
 import { Sprite } from '../objects/Sprite.js';

+ 101 - 0
src/math/Box3.js

@@ -371,6 +371,107 @@ Object.assign( Box3.prototype, {
 
 	},
 
+	intersectsTriangle: ( function () {
+
+		// triangle centered vertices
+		var v0 = new Vector3();
+		var v1 = new Vector3();
+		var v2 = new Vector3();
+
+		// triangle edge vectors
+		var f0 = new Vector3();
+		var f1 = new Vector3();
+		var f2 = new Vector3();
+
+		var testAxis = new Vector3();
+
+		var center = new Vector3();
+		var extents = new Vector3();
+
+		var triangleNormal = new Vector3();
+
+		function satForAxes( axes ) {
+
+			var i, j;
+
+			for ( i = 0, j = axes.length - 3; i <= j; i += 3 ) {
+
+				testAxis.fromArray( axes, i );
+				// project the aabb onto the seperating axis
+				var r = extents.x * Math.abs( testAxis.x ) + extents.y * Math.abs( testAxis.y ) + extents.z * Math.abs( testAxis.z );
+				// project all 3 vertices of the triangle onto the seperating axis
+				var p0 = v0.dot( testAxis );
+				var p1 = v1.dot( testAxis );
+				var p2 = v2.dot( testAxis );
+				// actual test, basically see if either of the most extreme of the triangle points intersects r
+				if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
+
+					// points of the projected triangle are outside the projected half-length of the aabb
+					// the axis is seperating and we can exit
+					return false;
+
+				}
+
+			}
+
+			return true;
+
+		}
+
+		return function intersectsTriangle( triangle ) {
+
+			if ( this.isEmpty() ) {
+
+				return false;
+
+			}
+
+			// compute box center and extents
+			this.getCenter( center );
+			extents.subVectors( this.max, center );
+
+			// translate triangle to aabb origin
+			v0.subVectors( triangle.a, center );
+			v1.subVectors( triangle.b, center );
+			v2.subVectors( triangle.c, center );
+
+			// compute edge vectors for triangle
+			f0.subVectors( v1, v0 );
+			f1.subVectors( v2, v1 );
+			f2.subVectors( v0, v2 );
+
+			// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
+			// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
+			// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
+			var axes = [
+				0, - f0.z, f0.y, 0, - f1.z, f1.y, 0, - f2.z, f2.y,
+				f0.z, 0, - f0.x, f1.z, 0, - f1.x, f2.z, 0, - f2.x,
+				- f0.y, f0.x, 0, - f1.y, f1.x, 0, - f2.y, f2.x, 0
+			];
+			if ( ! satForAxes( axes ) ) {
+
+				return false;
+
+			}
+
+			// test 3 face normals from the aabb
+			axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
+			if ( ! satForAxes( axes ) ) {
+
+				return false;
+
+			}
+
+			// finally testing the face normal of the triangle
+			// use already existing triangle edge vectors here
+			triangleNormal.crossVectors( f0, f1 );
+			axes = [ triangleNormal.x, triangleNormal.y, triangleNormal.z ];
+			return satForAxes( axes );
+
+		};
+
+	} )(),
+
 	clampPoint: function ( point, optionalTarget ) {
 
 		var result = optionalTarget || new Vector3();

+ 3 - 1
src/math/Quaternion.js

@@ -395,7 +395,9 @@ Object.assign( Quaternion.prototype, {
 
 	inverse: function () {
 
-		return this.conjugate().normalize();
+		// quaternion is assumed to have unit length
+
+		return this.conjugate();
 
 	},
 

+ 6 - 0
src/math/Triangle.js

@@ -189,6 +189,12 @@ Object.assign( Triangle.prototype, {
 
 	},
 
+	intersectsBox: function ( box ) {
+
+		return box.intersectsTriangle( this );
+
+	},
+
 	closestPointToPoint: function () {
 
 		var plane = new Plane();

+ 14 - 0
src/objects/Sprite.js

@@ -1,3 +1,4 @@
+import { Vector2 } from '../math/Vector2.js';
 import { Vector3 } from '../math/Vector3.js';
 import { Object3D } from '../core/Object3D.js';
 import { SpriteMaterial } from '../materials/SpriteMaterial.js';
@@ -15,6 +16,8 @@ function Sprite( material ) {
 
 	this.material = ( material !== undefined ) ? material : new SpriteMaterial();
 
+	this.center = new Vector2( 0.5, 0.5 );
+
 }
 
 Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
@@ -60,8 +63,19 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return new this.constructor( this.material ).copy( this );
 
+	},
+
+	copy: function ( source ) {
+
+		Object3D.prototype.copy.call( this, source );
+
+		if ( source.center !== undefined ) this.center.copy( source.center );
+
+		return this;
+
 	}
 
+
 } );
 
 

+ 4 - 2
src/renderers/WebGLRenderer.js

@@ -757,7 +757,7 @@ function WebGLRenderer( parameters ) {
 
 		//
 
-		var dataCount = 0;
+		var dataCount = Infinity;
 
 		if ( index !== null ) {
 
@@ -1216,7 +1216,7 @@ function WebGLRenderer( parameters ) {
 
 		state.setPolygonOffset( false );
 
-		scene.onAfterRender( _this, scene, camera, renderTarget );
+		scene.onAfterRender( _this, scene, camera );
 
 		if ( vr.enabled ) {
 
@@ -1226,6 +1226,8 @@ function WebGLRenderer( parameters ) {
 
 		// _gl.finish();
 
+		currentRenderList = null;
+
 	};
 
 	/*

+ 8 - 1
src/renderers/webgl/WebGLSpriteRenderer.js

@@ -55,6 +55,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			uvScale: gl.getUniformLocation( program, 'uvScale' ),
 
 			rotation: gl.getUniformLocation( program, 'rotation' ),
+			center: gl.getUniformLocation( program, 'center' ),
 			scale: gl.getUniformLocation( program, 'scale' ),
 
 			color: gl.getUniformLocation( program, 'color' ),
@@ -171,6 +172,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 		// render all sprites
 
 		var scale = [];
+		var center = [];
 
 		for ( var i = 0, l = sprites.length; i < l; i ++ ) {
 
@@ -189,6 +191,9 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			scale[ 0 ] = spriteScale.x;
 			scale[ 1 ] = spriteScale.y;
 
+			center[ 0 ] = sprite.center.x - 0.5;
+			center[ 1 ] = sprite.center.y - 0.5;
+
 			var fogType = 0;
 
 			if ( scene.fog && material.fog ) {
@@ -220,6 +225,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			gl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b );
 
 			gl.uniform1f( uniforms.rotation, material.rotation );
+			gl.uniform2fv( uniforms.center, center );
 			gl.uniform2fv( uniforms.scale, scale );
 
 			state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );
@@ -259,6 +265,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 			'uniform mat4 modelViewMatrix;',
 			'uniform mat4 projectionMatrix;',
 			'uniform float rotation;',
+			'uniform vec2 center;',
 			'uniform vec2 scale;',
 			'uniform vec2 uvOffset;',
 			'uniform vec2 uvScale;',
@@ -273,7 +280,7 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
 
 			'	vUV = uvOffset + uv * uvScale;',
 
-			'	vec2 alignedPosition = position * scale;',
+			'	vec2 alignedPosition = ( position - center ) * scale;',
 
 			'	vec2 rotatedPosition;',
 			'	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;',

+ 1 - 0
test/three.example.unit.js

@@ -4,3 +4,4 @@
 
 import './unit/example/exporters/GLTFExporter.tests';
 import './unit/example/loaders/GLTFLoader.tests';
+import './unit/example/objects/LensFlare.tests';

+ 0 - 2
test/three.source.unit.js

@@ -220,7 +220,6 @@ import './unit/src/math/interpolants/QuaternionLinearInterpolant.tests';
 //src/objects
 import './unit/src/objects/Bone.tests';
 import './unit/src/objects/Group.tests';
-import './unit/src/objects/LensFlare.tests';
 import './unit/src/objects/Line.tests';
 import './unit/src/objects/LineLoop.tests';
 import './unit/src/objects/LineSegments.tests';
@@ -251,7 +250,6 @@ import './unit/src/renderers/webgl/WebGLBufferRenderer.tests';
 import './unit/src/renderers/webgl/WebGLCapabilities.tests';
 import './unit/src/renderers/webgl/WebGLClipping.tests';
 import './unit/src/renderers/webgl/WebGLExtensions.tests';
-import './unit/src/renderers/webgl/WebGLFlareRenderer.tests';
 import './unit/src/renderers/webgl/WebGLGeometries.tests';
 import './unit/src/renderers/webgl/WebGLIndexedBufferRenderer.tests';
 import './unit/src/renderers/webgl/WebGLLights.tests';

+ 1 - 1
test/unit/src/objects/LensFlare.tests.js → test/unit/example/objects/LensFlare.tests.js

@@ -3,7 +3,7 @@
  */
 /* global QUnit */
 
-import { LensFlare } from '../../../../src/objects/LensFlare';
+import * as LensFlare from '../../../../examples/js/objects/LensFlare';
 
 export default QUnit.module( 'Objects', () => {
 

+ 18 - 0
test/unit/src/math/Box3.tests.js

@@ -6,6 +6,7 @@
 
 import { Box3 } from '../../../../src/math/Box3';
 import { Sphere } from '../../../../src/math/Sphere';
+import { Triangle } from '../../../../src/math/Triangle';
 import { Plane } from '../../../../src/math/Plane';
 import { Vector3 } from '../../../../src/math/Vector3';
 import { Matrix4 } from '../../../../src/math/Matrix4';
@@ -390,6 +391,23 @@ export default QUnit.module( 'Maths', () => {
 
 		} );
 
+		QUnit.test( "intersectsTriangle", ( assert ) => {
+
+			var a = new Box3( one3.clone(), two3.clone() );
+			var b = new Triangle( new Vector3( 1.5, 1.5, 2.5 ), new Vector3( 2.5, 1.5, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+			var c = new Triangle( new Vector3( 1.5, 1.5, 3.5 ), new Vector3( 3.5, 1.5, 1.5 ), new Vector3( 1.5, 1.5, 1.5 ) );
+			var d = new Triangle( new Vector3( 1.5, 1.75, 3 ), new Vector3( 3, 1.75, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+			var e = new Triangle( new Vector3( 1.5, 1.8, 3 ), new Vector3( 3, 1.8, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+			var f = new Triangle( new Vector3( 1.5, 2.5, 3 ), new Vector3( 3, 2.5, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+
+			assert.ok( a.intersectsTriangle( b ), "Passed!" );
+			assert.ok( a.intersectsTriangle( c ), "Passed!" );
+			assert.ok( a.intersectsTriangle( d ), "Passed!" );
+			assert.ok( ! a.intersectsTriangle( e ), "Passed!" );
+			assert.ok( ! a.intersectsTriangle( f ), "Passed!" );
+
+		} );
+
 		QUnit.test( "clampPoint", ( assert ) => {
 
 			var a = new Box3( zero3.clone(), zero3.clone() );

+ 18 - 0
test/unit/src/math/Triangle.tests.js

@@ -5,6 +5,7 @@
 /* global QUnit */
 
 import { Triangle } from '../../../../src/math/Triangle';
+import { Box3 } from '../../../../src/math/Box3';
 import { Vector3 } from '../../../../src/math/Vector3';
 import {
 	zero3,
@@ -219,6 +220,23 @@ export default QUnit.module( 'Maths', () => {
 
 		} );
 
+		QUnit.test( "intersectsBox", ( assert ) => {
+
+			var a = new Box3( one3.clone(), two3.clone() );
+			var b = new Triangle( new Vector3( 1.5, 1.5, 2.5 ), new Vector3( 2.5, 1.5, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+			var c = new Triangle( new Vector3( 1.5, 1.5, 3.5 ), new Vector3( 3.5, 1.5, 1.5 ), new Vector3( 1.5, 1.5, 1.5 ) );
+			var d = new Triangle( new Vector3( 1.5, 1.75, 3 ), new Vector3( 3, 1.75, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+			var e = new Triangle( new Vector3( 1.5, 1.8, 3 ), new Vector3( 3, 1.8, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+			var f = new Triangle( new Vector3( 1.5, 2.5, 3 ), new Vector3( 3, 2.5, 1.5 ), new Vector3( 1.5, 2.5, 1.5 ) );
+
+			assert.ok( b.intersectsBox( a ), "Passed!" );
+			assert.ok( c.intersectsBox( a ), "Passed!" );
+			assert.ok( d.intersectsBox( a ), "Passed!" );
+			assert.ok( ! e.intersectsBox( a ), "Passed!" );
+			assert.ok( ! f.intersectsBox( a ), "Passed!" );
+
+		} );
+
 		QUnit.test( "closestPointToPoint", ( assert ) => {
 
 			var a = new Triangle( new Vector3( - 1, 0, 0 ), new Vector3( 1, 0, 0 ), new Vector3( 0, 1, 0 ) );

+ 0 - 32
test/unit/src/renderers/webgl/WebGLFlareRenderer.tests.js

@@ -1,32 +0,0 @@
-/**
- * @author TristanVALCKE / https://github.com/Itee
- */
-/* global QUnit */
-
-import { WebGLFlareRenderer } from '../../../../../src/renderers/webgl/WebGLFlareRenderer';
-
-export default QUnit.module( 'Renderers', () => {
-
-	QUnit.module( 'WebGL', () => {
-
-		QUnit.module( 'WebGLFlareRenderer', () => {
-
-			// INSTANCING
-			QUnit.todo( "Instancing", ( assert ) => {
-
-				assert.ok( false, "everything's gonna be alright" );
-
-			} );
-
-			// PUBLIC STUFF
-			QUnit.todo( "render", ( assert ) => {
-
-				assert.ok( false, "everything's gonna be alright" );
-
-			} );
-
-		} );
-
-	} );
-
-} );

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