فهرست منبع

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

Arthur Silber 10 سال پیش
والد
کامیت
faee401d3b
100فایلهای تغییر یافته به همراه2863 افزوده شده و 1465 حذف شده
  1. 497 469
      build/three.js
  2. 141 123
      build/three.min.js
  3. 2 0
      docs/api/extras/geometries/DodecahedronGeometry.html
  4. 1 0
      docs/api/extras/geometries/IcosahedronGeometry.html
  5. 1 0
      docs/api/extras/geometries/OctahedronGeometry.html
  6. 2 0
      docs/api/extras/geometries/TetrahedronGeometry.html
  7. 1 0
      docs/api/extras/geometries/TorusGeometry.html
  8. 2 0
      docs/api/extras/geometries/TorusKnotGeometry.html
  9. 0 4
      docs/api/materials/MeshBasicMaterial.html
  10. 0 18
      docs/api/materials/MeshLambertMaterial.html
  11. 0 14
      docs/api/materials/MeshPhongMaterial.html
  12. 1 1
      docs/index.html
  13. 129 0
      docs/scenes/geometry-browser.html
  14. 309 0
      docs/scenes/js/geometry.js
  15. 0 5
      docs/scenes/js/material.js
  16. 80 62
      editor/js/Sidebar.Material.js
  17. 13 6
      editor/js/libs/app.js
  18. 24 10
      editor/js/libs/codemirror/codemirror.css
  19. 928 64
      editor/js/libs/codemirror/codemirror.js
  20. 13 2
      editor/js/libs/codemirror/mode/javascript.js
  21. 2 0
      editor/js/libs/codemirror/theme/monokai.css
  22. 12 12
      examples/canvas_geometry_birds.html
  23. 2 2
      examples/canvas_interactive_particles.html
  24. 1 1
      examples/canvas_lights_pointlights.html
  25. 2 11
      examples/canvas_materials.html
  26. 1 1
      examples/canvas_materials_video.html
  27. 1 1
      examples/canvas_particles_random.html
  28. 1 1
      examples/canvas_particles_shapes.html
  29. 1 1
      examples/canvas_particles_sprites.html
  30. 1 1
      examples/css3d_sprites.html
  31. 5 1
      examples/index.html
  32. 2 2
      examples/js/AudioObject.js
  33. 4 4
      examples/js/BlendCharacter.js
  34. 10 10
      examples/js/BlendCharacterGui.js
  35. 3 3
      examples/js/Car.js
  36. 2 2
      examples/js/Cloth.js
  37. 1 1
      examples/js/CurveExtras.js
  38. 1 1
      examples/js/ImprovedNoise.js
  39. 5 6
      examples/js/MD2Character.js
  40. 5 6
      examples/js/MD2CharacterComplex.js
  41. 15 15
      examples/js/MarchingCubes.js
  42. 1 1
      examples/js/Mirror.js
  43. 1 1
      examples/js/Ocean.js
  44. 3 3
      examples/js/Octree.js
  45. 6 5
      examples/js/ShaderDeferred.js
  46. 1 1
      examples/js/SimplexNoise.js
  47. 4 4
      examples/js/SimulationRenderer.js
  48. 1 1
      examples/js/SkyShader.js
  49. 3 3
      examples/js/Sparks.js
  50. 5 6
      examples/js/UCSCharacter.js
  51. 4 2
      examples/js/WaterShader.js
  52. 2 2
      examples/js/cameras/CombinedCamera.js
  53. 1 1
      examples/js/controls/EditorControls.js
  54. 1 1
      examples/js/controls/FirstPersonControls.js
  55. 3 3
      examples/js/controls/FlyControls.js
  56. 1 1
      examples/js/controls/MouseControls.js
  57. 3 3
      examples/js/controls/OrbitControls.js
  58. 1 1
      examples/js/controls/OrthographicTrackballControls.js
  59. 23 6
      examples/js/controls/TransformControls.js
  60. 67 26
      examples/js/controls/VRControls.js
  61. 1 1
      examples/js/crossfade/scenes.js
  62. 3 3
      examples/js/crossfade/transition.js
  63. 1 1
      examples/js/curves/NURBSSurface.js
  64. 2 2
      examples/js/effects/StereoEffect.js
  65. 149 158
      examples/js/effects/VREffect.js
  66. 1 1
      examples/js/exporters/OBJExporter.js
  67. 2 2
      examples/js/exporters/SceneExporter.js
  68. 7 7
      examples/js/geometries/DecalGeometry.js
  69. 1 1
      examples/js/libs/msgpack-js.js
  70. 38 38
      examples/js/loaders/AWDLoader.js
  71. 4 11
      examples/js/loaders/AssimpJSONLoader.js
  72. 1 1
      examples/js/loaders/BabylonLoader.js
  73. 51 51
      examples/js/loaders/BinaryLoader.js
  74. 106 113
      examples/js/loaders/ColladaLoader.js
  75. 3 3
      examples/js/loaders/DDSLoader.js
  76. 1 1
      examples/js/loaders/MTLLoader.js
  77. 2 2
      examples/js/loaders/OBJLoader.js
  78. 2 2
      examples/js/loaders/OBJMTLLoader.js
  79. 1 1
      examples/js/loaders/PDBLoader.js
  80. 5 5
      examples/js/loaders/PLYLoader.js
  81. 20 20
      examples/js/loaders/PVRLoader.js
  82. 4 4
      examples/js/loaders/RGBELoader.js
  83. 1 1
      examples/js/loaders/STLLoader.js
  84. 16 16
      examples/js/loaders/TGALoader.js
  85. 1 1
      examples/js/loaders/UTF8Loader.js
  86. 13 13
      examples/js/loaders/VRMLLoader.js
  87. 7 7
      examples/js/loaders/ctm/CTMLoader.js
  88. 1 1
      examples/js/loaders/ctm/CTMWorker.js
  89. 12 12
      examples/js/loaders/deprecated/SceneLoader.js
  90. 8 8
      examples/js/loaders/gltf/glTFAnimation.js
  91. 25 25
      examples/js/loaders/gltf/glTFLoader.js
  92. 3 3
      examples/js/loaders/gltf/glTFLoaderUtils.js
  93. 1 1
      examples/js/modifiers/ExplodeModifier.js
  94. 8 8
      examples/js/modifiers/SubdivisionModifier.js
  95. 4 4
      examples/js/postprocessing/AdaptiveToneMappingPass.js
  96. 2 2
      examples/js/postprocessing/BloomPass.js
  97. 1 1
      examples/js/postprocessing/BokehPass.js
  98. 1 1
      examples/js/postprocessing/DotScreenPass.js
  99. 1 1
      examples/js/postprocessing/EffectComposer.js
  100. 1 1
      examples/js/postprocessing/FilmPass.js

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 497 - 469
build/three.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 141 - 123
build/three.min.js


+ 2 - 0
docs/api/extras/geometries/DodecahedronGeometry.html

@@ -13,6 +13,8 @@
 
 		<div class="desc">A class for generating a dodecahedron geometries.</div>
 
+		<iframe src='../../../scenes/geometry-browser.html#DodecahedronGeometry'></iframe>
+
 
 		<h2>Constructor</h2>
 

+ 1 - 0
docs/api/extras/geometries/IcosahedronGeometry.html

@@ -12,6 +12,7 @@
 
 		<div class="desc">A class for generating an icosahedron geometry.</div>
 
+		<iframe src='../../../scenes/geometry-browser.html#IcosahedronGeometry'></iframe>
 
 		<h2>Constructor</h2>
 

+ 1 - 0
docs/api/extras/geometries/OctahedronGeometry.html

@@ -12,6 +12,7 @@
 
 		<div class="desc">A class for generating an octahedron geometry.</div>
 
+		<iframe src='../../../scenes/geometry-browser.html#OctahedronGeometry'></iframe>
 
 		<h2>Constructor</h2>
 

+ 2 - 0
docs/api/extras/geometries/TetrahedronGeometry.html

@@ -13,6 +13,8 @@
 
 		<div class="desc">A class for generating a tetrahedron geometries.</div>
 
+		<iframe src='../../../scenes/geometry-browser.html#TetrahedronGeometry'></iframe>
+
 
 		<h2>Constructor</h2>
 

+ 1 - 0
docs/api/extras/geometries/TorusGeometry.html

@@ -13,6 +13,7 @@
 
 		<div class="desc">A class for generating torus geometries</div>
 
+		<iframe src='../../../scenes/geometry-browser.html#TorusGeometry'></iframe>
 
 		<h2>Example</h2>
 		

+ 2 - 0
docs/api/extras/geometries/TorusKnotGeometry.html

@@ -13,6 +13,8 @@
 
 		<div class="desc">Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q.  If p and q are not coprime, the result will be a torus link.</div>
 
+		<iframe src='../../../scenes/geometry-browser.html#TorusKnotGeometry'></iframe>
+
 
 		<h2>Example</h2>
 		

+ 0 - 4
docs/api/materials/MeshBasicMaterial.html

@@ -25,7 +25,6 @@
 		<div>
 		color — geometry color in hexadecimal. Default is 0xffffff.<br />
 		map — Sets the texture map. Default is null <br />
-		lightMap — Set light map. Default is null.<br />
 		specularMap — Set specular map. Default is null.<br />
 		alphaMap — Set alpha map. Default is null.<br />
 		envMap — Set env map. Default is null.<br />
@@ -45,9 +44,6 @@
 		<h3>[property:Integer color]</h3>
 		<div>Sets the color of the geometry. Default is 0xffffff.</div>
 		
-		<h3>[property:Texture lightMap]</h3>
-		<div>Set light map. Default is null.</div>
-
 		<h3>[property:Texture specularMap]</h3>
 		<div>Set specular map. Default is null.</div>
 

+ 0 - 18
docs/api/materials/MeshLambertMaterial.html

@@ -25,7 +25,6 @@
 		<div>
 		color — Line color in hexadecimal. Default is 0xffffff.<br />
 		map — Sets the texture map. Default is null <br />
-		lightMap — Set light map. Default is null.<br />
 		specularMap — Set specular map. Default is null.<br />
 		alphaMap — Set alpha map. Default is null.<br />
 		envMap — Set env map. Default is null.<br />
@@ -53,27 +52,10 @@
 		<div>
 		Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.<br />
 		</div>
-		
-		<h3>[property:boolean wrapAround]</h3>
-		<div>
-			Define whether the diffuse lighting wraps around the model or not. This option adds a little more (tintable) light
-			onto the side of the object in relation to a light.
-		</div>
-
-		<h3>[property:Vector3 wrapRGB]</h3>
-		<div>
-			Decide how much of the wrap around values get used if the wrapAround option is set. The x, y, z values correspond
-			to the r, g, b values respectively. The typical range is of each is from 0 to 1. For example setting all of the
-			vector values to 0.5 will add a moderate amount of light to the side of the model. Changing *b* to 1 will
-			tint the light on the side to be more blue. Defaults to *(1,1,1)*.
-		</div> 
 
 		<h3>[property:Texture map]</h3>
 		<div>Set color texture map. Default is null.</div>
 
-		<h3>[property:Texture lightMap]</h3>
-		<div>Set light map. Default is null.</div>
-
 		<h3>[property:Texture specularMap]</h3>
 		<div>Since this material does not have a specular component, the specular value affects only how much of the environment map affects the surface. Default is null.</div>
 

+ 0 - 14
docs/api/materials/MeshPhongMaterial.html

@@ -74,20 +74,6 @@
 			underlying colors.
 		</div> 
 
-		<h3>[property:boolean wrapAround]</h3>
-		<div>
-			Define whether the diffuse lighting wraps around the model or not. This option adds a little more (tintable) light
-			onto the side of the object in relation to a light.
-		</div>
-
-		<h3>[property:Vector3 wrapRGB]</h3>
-		<div>
-			Decide how much of the wrap around values get used if the wrapAround option is set. The x, y, z values correspond
-			to the r, g, b values respectively. The typical range is of each is from 0 to 1. For example setting all of the
-			vector values to 0.5 will add a moderate amount of light to the side of the model. Changing *b* to 1 will
-			tint the light on the side to be more blue. Defaults to (1,1,1).
-		</div>
-
 		<h3>[property:Texture map]</h3>
 		<div>Set color texture map. Default is null.</div>
 

+ 1 - 1
docs/index.html

@@ -406,7 +406,7 @@
 			if ( window.location.hash.length > 0 ) goToHash();
 
 			console.log([
-				'   __     __',
+				'    __     __',
 				' __/ __\\  / __\\__   ____   _____   _____',
 				'/ __/  /\\/ /  /___\\/ ____\\/ _____\\/ _____\\',
 				'\\/_   __/ /   _   / /  __/ / __  / / __  /_   __   _____',

+ 129 - 0
docs/scenes/geometry-browser.html

@@ -0,0 +1,129 @@
+<!doctype html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8">
+		<title>Three.js Geometry Browser</title>
+		<style>
+			@font-face {
+				font-family: 'inconsolata';
+				src: url('../files/inconsolata.woff') format('woff');
+				font-weight: normal;
+				font-style: normal;
+			}
+			
+			body {
+				margin:0;
+				font-family: 'inconsolata';
+				font-size: 15px;
+				line-height: 18px;
+				overflow: hidden;
+			}
+			
+			canvas { width: 100%; height: 100% }
+			
+			#newWindow {
+				display: block;
+				position: absolute;
+				bottom: 0.3em;
+				left: 0.5em;
+				color: #fff;
+			}
+		</style>
+	</head>
+	<body>
+		
+		<a id='newWindow' href='./geometry-browser.html' target='_blank'>Open in New Window</a>
+		
+		<script src="../../build/three.min.js"></script>
+		<script src='../../examples/js/libs/dat.gui.min.js'></script>
+		<script src="../../examples/js/controls/OrbitControls.js"></script>
+		<script src='js/geometry.js'></script>
+		
+		<script>
+			
+			document.getElementById('newWindow').href += window.location.hash;
+			
+			var gui = new dat.GUI();
+			var scene = new THREE.Scene();
+			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 50 );
+			camera.position.z = 30;
+			
+			var renderer = new THREE.WebGLRenderer({antialias: true});
+			renderer.setSize( window.innerWidth, window.innerHeight );
+			document.body.appendChild( renderer.domElement );
+			
+			var orbit = new THREE.OrbitControls( camera, renderer.domElement );
+
+			var ambientLight = new THREE.AmbientLight( 0x000000 );
+			scene.add( ambientLight );
+
+			var lights = [];
+			lights[0] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[1] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[2] = new THREE.PointLight( 0xffffff, 1, 0 );
+			
+			lights[0].position.set( 0, 200, 0 );
+			lights[1].position.set( 100, 200, 100 );
+			lights[2].position.set( -100, -200, -100 );
+
+			scene.add( lights[0] );
+			scene.add( lights[1] );
+			scene.add( lights[2] );
+
+			var mesh = THREE.SceneUtils.createMultiMaterialObject(
+				
+				new THREE.Geometry(),
+				
+				[
+					
+					new THREE.MeshBasicMaterial({
+						color: 0xffffff,
+						side: THREE.DoubleSide,
+						wireframe: true,
+						transparent: true,
+						opacity: 0.5
+					}),
+					
+					new THREE.MeshPhongMaterial({
+						color: 0x156289,
+						emissive: 0x072534,
+						side: THREE.DoubleSide
+					})
+					
+				]
+				
+			)
+			
+			chooseFromHash( mesh );
+			
+			scene.add( mesh );
+			
+			var prevFog = false;
+			
+			var render = function () {
+				
+				requestAnimationFrame( render );
+
+				var time = Date.now() * 0.001;
+
+				mesh.rotation.x += 0.005;
+				mesh.rotation.y += 0.005;
+
+				renderer.render( scene, camera );
+				
+			};
+			
+			window.addEventListener( 'resize', function () {
+				
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				
+			}, false );
+
+			render();
+			
+		</script>
+	</body>
+</html>

+ 309 - 0
docs/scenes/js/geometry.js

