浏览代码

Merge branch 'dev' of [email protected]:mrdoob/three.js into ambientOcclusionMap

Ben Houston 10 年之前
父节点
当前提交
81a7d078f1
共有 100 个文件被更改,包括 1227 次插入946 次删除
  1. 1 1
      bower.json
  2. 103 55
      build/three.js
  3. 84 85
      build/three.min.js
  4. 4 2
      docs/api/extras/helpers/EdgesHelper.html
  5. 1 2
      docs/api/math/Matrix4.html
  6. 0 1
      docs/scenes/js/material.js
  7. 2 4
      editor/js/Script.js
  8. 3 1
      examples/index.html
  9. 1 1
      examples/js/AudioObject.js
  10. 2 2
      examples/js/MarchingCubes.js
  11. 1 1
      examples/js/Mirror.js
  12. 3 3
      examples/js/Octree.js
  13. 8 5
      examples/js/ShaderDeferred.js
  14. 16 23
      examples/js/SkyShader.js
  15. 1 1
      examples/js/UCSCharacter.js
  16. 1 1
      examples/js/WaterShader.js
  17. 2 2
      examples/js/controls/FlyControls.js
  18. 3 3
      examples/js/controls/OrbitControls.js
  19. 20 12
      examples/js/controls/VRControls.js
  20. 2 2
      examples/js/effects/StereoEffect.js
  21. 19 4
      examples/js/effects/VREffect.js
  22. 5 5
      examples/js/loaders/AWDLoader.js
  23. 1 1
      examples/js/loaders/BabylonLoader.js
  24. 23 23
      examples/js/loaders/BinaryLoader.js
  25. 34 34
      examples/js/loaders/ColladaLoader.js
  26. 3 3
      examples/js/loaders/DDSLoader.js
  27. 1 1
      examples/js/loaders/OBJLoader.js
  28. 1 1
      examples/js/loaders/OBJMTLLoader.js
  29. 1 1
      examples/js/loaders/PLYLoader.js
  30. 15 15
      examples/js/loaders/PVRLoader.js
  31. 4 4
      examples/js/loaders/RGBELoader.js
  32. 10 10
      examples/js/loaders/TGALoader.js
  33. 8 8
      examples/js/loaders/VRMLLoader.js
  34. 4 4
      examples/js/loaders/ctm/CTMLoader.js
  35. 15 15
      examples/js/loaders/gltf/glTFLoader.js
  36. 2 2
      examples/js/loaders/gltf/glTFLoaderUtils.js
  37. 2 2
      examples/js/math/Lut.js
  38. 7 7
      examples/js/modifiers/SubdivisionModifier.js
  39. 14 14
      examples/js/postprocessing/AdaptiveToneMappingPass.js
  40. 2 2
      examples/js/postprocessing/BloomPass.js
  41. 1 1
      examples/js/postprocessing/BokehPass.js
  42. 1 1
      examples/js/postprocessing/DotScreenPass.js
  43. 1 1
      examples/js/postprocessing/EffectComposer.js
  44. 1 1
      examples/js/postprocessing/FilmPass.js
  45. 5 5
      examples/js/postprocessing/GlitchPass.js
  46. 1 1
      examples/js/postprocessing/SavePass.js
  47. 1 1
      examples/js/postprocessing/TexturePass.js
  48. 2 2
      examples/js/renderers/CSS3DRenderer.js
  49. 6 6
      examples/js/renderers/CSS3DStereoRenderer.js
  50. 2 2
      examples/js/renderers/CanvasRenderer.js
  51. 3 3
      examples/js/renderers/Projector.js
  52. 1 1
      examples/js/renderers/SVGRenderer.js
  53. 6 4
      examples/js/shaders/NormalDisplacementShader.js
  54. 2 2
      examples/js/utils/GeometryUtils.js
  55. 1 1
      examples/js/wip/ProxyGeometry.js
  56. 6 5
      examples/misc_fps.html
  57. 3 0
      examples/models/json/pressure.json
  58. 二进制
      examples/textures/MaryOculus.webm
  59. 1 0
      examples/textures/MaryOculus.webm.nfo
  60. 5 0
      examples/textures/decal/LICENSE.TXT
  61. 二进制
      examples/textures/decal/decal-diffuse.png
  62. 二进制
      examples/textures/decal/decal-normal.jpg
  63. 168 0
      examples/vr_video.html
  64. 1 1
      examples/webgl_decals.html
  65. 1 0
      examples/webgl_interactive_cubes_gpu.html
  66. 10 32
      examples/webgl_loader_scene.html
  67. 3 0
      examples/webgl_materials_normaldisplacementmap.html
  68. 1 1
      examples/webgl_mirror.html
  69. 13 24
      examples/webgl_shaders_sky.html
  70. 37 18
      examples/webgl_shaders_tonemapping.html
  71. 1 1
      examples/webgl_terrain_dynamic.html
  72. 2 2
      src/Three.js
  73. 15 20
      src/core/BufferGeometry.js
  74. 32 9
      src/core/Geometry.js
  75. 1 3
      src/core/Object3D.js
  76. 7 9
      src/extras/FontUtils.js
  77. 223 220
      src/extras/animation/Animation.js
  78. 98 101
      src/extras/animation/KeyFrameAnimation.js
  79. 7 5
      src/extras/animation/MorphAnimation.js
  80. 57 2
      src/extras/audio/Audio.js
  81. 0 7
      src/extras/audio/AudioListener.js
  82. 2 2
      src/extras/core/Curve.js
  83. 13 14
      src/extras/core/Path.js
  84. 7 7
      src/extras/core/Shape.js
  85. 2 0
      src/extras/geometries/BoxGeometry.js
  86. 0 11
      src/extras/geometries/CubeGeometry.js
  87. 7 15
      src/extras/geometries/ExtrudeGeometry.js
  88. 2 3
      src/extras/geometries/ParametricGeometry.js
  89. 1 1
      src/extras/geometries/PlaneGeometry.js
  90. 1 2
      src/extras/geometries/PolyhedronGeometry.js
  91. 1 2
      src/extras/geometries/ShapeGeometry.js
  92. 2 6
      src/extras/geometries/TubeGeometry.js
  93. 11 2
      src/extras/helpers/EdgesHelper.js
  94. 0 2
      src/extras/helpers/VertexNormalsHelper.js
  95. 0 2
      src/extras/helpers/VertexTangentsHelper.js
  96. 0 1
      src/extras/objects/MorphBlendMesh.js
  97. 3 3
      src/loaders/BufferGeometryLoader.js
  98. 2 2
      src/loaders/Cache.js
  99. 17 15
      src/loaders/JSONLoader.js
  100. 1 1
      src/loaders/Loader.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
 	"name": "three.js",
 	"name": "three.js",
-	"version": "0.0.70",
+	"version": "0.0.71",
 	"homepage": "http://threejs.org/",
 	"homepage": "http://threejs.org/",
 	"description": "JavaScript 3D library",
 	"description": "JavaScript 3D library",
 	"main": "build/three.js",
 	"main": "build/three.js",

文件差异内容过多而无法显示
+ 103 - 55
build/three.js


文件差异内容过多而无法显示
+ 84 - 85
build/three.min.js


+ 4 - 2
docs/api/extras/helpers/EdgesHelper.html

@@ -27,10 +27,12 @@
 		</code>
 		</code>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
-		<h3>[name]( [page:Object3D object], [page:Color color] )</h3>
+		<h3>[name]( [page:Object3D object], [page:Color color], [page:Float thresholdAngle] )</h3>
 		<div>
 		<div>
 		object -- Object of which to draw edges <br />
 		object -- Object of which to draw edges <br />
-		color -- Color of the edges.
+		color -- Color of the edges.<br />
+		thresholdAngle -- the minimim angle (in degrees), between the face normals of adjacent faces, that is required to render an edge. Default is 0.1.
+
 		</div>
 		</div>
 		<div>
 		<div>
 		Creates a [page:Line], showing only the "hard" edges of the passed object; specifically, no edge will be drawn between faces which are adjacent and coplanar (or nearly coplanar).
 		Creates a [page:Line], showing only the "hard" edges of the passed object; specifically, no edge will be drawn between faces which are adjacent and coplanar (or nearly coplanar).

+ 1 - 2
docs/api/math/Matrix4.html

@@ -165,8 +165,7 @@
 
 
 		<h3>[method:Array decompose]( [page:Vector3 translation], [page:Quaternion quaternion], [page:Vector3 scale] )</h3>
 		<h3>[method:Array decompose]( [page:Vector3 translation], [page:Quaternion quaternion], [page:Vector3 scale] )</h3>
 		<div>
 		<div>
-		Decomposes this matrix into the *translation*, *quaternion* and *scale* components.<br />
-		If parameters are not passed, new instances will be created.
+		Decomposes this matrix into the *translation*, *quaternion* and *scale* components.
 		</div>
 		</div>
 
 
 		<h3>[method:Matrix4 makeTranslation]( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4 this]</h3>
 		<h3>[method:Matrix4 makeTranslation]( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4 this]</h3>

+ 0 - 1
docs/scenes/js/material.js

@@ -365,7 +365,6 @@ function guiMeshNormalMaterial ( gui, mesh, material, geometry ) {
 
 
 	var folder = gui.addFolder('THREE.MeshNormalMaterial');
 	var folder = gui.addFolder('THREE.MeshNormalMaterial');
 
 
-	folder.add( material, 'shading', constants.shading).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
 	folder.add( material, 'morphTargets' ).onChange( updateMorphs( mesh, material ) );
 	folder.add( material, 'morphTargets' ).onChange( updateMorphs( mesh, material ) );

+ 2 - 4
editor/js/Script.js

@@ -89,14 +89,12 @@ var Script = function ( editor ) {
 
 
 			}
 			}
 
 
-			for ( var i = 0; i < widgets.length; i ++ ) {
+			while ( widgets.length > 0 ) {
 
 
-				codemirror.removeLineWidget( widgets[ i ] );
+				codemirror.removeLineWidget( widgets.shift() );
 
 
 			}
 			}
 
 
-			widgets.length = 0;
-
 			//
 			//
 
 
 			try {
 			try {

+ 3 - 1
examples/index.html

@@ -358,6 +358,7 @@
 				"webgl_shadowmap",
 				"webgl_shadowmap",
 				"webgl_shadowmap_performance",
 				"webgl_shadowmap_performance",
 				"webgl_shadowmap_viewer",
 				"webgl_shadowmap_viewer",
+				"webgl_shadowmesh",
 				"webgl_sprites",
 				"webgl_sprites",
 				"webgl_terrain_dynamic",
 				"webgl_terrain_dynamic",
 				"webgl_test_memory",
 				"webgl_test_memory",
@@ -371,7 +372,8 @@
 				"webgldeferred_pointlights"
 				"webgldeferred_pointlights"
 			],
 			],
 			"vr": [
 			"vr": [
-				"vr_cubes"
+				"vr_cubes",
+				"vr_video"
 			],
 			],
 			"css3d": [
 			"css3d": [
 				"css3d_molecules",
 				"css3d_molecules",

+ 1 - 1
examples/js/AudioObject.js

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

+ 2 - 2
examples/js/MarchingCubes.js

@@ -740,7 +740,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 
 
 		this.render( geo_callback );
 		this.render( geo_callback );
 
 
-		// console.log( "generated " + geo.faces.length + " triangles" );
+		// THREE.log( "generated " + geo.faces.length + " triangles" );
 
 
 		return geo;
 		return geo;
 
 
@@ -751,7 +751,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 };
 };
 
 
 THREE.MarchingCubes.prototype = Object.create( THREE.ImmediateRenderObject.prototype );
 THREE.MarchingCubes.prototype = Object.create( THREE.ImmediateRenderObject.prototype );
-THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
+THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
 
 
 
 
 /////////////////////////////////////
 /////////////////////////////////////

+ 1 - 1
examples/js/Mirror.js

@@ -103,7 +103,7 @@ THREE.Mirror = function ( renderer, camera, options ) {
 	} else {
 	} else {
 
 
 		this.camera = new THREE.PerspectiveCamera();
 		this.camera = new THREE.PerspectiveCamera();
-		console.log( this.name + ': camera is not a Perspective Camera!' );
+		THREE.log( this.name + ': camera is not a Perspective Camera!' );
 
 
 	}
 	}
 
 

+ 3 - 3
examples/js/Octree.js

@@ -2029,9 +2029,9 @@
 			
 			
 			space = typeof space === 'string' ? space : spaceAddition;
 			space = typeof space === 'string' ? space : spaceAddition;
 			
 			