@@ -0,0 +1,309 @@
+/**
+ * @author TatumCreative (Greg Tatum) / http://gregtatum.com/
+ */
+
+var constants = {
+
+	combine: {
+
+		"THREE.MultiplyOperation" : THREE.MultiplyOperation,
+		"THREE.MixOperation" : THREE.MixOperation,
+		"THREE.AddOperation" : THREE.AddOperation
+
+	},
+
+	side : {
+
+		"THREE.FrontSide" : THREE.FrontSide,
+		"THREE.BackSide" : THREE.BackSide,
+		"THREE.DoubleSide" : THREE.DoubleSide
+
+	},
+
+	shading : {
+
+		"THREE.NoShading" : THREE.NoShading,
+		"THREE.FlatShading" : THREE.FlatShading,
+		"THREE.SmoothShading" : THREE.SmoothShading
+
+	},
+
+	colors : {
+
+		"THREE.NoColors" : THREE.NoColors,
+		"THREE.FaceColors" : THREE.FaceColors,
+		"THREE.VertexColors" : THREE.VertexColors
+
+	},
+
+	blendingMode : {
+
+		"THREE.NoBlending" : THREE.NoBlending,
+		"THREE.NormalBlending" : THREE.NormalBlending,
+		"THREE.AdditiveBlending" : THREE.AdditiveBlending,
+		"THREE.SubtractiveBlending" : THREE.SubtractiveBlending,
+		"THREE.MultiplyBlending" : THREE.MultiplyBlending,
+		"THREE.CustomBlending" : THREE.CustomBlending
+
+	},
+
+	equations : {
+
+		"THREE.AddEquation" : THREE.AddEquation,
+		"THREE.SubtractEquation" : THREE.SubtractEquation,
+		"THREE.ReverseSubtractEquation" : THREE.ReverseSubtractEquation
+
+	},
+
+	destinationFactors : {
+
+		"THREE.ZeroFactor" : THREE.ZeroFactor,
+		"THREE.OneFactor" : THREE.OneFactor,
+		"THREE.SrcColorFactor" : THREE.SrcColorFactor,
+		"THREE.OneMinusSrcColorFactor" : THREE.OneMinusSrcColorFactor,
+		"THREE.SrcAlphaFactor" : THREE.SrcAlphaFactor,
+		"THREE.OneMinusSrcAlphaFactor" : THREE.OneMinusSrcAlphaFactor,
+		"THREE.DstAlphaFactor" : THREE.DstAlphaFactor,
+		"THREE.OneMinusDstAlphaFactor" : THREE.OneMinusDstAlphaFactor
+
+	},
+
+	sourceFactors : {
+
+		"THREE.DstColorFactor" : THREE.DstColorFactor,
+		"THREE.OneMinusDstColorFactor" : THREE.OneMinusDstColorFactor,
+		"THREE.SrcAlphaSaturateFactor" : THREE.SrcAlphaSaturateFactor
+
+	}
+
+}
+
+function updateGroupGeometry( mesh, geometry ) {
+	
+	mesh.children[0].geometry = geometry
+	mesh.children[1].geometry = geometry.clone()
+	
+	//these do not update nicely together if shared
+}
+
+var guis = {
+	
+	TorusGeometry : function( mesh ) {
+
+		var data = {
+			radius : 10,
+			tube : 3,
+			radialSegments : 16,
+			tubularSegments : 100,
+			arc : Math.PI * 2
+		};
+		
+		function generateGeometry() {
+			
+			updateGroupGeometry( mesh, 
+				new THREE.TorusGeometry(
+					data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc
+				)
+			)
+			
+		}
+
+		var folder = gui.addFolder('THREE.TorusGeometry');
+		
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'tube', 0.1, 10 ).onChange( generateGeometry )
+		folder.add( data, 'radialSegments', 2, 30 ).step(1).onChange( generateGeometry )
+		folder.add( data, 'tubularSegments', 3, 200 ).step(1).onChange( generateGeometry )
+		folder.add( data, 'arc', 0.1, Math.PI * 2 ).onChange( generateGeometry )
+		
+		generateGeometry()
+
+	},
+	
+	TorusKnotGeometry : function( mesh ) {
+
+		var data = {
+			radius : 10,
+			tube : 3,
+			radialSegments : 64,
+			tubularSegments : 8,
+			p : 2,
+			q : 3,
+			heightScale : 1
+		};
+		
+		function generateGeometry() {
+			
+			updateGroupGeometry( mesh, 
+				new THREE.TorusKnotGeometry(
+					data.radius, data.tube, data.radialSegments, data.tubularSegments,
+					data.p, data.q, data.heightScale
+				)
+			)
+			
+		}
+
+		var folder = gui.addFolder('THREE.TorusGeometry');
+		
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'tube', 0.1, 10 ).onChange( generateGeometry )
+		folder.add( data, 'radialSegments', 3, 300 ).step(1).onChange( generateGeometry )
+		folder.add( data, 'tubularSegments', 3, 20 ).step(1).onChange( generateGeometry )
+		folder.add( data, 'p', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'q', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'heightScale', 1, 20 ).onChange( generateGeometry )
+		
+		generateGeometry()
+
+	},
+	
+	DodecahedronGeometry : function() {
+
+		var data = {
+			radius : 10,
+			detail : 0,
+		};
+		
+		function generateGeometry() {
+			
+			updateGroupGeometry( mesh, 
+				new THREE.DodecahedronGeometry(
+					data.radius, data.detail
+				)
+			)
+			
+		}
+
+		var folder = gui.addFolder('THREE.DodecahedronGeometry');
+		
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'detail', 0, 5 ).step(1).onChange( generateGeometry )
+		
+		generateGeometry()
+		
+	},
+	
+	IcosahedronGeometry : function() {
+
+		var data = {
+			radius : 10,
+			detail : 0,
+		};
+		
+		function generateGeometry() {
+			
+			updateGroupGeometry( mesh, 
+				new THREE.IcosahedronGeometry(
+					data.radius, data.detail
+				)
+			)
+			
+		}
+
+		var folder = gui.addFolder('THREE.IcosahedronGeometry');
+		
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'detail', 0, 5 ).step(1).onChange( generateGeometry )
+		
+		generateGeometry()
+		
+	},
+	
+	OctahedronGeometry : function() {
+
+		var data = {
+			radius : 10,
+			detail : 0,
+		};
+		
+		function generateGeometry() {
+			
+			updateGroupGeometry( mesh, 
+				new THREE.OctahedronGeometry(
+					data.radius, data.detail
+				)
+			)
+			
+		}
+
+		var folder = gui.addFolder('THREE.OctahedronGeometry');
+		
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'detail', 0, 5 ).step(1).onChange( generateGeometry )
+		
+		generateGeometry()
+		
+	},
+	
+	TetrahedronGeometry : function() {
+
+		var data = {
+			radius : 10,
+			detail : 0,
+		};
+		
+		function generateGeometry() {
+			
+			updateGroupGeometry( mesh, 
+				new THREE.TetrahedronGeometry(
+					data.radius, data.detail
+				)
+			)
+			
+		}
+
+		var folder = gui.addFolder('THREE.TetrahedronGeometry');
+		
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry )
+		folder.add( data, 'detail', 0, 5 ).step(1).onChange( generateGeometry )
+		
+		generateGeometry()
+		
+	}
+	
+}
+
+function chooseFromHash ( mesh ) {
+
+	var selectedGeometry = window.location.hash.substring(1) || "TorusGeometry";
+
+	switch (selectedGeometry) {
+
+	case "TorusGeometry" :
+
+		guis.TorusGeometry( mesh )
+
+		break;
+		
+	case "TorusKnotGeometry" :
+
+		guis.TorusKnotGeometry( mesh )
+
+		break;
+		
+	case "DodecahedronGeometry" :
+
+		guis.DodecahedronGeometry( mesh )
+
+		break;
+		
+	case "IcosahedronGeometry" :
+
+		guis.IcosahedronGeometry( mesh )
+
+		break;
+		
+	case "OctahedronGeometry" :
+
+		guis.OctahedronGeometry( mesh )
+
+		break;
+		
+	case "TetrahedronGeometry" :
+
+		guis.TetrahedronGeometry( mesh )
+
+		break;
+	}
+
+}

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

@@ -324,7 +324,6 @@ function guiMeshBasicMaterial ( gui, mesh, material, geometry ) {
 		color : material.color.getHex(),
 		envMaps : envMapKeys,
 		map : textureMapKeys,
-		lightMap : textureMapKeys,
 		specularMap : textureMapKeys,
 		alphaMap : textureMapKeys
 	};
@@ -340,7 +339,6 @@ function guiMeshBasicMaterial ( gui, mesh, material, geometry ) {
 
 	folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 	folder.add( data, 'map', textureMapKeys ).onChange( updateTexture( material, 'map', textureMaps ) );
-	folder.add( data, 'lightMap', textureMapKeys ).onChange( updateTexture( material, 'lightMap', textureMaps ) );
 	folder.add( data, 'specularMap', textureMapKeys ).onChange( updateTexture( material, 'specularMap', textureMaps ) );
 	folder.add( data, 'alphaMap', textureMapKeys ).onChange( updateTexture( material, 'alphaMap', textureMaps ) );
 	folder.add( material, 'morphTargets' ).onChange( updateMorphs( mesh, material ) );
@@ -365,7 +363,6 @@ function guiMeshNormalMaterial ( gui, mesh, material, geometry ) {
 
 	var folder = gui.addFolder('THREE.MeshNormalMaterial');
 
-	folder.add( material, 'shading', constants.shading).onChange( needsUpdate( material, geometry ) );
 	folder.add( material, 'wireframe' );
 	folder.add( material, 'wireframeLinewidth', 0, 10 );
 	folder.add( material, 'morphTargets' ).onChange( updateMorphs( mesh, material ) );
@@ -396,7 +393,6 @@ function guiMeshLambertMaterial ( gui, mesh, material, geometry ) {
 		emissive : material.emissive.getHex(),
 		envMaps : envMapKeys,
 		map : textureMapKeys,
-		lightMap : textureMapKeys,
 		specularMap : textureMapKeys,
 		alphaMap : textureMapKeys
 	};
@@ -416,7 +412,6 @@ function guiMeshLambertMaterial ( gui, mesh, material, geometry ) {
 
 	folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
 	folder.add( data, 'map', textureMapKeys ).onChange( updateTexture( material, 'map', textureMaps ) );
-	folder.add( data, 'lightMap', textureMapKeys ).onChange( updateTexture( material, 'lightMap', textureMaps ) );
 	folder.add( data, 'specularMap', textureMapKeys ).onChange( updateTexture( material, 'specularMap', textureMaps ) );
 	folder.add( data, 'alphaMap', textureMapKeys ).onChange( updateTexture( material, 'alphaMap', textureMaps ) );
 	folder.add( material, 'morphTargets' ).onChange( updateMorphs( mesh, material ) );

+ 80 - 62
editor/js/Sidebar.Material.js

@@ -6,24 +6,6 @@ Sidebar.Material = function ( editor ) {
 
 	var signals = editor.signals;
 
-	var materialClasses = {
-
-		'LineBasicMaterial': THREE.LineBasicMaterial,
-		'LineDashedMaterial': THREE.LineDashedMaterial,
-		'MeshBasicMaterial': THREE.MeshBasicMaterial,
-		'MeshDepthMaterial': THREE.MeshDepthMaterial,
-		'MeshFaceMaterial': THREE.MeshFaceMaterial,
-		'MeshLambertMaterial': THREE.MeshLambertMaterial,
-		'MeshNormalMaterial': THREE.MeshNormalMaterial,
-		'MeshPhongMaterial': THREE.MeshPhongMaterial,
-		'PointCloudMaterial': THREE.PointCloudMaterial,
-		'ShaderMaterial': THREE.ShaderMaterial,
-		'SpriteMaterial': THREE.SpriteMaterial,
-		'SpriteCanvasMaterial': THREE.SpriteCanvasMaterial,
-		'Material': THREE.Material
-
-	};
-
 	var container = new UI.CollapsiblePanel();
 	container.setCollapsed( editor.config.getKey( 'ui/sidebar/material/collapsed' ) );
 	container.onCollapsedChange( function ( boolean ) {
@@ -77,7 +59,6 @@ Sidebar.Material = function ( editor ) {
 		'LineDashedMaterial': 'LineDashedMaterial',
 		'MeshBasicMaterial': 'MeshBasicMaterial',
 		'MeshDepthMaterial': 'MeshDepthMaterial',
-		'MeshFaceMaterial': 'MeshFaceMaterial',
 		'MeshLambertMaterial': 'MeshLambertMaterial',
 		'MeshNormalMaterial': 'MeshNormalMaterial',
 		'MeshPhongMaterial': 'MeshPhongMaterial',
@@ -214,18 +195,6 @@ Sidebar.Material = function ( editor ) {
 
 	container.add( materialAlphaMapRow );
 
-	// light map
-
-	var materialLightMapRow = new UI.Panel();
-	var materialLightMapEnabled = new UI.Checkbox( false ).onChange( update );
-	var materialLightMap = new UI.Texture().onChange( update );
-
-	materialLightMapRow.add( new UI.Text( 'Light Map' ).setWidth( '90px' ) );
-	materialLightMapRow.add( materialLightMapEnabled );
-	materialLightMapRow.add( materialLightMap );
-
-	container.add( materialLightMapRow );
-
 	// bump map
 
 	var materialBumpMapRow = new UI.Panel();
@@ -278,6 +247,32 @@ Sidebar.Material = function ( editor ) {
 
 	container.add( materialEnvMapRow );
 
+	// light map
+
+	var materialLightMapRow = new UI.Panel();
+	var materialLightMapEnabled = new UI.Checkbox( false ).onChange( update );
+	var materialLightMap = new UI.Texture().onChange( update );
+
+	materialLightMapRow.add( new UI.Text( 'Light Map' ).setWidth( '90px' ) );
+	materialLightMapRow.add( materialLightMapEnabled );
+	materialLightMapRow.add( materialLightMap );
+
+	container.add( materialLightMapRow );
+
+	// ambient occlusion map
+
+	var materialAOMapRow = new UI.Panel();
+	var materialAOMapEnabled = new UI.Checkbox( false ).onChange( update );
+	var materialAOMap = new UI.Texture().onChange( update );
+	var materialAOScale = new UI.Number( 1 ).setRange( 0, 1 ).setWidth( '30px' ).onChange( update );
+
+	materialAOMapRow.add( new UI.Text( 'AO Map' ).setWidth( '90px' ) );
+	materialAOMapRow.add( materialAOMapEnabled );
+	materialAOMapRow.add( materialAOMap );
+	materialAOMapRow.add( materialAOScale );
+
+	container.add( materialAOMapRow );
+
 	// side
 
 	var materialSideRow = new UI.Panel();
@@ -385,9 +380,9 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
-			if ( material instanceof materialClasses[ materialClass.getValue() ] === false ) {
+			if ( material instanceof THREE[ materialClass.getValue() ] === false ) {
 
-				material = new materialClasses[ materialClass.getValue() ]();
+				material = new THREE[ materialClass.getValue() ]();
 				object.material = material;
 
 			}
@@ -493,25 +488,6 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
-			/*
-			if ( material.lightMap !== undefined ) {
-
-				var lightMapEnabled = materialLightMapEnabled.getValue() === true;
-
-				if ( objectHasUvs )  {
-
-					material.lightMap = lightMapEnabled ? materialLightMap.getValue() : null;
-					material.needsUpdate = true;
-
-				} else {
-
-					if ( lightMapEnabled ) textureWarning = true;
-
-				}
-
-			}
-			*/
-
 			if ( material.bumpMap !== undefined ) {
 
 				var bumpMapEnabled = materialBumpMapEnabled.getValue() === true;
@@ -574,6 +550,41 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
+
+			if ( material.lightMap !== undefined ) {
+
+				var lightMapEnabled = materialLightMapEnabled.getValue() === true;
+
+				if ( objectHasUvs ) {
+
+					material.lightMap = specularMapEnabled ? materialLightMap.getValue() : null;
+					material.needsUpdate = true;
+
+				} else {
+
+					if ( lightMapEnabled ) textureWarning = true;
+
+				}
+
+			}
+
+			if ( material.aoMap !== undefined ) {
+
+				var aoMapEnabled = materialAOMapEnabled.getValue() === true;
+
+				if ( objectHasUvs ) {
+
+					material.aoMap = aoMapEnabled ? materialAOMap.getValue() : null;
+					material.aoMapIntensity = materialAOScale.getValue();
+					material.needsUpdate = true;
+
+				} else {
+
+					if ( aoMapEnabled ) textureWarning = true;
+
+				}
+
+			}
 			if ( material.side !== undefined ) {
 
 				material.side = parseInt( materialSide.getValue() );
@@ -645,11 +656,12 @@ Sidebar.Material = function ( editor ) {
 			'skinning': materialSkinningRow,
 			'map': materialMapRow,
 			'alphaMap': materialAlphaMapRow,
-			'lightMap': materialLightMapRow,
 			'bumpMap': materialBumpMapRow,
 			'normalMap': materialNormalMapRow,
 			'specularMap': materialSpecularMapRow,
 			'envMap': materialEnvMapRow,
+			'lightMap': materialLightMapRow,
+			'aoMap': materialAOMapRow,
 			'side': materialSideRow,
 			'shading': materialShadingRow,
 			'blending': materialBlendingRow,
@@ -760,15 +772,6 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
-			/*
-			if ( material.lightMap !== undefined ) {
-
-				materialLightMapEnabled.setValue( material.lightMap !== null );
-				materialLightMap.setValue( material.lightMap );
-
-			}
-			*/
-
 			if ( material.bumpMap !== undefined ) {
 
 				materialBumpMapEnabled.setValue( material.bumpMap !== null );
@@ -799,6 +802,21 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
+			if ( material.lightMap !== undefined ) {
+
+				materialLightMapEnabled.setValue( material.lightMap !== null );
+				materialLightMap.setValue( material.lightMap );
+
+			}
+
+			if ( material.aoMap !== undefined ) {
+
+				materialAOMapEnabled.setValue( material.aoMap !== null );
+				materialAOMap.setValue( material.aoMap );
+				materialAOScale.setValue( material.aoMapIntensity );
+
+			}
+
 			if ( material.side !== undefined ) {
 
 				materialSide.setValue( material.side );

+ 13 - 6
editor/js/libs/app.js

@@ -11,7 +11,7 @@ var APP = {
 		var loader = new THREE.ObjectLoader();
 		var camera, scene, renderer;
 
-		var vr, controls;
+		var vr, controls, effect;
 
 		var events = {};
 
@@ -89,7 +89,7 @@ var APP = {
 				if ( camera.parent === undefined ) {
 
 					// camera needs to be in the scene so camera2 matrix updates
-					
+
 					scene.add( camera );
 
 				}
@@ -100,7 +100,7 @@ var APP = {
 				camera = camera2;
 
 				controls = new THREE.VRControls( camera );
-				renderer = new THREE.VREffect( renderer );
+				effect = new THREE.VREffect( renderer );
 
 				document.addEventListener( 'keyup', function ( event ) {
 
@@ -114,7 +114,7 @@ var APP = {
 
 				this.dom.addEventListener( 'dblclick', function () {
 
-					renderer.setFullScreen( true );
+					effect.setFullScreen( true );
 
 				} );
 
@@ -160,9 +160,16 @@ var APP = {
 
 			dispatch( events.update, { time: time, delta: time - prevTime } );
 
-			if ( vr ) controls.update();
+			if ( vr === true ) {
+
+				controls.update();
+				effect.render( scene, camera );
 
-			renderer.render( scene, camera );
+			} else {
+
+				renderer.render( scene, camera );
+
+			}
 
 			prevTime = time;
 

+ 24 - 10
editor/js/libs/codemirror/codemirror.css

@@ -4,6 +4,7 @@
   /* Set height, width, borders, and global font properties here */
   font-family: monospace;
   height: 300px;
+  color: black;
 }
 
 /* PADDING */
@@ -32,8 +33,7 @@
   min-width: 20px;
   text-align: right;
   color: #999;
-  -moz-box-sizing: content-box;
-  box-sizing: content-box;
+  white-space: nowrap;
 }
 
 .CodeMirror-guttermarker { color: black; }
@@ -139,11 +139,9 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
    the editor. You probably shouldn't touch them. */
 
 .CodeMirror {
-  line-height: 1;
   position: relative;
   overflow: hidden;
   background: white;
-  color: black;
 }
 
 .CodeMirror-scroll {
@@ -155,14 +153,10 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
   height: 100%;
   outline: none; /* Prevent dragging from highlighting the element */
   position: relative;
-  -moz-box-sizing: content-box;
-  box-sizing: content-box;
 }
 .CodeMirror-sizer {
   position: relative;
   border-right: 30px solid transparent;
-  -moz-box-sizing: content-box;
-  box-sizing: content-box;
 }
 
 /* The fake, visible scrollbars. Used to force redraw during scrolling
@@ -197,8 +191,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
 .CodeMirror-gutter {
   white-space: normal;
   height: 100%;
-  -moz-box-sizing: content-box;
-  box-sizing: content-box;
   display: inline-block;
   margin-bottom: -30px;
   /* Hack to make IE7 behave */
@@ -215,6 +207,11 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
   cursor: default;
   z-index: 4;
 }
+.CodeMirror-gutter-wrapper {
+  -webkit-user-select: none;
+  -moz-user-select: none;
+  user-select: none;
+}
 
 .CodeMirror-lines {
   cursor: text;
@@ -235,6 +232,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
   z-index: 2;
   position: relative;
   overflow: visible;
+  -webkit-tap-highlight-color: transparent;
 }
 .CodeMirror-wrap pre {
   word-wrap: break-word;
@@ -256,6 +254,20 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
 
 .CodeMirror-widget {}
 
+.CodeMirror-code {
+  outline: none;
+}
+
+/* Force content-box sizing for the elements where we expect it */
+.CodeMirror-scroll,
+.CodeMirror-sizer,
+.CodeMirror-gutter,
+.CodeMirror-gutters,
+.CodeMirror-linenumber {
+  -moz-box-sizing: content-box;
+  box-sizing: content-box;
+}
+
 .CodeMirror-measure {
   position: absolute;
   width: 100%;
@@ -283,6 +295,8 @@ div.CodeMirror-cursors {
 .CodeMirror-selected { background: #d9d9d9; }
 .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
 .CodeMirror-crosshair { cursor: crosshair; }
+.CodeMirror ::selection { background: #d7d4f0; }
+.CodeMirror ::-moz-selection { background: #d7d4f0; }
 
 .cm-searching {
   background: #ffa;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 928 - 64
editor/js/libs/codemirror/codemirror.js


+ 13 - 2
editor/js/libs/codemirror/mode/javascript.js

@@ -118,7 +118,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
       } else if (state.lastType == "operator" || state.lastType == "keyword c" ||
                state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
         readRegexp(stream);
-        stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
+        stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
         return ret("regexp", "string-2");
       } else {
         stream.eatWhile(isOperatorChar);
@@ -549,6 +549,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
   }
   function classBody(type, value) {
     if (type == "variable" || cx.style == "keyword") {
+      if (value == "static") {
+        cx.marked = "keyword";
+        return cont(classBody);
+      }
       cx.marked = "property";
       if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
       return cont(functiondef, classBody);
@@ -600,6 +604,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
     if (type == "if") return cont(expression, comprehension);
   }
 
+  function isContinuedStatement(state, textAfter) {
+    return state.lastType == "operator" || state.lastType == "," ||
+      isOperatorChar.test(textAfter.charAt(0)) ||
+      /[,.]/.test(textAfter.charAt(0));
+  }
+
   // Interface
 
   return {
@@ -651,7 +661,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
       else if (type == "form" && firstChar == "{") return lexical.indented;
       else if (type == "form") return lexical.indented + indentUnit;
       else if (type == "stat")
-        return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0);
+        return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
       else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
         return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
       else if (lexical.align) return lexical.column + (closing ? 0 : 1);
@@ -663,6 +673,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
     blockCommentEnd: jsonMode ? null : "*/",
     lineComment: jsonMode ? null : "//",
     fold: "brace",
+    closeBrackets: "()[]{}''\"\"``",
 
     helperType: jsonMode ? "json" : "javascript",
     jsonldMode: jsonldMode,

+ 2 - 0
editor/js/libs/codemirror/theme/monokai.css

@@ -2,6 +2,8 @@
 
 .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
 .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
+.cm-s-monokai.CodeMirror ::selection { background: rgba(73, 72, 62, .99); }
+.cm-s-monokai.CodeMirror ::-moz-selection { background: rgba(73, 72, 62, .99); }
 .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
 .cm-s-monokai .CodeMirror-guttermarker { color: white; }
 .cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; }

+ 12 - 12
examples/canvas_geometry_birds.html

@@ -55,13 +55,13 @@
 
 					_goal = target;
 
-				}
+				};
 
 				this.setAvoidWalls = function ( value ) {
 
 					_avoidWalls = value;
 
-				}
+				};
 
 				this.setWorldSize = function ( width, height, depth ) {
 
@@ -69,7 +69,7 @@
 					_height = height;
 					_depth = depth;
 
-				}
+				};
 
 				this.run = function ( boids ) {
 
@@ -120,7 +120,7 @@
 
 					this.move();
 
-				}
+				};
 
 				this.flock = function ( boids ) {
 
@@ -134,7 +134,7 @@
 					_acceleration.add( this.cohesion( boids ) );
 					_acceleration.add( this.separation( boids ) );
 
-				}
+				};
 
 				this.move = function () {
 
@@ -151,7 +151,7 @@
 					this.position.add( this.velocity );
 					_acceleration.set( 0, 0, 0 );
 
-				}
+				};
 
 				this.checkBounds = function () {
 
@@ -162,7 +162,7 @@
 					if ( this.position.z >  _depth ) this.position.z = - _depth;
 					if ( this.position.z < - _depth ) this.position.z =  _depth;
 
-				}
+				};
 
 				//
 
@@ -177,7 +177,7 @@
 
 					return steer;
 
-				}
+				};
 
 				this.repulse = function ( target ) {
 
@@ -194,7 +194,7 @@
 
 					}
 
-				}
+				};
 
 				this.reach = function ( target, amount ) {
 
@@ -205,7 +205,7 @@
 
 					return steer;
 
-				}
+				};
 
 				this.alignment = function ( boids ) {
 
@@ -245,7 +245,7 @@
 
 					return velSum;
 
-				}
+				};
 
 				this.cohesion = function ( boids ) {
 
@@ -288,7 +288,7 @@
 
 					return steer;
 
-				}
+				};
 
 				this.separation = function ( boids ) {
 

+ 2 - 2
examples/canvas_interactive_particles.html

@@ -38,7 +38,7 @@
 				context.arc( 0, 0, 0.5, 0, PI2, true );
 				context.fill();
 
-			}
+			};
 
 			var programStroke = function ( context ) {
 
@@ -47,7 +47,7 @@
 				context.arc( 0, 0, 0.5, 0, PI2, true );
 				context.stroke();
 
-			}
+			};
 
 			var INTERSECTED;
 

+ 1 - 1
examples/canvas_lights_pointlights.html

@@ -80,7 +80,7 @@
 					context.arc( 0, 0, 0.5, 0, PI2, true );
 					context.fill();
 
-				}
+				};
 
 				var sprite = new THREE.Sprite( new THREE.SpriteCanvasMaterial( { color: 0xff0040, program: program } ) );
 				light1.add( sprite );

+ 2 - 11
examples/canvas_materials.html

@@ -80,15 +80,6 @@
 
 				];
 
-				for ( var i = 0, l = geometry.faces.length; i < l; i ++ ) {
-
-					var face = geometry.faces[ i ];
-					if ( Math.random() > 0.5 ) face.materialIndex = Math.floor( Math.random() * materials.length );
-
-				}
-
-				materials.push( new THREE.MeshFaceMaterial( materials ) );
-
 				objects = [];
 
 				for ( var i = 0, l = materials.length; i < l; i ++ ) {
@@ -115,7 +106,7 @@
 					context.arc( 0, 0, 0.5, 0, PI2, true );
 					context.fill();
 
-				}
+				};
 
 				// Lights
 
@@ -176,7 +167,7 @@
 			function loadImage( path ) {
 
 				var image = document.createElement( 'img' );
-				var texture = new THREE.Texture( image, THREE.UVMapping )
+				var texture = new THREE.Texture( image, THREE.UVMapping );
 
 				image.onload = function () { texture.needsUpdate = true; };
 				image.src = path;

+ 1 - 1
examples/canvas_materials_video.html

@@ -140,7 +140,7 @@
 
 						particle = new THREE.Sprite( material );
 						particle.position.x = ix * separation - ( ( amountx * separation ) / 2 );
-						particle.position.y = -153
+						particle.position.y = -153;
 						particle.position.z = iy * separation - ( ( amounty * separation ) / 2 );
 						particle.scale.x = particle.scale.y = 2;
 						scene.add( particle );

+ 1 - 1
examples/canvas_particles_random.html

@@ -54,7 +54,7 @@
 					context.arc( 0, 0, 0.5, 0, PI2, true );
 					context.fill();
 
-				}
+				};
 
 				group = new THREE.Group();
 				scene.add( group );

+ 1 - 1
examples/canvas_particles_shapes.html

@@ -154,7 +154,7 @@
 					context.lineWidth = 0.5; //0.05
 					context.stroke();
 
-				}
+				};
 
 				var setTargetParticle = function() {
 

+ 1 - 1
examples/canvas_particles_sprites.html

@@ -120,7 +120,7 @@
 				var particle = this instanceof THREE.Sprite ? this : particle;
 				var delay = delay !== undefined ? delay : 0;
 
-				particle.position.set( 0, 0, 0 )
+				particle.position.set( 0, 0, 0 );
 				particle.scale.x = particle.scale.y = Math.random() * 32 + 16;
 
 				new TWEEN.Tween( particle )

+ 1 - 1
examples/css3d_sprites.html

@@ -71,7 +71,7 @@
 						var object = new THREE.CSS3DSprite( image.cloneNode() );
 						object.position.x = Math.random() * 4000 - 2000,
 						object.position.y = Math.random() * 4000 - 2000,
-						object.position.z = Math.random() * 4000 - 2000
+						object.position.z = Math.random() * 4000 - 2000;
 						scene.add( object );
 
 						objects.push( object );

+ 5 - 1
examples/index.html

@@ -194,10 +194,13 @@
 				"webgl_animation_skinning_morph",
 				"webgl_buffergeometry",
 				"webgl_buffergeometry_custom_attributes_particles",
+				"webgl_buffergeometry_drawcalls",
+				"webgl_buffergeometry_instancing",
+				"webgl_buffergeometry_instancing_dynamic",
+				"webgl_buffergeometry_instancing_interleaved_dynamic",
 				"webgl_buffergeometry_lines",
 				"webgl_buffergeometry_lines_indexed",
 				"webgl_buffergeometry_particles",
-				"webgl_buffergeometry_drawcalls",
 				"webgl_buffergeometry_rawshader",
 				"webgl_buffergeometry_uint",
 				"webgl_camera",
@@ -351,6 +354,7 @@
 				"webgl_shader_lava",
 				"webgl_shader2",
 				"webgl_shaders_ocean",
+				"webgl_shaders_ocean2",
 				"webgl_shading_physical",
 				"webgl_shaders_sky",
 				"webgl_shaders_tonemapping",

+ 2 - 2
examples/js/AudioObject.js

@@ -42,7 +42,7 @@ THREE.AudioObject = function ( url, volume, playbackRate, loop ) {
 
 		} catch ( error ) {
 
-			console.warn( "THREE.AudioObject: webkitAudioContext not found" );
+			THREE.warn( "THREE.AudioObject: webkitAudioContext not found" );
 			return this;
 
 		}
@@ -154,7 +154,7 @@ THREE.AudioObject = function ( url, volume, playbackRate, loop ) {
 			_this.source.buffer = _this.context.createBuffer( request.response, true );
 			_this.source.noteOn( 0 );
 
-		}
+		};
 
 		request.send();
 

+ 4 - 4
examples/js/BlendCharacter.js

@@ -124,7 +124,7 @@ THREE.BlendCharacter = function () {
 
 		}
 
-	}
+	};
 
 	this.play = function(animName, weight) {
 
@@ -231,13 +231,13 @@ THREE.BlendCharacter = function () {
 		this.weightSchedule.length = 0;
 		this.warpSchedule.length = 0;
 
-	}
+	};
 
 	this.showSkeleton = function( boolean ) {
 
 		this.skeletonHelper.visible = boolean;
 
-	}
+	};
 
 	this.showModel = function( boolean ) {
 
@@ -266,5 +266,5 @@ THREE.BlendCharacter.prototype.getForward = function() {
 
 		return forward;
 	}
-}
+};
 

+ 10 - 10
examples/js/BlendCharacterGui.js

@@ -78,7 +78,7 @@ function BlendCharacterGui(animations) {
 		playback.open();
 		blending.open();
 
-	}
+	};
 
 	var getAnimationData = function() {
 
@@ -94,7 +94,7 @@ function BlendCharacterGui(animations) {
 			}
 
 		};
-	}
+	};
 
 	controls.start = function() {
 
@@ -144,7 +144,7 @@ function BlendCharacterGui(animations) {
 		fadeData.detail.time = controls[ "Crossfade Time" ];
 
 		window.dispatchEvent( new CustomEvent( 'crossfade', fadeData ) );
-	}
+	};
 
 	controls.warp = function( from, to ) {
 
@@ -154,7 +154,7 @@ function BlendCharacterGui(animations) {
 		warpData.detail.time = controls[ "Crossfade Time" ];
 
 		window.dispatchEvent( new CustomEvent( 'warp', warpData ) );
-	}
+	};
 
 	controls['idle to walk'] = function() {
 
@@ -180,10 +180,10 @@ function BlendCharacterGui(animations) {
 			detail: {
 				shouldLock: controls['Lock Camera']
 			}
-		}
+		};
 
 		window.dispatchEvent( new CustomEvent( 'toggle-lock-camera', data ) );
-	}
+	};
 
 	controls.showSkeletonChanged = function() {
 
@@ -191,10 +191,10 @@ function BlendCharacterGui(animations) {
 			detail: {
 				shouldShow: controls['Show Skeleton']
 			}
-		}
+		};
 
 		window.dispatchEvent( new CustomEvent( 'toggle-show-skeleton', data ) );
-	}
+	};
 
 
 	controls.showModelChanged = function() {
@@ -203,10 +203,10 @@ function BlendCharacterGui(animations) {
 			detail: {
 				shouldShow: controls['Show Model']
 			}
-		}
+		};
 
 		window.dispatchEvent( new CustomEvent( 'toggle-show-model', data ) );
-	}
+	};
 
 
 	init.call(this);

+ 3 - 3
examples/js/Car.js

@@ -246,7 +246,7 @@ THREE.Car = function () {
 
 		createCar();
 
-	};
+	}
 
 	function createWheels ( geometry, materials ) {
 
@@ -255,7 +255,7 @@ THREE.Car = function () {
 
 		createCar();
 
-	};
+	}
 
 	function createCar () {
 
@@ -360,7 +360,7 @@ THREE.Car = function () {
 
 		}
 
-	};
+	}
 
 	function quadraticEaseOut( k ) { return - k * ( k - 2 ); }
 	function cubicEaseOut( k ) { return -- k * k * k + 1; }

+ 2 - 2
examples/js/Cloth.js

@@ -86,7 +86,7 @@ Particle.prototype.integrate = function(timesq) {
 	this.position = newPos;
 
 	this.a.set(0, 0, 0);
-}
+};
 
 
 var diff = new THREE.Vector3();
@@ -243,7 +243,7 @@ function simulate(time) {
 
 
 	ballPosition.z = -Math.sin(Date.now() / 600) * 90 ; //+ 40;
-	ballPosition.x = Math.cos(Date.now() / 400) * 70
+	ballPosition.x = Math.cos(Date.now() / 400) * 70;
 
 	if (sphere.visible)
 	for (particles = cloth.particles, i = 0, il = particles.length

+ 1 - 1
examples/js/CurveExtras.js

@@ -217,7 +217,7 @@ var scaleTo = function(x, y, t) {
 	var r = y - x;
 	return t * r + x;
 
-}
+};
 
 THREE.Curves.FigureEightPolynomialKnot = THREE.Curve.create(
 

+ 1 - 1
examples/js/ImprovedNoise.js

@@ -68,4 +68,4 @@ var ImprovedNoise = function () {
 
 		}
 	}
-}
+};

+ 5 - 6
examples/js/MD2Character.js

@@ -29,7 +29,7 @@ THREE.MD2Character = function () {
 
 		this.loadCounter = config.weapons.length * 2 + config.skins.length + 1;
 
-		var weaponsTextures = []
+		var weaponsTextures = [];
 		for ( var i = 0; i < config.weapons.length; i ++ ) weaponsTextures[ i ] = config.weapons[ i ][ 1 ];
 
 		// SKINS
@@ -79,7 +79,7 @@ THREE.MD2Character = function () {
 
 			}
 
-		}
+		};
 
 		for ( var i = 0; i < config.weapons.length; i ++ ) {
 
@@ -195,7 +195,7 @@ THREE.MD2Character = function () {
 
 		return textures;
 
-	};
+	}
 
 	function createPart( geometry, skinMap ) {
 
@@ -205,7 +205,6 @@ THREE.MD2Character = function () {
 		var materialWireframe = new THREE.MeshPhongMaterial( { color: 0xffaa00, specular: 0x111111, shininess: 50, wireframe: true, shading: THREE.SmoothShading, map: whiteMap, morphTargets: true, morphNormals: true, metal: false } );
 
 		var materialTexture = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 50, wireframe: false, shading: THREE.SmoothShading, map: skinMap, morphTargets: true, morphNormals: true, metal: false } );
-		materialTexture.wrapAround = true;
 
 		//
 
@@ -229,7 +228,7 @@ THREE.MD2Character = function () {
 
 		return mesh;
 
-	};
+	}
 
 	function checkLoadingComplete() {
 
@@ -237,6 +236,6 @@ THREE.MD2Character = function () {
 
 		if ( scope.loadCounter === 0 ) scope.onLoadComplete();
 
-	};
+	}
 
 };

+ 5 - 6
examples/js/MD2CharacterComplex.js

@@ -142,7 +142,7 @@ THREE.MD2CharacterComplex = function () {
 
 		this.loadCounter = config.weapons.length * 2 + config.skins.length + 1;
 
-		var weaponsTextures = []
+		var weaponsTextures = [];
 		for ( var i = 0; i < config.weapons.length; i ++ ) weaponsTextures[ i ] = config.weapons[ i ][ 1 ];
 
 		// SKINS
@@ -193,7 +193,7 @@ THREE.MD2CharacterComplex = function () {
 
 			}
 
-		}
+		};
 
 		for ( var i = 0; i < config.weapons.length; i ++ ) {
 
@@ -518,7 +518,7 @@ THREE.MD2CharacterComplex = function () {
 
 		return textures;
 
-	};
+	}
 
 	function createPart( geometry, skinMap ) {
 
@@ -528,7 +528,6 @@ THREE.MD2CharacterComplex = function () {
 		var materialWireframe = new THREE.MeshPhongMaterial( { color: 0xffaa00, specular: 0x111111, shininess: 50, wireframe: true, shading: THREE.SmoothShading, map: whiteMap, morphTargets: true, morphNormals: true, metal: true } );
 
 		var materialTexture = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 50, wireframe: false, shading: THREE.SmoothShading, map: skinMap, morphTargets: true, morphNormals: true, metal: true } );
-		materialTexture.wrapAround = true;
 
 		//
 
@@ -546,14 +545,14 @@ THREE.MD2CharacterComplex = function () {
 
 		return mesh;
 
-	};
+	}
 
 	function checkLoadingComplete() {
 
 		scope.loadCounter -= 1;
 		if ( scope.loadCounter === 0 ) 	scope.onLoadComplete();
 
-	};
+	}
 
 	function exponentialEaseOut( k ) { return k === 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; }
 

+ 15 - 15
examples/js/MarchingCubes.js

@@ -196,7 +196,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1 );
 			this.VIntX( q * 3, this.vlist, this.nlist, 0, isol, fx, fy, fz, field0, field1 );
 
-		};
+		}
 
 		if ( bits & 2 ) {
 
@@ -204,7 +204,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1y );
 			this.VIntY( q1 * 3, this.vlist, this.nlist, 3, isol, fx2, fy, fz, field1, field3 );
 
-		};
+		}
 
 		if ( bits & 4 ) {
 
@@ -212,7 +212,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1y );
 			this.VIntX( qy * 3, this.vlist, this.nlist, 6, isol, fx, fy2, fz, field2, field3 );
 
-		};
+		}
 
 		if ( bits & 8 ) {
 
@@ -220,7 +220,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( qy );
 			this.VIntY( q * 3, this.vlist, this.nlist, 9, isol, fx, fy, fz, field0, field2 );
 
-		};
+		}
 
 		// bottom of the cube
 