-			console.log( ( this.parent ? space + ' octree NODE > ' : ' octree ROOT > ' ), this, ' // id: ', this.id, ' // indexOctant: ', this.indexOctant, ' // position: ', this.position.x, this.position.y, this.position.z, ' // radius: ', this.radius, ' // depth: ', this.depth );
-			console.log( ( this.parent ? space + ' ' : ' ' ), '+ objects ( ', this.objects.length, ' ) ', this.objects );
-			console.log( ( this.parent ? space + ' ' : ' ' ), '+ children ( ', this.nodesIndices.length, ' )', this.nodesIndices, this.nodesByIndex );
+			THREE.log( ( this.parent ? space + ' octree NODE > ' : ' octree ROOT > ' ), this, ' // id: ', this.id, ' // indexOctant: ', this.indexOctant, ' // position: ', this.position.x, this.position.y, this.position.z, ' // radius: ', this.radius, ' // depth: ', this.depth );
+			THREE.log( ( this.parent ? space + ' ' : ' ' ), '+ objects ( ', this.objects.length, ' ) ', this.objects );
+			THREE.log( ( this.parent ? space + ' ' : ' ' ), '+ children ( ', this.nodesIndices.length, ' )', this.nodesIndices, this.nodesByIndex );
 			
 			
 			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 			for ( i = 0, l = this.nodesIndices.length; i < l; i ++ ) {
 				
 				

+ 8 - 5
examples/js/ShaderDeferred.js

@@ -187,7 +187,8 @@ THREE.ShaderDeferred = {
 
 
 				"const float opacity = 1.0;",
 				"const float opacity = 1.0;",
 
 
-				"gl_FragColor = vec4( diffuse, opacity );",
+				"vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
+				"vec4 diffuseColor = vec4( diffuse, opacity );",
 
 
 				THREE.ShaderChunk[ "map_fragment" ],
 				THREE.ShaderChunk[ "map_fragment" ],
 				THREE.ShaderChunk[ "alphatest_fragment" ],
 				THREE.ShaderChunk[ "alphatest_fragment" ],
@@ -195,6 +196,8 @@ THREE.ShaderDeferred = {
 				THREE.ShaderChunk[ "lightmap_fragment" ],
 				THREE.ShaderChunk[ "lightmap_fragment" ],
 				THREE.ShaderChunk[ "color_fragment" ],
 				THREE.ShaderChunk[ "color_fragment" ],
 
 
+				"outgoingLight = diffuseColor.rgb;",
+
 				"#ifdef USE_ENVMAP",
 				"#ifdef USE_ENVMAP",
 
 
 					"vec2 texCoord = gl_FragCoord.xy / vec2( viewWidth, viewHeight );",
 					"vec2 texCoord = gl_FragCoord.xy / vec2( viewWidth, viewHeight );",
@@ -230,15 +233,15 @@ THREE.ShaderDeferred = {
 
 
 					"if ( combine == 1 ) {",
 					"if ( combine == 1 ) {",
 
 
-						"gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );",
+						"outgoingLight = mix( outgoingLight, cubeColor.xyz, specularStrength * reflectivity );",
 
 
 					"} else if ( combine == 2 ) {",
 					"} else if ( combine == 2 ) {",
 
 
-						"gl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;",
+						"outgoingLight += cubeColor.xyz * specularStrength * reflectivity;",
 
 
 					"} else {",
 					"} else {",
 
 
-						"gl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );",
+						"outgoingLight = mix( outgoingLight, diffuseColor.xyz * cubeColor.xyz, specularStrength * reflectivity );",
 
 
 					"}",
 					"}",
 
 
@@ -267,7 +270,7 @@ THREE.ShaderDeferred = {
 
 
 				// diffuse color
 				// diffuse color
 
 
-				"gl_FragColor.x = vec3_to_float( compressionScale * gl_FragColor.xyz );",
+				"gl_FragColor.x = vec3_to_float( compressionScale * outgoingLight );",
 
 
 				// specular color
 				// specular color
 
 

+ 16 - 23
examples/js/SkyShader.js

@@ -1,16 +1,16 @@
 /**
 /**
  * @author zz85 / https://github.com/zz85
  * @author zz85 / https://github.com/zz85
- * 
- * Based on "A Practical Analytic Model for Daylight" 
+ *
+ * Based on "A Practical Analytic Model for Daylight"
  * aka The Preetham Model, the de facto standard analytic skydome model
  * aka The Preetham Model, the de facto standard analytic skydome model
  * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf
  * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf
- * 
+ *
  * First implemented by Simon Wallner
  * First implemented by Simon Wallner
  * http://www.simonwallner.at/projects/atmospheric-scattering
  * http://www.simonwallner.at/projects/atmospheric-scattering
- * 
+ *
  * Improved by Martin Upitis
  * Improved by Martin Upitis
  * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR
  * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR
- * 
+ *
  * Three.js integration by zz85 http://twitter.com/blurspline
  * Three.js integration by zz85 http://twitter.com/blurspline
 */
 */
 
 
@@ -30,13 +30,11 @@ THREE.ShaderLib['sky'] = {
 	vertexShader: [
 	vertexShader: [
 
 
 		"varying vec3 vWorldPosition;",
 		"varying vec3 vWorldPosition;",
-		"varying vec2 vUv;",
 
 
 		"void main() {",
 		"void main() {",
 
 
 			"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
 			"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
 			"vWorldPosition = worldPosition.xyz;",
 			"vWorldPosition = worldPosition.xyz;",
-			"vUv = uv;",
 
 
 			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 
@@ -46,12 +44,9 @@ THREE.ShaderLib['sky'] = {
 
 
 	fragmentShader: [
 	fragmentShader: [
 
 
-
 		"uniform sampler2D skySampler;",
 		"uniform sampler2D skySampler;",
 		"uniform vec3 sunPosition;",
 		"uniform vec3 sunPosition;",
 		"varying vec3 vWorldPosition;",
 		"varying vec3 vWorldPosition;",
-		"varying vec2 vUv;",
-
 
 
 		"vec3 cameraPos = vec3(0., 0., 0.);",
 		"vec3 cameraPos = vec3(0., 0., 0.);",
 		"// uniform sampler2D sDiffuse;",
 		"// uniform sampler2D sDiffuse;",
@@ -67,7 +62,6 @@ THREE.ShaderLib['sky'] = {
 		"uniform float mieCoefficient;",
 		"uniform float mieCoefficient;",
 		"uniform float mieDirectionalG;",
 		"uniform float mieDirectionalG;",
 
 
-
 		"vec3 sunDirection = normalize(sunPosition);",
 		"vec3 sunDirection = normalize(sunPosition);",
 		"float reileighCoefficient = reileigh;",
 		"float reileighCoefficient = reileigh;",
 
 
@@ -165,9 +159,9 @@ THREE.ShaderLib['sky'] = {
 			"// luminance =  1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;",
 			"// luminance =  1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;",
 
 
 			 "// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);",
 			 "// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);",
-			
+
 			"reileighCoefficient = reileighCoefficient - (1.0* (1.0-sunfade));",
 			"reileighCoefficient = reileighCoefficient - (1.0* (1.0-sunfade));",
-			
+
 			"float sunE = sunIntensity(dot(sunDirection, up));",
 			"float sunE = sunIntensity(dot(sunDirection, up));",
 
 
 			"// extinction (absorbtion + out scattering) ",
 			"// extinction (absorbtion + out scattering) ",
@@ -210,7 +204,7 @@ THREE.ShaderLib['sky'] = {
 			"vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);",
 			"vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);",
 			"// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;",
 			"// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;",
 			"vec3 L0 = vec3(0.1) * Fex;",
 			"vec3 L0 = vec3(0.1) * Fex;",
-			
+
 			"// composition + solar disc",
 			"// composition + solar disc",
 			"//if (cosTheta > sunAngularDiameterCos)",
 			"//if (cosTheta > sunAngularDiameterCos)",
 			"float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);",
 			"float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);",
@@ -219,25 +213,25 @@ THREE.ShaderLib['sky'] = {
 
 
 
 
 			"vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));",
 			"vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));",
-			
+
 			"vec3 texColor = (Lin+L0);   ",
 			"vec3 texColor = (Lin+L0);   ",
 			"texColor *= 0.04 ;",
 			"texColor *= 0.04 ;",
 			"texColor += vec3(0.0,0.001,0.0025)*0.3;",
 			"texColor += vec3(0.0,0.001,0.0025)*0.3;",
-			
+
 			"float g_fMaxLuminance = 1.0;",
 			"float g_fMaxLuminance = 1.0;",
 			"float fLumScaled = 0.1 / luminance;     ",
 			"float fLumScaled = 0.1 / luminance;     ",
 			"float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ",
 			"float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ",
 
 
 			"float ExposureBias = fLumCompressed;",
 			"float ExposureBias = fLumCompressed;",
-		   
+
 			"vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);",
 			"vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);",
 			"vec3 color = curr*whiteScale;",
 			"vec3 color = curr*whiteScale;",
 
 
 			"vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));",
 			"vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));",
 
 
-			
+
 			"gl_FragColor.rgb = retColor;",
 			"gl_FragColor.rgb = retColor;",
-				
+
 			"gl_FragColor.a = 1.0;",
 			"gl_FragColor.a = 1.0;",
 		"}",
 		"}",
 
 
@@ -250,9 +244,9 @@ THREE.Sky = function () {
 	var skyShader = THREE.ShaderLib[ "sky" ];
 	var skyShader = THREE.ShaderLib[ "sky" ];
 	var skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );
 	var skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );
 
 
-	var skyMat = new THREE.ShaderMaterial( { 
-		fragmentShader: skyShader.fragmentShader, 
-		vertexShader: skyShader.vertexShader, 
+	var skyMat = new THREE.ShaderMaterial( {
+		fragmentShader: skyShader.fragmentShader,
+		vertexShader: skyShader.vertexShader,
 		uniforms: skyUniforms,
 		uniforms: skyUniforms,
 		side: THREE.BackSide
 		side: THREE.BackSide
 	} );
 	} );
@@ -265,5 +259,4 @@ THREE.Sky = function () {
 	this.mesh = skyMesh;
 	this.mesh = skyMesh;
 	this.uniforms = skyUniforms;
 	this.uniforms = skyUniforms;
 
 
-
 };
 };

+ 1 - 1
examples/js/UCSCharacter.js

@@ -36,7 +36,7 @@ THREE.UCSCharacter = function() {
 		
 		
 		// CHARACTER
 		// CHARACTER
 		var loader = new THREE.JSONLoader();
 		var loader = new THREE.JSONLoader();
-		console.log( config.baseUrl + config.character );
+		THREE.log( config.baseUrl + config.character );
 		loader.load( config.baseUrl + config.character, function( geometry ) {
 		loader.load( config.baseUrl + config.character, function( geometry ) {
 			geometry.computeBoundingBox();
 			geometry.computeBoundingBox();
 			geometry.computeVertexNormals();
 			geometry.computeVertexNormals();

+ 1 - 1
examples/js/WaterShader.js

@@ -142,7 +142,7 @@ THREE.Water = function ( renderer, camera, scene, options ) {
 	else 
 	else 
 	{
 	{
 		this.camera = new THREE.PerspectiveCamera();
 		this.camera = new THREE.PerspectiveCamera();
-		console.log(this.name + ': camera is not a Perspective Camera!')
+		THREE.log(this.name + ': camera is not a Perspective Camera!')
 	}
 	}
 
 
 	this.textureMatrix = new THREE.Matrix4();
 	this.textureMatrix = new THREE.Matrix4();

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

@@ -210,7 +210,7 @@ THREE.FlyControls = function ( object, domElement ) {
 		this.moveVector.y = ( -this.moveState.down    + this.moveState.up );
 		this.moveVector.y = ( -this.moveState.down    + this.moveState.up );
 		this.moveVector.z = ( -forward + this.moveState.back );
 		this.moveVector.z = ( -forward + this.moveState.back );
 
 
-		//console.log( 'move:', [ this.moveVector.x, this.moveVector.y, this.moveVector.z ] );
+		//THREE.log( 'move:', [ this.moveVector.x, this.moveVector.y, this.moveVector.z ] );
 
 
 	};
 	};
 
 
@@ -220,7 +220,7 @@ THREE.FlyControls = function ( object, domElement ) {
 		this.rotationVector.y = ( -this.moveState.yawRight  + this.moveState.yawLeft );
 		this.rotationVector.y = ( -this.moveState.yawRight  + this.moveState.yawLeft );
 		this.rotationVector.z = ( -this.moveState.rollRight + this.moveState.rollLeft );
 		this.rotationVector.z = ( -this.moveState.rollRight + this.moveState.rollLeft );
 
 
-		//console.log( 'rotate:', [ this.rotationVector.x, this.rotationVector.y, this.rotationVector.z ] );
+		//THREE.log( 'rotate:', [ this.rotationVector.x, this.rotationVector.y, this.rotationVector.z ] );
 
 
 	};
 	};
 
 

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

@@ -208,7 +208,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 		} else {
 		} else {
 
 
 			// camera neither orthographic or perspective
 			// camera neither orthographic or perspective
-			console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
+			THREE.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
 
 
 		}
 		}
 
 
@@ -234,7 +234,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 
 		} else {
 		} else {
 
 
-			console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
+			THREE.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
 
 
 		}
 		}
 
 
@@ -260,7 +260,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 
 		} else {
 		} else {
 
 
-			console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
+			THREE.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
 
 
 		}
 		}
 
 

+ 20 - 12
examples/js/controls/VRControls.js

@@ -7,7 +7,8 @@ THREE.VRControls = function ( object, callback ) {
 
 
 	var scope = this;
 	var scope = this;
 
 
-	var vrInput;
+	// Allow for multiple VR input devices.
+	var vrInputs = [];
 
 
 	var onVRDevices = function ( devices ) {
 	var onVRDevices = function ( devices ) {
 
 
@@ -17,8 +18,7 @@ THREE.VRControls = function ( object, callback ) {
 
 
 			if ( device instanceof PositionSensorVRDevice ) {
 			if ( device instanceof PositionSensorVRDevice ) {
 
 
-				vrInput = devices[ i ];
-				return; // We keep the first we encounter
+				vrInputs.push( devices[ i ] );
 
 
 			}
 			}
 
 
@@ -49,19 +49,23 @@ THREE.VRControls = function ( object, callback ) {
 
 
 	this.update = function () {
 	this.update = function () {
 
 
-		if ( vrInput === undefined ) return;
+		for ( var i = 0; i < vrInputs.length; i++ ) {
 
 
-		var state = vrInput.getState();
+			var vrInput = vrInputs[ i ];
 
 
-		if ( state.orientation !== null ) {
+			var state = vrInput.getState();
 
 
-			object.quaternion.copy( state.orientation );
+			if ( state.orientation !== null ) {
 
 
-		}
+				object.quaternion.copy( state.orientation );
+
+			}
+
+			if ( state.position !== null ) {
 
 
-		if ( state.position !== null ) {
+				object.position.copy( state.position ).multiplyScalar( scope.scale );
 
 
-			object.position.copy( state.position ).multiplyScalar( scope.scale );
+			}
 
 
 		}
 		}
 
 
@@ -69,9 +73,13 @@ THREE.VRControls = function ( object, callback ) {
 
 
 	this.zeroSensor = function () {
 	this.zeroSensor = function () {
 
 
-		if ( vrInput === undefined ) return;
+		for ( var i = 0; i < vrInputs.length; i++ ) {
+
+			var vrInput = vrInputs[ i ];
 
 
-		vrInput.zeroSensor();
+			vrInput.zeroSensor();
+
+		}
 
 
 	};
 	};
 
 

+ 2 - 2
examples/js/effects/StereoEffect.js

@@ -22,7 +22,7 @@ THREE.StereoEffect = function ( renderer ) {
 				return scope.eyeSeparation;
 				return scope.eyeSeparation;
 			},
 			},
 			set: function ( value ) {
 			set: function ( value ) {
-				console.warn( 'THREE.StereoEffect: .separation is now .eyeSeparation.' );
+				THREE.warn( 'THREE.StereoEffect: .separation is now .eyeSeparation.' );
 				scope.eyeSeparation = value;
 				scope.eyeSeparation = value;
 			}
 			}
 		},
 		},
@@ -31,7 +31,7 @@ THREE.StereoEffect = function ( renderer ) {
 				return scope.focalLength;
 				return scope.focalLength;
 			},
 			},
 			set: function ( value ) {
 			set: function ( value ) {
-				console.warn( 'THREE.StereoEffect: .targetDistance is now .focalLength.' );
+				THREE.warn( 'THREE.StereoEffect: .targetDistance is now .focalLength.' );
 				scope.focalLength = value;
 				scope.focalLength = value;
 			}
 			}
 		}
 		}

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

@@ -74,16 +74,31 @@ THREE.VREffect = function ( renderer, done ) {
 			return;
 			return;
 		}
 		}
 		// Regular render mode if not HMD
 		// Regular render mode if not HMD
+		if ( scene instanceof Array ) scene = scene[ 0 ];
 		renderer.render.apply( this._renderer, arguments );
 		renderer.render.apply( this._renderer, arguments );
 	};
 	};
 
 
 	this.renderStereo = function( scene, camera, renderTarget, forceClear ) {
 	this.renderStereo = function( scene, camera, renderTarget, forceClear ) {
 
 
+		var sceneLeft, sceneRight;
+
+		if ( scene instanceof Array ) {
+
+			sceneLeft = scene[ 0 ];
+			sceneRight = scene[ 1 ];
+
+		} else {
+
+			sceneLeft = scene;
+			sceneRight = scene;
+
+		}
+
 		var leftEyeTranslation = this.leftEyeTranslation;
 		var leftEyeTranslation = this.leftEyeTranslation;
 		var rightEyeTranslation = this.rightEyeTranslation;
 		var rightEyeTranslation = this.rightEyeTranslation;
 		var renderer = this._renderer;
 		var renderer = this._renderer;
-		var rendererWidth = renderer.context.drawingBufferWidth;
-		var rendererHeight = renderer.context.drawingBufferHeight;
+		var rendererWidth = renderer.context.drawingBufferWidth / renderer.getPixelRatio();
+		var rendererHeight = renderer.context.drawingBufferHeight / renderer.getPixelRatio();
 		var eyeDivisionLine = rendererWidth / 2;
 		var eyeDivisionLine = rendererWidth / 2;
 
 
 		renderer.enableScissorTest( true );
 		renderer.enableScissorTest( true );
@@ -105,12 +120,12 @@ THREE.VREffect = function ( renderer, done ) {
 		// render left eye
 		// render left eye
 		renderer.setViewport( 0, 0, eyeDivisionLine, rendererHeight );
 		renderer.setViewport( 0, 0, eyeDivisionLine, rendererHeight );
 		renderer.setScissor( 0, 0, eyeDivisionLine, rendererHeight );
 		renderer.setScissor( 0, 0, eyeDivisionLine, rendererHeight );
-		renderer.render( scene, cameraLeft );
+		renderer.render( sceneLeft, cameraLeft );
 
 
 		// render right eye
 		// render right eye
 		renderer.setViewport( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight );
 		renderer.setViewport( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight );
 		renderer.setScissor( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight );
 		renderer.setScissor( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight );
-		renderer.render( scene, cameraRight );
+		renderer.render( sceneRight, cameraRight );
 
 
 		renderer.enableScissorTest( false );
 		renderer.enableScissorTest( false );
 
 

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

@@ -137,7 +137,7 @@ THREE.AWDLoader = (function () {
 
 
 				} else {
 				} else {
 
 
-					console.error( 'AWDLoader: Couldn\'t load ' + url + ' (' + xhr.status + ')' );
+					THREE.error( 'AWDLoader: Couldn\'t load ' + url + ' (' + xhr.status + ')' );
 
 
 				}
 				}
 
 
@@ -159,11 +159,11 @@ THREE.AWDLoader = (function () {
 		this._parseHeader( );
 		this._parseHeader( );
 
 
 		if ( this._compression != 0  ) {
 		if ( this._compression != 0  ) {
-			console.error( 'compressed AWD not supported' );
+			THREE.error( 'compressed AWD not supported' );
 		}
 		}
 
 
 		if (!this._streaming && this._bodylen != data.byteLength - this._ptr ) {
 		if (!this._streaming && this._bodylen != data.byteLength - this._ptr ) {
-			console.error('AWDLoader: body len does not match file length', this._bodylen,  blen - this._ptr);
+			THREE.error('AWDLoader: body len does not match file length', this._bodylen,  blen - this._ptr);
 		}
 		}
 
 
 		while ( this._ptr < blen ) {
 		while ( this._ptr < blen ) {
@@ -451,7 +451,7 @@ THREE.AWDLoader = (function () {
 		if (type === 0) {
 		if (type === 0) {
 			data_len = this.readU32();
 			data_len = this.readU32();
 			var url = this.readUTFBytes(data_len);
 			var url = this.readUTFBytes(data_len);
-			console.log( url );
+			THREE.log( url );
 
 
 			asset = this.loadTexture( url );
 			asset = this.loadTexture( url );
 		} else {
 		} else {
@@ -883,7 +883,7 @@ THREE.AWDLoader = (function () {
 		var mesh = this.getBlock( geoAdress );
 		var mesh = this.getBlock( geoAdress );
 
 
 		if (mesh == null) {
 		if (mesh == null) {
-			console.log( "parseMeshPoseAnimation target mesh not found at:", geoAdress );
+			THREE.log( "parseMeshPoseAnimation target mesh not found at:", geoAdress );
 			return;
 			return;
 		}
 		}
 
 

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

@@ -67,7 +67,7 @@ THREE.BabylonLoader.prototype = {
 
 
 				var data = json.multiMaterials[ i ];
 				var data = json.multiMaterials[ i ];
 
 
-				console.warn( 'THREE.BabylonLoader: Multi materials not yet supported.' );
+				THREE.warn( 'THREE.BabylonLoader: Multi materials not yet supported.' );
 
 
 				materials[ data.id ] = new THREE.MeshPhongMaterial();
 				materials[ data.id ] = new THREE.MeshPhongMaterial();
 
 

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

@@ -54,7 +54,7 @@ THREE.BinaryLoader.prototype.loadAjaxJSON = function ( context, url, callback, t
 
 
 			} else {
 			} else {
 
 
-				console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
+				THREE.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 
 			}
 			}
 
 
@@ -119,7 +119,7 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers = function ( json, callback, binary
 
 
 	xhr.addEventListener( 'error', function ( event ) {
 	xhr.addEventListener( 'error', function ( event ) {
 
 
-		console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
+		THREE.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 
 	}, false );
 	}, false );
 
 
@@ -251,31 +251,31 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 
 			};
 			};
 /*
 /*
-			console.log( "signature: " + metaData.signature );
+			THREE.log( "signature: " + metaData.signature );
 
 
-			console.log( "header_bytes: " + metaData.header_bytes );
-			console.log( "vertex_coordinate_bytes: " + metaData.vertex_coordinate_bytes );
-			console.log( "normal_coordinate_bytes: " + metaData.normal_coordinate_bytes );
-			console.log( "uv_coordinate_bytes: " + metaData.uv_coordinate_bytes );
+			THREE.log( "header_bytes: " + metaData.header_bytes );
+			THREE.log( "vertex_coordinate_bytes: " + metaData.vertex_coordinate_bytes );
+			THREE.log( "normal_coordinate_bytes: " + metaData.normal_coordinate_bytes );
+			THREE.log( "uv_coordinate_bytes: " + metaData.uv_coordinate_bytes );
 
 
-			console.log( "vertex_index_bytes: " + metaData.vertex_index_bytes );
-			console.log( "normal_index_bytes: " + metaData.normal_index_bytes );
-			console.log( "uv_index_bytes: " + metaData.uv_index_bytes );
-			console.log( "material_index_bytes: " + metaData.material_index_bytes );
+			THREE.log( "vertex_index_bytes: " + metaData.vertex_index_bytes );
+			THREE.log( "normal_index_bytes: " + metaData.normal_index_bytes );
+			THREE.log( "uv_index_bytes: " + metaData.uv_index_bytes );
+			THREE.log( "material_index_bytes: " + metaData.material_index_bytes );
 
 
-			console.log( "nvertices: " + metaData.nvertices );
-			console.log( "nnormals: " + metaData.nnormals );
-			console.log( "nuvs: " + metaData.nuvs );
+			THREE.log( "nvertices: " + metaData.nvertices );
+			THREE.log( "nnormals: " + metaData.nnormals );
+			THREE.log( "nuvs: " + metaData.nuvs );
 
 
-			console.log( "ntri_flat: " + metaData.ntri_flat );
-			console.log( "ntri_smooth: " + metaData.ntri_smooth );
-			console.log( "ntri_flat_uv: " + metaData.ntri_flat_uv );
-			console.log( "ntri_smooth_uv: " + metaData.ntri_smooth_uv );
+			THREE.log( "ntri_flat: " + metaData.ntri_flat );
+			THREE.log( "ntri_smooth: " + metaData.ntri_smooth );
+			THREE.log( "ntri_flat_uv: " + metaData.ntri_flat_uv );
+			THREE.log( "ntri_smooth_uv: " + metaData.ntri_smooth_uv );
 
 
-			console.log( "nquad_flat: " + metaData.nquad_flat );
-			console.log( "nquad_smooth: " + metaData.nquad_smooth );
-			console.log( "nquad_flat_uv: " + metaData.nquad_flat_uv );
-			console.log( "nquad_smooth_uv: " + metaData.nquad_smooth_uv );
+			THREE.log( "nquad_flat: " + metaData.nquad_flat );
+			THREE.log( "nquad_smooth: " + metaData.nquad_smooth );
+			THREE.log( "nquad_flat_uv: " + metaData.nquad_flat_uv );
+			THREE.log( "nquad_smooth_uv: " + metaData.nquad_smooth_uv );
 
 
 			var total = metaData.header_bytes
 			var total = metaData.header_bytes
 					  + metaData.nvertices * metaData.vertex_coordinate_bytes * 3
 					  + metaData.nvertices * metaData.vertex_coordinate_bytes * 3
@@ -289,7 +289,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 					  + metaData.nquad_smooth * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 )
 					  + metaData.nquad_smooth * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 )
 					  + metaData.nquad_flat_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.uv_index_bytes*4 )
 					  + metaData.nquad_flat_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.uv_index_bytes*4 )
 					  + metaData.nquad_smooth_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 + metaData.uv_index_bytes*4 );
 					  + metaData.nquad_smooth_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 + metaData.uv_index_bytes*4 );
-			console.log( "total bytes: " + total );
+			THREE.log( "total bytes: " + total );
 */
 */
 
 
 			return metaData;
 			return metaData;

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

@@ -91,7 +91,7 @@ THREE.ColladaLoader = function () {
 
 
 							} else {
 							} else {
 
 
-								console.error( "ColladaLoader: Empty or non-existing file (" + url + ")" );
+								THREE.error( "ColladaLoader: Empty or non-existing file (" + url + ")" );
 
 
 							}
 							}
 
 
@@ -412,7 +412,7 @@ THREE.ColladaLoader = function () {
 
 
 		if ( !morphCtrl || !morphCtrl.morph ) {
 		if ( !morphCtrl || !morphCtrl.morph ) {
 
 
-			console.log("could not find morph controller!");
+			THREE.log("could not find morph controller!");
 			return;
 			return;
 
 
 		}
 		}
@@ -450,14 +450,14 @@ THREE.ColladaLoader = function () {
 
 
 		if ( !skinCtrl || !skinCtrl.skin ) {
 		if ( !skinCtrl || !skinCtrl.skin ) {
 
 
-			console.log( "could not find skin controller!" );
+			THREE.log( "could not find skin controller!" );
 			return;
 			return;
 
 
 		}
 		}
 
 
 		if ( !ctrl.skeleton || !ctrl.skeleton.length ) {
 		if ( !ctrl.skeleton || !ctrl.skeleton.length ) {
 
 
-			console.log( "could not find the skeleton for the skin!" );
+			THREE.log( "could not find the skeleton for the skin!" );
 			return;
 			return;
 
 
 		}
 		}
@@ -587,7 +587,7 @@ THREE.ColladaLoader = function () {
 
 
 			} else {
 			} else {
 
 
-				console.warn( "ColladaLoader: Could not find joint '" + bone.sid + "'." );
+				THREE.warn( "ColladaLoader: Could not find joint '" + bone.sid + "'." );
 
 
 				bone.skinningMatrix = new THREE.Matrix4();
 				bone.skinningMatrix = new THREE.Matrix4();
 				bone.weights = [];
 				bone.weights = [];
@@ -686,14 +686,14 @@ THREE.ColladaLoader = function () {
 
 
 		if ( !skinController || !skinController.skin ) {
 		if ( !skinController || !skinController.skin ) {
 
 
-			console.log( 'ColladaLoader: Could not find skin controller.' );
+			THREE.log( 'ColladaLoader: Could not find skin controller.' );
 			return;
 			return;
 
 
 		}
 		}
 
 
 		if ( !instanceCtrl.skeleton || !instanceCtrl.skeleton.length ) {
 		if ( !instanceCtrl.skeleton || !instanceCtrl.skeleton.length ) {
 
 
-			console.log( 'ColladaLoader: Could not find the skeleton for the skin. ' );
+			THREE.log( 'ColladaLoader: Could not find the skeleton for the skin. ' );
 			return;
 			return;
 
 
 		}
 		}
@@ -776,7 +776,7 @@ THREE.ColladaLoader = function () {
 
 
 		}
 		}
 
 
-		console.log( 'ColladaLoader:', animationBounds.ID + ' has ' + sortedbones.length + ' bones.' );
+		THREE.log( 'ColladaLoader:', animationBounds.ID + ' has ' + sortedbones.length + ' bones.' );
 
 
 
 
 
 
@@ -874,7 +874,7 @@ THREE.ColladaLoader = function () {
 
 
 				} else {
 				} else {
 
 
-					console.log( 'getJointValue: joint ' + jointIndex + ' doesn\'t exist' );
+					THREE.log( 'getJointValue: joint ' + jointIndex + ' doesn\'t exist' );
 
 
 				}
 				}
 
 
@@ -890,11 +890,11 @@ THREE.ColladaLoader = function () {
 
 
 					if ( value > joint.limits.max || value < joint.limits.min ) {
 					if ( value > joint.limits.max || value < joint.limits.min ) {
 
 
-						console.log( 'setJointValue: joint ' + jointIndex + ' value ' + value + ' outside of limits (min: ' + joint.limits.min + ', max: ' + joint.limits.max + ')' );
+						THREE.log( 'setJointValue: joint ' + jointIndex + ' value ' + value + ' outside of limits (min: ' + joint.limits.min + ', max: ' + joint.limits.max + ')' );
 
 
 					} else if ( joint.static ) {
 					} else if ( joint.static ) {
 
 
-						console.log( 'setJointValue: joint ' + jointIndex + ' is static' );
+						THREE.log( 'setJointValue: joint ' + jointIndex + ' is static' );
 
 
 					} else {
 					} else {
 
 
@@ -926,7 +926,7 @@ THREE.ColladaLoader = function () {
 
 
 									default:
 									default:
 
 
-										console.warn( 'setJointValue: unknown joint type: ' + joint.type );
+										THREE.warn( 'setJointValue: unknown joint type: ' + joint.type );
 										break;
 										break;
 
 
 								}
 								}
@@ -988,7 +988,7 @@ THREE.ColladaLoader = function () {
 
 
 				} else {
 				} else {
 
 
-					console.log( 'setJointValue: joint ' + jointIndex + ' doesn\'t exist' );
+					THREE.log( 'setJointValue: joint ' + jointIndex + ' doesn\'t exist' );
 
 
 				}
 				}
 
 
@@ -1100,7 +1100,7 @@ THREE.ColladaLoader = function () {
 
 
 					}
 					}
 
 
-					console.log( 'ColladaLoader: Morph-controller partially supported.' );
+					THREE.log( 'ColladaLoader: Morph-controller partially supported.' );
 
 
 				default:
 				default:
 					break;
 					break;
@@ -1460,7 +1460,7 @@ THREE.ColladaLoader = function () {
 					if ( sampler.input[ j + 1 ] > t ) {
 					if ( sampler.input[ j + 1 ] > t ) {
 
 
 						value = sampler.output[ j ];
 						value = sampler.output[ j ];
-						//console.log(value.flatten)
+						//THREE.log(value.flatten)
 						break;
 						break;
 
 
 					}
 					}
@@ -1559,7 +1559,7 @@ THREE.ColladaLoader = function () {
 
 
 				} else {
 				} else {
 
 
-					console.log( 'Could not find transform "' + channel.sid + '" in node ' + node.id );
+					THREE.log( 'Could not find transform "' + channel.sid + '" in node ' + node.id );
 
 
 				}
 				}
 
 
@@ -1825,7 +1825,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -1935,7 +1935,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -2346,7 +2346,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -2420,7 +2420,7 @@ THREE.ColladaLoader = function () {
 				break;
 				break;
 
 
 			default:
 			default:
-				console.log( 'Can not convert Transform of type ' + this.type );
+				THREE.log( 'Can not convert Transform of type ' + this.type );
 				break;
 				break;
 
 
 		}
 		}
@@ -2526,7 +2526,7 @@ THREE.ColladaLoader = function () {
 
 
 				} else {
 				} else {
 
 
-					console.log('Incorrect addressing of matrix in transform.');
+					THREE.log('Incorrect addressing of matrix in transform.');
 
 
 				}
 				}
 
 
@@ -2746,7 +2746,7 @@ THREE.ColladaLoader = function () {
 
 
 				case 'extra':
 				case 'extra':
 
 
-					// console.log( child );
+					// THREE.log( child );
 					break;
 					break;
 
 
 				default:
 				default:
@@ -3103,7 +3103,7 @@ THREE.ColladaLoader = function () {
 
 
 				} else {
 				} else {
 
 
-					console.log( 'dropped face with vcount ' + vcount + ' for geometry with id: ' + geom.id );
+					THREE.log( 'dropped face with vcount ' + vcount + ' for geometry with id: ' + geom.id );
 
 
 				}
 				}
 
 
@@ -3168,7 +3168,7 @@ THREE.ColladaLoader = function () {
 
 
 				case 'ph':
 				case 'ph':
 
 
-					console.warn( 'polygon holes not yet supported!' );
+					THREE.warn( 'polygon holes not yet supported!' );
 					break;
 					break;
 
 
 				default:
 				default:
@@ -3357,7 +3357,7 @@ THREE.ColladaLoader = function () {
 					break;
 					break;
 
 
 				default:
 				default:
-					// console.log(child.nodeName);
+					// THREE.log(child.nodeName);
 					break;
 					break;
 
 
 			}
 			}
@@ -3376,7 +3376,7 @@ THREE.ColladaLoader = function () {
 
 
 		var param = this.accessor.params[ 0 ];
 		var param = this.accessor.params[ 0 ];
 
 
-			//console.log(param.name + " " + param.type);
+			//THREE.log(param.name + " " + param.type);
 
 
 		switch ( param.type ) {
 		switch ( param.type ) {
 
 
@@ -3399,7 +3399,7 @@ THREE.ColladaLoader = function () {
 
 
 			default:
 			default:
 
 
-				console.log( 'ColladaLoader: Source: Read dont know how to read ' + param.type + '.' );
+				THREE.log( 'ColladaLoader: Source: Read dont know how to read ' + param.type + '.' );
 				break;
 				break;
 
 
 		}
 		}
@@ -3613,11 +3613,11 @@ THREE.ColladaLoader = function () {
 						} else if ( bumpType.toLowerCase() === "normalmap" ) {
 						} else if ( bumpType.toLowerCase() === "normalmap" ) {
 							this[ 'normal' ] = ( new ColorOrTexture() ).parse( child );
 							this[ 'normal' ] = ( new ColorOrTexture() ).parse( child );
 						} else {
 						} else {
-							console.error( "Shader.prototype.parse: Invalid value for attribute 'bumptype' (" + bumpType + ") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'" );
+							THREE.error( "Shader.prototype.parse: Invalid value for attribute 'bumptype' (" + bumpType + ") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'" );
 							this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
 							this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
 						}
 						}
 					} else {
 					} else {
-						console.warn( "Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'" );
+						THREE.warn( "Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'" );
 						this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
 						this[ 'bump' ] = ( new ColorOrTexture() ).parse( child );
 					}
 					}
 
 
@@ -3847,7 +3847,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( "unhandled Surface prop: " + child.nodeName );
+					THREE.log( "unhandled Surface prop: " + child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -3911,7 +3911,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( "unhandled Sampler2D prop: " + child.nodeName );
+					THREE.log( "unhandled Sampler2D prop: " + child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -4001,7 +4001,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -4048,7 +4048,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 					break;
 
 
 			}
 			}
@@ -4350,7 +4350,7 @@ THREE.ColladaLoader = function () {
 
 
 				default:
 				default:
 
 
-					console.log(input.semantic);
+					THREE.log(input.semantic);
 					break;
 					break;
 
 
 			}
 			}

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

@@ -126,14 +126,14 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 
 
 	if ( header[ off_magic ] !== DDS_MAGIC ) {
 	if ( header[ off_magic ] !== DDS_MAGIC ) {
 
 
-		console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' );
+		THREE.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' );
 		return dds;
 		return dds;
 
 
 	}
 	}
 
 
 	if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) {
 	if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) {
 
 
-		console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' );
+		THREE.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' );
 		return dds;
 		return dds;
 
 
 	}
 	}
@@ -175,7 +175,7 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 				blockBytes = 64;
 				blockBytes = 64;
 				dds.format = THREE.RGBAFormat;
 				dds.format = THREE.RGBAFormat;
 			} else {
 			} else {
-				console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) );
+				THREE.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) );
 				return dds;
 				return dds;
 			}
 			}
 	}
 	}

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

@@ -328,7 +328,7 @@ THREE.OBJLoader.prototype = {
 
 
 			} else {
 			} else {
 
 
-				// console.log( "THREE.OBJLoader: Unhandled line " + line );
+				// THREE.log( "THREE.OBJLoader: Unhandled line " + line );
 
 
 			}
 			}
 
 

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

@@ -347,7 +347,7 @@ THREE.OBJMTLLoader.prototype = {
 
 
 			} else {
 			} else {
 
 
-				console.log( "THREE.OBJMTLLoader: Unhandled line " + line );
+				THREE.log( "THREE.OBJMTLLoader: Unhandled line " + line );
 
 
 			}
 			}
 
 

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

@@ -209,7 +209,7 @@ THREE.PLYLoader.prototype = {
 
 
 			default:
 			default:
 
 
-				console.log("unhandled", lineType, lineValues);
+				THREE.log("unhandled", lineType, lineValues);
 
 
 			}
 			}
 
 

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

@@ -164,21 +164,21 @@ THREE.PVRLoader._extract = function ( pvrDatas ) {
 
 
 
 
 
 
-	// console.log( "--------------------------" );
-
-	// console.log( "headerLength ", headerLength);
-	// console.log( "height       ", height      );
-	// console.log( "width        ", width       );
-	// console.log( "numMipmaps   ", numMipmaps  );
-	// console.log( "flags        ", flags       );
-	// console.log( "dataLength   ", dataLength  );
-	// console.log( "bpp          ", bpp         );
-	// console.log( "bitmaskRed   ", bitmaskRed  );
-	// console.log( "bitmaskGreen ", bitmaskGreen);
-	// console.log( "bitmaskBlue  ", bitmaskBlue );
-	// console.log( "bitmaskAlpha ", bitmaskAlpha);
-	// console.log( "pvrTag       ", pvrTag      );
-	// console.log( "numSurfs     ", numSurfs    );
+	// THREE.log( "--------------------------" );
+
+	// THREE.log( "headerLength ", headerLength);
+	// THREE.log( "height       ", height      );
+	// THREE.log( "width        ", width       );
+	// THREE.log( "numMipmaps   ", numMipmaps  );
+	// THREE.log( "flags        ", flags       );
+	// THREE.log( "dataLength   ", dataLength  );
+	// THREE.log( "bpp          ", bpp         );
+	// THREE.log( "bitmaskRed   ", bitmaskRed  );
+	// THREE.log( "bitmaskGreen ", bitmaskGreen);
+	// THREE.log( "bitmaskBlue  ", bitmaskBlue );
+	// THREE.log( "bitmaskAlpha ", bitmaskAlpha);
+	// THREE.log( "pvrTag       ", pvrTag      );
+	// THREE.log( "numSurfs     ", numSurfs    );
 
 
 
 
 
 

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

@@ -29,14 +29,14 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 		rgbe_memory_error   = 4,
 		rgbe_memory_error   = 4,
 		rgbe_error = function(rgbe_error_code, msg) {
 		rgbe_error = function(rgbe_error_code, msg) {
 			switch (rgbe_error_code) {
 			switch (rgbe_error_code) {
-				case rgbe_read_error: console.error("THREE.RGBELoader Read Error: " + (msg||''));
+				case rgbe_read_error: THREE.error("THREE.RGBELoader Read Error: " + (msg||''));
 					break;
 					break;
-				case rgbe_write_error: console.error("THREE.RGBELoader Write Error: " + (msg||''));
+				case rgbe_write_error: THREE.error("THREE.RGBELoader Write Error: " + (msg||''));
 					break;
 					break;
-				case rgbe_format_error:  console.error("THREE.RGBELoader Bad File Format: " + (msg||''));
+				case rgbe_format_error:  THREE.error("THREE.RGBELoader Bad File Format: " + (msg||''));
 					break;
 					break;
 				default:
 				default:
-				case rgbe_memory_error:  console.error("THREE.RGBELoader: Error: " + (msg||''));
+				case rgbe_memory_error:  THREE.error("THREE.RGBELoader: Error: " + (msg||''));
 			}
 			}
 			return RGBE_RETURN_FAILURE;
 			return RGBE_RETURN_FAILURE;
 		},
 		},

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

@@ -33,7 +33,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 
 
 
 	if ( buffer.length < 19 )
 	if ( buffer.length < 19 )
-		console.error( 'THREE.TGALoader.parse: Not enough data to contain header.' );
+		THREE.error( 'THREE.TGALoader.parse: Not enough data to contain header.' );
 
 
 	var content = new Uint8Array( buffer ),
 	var content = new Uint8Array( buffer ),
 		offset = 0,
 		offset = 0,
@@ -63,7 +63,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			case TGA_TYPE_INDEXED:
 			case TGA_TYPE_INDEXED:
 			case TGA_TYPE_RLE_INDEXED:
 			case TGA_TYPE_RLE_INDEXED:
 				if ( header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1) {
 				if ( header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1) {
-					console.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type colormap data for indexed type');
+					THREE.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type colormap data for indexed type');
 				}
 				}
 				break;
 				break;
 
 
@@ -73,23 +73,23 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			case TGA_TYPE_RLE_RGB:
 			case TGA_TYPE_RLE_RGB:
 			case TGA_TYPE_RLE_GREY:
 			case TGA_TYPE_RLE_GREY:
 				if (header.colormap_type) {
 				if (header.colormap_type) {
-					console.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type colormap data for colormap type');
+					THREE.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type colormap data for colormap type');
 				}
 				}
 				break;
 				break;
 
 
 			// What the need of a file without data ?
 			// What the need of a file without data ?
 			case TGA_TYPE_NO_DATA:
 			case TGA_TYPE_NO_DATA:
-				console.error('THREE.TGALoader.parse.tgaCheckHeader: No data');
+				THREE.error('THREE.TGALoader.parse.tgaCheckHeader: No data');
 
 
 			// Invalid type ?
 			// Invalid type ?
 			default:
 			default:
-				console.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type " ' + header.image_type + '"');
+				THREE.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid type " ' + header.image_type + '"');
 
 
 		}
 		}
 
 
 		// Check image width and height
 		// Check image width and height
 		if ( header.width <= 0 || header.height <= 0 ) {
 		if ( header.width <= 0 || header.height <= 0 ) {
-			console.error( 'THREE.TGALoader.parse.tgaCheckHeader: Invalid image size' );
+			THREE.error( 'THREE.TGALoader.parse.tgaCheckHeader: Invalid image size' );
 		}
 		}
 
 
 		// Check image pixel size
 		// Check image pixel size
@@ -97,7 +97,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			header.pixel_size !== 16 &&
 			header.pixel_size !== 16 &&
 			header.pixel_size !== 24 &&
 			header.pixel_size !== 24 &&
 			header.pixel_size !== 32) {
 			header.pixel_size !== 32) {
-			console.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid pixel size "' + header.pixel_size + '"');
+			THREE.error('THREE.TGALoader.parse.tgaCheckHeader: Invalid pixel size "' + header.pixel_size + '"');
 		}
 		}
 
 
 	}
 	}
@@ -106,7 +106,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 	tgaCheckHeader( header );
 	tgaCheckHeader( header );
 
 
 	if ( header.id_length + offset > buffer.length ) {
 	if ( header.id_length + offset > buffer.length ) {
-		console.error('THREE.TGALoader.parse: No data');
+		THREE.error('THREE.TGALoader.parse: No data');
 	}
 	}
 
 
 	// Skip the needn't data
 	// Skip the needn't data
@@ -382,7 +382,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 					tgaGetImageDataGrey16bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image );
 					tgaGetImageDataGrey16bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image );
 					break;
 					break;
 				default:
 				default:
-					console.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
+					THREE.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
 					break;
 					break;
 			}
 			}
 
 
@@ -406,7 +406,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 					break;
 					break;
 
 
 				default:
 				default:
-					console.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
+					THREE.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
 					break;
 					break;
 			}
 			}
 
 

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

@@ -58,7 +58,7 @@ THREE.VRMLLoader.prototype = {
 
 
 		var parseV1 = function ( lines, scene ) {
 		var parseV1 = function ( lines, scene ) {
 
 
-			console.warn( 'VRML V1.0 not supported yet' );
+			THREE.warn( 'VRML V1.0 not supported yet' );
 
 
 		};
 		};
 
 
@@ -349,7 +349,7 @@ THREE.VRMLLoader.prototype = {
 						case 'color':
 						case 'color':
 
 
 							if (parts.length != 4) {
 							if (parts.length != 4) {
-								console.warn('Invalid color format detected for ' + fieldName );
+								THREE.warn('Invalid color format detected for ' + fieldName );
 								break;
 								break;
 							}
 							}
 
 
@@ -365,7 +365,7 @@ THREE.VRMLLoader.prototype = {
 						case 'scale':
 						case 'scale':
 						case 'size':
 						case 'size':
 							if (parts.length != 4) {
 							if (parts.length != 4) {
-								console.warn('Invalid vector format detected for ' + fieldName);
+								THREE.warn('Invalid vector format detected for ' + fieldName);
 								break;
 								break;
 							}
 							}
 
 
@@ -385,7 +385,7 @@ THREE.VRMLLoader.prototype = {
 						case 'shininess':
 						case 'shininess':
 						case 'ambientIntensity':
 						case 'ambientIntensity':
 							if (parts.length != 2) {
 							if (parts.length != 2) {
-								console.warn('Invalid single float value specification detected for ' + fieldName);
+								THREE.warn('Invalid single float value specification detected for ' + fieldName);
 								break;
 								break;
 							}
 							}
 
 
@@ -395,7 +395,7 @@ THREE.VRMLLoader.prototype = {
 
 
 						case 'rotation':
 						case 'rotation':
 							if (parts.length != 5) {
 							if (parts.length != 5) {
-								console.warn('Invalid quaternion format detected for ' + fieldName);
+								THREE.warn('Invalid quaternion format detected for ' + fieldName);
 								break;
 								break;
 							}
 							}
 
 
@@ -413,7 +413,7 @@ THREE.VRMLLoader.prototype = {
 						case 'colorPerVertex':
 						case 'colorPerVertex':
 						case 'convex':
 						case 'convex':
 							if (parts.length != 2) {
 							if (parts.length != 2) {
-								console.warn('Invalid format detected for ' + fieldName);
+								THREE.warn('Invalid format detected for ' + fieldName);
 								break;
 								break;
 							}
 							}
 
 
@@ -502,7 +502,7 @@ THREE.VRMLLoader.prototype = {
 
 
 			var parseNode = function ( data, parent ) {
 			var parseNode = function ( data, parent ) {
 
 
-				// console.log( data );
+				// THREE.log( data );
 
 
 				if ( typeof data === 'string' ) {
 				if ( typeof data === 'string' ) {
 
 
@@ -511,7 +511,7 @@ THREE.VRMLLoader.prototype = {
 						var defineKey = /USE\s+?(\w+)/.exec( data )[ 1 ];
 						var defineKey = /USE\s+?(\w+)/.exec( data )[ 1 ];
 
 
 						if (undefined == defines[defineKey]) {
 						if (undefined == defines[defineKey]) {
-							console.warn(defineKey + ' is not defined.');
+							THREE.warn(defineKey + ' is not defined.');
 						} else {
 						} else {
 
 
 							if ( /appearance/.exec( data ) && defineKey ) {
 							if ( /appearance/.exec( data ) && defineKey ) {

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

@@ -121,12 +121,12 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 							var ctmFile = files[ i ];
 							var ctmFile = files[ i ];
 
 
 							var e1 = Date.now();
 							var e1 = Date.now();
-							// console.log( "CTM data parse time [worker]: " + (e1-s) + " ms" );
+							// THREE.log( "CTM data parse time [worker]: " + (e1-s) + " ms" );
 
 
 							scope.createModel( ctmFile, callback );
 							scope.createModel( ctmFile, callback );
 
 
 							var e = Date.now();
 							var e = Date.now();
-							console.log( "model load time [worker]: " + (e - e1) + " ms, total: " + (e - s));
+							THREE.log( "model load time [worker]: " + (e - e1) + " ms, total: " + (e - s));
 
 
 						}
 						}
 
 
@@ -149,13 +149,13 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 					}
 					}
 
 
 					//var e = Date.now();
 					//var e = Date.now();
-					//console.log( "CTM data parse time [inline]: " + (e-s) + " ms" );
+					//THREE.log( "CTM data parse time [inline]: " + (e-s) + " ms" );
 
 
 				}
 				}
 
 
 			} else {
 			} else {
 
 
-				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
+				THREE.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 
 			}
 			}
 
 

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

@@ -127,7 +127,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
 	IndicesDelegate.prototype.handleError = function(errorCode, info) {
 	IndicesDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
         // FIXME: report error
-		console.log("ERROR(IndicesDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(IndicesDelegate):" + errorCode + ":" + info);
 	};
 	};
 
 
 	IndicesDelegate.prototype.convert = function(resource, ctx) {
 	IndicesDelegate.prototype.convert = function(resource, ctx) {
@@ -153,7 +153,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
 	VertexAttributeDelegate.prototype.handleError = function(errorCode, info) {
 	VertexAttributeDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
         // FIXME: report error
-		console.log("ERROR(VertexAttributeDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(VertexAttributeDelegate):" + errorCode + ":" + info);
 	};
 	};
 
 
 	VertexAttributeDelegate.prototype.convert = function(resource, ctx) {
 	VertexAttributeDelegate.prototype.convert = function(resource, ctx) {
@@ -325,7 +325,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
 	AnimationParameterDelegate.prototype.handleError = function(errorCode, info) {
 	AnimationParameterDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
         // FIXME: report error
-		console.log("ERROR(AnimationParameterDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(AnimationParameterDelegate):" + errorCode + ":" + info);
 	};
 	};
 
 
 	AnimationParameterDelegate.prototype.convert = function(resource, ctx) {
 	AnimationParameterDelegate.prototype.convert = function(resource, ctx) {
@@ -397,7 +397,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
 	InverseBindMatricesDelegate.prototype.handleError = function(errorCode, info) {
 	InverseBindMatricesDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
         // FIXME: report error
-		console.log("ERROR(InverseBindMatricesDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(InverseBindMatricesDelegate):" + errorCode + ":" + info);
 	};
 	};
 
 
 	InverseBindMatricesDelegate.prototype.convert = function(resource, ctx) {
 	InverseBindMatricesDelegate.prototype.convert = function(resource, ctx) {
@@ -433,7 +433,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
 	ShaderDelegate.prototype.handleError = function(errorCode, info) {
 	ShaderDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
         // FIXME: report error
-		console.log("ERROR(ShaderDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(ShaderDelegate):" + errorCode + ":" + info);
 	};
 	};
 
 
 	ShaderDelegate.prototype.convert = function(resource, ctx) {
 	ShaderDelegate.prototype.convert = function(resource, ctx) {
@@ -467,12 +467,12 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 
 	Resources.prototype.setEntry = function(entryID, object, description) {
 	Resources.prototype.setEntry = function(entryID, object, description) {
 		if (!entryID) {
 		if (!entryID) {
-			console.error("No EntryID provided, cannot store", description);
+			THREE.error("No EntryID provided, cannot store", description);
 			return;
 			return;
 		}
 		}
 
 
 		if (this._entries[entryID]) {
 		if (this._entries[entryID]) {
-			console.warn("entry[" + entryID + "] is being overwritten");
+			THREE.warn("entry[" + entryID + "] is being overwritten");
 		}
 		}
     
     
 		this._entries[entryID] = new ResourceEntry(entryID, object, description );
 		this._entries[entryID] = new ResourceEntry(entryID, object, description );
@@ -588,13 +588,13 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         		
         		
 	var fragmentShader = theLoader.shaders[material.params.fragmentShader];
 	var fragmentShader = theLoader.shaders[material.params.fragmentShader];
 	if (!fragmentShader) {
 	if (!fragmentShader) {
-		console.log("ERROR: Missing fragment shader definition:", material.params.fragmentShader);
+		THREE.log("ERROR: Missing fragment shader definition:", material.params.fragmentShader);
 		return new THREE.MeshPhongMaterial;
 		return new THREE.MeshPhongMaterial;
 	}
 	}
         		
         		
 	var vertexShader = theLoader.shaders[material.params.vertexShader];
 	var vertexShader = theLoader.shaders[material.params.vertexShader];
 	if (!fragmentShader) {
 	if (!fragmentShader) {
-		console.log("ERROR: Missing vertex shader definition:", material.params.vertexShader);
+		THREE.log("ERROR: Missing vertex shader definition:", material.params.vertexShader);
 		return new THREE.MeshPhongMaterial;
 		return new THREE.MeshPhongMaterial;
 	}
 	}
         		
         		
@@ -825,7 +825,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	var primitivesDescription = description.primitives;
 	var primitivesDescription = description.primitives;
 	if (!primitivesDescription) {
 	if (!primitivesDescription) {
                     //FIXME: not implemented in delegate
                     //FIXME: not implemented in delegate
-		console.log("MISSING_PRIMITIVES for mesh:" + entryID);
+		THREE.log("MISSING_PRIMITIVES for mesh:" + entryID);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -1204,7 +1204,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 									boneInverses.push(mat);
 									boneInverses.push(mat);
         	                                    
         	                                    
 								} else {
 								} else {
-									console.log("WARNING: jointId:" + jointId + " cannot be found in skeleton:" + skeleton);
+									THREE.log("WARNING: jointId:" + jointId + " cannot be found in skeleton:" + skeleton);
 								}
 								}
 							}
 							}
 
 
@@ -1253,7 +1253,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
             value: function(entryID, description, userInfo) {
             value: function(entryID, description, userInfo) {
 
 
 	if (!description.nodes) {
 	if (!description.nodes) {
-		console.log("ERROR: invalid file required nodes property is missing from scene");
+		THREE.log("ERROR: invalid file required nodes property is missing from scene");
 		return false;
 		return false;
 	}
 	}
 
 
@@ -1294,9 +1294,9 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	for (var name in this.nodeAnimationChannels) {
 	for (var name in this.nodeAnimationChannels) {
 		var nodeAnimationChannels = this.nodeAnimationChannels[name];
 		var nodeAnimationChannels = this.nodeAnimationChannels[name];
 		var i, len = nodeAnimationChannels.length;
 		var i, len = nodeAnimationChannels.length;
-        			//console.log(" animation channels for node " + name);
+        			//THREE.log(" animation channels for node " + name);
         			//for (i = 0; i < len; i++) {
         			//for (i = 0; i < len; i++) {
-        			//	console.log(nodeAnimationChannels[i]);
+        			//	THREE.log(nodeAnimationChannels[i]);
         			//}
         			//}
 		var anim = new THREE.glTFAnimation(nodeAnimationChannels);
 		var anim = new THREE.glTFAnimation(nodeAnimationChannels);
 		anim.name = "animation_" + name;
 		anim.name = "animation_" + name;
@@ -1372,7 +1372,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	            var parameters = description.parameters;
 	            var parameters = description.parameters;
 	            if (!parameters) {
 	            if (!parameters) {
 	                //FIXME: not implemented in delegate
 	                //FIXME: not implemented in delegate
-		console.log("MISSING_PARAMETERS for animation:" + entryID);
+		THREE.log("MISSING_PARAMETERS for animation:" + entryID);
 		return false;
 		return false;
 	            }
 	            }
 	
 	

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

@@ -43,12 +43,12 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
         enumerable: false,
         enumerable: false,
         value: function(resourceID, resource) {
         value: function(resourceID, resource) {
 	if (!resourceID) {
 	if (!resourceID) {
-		console.log("ERROR: entry does not contain id, cannot store");
+		THREE.log("ERROR: entry does not contain id, cannot store");
 		return;
 		return;
 	}
 	}
 
 
 	if (this._containsResource[resourceID]) {
 	if (this._containsResource[resourceID]) {
-		console.log("WARNING: resource:" + resourceID + " is already stored, overriding");
+		THREE.log("WARNING: resource:" + resourceID + " is already stored, overriding");
 	}
 	}
 
 
 	this._resources[resourceID] = resource;
 	this._resources[resourceID] = resource;

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

@@ -300,7 +300,7 @@ THREE.Lut.prototype = {
 		contextTitle.fillText( this.legend.labels.title.toString() + this.legend.labels.um.toString(), borderThickness, this.legend.labels.fontsize + borderThickness );
 		contextTitle.fillText( this.legend.labels.title.toString() + this.legend.labels.um.toString(), borderThickness, this.legend.labels.fontsize + borderThickness );
 
 
 		var txtTitle = new THREE.Texture( canvasTitle );
 		var txtTitle = new THREE.Texture( canvasTitle );
-
+		txtTitle.minFilter = THREE.LinearFilter;
 		txtTitle.needsUpdate = true;
 		txtTitle.needsUpdate = true;
 
 
 		var spriteMaterialTitle = new THREE.SpriteMaterial( { map: txtTitle, useScreenCoordinates: false } );
 		var spriteMaterialTitle = new THREE.SpriteMaterial( { map: txtTitle, useScreenCoordinates: false } );
@@ -385,7 +385,7 @@ THREE.Lut.prototype = {
 				contextTick.fillText( value.toString(), borderThickness, this.legend.labels.fontsize + borderThickness );
 				contextTick.fillText( value.toString(), borderThickness, this.legend.labels.fontsize + borderThickness );
 
 
 				var txtTick = new THREE.Texture( canvasTick );
 				var txtTick = new THREE.Texture( canvasTick );
-
+				txtTick.minFilter = THREE.LinearFilter;
 				txtTick.needsUpdate = true;
 				txtTick.needsUpdate = true;
 
 
 				var spriteMaterialTick = new THREE.SpriteMaterial( { map: txtTick, useScreenCoordinates: false } );
 				var spriteMaterialTick = new THREE.SpriteMaterial( { map: txtTick, useScreenCoordinates: false } );

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

@@ -184,7 +184,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 
 				if ( connectedFaces != 1 ) {
 				if ( connectedFaces != 1 ) {
 					
 					
-					if (WARNINGS) console.warn('Subdivision Modifier: Number of connected faces != 2, is: ', connectedFaces, currentEdge);
+					if (WARNINGS) THREE.warn('Subdivision Modifier: Number of connected faces != 2, is: ', connectedFaces, currentEdge);
 			
 			
 				}
 				}
 
 
@@ -215,7 +215,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 			currentEdge.newEdge = newEdgeVertices.length;
 			currentEdge.newEdge = newEdgeVertices.length;
 			newEdgeVertices.push(newEdge);
 			newEdgeVertices.push(newEdge);
 
 
-			// console.log(currentEdge, newEdge);
+			// THREE.log(currentEdge, newEdge);
 		}
 		}
 
 
 		/******************************************************
 		/******************************************************
@@ -257,11 +257,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 			if ( n <= 2 ) {
 			if ( n <= 2 ) {
 				
 				
 				// crease and boundary rules
 				// crease and boundary rules
-				// console.warn('crease and boundary rules');
+				// THREE.warn('crease and boundary rules');
 
 
 				if ( n == 2 ) {
 				if ( n == 2 ) {
 
 
-					if (WARNINGS) console.warn('2 connecting edges', connectingEdges);
+					if (WARNINGS) THREE.warn('2 connecting edges', connectingEdges);
 					sourceVertexWeight = 3 / 4;
 					sourceVertexWeight = 3 / 4;
 					connectingVertexWeight = 1 / 8;
 					connectingVertexWeight = 1 / 8;
 
 
@@ -270,11 +270,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 
 				} else if ( n == 1 ) {
 				} else if ( n == 1 ) {
 
 
-					if (WARNINGS) console.warn('only 1 connecting edge');
+					if (WARNINGS) THREE.warn('only 1 connecting edge');
 
 
 				} else if ( n == 0 ) {
 				} else if ( n == 0 ) {
 
 
-					if (WARNINGS) console.warn('0 connecting edges');
+					if (WARNINGS) THREE.warn('0 connecting edges');
 			
 			
 				}
 				}
 			
 			
@@ -335,7 +335,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 		geometry.vertices = newVertices;
 		geometry.vertices = newVertices;
 		geometry.faces = newFaces;
 		geometry.faces = newFaces;
 
 
-		// console.log('done');
+		// THREE.log('done');
 
 
 	};
 	};
 
 

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

@@ -16,9 +16,9 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	this.luminanceRT = null;
 	this.luminanceRT = null;
 	this.previousLuminanceRT = null;
 	this.previousLuminanceRT = null;
 	this.currentLuminanceRT = null;
 	this.currentLuminanceRT = null;
-	
+
 	if ( THREE.CopyShader === undefined )
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.AdaptiveToneMappingPass relies on THREE.CopyShader" );
+		THREE.error( "THREE.AdaptiveToneMappingPass relies on THREE.CopyShader" );
 
 
 	var copyShader = THREE.CopyShader;
 	var copyShader = THREE.CopyShader;
 
 
@@ -35,11 +35,11 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	} );
 	} );
 
 
 	if ( THREE.LuminosityShader === undefined )
 	if ( THREE.LuminosityShader === undefined )
-		console.error( "THREE.AdaptiveToneMappingPass relies on THREE.LuminosityShader" );
+		THREE.error( "THREE.AdaptiveToneMappingPass relies on THREE.LuminosityShader" );
 
 
 	this.materialLuminance = new THREE.ShaderMaterial( {
 	this.materialLuminance = new THREE.ShaderMaterial( {
 
 
-		uniforms: THREE.LuminosityShader.uniforms,
+		uniforms: THREE.UniformsUtils.clone( THREE.LuminosityShader.uniforms ),
 		vertexShader: THREE.LuminosityShader.vertexShader,
 		vertexShader: THREE.LuminosityShader.vertexShader,
 		fragmentShader: THREE.LuminosityShader.fragmentShader,
 		fragmentShader: THREE.LuminosityShader.fragmentShader,
 		blending: THREE.NoBlending,
 		blending: THREE.NoBlending,
@@ -72,15 +72,15 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 			"uniform sampler2D currentLum;",
 			"uniform sampler2D currentLum;",
 			"uniform float delta;",
 			"uniform float delta;",
 			"uniform float tau;",
 			"uniform float tau;",
-			
+
 			"void main() {",
 			"void main() {",
 
 
 				"vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );",
 				"vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );",
 				"vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );",
 				"vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );",
-				
+
 				"float fLastLum = lastLum.r;",
 				"float fLastLum = lastLum.r;",
 				"float fCurrentLum = currentLum.r;",
 				"float fCurrentLum = currentLum.r;",
-				
+
 				//The adaption seems to work better in extreme lighting differences
 				//The adaption seems to work better in extreme lighting differences
 				//if the input luminance is squared.
 				//if the input luminance is squared.
 				"fCurrentLum *= fCurrentLum;",
 				"fCurrentLum *= fCurrentLum;",
@@ -95,7 +95,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 
 
 	this.materialAdaptiveLum = new THREE.ShaderMaterial( {
 	this.materialAdaptiveLum = new THREE.ShaderMaterial( {
 
 
-		uniforms: this.adaptLuminanceShader.uniforms,
+		uniforms: THREE.UniformsUtils.clone( this.adaptLuminanceShader.uniforms ),
 		vertexShader: this.adaptLuminanceShader.vertexShader,
 		vertexShader: this.adaptLuminanceShader.vertexShader,
 		fragmentShader: this.adaptLuminanceShader.fragmentShader,
 		fragmentShader: this.adaptLuminanceShader.fragmentShader,
 		defines: this.adaptLuminanceShader.defines,
 		defines: this.adaptLuminanceShader.defines,
@@ -103,11 +103,11 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	} );
 	} );
 
 
 	if ( THREE.ToneMapShader === undefined )
 	if ( THREE.ToneMapShader === undefined )
-		console.error( "THREE.AdaptiveToneMappingPass relies on THREE.ToneMapShader" );
+		THREE.error( "THREE.AdaptiveToneMappingPass relies on THREE.ToneMapShader" );
 
 
 	this.materialToneMap = new THREE.ShaderMaterial( {
 	this.materialToneMap = new THREE.ShaderMaterial( {
 
 
-		uniforms: THREE.ToneMapShader.uniforms,
+		uniforms: THREE.UniformsUtils.clone( THREE.ToneMapShader.uniforms ),
 		vertexShader: THREE.ToneMapShader.vertexShader,
 		vertexShader: THREE.ToneMapShader.vertexShader,
 		fragmentShader: THREE.ToneMapShader.fragmentShader,
 		fragmentShader: THREE.ToneMapShader.fragmentShader,
 		blending: THREE.NoBlending
 		blending: THREE.NoBlending
@@ -120,7 +120,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	this.camera = new THREE.OrthographicCamera( -1, 1, 1, -1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( -1, 1, 1, -1, 0, 1 );
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
-	this.quad = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), null );
+	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };
@@ -160,7 +160,7 @@ THREE.AdaptiveToneMappingPass.prototype = {
 		this.quad.material = this.materialToneMap;
 		this.quad.material = this.materialToneMap;
 		this.materialToneMap.uniforms.tDiffuse.value = readBuffer;
 		this.materialToneMap.uniforms.tDiffuse.value = readBuffer;
 		renderer.render( this.scene, this.camera, writeBuffer, this.clear );
 		renderer.render( this.scene, this.camera, writeBuffer, this.clear );
-		
+
 	},
 	},
 
 
 	reset: function( renderer ) {
 	reset: function( renderer ) {
@@ -184,7 +184,7 @@ THREE.AdaptiveToneMappingPass.prototype = {
 		//We only need mipmapping for the current luminosity because we want a down-sampled version to sample in our adaptive shader
 		//We only need mipmapping for the current luminosity because we want a down-sampled version to sample in our adaptive shader
 		pars.minFilter = THREE.LinearMipMapLinearFilter;
 		pars.minFilter = THREE.LinearMipMapLinearFilter;
 		this.currentLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
 		this.currentLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
-		
+
 		if ( this.adaptive ) {
 		if ( this.adaptive ) {
 			this.materialToneMap.defines["ADAPTED_LUMINANCE"] = "";
 			this.materialToneMap.defines["ADAPTED_LUMINANCE"] = "";
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT;
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT;
@@ -261,4 +261,4 @@ THREE.AdaptiveToneMappingPass.prototype = {
 		}
 		}
 	}
 	}
 
 
-};
+};

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

@@ -19,7 +19,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	// copy material
 	// copy material
 
 
 	if ( THREE.CopyShader === undefined )
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.BloomPass relies on THREE.CopyShader" );
+		THREE.error( "THREE.BloomPass relies on THREE.CopyShader" );
 
 
 	var copyShader = THREE.CopyShader;
 	var copyShader = THREE.CopyShader;
 
 
@@ -40,7 +40,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	// convolution material
 	// convolution material
 
 
 	if ( THREE.ConvolutionShader === undefined )
 	if ( THREE.ConvolutionShader === undefined )
-		console.error( "THREE.BloomPass relies on THREE.ConvolutionShader" );
+		THREE.error( "THREE.BloomPass relies on THREE.ConvolutionShader" );
 
 
 	var convolutionShader = THREE.ConvolutionShader;
 	var convolutionShader = THREE.ConvolutionShader;
 
 

+ 1 - 1
examples/js/postprocessing/BokehPass.js

@@ -33,7 +33,7 @@ THREE.BokehPass = function ( scene, camera, params ) {
 	// bokeh material
 	// bokeh material
 
 
 	if ( THREE.BokehShader === undefined ) {
 	if ( THREE.BokehShader === undefined ) {
-		console.error( "THREE.BokehPass relies on THREE.BokehShader" );
+		THREE.error( "THREE.BokehPass relies on THREE.BokehShader" );
 	}
 	}
 	
 	
 	var bokehShader = THREE.BokehShader;
 	var bokehShader = THREE.BokehShader;

+ 1 - 1
examples/js/postprocessing/DotScreenPass.js

@@ -5,7 +5,7 @@
 THREE.DotScreenPass = function ( center, angle, scale ) {
 THREE.DotScreenPass = function ( center, angle, scale ) {
 
 
 	if ( THREE.DotScreenShader === undefined )
 	if ( THREE.DotScreenShader === undefined )
-		console.error( "THREE.DotScreenPass relies on THREE.DotScreenShader" );
+		THREE.error( "THREE.DotScreenPass relies on THREE.DotScreenShader" );
 
 
 	var shader = THREE.DotScreenShader;
 	var shader = THREE.DotScreenShader;
 
 

+ 1 - 1
examples/js/postprocessing/EffectComposer.js

@@ -27,7 +27,7 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
 	this.passes = [];
 	this.passes = [];
 
 
 	if ( THREE.CopyShader === undefined )
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.EffectComposer relies on THREE.CopyShader" );
+		THREE.error( "THREE.EffectComposer relies on THREE.CopyShader" );
 
 
 	this.copyPass = new THREE.ShaderPass( THREE.CopyShader );
 	this.copyPass = new THREE.ShaderPass( THREE.CopyShader );
 
 

+ 1 - 1
examples/js/postprocessing/FilmPass.js

@@ -5,7 +5,7 @@
 THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) {
 THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) {
 
 
 	if ( THREE.FilmShader === undefined )
 	if ( THREE.FilmShader === undefined )
-		console.error( "THREE.FilmPass relies on THREE.FilmShader" );
+		THREE.error( "THREE.FilmPass relies on THREE.FilmShader" );
 
 
 	var shader = THREE.FilmShader;
 	var shader = THREE.FilmShader;
 
 

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

@@ -4,7 +4,7 @@
 
 
 THREE.GlitchPass = function ( dt_size ) {
 THREE.GlitchPass = function ( dt_size ) {
 
 
-	if ( THREE.DigitalGlitch === undefined ) console.error( "THREE.GlitchPass relies on THREE.DigitalGlitch" );
+	if ( THREE.DigitalGlitch === undefined ) THREE.error( "THREE.GlitchPass relies on THREE.DigitalGlitch" );
 	
 	
 	var shader = THREE.DigitalGlitch;
 	var shader = THREE.DigitalGlitch;
 	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
@@ -21,7 +21,7 @@ THREE.GlitchPass = function ( dt_size ) {
 		fragmentShader: shader.fragmentShader
 		fragmentShader: shader.fragmentShader
 	});
 	});
 
 
-	console.log(this.material);
+	THREE.log(this.material);
 	
 	
 	this.enabled = true;
 	this.enabled = true;
 	this.renderToScreen = false;
 	this.renderToScreen = false;
@@ -91,7 +91,7 @@ THREE.GlitchPass.prototype = {
 	generateHeightmap:function(dt_size)
 	generateHeightmap:function(dt_size)
 	{
 	{
 		var data_arr = new Float32Array( dt_size * dt_size * 3 );
 		var data_arr = new Float32Array( dt_size * dt_size * 3 );
-		console.log(dt_size);
+		THREE.log(dt_size);
 		var length = dt_size * dt_size;
 		var length = dt_size * dt_size;
 		
 		
 		for ( var i = 0; i < length; i ++) 
 		for ( var i = 0; i < length; i ++) 
@@ -103,8 +103,8 @@ THREE.GlitchPass.prototype = {
 		}
 		}
 		
 		
 		var texture = new THREE.DataTexture( data_arr, dt_size, dt_size, THREE.RGBFormat, THREE.FloatType );
 		var texture = new THREE.DataTexture( data_arr, dt_size, dt_size, THREE.RGBFormat, THREE.FloatType );
-		console.log(texture);
-		console.log(dt_size);
+		THREE.log(texture);
+		THREE.log(dt_size);
 		texture.minFilter = THREE.NearestFilter;
 		texture.minFilter = THREE.NearestFilter;
 		texture.magFilter = THREE.NearestFilter;
 		texture.magFilter = THREE.NearestFilter;
 		texture.needsUpdate = true;
 		texture.needsUpdate = true;

+ 1 - 1
examples/js/postprocessing/SavePass.js

@@ -5,7 +5,7 @@
 THREE.SavePass = function ( renderTarget ) {
 THREE.SavePass = function ( renderTarget ) {
 
 
 	if ( THREE.CopyShader === undefined )
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.SavePass relies on THREE.CopyShader" );
+		THREE.error( "THREE.SavePass relies on THREE.CopyShader" );
 
 
 	var shader = THREE.CopyShader;
 	var shader = THREE.CopyShader;
 
 

+ 1 - 1
examples/js/postprocessing/TexturePass.js

@@ -5,7 +5,7 @@
 THREE.TexturePass = function ( texture, opacity ) {
 THREE.TexturePass = function ( texture, opacity ) {
 
 
 	if ( THREE.CopyShader === undefined )
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.TexturePass relies on THREE.CopyShader" );
+		THREE.error( "THREE.TexturePass relies on THREE.CopyShader" );
 
 
 	var shader = THREE.CopyShader;
 	var shader = THREE.CopyShader;
 
 

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

@@ -44,7 +44,7 @@ THREE.CSS3DRenderer = function () {
 	var _widthHalf, _heightHalf;
 	var _widthHalf, _heightHalf;
 
 
 	var matrix = new THREE.Matrix4();
 	var matrix = new THREE.Matrix4();
-	
+
 	var cache = {
 	var cache = {
 		camera: { fov: 0, style: '' },
 		camera: { fov: 0, style: '' },
 		objects: {}
 		objects: {}
@@ -233,7 +233,7 @@ THREE.CSS3DRenderer = function () {
 			cameraElement.style.MozTransform = style;
 			cameraElement.style.MozTransform = style;
 			cameraElement.style.oTransform = style;
 			cameraElement.style.oTransform = style;
 			cameraElement.style.transform = style;
 			cameraElement.style.transform = style;
-			
+
 			cache.camera.style = style;
 			cache.camera.style = style;
 
 
 		}
 		}

+ 6 - 6
examples/js/renderers/CSS3DStereoRenderer.js

@@ -11,7 +11,7 @@ THREE.CSS3DObject = function ( element ) {
 
 
 	this.elementR = element.cloneNode( true );
 	this.elementR = element.cloneNode( true );
 	this.elementR.style.position = 'absolute';
 	this.elementR.style.position = 'absolute';
-	
+
 	this.addEventListener( 'removed', function ( event ) {
 	this.addEventListener( 'removed', function ( event ) {
 
 
 		if ( this.elementL.parentNode !== null ) {
 		if ( this.elementL.parentNode !== null ) {
@@ -265,7 +265,7 @@ THREE.CSS3DStereoRenderer = function () {
 		var fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height;
 		var fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height;
 
 
 		// Left
 		// Left
-		
+
 		_cameraL.fov = camera.fov;
 		_cameraL.fov = camera.fov;
 		_cameraL.aspect = 0.5 * camera.aspect;
 		_cameraL.aspect = 0.5 * camera.aspect;
 		_cameraL.updateProjectionMatrix();
 		_cameraL.updateProjectionMatrix();
@@ -292,11 +292,11 @@ THREE.CSS3DStereoRenderer = function () {
 		cameraElementL.style.MozTransform = style;
 		cameraElementL.style.MozTransform = style;
 		cameraElementL.style.oTransform = style;
 		cameraElementL.style.oTransform = style;
 		cameraElementL.style.transform = style;
 		cameraElementL.style.transform = style;
-		
+
 		renderObject( scene, _cameraL, cameraElementL, 'L' );
 		renderObject( scene, _cameraL, cameraElementL, 'L' );
-		
+
 		// Right
 		// Right
-		
+
 		_cameraR.projectionMatrix = _cameraL.projectionMatrix;
 		_cameraR.projectionMatrix = _cameraL.projectionMatrix;
 
 
 		_cameraR.near = camera.near;
 		_cameraR.near = camera.near;
@@ -321,7 +321,7 @@ THREE.CSS3DStereoRenderer = function () {
 		cameraElementR.style.MozTransform = style;
 		cameraElementR.style.MozTransform = style;
 		cameraElementR.style.oTransform = style;
 		cameraElementR.style.oTransform = style;
 		cameraElementR.style.transform = style;
 		cameraElementR.style.transform = style;
-		
+
 		renderObject( scene, _cameraR, cameraElementR, 'R' );
 		renderObject( scene, _cameraR, cameraElementR, 'R' );
 
 
 	};
 	};

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

@@ -220,7 +220,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 	this.setClearColorHex = function ( hex, alpha ) {
 	this.setClearColorHex = function ( hex, alpha ) {
 
 
-		console.warn( 'THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.' );
+		THREE.warn( 'THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.' );
 		this.setClearColor( hex, alpha );
 		this.setClearColor( hex, alpha );
 
 
 	};
 	};
@@ -298,7 +298,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 		if ( camera instanceof THREE.Camera === false ) {
 		if ( camera instanceof THREE.Camera === false ) {
 
 
-			console.error( 'THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.' );
+			THREE.error( 'THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.' );
 			return;
 			return;
 
 
 		}
 		}

+ 3 - 3
examples/js/renderers/Projector.js

@@ -127,21 +127,21 @@ THREE.Projector = function () {
 
 
 	this.projectVector = function ( vector, camera ) {
 	this.projectVector = function ( vector, camera ) {
 
 
-		console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
+		THREE.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
 		vector.project( camera );
 		vector.project( camera );
 
 
 	};
 	};
 
 
 	this.unprojectVector = function ( vector, camera ) {
 	this.unprojectVector = function ( vector, camera ) {
 
 
-		console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
+		THREE.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
 		vector.unproject( camera );
 		vector.unproject( camera );
 
 
 	};
 	};
 
 
 	this.pickingRay = function ( vector, camera ) {
 	this.pickingRay = function ( vector, camera ) {
 
 
-		console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
+		THREE.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
 
 
 	};
 	};
 
 

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

@@ -125,7 +125,7 @@ THREE.SVGRenderer = function () {
 
 
 		if ( camera instanceof THREE.Camera === false ) {
 		if ( camera instanceof THREE.Camera === false ) {
 
 
-			console.error( 'THREE.SVGRenderer.render: camera is not an instance of THREE.Camera.' );
+			THREE.error( 'THREE.SVGRenderer.render: camera is not an instance of THREE.Camera.' );
 			return;
 			return;
 
 
 		}
 		}

+ 6 - 4
examples/js/shaders/NormalDisplacementShader.js

@@ -387,7 +387,7 @@ THREE.NormalDisplacementShader = {
 
 
 		"	#ifdef METAL",
 		"	#ifdef METAL",
 
 
-		"		outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor * diffuse + totalSpecularLight );",
+		"		outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
 
 
 		"	#else",
 		"	#else",
 
 
@@ -399,13 +399,15 @@ THREE.NormalDisplacementShader = {
 
 
 		"		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );",
 		"		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );",
 
 
+		"		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );",
+
 		"		#ifdef ENVMAP_MODE_REFLECTION",
 		"		#ifdef ENVMAP_MODE_REFLECTION",
 
 
-		"			vec3 vReflect = reflect( cameraToVertex, normal );",
+		"			vec3 vReflect = reflect( cameraToVertex, worldNormal );",
 
 
 		"		#else",
 		"		#else",
 
 
-		"			vec3 vReflect = refract( cameraToVertex, normal, refractionRatio );",
+		"			vec3 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );",
 
 
 		"		#endif",
 		"		#endif",
 
 
@@ -417,7 +419,7 @@ THREE.NormalDisplacementShader = {
 
 
 		"		#endif",
 		"		#endif",
 
 
-		"		outgoingLight = mix( outgoingLight.xyz, cubeColor.xyz, specularTex.r * reflectivity );",
+		"		outgoingLight = mix( outgoingLight, cubeColor.xyz, specularTex.r * reflectivity );",
 
 
 		"	}",
 		"	}",
 
 

+ 2 - 2
examples/js/utils/GeometryUtils.js

@@ -9,7 +9,7 @@ THREE.GeometryUtils = {
 
 
 	merge: function ( geometry1, geometry2, materialIndexOffset ) {
 	merge: function ( geometry1, geometry2, materialIndexOffset ) {
 
 
-		console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
+		THREE.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
 
 
 		var matrix;
 		var matrix;
 
 
@@ -292,7 +292,7 @@ THREE.GeometryUtils = {
 
 
 	center: function ( geometry ) {
 	center: function ( geometry ) {
 
 
-		console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
+		THREE.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
 		return geometry.center();
 		return geometry.center();
 
 
 	}
 	}

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

@@ -573,7 +573,7 @@ THREE.ProxyGeometry.prototype.mergeVertices = function () {
 
 
 		} else {
 		} else {
 
 
-			//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
+			//THREE.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
 			changes[ i ] = changes[ verticesMap[ key ] ];
 			changes[ i ] = changes[ verticesMap[ key ] ];
 
 
 		}
 		}

+ 6 - 5
examples/misc_fps.html

@@ -163,7 +163,7 @@
 								var actualHeight = hits[0].distance - birdsEye;
 								var actualHeight = hits[0].distance - birdsEye;
 
 
 								// collision: stick to the surface if landing on it
 								// collision: stick to the surface if landing on it
-								
+
 								if( ( motion.velocity.y <= 0 ) && ( Math.abs( actualHeight ) < kneeDeep ) ) {
 								if( ( motion.velocity.y <= 0 ) && ( Math.abs( actualHeight ) < kneeDeep ) ) {
 									motion.position.y -= actualHeight;
 									motion.position.y -= actualHeight;
 									motion.velocity.y = 0;
 									motion.velocity.y = 0;
@@ -185,9 +185,9 @@
 							// limit the tilt at ±0.4 radians
 							// limit the tilt at ±0.4 radians
 
 
 							motion.rotation.x = Math.max( -0.4, Math.min ( +0.4, motion.rotation.x ) );
 							motion.rotation.x = Math.max( -0.4, Math.min ( +0.4, motion.rotation.x ) );
-							
+
 							// wrap horizontal rotation to 0...2π
 							// wrap horizontal rotation to 0...2π
-							
+
 							motion.rotation.y += tau; motion.rotation.y %= tau;
 							motion.rotation.y += tau; motion.rotation.y %= tau;
 
 
 							timeLeft -= dt;
 							timeLeft -= dt;
@@ -233,6 +233,7 @@
 				var placeholder = new THREE.Object3D();
 				var placeholder = new THREE.Object3D();
 
 
 				var texture = THREE.ImageUtils.loadTexture( textureUrl );
 				var texture = THREE.ImageUtils.loadTexture( textureUrl );
+				texture.minFilter = THREE.LinearFilter;
 				texture.anisotropy = textureQuality;
 				texture.anisotropy = textureQuality;
 
 
 				var loader = new THREE.JSONLoader();
 				var loader = new THREE.JSONLoader();
@@ -256,7 +257,7 @@
 			var camera = new THREE.PerspectiveCamera( 60, 1, 0.1, 9000 );
 			var camera = new THREE.PerspectiveCamera( 60, 1, 0.1, 9000 );
 
 
 			var scene = new THREE.Scene();
 			var scene = new THREE.Scene();
-			
+
 			scene.add( camera );
 			scene.add( camera );
 
 
 			scene.add( makeSkybox( [
 			scene.add( makeSkybox( [
@@ -294,7 +295,7 @@
 
 
 					// call our game loop with the time elapsed since last rendering, in ms
 					// call our game loop with the time elapsed since last rendering, in ms
 					gameLoop( timeElapsed );
 					gameLoop( timeElapsed );
-					
+
 					renderer.render( scene, camera );
 					renderer.render( scene, camera );
 					requestAnimationFrame( render );
 					requestAnimationFrame( render );
 				};
 				};

文件差异内容过多而无法显示
+ 3 - 0
examples/models/json/pressure.json


二进制
examples/textures/MaryOculus.webm


+ 1 - 0
examples/textures/MaryOculus.webm.nfo

@@ -0,0 +1 @@
+ffmpeg -i MaryOculus.mp4 -vf scale=2048:1024 -b:v 20M -threads 4 -an MaryOculus7.webm

+ 5 - 0
examples/textures/decal/LICENSE.TXT

@@ -0,0 +1,5 @@
+decal-diffuse.png
+decal-normal.jpg
+
+Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication License:
+http://creativecommons.org/publicdomain/zero/1.0/

二进制
examples/textures/decal/decal-diffuse.png


二进制
examples/textures/decal/decal-normal.jpg


+ 168 - 0
examples/vr_video.html

@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - vr video</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+			body {
+				font-family: Monospace;
+				background-color: #f0f0f0;
+				margin: 0px;
+				overflow: hidden;
+			}
+			#info {
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				color: #fff;
+				text-align: center;
+			}
+			a {
+				color: #ff0
+			}
+		</style>
+	</head>
+	<body>
+		<div id="container"></div>
+		<div id="info">
+			<a href="http://threejs.org" target="_blank">three.js</a> webgl - vr video<br />
+			stereoscopic panoramic render by <a href="http://pedrofe.com/rendering-for-oculus-rift-with-arnold/" target="_blank">pedrofe</a>. scene from <a href="http://www.meryproject.com/" target="_blank">mery project</a>.
+		</div>
+
+		<script src="../build/three.min.js"></script>
+		<script src="js/effects/VREffect.js"></script>
+		<script src="js/controls/VRControls.js"></script>
+
+		<script>
+
+			var camera, sceneLeft, sceneRight, renderer;
+			var video, texture;
+
+			var controls, effect;
+
+			init();
+			animate();
+
+			function init() {
+
+				var container = document.getElementById( 'container' );
+				container.addEventListener( 'click', function () {
+
+					video.play();
+					effect.setFullScreen( true );
+
+				} );
+
+				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 2000 );
+
+				// video
+
+				video = document.createElement( 'video' );
+				video.loop = true;
+				video.src = 'textures/MaryOculus.webm';
+				video.play();
+
+				texture = new THREE.VideoTexture( video );
+				texture.minFilter = THREE.LinearFilter;
+				texture.format = THREE.RGBFormat;
+				texture.generateMipmaps = false;
+
+				// left
+
+				sceneLeft = new THREE.Scene();
+
+				var geometry = new THREE.SphereGeometry( 500, 60, 40 );
+				geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+
+				var uvs = geometry.faceVertexUvs[ 0 ];
+
+				for ( var i = 0; i < uvs.length; i ++ ) {
+
+					for ( var j = 0; j < 3; j ++ ) {
+
+						uvs[ i ][ j ].x *= 0.5;
+
+					}
+
+				}
+
+				var material = new THREE.MeshBasicMaterial( { map: texture } );
+
+				var mesh = new THREE.Mesh( geometry, material );
+				mesh.rotation.y = - Math.PI / 2;
+				sceneLeft.add( mesh );
+
+				// right
+
+				sceneRight = new THREE.Scene();
+
+				var geometry = new THREE.SphereGeometry( 500, 60, 40 );
+				geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+
+				var uvs = geometry.faceVertexUvs[ 0 ];
+
+				for ( var i = 0; i < uvs.length; i ++ ) {
+
+					for ( var j = 0; j < 3; j ++ ) {
+
+						uvs[ i ][ j ].x *= 0.5;
+						uvs[ i ][ j ].x += 0.5;
+
+					}
+
+				}
+
+				var material = new THREE.MeshBasicMaterial( { map: texture } );
+
+				var mesh = new THREE.Mesh( geometry, material );
+				mesh.rotation.y = - Math.PI / 2;
+				sceneRight.add( mesh );
+
+				//
+
+				renderer = new THREE.WebGLRenderer();
+				renderer.setClearColor( 0x101010 );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( renderer.domElement );
+
+				//
+
+				controls = new THREE.VRControls( camera );
+
+				effect = new THREE.VREffect( renderer );
+				effect.setSize( window.innerWidth, window.innerHeight );
+
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				effect.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+				render();
+
+			}
+
+			function render() {
+
+				controls.update();
+
+				effect.render( [ sceneLeft, sceneRight ], camera );
+
+			}
+
+		</script>
+	</body>
+</html>

+ 1 - 1
examples/webgl_decals.html

@@ -53,7 +53,7 @@
 			specular: 0x444444,
 			specular: 0x444444,
 			map: decalDiffuse,
 			map: decalDiffuse,
 			normalMap: decalNormal,
 			normalMap: decalNormal,
-			normalScale: new THREE.Vector2( .15, .15 ),
+			normalScale: new THREE.Vector2( 1, 1 ),
 			shininess: 30,
 			shininess: 30,
 			transparent: true,
 			transparent: true,
 			depthTest: true,
 			depthTest: true,

+ 1 - 0
examples/webgl_interactive_cubes_gpu.html

@@ -75,6 +75,7 @@
 
 
 				pickingScene = new THREE.Scene();
 				pickingScene = new THREE.Scene();
 				pickingTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight );
 				pickingTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight );
+				pickingTexture.minFilter = THREE.LinearFilter;
 				pickingTexture.generateMipmaps = false;
 				pickingTexture.generateMipmaps = false;
 
 
 				scene.add( new THREE.AmbientLight( 0x555555 ) );
 				scene.add( new THREE.AmbientLight( 0x555555 ) );

+ 10 - 32
examples/webgl_loader_scene.html

@@ -39,15 +39,6 @@
 				display:none;
 				display:none;
 			}
 			}
 
 
-			#start {
-				color:#fff;
-				text-shadow: #000 0px 0px 2px;
-				padding:0.1em 0.3em;
-				width:3em;
-				text-align: center;
-				display:none;
-			}
-
 			.shadow {
 			.shadow {
 				-moz-box-shadow: 0px 0px 5px #000;
 				-moz-box-shadow: 0px 0px 5px #000;
 				-webkit-box-shadow: 0px 0px 5px #000;
 				-webkit-box-shadow: 0px 0px 5px #000;
@@ -97,7 +88,6 @@
 
 
 			<center>
 			<center>
 				<div id="progressbar" class="shadow"><div id="bar" class="shadow"></div></div>
 				<div id="progressbar" class="shadow"><div id="bar" class="shadow"></div></div>
-				<div id="start" class="disabled">Start</div>
 			</center>
 			</center>
 		</div>
 		</div>
 
 
@@ -186,8 +176,6 @@
 				stats.domElement.style.zIndex = 100;
 				stats.domElement.style.zIndex = 100;
 				container.appendChild( stats.domElement );
 				container.appendChild( stats.domElement );
 
 
-				$( "start" ).addEventListener( 'click', onStartClick, false );
-
 				var callbackProgress = function( progress, result ) {
 				var callbackProgress = function( progress, result ) {
 
 
 					var bar = 250,
 					var bar = 250,
@@ -207,8 +195,6 @@
 
 
 					$( "message" ).style.display = "none";
 					$( "message" ).style.display = "none";
 					$( "progressbar" ).style.display = "none";
 					$( "progressbar" ).style.display = "none";
-					$( "start" ).style.display = "block";
-					$( "start" ).className = "enabled";
 
 
 					result.scene.traverse( function ( object ) {
 					result.scene.traverse( function ( object ) {
 
 
@@ -237,6 +223,16 @@
 
 
 					} );
 					} );
 
 
+					//
+
+					$( "progress" ).style.display = "none";
+
+					camera = loaded.currentCamera;
+					camera.aspect = window.innerWidth / window.innerHeight;
+					camera.updateProjectionMatrix();
+
+					scene = loaded.scene;
+
 				}
 				}
 
 
 				$( "progress" ).style.display = "block";
 				$( "progress" ).style.display = "block";
@@ -276,24 +272,6 @@
 
 
 			}
 			}
 
 
-			function setButtonActive( id ) {
-
-				$( "start" ).style.backgroundColor = "green";
-
-			}
-
-			function onStartClick() {
-
-				$( "progress" ).style.display = "none";
-
-				camera = loaded.currentCamera;
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				scene = loaded.scene;
-
-			}
-
 			function onDocumentMouseMove( event ) {
 			function onDocumentMouseMove( event ) {
 
 
 				mouseX = ( event.clientX - windowHalfX );
 				mouseX = ( event.clientX - windowHalfX );

+ 3 - 0
examples/webgl_materials_normaldisplacementmap.html

@@ -185,6 +185,9 @@
 				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: false };
 				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: false };
 				var material1 = new THREE.ShaderMaterial( parameters );
 				var material1 = new THREE.ShaderMaterial( parameters );
 
 
+				// Ensure that ENVMAP_MODE_REFLECTION is defined in shader
+				material1.envMap = reflectionCube;
+
 				var material2 = new THREE.MeshPhongMaterial( {
 				var material2 = new THREE.MeshPhongMaterial( {
 					color: diffuse,
 					color: diffuse,
 					specular: specular,
 					specular: specular,

+ 1 - 1
examples/webgl_mirror.html

@@ -86,7 +86,7 @@
 
 
 				var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
 				var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 );
 				
 				
-				// MIRORR planes
+				// MIRROR planes
 				groundMirror = new THREE.Mirror( renderer, camera, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT, color: 0x777777 } );
 				groundMirror = new THREE.Mirror( renderer, camera, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT, color: 0x777777 } );
 				
 				
 				var mirrorMesh = new THREE.Mesh( planeGeo, groundMirror.material );
 				var mirrorMesh = new THREE.Mesh( planeGeo, groundMirror.material );

+ 13 - 24
examples/webgl_shaders_sky.html

@@ -20,8 +20,8 @@
 			}
 			}
 
 
 			#info {
 			#info {
-				color:#333;
-				text-shadow: 1px 1px #fff;
+				color:#ccc;
+				text-shadow: 1px 1px rgba(0,0,0,0.25);
 				position: absolute;
 				position: absolute;
 				top: 0px; width: 100%;
 				top: 0px; width: 100%;
 				padding: 5px;
 				padding: 5px;
@@ -29,7 +29,7 @@
 			}
 			}
 
 
 			a {
 			a {
-				color: #333;
+				color: #fff;
 			}
 			}
 
 
 		</style>
 		</style>
@@ -90,7 +90,7 @@
 					mieDirectionalG: 0.8,
 					mieDirectionalG: 0.8,
 					luminance: 1,
 					luminance: 1,
 					inclination: 0.49, // elevation / inclination
 					inclination: 0.49, // elevation / inclination
-					azimuth: 0.25, // Facing front,					
+					azimuth: 0.25, // Facing front,
 					sun: !true
 					sun: !true
 				}
 				}
 
 
@@ -108,8 +108,8 @@
 					var phi = 2 * Math.PI * (effectController.azimuth - 0.5);
 					var phi = 2 * Math.PI * (effectController.azimuth - 0.5);
 
 
 					sunSphere.position.x = distance * Math.cos(phi);
 					sunSphere.position.x = distance * Math.cos(phi);
-					sunSphere.position.y = distance * Math.sin(phi) * Math.sin(theta); 
-					sunSphere.position.z = distance * Math.sin(phi) * Math.cos(theta); 
+					sunSphere.position.y = distance * Math.sin(phi) * Math.sin(theta);
+					sunSphere.position.z = distance * Math.sin(phi) * Math.cos(theta);
 
 
 					sunSphere.visible = effectController.sun;
 					sunSphere.visible = effectController.sun;
 
 
@@ -129,14 +129,14 @@
 				gui.add( effectController, "inclination", 0, 1, 0.0001).onChange( guiChanged );
 				gui.add( effectController, "inclination", 0, 1, 0.0001).onChange( guiChanged );
 				gui.add( effectController, "azimuth", 0, 1, 0.0001).onChange( guiChanged );
 				gui.add( effectController, "azimuth", 0, 1, 0.0001).onChange( guiChanged );
 				gui.add( effectController, "sun").onChange( guiChanged );
 				gui.add( effectController, "sun").onChange( guiChanged );
-				
+
 
 
 				guiChanged();
 				guiChanged();
 
 
 
 
 				camera.lookAt(sunSphere.position)
 				camera.lookAt(sunSphere.position)
 
 
-	
+
 			}
 			}
 
 
 
 
@@ -150,21 +150,10 @@
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 
-				var size = 500;
-
-				var geometryLines = new THREE.BoxGeometry( size, size, size );
-	
-				var geometryPlane = new THREE.PlaneGeometry( size * 10, size * 10, 1, 1);
-				geometryPlane.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
-	
-
-				var materialLines = new THREE.MeshBasicMaterial( { wireframe: true } );
-
-				meshLines = new THREE.Mesh( geometryLines, materialLines );
-
-				// scene.add( meshLines );
-
-				scene.add( new THREE.Mesh( geometryPlane, materialLines ) );
+				var helper = new THREE.GridHelper( 5000, 5000 );
+				helper.color1.setHex( 0xffffff );
+				helper.color2.setHex( 0xffffff );
+				scene.add( helper );
 
 
 				initSky();
 				initSky();
 
 
@@ -206,7 +195,7 @@
 				time = Date.now();
 				time = Date.now();
 
 
 				requestAnimationFrame( animate );
 				requestAnimationFrame( animate );
-				
+
 				controls.update();
 				controls.update();
 
 
 				render();
 				render();

+ 37 - 18
examples/webgl_shaders_tonemapping.html

@@ -85,12 +85,15 @@
 			function init() {
 			function init() {
 
 
 				params = {
 				params = {
-					"Average Luminosity": 0.7,
+					bloomAmount: 1.0,
+					sunLight: 4.0,
+
+					enabled: true,
+					avgLuminance: 0.7,
 					middleGrey: 0.04,
 					middleGrey: 0.04,
 					maxLuminance: 16,
 					maxLuminance: 16,
-					bloomAmount: 1.0,
+
 					adaptionRate: 2.0,
 					adaptionRate: 2.0,
-					sunLight: 4.0,
 				};
 				};
 
 
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
@@ -395,22 +398,25 @@
 				// ldrEffectComposer.addPass( gammaPass );
 				// ldrEffectComposer.addPass( gammaPass );
 
 
 
 
-				var dynamicHdrGui = new dat.GUI();
+				var gui = new dat.GUI();
 
 
 				// dynamicHdrGui.add( params, 'projection', { 'From cam to mesh': 'camera', 'Normal to mesh': 'normal' } );
 				// dynamicHdrGui.add( params, 'projection', { 'From cam to mesh': 'camera', 'Normal to mesh': 'normal' } );
-				dynamicHdrGui.add( params, 'middleGrey', 0, 12 );
-				dynamicHdrGui.add( params, 'maxLuminance', 1, 30 );
-				dynamicHdrGui.add( params, 'adaptionRate', 0.0, 10.0 );
-				dynamicHdrGui.add( params, 'bloomAmount', 0.0, 10.0 );
-				dynamicHdrGui.add( params, 'sunLight', 0.1, 12.0 );
-				// dynamicHdrGui.add( params, 'clear' );
-				dynamicHdrGui.open();
+				var sceneGui = gui.addFolder( 'Scenes' );
+				var toneMappingGui = gui.addFolder( 'ToneMapping' );
+				var staticToneMappingGui = gui.addFolder( 'StaticOnly' );
+				var adaptiveToneMappingGui = gui.addFolder( 'AdaptiveOnly' );
+
+				sceneGui.add( params, 'bloomAmount', 0.0, 10.0 );
+				sceneGui.add( params, 'sunLight', 0.1, 12.0 );
 
 
-				var ldrGui = new dat.GUI();
-				ldrGui.domElement.style.position = 'absolute';
-				ldrGui.add( params, 'Average Luminosity', 0.001, 2.0 );
-				ldrGui.open();
+				toneMappingGui.add( params, 'enabled' );
+				toneMappingGui.add( params, 'middleGrey', 0, 12 );
+				toneMappingGui.add( params, 'maxLuminance', 1, 30 );
 
 
+				staticToneMappingGui.add( params, 'avgLuminance', 0.001, 2.0 );
+				adaptiveToneMappingGui.add( params, 'adaptionRate', 0.0, 10.0 );
+
+				gui.open();
 
 
 				window.addEventListener( 'resize', onWindowResize, false );
 				window.addEventListener( 'resize', onWindowResize, false );
 
 
@@ -444,11 +450,24 @@
 					adaptToneMappingPass.setAdaptionRate( params.adaptionRate );
 					adaptToneMappingPass.setAdaptionRate( params.adaptionRate );
 					adaptiveLuminanceMat.uniforms.map.value = adaptToneMappingPass.luminanceRT;
 					adaptiveLuminanceMat.uniforms.map.value = adaptToneMappingPass.luminanceRT;
 					currentLuminanceMat.uniforms.map.value = adaptToneMappingPass.currentLuminanceRT;
 					currentLuminanceMat.uniforms.map.value = adaptToneMappingPass.currentLuminanceRT;
-					if ( adaptToneMappingPass.setAverageLuminance ) {
-						adaptToneMappingPass.setAverageLuminance( params["Average Luminosity"] );
-					}
+					
+					adaptToneMappingPass.enabled = params.enabled;
 					adaptToneMappingPass.setMaxLuminance( params.maxLuminance );
 					adaptToneMappingPass.setMaxLuminance( params.maxLuminance );
 					adaptToneMappingPass.setMiddleGrey( params.middleGrey );
 					adaptToneMappingPass.setMiddleGrey( params.middleGrey );
+
+					hdrToneMappingPass.enabled = params.enabled;
+					hdrToneMappingPass.setMaxLuminance( params.maxLuminance );
+					hdrToneMappingPass.setMiddleGrey( params.middleGrey );
+					if ( hdrToneMappingPass.setAverageLuminance ) {
+						hdrToneMappingPass.setAverageLuminance( params.avgLuminance );
+					}
+				
+					ldrToneMappingPass.enabled = params.enabled;
+					ldrToneMappingPass.setMaxLuminance( params.maxLuminance );
+					ldrToneMappingPass.setMiddleGrey( params.middleGrey );
+					if ( ldrToneMappingPass.setAverageLuminance ) {
+						ldrToneMappingPass.setAverageLuminance( params.avgLuminance );
+					}
 				}
 				}
 
 
 				directionalLight.intensity = params.sunLight;
 				directionalLight.intensity = params.sunLight;

+ 1 - 1
examples/webgl_terrain_dynamic.html

@@ -606,7 +606,7 @@
 
 
 				var sceneTmp = new THREE.Scene();
 				var sceneTmp = new THREE.Scene();
 
 
-				var meshTmp = new THREE.Mesh( new THREE.PlaneGeometry( SCREEN_WIDTH, SCREEN_HEIGHT ), shaderMaterial );
+				var meshTmp = new THREE.Mesh( new THREE.PlaneBufferGeometry( SCREEN_WIDTH, SCREEN_HEIGHT ), shaderMaterial );
 				meshTmp.position.z = -500;
 				meshTmp.position.z = -500;
 
 
 				sceneTmp.add( meshTmp );
 				sceneTmp.add( meshTmp );

+ 2 - 2
src/Three.js

@@ -2,7 +2,7 @@
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
  */
  */
 
 
-var THREE = { REVISION: '71dev' };
+var THREE = { REVISION: '72dev' };
 
 
 // browserify support
 // browserify support
 
 
@@ -16,7 +16,7 @@ if ( typeof module === 'object' ) {
 
 
 if ( Math.sign === undefined ) {
 if ( Math.sign === undefined ) {
 
 
-	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign 
+	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
 
 
 	Math.sign = function ( x ) {
 	Math.sign = function ( x ) {
 
 

+ 15 - 20
src/core/BufferGeometry.js

@@ -667,30 +667,24 @@ THREE.BufferGeometry.prototype = {
 	},
 	},
 
 
 	/*
 	/*
-		computeOffsets
-		Compute the draw offset for large models by chunking the index buffer into chunks of 65k addressable vertices.
-		This method will effectively rewrite the index buffer and remap all attributes to match the new indices.
-		WARNING: This method will also expand the vertex count to prevent sprawled triangles across draw offsets.
-		indexBufferSize - Defaults to 65535, but allows for larger or smaller chunks.
+	Compute the draw offset for large models by chunking the index buffer into chunks of 65k addressable vertices.
+	This method will effectively rewrite the index buffer and remap all attributes to match the new indices.
+	WARNING: This method will also expand the vertex count to prevent sprawled triangles across draw offsets.
+	size - Defaults to 65535, but allows for larger or smaller chunks.
 	*/
 	*/
-	computeOffsets: function ( indexBufferSize ) {
+	computeOffsets: function ( size ) {
 
 
-		var size = indexBufferSize;
-		if ( indexBufferSize === undefined )
-			size = 65535; //WebGL limits type of index buffer values to 16-bit.
-
-		var s = Date.now();
+		if ( size === undefined ) size = 65535; // WebGL limits type of index buffer values to 16-bit.
 
 
 		var indices = this.attributes.index.array;
 		var indices = this.attributes.index.array;
 		var vertices = this.attributes.position.array;
 		var vertices = this.attributes.position.array;
 
 
-		var verticesCount = ( vertices.length / 3 );
 		var facesCount = ( indices.length / 3 );
 		var facesCount = ( indices.length / 3 );
 
 
 		/*
 		/*
-		console.log("Computing buffers in offsets of "+size+" -> indices:"+indices.length+" vertices:"+vertices.length);
-		console.log("Faces to process: "+(indices.length/3));
-		console.log("Reordering "+verticesCount+" vertices.");
+		THREE.log("Computing buffers in offsets of "+size+" -> indices:"+indices.length+" vertices:"+vertices.length);
+		THREE.log("Faces to process: "+(indices.length/3));
+		THREE.log("Reordering "+verticesCount+" vertices.");
 		*/
 		*/
 
 
 		var sortedIndices = new Uint16Array( indices.length ); //16-bit buffers
 		var sortedIndices = new Uint16Array( indices.length ); //16-bit buffers
@@ -764,14 +758,15 @@ THREE.BufferGeometry.prototype = {
 
 
 		/* Move all attribute values to map to the new computed indices , also expand the vertice stack to match our new vertexPtr. */
 		/* Move all attribute values to map to the new computed indices , also expand the vertice stack to match our new vertexPtr. */
 		this.reorderBuffers( sortedIndices, revVertexMap, vertexPtr );
 		this.reorderBuffers( sortedIndices, revVertexMap, vertexPtr );
-		this.offsets = offsets;
+		this.offsets = offsets; // TODO: Deprecate
+		this.drawcalls = offsets;
 
 
 		/*
 		/*
 		var orderTime = Date.now();
 		var orderTime = Date.now();
-		console.log("Reorder time: "+(orderTime-s)+"ms");
-		console.log("Duplicated "+duplicatedVertices+" vertices.");
-		console.log("Compute Buffers time: "+(Date.now()-s)+"ms");
-		console.log("Draw offsets: "+offsets.length);
+		THREE.log("Reorder time: "+(orderTime-s)+"ms");
+		THREE.log("Duplicated "+duplicatedVertices+" vertices.");
+		THREE.log("Compute Buffers time: "+(Date.now()-s)+"ms");
+		THREE.log("Draw offsets: "+offsets.length);
 		*/
 		*/
 
 
 		return offsets;
 		return offsets;

+ 32 - 9
src/core/Geometry.js

@@ -154,9 +154,33 @@ THREE.Geometry.prototype = {
 
 
 		if ( indices !== undefined ) {
 		if ( indices !== undefined ) {
 
 
-			for ( var i = 0; i < indices.length; i += 3 ) {
+			var drawcalls = geometry.drawcalls;
 
 
-				addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
+			if ( drawcalls.length > 0 ) {
+
+				for ( var i = 0; i < drawcalls.length; i ++ ) {
+
+					var drawcall = drawcalls[ i ];
+
+					var start = drawcall.start;
+					var count = drawcall.count;
+					var index = drawcall.index;
+
+					for ( var j = start, jl = start + count; j < jl; j += 3 ) {
+
+						addFace( index + indices[ j ], index + indices[ j + 1 ], index + indices[ j + 2 ] );
+
+					}
+
+				}
+
+			} else {
+
+				for ( var i = 0; i < indices.length; i += 3 ) {
+
+					addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
+
+				}
 
 
 			}
 			}
 
 
@@ -241,9 +265,8 @@ THREE.Geometry.prototype = {
 			// vertex normals weighted by triangle areas
 			// vertex normals weighted by triangle areas
 			// http://www.iquilezles.org/www/articles/normals/normals.htm
 			// http://www.iquilezles.org/www/articles/normals/normals.htm
 
 
-			var vA, vB, vC, vD;
-			var cb = new THREE.Vector3(), ab = new THREE.Vector3(),
-				db = new THREE.Vector3(), dc = new THREE.Vector3(), bc = new THREE.Vector3();
+			var vA, vB, vC;
+			var cb = new THREE.Vector3(), ab = new THREE.Vector3();
 
 
 			for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
 			for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
 
 
@@ -417,7 +440,7 @@ THREE.Geometry.prototype = {
 		// based on http://www.terathon.com/code/tangent.html
 		// based on http://www.terathon.com/code/tangent.html
 		// tangents go to vertices
 		// tangents go to vertices
 
 
-		var f, fl, v, vl, i, il, vertexIndex,
+		var f, fl, v, vl, i, vertexIndex,
 			face, uv, vA, vB, vC, uvA, uvB, uvC,
 			face, uv, vA, vB, vC, uvA, uvB, uvC,
 			x1, x2, y1, y2, z1, z2,
 			x1, x2, y1, y2, z1, z2,
 			s1, s2, t1, t2, r, t, test,
 			s1, s2, t1, t2, r, t, test,
@@ -699,8 +722,8 @@ THREE.Geometry.prototype = {
 		var v, key;
 		var v, key;
 		var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
 		var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
 		var precision = Math.pow( 10, precisionPoints );
 		var precision = Math.pow( 10, precisionPoints );
-		var i,il, face;
-		var indices, k, j, jl, u;
+		var i, il, face;
+		var indices, j, jl;
 
 
 		for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
 		for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
 
 
@@ -715,7 +738,7 @@ THREE.Geometry.prototype = {
 
 
 			} else {
 			} else {
 
 
-				//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
+				//THREE.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
 				changes[ i ] = changes[ verticesMap[ key ] ];
 				changes[ i ] = changes[ verticesMap[ key ] ];
 
 
 			}
 			}

+ 1 - 3
src/core/Object3D.js

@@ -19,8 +19,6 @@ THREE.Object3D = function () {
 
 
 	this.up = THREE.Object3D.DefaultUp.clone();
 	this.up = THREE.Object3D.DefaultUp.clone();
 
 
-	var scope = this;
-
 	var position = new THREE.Vector3();
 	var position = new THREE.Vector3();
 	var rotation = new THREE.Euler();
 	var rotation = new THREE.Euler();
 	var quaternion = new THREE.Quaternion();
 	var quaternion = new THREE.Quaternion();
@@ -53,7 +51,7 @@ THREE.Object3D = function () {
 		scale: {
 		scale: {
 			enumerable: true,
 			enumerable: true,
 			value: scale
 			value: scale
-		},
+		}
 	} );
 	} );
 
 
 	this.rotationAutoUpdate = true;
 	this.rotationAutoUpdate = true;

+ 7 - 9
src/extras/FontUtils.js

@@ -56,7 +56,7 @@ THREE.FontUtils = {
 		ThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {};
 		ThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {};
 		ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;
 		ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;
 
 
-		var face = ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;
+		ThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;
 
 
 		return data;
 		return data;
 
 
@@ -64,11 +64,9 @@ THREE.FontUtils = {
 
 
 	drawText: function ( text ) {
 	drawText: function ( text ) {
 
 
-		var characterPts = [], allPts = [];
-
 		// RenderText
 		// RenderText
 
 
-		var i, p,
+		var i,
 			face = this.getFace(),
 			face = this.getFace(),
 			scale = this.size / face.resolution,
 			scale = this.size / face.resolution,
 			offset = 0,
 			offset = 0,
@@ -136,7 +134,7 @@ THREE.FontUtils = {
 
 
 				action = outline[ i ++ ];
 				action = outline[ i ++ ];
 
 
-				//console.log( action );
+				//THREE.log( action );
 
 
 				switch ( action ) {
 				switch ( action ) {
 
 
@@ -180,8 +178,8 @@ THREE.FontUtils = {
 						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {
 						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {
 
 
 							var t = i2 / divisions;
 							var t = i2 / divisions;
-							var tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
-							var ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );
+							THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
+							THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );
 						}
 						}
 
 
 					}
 					}
@@ -211,8 +209,8 @@ THREE.FontUtils = {
 						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {
 						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {
 
 
 							var t = i2 / divisions;
 							var t = i2 / divisions;
-							var tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );
-							var ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );
+							THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );
+							THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );
 
 
 						}
 						}
 
 

+ 223 - 220
src/extras/animation/Animation.js

@@ -21,383 +21,386 @@ THREE.Animation = function ( root, data ) {
 
 
 };
 };
 
 
+THREE.Animation.prototype = {
 
 
-THREE.Animation.prototype.keyTypes = [ "pos", "rot", "scl" ];
+	constructor: THREE.Animation,
 
 
+	keyTypes:  [ "pos", "rot", "scl" ],
 
 
-THREE.Animation.prototype.play = function ( startTime, weight ) {
+	play: function ( startTime, weight ) {
 
 
-	this.currentTime = startTime !== undefined ? startTime : 0;
-	this.weight = weight !== undefined ? weight : 1;
+		this.currentTime = startTime !== undefined ? startTime : 0;
+		this.weight = weight !== undefined ? weight : 1;
 
 
-	this.isPlaying = true;
+		this.isPlaying = true;
 
 
-	this.reset();
+		this.reset();
 
 
-	THREE.AnimationHandler.play( this );
+		THREE.AnimationHandler.play( this );
 
 
-};
+	},
 
 
+	stop: function() {
 
 
-THREE.Animation.prototype.stop = function() {
+		this.isPlaying = false;
 
 
-	this.isPlaying = false;
+		THREE.AnimationHandler.stop( this );
 
 
-	THREE.AnimationHandler.stop( this );
+	},
 
 
-};
+	reset: function () {
 
 
-THREE.Animation.prototype.reset = function () {
+		for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
 
 
-	for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
+			var object = this.hierarchy[ h ];
 
 
-		var object = this.hierarchy[ h ];
+			if ( object.animationCache === undefined ) {
 
 
-		if ( object.animationCache === undefined ) {
+				object.animationCache = {
+					animations: {},
+					blending: {
+						positionWeight: 0.0,
+						quaternionWeight: 0.0,
+						scaleWeight: 0.0
+					}
+				};
+			}
 
 
-			object.animationCache = {
-				animations: {},
-				blending: {
-					positionWeight: 0.0,
-					quaternionWeight: 0.0,
-					scaleWeight: 0.0
-				}
-			};
-		}
+			var name = this.data.name;
+			var animations = object.animationCache.animations;
+			var animationCache = animations[ name ];
 
 
-		if ( object.animationCache.animations[this.data.name] === undefined ) {
+			if ( animationCache === undefined ) {
 
 
-			object.animationCache.animations[this.data.name] = {};
-			object.animationCache.animations[this.data.name].prevKey = { pos: 0, rot: 0, scl: 0 };
-			object.animationCache.animations[this.data.name].nextKey = { pos: 0, rot: 0, scl: 0 };
-			object.animationCache.animations[this.data.name].originalMatrix = object.matrix;
+				animationCache = {
+					prevKey: { pos: 0, rot: 0, scl: 0 },
+					nextKey: { pos: 0, rot: 0, scl: 0 },
+					originalMatrix: object.matrix
+				};
 
 
-		}
+				animations[ name ] = animationCache;
 
 
-		var animationCache = object.animationCache.animations[this.data.name];
+			}
 
 
-		// Get keys to match our current time
+			// Get keys to match our current time
 
 
-		for ( var t = 0; t < 3; t ++ ) {
+			for ( var t = 0; t < 3; t ++ ) {
 
 
-			var type = this.keyTypes[ t ];
+				var type = this.keyTypes[ t ];
 
 
-			var prevKey = this.data.hierarchy[ h ].keys[ 0 ];
-			var nextKey = this.getNextKeyWith( type, h, 1 );
+				var prevKey = this.data.hierarchy[ h ].keys[ 0 ];
+				var nextKey = this.getNextKeyWith( type, h, 1 );
 
 
-			while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {
+				while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {
 
 
-				prevKey = nextKey;
-				nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
+					prevKey = nextKey;
+					nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
 
 
-			}
+				}
+
+				animationCache.prevKey[ type ] = prevKey;
+				animationCache.nextKey[ type ] = nextKey;
 
 
-			animationCache.prevKey[ type ] = prevKey;
-			animationCache.nextKey[ type ] = nextKey;
+			}
 
 
 		}
 		}
 
 
-	}
+	},
 
 
-};
+	resetBlendWeights: function () {
+
+		for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
 
 
-THREE.Animation.prototype.resetBlendWeights = function () {
+			var object = this.hierarchy[ h ];
+			var animationCache = object.animationCache;
 
 
-	for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
+			if ( animationCache !== undefined ) {
 
 
-		var object = this.hierarchy[ h ];
+				var blending = animationCache.blending;
 
 
-		if ( object.animationCache !== undefined ) {
+				blending.positionWeight = 0.0;
+				blending.quaternionWeight = 0.0;
+				blending.scaleWeight = 0.0;
 
 
-			object.animationCache.blending.positionWeight = 0.0;
-			object.animationCache.blending.quaternionWeight = 0.0;
-			object.animationCache.blending.scaleWeight = 0.0;
+			}
 
 
 		}
 		}
 
 
-	}
+	},
 
 
-};
+	update: ( function() {
 
 
-THREE.Animation.prototype.update = (function() {
+		var points = [];
+		var target = new THREE.Vector3();
+		var newVector = new THREE.Vector3();
+		var newQuat = new THREE.Quaternion();
 
 
-	var points = [];
-	var target = new THREE.Vector3();
-	var newVector = new THREE.Vector3();
-	var newQuat = new THREE.Quaternion();
+		// Catmull-Rom spline
 
 
-	// Catmull-Rom spline
+		var interpolateCatmullRom = function ( points, scale ) {
 
 
-	var interpolateCatmullRom = function ( points, scale ) {
+			var c = [], v3 = [],
+			point, intPoint, weight, w2, w3,
+			pa, pb, pc, pd;
 
 
-		var c = [], v3 = [],
-		point, intPoint, weight, w2, w3,
-		pa, pb, pc, pd;
+			point = ( points.length - 1 ) * scale;
+			intPoint = Math.floor( point );
+			weight = point - intPoint;
 
 
-		point = ( points.length - 1 ) * scale;
-		intPoint = Math.floor( point );
-		weight = point - intPoint;
+			c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
+			c[ 1 ] = intPoint;
+			c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
+			c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
 
 
-		c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
-		c[ 1 ] = intPoint;
-		c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
-		c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
+			pa = points[ c[ 0 ] ];
+			pb = points[ c[ 1 ] ];
+			pc = points[ c[ 2 ] ];
+			pd = points[ c[ 3 ] ];
 
 
-		pa = points[ c[ 0 ] ];
-		pb = points[ c[ 1 ] ];
-		pc = points[ c[ 2 ] ];
-		pd = points[ c[ 3 ] ];
+			w2 = weight * weight;
+			w3 = weight * w2;
 
 
-		w2 = weight * weight;
-		w3 = weight * w2;
+			v3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );
+			v3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );
+			v3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );
 
 
-		v3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );
-		v3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );
-		v3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );
+			return v3;
 
 
-		return v3;
+		};
 
 
-	};
+		var interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) {
 
 
-	var interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) {
+			var v0 = ( p2 - p0 ) * 0.5,
+				v1 = ( p3 - p1 ) * 0.5;
 
 
-		var v0 = ( p2 - p0 ) * 0.5,
-			v1 = ( p3 - p1 ) * 0.5;
+			return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;
 
 
-		return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;
+		};
 
 
-	};
+		return function ( delta ) {
 
 
-	return function ( delta ) {
+			if ( this.isPlaying === false ) return;
 
 
-		if ( this.isPlaying === false ) return;
+			this.currentTime += delta * this.timeScale;
 
 
-		this.currentTime += delta * this.timeScale;
+			if ( this.weight === 0 )
+				return;
 
 
-		if ( this.weight === 0 )
-			return;
+			//
 
 
-		//
+			var duration = this.data.length;
 
 
-		var duration = this.data.length;
+			if ( this.currentTime > duration || this.currentTime < 0 ) {
 
 
-		if ( this.currentTime > duration || this.currentTime < 0 ) {
+				if ( this.loop ) {
 
 
-			if ( this.loop ) {
+					this.currentTime %= duration;
 
 
-				this.currentTime %= duration;
+					if ( this.currentTime < 0 )
+						this.currentTime += duration;
 
 
-				if ( this.currentTime < 0 )
-					this.currentTime += duration;
+					this.reset();
 
 
-				this.reset();
+				} else {
 
 
-			} else {
+					this.stop();
 
 
-				this.stop();
+				}
 
 
 			}
 			}
 
 
-		}
+			for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
 
 
-		for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
+				var object = this.hierarchy[ h ];
+				var animationCache = object.animationCache.animations[this.data.name];
+				var blending = object.animationCache.blending;
 
 
-			var object = this.hierarchy[ h ];
-			var animationCache = object.animationCache.animations[this.data.name];
-			var blending = object.animationCache.blending;
+				// loop through pos/rot/scl
 
 
-			// loop through pos/rot/scl
+				for ( var t = 0; t < 3; t ++ ) {
 
 
-			for ( var t = 0; t < 3; t ++ ) {
+					// get keys
 
 
-				// get keys
+					var type    = this.keyTypes[ t ];
+					var prevKey = animationCache.prevKey[ type ];
+					var nextKey = animationCache.nextKey[ type ];
 
 
-				var type    = this.keyTypes[ t ];
-				var prevKey = animationCache.prevKey[ type ];
-				var nextKey = animationCache.nextKey[ type ];
+					if ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) ||
+						( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) {
 
 
-				if ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) ||
-					( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) {
+						prevKey = this.data.hierarchy[ h ].keys[ 0 ];
+						nextKey = this.getNextKeyWith( type, h, 1 );
 
 
-					prevKey = this.data.hierarchy[ h ].keys[ 0 ];
-					nextKey = this.getNextKeyWith( type, h, 1 );
+						while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {
 
 
-					while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {
+							prevKey = nextKey;
+							nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
 
 
-						prevKey = nextKey;
-						nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
+						}
+
+						animationCache.prevKey[ type ] = prevKey;
+						animationCache.nextKey[ type ] = nextKey;
 
 
 					}
 					}
 
 
-					animationCache.prevKey[ type ] = prevKey;
-					animationCache.nextKey[ type ] = nextKey;
+					var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );
 
 
-				}
+					var prevXYZ = prevKey[ type ];
+					var nextXYZ = nextKey[ type ];
 
 
-				var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );
+					if ( scale < 0 ) scale = 0;
+					if ( scale > 1 ) scale = 1;
 
 
-				var prevXYZ = prevKey[ type ];
-				var nextXYZ = nextKey[ type ];
+					// interpolate
 
 
-				if ( scale < 0 ) scale = 0;
-				if ( scale > 1 ) scale = 1;
+					if ( type === "pos" ) {
 
 
-				// interpolate
+						if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) {
 
 
-				if ( type === "pos" ) {
+							newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
+							newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
+							newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
 
 
-					if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) {
+							// blend
+							var proportionalWeight = this.weight / ( this.weight + blending.positionWeight );
+							object.position.lerp( newVector, proportionalWeight );
+							blending.positionWeight += this.weight;
 
 
-						newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
-						newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
-						newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
+						} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
+									this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 
 
-						// blend
-						var proportionalWeight = this.weight / ( this.weight + blending.positionWeight );
-						object.position.lerp( newVector, proportionalWeight );
-						blending.positionWeight += this.weight;
+							points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ];
+							points[ 1 ] = prevXYZ;
+							points[ 2 ] = nextXYZ;
+							points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ];
 
 
-					} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
-								this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
+							scale = scale * 0.33 + 0.33;
 
 
-						points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ];
-						points[ 1 ] = prevXYZ;
-						points[ 2 ] = nextXYZ;
-						points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ];
+							var currentPoint = interpolateCatmullRom( points, scale );
+							var proportionalWeight = this.weight / ( this.weight + blending.positionWeight );
+							blending.positionWeight += this.weight;
 
 
-						scale = scale * 0.33 + 0.33;
+							// blend
 
 
-						var currentPoint = interpolateCatmullRom( points, scale );
-						var proportionalWeight = this.weight / ( this.weight + blending.positionWeight );
-						blending.positionWeight += this.weight;
+							var vector = object.position;
 
 
-						// blend
+							vector.x = vector.x + ( currentPoint[ 0 ] - vector.x ) * proportionalWeight;
+							vector.y = vector.y + ( currentPoint[ 1 ] - vector.y ) * proportionalWeight;
+							vector.z = vector.z + ( currentPoint[ 2 ] - vector.z ) * proportionalWeight;
 
 
-						var vector = object.position;
-						
-						vector.x = vector.x + ( currentPoint[ 0 ] - vector.x ) * proportionalWeight;
-						vector.y = vector.y + ( currentPoint[ 1 ] - vector.y ) * proportionalWeight;
-						vector.z = vector.z + ( currentPoint[ 2 ] - vector.z ) * proportionalWeight;
+							if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 
 
-						if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
+								var forwardPoint = interpolateCatmullRom( points, scale * 1.01 );
 
 
-							var forwardPoint = interpolateCatmullRom( points, scale * 1.01 );
+								target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );
+								target.sub( vector );
+								target.y = 0;
+								target.normalize();
 
 
-							target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );
-							target.sub( vector );
-							target.y = 0;
-							target.normalize();
+								var angle = Math.atan2( target.x, target.z );
+								object.rotation.set( 0, angle, 0 );
 
 
-							var angle = Math.atan2( target.x, target.z );
-							object.rotation.set( 0, angle, 0 );
+							}
 
 
 						}
 						}
 
 
-					}
+					} else if ( type === "rot" ) {
 
 
-				} else if ( type === "rot" ) {
+						THREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale );
 
 
-					THREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale );
+						// Avoid paying the cost of an additional slerp if we don't have to
+						if ( blending.quaternionWeight === 0 ) {
 
 
-					// Avoid paying the cost of an additional slerp if we don't have to
-					if ( blending.quaternionWeight === 0 ) {
+							object.quaternion.copy(newQuat);
+							blending.quaternionWeight = this.weight;
 
 
-						object.quaternion.copy(newQuat);
-						blending.quaternionWeight = this.weight;
+						} else {
 
 
-					} else {
+							var proportionalWeight = this.weight / ( this.weight + blending.quaternionWeight );
+							THREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight );
+							blending.quaternionWeight += this.weight;
 
 
-						var proportionalWeight = this.weight / ( this.weight + blending.quaternionWeight );
-						THREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight );
-						blending.quaternionWeight += this.weight;
+						}
 
 
-					}
+					} else if ( type === "scl" ) {
 
 
-				} else if ( type === "scl" ) {
+						newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
+						newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
+						newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
 
 
-					newVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
-					newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
-					newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
+						var proportionalWeight = this.weight / ( this.weight + blending.scaleWeight );
+						object.scale.lerp( newVector, proportionalWeight );
+						blending.scaleWeight += this.weight;
 
 
-					var proportionalWeight = this.weight / ( this.weight + blending.scaleWeight );
-					object.scale.lerp( newVector, proportionalWeight );
-					blending.scaleWeight += this.weight;
+					}
 
 
 				}
 				}
 
 
 			}
 			}
 
 
-		}
-
-		return true;
-
-	};
+			return true;
 
 
-})();
+		};
 
 
+	} )(),
 
 
+	getNextKeyWith: function ( type, h, key ) {
 
 
+		var keys = this.data.hierarchy[ h ].keys;
 
 
+		if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
+			 this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 
 
-// Get next key with
+			key = key < keys.length - 1 ? key : keys.length - 1;
 
 
-THREE.Animation.prototype.getNextKeyWith = function ( type, h, key ) {
+		} else {
 
 
-	var keys = this.data.hierarchy[ h ].keys;
+			key = key % keys.length;
 
 
-	if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
-		 this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
-
-		key = key < keys.length - 1 ? key : keys.length - 1;
-
-	} else {
+		}
 
 
-		key = key % keys.length;
+		for ( ; key < keys.length; key ++ ) {
 
 
-	}
+			if ( keys[ key ][ type ] !== undefined ) {
 
 
-	for ( ; key < keys.length; key ++ ) {
+				return keys[ key ];
 
 
-		if ( keys[ key ][ type ] !== undefined ) {
-
-			return keys[ key ];
+			}
 
 
 		}
 		}
 
 
-	}
-
-	return this.data.hierarchy[ h ].keys[ 0 ];
+		return this.data.hierarchy[ h ].keys[ 0 ];
 
 
-};
+	},
 
 
-// Get previous key with
+	getPrevKeyWith: function ( type, h, key ) {
 
 
-THREE.Animation.prototype.getPrevKeyWith = function ( type, h, key ) {
+		var keys = this.data.hierarchy[ h ].keys;
 
 
-	var keys = this.data.hierarchy[ h ].keys;
+		if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
+			this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 
 
-	if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
-		this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
+			key = key > 0 ? key : 0;
 
 
-		key = key > 0 ? key : 0;
+		} else {
 
 
-	} else {
+			key = key >= 0 ? key : key + keys.length;
 
 
-		key = key >= 0 ? key : key + keys.length;
+		}
 
 
-	}
 
 
+		for ( ; key >= 0; key -- ) {
 
 
-	for ( ; key >= 0; key -- ) {
+			if ( keys[ key ][ type ] !== undefined ) {
 
 
-		if ( keys[ key ][ type ] !== undefined ) {
+				return keys[ key ];
 
 
-			return keys[ key ];
+			}
 
 
 		}
 		}
 
 
-	}
+		return this.data.hierarchy[ h ].keys[ keys.length - 1 ];
 
 
-	return this.data.hierarchy[ h ].keys[ keys.length - 1 ];
+	}
 
 
 };
 };