@@ -230,7 +230,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1z );
 			this.VIntX( qz * 3, this.vlist, this.nlist, 12, isol, fx, fy, fz2, field4, field5 );
 
-		};
+		}
 
 		if ( bits & 32 ) {
 
@@ -238,7 +238,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1yz );
 			this.VIntY( q1z * 3,  this.vlist, this.nlist, 15, isol, fx2, fy, fz2, field5, field7 );
 
-		};
+		}
 
 		if ( bits & 64 ) {
 
@@ -246,7 +246,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1yz );
 			this.VIntX( qyz * 3, this.vlist, this.nlist, 18, isol, fx, fy2, fz2, field6, field7 );
 
-		};
+		}
 
 		if ( bits & 128 ) {
 
@@ -254,7 +254,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( qyz );
 			this.VIntY( qz * 3,  this.vlist, this.nlist, 21, isol, fx, fy, fz2, field4, field6 );
 
-		};
+		}
 
 		// vertical lines of the cube
 
@@ -264,7 +264,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( qz );
 			this.VIntZ( q * 3, this.vlist, this.nlist, 24, isol, fx, fy, fz, field0, field4 );
 
-		};
+		}
 
 		if ( bits & 512 ) {
 
@@ -272,7 +272,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1z );
 			this.VIntZ( q1 * 3,  this.vlist, this.nlist, 27, isol, fx2, fy,  fz, field1, field5 );
 
-		};
+		}
 
 		if ( bits & 1024 ) {
 
@@ -280,7 +280,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( q1yz );
 			this.VIntZ( q1y * 3, this.vlist, this.nlist, 30, isol, fx2, fy2, fz, field3, field7 );
 
-		};
+		}
 
 		if ( bits & 2048 ) {
 
@@ -288,7 +288,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 			this.compNorm( qyz );
 			this.VIntZ( qy * 3, this.vlist, this.nlist, 33, isol, fx,  fy2, fz, field2, field6 );
 
-		};
+		}
 
 		cubeindex <<= 4;  // re-purpose cubeindex into an offset into triTable
 
@@ -740,7 +740,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 
 		this.render( geo_callback );
 
-		// console.log( "generated " + geo.faces.length + " triangles" );
+		// THREE.log( "generated " + geo.faces.length + " triangles" );
 
 		return geo;
 
@@ -751,7 +751,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 };
 
 THREE.MarchingCubes.prototype = Object.create( THREE.ImmediateRenderObject.prototype );
-THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
+THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
 
 
 /////////////////////////////////////
@@ -794,7 +794,7 @@ THREE.edgeTable = new Int32Array([
 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,
 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
-0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ])
+0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ]);
 
 THREE.triTable = new Int32Array([
 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,

+ 1 - 1
examples/js/Mirror.js

@@ -103,7 +103,7 @@ THREE.Mirror = function ( renderer, camera, options ) {
 	} else {
 
 		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!' );
 
 	}
 

+ 1 - 1
examples/js/Ocean.js

@@ -18,7 +18,7 @@
 	// Assign optional parameters as variables and object properties
 	function optionalParameter(value, defaultValue) {
 		return value !== undefined ? value : defaultValue;
-	};
+	}
 	options = options || {};
 	this.clearColor = optionalParameter(options.CLEAR_COLOR, [ 1.0, 1.0, 1.0, 0.0 ]);
 	this.geometryOrigin = optionalParameter(options.GEOMETRY_ORIGIN, [ -1000.0, -1000.0 ]);

+ 3 - 3
examples/js/Octree.js

@@ -2029,9 +2029,9 @@
 			
 			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 ++ ) {
 				

+ 6 - 5
examples/js/ShaderDeferred.js

@@ -149,8 +149,9 @@ THREE.ShaderDeferred = {
 
 			THREE.ShaderChunk[ "common" ],
 			THREE.ShaderChunk[ "color_pars_fragment" ],
+			THREE.ShaderChunk[ "uv_pars_fragment" ],
+			THREE.ShaderChunk[ "uv2_pars_fragment" ],
 			THREE.ShaderChunk[ "map_pars_fragment" ],
-			THREE.ShaderChunk[ "lightmap_pars_fragment" ],
 
 			"#ifdef USE_ENVMAP",
 
@@ -309,8 +310,8 @@ THREE.ShaderDeferred = {
 		vertexShader : [
 
 			THREE.ShaderChunk[ "common" ],
-			THREE.ShaderChunk[ "map_pars_vertex" ],
-			THREE.ShaderChunk[ "lightmap_pars_vertex" ],
+			THREE.ShaderChunk[ "uv_pars_vertex" ],
+			THREE.ShaderChunk[ "uv2_pars_vertex" ],
 			THREE.ShaderChunk[ "color_pars_vertex" ],
 			THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
 			THREE.ShaderChunk[ "skinning_pars_vertex" ],
@@ -324,8 +325,8 @@ THREE.ShaderDeferred = {
 
 			"void main() {",
 
-				THREE.ShaderChunk[ "map_vertex" ],
-				THREE.ShaderChunk[ "lightmap_vertex" ],
+				THREE.ShaderChunk[ "uv_vertex" ],
+				THREE.ShaderChunk[ "uv2_vertex" ],
 				THREE.ShaderChunk[ "color_vertex" ],
 
 				THREE.ShaderChunk[ "skinbase_vertex" ],

+ 1 - 1
examples/js/SimplexNoise.js

@@ -55,7 +55,7 @@ SimplexNoise.prototype.dot = function(g, x, y) {
 
 SimplexNoise.prototype.dot3 = function(g, x, y, z) {
 	return g[0] * x + g[1] * y + g[2] * z; 
-}
+};
 
 SimplexNoise.prototype.dot4 = function(g, x, y, z, w) {
 	return g[0] * x + g[1] * y + g[2] * z + g[3] * w;

+ 4 - 4
examples/js/SimulationRenderer.js

@@ -130,7 +130,7 @@ function SimulationRenderer(WIDTH, renderer) {
 		mesh.material = passThruShader;
 		uniforms.texture.value = input;
 		renderer.render( scene, camera, output );
-	}
+	};
 
 
 	this.renderPosition = function(position, velocity, output, delta) {
@@ -141,7 +141,7 @@ function SimulationRenderer(WIDTH, renderer) {
 		positionShader.uniforms.delta.value = delta;
 		renderer.render( scene, camera, output );
 		this.currentPosition = output;
-	}
+	};
 
 	this.renderVelocity = function(position, velocity, output, delta) {
 		mesh.material = velocityShader;
@@ -151,7 +151,7 @@ function SimulationRenderer(WIDTH, renderer) {
 		velocityShader.uniforms.delta.value = delta;
 		renderer.render( scene, camera, output );
 		this.currentVelocity = output;
-	}
+	};
 
 	this.simulate = function( delta ) {
 
@@ -169,7 +169,7 @@ function SimulationRenderer(WIDTH, renderer) {
 
 		flipflop = !flipflop;
 
-	}
+	};
 
 	function generatePositionTexture() {
 

+ 1 - 1
examples/js/SkyShader.js

@@ -251,7 +251,7 @@ THREE.Sky = function () {
 		side: THREE.BackSide
 	} );
 
-	var skyGeo = new THREE.SphereGeometry( 450000, 32, 15 );
+	var skyGeo = new THREE.SphereBufferGeometry( 450000, 32, 15 );
 	var skyMesh = new THREE.Mesh( skyGeo, skyMat );
 
 

+ 3 - 3
examples/js/Sparks.js

@@ -213,8 +213,8 @@ SPARKS.Emitter.prototype = {
  * Events called by emitter.dispatchEvent()
  *
  */
-SPARKS.EVENT_PARTICLE_CREATED = "created"
-SPARKS.EVENT_PARTICLE_UPDATED = "updated"
+SPARKS.EVENT_PARTICLE_CREATED = "created";
+SPARKS.EVENT_PARTICLE_UPDATED = "updated";
 SPARKS.EVENT_PARTICLE_DEAD = "dead";
 SPARKS.EVENT_LOOP_UPDATED = "loopUpdated";
 
@@ -495,7 +495,7 @@ SPARKS.RandomDrift = function(x,y,z) {
 	}
 
 	this.drift = new THREE.Vector3(x,y,z);
-}
+};
 
 
 SPARKS.RandomDrift.prototype.update = function(emitter, particle, time) {

+ 5 - 6
examples/js/UCSCharacter.js

@@ -36,7 +36,7 @@ THREE.UCSCharacter = function() {
 		
 		// CHARACTER
 		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 ) {
 			geometry.computeBoundingBox();
 			geometry.computeVertexNormals();
@@ -75,7 +75,7 @@ THREE.UCSCharacter = function() {
 				mesh.morphTargetInfluences[ i ] = influences[ scope.morphs[ i ] ] / 100;
 			}
 		}
-	}
+	};
 	
 	function loadTextures( baseUrl, textureUrls ) {
 		var mapping = THREE.UVMapping;
@@ -89,7 +89,7 @@ THREE.UCSCharacter = function() {
 		}
 
 		return textures;
-	};
+	}
 
 	function createMaterials( skins ) {
 		var materials = [];
@@ -101,8 +101,7 @@ THREE.UCSCharacter = function() {
 				specular: 10.0,
 				map: skins[ i ],
 				skinning: true,
-				morphTargets: true,
-				wrapAround: true
+				morphTargets: true
 			} );
 
 		}
@@ -122,4 +121,4 @@ THREE.UCSCharacter = function() {
 
 	}
 
-}
+};

+ 4 - 2
examples/js/WaterShader.js

@@ -109,7 +109,7 @@ THREE.Water = function ( renderer, camera, scene, options ) {
 
 	function optionalParameter ( value, defaultValue ) {
 		return value !== undefined ? value : defaultValue;
-	};
+	}
 
 	options = options || {};
 	
@@ -142,7 +142,7 @@ THREE.Water = function ( renderer, camera, scene, options ) {
 	else 
 	{
 		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();
@@ -177,7 +177,9 @@ THREE.Water = function ( renderer, camera, scene, options ) {
 	if ( !THREE.Math.isPowerOfTwo(width) || !THREE.Math.isPowerOfTwo(height) )
 	{
 		this.texture.generateMipmaps = false;
+		this.texture.minFilter = THREE.LinearFilter;
 		this.tempTexture.generateMipmaps = false;
+		this.tempTexture.minFilter = THREE.LinearFilter;
 	}
 
 	this.updateTextureMatrix();

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

@@ -16,7 +16,7 @@ THREE.CombinedCamera = function ( width, height, fov, near, far, orthoNear, orth
 	this.fov = fov;
 
 	this.left = -width / 2;
-	this.right = width / 2
+	this.right = width / 2;
 	this.top = height / 2;
 	this.bottom = -height / 2;
 
@@ -106,7 +106,7 @@ THREE.CombinedCamera.prototype.setSize = function( width, height ) {
 
 	this.cameraP.aspect = width / height;
 	this.left = -width / 2;
-	this.right = width / 2
+	this.right = width / 2;
 	this.top = height / 2;
 	this.bottom = -height / 2;
 

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

@@ -255,7 +255,7 @@ THREE.EditorControls = function ( object, domElement ) {
 
 			return closest;
 
-		}
+		};
 
 		switch ( event.touches.length ) {
 

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

@@ -271,7 +271,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 		};
 
-	};
+	}
 
 	this.handleResize();
 

+ 3 - 3
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.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.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 ] );
 
 	};
 
@@ -252,7 +252,7 @@ THREE.FlyControls = function ( object, domElement ) {
 
 		};
 
-	};
+	}
 
 	this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
 

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

@@ -45,7 +45,7 @@ THREE.MouseControls = function ( object ) {
 
 		mouseQuat.x.setFromAxisAngle( xVector, this.orientation.x );
 		mouseQuat.y.setFromAxisAngle( yVector, this.orientation.y );
-		object.quaternion.copy(mouseQuat.y).multiply(mouseQuat.x)
+		object.quaternion.copy(mouseQuat.y).multiply(mouseQuat.x);
 		return;
 
 	};

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

@@ -208,7 +208,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 		} else {
 
 			// 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 {
 
-			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 {
 
-			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.' );
 
 		}
 

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

@@ -176,7 +176,7 @@ THREE.OrthographicTrackballControls = function ( object, domElement ) {
 
 			_eye.copy( _this.object.position ).sub( _this.target );
 
-			vector.copy( _this.object.up ).setLength( mouseOnBall.y )
+			vector.copy( _this.object.up ).setLength( mouseOnBall.y );
 			vector.add( objectUp.copy( _this.object.up ).cross( _eye ).setLength( mouseOnBall.x ) );
 			vector.add( _eye.setLength( mouseOnBall.z ) );
 

+ 23 - 6
examples/js/controls/TransformControls.js

@@ -632,6 +632,23 @@
 		domElement.addEventListener( "touchcancel", onPointerUp, false );
 		domElement.addEventListener( "touchleave", onPointerUp, false );
 
+		this.dispose = function () {
+			domElement.removeEventListener( "mousedown", onPointerDown );
+			domElement.removeEventListener( "touchstart", onPointerDown );
+
+			domElement.removeEventListener( "mousemove", onPointerHover );
+			domElement.removeEventListener( "touchmove", onPointerHover );
+
+			domElement.removeEventListener( "mousemove", onPointerMove );
+			domElement.removeEventListener( "touchmove", onPointerMove );
+
+			domElement.removeEventListener( "mouseup", onPointerUp );
+			domElement.removeEventListener( "mouseout", onPointerUp );
+			domElement.removeEventListener( "touchend", onPointerUp );
+			domElement.removeEventListener( "touchcancel", onPointerUp );
+			domElement.removeEventListener( "touchleave", onPointerUp );
+		};
+
 		this.attach = function ( object ) {
 
 			scope.object = object;
@@ -645,7 +662,7 @@
 
 		};
 
-		this.detach = function ( object ) {
+		this.detach = function () {
 
 			scope.object = undefined;
 			this.axis = null;
@@ -726,8 +743,6 @@
 
 			if ( scope.object === undefined || _dragging === true ) return;
 
-			event.preventDefault();
-
 			var pointer = event.changedTouches ? event.changedTouches[ 0 ] : event;
 
 			var intersect = intersectObjects( pointer, scope.gizmo[_mode].pickers.children );
@@ -738,6 +753,8 @@
 
 				axis = intersect.object.name;
 
+				event.preventDefault();
+
 			}
 
 			if ( scope.axis !== axis ) {
@@ -754,9 +771,6 @@
 
 			if ( scope.object === undefined || _dragging === true ) return;
 
-			event.preventDefault();
-			event.stopPropagation();
-
 			var pointer = event.changedTouches ? event.changedTouches[ 0 ] : event;
 
 			if ( pointer.button === 0 || pointer.button === undefined ) {
@@ -765,6 +779,9 @@
 
 				if ( intersect ) {
 
+					event.preventDefault();
+					event.stopPropagation();
+
 					scope.dispatchEvent( mouseDownEvent );
 
 					scope.axis = intersect.object.name;

+ 67 - 26
examples/js/controls/VRControls.js

@@ -3,65 +3,107 @@
  * @author mrdoob / http://mrdoob.com
  */
 
-THREE.VRControls = function ( object, callback ) {
+THREE.VRControls = function ( object, onError ) {
 
 	var scope = this;
 
-	var vrInput;
+	var vrInputs = [];
 
-	var onVRDevices = function ( devices ) {
+	function filterInvalidDevices( devices ) {
 
-		for ( var i = 0; i < devices.length; i ++ ) {
+		// Exclude Cardboard position sensor if Oculus exists.
 
-			var device = devices[ i ];
+		var oculusDevices = devices.filter( function ( device ) {
 
-			if ( device instanceof PositionSensorVRDevice ) {
+			return device.deviceName.toLowerCase().indexOf('oculus') !== -1;
 
-				vrInput = devices[ i ];
-				return; // We keep the first we encounter
+		} );
 
-			}
+		if ( oculusDevices.length >= 1 ) {
 
-		}
+			return devices.filter( function ( device ) {
+
+				return device.deviceName.toLowerCase().indexOf('cardboard') === -1;
+
+			} );
 
-		if ( callback !== undefined ) {
+		} else {
 
-			callback( 'HMD not available' );
+			return devices;
 
 		}
 
-	};
+	}
+
+	function gotVRDevices( devices ) {
+
+		devices = filterInvalidDevices( devices );
 
-	if ( navigator.getVRDevices !== undefined ) {
+		for ( var i = 0; i < devices.length; i ++ ) {
+
+			if ( devices[ i ] instanceof PositionSensorVRDevice ) {
+
+				vrInputs.push( devices[ i ] );
+
+			}
 
-		navigator.getVRDevices().then( onVRDevices );
+		}
+
+		if ( onError ) onError( 'HMD not available' );
+
+	}
 
-	} else if ( callback !== undefined ) {
+	if ( navigator.getVRDevices ) {
 
-		callback( 'Your browser is not VR Ready' );
+		navigator.getVRDevices().then( gotVRDevices );
 
 	}
 
 	// the Rift SDK returns the position in meters
 	// this scale factor allows the user to define how meters
 	// are converted to scene units.
+
 	this.scale = 1;
 
 	this.update = function () {
 
-		if ( vrInput === undefined ) return;
+		for ( var i = 0; i < vrInputs.length; i ++ ) {
+
+			var vrInput = vrInputs[ i ];
+
+			var state = vrInput.getState();
 
-		var state = vrInput.getState();
+			if ( state.orientation !== null ) {
 
-		if ( state.orientation !== null ) {
+				object.quaternion.copy( state.orientation );
+
+			}
 
-			object.quaternion.copy( state.orientation );
+			if ( state.position !== null ) {
+
+				object.position.copy( state.position ).multiplyScalar( scope.scale );
+
+			}
 
 		}
 
-		if ( state.position !== null ) {
+	};
+
+	this.resetSensor = function () {
+
+		for ( var i = 0; i < vrInputs.length; i ++ ) {
+
+			var vrInput = vrInputs[ i ];
+
+			if ( vrInput.resetSensor !== undefined ) {
+
+				vrInput.resetSensor();
 
-			object.position.copy( state.position ).multiplyScalar( scope.scale );
+			} else if ( vrInput.zeroSensor !== undefined ) {
+
+				vrInput.zeroSensor();
+
+			}
 
 		}
 
@@ -69,9 +111,8 @@ THREE.VRControls = function ( object, callback ) {
 
 	this.zeroSensor = function () {
 
-		if ( vrInput === undefined ) return;
-
-		vrInput.zeroSensor();
+		THREE.warn( 'THREE.VRControls: .zeroSensor() is now .resetSensor().' );
+		this.resetSensor();
 
 	};
 

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

@@ -47,7 +47,7 @@ function generateGeometry(objectType, numObjects) {
 		}
 		else if ( objectType == "sphere" )
 		{
-			geom = new THREE.IcosahedronGeometry( 1, 1 )
+			geom = new THREE.IcosahedronGeometry( 1, 1 );
 			scale.y = scale.z = scale.x;
 			color.setRGB( Math.random() + 0.1, 0, 0 );
 		}

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

@@ -103,19 +103,19 @@ function Transition ( sceneA, sceneB ) {
 	
 		this.quadmaterial.uniforms.threshold.value = value;
 
-	}
+	};
 	
 	this.useTexture = function ( value ) {
 	
 		this.quadmaterial.uniforms.useTexture.value = value ? 1 : 0;
 
-	}
+	};
 	
 	this.setTexture = function ( i ) {
 		
 		this.quadmaterial.uniforms.tMixTexture.value = this.textures[i];
 		
-	}
+	};
 	
 	this.render = function( delta ) {
 		

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

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

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

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

+ 149 - 158
examples/js/effects/VREffect.js

@@ -1,200 +1,187 @@
 /**
  * @author dmarcos / https://github.com/dmarcos
+ * @author mrdoob / http://mrdoob.com
  *
- * It handles stereo rendering
- * If mozGetVRDevices and getVRDevices APIs are not available it gracefuly falls back to a
- * regular renderer
+ * WebVR Spec: http://mozvr.github.io/webvr-spec/webvr.html
  *
- * The HMD supported is the Oculus DK1 and The Web API doesn't currently allow
- * to query for the display resolution (only the chrome API allows it).
- * The dimensions of the screen are temporarly hardcoded (1280 x 800).
- *
- * For VR mode to work it has to be used with the Oculus enabled builds of Firefox or Chrome:
- *
- * Firefox:
- *
- * http://mozvr.com/downloads.html
- *
- * Chrome builds:
- *
- * https://drive.google.com/a/google.com/folderview?id=0BzudLt22BqGRbW9WTHMtOWMzNjQ&usp=sharing#list
+ * Firefox: http://mozvr.com/downloads/
+ * Chromium: https://drive.google.com/folderview?id=0BzudLt22BqGRbW9WTHMtOWMzNjQ&usp=sharing#list
  *
  */
-THREE.VREffect = function ( renderer, done ) {
 
-	var cameraLeft = new THREE.PerspectiveCamera();
-	var cameraRight = new THREE.PerspectiveCamera();
+THREE.VREffect = function ( renderer, onError ) {
 
-	this._renderer = renderer;
+	var vrHMD;
+	var eyeTranslationL, eyeFOVL;
+	var eyeTranslationR, eyeFOVR;
 
-	this._init = function() {
-		var self = this;
-		if ( !navigator.mozGetVRDevices && !navigator.getVRDevices ) {
-			if ( done ) {
-				done("Your browser is not VR Ready");
-			}
-			return;
-		}
-		if ( navigator.getVRDevices ) {
-			navigator.getVRDevices().then( gotVRDevices );
-		} else {
-			navigator.mozGetVRDevices( gotVRDevices );
-		}
-		function gotVRDevices( devices ) {
-			var vrHMD;
-			var error;
-			for ( var i = 0; i < devices.length; ++ i ) {
-				if ( devices[i] instanceof HMDVRDevice ) {
-					vrHMD = devices[i];
-					self._vrHMD = vrHMD;
-					self.leftEyeTranslation = vrHMD.getEyeTranslation( "left" );
-					self.rightEyeTranslation = vrHMD.getEyeTranslation( "right" );
-					self.leftEyeFOV = vrHMD.getRecommendedEyeFieldOfView( "left" );
-					self.rightEyeFOV = vrHMD.getRecommendedEyeFieldOfView( "right" );
-					break; // We keep the first we encounter
-				}
-			}
-			if ( done ) {
-				if ( !vrHMD ) {
-					error = 'HMD not available';
-				}
-				done( error );
-			}
-		}
-	};
+	function gotVRDevices( devices ) {
 
-	this._init();
+		for ( var i = 0; i < devices.length; i ++ ) {
 
-	this.render = function ( scene, camera ) {
-		var renderer = this._renderer;
-		var vrHMD = this._vrHMD;
-		// VR render mode if HMD is available
-		if ( vrHMD ) {
-			this.renderStereo.apply( this, arguments );
-			return;
-		}
-		// Regular render mode if not HMD
-		if ( scene instanceof Array ) scene = scene[ 0 ];
-		renderer.render.apply( this._renderer, arguments );
-	};
+			if ( devices[ i ] instanceof HMDVRDevice ) {
 
-	this.renderStereo = function( scene, camera, renderTarget, forceClear ) {
+				vrHMD = devices[ i ];
 
-		var sceneLeft, sceneRight;
+				if ( vrHMD.getEyeParameters !== undefined ) {
 
-		if ( scene instanceof Array ) {
+					var eyeParamsL = vrHMD.getEyeParameters( 'left' );
+					var eyeParamsR = vrHMD.getEyeParameters( 'right' );
 
-			sceneLeft = scene[ 0 ];
-			sceneRight = scene[ 1 ];
+					eyeTranslationL = eyeParamsL.eyeTranslation;
+					eyeTranslationR = eyeParamsR.eyeTranslation;
+					eyeFOVL = eyeParamsL.recommendedFieldOfView;
+					eyeFOVR = eyeParamsR.recommendedFieldOfView;
 
-		} else {
+				} else {
 
-			sceneLeft = scene;
-			sceneRight = scene;
+					// TODO: This is an older code path and not spec compliant.
+					// It should be removed at some point in the near future.
+					eyeTranslationL = vrHMD.getEyeTranslation( 'left' );
+					eyeTranslationR = vrHMD.getEyeTranslation( 'right' );
+					eyeFOVL = vrHMD.getRecommendedEyeFieldOfView( 'left' );
+					eyeFOVR = vrHMD.getRecommendedEyeFieldOfView( 'right' );
 
-		}
+				}
 
-		var leftEyeTranslation = this.leftEyeTranslation;
-		var rightEyeTranslation = this.rightEyeTranslation;
-		var renderer = this._renderer;
-		var rendererWidth = renderer.context.drawingBufferWidth / renderer.getPixelRatio();
-		var rendererHeight = renderer.context.drawingBufferHeight / renderer.getPixelRatio();
-		var eyeDivisionLine = rendererWidth / 2;
+				break; // We keep the first we encounter
 
-		renderer.enableScissorTest( true );
-		renderer.clear();
+			}
 
-		if ( camera.parent === undefined ) {
-			camera.updateMatrixWorld();
 		}
 
-		cameraLeft.projectionMatrix = this.FovToProjection( this.leftEyeFOV, true, camera.near, camera.far );
-		cameraRight.projectionMatrix = this.FovToProjection( this.rightEyeFOV, true, camera.near, camera.far );
+		if ( vrHMD === undefined ) {
 
-		camera.matrixWorld.decompose( cameraLeft.position, cameraLeft.quaternion, cameraLeft.scale );
-		camera.matrixWorld.decompose( cameraRight.position, cameraRight.quaternion, cameraRight.scale );
+			if ( onError ) onError( 'HMD not available' );
 
-		cameraLeft.translateX( leftEyeTranslation.x );
-		cameraRight.translateX( rightEyeTranslation.x );
+		}
 
-		// render left eye
-		renderer.setViewport( 0, 0, eyeDivisionLine, rendererHeight );
-		renderer.setScissor( 0, 0, eyeDivisionLine, rendererHeight );
-		renderer.render( sceneLeft, cameraLeft );
+	}
 
-		// render right eye
-		renderer.setViewport( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight );
-		renderer.setScissor( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight );
-		renderer.render( sceneRight, cameraRight );
+	if ( navigator.getVRDevices ) {
 
-		renderer.enableScissorTest( false );
+		navigator.getVRDevices().then( gotVRDevices );
 
-	};
+	}
+
+	//
+
+	this.scale = 1;
 
 	this.setSize = function( width, height ) {
+
 		renderer.setSize( width, height );
+
 	};
 
-	this.setFullScreen = function( enable ) {
-		var renderer = this._renderer;
-		var vrHMD = this._vrHMD;
-		var canvasOriginalSize = this._canvasOriginalSize;
-		if (!vrHMD) {
-			return;
-		}
-		// If state doesn't change we do nothing
-		if ( enable === this._fullScreen ) {
-			return;
-		}
-		this._fullScreen = !!enable;
+	// fullscreen
 
-		// VR Mode disabled
-		if ( !enable ) {
-			// Restores canvas original size
-			renderer.setSize( canvasOriginalSize.width, canvasOriginalSize.height );
-			return;
-		}
-		// VR Mode enabled
-		this._canvasOriginalSize = {
-			width: renderer.domElement.width,
-			height: renderer.domElement.height
-		};
-		// Hardcoded Rift display size
-		renderer.setSize( 1280, 800, false );
-		this.startFullscreen();
-	};
+	var isFullscreen = false;
+
+	var canvas = renderer.domElement;
+	var fullscreenchange = canvas.mozRequestFullScreen ? 'mozfullscreenchange' : 'webkitfullscreenchange';
+
+	document.addEventListener( fullscreenchange, function ( event ) {
+
+		isFullscreen = document.mozFullScreenElement || document.webkitFullscreenElement;
+
+	}, false );
+
+	this.setFullScreen = function ( boolean ) {
+
+		if ( vrHMD === undefined ) return;
+		if ( isFullscreen === boolean ) return;
 
-	this.startFullscreen = function() {
-		var self = this;
-		var renderer = this._renderer;
-		var vrHMD = this._vrHMD;
-		var canvas = renderer.domElement;
-		var fullScreenChange =
-			canvas.mozRequestFullScreen ? 'mozfullscreenchange' : 'webkitfullscreenchange';
-
-		document.addEventListener( fullScreenChange, onFullScreenChanged, false );
-		function onFullScreenChanged() {
-			if ( !document.mozFullScreenElement && !document.webkitFullscreenElement ) {
-				self.setFullScreen( false );
-			}
-		}
 		if ( canvas.mozRequestFullScreen ) {
+
 			canvas.mozRequestFullScreen( { vrDisplay: vrHMD } );
+
 		} else if ( canvas.webkitRequestFullscreen ) {
+
 			canvas.webkitRequestFullscreen( { vrDisplay: vrHMD } );
+
+		}
+
+	};
+
+	// render
+
+	var cameraL = new THREE.PerspectiveCamera();
+	var cameraR = new THREE.PerspectiveCamera();
+
+	this.render = function ( scene, camera ) {
+
+		if ( vrHMD ) {
+
+			var sceneL, sceneR;
+
+			if ( scene instanceof Array ) {
+
+				sceneL = scene[ 0 ];
+				sceneR = scene[ 1 ];
+
+			} else {
+
+				sceneL = scene;
+				sceneR = scene;
+
+			}
+
+			var size = renderer.getSize();
+			size.width /= 2;
+
+			renderer.enableScissorTest( true );
+			renderer.clear();
+
+			if ( camera.parent === undefined ) camera.updateMatrixWorld();
+
+			cameraL.projectionMatrix = fovToProjection( eyeFOVL, true, camera.near, camera.far );
+			cameraR.projectionMatrix = fovToProjection( eyeFOVR, true, camera.near, camera.far );
+
+			camera.matrixWorld.decompose( cameraL.position, cameraL.quaternion, cameraL.scale );
+			camera.matrixWorld.decompose( cameraR.position, cameraR.quaternion, cameraR.scale );
+
+			cameraL.translateX( eyeTranslationL.x * this.scale );
+			cameraR.translateX( eyeTranslationR.x * this.scale );
+
+			// render left eye
+			renderer.setViewport( 0, 0, size.width, size.height );
+			renderer.setScissor( 0, 0, size.width, size.height );
+			renderer.render( sceneL, cameraL );
+
+			// render right eye
+			renderer.setViewport( size.width, 0, size.width, size.height );
+			renderer.setScissor( size.width, 0, size.width, size.height );
+			renderer.render( sceneR, cameraR );
+
+			renderer.enableScissorTest( false );
+
+			return;
+
 		}
+
+		// Regular render mode if not HMD
+
+		if ( scene instanceof Array ) scene = scene[ 0 ];
+
+		renderer.render( scene, camera );
+
 	};
 
-	this.FovToNDCScaleOffset = function( fov ) {
+	//
+
+	function fovToNDCScaleOffset( fov ) {
+
 		var pxscale = 2.0 / (fov.leftTan + fov.rightTan);
 		var pxoffset = (fov.leftTan - fov.rightTan) * pxscale * 0.5;
 		var pyscale = 2.0 / (fov.upTan + fov.downTan);
 		var pyoffset = (fov.upTan - fov.downTan) * pyscale * 0.5;
 		return { scale: [ pxscale, pyscale ], offset: [ pxoffset, pyoffset ] };
-	};
 
-	this.FovPortToProjection = function( fov, rightHanded /* = true */, zNear /* = 0.01 */, zFar /* = 10000.0 */ )
-	{
+	}
+
+	function fovPortToProjection( fov, rightHanded, zNear, zFar ) {
+
 		rightHanded = rightHanded === undefined ? true : rightHanded;
 		zNear = zNear === undefined ? 0.01 : zNear;
 		zFar = zFar === undefined ? 10000.0 : zFar;
@@ -206,7 +193,7 @@ THREE.VREffect = function ( renderer, done ) {
 		var m = mobj.elements;
 
 		// and with scale/offset info for normalized device coords
-		var scaleAndOffset = this.FovToNDCScaleOffset(fov);
+		var scaleAndOffset = fovToNDCScaleOffset(fov);
 
 		// X result, map clip edges to [-w,+w]
 		m[0 * 4 + 0] = scaleAndOffset.scale[0];
@@ -237,17 +224,21 @@ THREE.VREffect = function ( renderer, done ) {
 		mobj.transpose();
 
 		return mobj;
-	};
+	}
+
+	function fovToProjection( fov, rightHanded, zNear, zFar ) {
+
+		var DEG2RAD = Math.PI / 180.0;
 
-	this.FovToProjection = function( fov, rightHanded /* = true */, zNear /* = 0.01 */, zFar /* = 10000.0 */ )
-	{
 		var fovPort = {
-			upTan: Math.tan(fov.upDegrees * Math.PI / 180.0),
-			downTan: Math.tan(fov.downDegrees * Math.PI / 180.0),
-			leftTan: Math.tan(fov.leftDegrees * Math.PI / 180.0),
-			rightTan: Math.tan(fov.rightDegrees * Math.PI / 180.0)
+			upTan: Math.tan( fov.upDegrees * DEG2RAD ),
+			downTan: Math.tan( fov.downDegrees * DEG2RAD ),
+			leftTan: Math.tan( fov.leftDegrees * DEG2RAD ),
+			rightTan: Math.tan( fov.rightDegrees * DEG2RAD )
 		};
-		return this.FovPortToProjection(fovPort, rightHanded, zNear, zFar);
-	};
+
+		return fovPortToProjection( fovPort, rightHanded, zNear, zFar );
+
+	}
 
 };

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

@@ -13,7 +13,7 @@ THREE.OBJExporter.prototype = {
 		var output = '';
 
 		var indexVertex = 0;
-		var indexVertexUvs = 0
+		var indexVertexUvs = 0;
 		var indexNormals = 0;
 
 		var parseObject = function ( child ) {

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

@@ -189,7 +189,7 @@ THREE.SceneExporter.prototype = {
 
 				if ( THREE[ constants[ i ] ] === c ) return LabelString( constants[ i ] );
 
-			};
+			}
 
 			return "";
 
@@ -751,4 +751,4 @@ THREE.SceneExporter.prototype = {
 
 	}
 
-}
+};

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

@@ -3,13 +3,13 @@ THREE.DecalVertex = function( v, n ) {
 	this.vertex = v;
 	this.normal = n;
 
-}
+};
 
 THREE.DecalVertex.prototype.clone = function() {
 
 	return new THREE.DecalVertex( this.vertex.clone(), this.normal.clone() );
 
-}
+};
 
 THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
@@ -162,7 +162,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 
 		return outVertices;
 
-	}
+	};
 
 	this.pushVertex = function( vertices, id, n ) {
 
@@ -171,7 +171,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 		v.applyMatrix4( this.iCubeMatrix );
 		vertices.push( new THREE.DecalVertex( v, n.clone() ) );
 
-	}
+	};
 
 	this.computeDecal = function() {
 
@@ -230,7 +230,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 				k, 
 				k + 1, 
 				k + 2
-			) 
+			);
 			f.vertexNormals.push( finalVertices[ k + 0 ].normal );
 			f.vertexNormals.push( finalVertices[ k + 1 ].normal );
 			f.vertexNormals.push( finalVertices[ k + 2 ].normal );
@@ -254,11 +254,11 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 		this.tangentsNeedUpdate = true;
 		this.computeFaceNormals();
 
-	}
+	};
 
 	this.computeDecal();
 
-}
+};
 
 THREE.DecalGeometry.prototype = Object.create( THREE.Geometry.prototype );
 THREE.DecalGeometry.prototype.constructor = THREE.DecalGeometry;

+ 1 - 1
examples/js/libs/msgpack-js.js

@@ -147,7 +147,7 @@ exports.encode = function (value) {
   var view = new DataView(buffer);
   encode(value, view, 0);
   return buffer;
-}
+};
 
 exports.decode = decode;
 

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

@@ -74,7 +74,7 @@ THREE.AWDLoader = (function () {
 	return tex;
 
     }
-  }
+  };
 
 
 
@@ -113,7 +113,7 @@ THREE.AWDLoader = (function () {
 		this._accuracyProps   = false;
 
 
-	};
+	}
 
 
 	AWDLoader.prototype = Object.create( THREE.Loader.prototype );
@@ -137,7 +137,7 @@ THREE.AWDLoader = (function () {
 
 				} 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( );
 
 		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 ) {
-			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 ) {
@@ -172,7 +172,7 @@ THREE.AWDLoader = (function () {
 
 		return this.trunk;
 
-	}
+	};
 
 
 
@@ -240,7 +240,7 @@ THREE.AWDLoader = (function () {
 		block.data = assetData;
 		block.id = blockId;
 
-	}
+	};
 
 
 	AWDLoader.prototype._parseHeader = function () {
@@ -277,7 +277,7 @@ THREE.AWDLoader = (function () {
 		this._bodylen = this.readU32();
 
 
-	}
+	};
 
 
 	AWDLoader.prototype.parseContainer = function ( len ) {
@@ -302,7 +302,7 @@ THREE.AWDLoader = (function () {
 		ctr.extra = this.parseUserAttributes();
 
 		return ctr;
-	}
+	};
 
 
 
@@ -336,13 +336,13 @@ THREE.AWDLoader = (function () {
 
 
 
-		meshLen = geometries.length
+		meshLen = geometries.length;
 		meshes = [];
 
     // TODO : BufferGeometry don't support "geometryGroups" for now.
     // so we create sub meshes for each groups
 		if ( meshLen  > 1 ) {
-			mesh = new THREE.Object3D()
+			mesh = new THREE.Object3D();
 			for ( i = 0; i < meshLen; i ++) {
 				var sm = new THREE.Mesh( geometries[i] );
 				meshes.push( sm );
@@ -373,7 +373,7 @@ THREE.AWDLoader = (function () {
 		mesh.extra = this.parseUserAttributes();
 
 		return mesh;
-	}
+	};
 
 
 
@@ -434,7 +434,7 @@ THREE.AWDLoader = (function () {
 
 
 		return mat;
-	}
+	};
 
 
 
@@ -451,7 +451,7 @@ THREE.AWDLoader = (function () {
 		if (type === 0) {
 			data_len = this.readU32();
 			var url = this.readUTFBytes(data_len);
-			console.log( url );
+			THREE.log( url );
 
 			asset = this.loadTexture( url );
 		} else {
@@ -462,7 +462,7 @@ THREE.AWDLoader = (function () {
 
 		this.parseUserAttributes();
 		return asset;
-	}
+	};
 
 	AWDLoader.prototype.loadTexture = function( url ) {
 
@@ -470,7 +470,7 @@ THREE.AWDLoader = (function () {
       this._resourceLoader = new ResourcesLoader( this._url );
 
 		return this._resourceLoader.loadTexture( url );
-	}
+	};
 
   // broken : skeleton pose format is different than threejs one
 	AWDLoader.prototype.parseSkeleton = function(len) // Array<Bone>
@@ -508,7 +508,7 @@ THREE.AWDLoader = (function () {
 
 
 		return skeleton;
-	}
+	};
 
 
 
@@ -548,7 +548,7 @@ THREE.AWDLoader = (function () {
 		this.parseUserAttributes();
 
 		return pose
-	}
+	};
 
 	AWDLoader.prototype.parseSkeletonAnimation = function(blockID)
   {
@@ -573,7 +573,7 @@ THREE.AWDLoader = (function () {
 			pose_addr = this.readU32();
 			frame_dur = this.readU16();
 
-			pose = this._blocks[pose_addr].data
+			pose = this._blocks[pose_addr].data;
       // debug( 'pose address ',pose[2].elements[12],pose[2].elements[13],pose[2].elements[14] );
 			clip.push( {
         pose : pose,
@@ -589,7 +589,7 @@ THREE.AWDLoader = (function () {
     // Ignore attributes for now
 		this.parseUserAttributes();
 		return clip;
-	}
+	};
 
 
 
@@ -612,7 +612,7 @@ THREE.AWDLoader = (function () {
 
 
 		return skeletonFrames;
-	}
+	};
 
 
 	AWDLoader.prototype.parseAnimatorSet = function(len)
@@ -650,7 +650,7 @@ THREE.AWDLoader = (function () {
 			targetMeshes.push(this._blocks[meshAdresses[i]].data);
 		}
 
-		targetAnimationSet = this._blocks[animSetBlockAdress].data
+		targetAnimationSet = this._blocks[animSetBlockAdress].data;
 		var thisAnimator;
 
 		if (type == 1) {
@@ -672,7 +672,7 @@ THREE.AWDLoader = (function () {
     // debug("Parsed a Animator: Name = " + name);
 
 		return thisAnimator;
-	}
+	};
 
 
 
@@ -851,7 +851,7 @@ THREE.AWDLoader = (function () {
     //finalizeAsset(geom, name);
 
 		return geometries;
-	}
+	};
 
 	AWDLoader.prototype.parseMeshPoseAnimation = function(len, poseOnly)
   {
@@ -883,7 +883,7 @@ THREE.AWDLoader = (function () {
 		var mesh = this.getBlock( geoAdress );
 
 		if (mesh == null) {
-			console.log( "parseMeshPoseAnimation target mesh not found at:", geoAdress );
+			THREE.log( "parseMeshPoseAnimation target mesh not found at:", geoAdress );
 			return;
 		}
 
@@ -957,7 +957,7 @@ THREE.AWDLoader = (function () {
 		this.parseUserAttributes();
 
 		return null;
-	}
+	};
 
 
 
@@ -1000,7 +1000,7 @@ THREE.AWDLoader = (function () {
     //e[15] = this.readF32();
 	e[15] = 1.0;
 	return mtx;
-  }
+  };
 
 
 	AWDLoader.prototype.parseProperties = function ( expected ) {
@@ -1111,47 +1111,47 @@ THREE.AWDLoader = (function () {
 			return read_func.call( this );
 		}
 
-	}
+	};
 
 
 	AWDLoader.prototype.readU8 = function () {
 		return this._data.getUint8( this._ptr ++ );
-	}
+	};
 	AWDLoader.prototype.readI8 = function () {
 		return this._data.getInt8( this._ptr ++ );
-	}
+	};
 
 	AWDLoader.prototype.readU16 = function () {
 		var a = this._data.getUint16( this._ptr, littleEndian );
 		this._ptr += 2;
 		return a;
-	}
+	};
 	AWDLoader.prototype.readI16 = function () {
 		var a = this._data.getInt16( this._ptr, littleEndian );
 		this._ptr += 2;
 		return a;
-	}
+	};
 
 	AWDLoader.prototype.readU32 = function () {
 		var a = this._data.getUint32( this._ptr, littleEndian );
 		this._ptr += 4;
 		return a;
-	}
+	};
 	AWDLoader.prototype.readI32 = function () {
 		var a = this._data.getInt32( this._ptr, littleEndian );
 		this._ptr += 4;
 		return a;
-	}
+	};
 	AWDLoader.prototype.readF32 = function () {
 		var a = this._data.getFloat32( this._ptr, littleEndian );
 		this._ptr += 4;
 		return a;
-	}
+	};
 	AWDLoader.prototype.readF64 = function () {
 		var a = this._data.getFloat64( this._ptr, littleEndian );
 		this._ptr += 8;
 		return a;
-	}
+	};
 
 
   /**
@@ -1203,7 +1203,7 @@ THREE.AWDLoader = (function () {
 
 
 
-	AWDProperties = function() {}
+	AWDProperties = function() {};
 
 	AWDProperties.prototype = {
 
@@ -1219,7 +1219,7 @@ THREE.AWDLoader = (function () {
         return this[key];
       else return fallback;
     }
-  }
+  };
 
 	return AWDLoader;
 

+ 4 - 11
examples/js/loaders/AssimpJSONLoader.js

@@ -94,13 +94,8 @@ THREE.AssimpJSONLoader.prototype = {
 		// read faces
 		var cnt = 0;
 		for (in_data = json.faces, i = 0, e = in_data.length; i < e; ++ i) {
-			face = new THREE.Face3();
 			src = in_data[i];
-			face.a = src[0];
-			face.b = src[1];
-			face.c = src[2];
-
-			face.materialIndex = 0; //json.materialindex;
+			face = new THREE.Face3(src[0],src[1],src[2]);
 			geometry.faces.push(face);
 		}
 
@@ -189,7 +184,7 @@ THREE.AssimpJSONLoader.prototype = {
 	},
 
 	parseMaterial : function(json) {
-		var mat = null, 
+		var mat = null,
 		scope = this, i, prop, has_textures = [],
 
 		init_props = {
@@ -240,7 +235,7 @@ THREE.AssimpJSONLoader.prototype = {
 						has_textures.push(keyname);
 
 						loader.setCrossOrigin(this.crossOrigin);
-						var material_url = scope.texturePath + '/' + prop.value
+						var material_url = scope.texturePath + '/' + prop.value;
 						material_url = material_url.replace(/\\/g, '/');
 						loader.load(material_url, function(tex) {
 							if (tex) {
@@ -286,7 +281,7 @@ THREE.AssimpJSONLoader.prototype = {
 				init_props[has_textures[i]] = defaultTexture();
 			}
 		}
-		
+
 		mat = new THREE.MeshPhongMaterial( init_props );
 		return mat;
 	},
@@ -313,5 +308,3 @@ THREE.AssimpJSONLoader.prototype = {
 		return obj;
 	},
 };
-
-

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

@@ -67,7 +67,7 @@ THREE.BabylonLoader.prototype = {
 
 				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();
 

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

@@ -54,7 +54,7 @@ THREE.BinaryLoader.prototype.loadAjaxJSON = function ( context, url, callback, t
 
 			} 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 ) {
 
-		console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
+		THREE.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 	}, false );
 
@@ -217,7 +217,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return ( n % 4 ) ? ( 4 - n % 4 ) : 0;
 
-		};
+		}
 
 		function parseMetaData( data, offset ) {
 
@@ -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
 					  + metaData.nvertices * metaData.vertex_coordinate_bytes * 3
@@ -289,12 +289,12 @@ 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_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 );
-			console.log( "total bytes: " + total );
+			THREE.log( "total bytes: " + total );
 */
 
 			return metaData;
 
-		};
+		}
 
 		function parseString( data, offset, length ) {
 
@@ -310,7 +310,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return text;
 
-		};
+		}
 
 		function parseUChar8( data, offset ) {
 
@@ -318,7 +318,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return charArray[ 0 ];
 
-		};
+		}
 
 		function parseUInt32( data, offset ) {
 
@@ -326,7 +326,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return intArray[ 0 ];
 
-		};
+		}
 
 		function init_vertices( start ) {
 
@@ -348,7 +348,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return nElements * 3 * Float32Array.BYTES_PER_ELEMENT;
 
-		};
+		}
 
 		function init_normals( start ) {
 
@@ -374,7 +374,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return nElements * 3 * Int8Array.BYTES_PER_ELEMENT;
 
-		};
+		}
 
 		function init_uvs( start ) {
 
@@ -399,7 +399,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			return nElements * 2 * Float32Array.BYTES_PER_ELEMENT;
 
-		};
+		}
 
 		function init_uvs3( nElements, offset ) {
 
@@ -430,7 +430,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_uvs4( nElements, offset ) {
 
@@ -471,7 +471,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_faces3_flat( nElements, offsetVertices, offsetMaterials ) {
 
@@ -488,11 +488,11 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 				m = materialIndexBuffer[ i ];
 
-				scope.faces.push( new THREE.Face3( a, b, c, null, null, m ) );
+				scope.faces.push( new THREE.Face3( a, b, c ) );
 
 			}
 
-		};
+		}
 
 		function init_faces4_flat( nElements, offsetVertices, offsetMaterials ) {
 
@@ -510,12 +510,12 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 				m = materialIndexBuffer[ i ];
 
-				scope.faces.push( new THREE.Face3( a, b, d, null, null, m ) );
-				scope.faces.push( new THREE.Face3( b, c, d, null, null, m ) );
+				scope.faces.push( new THREE.Face3( a, b, d ) );
+				scope.faces.push( new THREE.Face3( b, c, d ) );
 
 			}
 
-		};
+		}
 
 		function init_faces3_smooth( nElements, offsetVertices, offsetNormals, offsetMaterials ) {
 
@@ -554,11 +554,11 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 					new THREE.Vector3( nax, nay, naz ),
 					new THREE.Vector3( nbx, nby, nbz ),
 					new THREE.Vector3( ncx, ncy, ncz )
-				], null, m ) );
+				] ) );
 
 			}
 
-		};
+		}
 
 		function init_faces4_smooth( nElements, offsetVertices, offsetNormals, offsetMaterials ) {
 
@@ -603,17 +603,17 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 					new THREE.Vector3( nax, nay, naz ),
 					new THREE.Vector3( nbx, nby, nbz ),
 					new THREE.Vector3( ndx, ndy, ndz )
-				], null, m ) );
+				] ) );
 
 				scope.faces.push( new THREE.Face3( b, c, d, [
 					new THREE.Vector3( nbx, nby, nbz ),
 					new THREE.Vector3( ncx, ncy, ncz ),
 					new THREE.Vector3( ndx, ndy, ndz )
-				], null, m ) );
+				] ) );
 
 			}
 