+ 98 - 101
src/extras/animation/KeyFrameAnimation.js

@@ -50,195 +50,192 @@ THREE.KeyFrameAnimation = function ( data ) {
 
 
 };
 };
 
 
+THREE.KeyFrameAnimation.prototype = {
 
 
-THREE.KeyFrameAnimation.prototype.play = function ( startTime ) {
+	constructor: THREE.KeyFrameAnimation,
 
 
-	this.currentTime = startTime !== undefined ? startTime : 0;
+	play: function ( startTime ) {
 
 
-	if ( this.isPlaying === false ) {
+		this.currentTime = startTime !== undefined ? startTime : 0;
 
 
-		this.isPlaying = true;
+		if ( this.isPlaying === false ) {
 
 
-		// reset key cache
+			this.isPlaying = true;
 
 
-		var h, hl = this.hierarchy.length,
-			object,
-			node;
+			// reset key cache
 
 
-		for ( h = 0; h < hl; h ++ ) {
+			var h, hl = this.hierarchy.length,
+				object,
+				node;
 
 
-			object = this.hierarchy[ h ];
-			node = this.data.hierarchy[ h ];
+			for ( h = 0; h < hl; h ++ ) {
 
 
-			if ( node.animationCache === undefined ) {
+				object = this.hierarchy[ h ];
+				node = this.data.hierarchy[ h ];
 
 
-				node.animationCache = {};
-				node.animationCache.prevKey = null;
-				node.animationCache.nextKey = null;
-				node.animationCache.originalMatrix = object.matrix;
+				if ( node.animationCache === undefined ) {
 
 
-			}
+					node.animationCache = {};
+					node.animationCache.prevKey = null;
+					node.animationCache.nextKey = null;
+					node.animationCache.originalMatrix = object.matrix;
+
+				}
+
+				var keys = this.data.hierarchy[h].keys;
 
 
-			var keys = this.data.hierarchy[h].keys;
+				if (keys.length) {
 
 
-			if (keys.length) {
+					node.animationCache.prevKey = keys[ 0 ];
+					node.animationCache.nextKey = keys[ 1 ];
 
 
-				node.animationCache.prevKey = keys[ 0 ];
-				node.animationCache.nextKey = keys[ 1 ];
+					this.startTime = Math.min( keys[0].time, this.startTime );
+					this.endTime = Math.max( keys[keys.length - 1].time, this.endTime );
 
 
-				this.startTime = Math.min( keys[0].time, this.startTime );
-				this.endTime = Math.max( keys[keys.length - 1].time, this.endTime );
+				}
 
 
 			}
 			}
 
 
+			this.update( 0 );
+
 		}
 		}
 
 
-		this.update( 0 );
+		this.isPaused = false;
 
 
-	}
+		THREE.AnimationHandler.play( this );
 
 
-	this.isPaused = false;
+	},
 
 
-	THREE.AnimationHandler.play( this );
+	stop: function () {
 
 
-};
+		this.isPlaying = false;
+		this.isPaused  = false;
 
 
+		THREE.AnimationHandler.stop( this );
 
 
-THREE.KeyFrameAnimation.prototype.stop = function() {
+		// reset JIT matrix and remove cache
 
 
-	this.isPlaying = false;
-	this.isPaused  = false;
-
-	THREE.AnimationHandler.stop( this );
+		for ( var h = 0; h < this.data.hierarchy.length; h ++ ) {
 
 
-	// reset JIT matrix and remove cache
+			var obj = this.hierarchy[ h ];
+			var node = this.data.hierarchy[ h ];
 
 
-	for ( var h = 0; h < this.data.hierarchy.length; h ++ ) {
-		
-		var obj = this.hierarchy[ h ];
-		var node = this.data.hierarchy[ h ];
+			if ( node.animationCache !== undefined ) {
 
 
-		if ( node.animationCache !== undefined ) {
+				var original = node.animationCache.originalMatrix;
 
 
-			var original = node.animationCache.originalMatrix;
+				original.copy( obj.matrix );
+				obj.matrix = original;
 
 
-			original.copy( obj.matrix );
-			obj.matrix = original;
+				delete node.animationCache;
 
 
-			delete node.animationCache;
+			}
 
 
 		}
 		}
 
 
-	}
-
-};
+	},
 
 
+	update: function ( delta ) {
 
 
-// Update
+		if ( this.isPlaying === false ) return;
 
 
-THREE.KeyFrameAnimation.prototype.update = function ( delta ) {
+		this.currentTime += delta * this.timeScale;
 
 
-	if ( this.isPlaying === false ) return;
+		//
 
 
-	this.currentTime += delta * this.timeScale;
+		var duration = this.data.length;
 
 
-	//
+		if ( this.loop === true && this.currentTime > duration ) {
 
 
-	var duration = this.data.length;
+			this.currentTime %= duration;
 
 
-	if ( this.loop === true && this.currentTime > duration ) {
+		}
 
 
-		this.currentTime %= duration;
+		this.currentTime = Math.min( this.currentTime, duration );
 
 
-	}
+		for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
 
 
-	this.currentTime = Math.min( this.currentTime, duration );
+			var object = this.hierarchy[ h ];
+			var node = this.data.hierarchy[ h ];
 
 
-	for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
+			var keys = node.keys,
+				animationCache = node.animationCache;
 
 
-		var object = this.hierarchy[ h ];
-		var node = this.data.hierarchy[ h ];
 
 
-		var keys = node.keys,
-			animationCache = node.animationCache;
+			if ( keys.length ) {
 
 
+				var prevKey = animationCache.prevKey;
+				var nextKey = animationCache.nextKey;
 
 
-		if ( keys.length ) {
+				if ( nextKey.time <= this.currentTime ) {
 
 
-			var prevKey = animationCache.prevKey;
-			var nextKey = animationCache.nextKey;
+					while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {
 
 
-			if ( nextKey.time <= this.currentTime ) {
+						prevKey = nextKey;
+						nextKey = keys[ prevKey.index + 1 ];
 
 
-				while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {
+					}
 
 
-					prevKey = nextKey;
-					nextKey = keys[ prevKey.index + 1 ];
+					animationCache.prevKey = prevKey;
+					animationCache.nextKey = nextKey;
 
 
 				}
 				}
 
 
-				animationCache.prevKey = prevKey;
-				animationCache.nextKey = nextKey;
+				if ( nextKey.time >= this.currentTime ) {
 
 
-			}
+					prevKey.interpolate( nextKey, this.currentTime );
 
 
-			if ( nextKey.time >= this.currentTime ) {
+				} else {
 
 
-				prevKey.interpolate( nextKey, this.currentTime );
+					prevKey.interpolate( nextKey, nextKey.time );
 
 
-			} else {
+				}
 
 
-				prevKey.interpolate( nextKey, nextKey.time );
+				this.data.hierarchy[ h ].node.updateMatrix();
+				object.matrixWorldNeedsUpdate = true;
 
 
 			}
 			}
 
 
-			this.data.hierarchy[ h ].node.updateMatrix();
-			object.matrixWorldNeedsUpdate = true;
-
 		}
 		}
 
 
-	}
-
-};
+	},
 
 
-// Get next key with
+	getNextKeyWith: function ( sid, h, key ) {
 
 
-THREE.KeyFrameAnimation.prototype.getNextKeyWith = function( sid, h, key ) {
+		var keys = this.data.hierarchy[ h ].keys;
+		key = key % keys.length;
 
 
-	var keys = this.data.hierarchy[ h ].keys;
-	key = key % keys.length;
+		for ( ; key < keys.length; key ++ ) {
 
 
-	for ( ; key < keys.length; key ++ ) {
+			if ( keys[ key ].hasTarget( sid ) ) {
 
 
-		if ( keys[ key ].hasTarget( sid ) ) {
+				return keys[ key ];
 
 
-			return keys[ key ];
+			}
 
 
 		}
 		}
 
 
-	}
-
-	return keys[ 0 ];
+		return keys[ 0 ];
 
 
-};
+	},
 
 
-// Get previous key with
+	getPrevKeyWith: function ( sid, h, key ) {
 
 
-THREE.KeyFrameAnimation.prototype.getPrevKeyWith = function( sid, h, key ) {
+		var keys = this.data.hierarchy[ h ].keys;
+		key = key >= 0 ? key : key + keys.length;
 
 
-	var keys = this.data.hierarchy[ h ].keys;
-	key = key >= 0 ? key : key + keys.length;
+		for ( ; key >= 0; key -- ) {
 
 
-	for ( ; key >= 0; key -- ) {
+			if ( keys[ key ].hasTarget( sid ) ) {
 
 
-		if ( keys[ key ].hasTarget( sid ) ) {
+				return keys[ key ];
 
 
-			return keys[ key ];
+			}
 
 
 		}
 		}
 
 
-	}
+		return keys[ keys.length - 1 ];
 
 
-	return keys[ keys.length - 1 ];
+	}
 
 
 };
 };