-		};
+		}
 
 		function init_triangles_flat( start ) {
 
@@ -626,7 +626,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_triangles_flat_uv( start ) {
 
@@ -642,7 +642,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_triangles_smooth( start ) {
 
@@ -657,7 +657,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_triangles_smooth_uv( start ) {
 
@@ -674,7 +674,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_quads_flat( start ) {
 
@@ -687,7 +687,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_quads_flat_uv( start ) {
 
@@ -703,7 +703,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_quads_smooth( start ) {
 
@@ -718,7 +718,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 		function init_quads_smooth_uv( start ) {
 
@@ -735,7 +735,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 			}
 
-		};
+		}
 
 	};
 

+ 106 - 113
examples/js/loaders/ColladaLoader.js

@@ -85,13 +85,13 @@ THREE.ColladaLoader = function () {
 
 						} else {
 
-							if ( faillCallback ) {
+							if ( failCallback ) {
 
 								failCallback();
 
 							} else {
 
-								console.error( "ColladaLoader: Empty or non-existing file (" + url + ")" );
+								THREE.error( "ColladaLoader: Empty or non-existing file (" + url + ")" );
 
 							}
 
@@ -115,7 +115,7 @@ THREE.ColladaLoader = function () {
 
 				}
 
-			}
+			};
 
 			request.open( "GET", url, true );
 			request.send( null );
@@ -412,7 +412,7 @@ THREE.ColladaLoader = function () {
 
 		if ( !morphCtrl || !morphCtrl.morph ) {
 
-			console.log("could not find morph controller!");
+			THREE.log("could not find morph controller!");
 			return;
 
 		}
@@ -442,7 +442,7 @@ THREE.ColladaLoader = function () {
 
 		geometry.morphTargets.push( { name: "target_Z", vertices: geometry.vertices } );
 
-	};
+	}
 
 	function createSkin ( geometry, ctrl, applyBindShape ) {
 
@@ -450,14 +450,14 @@ THREE.ColladaLoader = function () {
 
 		if ( !skinCtrl || !skinCtrl.skin ) {
 
-			console.log( "could not find skin controller!" );
+			THREE.log( "could not find skin controller!" );
 			return;
 
 		}
 
 		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;
 
 		}
@@ -587,7 +587,7 @@ THREE.ColladaLoader = function () {
 
 			} 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.weights = [];
@@ -686,14 +686,14 @@ THREE.ColladaLoader = function () {
 
 		if ( !skinController || !skinController.skin ) {
 
-			console.log( 'ColladaLoader: Could not find skin controller.' );
+			THREE.log( 'ColladaLoader: Could not find skin controller.' );
 			return;
 
 		}
 
 		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;
 
 		}
@@ -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.' );
 
 
 
@@ -826,7 +826,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function createKinematics() {
 
@@ -874,7 +874,7 @@ THREE.ColladaLoader = function () {
 
 				} 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 ) {
 
-						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 ) {
 
-						console.log( 'setJointValue: joint ' + jointIndex + ' is static' );
+						THREE.log( 'setJointValue: joint ' + jointIndex + ' is static' );
 
 					} else {
 
@@ -926,7 +926,7 @@ THREE.ColladaLoader = function () {
 
 									default:
 
-										console.warn( 'setJointValue: unknown joint type: ' + joint.type );
+										THREE.warn( 'setJointValue: unknown joint type: ' + joint.type );
 										break;
 
 								}
@@ -988,7 +988,7 @@ THREE.ColladaLoader = function () {
 
 				} else {
 
-					console.log( 'setJointValue: joint ' + jointIndex + ' doesn\'t exist' );
+					THREE.log( 'setJointValue: joint ' + jointIndex + ' doesn\'t exist' );
 
 				}
 
@@ -1031,7 +1031,7 @@ THREE.ColladaLoader = function () {
 			}
 		}
 
-	};
+	}
 
 	function createSceneGraph ( node, parent ) {
 
@@ -1100,7 +1100,7 @@ THREE.ColladaLoader = function () {
 
 					}
 
-					console.log( 'ColladaLoader: Morph-controller partially supported.' );
+					THREE.log( 'ColladaLoader: Morph-controller partially supported.' );
 
 				default:
 					break;
@@ -1179,13 +1179,6 @@ THREE.ColladaLoader = function () {
 
 					material = new THREE.MeshFaceMaterial( used_materials_array );
 
-					for ( j = 0; j < geom.faces.length; j ++ ) {
-
-						var face = geom.faces[ j ];
-						face.materialIndex = used_materials[ face.daeMaterial ]
-
-					}
-
 				}
 
 				if ( skinController !== undefined ) {
@@ -1332,7 +1325,7 @@ THREE.ColladaLoader = function () {
 
 		return obj;
 
-	};
+	}
 
 	function getJointId( skin, id ) {
 
@@ -1346,7 +1339,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function getLibraryNode( id ) {
 
@@ -1366,7 +1359,7 @@ THREE.ColladaLoader = function () {
 
 		return undefined;
 
-	};
+	}
 
 	function getChannelsForNode ( node ) {
 
@@ -1407,7 +1400,7 @@ THREE.ColladaLoader = function () {
 
 		return channels;
 
-	};
+	}
 
 	function calcFrameDuration( node ) {
 
@@ -1428,7 +1421,7 @@ THREE.ColladaLoader = function () {
 
 		return minT;
 
-	};
+	}
 
 	function calcMatrixAt( node, t ) {
 
@@ -1460,7 +1453,7 @@ THREE.ColladaLoader = function () {
 					if ( sampler.input[ j + 1 ] > t ) {
 
 						value = sampler.output[ j ];
-						//console.log(value.flatten)
+						//THREE.log(value.flatten)
 						break;
 
 					}
@@ -1497,7 +1490,7 @@ THREE.ColladaLoader = function () {
 
 		return matrix;
 
-	};
+	}
 
 	function bakeAnimations ( node ) {
 
@@ -1559,7 +1552,7 @@ THREE.ColladaLoader = function () {
 
 				} 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 );
 
 				}
 
@@ -1589,7 +1582,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function findKey ( keys, time) {
 
@@ -1613,7 +1606,7 @@ THREE.ColladaLoader = function () {
 
 		return retVal;
 
-	};
+	}
 
 	function findTimeNdx ( keys, time) {
 
@@ -1633,7 +1626,7 @@ THREE.ColladaLoader = function () {
 
 		return ndx;
 
-	};
+	}
 
 	function interpolateKeys ( keys, key, ndx, fullSid ) {
 
@@ -1672,7 +1665,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	// Get next key with given sid
 
@@ -1692,7 +1685,7 @@ THREE.ColladaLoader = function () {
 
 		return null;
 
-	};
+	}
 
 	// Get previous key with given sid
 
@@ -1714,14 +1707,14 @@ THREE.ColladaLoader = function () {
 
 		return null;
 
-	};
+	}
 
 	function _Image() {
 
 		this.id = "";
 		this.init_from = "";
 
-	};
+	}
 
 	_Image.prototype.parse = function(element) {
 
@@ -1751,7 +1744,7 @@ THREE.ColladaLoader = function () {
 		this.skin = null;
 		this.morph = null;
 
-	};
+	}
 
 	Controller.prototype.parse = function( element ) {
 
@@ -1794,7 +1787,7 @@ THREE.ColladaLoader = function () {
 		this.targets = null;
 		this.weights = null;
 
-	};
+	}
 
 	Morph.prototype.parse = function( element ) {
 
@@ -1825,7 +1818,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 
 			}
@@ -1892,7 +1885,7 @@ THREE.ColladaLoader = function () {
 		this.joints = [];
 		this.weights = [];
 
-	};
+	}
 
 	Skin.prototype.parse = function( element ) {
 
@@ -1935,7 +1928,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 
 			}
@@ -2073,7 +2066,7 @@ THREE.ColladaLoader = function () {
 		this.nodes = [];
 		this.scene = new THREE.Group();
 
-	};
+	}
 
 	VisualScene.prototype.getChildById = function( id, recursive ) {
 
@@ -2152,7 +2145,7 @@ THREE.ColladaLoader = function () {
 		this.channels = [];
 		this.matrix = new THREE.Matrix4();
 
-	};
+	}
 
 	Node.prototype.getChannelForTransform = function( transformSid ) {
 
@@ -2346,7 +2339,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 
 			}
@@ -2381,7 +2374,7 @@ THREE.ColladaLoader = function () {
 		this.data = [];
 		this.obj = null;
 
-	};
+	}
 
 	Transform.prototype.parse = function ( element ) {
 
@@ -2420,7 +2413,7 @@ THREE.ColladaLoader = function () {
 				break;
 
 			default:
-				console.log( 'Can not convert Transform of type ' + this.type );
+				THREE.log( 'Can not convert Transform of type ' + this.type );
 				break;
 
 		}
@@ -2526,7 +2519,7 @@ THREE.ColladaLoader = function () {
 
 				} else {
 
-					console.log('Incorrect addressing of matrix in transform.');
+					THREE.log('Incorrect addressing of matrix in transform.');
 
 				}
 
@@ -2620,7 +2613,7 @@ THREE.ColladaLoader = function () {
 		this.skeleton = [];
 		this.instance_material = [];
 
-	};
+	}
 
 	InstanceController.prototype.parse = function ( element ) {
 
@@ -2672,7 +2665,7 @@ THREE.ColladaLoader = function () {
 		this.symbol = "";
 		this.target = "";
 
-	};
+	}
 
 	InstanceMaterial.prototype.parse = function ( element ) {
 
@@ -2687,7 +2680,7 @@ THREE.ColladaLoader = function () {
 		this.url = "";
 		this.instance_material = [];
 
-	};
+	}
 
 	InstanceGeometry.prototype.parse = function ( element ) {
 
@@ -2725,7 +2718,7 @@ THREE.ColladaLoader = function () {
 		this.id = "";
 		this.mesh = null;
 
-	};
+	}
 
 	Geometry.prototype.parse = function ( element ) {
 
@@ -2746,7 +2739,7 @@ THREE.ColladaLoader = function () {
 
 				case 'extra':
 
-					// console.log( child );
+					// THREE.log( child );
 					break;
 
 				default:
@@ -2765,7 +2758,7 @@ THREE.ColladaLoader = function () {
 		this.vertices = null;
 		this.geometry3js = null;
 
-	};
+	}
 
 	Mesh.prototype.parse = function ( element ) {
 
@@ -3103,7 +3096,7 @@ THREE.ColladaLoader = function () {
 
 				} 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 );
 
 				}
 