+ 7 - 5
src/extras/animation/MorphAnimation.js

@@ -50,19 +50,21 @@ THREE.MorphAnimation.prototype = {
 		var interpolation = this.duration / this.frames;
 		var interpolation = this.duration / this.frames;
 		var frame = Math.floor( this.currentTime / interpolation );
 		var frame = Math.floor( this.currentTime / interpolation );
 
 
+		var influences = this.mesh.morphTargetInfluences;
+
 		if ( frame != this.currentFrame ) {
 		if ( frame != this.currentFrame ) {
 
 
-			this.mesh.morphTargetInfluences[ this.lastFrame ] = 0;
-			this.mesh.morphTargetInfluences[ this.currentFrame ] = 1;
-			this.mesh.morphTargetInfluences[ frame ] = 0;
+			influences[ this.lastFrame ] = 0;
+			influences[ this.currentFrame ] = 1;
+			influences[ frame ] = 0;
 
 
 			this.lastFrame = this.currentFrame;
 			this.lastFrame = this.currentFrame;
 			this.currentFrame = frame;
 			this.currentFrame = frame;
 
 
 		}
 		}
 
 
-		this.mesh.morphTargetInfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
-		this.mesh.morphTargetInfluences[ this.lastFrame ] = 1 - this.mesh.morphTargetInfluences[ frame ];
+		influences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
+		influences[ this.lastFrame ] = 1 - influences[ frame ];
 
 
 	}
 	}
 
 

+ 57 - 2
src/extras/audio/Audio.js

@@ -10,6 +10,7 @@ THREE.Audio = function ( listener ) {
 
 
 	this.context = listener.context;
 	this.context = listener.context;
 	this.source = this.context.createBufferSource();
 	this.source = this.context.createBufferSource();
+	this.source.onended = this.onEnded.bind(this);
 
 
 	this.gain = this.context.createGain();
 	this.gain = this.context.createGain();
 	this.gain.connect( this.context.destination );
 	this.gain.connect( this.context.destination );
@@ -17,6 +18,11 @@ THREE.Audio = function ( listener ) {
 	this.panner = this.context.createPanner();
 	this.panner = this.context.createPanner();
 	this.panner.connect( this.gain );
 	this.panner.connect( this.gain );
 
 
+	this.autoplay = false;
+
+	this.startTime = 0;
+	this.isPlaying = false;
+
 };
 };
 
 
 THREE.Audio.prototype = Object.create( THREE.Object3D.prototype );
 THREE.Audio.prototype = Object.create( THREE.Object3D.prototype );
@@ -34,8 +40,8 @@ THREE.Audio.prototype.load = function ( file ) {
 		scope.context.decodeAudioData( this.response, function ( buffer ) {
 		scope.context.decodeAudioData( this.response, function ( buffer ) {
 
 
 			scope.source.buffer = buffer;
 			scope.source.buffer = buffer;
-			scope.source.connect( scope.panner );
-			scope.source.start( 0 );
+
+			if( scope.autoplay ) scope.play();
 
 
 		} );
 		} );
 
 
@@ -46,6 +52,49 @@ THREE.Audio.prototype.load = function ( file ) {
 
 
 };
 };
 
 