@@ -3124,7 +3117,7 @@ THREE.ColladaLoader = function () {
 		this.p = [];
 		this.geometry = new THREE.Geometry();
 
-	};
+	}
 
 	Polygons.prototype.setVertices = function ( vertices ) {
 
@@ -3168,7 +3161,7 @@ THREE.ColladaLoader = function () {
 
 				case 'ph':
 
-					console.warn( 'polygon holes not yet supported!' );
+					THREE.warn( 'polygon holes not yet supported!' );
 					break;
 
 				default:
@@ -3188,7 +3181,7 @@ THREE.ColladaLoader = function () {
 
 		this.vcount = [];
 
-	};
+	}
 
 	Polylist.prototype = Object.create( Polygons.prototype );
 	Polylist.prototype.constructor = Polylist;
@@ -3199,7 +3192,7 @@ THREE.ColladaLoader = function () {
 
 		this.vcount = 1;
 
-	};
+	}
 
 	LineStrips.prototype = Object.create( Polygons.prototype );
 	LineStrips.prototype.constructor = LineStrips;
@@ -3210,7 +3203,7 @@ THREE.ColladaLoader = function () {
 
 		this.vcount = 3;
 
-	};
+	}
 
 	Triangles.prototype = Object.create( Polygons.prototype );
 	Triangles.prototype.constructor = Triangles;
@@ -3222,7 +3215,7 @@ THREE.ColladaLoader = function () {
 		this.stride = 0;
 		this.params = [];
 
-	};
+	}
 
 	Accessor.prototype.parse = function ( element ) {
 
@@ -3254,7 +3247,7 @@ THREE.ColladaLoader = function () {
 
 		this.input = {};
 
-	};
+	}
 
 	Vertices.prototype.parse = function ( element ) {
 
@@ -3282,7 +3275,7 @@ THREE.ColladaLoader = function () {
 		this.source = "";
 		this.set = 0;
 
-	};
+	}
 
 	Input.prototype.parse = function ( element ) {
 
@@ -3306,7 +3299,7 @@ THREE.ColladaLoader = function () {
 		this.id = id;
 		this.type = null;
 
-	};
+	}
 
 	Source.prototype.parse = function ( element ) {
 
@@ -3357,7 +3350,7 @@ THREE.ColladaLoader = function () {
 					break;
 
 				default:
-					// console.log(child.nodeName);
+					// THREE.log(child.nodeName);
 					break;
 
 			}
@@ -3376,7 +3369,7 @@ THREE.ColladaLoader = function () {
 
 		var param = this.accessor.params[ 0 ];
 
-			//console.log(param.name + " " + param.type);
+			//THREE.log(param.name + " " + param.type);
 
 		switch ( param.type ) {
 
@@ -3399,7 +3392,7 @@ THREE.ColladaLoader = function () {
 
 			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;
 
 		}
@@ -3416,7 +3409,7 @@ THREE.ColladaLoader = function () {
 		this.name = "";
 		this.instance_effect = null;
 
-	};
+	}
 
 	Material.prototype.parse = function ( element ) {
 
@@ -3448,7 +3441,7 @@ THREE.ColladaLoader = function () {
 		this.texcoord = null;
 		this.texOpts = null;
 
-	};
+	}
 
 	ColorOrTexture.prototype.isColor = function () {
 
@@ -3582,7 +3575,7 @@ THREE.ColladaLoader = function () {
 		this.effect = effect;
 		this.material = null;
 
-	};
+	}
 
 	Shader.prototype.parse = function ( element ) {
 
@@ -3613,11 +3606,11 @@ THREE.ColladaLoader = function () {
 						} else if ( bumpType.toLowerCase() === "normalmap" ) {
 							this[ 'normal' ] = ( new ColorOrTexture() ).parse( child );
 						} 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 );
 						}
 					} 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 );
 					}
 
@@ -3824,7 +3817,7 @@ THREE.ColladaLoader = function () {
 		this.init_from = null;
 		this.format = null;
 
-	};
+	}
 
 	Surface.prototype.parse = function ( element ) {
 
@@ -3847,7 +3840,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( "unhandled Surface prop: " + child.nodeName );
+					THREE.log( "unhandled Surface prop: " + child.nodeName );
 					break;
 
 			}
@@ -3868,7 +3861,7 @@ THREE.ColladaLoader = function () {
 		this.magfilter = null;
 		this.mipfilter = null;
 
-	};
+	}
 
 	Sampler2D.prototype.parse = function ( element ) {
 
@@ -3911,7 +3904,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( "unhandled Sampler2D prop: " + child.nodeName );
+					THREE.log( "unhandled Sampler2D prop: " + child.nodeName );
 					break;
 
 			}
@@ -3930,7 +3923,7 @@ THREE.ColladaLoader = function () {
 		this.surface = {};
 		this.sampler = {};
 
-	};
+	}
 
 	Effect.prototype.create = function () {
 
@@ -4001,7 +3994,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 
 			}
@@ -4048,7 +4041,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log( child.nodeName );
+					THREE.log( child.nodeName );
 					break;
 
 			}
@@ -4133,7 +4126,7 @@ THREE.ColladaLoader = function () {
 
 		this.url = "";
 
-	};
+	}
 
 	InstanceEffect.prototype.parse = function ( element ) {
 
@@ -4150,7 +4143,7 @@ THREE.ColladaLoader = function () {
 		this.sampler = [];
 		this.channel = [];
 
-	};
+	}
 
 	Animation.prototype.parse = function ( element ) {
 
@@ -4224,7 +4217,7 @@ THREE.ColladaLoader = function () {
 		this.arrIndices = null;
 		this.member = null;
 
-	};
+	}
 
 	Channel.prototype.parse = function ( element ) {
 
@@ -4285,7 +4278,7 @@ THREE.ColladaLoader = function () {
 		this.endTime = null;
 		this.duration = 0;
 
-	};
+	}
 
 	Sampler.prototype.parse = function ( element ) {
 
@@ -4350,7 +4343,7 @@ THREE.ColladaLoader = function () {
 
 				default:
 
-					console.log(input.semantic);
+					THREE.log(input.semantic);
 					break;
 
 			}
@@ -4440,7 +4433,7 @@ THREE.ColladaLoader = function () {
 		this.targets = [];
 		this.time = time;
 
-	};
+	}
 
 	Key.prototype.addTarget = function ( fullSid, transform, member, data ) {
 
@@ -4554,7 +4547,7 @@ THREE.ColladaLoader = function () {
 		this.name = "";
 		this.technique = "";
 
-	};
+	}
 
 	Camera.prototype.parse = function ( element ) {
 
@@ -4672,7 +4665,7 @@ THREE.ColladaLoader = function () {
 
 		this.url = "";
 
-	};
+	}
 
 	InstanceCamera.prototype.parse = function ( element ) {
 
@@ -4690,7 +4683,7 @@ THREE.ColladaLoader = function () {
 		this.name = "";
 		this.technique = "";
 
-	};
+	}
 
 	Light.prototype.parse = function ( element ) {
 
@@ -4801,7 +4794,7 @@ THREE.ColladaLoader = function () {
 
 		this.url = "";
 
-	};
+	}
 
 	InstanceLight.prototype.parse = function ( element ) {
 
@@ -5049,7 +5042,7 @@ THREE.ColladaLoader = function () {
 		sources[ id ] = ( new Source(id )).parse( element );
 		return sources[ id ];
 
-	};
+	}
 
 	function _nsResolver( nsPrefix ) {
 
@@ -5061,7 +5054,7 @@ THREE.ColladaLoader = function () {
 
 		return null;
 
-	};
+	}
 
 	function _bools( str ) {
 
@@ -5076,7 +5069,7 @@ THREE.ColladaLoader = function () {
 
 		return data;
 
-	};
+	}
 
 	function _floats( str ) {
 
@@ -5091,7 +5084,7 @@ THREE.ColladaLoader = function () {
 
 		return data;
 
-	};
+	}
 
 	function _ints( str ) {
 
@@ -5106,19 +5099,19 @@ THREE.ColladaLoader = function () {
 
 		return data;
 
-	};
+	}
 
 	function _strings( str ) {
 
 		return ( str.length > 0 ) ? _trimString( str ).split( /\s+/ ) : [];
 
-	};
+	}
 
 	function _trimString( str ) {
 
 		return str.replace( /^\s+/, "" ).replace( /\s+$/, "" );
 
-	};
+	}
 
 	function _attr_as_float( element, name, defaultValue ) {
 
@@ -5132,7 +5125,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function _attr_as_int( element, name, defaultValue ) {
 
@@ -5146,7 +5139,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function _attr_as_string( element, name, defaultValue ) {
 
@@ -5160,7 +5153,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function _format_float( f, num ) {
 
@@ -5191,7 +5184,7 @@ THREE.ColladaLoader = function () {
 
 		return parts.join( '.' );
 
-	};
+	}
 
 	function loadTextureImage ( texture, url ) {
 
@@ -5204,7 +5197,7 @@ THREE.ColladaLoader = function () {
 
 		} );
 
-	};
+	}
 
 	function extractDoubleSided( obj, element ) {
 
@@ -5222,7 +5215,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	// Up axis conversion
 
@@ -5255,7 +5248,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function fixCoords( data, sign ) {
 
@@ -5313,7 +5306,7 @@ THREE.ColladaLoader = function () {
 
 		}
 
-	};
+	}
 
 	function getConvertedTranslation( axis, data ) {
 
@@ -5338,7 +5331,7 @@ THREE.ColladaLoader = function () {
 		}
 
 		return data;
-	};
+	}
 
 	function getConvertedVec3( data, offset ) {
 
@@ -5346,7 +5339,7 @@ THREE.ColladaLoader = function () {
 		fixCoords( arr, -1 );
 		return new THREE.Vector3( arr[ 0 ], arr[ 1 ], arr[ 2 ] );
 
-	};
+	}
 
 	function getConvertedMat4( data ) {
 
@@ -5403,7 +5396,7 @@ THREE.ColladaLoader = function () {
 			data[12], data[13], data[14], data[15]
 			);
 
-	};
+	}
 
 	function getConvertedIndex( index ) {
 
@@ -5419,7 +5412,7 @@ THREE.ColladaLoader = function () {
 
 		return index;
 
-	};
+	}
 
 	function getConvertedMember( member ) {
 
@@ -5495,7 +5488,7 @@ THREE.ColladaLoader = function () {
 
 		return member;
 
-	};
+	}
 
 	return {
 

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

@@ -126,14 +126,14 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 
 	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;
 
 	}
 
 	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;
 
 	}
@@ -175,7 +175,7 @@ THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
 				blockBytes = 64;
 				dds.format = THREE.RGBAFormat;
 			} else {
-				console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) );
+				THREE.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) );
 				return dds;
 			}
 	}

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

@@ -87,7 +87,7 @@ THREE.MTLLoader.prototype = {
 		}
 
 		var materialCreator = new THREE.MTLLoader.MaterialCreator( this.baseUrl, this.options );
-		materialCreator.crossOrigin = this.crossOrigin
+		materialCreator.crossOrigin = this.crossOrigin;
 		materialCreator.setMaterials( materialsInfo );
 		return materialCreator;
 

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

@@ -205,7 +205,7 @@ THREE.OBJLoader.prototype = {
 
 		// f vertex//normal vertex//normal vertex//normal ...
 
-		var face_pattern4 = /f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/
+		var face_pattern4 = /f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/;
 
 		//
 
@@ -328,7 +328,7 @@ THREE.OBJLoader.prototype = {
 
 			} else {
 
-				// console.log( "THREE.OBJLoader: Unhandled line " + line );
+				// THREE.log( "THREE.OBJLoader: Unhandled line " + line );
 
 			}
 

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

@@ -225,7 +225,7 @@ THREE.OBJMTLLoader.prototype = {
 
 		// f vertex//normal vertex//normal vertex//normal ...
 
-		var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/
+		var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/;
 
 		//
 
@@ -347,7 +347,7 @@ THREE.OBJMTLLoader.prototype = {
 
 			} else {
 
-				console.log( "THREE.OBJMTLLoader: Unhandled line " + line );
+				THREE.log( "THREE.OBJMTLLoader: Unhandled line " + line );
 
 			}
 

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

@@ -176,5 +176,5 @@ THREE.PDBLoader.prototype = {
 
 	}
 
-}
+};
 

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

@@ -164,11 +164,11 @@ THREE.PLYLoader.prototype = {
 		for ( var i = 0; i < lines.length; i ++ ) {
 
 			var line = lines[ i ];
-			line = line.trim()
+			line = line.trim();
 			if ( line === "" ) { continue; }
 			lineValues = line.split( /\s+/ );
-			lineType = lineValues.shift()
-			line = lineValues.join(" ")
+			lineType = lineValues.shift();
+			line = lineValues.join(" ");
 
 			switch ( lineType ) {
 
@@ -209,7 +209,7 @@ THREE.PLYLoader.prototype = {
 
 			default:
 
-				console.log("unhandled", lineType, lineValues);
+				THREE.log("unhandled", lineType, lineValues);
 
 			}
 
@@ -299,7 +299,7 @@ THREE.PLYLoader.prototype = {
 		for ( var i = 0; i < lines.length; i ++ ) {
 
 			var line = lines[ i ];
-			line = line.trim()
+			line = line.trim();
 			if ( line === "" ) { continue; }
 
 			if ( currentElementCount >= header.elements[currentElement].count ) {

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

@@ -61,15 +61,15 @@ THREE.PVRLoader._parseV3 = function ( pvrDatas ) {
 			format = THREE.RGB_PVRTC_2BPPV1_Format;
 			break;
 		case 1 : // PVRTC 2bpp RGBA
-			bpp = 2
+			bpp = 2;
 			format = THREE.RGBA_PVRTC_2BPPV1_Format;
 			break;
 		case 2 : // PVRTC 4bpp RGB
-			bpp = 4
+			bpp = 4;
 			format = THREE.RGB_PVRTC_4BPPV1_Format;
 			break;
 		case 3 : // PVRTC 4bpp RGBA
-			bpp = 4
+			bpp = 4;
 			format = THREE.RGBA_PVRTC_4BPPV1_Format;
 			break;
 		default :
@@ -108,9 +108,9 @@ THREE.PVRLoader._parseV2 = function ( pvrDatas ) {
 		numSurfs      =  header[12];
 
 
-	var TYPE_MASK = 0xff
+	var TYPE_MASK = 0xff;
 	var PVRTC_2 = 24,
-		PVRTC_4 = 25
+		PVRTC_4 = 25;
 
 	var formatFlags = flags & TYPE_MASK;
 
@@ -164,21 +164,21 @@ THREE.PVRLoader._extract = function ( pvrDatas ) {
 
 
 
-	// console.log( "--------------------------" );
+	// THREE.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( "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    );
 
 
 
@@ -249,4 +249,4 @@ THREE.PVRLoader._extract = function ( pvrDatas ) {
 
 
 	return pvr;
-}
+};

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

@@ -29,14 +29,14 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 		rgbe_memory_error   = 4,
 		rgbe_error = function(rgbe_error_code, msg) {
 			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;
-				case rgbe_write_error: console.error("THREE.RGBELoader Write Error: " + (msg||''));
+				case rgbe_write_error: THREE.error("THREE.RGBELoader Write Error: " + (msg||''));
 					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;
 				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;
 		},

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

@@ -269,7 +269,7 @@ if ( typeof DataView === 'undefined') {
 		this.byteLength = byteLength || buffer.byteLength || buffer.length;
 		this._isString = typeof buffer === "string";
 
-	}
+	};
 
 	DataView.prototype = {
 

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

@@ -33,7 +33,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 
 	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 ),
 		offset = 0,
@@ -63,7 +63,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			case TGA_TYPE_INDEXED:
 			case TGA_TYPE_RLE_INDEXED:
 				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;
 
@@ -73,23 +73,23 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			case TGA_TYPE_RLE_RGB:
 			case TGA_TYPE_RLE_GREY:
 				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;
 
 			// What the need of a file without data ?
 			case TGA_TYPE_NO_DATA:
-				console.error('THREE.TGALoader.parse.tgaCheckHeader: No data');
+				THREE.error('THREE.TGALoader.parse.tgaCheckHeader: No data');
 
 			// Invalid type ?
 			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
 		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
@@ -97,7 +97,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 			header.pixel_size !== 16 &&
 			header.pixel_size !== 24 &&
 			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 );
 
 	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
@@ -228,7 +228,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		return imageData;
 
-	};
+	}
 
 	function tgaGetImageData16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
 
@@ -247,7 +247,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		return imageData;
 
-	};
+	}
 
 	function tgaGetImageData24bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
 
@@ -265,7 +265,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		return imageData;
 
-	};
+	}
 
 	function tgaGetImageData32bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
 