+THREE.Audio.prototype.play = function () {
+
+	if ( this.isPlaying === true ) {
+
+		THREE.warn( 'THREE.Audio: Audio is already playing.' );
+		return;
+
+	}
+
+	var source = this.context.createBufferSource();
+
+	source.buffer = this.source.buffer;
+	source.loop = this.source.loop;
+	source.onended = this.source.onended;
+	source.connect( this.panner );
+	source.start( 0, this.startTime );
+
+	this.isPlaying = true;
+
+	this.source = source;
+
+};
+
+THREE.Audio.prototype.pause = function () {
+
+	this.source.stop();
+	this.startTime = this.context.currentTime;
+
+};
+
+THREE.Audio.prototype.stop = function () {
+
+	this.source.stop();
+	this.startTime = 0;
+
+};
+
+THREE.Audio.prototype.onEnded = function() {
+
+	this.isPlaying = false;
+
+};
+
 THREE.Audio.prototype.setLoop = function ( value ) {
 THREE.Audio.prototype.setLoop = function ( value ) {
 
 
 	this.source.loop = value;
 	this.source.loop = value;
@@ -64,6 +113,12 @@ THREE.Audio.prototype.setRolloffFactor = function ( value ) {
 
 
 };
 };
 
 
+THREE.Audio.prototype.setVolume = function ( value ) {
+
+	this.gain.gain.value = value;
+
+};
+
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
 
 
 	var position = new THREE.Vector3();
 	var position = new THREE.Vector3();

+ 0 - 7
src/extras/audio/AudioListener.js

@@ -22,9 +22,6 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 	var scale = new THREE.Vector3();
 	var scale = new THREE.Vector3();
 
 
 	var orientation = new THREE.Vector3();
 	var orientation = new THREE.Vector3();
-	var velocity = new THREE.Vector3();
-
-	var positionPrev = new THREE.Vector3();
 
 
 	return function ( force ) {
 	return function ( force ) {
 
 
@@ -36,13 +33,9 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 		this.matrixWorld.decompose( position, quaternion, scale );
 		this.matrixWorld.decompose( position, quaternion, scale );
 
 
 		orientation.set( 0, 0, -1 ).applyQuaternion( quaternion );
 		orientation.set( 0, 0, -1 ).applyQuaternion( quaternion );
-		velocity.subVectors( position, positionPrev );
 
 
 		listener.setPosition( position.x, position.y, position.z );
 		listener.setPosition( position.x, position.y, position.z );
 		listener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z );
 		listener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z );
-		listener.setVelocity( velocity.x, velocity.y, velocity.z );
-
-		positionPrev.copy( position );
 
 
 	};
 	};
 
 

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

@@ -113,7 +113,7 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
 		&& ( this.cacheArcLengths.length == divisions + 1 )
 		&& ( this.cacheArcLengths.length == divisions + 1 )
 		&& ! this.needsUpdate) {
 		&& ! this.needsUpdate) {
 
 
-		//console.log( "cached", this.cacheArcLengths );
+		//THREE.log( "cached", this.cacheArcLengths );
 		return this.cacheArcLengths;
 		return this.cacheArcLengths;
 
 
 	}
 	}
@@ -200,7 +200,7 @@ THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
 
 
 	i = high;
 	i = high;
 
 
-	//console.log('b' , i, low, high, Date.now()- time);
+	//THREE.log('b' , i, low, high, Date.now()- time);
 
 
 	if ( arcLengths[ i ] == targetArcLength ) {
 	if ( arcLengths[ i ] == targetArcLength ) {
 
 

+ 13 - 14
src/extras/core/Path.js

@@ -208,7 +208,7 @@ THREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) {
 THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 
 	if (this.useSpacedPoints) {
 	if (this.useSpacedPoints) {
-		console.log('tata');
+		THREE.log('tata');
 		return this.getSpacedPoints( divisions, closedPath );
 		return this.getSpacedPoints( divisions, closedPath );
 	}
 	}
 
 
@@ -367,13 +367,13 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 				tx = aX + aRadius * Math.cos( angle );
 				tx = aX + aRadius * Math.cos( angle );
 				ty = aY + aRadius * Math.sin( angle );
 				ty = aY + aRadius * Math.sin( angle );
 
 
-				//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
+				//THREE.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
 
 
 				points.push( new THREE.Vector2( tx, ty ) );
 				points.push( new THREE.Vector2( tx, ty ) );
 
 
 			}
 			}
 
 
-			//console.log(points);
+			//THREE.log(points);
 
 
 			break;
 			break;
 		  
 		  
@@ -405,13 +405,13 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 				tx = aX + xRadius * Math.cos( angle );
 				tx = aX + xRadius * Math.cos( angle );
 				ty = aY + yRadius * Math.sin( angle );
 				ty = aY + yRadius * Math.sin( angle );
 
 
-				//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
+				//THREE.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
 
 
 				points.push( new THREE.Vector2( tx, ty ) );
 				points.push( new THREE.Vector2( tx, ty ) );
 
 
 			}
 			}
 
 
-			//console.log(points);
+			//THREE.log(points);
 
 
 			break;
 			break;
 
 
@@ -485,7 +485,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 
 
 		}
 		}
 
 
-		// console.log(subPaths);
+		// THREE.log(subPaths);
 
 
 		return	subPaths;
 		return	subPaths;
 	}
 	}
@@ -505,7 +505,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 			shapes.push( tmpShape );
 			shapes.push( tmpShape );
 		}
 		}
 
 
-		//console.log("shape", shapes);
+		//THREE.log("shape", shapes);
 
 
 		return shapes;
 		return shapes;
 	};
 	};
@@ -578,7 +578,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 	var holesFirst = ! THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() );
 	var holesFirst = ! THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() );
 	holesFirst = isCCW ? ! holesFirst : holesFirst;
 	holesFirst = isCCW ? ! holesFirst : holesFirst;
 
 
-	// console.log("Holes first", holesFirst);
+	// THREE.log("Holes first", holesFirst);
 	
 	
 	var betterShapeHoles = [];
 	var betterShapeHoles = [];
 	var newShapes = [];
 	var newShapes = [];
@@ -609,13 +609,13 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 			if ( holesFirst )	mainIdx ++;
 			if ( holesFirst )	mainIdx ++;
 			newShapeHoles[mainIdx] = [];
 			newShapeHoles[mainIdx] = [];
 
 
-			//console.log('cw', i);
+			//THREE.log('cw', i);
 
 
 		} else {
 		} else {
 
 
 			newShapeHoles[mainIdx].push( { h: tmpPath, p: tmpPoints[0] } );
 			newShapeHoles[mainIdx].push( { h: tmpPath, p: tmpPoints[0] } );
 
 
-			//console.log('ccw', i);
+			//THREE.log('ccw', i);
 
 
 		}
 		}
 
 
@@ -633,7 +633,6 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 			betterShapeHoles[sIdx] = [];
 			betterShapeHoles[sIdx] = [];
 		}
 		}
 		for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
 		for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
-			var sh = newShapes[sIdx];
 			var sho = newShapeHoles[sIdx];
 			var sho = newShapeHoles[sIdx];
 			for (var hIdx = 0; hIdx < sho.length; hIdx ++ ) {
 			for (var hIdx = 0; hIdx < sho.length; hIdx ++ ) {
 				var ho = sho[hIdx];
 				var ho = sho[hIdx];
@@ -652,9 +651,9 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 				if ( hole_unassigned ) { betterShapeHoles[sIdx].push( ho ); }
 				if ( hole_unassigned ) { betterShapeHoles[sIdx].push( ho ); }
 			}
 			}
 		}
 		}
-		// console.log("ambigious: ", ambigious);
+		// THREE.log("ambigious: ", ambigious);
 		if ( toChange.length > 0 ) {
 		if ( toChange.length > 0 ) {
-			// console.log("to change: ", toChange);
+			// THREE.log("to change: ", toChange);
 			if (! ambigious)	newShapeHoles = betterShapeHoles;
 			if (! ambigious)	newShapeHoles = betterShapeHoles;
 		}
 		}
 	}
 	}
@@ -669,7 +668,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 		}
 		}
 	}
 	}
 
 
-	//console.log("shape", shapes);
+	//THREE.log("shape", shapes);
 
 
 	return shapes;
 	return shapes;
 
 

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

@@ -284,7 +284,7 @@ THREE.Shape.Utils = {
 			if ( Math.abs(from2toAngle) > EPSILON ) {			// angle != 180 deg.
 			if ( Math.abs(from2toAngle) > EPSILON ) {			// angle != 180 deg.
 
 
 				var other2toAngle		= otherPtX * legToPtY - otherPtY * legToPtX;
 				var other2toAngle		= otherPtX * legToPtY - otherPtY * legToPtX;
-				// console.log( "from2to: " + from2toAngle + ", from2other: " + from2otherAngle + ", other2to: " + other2toAngle );
+				// THREE.log( "from2to: " + from2toAngle + ", from2other: " + from2otherAngle + ", other2to: " + other2toAngle );
 
 
 				if ( from2toAngle > 0 ) {				// main angle < 180 deg.
 				if ( from2toAngle > 0 ) {				// main angle < 180 deg.
 					return	( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) );
 					return	( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) );
@@ -292,7 +292,7 @@ THREE.Shape.Utils = {
 					return	( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) );
 					return	( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) );
 				}
 				}
 			} else {										// angle == 180 deg.
 			} else {										// angle == 180 deg.
-				// console.log( "from2to: 180 deg., from2other: " + from2otherAngle  );
+				// THREE.log( "from2to: 180 deg., from2other: " + from2otherAngle  );
 				return	( from2otherAngle > 0 );
 				return	( from2otherAngle > 0 );
 			}
 			}
 		}
 		}
@@ -315,7 +315,7 @@ THREE.Shape.Utils = {
 
 
 				var insideAngle = isPointInsideAngle( shape[inShapeIdx], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[inHoleIdx] );
 				var insideAngle = isPointInsideAngle( shape[inShapeIdx], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[inHoleIdx] );
 				if (! insideAngle ) {
 				if (! insideAngle ) {
-					// console.log( "Vertex (Shape): " + inShapeIdx + ", Point: " + hole[inHoleIdx].x + "/" + hole[inHoleIdx].y );
+					// THREE.log( "Vertex (Shape): " + inShapeIdx + ", Point: " + hole[inHoleIdx].x + "/" + hole[inHoleIdx].y );
 					return	false;
 					return	false;
 				}
 				}
 
 
@@ -330,7 +330,7 @@ THREE.Shape.Utils = {
 
 
 				insideAngle = isPointInsideAngle( hole[inHoleIdx], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[inShapeIdx] );
 				insideAngle = isPointInsideAngle( hole[inHoleIdx], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[inShapeIdx] );
 				if (! insideAngle ) {
 				if (! insideAngle ) {
-					// console.log( "Vertex (Hole): " + inHoleIdx + ", Point: " + shape[inShapeIdx].x + "/" + shape[inShapeIdx].y );
+					// THREE.log( "Vertex (Hole): " + inHoleIdx + ", Point: " + shape[inShapeIdx].x + "/" + shape[inShapeIdx].y );
 					return	false;
 					return	false;
 				}
 				}
 
 
@@ -383,7 +383,7 @@ THREE.Shape.Utils = {
 			while ( indepHoles.length > 0 ) {
 			while ( indepHoles.length > 0 ) {
 				counter --;
 				counter --;
 				if ( counter < 0 ) {
 				if ( counter < 0 ) {
-					console.log( "Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!" );
+					THREE.log( "Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!" );
 					break;
 					break;
 				}
 				}
 
 
@@ -452,7 +452,7 @@ THREE.Shape.Utils = {
 
 
 		}
 		}
 
 
-		//console.log( "allpoints",allpoints, allpoints.length );
+		//THREE.log( "allpoints",allpoints, allpoints.length );
 
 
 		// prepare all points map
 		// prepare all points map
 
 
@@ -474,7 +474,7 @@ THREE.Shape.Utils = {
 		var shapeWithoutHoles = removeHoles( contour, holes );
 		var shapeWithoutHoles = removeHoles( contour, holes );
 
 
 		var triangles = THREE.FontUtils.Triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape
 		var triangles = THREE.FontUtils.Triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape
-		//console.log( "triangles",triangles, triangles.length );
+		//THREE.log( "triangles",triangles, triangles.length );
 
 
 		// check all face vertices against all points map
 		// check all face vertices against all points map
 
 

+ 2 - 0
src/extras/geometries/BoxGeometry.js

@@ -125,3 +125,5 @@ THREE.BoxGeometry = function ( width, height, depth, widthSegments, heightSegmen
 
 
 THREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype );
 THREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype );
 THREE.BoxGeometry.prototype.constructor = THREE.BoxGeometry;
 THREE.BoxGeometry.prototype.constructor = THREE.BoxGeometry;
+
+THREE.CubeGeometry = THREE.BoxGeometry; // backwards compatibility

+ 0 - 11
src/extras/geometries/CubeGeometry.js

@@ -1,11 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-
-THREE.CubeGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) {
-
-	THREE.warn( 'THREE.CubeGeometry has been renamed to THREE.BoxGeometry.' );
-	return new THREE.BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );
-
- };

+ 7 - 15
src/extras/geometries/ExtrudeGeometry.js

@@ -47,7 +47,7 @@ THREE.ExtrudeGeometry = function ( shapes, options ) {
 
 
 	//this.computeVertexNormals();
 	//this.computeVertexNormals();
 
 
-	//console.log( "took", ( Date.now() - startTime ) );
+	//THREE.log( "took", ( Date.now() - startTime ) );
 
 
 };
 };
 
 
@@ -101,7 +101,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 
 
 		splineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);
 		splineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);
 
 
-		// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
+		// THREE.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
 
 
 		binormal = new THREE.Vector3();
 		binormal = new THREE.Vector3();
 		normal = new THREE.Vector3();
 		normal = new THREE.Vector3();
@@ -123,7 +123,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 
 
 	var ahole, h, hl; // looping of holes
 	var ahole, h, hl; // looping of holes
 	var scope = this;
 	var scope = this;
-	var bevelPoints = [];
 
 
 	var shapesOffset = this.vertices.length;
 	var shapesOffset = this.vertices.length;
 
 
@@ -182,14 +181,11 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 
 
 	var b, bs, t, z,
 	var b, bs, t, z,
 		vert, vlen = vertices.length,
 		vert, vlen = vertices.length,
-		face, flen = faces.length,
-		cont, clen = contour.length;
+		face, flen = faces.length;
 
 
 
 
 	// Find directions for point movement
 	// Find directions for point movement
 
 
-	var RAD_TO_DEGREES = 180 / Math.PI;
-
 
 
 	function getBevelVec( inPt, inPrev, inNext ) {
 	function getBevelVec( inPt, inPrev, inNext ) {
 
 
@@ -264,12 +260,12 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 			}
 			}
 
 
 			if ( direction_eq ) {
 			if ( direction_eq ) {
-				// console.log("Warning: lines are a straight sequence");
+				// THREE.log("Warning: lines are a straight sequence");
 				v_trans_x = - v_prev_y;
 				v_trans_x = - v_prev_y;
 				v_trans_y =  v_prev_x;
 				v_trans_y =  v_prev_x;
 				shrink_by = Math.sqrt( v_prev_lensq );
 				shrink_by = Math.sqrt( v_prev_lensq );
 			} else {
 			} else {
-				// console.log("Warning: lines are a straight spike");
+				// THREE.log("Warning: lines are a straight spike");
 				v_trans_x = v_prev_x;
 				v_trans_x = v_prev_x;
 				v_trans_y = v_prev_y;
 				v_trans_y = v_prev_y;
 				shrink_by = Math.sqrt( v_prev_lensq / 2 );
 				shrink_by = Math.sqrt( v_prev_lensq / 2 );
@@ -290,11 +286,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		if ( k === il ) k = 0;
 		if ( k === il ) k = 0;
 
 
 		//  (j)---(i)---(k)
 		//  (j)---(i)---(k)
-		// console.log('i,j,k', i, j , k)
-
-		var pt_i = contour[ i ];
-		var pt_j = contour[ j ];
-		var pt_k = contour[ k ];
+		// THREE.log('i,j,k', i, j , k)
 
 
 		contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
 		contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
 
 
@@ -566,7 +558,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 			k = i - 1;
 			k = i - 1;
 			if ( k < 0 ) k = contour.length - 1;
 			if ( k < 0 ) k = contour.length - 1;
 
 
-			//console.log('b', i,j, i-1, k,vertices.length);
+			//THREE.log('b', i,j, i-1, k,vertices.length);
 
 
 			var s = 0, sl = steps  + bevelSegments * 2;
 			var s = 0, sl = steps  + bevelSegments * 2;
 
 

+ 2 - 3
src/extras/geometries/ParametricGeometry.js

@@ -26,7 +26,6 @@ THREE.ParametricGeometry = function ( func, slices, stacks ) {
 	var i, j, p;
 	var i, j, p;
 	var u, v;
 	var u, v;
 
 
-	var stackCount = stacks + 1;
 	var sliceCount = slices + 1;
 	var sliceCount = slices + 1;
 
 
 	for ( i = 0; i <= stacks; i ++ ) {
 	for ( i = 0; i <= stacks; i ++ ) {
@@ -70,11 +69,11 @@ THREE.ParametricGeometry = function ( func, slices, stacks ) {
 
 
 	}
 	}
 
 
-	// console.log(this);
+	// THREE.log(this);
 
 
 	// magic bullet
 	// magic bullet
 	// var diff = this.mergeVertices();
 	// var diff = this.mergeVertices();
-	// console.log('removed ', diff, ' vertices by merging');
+	// THREE.log('removed ', diff, ' vertices by merging');
 
 
 	this.computeFaceNormals();
 	this.computeFaceNormals();
 	this.computeVertexNormals();
 	this.computeVertexNormals();

+ 1 - 1
src/extras/geometries/PlaneGeometry.js

@@ -5,7 +5,7 @@
 
 
 THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) {
 THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) {
 
 
-	console.info( 'THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.' );
+	THREE.log( 'THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.' );
 
 
 	THREE.Geometry.call( this );
 	THREE.Geometry.call( this );
 
 

+ 1 - 2
src/extras/geometries/PolyhedronGeometry.js

@@ -28,7 +28,7 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
 
 
 	}
 	}
 
 
-	var midpoints = [], p = this.vertices;
+	var p = this.vertices;
 
 
 	var faces = [];
 	var faces = [];
 
 
@@ -136,7 +136,6 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
 	function subdivide( face, detail ) {
 	function subdivide( face, detail ) {
 
 
 		var cols = Math.pow(2, detail);
 		var cols = Math.pow(2, detail);
-		var cells = Math.pow(4, detail);
 		var a = prepare( that.vertices[ face.a ] );
 		var a = prepare( that.vertices[ face.a ] );
 		var b = prepare( that.vertices[ face.b ] );
 		var b = prepare( that.vertices[ face.b ] );
 		var c = prepare( that.vertices[ face.c ] );
 		var c = prepare( that.vertices[ face.c ] );

+ 1 - 2
src/extras/geometries/ShapeGeometry.js

@@ -59,7 +59,7 @@ THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) {
 
 
 	//
 	//
 
 
-	var i, l, hole, s;
+	var i, l, hole;
 
 
 	var shapesOffset = this.vertices.length;
 	var shapesOffset = this.vertices.length;
 	var shapePoints = shape.extractPoints( curveSegments );
 	var shapePoints = shape.extractPoints( curveSegments );
@@ -108,7 +108,6 @@ THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) {
 
 
 	var vert, vlen = vertices.length;
 	var vert, vlen = vertices.length;
 	var face, flen = faces.length;
 	var face, flen = faces.length;
-	var cont, clen = contour.length;
 
 
 	for ( i = 0; i < vlen; i ++ ) {
 	for ( i = 0; i < vlen; i ++ ) {
 
 

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

@@ -42,8 +42,6 @@ THREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed,
 
 
 		numpoints = segments + 1,
 		numpoints = segments + 1,
 
 
-		x, y, z,
-		tx, ty, tz,
 		u, v, r,
 		u, v, r,
 
 
 		cx, cy,
 		cx, cy,
@@ -154,9 +152,7 @@ THREE.TubeGeometry.SinusoidalTaper = function ( u ) {
 // For computing of Frenet frames, exposing the tangents, normals and binormals the spline
 // For computing of Frenet frames, exposing the tangents, normals and binormals the spline
 THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
 THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
 
 
-	var	tangent = new THREE.Vector3(),
-		normal = new THREE.Vector3(),
-		binormal = new THREE.Vector3(),
+	var	normal = new THREE.Vector3(),
 
 
 		tangents = [],
 		tangents = [],
 		normals = [],
 		normals = [],
@@ -171,7 +167,7 @@ THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
 		smallest,
 		smallest,
 
 
 		tx, ty, tz,
 		tx, ty, tz,
-		i, u, v;
+		i, u;
 
 
 
 
 	// expose internals
 	// expose internals

+ 11 - 2
src/extras/helpers/EdgesHelper.js

@@ -1,10 +1,19 @@
 /**
 /**
  * @author WestLangley / http://github.com/WestLangley
  * @author WestLangley / http://github.com/WestLangley
+ * @param object THREE.Mesh whose geometry will be used
+ * @param hex line color
+ * @param thresholdAngle the minimim angle (in degrees),
+ * between the face normals of adjacent faces,
+ * that is required to render an edge. A value of 10 means
+ * an edge is only rendered if the angle is at least 10 degrees.
  */
  */
 
 
-THREE.EdgesHelper = function ( object, hex ) {
+THREE.EdgesHelper = function ( object, hex, thresholdAngle ) {
 
 
 	var color = ( hex !== undefined ) ? hex : 0xffffff;
 	var color = ( hex !== undefined ) ? hex : 0xffffff;
+	thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;
+
+	var thresholdDot = Math.cos( THREE.Math.degToRad( thresholdAngle ) );
 
 
 	var edge = [ 0, 0 ], hash = {};
 	var edge = [ 0, 0 ], hash = {};
 	var sortFunction = function ( a, b ) { return a - b };
 	var sortFunction = function ( a, b ) { return a - b };
@@ -67,7 +76,7 @@ THREE.EdgesHelper = function ( object, hex ) {
 
 
 		var h = hash[ key ];
 		var h = hash[ key ];
 
 
-		if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) < 0.9999 ) { // hardwired const OK
+		if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {
 
 
 			var vertex = vertices[ h.vert1 ];
 			var vertex = vertices[ h.vert1 ];
 			coords[ index ++ ] = vertex.x;
 			coords[ index ++ ] = vertex.x;

+ 0 - 2
src/extras/helpers/VertexNormalsHelper.js

@@ -15,8 +15,6 @@ THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) {
 
 
 	var geometry = new THREE.Geometry();
 	var geometry = new THREE.Geometry();
 
 
-	var vertices = object.geometry.vertices;
-
 	var faces = object.geometry.faces;
 	var faces = object.geometry.faces;
 
 
 	for ( var i = 0, l = faces.length; i < l; i ++ ) {
 	for ( var i = 0, l = faces.length; i < l; i ++ ) {

+ 0 - 2
src/extras/helpers/VertexTangentsHelper.js

@@ -15,8 +15,6 @@ THREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) {
 
 
 	var geometry = new THREE.Geometry();
 	var geometry = new THREE.Geometry();
 
 
-	var vertices = object.geometry.vertices;
-
 	var faces = object.geometry.faces;
 	var faces = object.geometry.faces;
 
 
 	for ( var i = 0, l = faces.length; i < l; i ++ ) {
 	for ( var i = 0, l = faces.length; i < l; i ++ ) {

+ 0 - 1
src/extras/objects/MorphBlendMesh.js

@@ -76,7 +76,6 @@ THREE.MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) {
 		if ( chunks && chunks.length > 1 ) {
 		if ( chunks && chunks.length > 1 ) {
 
 
 			var name = chunks[ 1 ];
 			var name = chunks[ 1 ];
-			var num = chunks[ 2 ];
 
 
 			if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity };
 			if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity };
 
 

+ 3 - 3
src/loaders/BufferGeometryLoader.js

@@ -36,7 +36,7 @@ THREE.BufferGeometryLoader.prototype = {
 
 
 		var geometry = new THREE.BufferGeometry();
 		var geometry = new THREE.BufferGeometry();
 
 
-		var attributes = json.attributes;
+		var attributes = json.data.attributes;
 
 
 		for ( var key in attributes ) {
 		for ( var key in attributes ) {
 
 
@@ -47,7 +47,7 @@ THREE.BufferGeometryLoader.prototype = {
 
 
 		}
 		}
 
 
-		var offsets = json.offsets;
+		var offsets = json.data.offsets;
 
 
 		if ( offsets !== undefined ) {
 		if ( offsets !== undefined ) {
 
 
@@ -55,7 +55,7 @@ THREE.BufferGeometryLoader.prototype = {
 
 
 		}
 		}
 
 
-		var boundingSphere = json.boundingSphere;
+		var boundingSphere = json.data.boundingSphere;
 
 
 		if ( boundingSphere !== undefined ) {
 		if ( boundingSphere !== undefined ) {
 
 

+ 2 - 2
src/loaders/Cache.js

@@ -8,7 +8,7 @@ THREE.Cache = {
 
 
 	add: function ( key, file ) {
 	add: function ( key, file ) {
 
 
-		// console.log( 'THREE.Cache', 'Adding key:', key );
+		// THREE.log( 'THREE.Cache', 'Adding key:', key );
 
 
 		this.files[ key ] = file;
 		this.files[ key ] = file;
 
 
@@ -16,7 +16,7 @@ THREE.Cache = {
 
 
 	get: function ( key ) {
 	get: function ( key ) {
 
 
-		// console.log( 'THREE.Cache', 'Checking key:', key );
+		// THREE.log( 'THREE.Cache', 'Checking key:', key );
 
 
 		return this.files[ key ];
 		return this.files[ key ];
 
 

+ 17 - 15
src/loaders/JSONLoader.js

@@ -16,8 +16,6 @@ THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
 
 
 THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
 THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
 
 
-	var scope = this;
-
 	// todo: unify load API to for easier SceneLoader use
 	// todo: unify load API to for easier SceneLoader use
 
 
 	texturePath = texturePath && ( typeof texturePath === 'string' ) ? texturePath : this.extractUrlBase( url );
 	texturePath = texturePath && ( typeof texturePath === 'string' ) ? texturePath : this.extractUrlBase( url );
@@ -42,18 +40,23 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, tex
 				if ( xhr.responseText ) {
 				if ( xhr.responseText ) {
 
 
 					var json = JSON.parse( xhr.responseText );
 					var json = JSON.parse( xhr.responseText );
+					var metadata = json.metadata;
 
 
-					if ( json.metadata !== undefined && json.metadata.version >= 4 ) {
+					if ( metadata !== undefined ) {
 
 
-						console.error( 'THREE.JSONLoader: "' + url + '" should be loaded with THREE.ObjectLoader instead.' );
-						return;
+						if ( metadata.type === 'object' ) {
 
 
-					}
+							THREE.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.ObjectLoader instead.' );
+							return;
+
+						}
+
+						if ( metadata.type === 'scene' ) {
 
 
-					if ( json.metadata !== undefined && json.metadata.type === 'scene' ) {
+							THREE.error( 'THREE.JSONLoader: ' + url + ' seems to be a Scene. Use THREE.SceneLoader instead.' );
+							return;
 
 
-						THREE.error( 'THREE.JSONLoader: "' + url + '" seems to be a Scene. Use THREE.SceneLoader instead.' );
-						return;
+						}
 
 
 					}
 					}
 
 
@@ -62,7 +65,7 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, tex
 
 
 				} else {
 				} else {
 
 
-					THREE.error( 'THREE.JSONLoader: "' + url + '" seems to be unreachable or the file is empty.' );
+					THREE.error( 'THREE.JSONLoader: ' + url + ' seems to be unreachable or the file is empty.' );
 
 
 				}
 				}
 
 
@@ -74,7 +77,7 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, tex
 
 
 			} else {
 			} else {
 
 
-				THREE.error( 'THREE.JSONLoader: Couldn\'t load "' + url + '" (' + xhr.status + ')' );
+				THREE.error( 'THREE.JSONLoader: Couldn\'t load ' + url + ' (' + xhr.status + ')' );
 
 
 			}
 			}
 
 
@@ -112,8 +115,7 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, tex
 
 
 THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 
-	var scope = this,
-	geometry = new THREE.Geometry(),
+	var geometry = new THREE.Geometry(),
 	scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0;
 	scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0;
 
 
 	parseModel( scale );
 	parseModel( scale );
@@ -145,7 +147,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 		hasFaceNormal, hasFaceVertexNormal,
 		hasFaceNormal, hasFaceVertexNormal,
 		hasFaceColor, hasFaceVertexColor,
 		hasFaceColor, hasFaceVertexColor,
 
 
-		vertex, face, faceA, faceB, color, hex, normal,
+		vertex, face, faceA, faceB, hex, normal,
 
 
 		uvLayer, uv, u, v,
 		uvLayer, uv, u, v,
 
 
@@ -205,7 +207,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 			hasFaceColor	     = isBitSet( type, 6 );
 			hasFaceColor	     = isBitSet( type, 6 );
 			hasFaceVertexColor  = isBitSet( type, 7 );
 			hasFaceVertexColor  = isBitSet( type, 7 );
 
 
-			// console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
+			// THREE.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
 
 
 			if ( isQuad ) {
 			if ( isQuad ) {
 
 

+ 1 - 1
src/loaders/Loader.js

@@ -316,7 +316,7 @@ THREE.Loader.prototype = {
 
 
 		if ( m.transparency !== undefined ) {
 		if ( m.transparency !== undefined ) {
 
 
-			console.warn( 'THREE.Loader: transparency has been renamed to opacity' );
+			THREE.warn( 'THREE.Loader: transparency has been renamed to opacity' );
 			m.opacity = m.transparency;
 			m.opacity = m.transparency;
 
 
 		}
 		}

部分文件因为文件数量过多而无法显示