@@ -283,7 +283,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		return imageData;
 
-	};
+	}
 
 	function tgaGetImageDataGrey8bits( imageData, y_start, y_step, y_end, x_start, x_step, x_end, image ) {
 
@@ -302,7 +302,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		return imageData;
 
-	};
+	}
 
 	function tgaGetImageDataGrey16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
 
@@ -320,7 +320,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 
 		return imageData;
 
-	};
+	}
 
 	function getTgaRGBA( width, height, image, palette ) {
 
@@ -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 );
 					break;
 				default:
-					console.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
+					THREE.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
 					break;
 			}
 
@@ -406,7 +406,7 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 					break;
 
 				default:
-					console.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
+					THREE.error( 'THREE.TGALoader.parse.getTgaRGBA: not support this format' );
 					break;
 			}
 

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

@@ -577,7 +577,7 @@ THREE.UTF8Loader.prototype.downloadMesh = function ( path, name, meshEntry, deco
 
 		}
 
-	};
+	}
 
 	getHttpRequest( path, function( req, e ) {
 

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

@@ -58,7 +58,7 @@ THREE.VRMLLoader.prototype = {
 
 		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':
 
 							if (parts.length != 4) {
-								console.warn('Invalid color format detected for ' + fieldName );
+								THREE.warn('Invalid color format detected for ' + fieldName );
 								break;
 							}
 
@@ -357,7 +357,7 @@ THREE.VRMLLoader.prototype = {
 								r: parseFloat(parts[1]),
 								g: parseFloat(parts[2]),
 								b: parseFloat(parts[3])
-							}
+							};
 
 							break;
 
@@ -365,7 +365,7 @@ THREE.VRMLLoader.prototype = {
 						case 'scale':
 						case 'size':
 							if (parts.length != 4) {
-								console.warn('Invalid vector format detected for ' + fieldName);
+								THREE.warn('Invalid vector format detected for ' + fieldName);
 								break;
 							}
 
@@ -373,7 +373,7 @@ THREE.VRMLLoader.prototype = {
 								x: parseFloat(parts[1]),
 								y: parseFloat(parts[2]),
 								z: parseFloat(parts[3])
-							}
+							};
 
 							break;
 
@@ -385,7 +385,7 @@ THREE.VRMLLoader.prototype = {
 						case 'shininess':
 						case 'ambientIntensity':
 							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;
 							}
 
@@ -395,7 +395,7 @@ THREE.VRMLLoader.prototype = {
 
 						case 'rotation':
 							if (parts.length != 5) {
-								console.warn('Invalid quaternion format detected for ' + fieldName);
+								THREE.warn('Invalid quaternion format detected for ' + fieldName);
 								break;
 							}
 
@@ -404,7 +404,7 @@ THREE.VRMLLoader.prototype = {
 								y: parseFloat(parts[2]),
 								z: parseFloat(parts[3]),
 								w: parseFloat(parts[4])
-							}
+							};
 
 							break;
 
@@ -413,7 +413,7 @@ THREE.VRMLLoader.prototype = {
 						case 'colorPerVertex':
 						case 'convex':
 							if (parts.length != 2) {
-								console.warn('Invalid format detected for ' + fieldName);
+								THREE.warn('Invalid format detected for ' + fieldName);
 								break;
 							}
 
@@ -498,11 +498,11 @@ THREE.VRMLLoader.prototype = {
 				}
 
 				return tree;
-			}
+			};
 
 			var parseNode = function ( data, parent ) {
 
-				// console.log( data );
+				// THREE.log( data );
 
 				if ( typeof data === 'string' ) {
 
@@ -511,7 +511,7 @@ THREE.VRMLLoader.prototype = {
 						var defineKey = /USE\s+?(\w+)/.exec( data )[ 1 ];
 
 						if (undefined == defines[defineKey]) {
-							console.warn(defineKey + ' is not defined.');
+							THREE.warn(defineKey + ' is not defined.');
 						} else {
 
 							if ( /appearance/.exec( data ) && defineKey ) {
@@ -807,7 +807,7 @@ THREE.VRMLLoader.prototype = {
 
 				}
 
-			}
+			};
 
 			parseNode( getTree( lines ), scene );
 

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

@@ -72,7 +72,7 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, parameters ) {
 
 		}
 
-	}
+	};
 
 	xhr.open( "GET", url, true );
 	xhr.setRequestHeader( "Content-Type", "text/plain" );
@@ -121,12 +121,12 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 							var ctmFile = files[ i ];
 
 							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 );
 
 							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();
-					//console.log( "CTM data parse time [inline]: " + (e-s) + " ms" );
+					//THREE.log( "CTM data parse time [inline]: " + (e-s) + " ms" );
 
 				}
 
 			} else {
 
-				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
+				THREE.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 			}
 
@@ -179,7 +179,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, parameters ) {
 
 		}
 
-	}
+	};
 
 	xhr.open( "GET", url, true );
 	xhr.responseType = "arraybuffer";
@@ -240,7 +240,7 @@ THREE.CTMLoader.prototype.createModel = function ( file, callback ) {
 
 		}
 
-	}
+	};
 
 	Model.prototype = Object.create( THREE.BufferGeometry.prototype );
 	Model.prototype.constructor = Model;

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

@@ -16,4 +16,4 @@ self.onmessage = function( event ) {
 	self.postMessage( files );
 	self.close();
 
-}
+};

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

@@ -155,7 +155,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		// toplevel loader function, delegates to handle_children
 
@@ -515,7 +515,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		function handle_mesh( geo, mat, id ) {
 
@@ -523,7 +523,7 @@ THREE.SceneLoader.prototype = {
 			result.face_materials[ id ] = mat;
 			handle_objects();
 
-		};
+		}
 
 		function handle_hierarchy( node, id, parent, material, obj ) {
 
@@ -577,7 +577,7 @@ THREE.SceneLoader.prototype = {
 			result.objects[ id ] = node;
 			handle_objects();
 
-		};
+		}
 
 		function create_callback_geometry( id ) {
 
@@ -595,7 +595,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		function create_callback_hierachy( id, parent, material, obj ) {
 
@@ -634,7 +634,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		function create_callback_embed( id ) {
 
@@ -647,7 +647,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		function async_callback_gate() {
 
@@ -671,7 +671,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		function finalize() {
 
@@ -702,7 +702,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		var callbackTexture = function ( count ) {
 
@@ -740,7 +740,7 @@ THREE.SceneLoader.prototype = {
 
 			}
 
-		};
+		}
 
 		// first go synchronous elements
 
@@ -1012,7 +1012,7 @@ THREE.SceneLoader.prototype = {
 					var wrapMap = {
 						"repeat": THREE.RepeatWrapping,
 						"mirror": THREE.MirroredRepeatWrapping
-					}
+					};
 
 					if ( wrapMap[ textureJSON.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ textureJSON.wrap[ 0 ] ];
 					if ( wrapMap[ textureJSON.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ textureJSON.wrap[ 1 ] ];
@@ -1161,4 +1161,4 @@ THREE.SceneLoader.prototype = {
 
 	}
 
-}
+};

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

@@ -45,7 +45,7 @@ THREE.glTFAnimation = function(interps)
 	{
 		this.createInterpolators(interps);
 	}
-}
+};
 
 THREE.glTFAnimation.prototype.createInterpolators = function(interps)
 {
@@ -56,7 +56,7 @@ THREE.glTFAnimation.prototype.createInterpolators = function(interps)
 		this.interps.push(interp);
 		this.duration = Math.max(this.duration, interp.duration);
 	}
-}
+};
 
 // Start/stop
 THREE.glTFAnimation.prototype.play = function()
@@ -67,13 +67,13 @@ THREE.glTFAnimation.prototype.play = function()
 	this.startTime = Date.now();
 	this.running = true;
 	THREE.glTFAnimator.add(this);
-}
+};
 
 THREE.glTFAnimation.prototype.stop = function()
 {
 	this.running = false;
 	THREE.glTFAnimator.remove(this);
-}
+};
 
 // Update - drive key frame evaluation
 THREE.glTFAnimation.prototype.update = function()
@@ -105,7 +105,7 @@ THREE.glTFAnimation.prototype.update = function()
 			this.interps[i].interp(t);
 		}
 	}
-}
+};
 
 //Interpolator class
 //Construction/initialization
@@ -147,7 +147,7 @@ THREE.glTFInterpolator = function(param)
 	this.quat1 = new THREE.Quaternion;
 	this.quat2 = new THREE.Quaternion;
 	this.quat3 = new THREE.Quaternion;
-}
+};
 
 //Interpolation and tweening methods
 THREE.glTFInterpolator.prototype.interp = function(t)
@@ -238,7 +238,7 @@ THREE.glTFInterpolator.prototype.interp = function(t)
 	{
 		this.copyValue(this.target);
 	}
-}
+};
 
 THREE.glTFInterpolator.prototype.copyValue = function(target) {
 	
@@ -248,4 +248,4 @@ THREE.glTFInterpolator.prototype.copyValue = function(target) {
 	else {
 		target.copy(this.vec3);
 	}		
-}
+};

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

@@ -14,7 +14,7 @@ THREE.glTFLoader = function (showStatus) {
 	this.shadersLoaded = 0;
 	this.shaders = {};
 	THREE.Loader.call( this, showStatus );
-}
+};
 
 THREE.glTFLoader.prototype = Object.create( THREE.Loader.prototype );
 THREE.glTFLoader.prototype.constructor = THREE.glTFLoader;
@@ -107,7 +107,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 		geometry.addDrawCall( 0, this.indexArray.length, 0 );
 
 		geometry.computeBoundingSphere();
-	}
+	};
     
 	ClassicGeometry.prototype.checkFinished = function() {
 		if (this.indexArray && this.loadedAttributes === this.totalAttributes) {
@@ -127,7 +127,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 	IndicesDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-		console.log("ERROR(IndicesDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(IndicesDelegate):" + errorCode + ":" + info);
 	};
 
 	IndicesDelegate.prototype.convert = function(resource, ctx) {
@@ -153,7 +153,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 	VertexAttributeDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-		console.log("ERROR(VertexAttributeDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(VertexAttributeDelegate):" + errorCode + ":" + info);
 	};
 
 	VertexAttributeDelegate.prototype.convert = function(resource, ctx) {
@@ -203,7 +203,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 		geom.geometry.skinIndices.push( new THREE.Vector4( floatArray[i], floatArray[i + 1], floatArray[i + 2], floatArray[i + 3] ) );
 	}
         }
-	}
+	};
     
 	VertexAttributeDelegate.prototype.bufferResourceAvailable = function(glResource, ctx) {
 		var geom = ctx.geometry;
@@ -241,7 +241,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	floatArray = new Float32Array(glResource, 0, attribute.count * nComponents);
 	geom.geometry.addAttribute( 'skinIndex', new THREE.BufferAttribute( floatArray, nComponents ) );
         }
-	}
+	};
     
 	VertexAttributeDelegate.prototype.resourceAvailable = function(glResource, ctx) {
 
@@ -325,7 +325,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 	AnimationParameterDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-		console.log("ERROR(AnimationParameterDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(AnimationParameterDelegate):" + errorCode + ":" + info);
 	};
 
 	AnimationParameterDelegate.prototype.convert = function(resource, ctx) {
@@ -397,7 +397,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 	InverseBindMatricesDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-		console.log("ERROR(InverseBindMatricesDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(InverseBindMatricesDelegate):" + errorCode + ":" + info);
 	};
 
 	InverseBindMatricesDelegate.prototype.convert = function(resource, ctx) {
@@ -433,12 +433,12 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 	ShaderDelegate.prototype.handleError = function(errorCode, info) {
         // FIXME: report error
-		console.log("ERROR(ShaderDelegate):" + errorCode + ":" + info);
+		THREE.log("ERROR(ShaderDelegate):" + errorCode + ":" + info);
 	};
 
 	ShaderDelegate.prototype.convert = function(resource, ctx) {
 		return resource; 
-	}
+	};
     
 	ShaderDelegate.prototype.resourceAvailable = function(data, ctx) {
 		theLoader.shadersLoaded ++;
@@ -467,12 +467,12 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 
 	Resources.prototype.setEntry = function(entryID, object, description) {
 		if (!entryID) {
-			console.error("No EntryID provided, cannot store", description);
+			THREE.error("No EntryID provided, cannot store", description);
 			return;
 		}
 
 		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 );
@@ -487,11 +487,11 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	};
 
 	LoadDelegate = function() {
-    }
+    };
     
 	LoadDelegate.prototype.loadCompleted = function(callback, obj) {
 		callback.call(Window, obj);
-	}
+	};
     
     // Loader
 
@@ -588,13 +588,13 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
         		
 	var fragmentShader = theLoader.shaders[material.params.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;
 	}
         		
 	var vertexShader = theLoader.shaders[material.params.vertexShader];
 	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;
 	}
         		
@@ -825,7 +825,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	var primitivesDescription = description.primitives;
 	if (!primitivesDescription) {
                     //FIXME: not implemented in delegate
-		console.log("MISSING_PRIMITIVES for mesh:" + entryID);
+		THREE.log("MISSING_PRIMITIVES for mesh:" + entryID);
 		return false;
 	}
 
@@ -1204,7 +1204,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 									boneInverses.push(mat);
         	                                    
 								} else {
-									console.log("WARNING: jointId:" + jointId + " cannot be found in skeleton:" + skeleton);
+									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) {
 
 	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;
 	}
 
@@ -1294,9 +1294,9 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	for (var name in this.nodeAnimationChannels) {
 		var nodeAnimationChannels = this.nodeAnimationChannels[name];
 		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++) {
-        			//	console.log(nodeAnimationChannels[i]);
+        			//	THREE.log(nodeAnimationChannels[i]);
         			//}
 		var anim = new THREE.glTFAnimation(nodeAnimationChannels);
 		anim.name = "animation_" + name;
@@ -1372,7 +1372,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	            var parameters = description.parameters;
 	            if (!parameters) {
 	                //FIXME: not implemented in delegate
-		console.log("MISSING_PARAMETERS for animation:" + entryID);
+		THREE.log("MISSING_PARAMETERS for animation:" + entryID);
 		return false;
 	            }
 	
@@ -1517,7 +1517,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
 	this.callback = callback;
 	this.rootObj = rootObj;
 	return rootObj;
-}
+};
 
 THREE.glTFLoader.prototype.callLoadedCallback = function() {
 	var result = {
@@ -1527,7 +1527,7 @@ THREE.glTFLoader.prototype.callLoadedCallback = function() {
 	};
 	
 	this.callback(result);
-}
+};
 
 THREE.glTFLoader.prototype.checkComplete = function() {
 	if (this.meshesLoaded == this.meshesRequested 
@@ -1550,7 +1550,7 @@ THREE.glTFLoader.prototype.checkComplete = function() {
         
 		this.callLoadedCallback();
 	}
-}
+};
 
 
 

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

@@ -43,12 +43,12 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
         enumerable: false,
         value: function(resourceID, resource) {
 	if (!resourceID) {
-		console.log("ERROR: entry does not contain id, cannot store");
+		THREE.log("ERROR: entry does not contain id, cannot store");
 		return;
 	}
 
 	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;
@@ -137,7 +137,7 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
 
 	processResourceDelegate.handleError = function(errorCode, info) {
 		request.delegate.handleError(errorCode, info);
-	}
+	};
 
 	this._loadStream(request.path, request.type, processResourceDelegate);
         }

+ 1 - 1
examples/js/modifiers/ExplodeModifier.js

@@ -40,4 +40,4 @@ THREE.ExplodeModifier.prototype.modify = function ( geometry ) {
 	geometry.vertices = vertices;
 	delete geometry.__tmpVertices;
 
-}
+};

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

@@ -136,7 +136,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 		var metaVertices, sourceEdges;
 
 		// new stuff.
-		var sourceEdges, newEdgeVertices, newSourceVertices
+		var sourceEdges, newEdgeVertices, newSourceVertices;
 
 		oldVertices = geometry.vertices; // { x, y, z}
 		oldFaces = geometry.faces; // { a: oldVertex1, b: oldVertex2, c: oldVertex3 }
@@ -184,7 +184,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 				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;
 			newEdgeVertices.push(newEdge);
 
-			// console.log(currentEdge, newEdge);
+			// THREE.log(currentEdge, newEdge);
 		}
 
 		/******************************************************
@@ -257,11 +257,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 			if ( n <= 2 ) {
 				
 				// crease and boundary rules
-				// console.warn('crease and boundary rules');
+				// THREE.warn('crease and boundary rules');
 
 				if ( n == 2 ) {
 
-					if (WARNINGS) console.warn('2 connecting edges', connectingEdges);
+					if (WARNINGS) THREE.warn('2 connecting edges', connectingEdges);
 					sourceVertexWeight = 3 / 4;
 					connectingVertexWeight = 1 / 8;
 
@@ -270,11 +270,11 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 
 				} else if ( n == 1 ) {
 
-					if (WARNINGS) console.warn('only 1 connecting edge');
+					if (WARNINGS) THREE.warn('only 1 connecting edge');
 
 				} 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.faces = newFaces;
 
-		// console.log('done');
+		// THREE.log('done');
 
 	};
 

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

@@ -18,7 +18,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	this.currentLuminanceRT = null;
 
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.AdaptiveToneMappingPass relies on THREE.CopyShader" );
+		THREE.error( "THREE.AdaptiveToneMappingPass relies on THREE.CopyShader" );
 
 	var copyShader = THREE.CopyShader;
 
@@ -35,7 +35,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	} );
 
 	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( {
 
@@ -47,7 +47,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 
 	this.adaptLuminanceShader = {
 		defines: {
-			"MIP_LEVEL_1X1" : Math.log2( this.resolution ).toFixed(1),
+			"MIP_LEVEL_1X1" : ( Math.log( this.resolution ) / Math.log( 2.0 ) ).toFixed(1),
 		},
 		uniforms: {
 			"lastLum": { type: "t", value: null },
@@ -103,7 +103,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	} );
 
 	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( {
 

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

@@ -19,7 +19,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	// copy material
 
 	if ( THREE.CopyShader === undefined )
-		console.error( "THREE.BloomPass relies on THREE.CopyShader" );
+		THREE.error( "THREE.BloomPass relies on THREE.CopyShader" );
 
 	var copyShader = THREE.CopyShader;
 
@@ -40,7 +40,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	// convolution material
 
 	if ( THREE.ConvolutionShader === undefined )
-		console.error( "THREE.BloomPass relies on THREE.ConvolutionShader" );
+		THREE.error( "THREE.BloomPass relies on 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
 
 	if ( THREE.BokehShader === undefined ) {
-		console.error( "THREE.BokehPass relies on THREE.BokehShader" );
+		THREE.error( "THREE.BokehPass relies on THREE.BokehShader" );
 	}
 	
 	var bokehShader = THREE.BokehShader;

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

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

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

@@ -27,7 +27,7 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
 	this.passes = [];
 
 	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 );
 

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

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

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است