Explorar o código

Added namespace to all the objects that missed it (geometries, uniforms, etc)
WebGLRenderer antialias is off by default (considering Firefox doesn't support it...)
Formatting clean up here and there

Mr.doob %!s(int64=14) %!d(string=hai) anos
pai
achega
76e7ea3461
Modificáronse 100 ficheiros con 1377 adicións e 1332 borrados
  1. 1 1
      README.md
  2. 89 90
      build/Three.js
  3. 1 1
      build/custom/ThreeCanvas.js
  4. 1 1
      build/custom/ThreeDOM.js
  5. 7 6
      build/custom/ThreeExtras.js
  6. 1 1
      build/custom/ThreeSVG.js
  7. 24 25
      build/custom/ThreeWebGL.js
  8. 1 1
      examples/canvas_camera_orthographic.html
  9. 2 2
      examples/canvas_geometry_cube.html
  10. 2 2
      examples/canvas_geometry_earth.html
  11. 2 2
      examples/canvas_geometry_hierarchy.html
  12. 1 1
      examples/canvas_geometry_panorama.html
  13. 1 1
      examples/canvas_geometry_panorama_fisheye.html
  14. 1 1
      examples/canvas_geometry_terrain.html
  15. 1 1
      examples/canvas_interactive_cubes.html
  16. 1 1
      examples/canvas_interactive_cubes_tween.html
  17. 3 3
      examples/canvas_interactive_voxelpainter.html
  18. 4 4
      examples/canvas_materials.html
  19. 2 3
      examples/canvas_materials_depth.html
  20. 1 1
      examples/canvas_materials_reflection.html
  21. 1 1
      examples/canvas_materials_video.html
  22. 1 1
      examples/canvas_performance.html
  23. 2 2
      examples/canvas_sandbox.html
  24. 1 1
      examples/misc_lights_test.html
  25. 2 2
      examples/misc_lookat.html
  26. 17 12
      examples/misc_materials_multimaterials.html
  27. 14 12
      examples/misc_sound.html
  28. 4 5
      examples/misc_ubiquity_test.html
  29. 25 25
      examples/webgl_collisions_box.html
  30. 43 43
      examples/webgl_collisions_primitives.html
  31. 45 45
      examples/webgl_collisions_reaction.html
  32. 31 31
      examples/webgl_collisions_terrain.html
  33. 43 42
      examples/webgl_collisions_trigger.html
  34. 9 9
      examples/webgl_geometries.html
  35. 3 3
      examples/webgl_geometry_blenderexport_colors.html
  36. 16 16
      examples/webgl_geometry_colors.html
  37. 8 4
      examples/webgl_geometry_dynamic.html
  38. 2 2
      examples/webgl_geometry_hierarchy.html
  39. 2 2
      examples/webgl_geometry_hierarchy2.html
  40. 5 9
      examples/webgl_geometry_large_mesh.html
  41. 16 12
      examples/webgl_geometry_minecraft.html
  42. 10 8
      examples/webgl_geometry_minecraft_ao.html
  43. 8 4
      examples/webgl_geometry_terrain.html
  44. 8 4
      examples/webgl_geometry_terrain_fog.html
  45. 2 2
      examples/webgl_hdr.html
  46. 5 5
      examples/webgl_interactive_voxelpainter.html
  47. 1 1
      examples/webgl_lights_pointlights.html
  48. 9 9
      examples/webgl_lines_colors.html
  49. 6 6
      examples/webgl_lines_splines.html
  50. 13 9
      examples/webgl_lod.html
  51. 4 4
      examples/webgl_materials.html
  52. 3 3
      examples/webgl_materials_cars.html
  53. 19 19
      examples/webgl_materials_cars_camaro.html
  54. 9 9
      examples/webgl_materials_cubemap.html
  55. 5 5
      examples/webgl_materials_cubemap_balls_reflection.html
  56. 5 6
      examples/webgl_materials_cubemap_balls_refraction.html
  57. 3 3
      examples/webgl_materials_cubemap_escher.html
  58. 6 8
      examples/webgl_materials_cubemap_refraction.html
  59. 2 2
      examples/webgl_materials_grass.html
  60. 11 11
      examples/webgl_materials_normalmap.html
  61. 6 6
      examples/webgl_materials_normalmap2.html
  62. 9 5
      examples/webgl_materials_shaders.html
  63. 6 7
      examples/webgl_materials_shaders_fresnel.html
  64. 39 40
      examples/webgl_materials_texture_filters.html
  65. 9 9
      examples/webgl_materials_video.html
  66. 20 20
      examples/webgl_morphtargets.html
  67. 9 9
      examples/webgl_objconvert_test.html
  68. 1 1
      examples/webgl_panorama_equirectangular.html
  69. 2 2
      examples/webgl_particles_billboards.html
  70. 2 2
      examples/webgl_particles_billboards_colors.html
  71. 7 7
      examples/webgl_particles_sprites.html
  72. 12 12
      examples/webgl_postprocessing.html
  73. 9 9
      examples/webgl_postprocessing_dof.html
  74. 6 6
      examples/webgl_ribbons.html
  75. 2 2
      examples/webgl_rtt.html
  76. 6 7
      examples/webgl_sandbox.html
  77. 1 1
      examples/webgl_scene_test.html
  78. 2 2
      examples/webgl_scene_test_blender.html
  79. 1 1
      examples/webgl_shader.html
  80. 3 3
      examples/webgl_shader2.html
  81. 27 27
      examples/webgl_shader_lava.html
  82. 3 3
      examples/webgl_sprites.html
  83. 9 9
      examples/webgl_stencil.html
  84. 8 8
      examples/webgl_stencilLensFlare.html
  85. 7 0
      src/Three.js
  86. 10 6
      src/extras/ImageUtils.js
  87. 31 27
      src/extras/SceneUtils.js
  88. 384 376
      src/extras/ShaderUtils.js
  89. 65 65
      src/extras/cameras/PathCamera.js
  90. 24 24
      src/extras/cameras/QuakeCamera.js
  91. 5 5
      src/extras/geometries/Cube.js
  92. 3 3
      src/extras/geometries/Cylinder.js
  93. 3 3
      src/extras/geometries/Icosahedron.js
  94. 3 3
      src/extras/geometries/Lathe.js
  95. 4 4
      src/extras/geometries/Plane.js
  96. 3 3
      src/extras/geometries/Sphere.js
  97. 5 5
      src/extras/geometries/Torus.js
  98. 5 4
      src/extras/geometries/TorusKnot.js
  99. 49 49
      src/extras/io/BinaryLoader.js
  100. 12 12
      src/extras/io/JSONLoader.js

+ 1 - 1
README.md

@@ -3,7 +3,7 @@ three.js
 
 #### Javascript 3D Engine ####
 
-The aim of this project is to create a lightweight 3D engine with a very low level of abstraction — in other words, for dummies. The engine can render using <canvas>, <svg> and WebGL.
+The aim of the project is to create a lightweight 3D engine with a very low level of complexity — in other words, for dummies. The engine can render using <canvas>, <svg> and WebGL.
 
 [Contributors](https://github.com/mrdoob/three.js/contributors) — [API Reference](https://github.com/mrdoob/three.js/wiki/API-Reference)
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 89 - 90
build/Three.js


+ 1 - 1
build/custom/ThreeCanvas.js

@@ -1,5 +1,5 @@
 // ThreeCanvas.js r38 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
+var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,g,f,i,h;if(c==0)e=d=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:e=h;d=c;g=a;break;case 2:e=a;d=c;g=b;break;case 3:e=a;d=h;g=c;break;case 4:e=b;d=a;g=c;break;case 5:e=c;d=a;
 g=h;break;case 6:case 0:e=c;d=b;g=a}}this.r=e;this.g=d;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -1,5 +1,5 @@
 // ThreeDOM.js r38 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
+var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,g,f,i,h;if(c==0)e=d=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:e=h;d=c;g=a;break;case 2:e=a;d=c;g=b;break;case 3:e=a;d=h;g=c;break;case 4:e=b;d=a;g=c;break;case 5:e=c;d=a;
 g=h;break;case 6:case 0:e=c;d=b;g=a}}this.r=e;this.g=d;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 7 - 6
build/custom/ThreeExtras.js


+ 1 - 1
build/custom/ThreeSVG.js

@@ -1,5 +1,5 @@
 // ThreeSVG.js r38 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
+var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,g,f,i,h;if(c==0)e=d=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:e=h;d=c;g=a;break;case 2:e=a;d=c;g=b;break;case 3:e=a;d=h;g=c;break;case 4:e=b;d=a;g=c;break;case 5:e=c;d=a;
 g=h;break;case 6:case 0:e=c;d=b;g=a}}this.r=e;this.g=d;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 24 - 25
build/custom/ThreeWebGL.js


+ 1 - 1
examples/canvas_camera_orthographic.html

@@ -71,7 +71,7 @@
 
 				// Cubes
 
-				var geometry = new Cube( 50, 50, 50 );
+				var geometry = new THREE.Cube( 50, 50, 50 );
 				var material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
 
 				for ( var i = 0; i < 100; i ++ ) {

+ 2 - 2
examples/canvas_geometry_cube.html

@@ -70,14 +70,14 @@
 
 				}
 
-				cube = new THREE.Mesh( new Cube( 200, 200, 200, 1, 1, 1, materials ), new THREE.MeshFaceMaterial() );
+				cube = new THREE.Mesh( new THREE.Cube( 200, 200, 200, 1, 1, 1, materials ), new THREE.MeshFaceMaterial() );
 				cube.position.y = 150;
 				cube.overdraw = true;
 				scene.addObject( cube );
 
 				// Plane
 
-				plane = new THREE.Mesh( new Plane( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) );
+				plane = new THREE.Mesh( new THREE.Plane( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) );
 				plane.rotation.x = - 90 * ( Math.PI / 180 );
 				plane.overdraw = true;
 				scene.addObject( plane );

+ 2 - 2
examples/canvas_geometry_earth.html

@@ -63,12 +63,12 @@
 
 				scene = new THREE.Scene();
 
-				mesh = new THREE.Mesh( new Plane( 300, 300, 3, 3 ), new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/shadow.png' ) } ) );
+				mesh = new THREE.Mesh( new THREE.Plane( 300, 300, 3, 3 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ) );
 				mesh.position.y = - 250;
 				mesh.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject(mesh);
 
-				mesh = new THREE.Mesh( new Sphere( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ) );
+				mesh = new THREE.Mesh( new THREE.Sphere( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ) );
 				mesh.overdraw = true;
 				scene.addObject(mesh);
 

+ 2 - 2
examples/canvas_geometry_hierarchy.html

@@ -16,7 +16,7 @@
 	<body>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
@@ -48,7 +48,7 @@
 
 				scene = new THREE.Scene();
 
-				var geometry = new Cube( 100, 100, 100 );
+				var geometry = new THREE.Cube( 100, 100, 100 );
 				var material = new THREE.MeshNormalMaterial();
 
 				group = new THREE.Object3D();

+ 1 - 1
examples/canvas_geometry_panorama.html

@@ -76,7 +76,7 @@
 
 				];
 
-				mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
+				mesh = new THREE.Mesh( new THREE.Cube( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
 				mesh.overdraw = true;
 				scene.addObject( mesh );
 

+ 1 - 1
examples/canvas_geometry_panorama_fisheye.html

@@ -76,7 +76,7 @@
 
 				];
 
-				mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
+				mesh = new THREE.Mesh( new THREE.Cube( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() );
 				mesh.overdraw = true;
 				scene.addObject( mesh );
 

+ 1 - 1
examples/canvas_geometry_terrain.html

@@ -70,7 +70,7 @@
 				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTexture( data, 1024, 1024 ) ) } );
 
 				var quality = 16, step = 1024 / quality;
-				var plane = new Plane( 2000, 2000, quality - 1, quality - 1 );
+				var plane = new THREE.Plane( 2000, 2000, quality - 1, quality - 1 );
 
 				for ( var i = 0, l = plane.vertices.length; i < l; i ++ ) {
 

+ 1 - 1
examples/canvas_interactive_cubes.html

@@ -47,7 +47,7 @@
 
 				scene = new THREE.Scene();
 
-				var geometry = new Cube( 100, 100, 100 );
+				var geometry = new THREE.Cube( 100, 100, 100 );
 
 				for ( var i = 0; i < 10; i ++ ) {
 

+ 1 - 1
examples/canvas_interactive_cubes_tween.html

@@ -47,7 +47,7 @@
 
 				scene = new THREE.Scene();
 
-				var geometry = new Cube( 100, 100, 100 );
+				var geometry = new THREE.Cube( 100, 100, 100 );
 
 				for ( var i = 0; i < 20; i ++ ) {
 

+ 3 - 3
examples/canvas_interactive_voxelpainter.html

@@ -23,7 +23,7 @@
 
 			var container, stats;
 			var camera, scene, renderer;
-			var projector, plane, cube;
+			var projector, plane;
 			var mouse2D, mouse3D, ray,
 			rollOveredFace, isShiftDown = false,
 			theta = 45, isCtrlDown = false;
@@ -73,7 +73,7 @@
 
 				projector = new THREE.Projector();
 
-				plane = new THREE.Mesh( new Plane( 1000, 1000, 20, 20 ), new THREE.MeshFaceMaterial() );
+				plane = new THREE.Mesh( new THREE.Plane( 1000, 1000, 20, 20 ), new THREE.MeshFaceMaterial() );
 				plane.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject( plane );
 
@@ -145,7 +145,7 @@
 
 						var position = new THREE.Vector3().add( intersects[ 0 ].point, intersects[ 0 ].object.matrixRotationWorld.multiplyVector3( intersects[ 0 ].face.normal.clone() ) );
 
-						var voxel = new THREE.Mesh( new Cube( 50, 50, 50 ), [ new THREE.MeshLambertMaterial( { color: 0x00ff80, opacity: 1, shading: THREE.FlatShading } ), new THREE.MeshFaceMaterial() ] );
+						var voxel = new THREE.Mesh( new THREE.Cube( 50, 50, 50 ), [ new THREE.MeshLambertMaterial( { color: 0x00ff80, opacity: 1, shading: THREE.FlatShading } ), new THREE.MeshFaceMaterial() ] );
 						voxel.position.x = Math.floor( position.x / 50 ) * 50 + 25;
 						voxel.position.y = Math.floor( position.y / 50 ) * 50 + 25;
 						voxel.position.z = Math.floor( position.z / 50 ) * 50 + 25;

+ 4 - 4
examples/canvas_materials.html

@@ -65,7 +65,7 @@
 
 				// Spheres
 
-				var geometry = new Sphere( 100, 14, 7, false );
+				var geometry = new THREE.Sphere( 100, 14, 7, false );
 
 				var materials = [
 
@@ -75,9 +75,9 @@
 					{ material: new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ), overdraw: true, doubleSided: false },
 					{ material: new THREE.MeshDepthMaterial(), overdraw: true, doubleSided: false },
 					{ material: new THREE.MeshNormalMaterial(), overdraw: true, doubleSided: false },
-					{ material: new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
-					{ material: new THREE.MeshLambertMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
-					{ material: new THREE.MeshBasicMaterial( { envMap: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ), overdraw: false, doubleSided: false }
+					{ material: new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
+					{ material: new THREE.MeshLambertMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
+					{ material: new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ), overdraw: false, doubleSided: false }
 
 				];
 

+ 2 - 3
examples/canvas_materials_depth.html

@@ -72,7 +72,7 @@
 
 				var material = new THREE.MeshDepthMaterial();
 
-				plane = new THREE.Mesh( new Plane( 1000, 1000, 10, 10 ), material );
+				plane = new THREE.Mesh( new THREE.Plane( 1000, 1000, 10, 10 ), material );
 				plane.rotation.x = - 90 * ( Math.PI / 180 );
 				plane.position.y = - 100;
 				plane.doubleSided = true;
@@ -80,8 +80,7 @@
 
 				// Spheres
 
-				geometry = new Cube( 100, 100, 100 );
-				//material = new THREE.MeshLambertMaterial( { color: 0xffffff } );
+				geometry = new THREE.Cube( 100, 100, 100 );
 				material = new THREE.MeshDepthMaterial( { near: 1, far: 2000 } );
 
 				for (var i = 0; i < 20; i ++ ) {

+ 1 - 1
examples/canvas_materials_reflection.html

@@ -66,7 +66,7 @@
 				geometry = new WaltHead();
 				geometry.computeVertexNormals();
 
-				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
+				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
 				mesh.overdraw = true;
 				scene.addObject( mesh );
 

+ 1 - 1
examples/canvas_materials_video.html

@@ -104,7 +104,7 @@
 
 				//
 
-				var plane = new Plane( 480, 204, 4, 4 );
+				var plane = new THREE.Plane( 480, 204, 4, 4 );
 
 				mesh = new THREE.Mesh( plane, material );
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5;

+ 1 - 1
examples/canvas_performance.html

@@ -74,7 +74,7 @@
 
 				// Spheres
 
-				geometry = new Sphere( 100, 26, 18 );
+				geometry = new THREE.Sphere( 100, 26, 18 );
 				material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, opacity: 1 } );
 
 				for ( var i = 0; i < 20; i ++ ) {

+ 2 - 2
examples/canvas_sandbox.html

@@ -171,8 +171,8 @@
 
 				objects = [];
 
-				geometry = new Sphere( 100, 16, 8 );
-				material = new THREE.MeshBasicMaterial( { envMap: ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } );
+				geometry = new THREE.Sphere( 100, 16, 8 );
+				material = new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } );
 
 				for ( var i = 0; i < 10; i ++ ) {
 

+ 1 - 1
examples/misc_lights_test.html

@@ -90,7 +90,7 @@
 
 				// Spheres
 
-				var geometry = new Sphere( 100, 16, 8 );
+				var geometry = new THREE.Sphere( 100, 16, 8 );
 				var material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
 
 				for ( var i = 0; i < 30; i ++ ) {

+ 2 - 2
examples/misc_lookat.html

@@ -65,10 +65,10 @@
 
 				scene = new THREE.Scene();
 
-				var geometry = new Cube( 10, 10, 100 );
+				var geometry = new THREE.Cube( 10, 10, 100 );
 				var material = new THREE.MeshNormalMaterial( { shading: THREE.SmoothShading } );
 
-				target = new THREE.Mesh( new Sphere( 100, 20, 20 ), material );
+				target = new THREE.Mesh( new THREE.Sphere( 100, 20, 20 ), material );
 				scene.addObject( target );
 
 				for ( var i = 0; i < 1000; i ++ ) {

+ 17 - 12
examples/misc_materials_multimaterials.html

@@ -49,7 +49,7 @@
 
 			var SCREEN_WIDTH = window.innerWidth/2;
 			var SCREEN_HEIGHT = window.innerHeight;
-			var FLOOR = -250;
+			var FLOOR = - 250;
 
 			var container;
 			var stats;
@@ -96,8 +96,10 @@
 
 				// SPHERES
 
-				sphere = new Sphere( 100, 16, 8 );
-				for (var i=0; i<10; i++) {
+				sphere = new THREE.Sphere( 100, 16, 8 );
+
+				for ( var i = 0; i < 10; i ++ ) {
+
 					//mesh = new THREE.Mesh( sphere, new THREE.MeshLambertMaterial( ) );
 					mesh = new THREE.Mesh( sphere, [ new THREE.MeshLambertMaterial( { color: 0xffffff } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true,  wireframeLinewidth: 1.5 } ) ] );
 					//mesh = new THREE.Mesh( sphere, new THREE.MeshLambertMaterial( { color: 0x00aa00, wireframe: true,  wireframeLinewidth: 1.5 } ) );
@@ -107,6 +109,7 @@
 					mesh.position.z = 500 * ( Math.random() - 0.5 );
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * (Math.random() + 0.5);
 					scene.addObject(mesh);
+
 				}
 
 
@@ -132,10 +135,12 @@
 				mesh.position = pointLight.position;
 				scene.addObject(mesh);
 
-				if( render_canvas ) {
+				if ( render_canvas ) {
+
 					canvasRenderer = new THREE.CanvasRenderer();
 					canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 					container.appendChild( canvasRenderer.domElement );
+
 				}
 
 				if ( render_gl ) {
@@ -234,12 +239,12 @@
 
 			function createMaterialsPalette( materials, size, bottom ) {
 
-				for ( var i=0; i<materials.length; ++i ) {
+				for ( var i = 0; i < materials.length; i ++ ) {
 
 					// material
-					mesh = new THREE.Mesh( new Plane( size, size ), materials[i] );
-					mesh.position.x = i * (size + 5) - ( ( materials.length - 1 )* ( size + 5 )/2);
-					mesh.position.y = FLOOR + size/2 + bottom;
+					mesh = new THREE.Mesh( new THREE.Plane( size, size ), materials[i] );
+					mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 ) * ( size + 5 ) / 2 );
+					mesh.position.y = FLOOR + size / 2 + bottom;
 					mesh.position.z = -100;
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
 					mesh.doubleSided = true;
@@ -259,10 +264,10 @@
 					var xm = new THREE.MeshBasicMaterial( { map: new THREE.Texture( x ) } );
 					xm.map.needsUpdate = true;
 
-					mesh = new THREE.Mesh( new Plane( size, size ), xm );
-					mesh.position.x = i * (size + 5) - ( ( materials.length - 1 )* ( size + 5 )/2);
-					mesh.position.y = FLOOR + size/2 + bottom;
-					mesh.position.z = -99;
+					mesh = new THREE.Mesh( new THREE.Plane( size, size ), xm );
+					mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 ) * ( size + 5 ) / 2 );
+					mesh.position.y = FLOOR + size / 2 + bottom;
+					mesh.position.z = - 99;
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
 					mesh.doubleSided = true;
 					mesh.updateMatrix();

+ 14 - 12
examples/misc_sound.html

@@ -70,8 +70,10 @@
 				scene  = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.0035 );
 
-				camera = new THREE.QuakeCamera( { fov: 50, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
-												  movementSpeed: 1, lookSpeed: 0.002, noFly: true, lookVertical: false } );
+				camera = new THREE.QuakeCamera( {
+					fov: 50, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
+					movementSpeed: 1, lookSpeed: 0.002, noFly: true, lookVertical: false
+				} );
 
 				camera.position.set( 0, 25, 0 );
 
@@ -80,12 +82,12 @@
 				light.position.normalize();
 				scene.addLight( light );
 
-				var sphere = new Sphere( 20, 32, 16 );
+				var sphere = new THREE.Sphere( 20, 32, 16 );
 
 				material_sphere1 = new THREE.MeshLambertMaterial( { color: 0xffaa00, shading: THREE.FlatShading } );
 				material_sphere2 = new THREE.MeshLambertMaterial( { color: 0xff2200, shading: THREE.FlatShading } );
 
-				var cube = new Cube( 5, 40, 5 );
+				var cube = new THREE.Cube( 5, 40, 5 );
 				var material_cube = new THREE.MeshLambertMaterial( { color: 0xffff00, shading: THREE.FlatShading } );
 				material_cube.color.setHSV( 0.1, 0.7, 1 );
 
@@ -130,7 +132,7 @@
 				material_wireframe.color.setHSV( 0.1, 0.2, 0.25 );
 
 
-				var plane = new Plane( 1000, 1000, 100, 100 );
+				var plane = new THREE.Plane( 1000, 1000, 100, 100 );
 				mesh = new THREE.Mesh( plane, material_wireframe );
 				mesh.position.y = 0.1;
 				mesh.rotation.x = -1.57;
@@ -165,8 +167,8 @@
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
@@ -181,15 +183,15 @@
 
 				} );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
 				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
 
 				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -199,8 +201,8 @@
 
 				} );
 
-				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
-				postprocessing.quad.position.z = -500;
+				postprocessing.quad = new THREE.Mesh( new THREE.Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad.position.z = - 500;
 				postprocessing.scene.addObject( postprocessing.quad );
 
 			}

+ 4 - 5
examples/misc_ubiquity_test.html

@@ -57,7 +57,6 @@
 		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/Texture.js"></script>
-		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
 		<script type="text/javascript" src="../src/objects/Particle.js"></script>
 		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
 		<script type="text/javascript" src="../src/objects/Line.js"></script>
@@ -103,7 +102,7 @@
 		<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
 		<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
 		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
-		
+
 		<script type="text/javascript" src="obj/Qrcode.js"></script>
 
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
@@ -150,7 +149,7 @@
 
 				// CUBES
 
-				var cube = new Cube( 100, 100, 100 );
+				var cube = new THREE.Cube( 100, 100, 100 );
 
 				mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: 0x0000ff, opacity: 0.5 } ) );
 				mesh.position.x = 500;
@@ -169,7 +168,7 @@
 
 				// PLANE
 
-				mesh = new THREE.Mesh( new Plane( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
+				mesh = new THREE.Mesh( new THREE.Plane( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
 				mesh.position.y = -500;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
 				mesh.doubleSided = true;
@@ -177,7 +176,7 @@
 
 				// CYLINDER
 
-				mesh = new THREE.Mesh( new Cylinder( 10, 20, 100, 200, - 50, - 20 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
+				mesh = new THREE.Mesh( new THREE.Cylinder( 10, 20, 100, 200, - 50, - 20 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
 				mesh.position.x = -500;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
 				scene.addObject( mesh );

+ 25 - 25
examples/webgl_collisions_box.html

@@ -1,9 +1,9 @@
-<html> 
- 
-<head> 
-<title>three.js webgl - intersection: ray with box</title> 
-<meta http-equiv="content-type" content="text/html; charset=utf-8"> 
-<style type="text/css"> 
+<html>
+
+<head>
+<title>three.js webgl - intersection: ray with box</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<style type="text/css">
 
 body {
 	font-family: Monospace;
@@ -11,7 +11,7 @@ body {
 	margin: 0px;
 	overflow: hidden;
 }
- 
+
 #oldie { background-color: #ddd !important }
 
 #info {
@@ -38,7 +38,7 @@ body {
 
 </style>
 
-<script type="text/javascript" src="../build/Three.js"></script> 
+<script type="text/javascript" src="../build/Three.js"></script>
 <script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 <script type="text/javascript" src="js/Stats.js"></script>
 
@@ -52,9 +52,9 @@ function init() {
 
 	container = document.createElement( 'div' );
 	document.body.appendChild( container );
-	
+
 	info = document.getElementById("info");
-	
+
 	camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 	camera.position.z = -500;
 	mouse2d = new THREE.Vector3( 0, 0, 1 );
@@ -64,14 +64,14 @@ function init() {
 	renderer = new THREE.WebGLRenderer();
 	renderer.setSize( window.innerWidth, window.innerHeight );
 	container.appendChild(renderer.domElement);
-	
+
 	var ambientLight = new THREE.AmbientLight( 0x606060 );
 	scene.addLight( ambientLight );
 
 	sun = new THREE.DirectionalLight( 0xffffff );
 	sun.position = camera.position.clone();
 	scene.addLight( sun );
-	
+
 	createCube( 200, new THREE.Vector3( 0,0,0 ) );
 
 	stats = new Stats();
@@ -85,9 +85,9 @@ function init() {
 }
 
 function createCube( s, p ) {
-	
-	cube = new THREE.Mesh ( 	
-		new Cube( s,s,s, 1,1,1 ), 
+
+	cube = new THREE.Mesh (
+		new THREE.Cube( s,s,s, 1,1,1 ),
 		new THREE.MeshLambertMaterial( { color: 0x003300 })
 	);
 
@@ -100,7 +100,7 @@ function createCube( s, p ) {
 
 function onDocumentMouseMove( event ) {
 
-	event.preventDefault();	
+	event.preventDefault();
 	mouse2d.x = ( event.clientX / window.innerWidth ) * 2 - 1;
 	mouse2d.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
 	mouse2d.z = 1;
@@ -110,7 +110,7 @@ function onDocumentMouseMove( event ) {
 function animate() {
 
 	requestAnimationFrame( animate );
-	
+
 	var r = new THREE.Ray();
 	r.origin.copy( mouse2d );
 
@@ -124,7 +124,7 @@ function animate() {
 	var c = THREE.Collisions.rayCastNearest( r );
 
 	if( c ) {
-	
+
 		info.innerHTML += "Found @ distance " + c.distance.toFixed(2);
 		c.mesh.materials[ 0 ].color.setHex( 0xaa0000 );
 
@@ -134,15 +134,15 @@ function animate() {
 		cube.materials[0].color.setHex( 0x003300 );
 
 	}
-	
-	
+
+
 	cube.rotation.x += 0.01;
 	cube.rotation.y += 0.02;
 	cube.position.x = Math.sin(bounce) * 100;
 	bounce += 0.01;
 
 	renderer.render( scene, camera );
-	
+
 	stats.update();
 
 };
@@ -156,11 +156,11 @@ function vts(v) {
 
 </script>
 
-</head> 
+</head>
 
-<body onload="init();"> 
+<body onload="init();">
 <div id="info"></div>
 <div id="options"></div>
-</body> 
+</body>
 
-</html> 
+</html>

+ 43 - 43
examples/webgl_collisions_primitives.html

@@ -3,18 +3,18 @@
         <title>three.js webgl - intersection: ray with sphere/AABB/plane</title>
         <meta http-equiv="content-type" content="text/html; charset=utf-8">
         <style type="text/css">
-            
+
             body {
                 font-family: Monospace;
                 background-color: #f0f0f0;
                 margin: 0px;
                 overflow: hidden;
             }
-            
+
             #oldie {
                 background-color: #ddd !important
             }
-            
+
             #info {
                 position: absolute;
                 top: 30px;
@@ -27,7 +27,7 @@
                 text-align: left;
                 z-index: 100;
             }
-            
+
             #options {
                 position: absolute;
                 top: 10px;
@@ -40,41 +40,41 @@
                 text-align: left;
                 z-index: 100;
             }
-            
+
         </style>
         <script type="text/javascript" src="../build/Three.js"></script>
         <script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
-		
+
         <script type="text/javascript">
-            
+
             var scene, camera, renderer, info, mouse2d, sun;
-            
+
             var theta = 0;
             var camdist = 1500;
             var geoms = [];
-            
+
             function init(){
                 container = document.createElement('div');
                 document.body.appendChild(container);
-                
+
                 info = document.getElementById("info");
-                
+
                 camera = new THREE.Camera(40, window.innerWidth / window.innerHeight, 1, 10000);
                 mouse2d = new THREE.Vector3(0, 0, 1);
-                
+
                 scene = new THREE.Scene();
-                
+
                 renderer = new THREE.WebGLRenderer();
                 renderer.setSize(window.innerWidth, window.innerHeight);
                 container.appendChild(renderer.domElement);
-                
+
                 var ambientLight = new THREE.AmbientLight(0x606060);
                 scene.addLight(ambientLight);
-                
+
                 sun = new THREE.DirectionalLight(0xffffff);
                 scene.addLight(sun);
-                
+
                 //makeWall(480);
                 //makeWall(360);
                 makeWall(240);
@@ -84,43 +84,43 @@
                 makeWall(-240);
                 //makeWall(-360);
                 //makeWall(-480);
-                
-                plane = new THREE.Mesh(new Plane(30000, 30000, 10, 10), new THREE.MeshLambertMaterial({
+
+                plane = new THREE.Mesh(new THREE.Plane(30000, 30000, 10, 10), new THREE.MeshLambertMaterial({
                     color: 0x003300
                 }));
                 plane.position.y = -480;
                 plane.rotation.x = Math.PI / -2;
                 scene.addObject(plane);
                 geoms.push(plane);
-                
+
                 var cplane = new THREE.PlaneCollider(plane.position, new THREE.Vector3(0, 1, 0));
                 cplane.mesh = plane;
                 THREE.Collisions.colliders.push(cplane);
-                
+
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
 				stats.domElement.style.top = '0px';
 				container.appendChild( stats.domElement );
-				
+
                 container.onmousemove = onDocumentMouseMove;
                 animate();
 
             }
-            
+
             function makeWall(z){
                 var mx = 120 * 2;
                 for (var i = -mx; i <= mx; i += 120) {
                     for (var j = -mx; j <= mx; j += 120) {
-                        if (Math.random() > 0.5) 
+                        if (Math.random() > 0.5)
                             createCube(100, new THREE.Vector3(j, i, z));
-                        else 
+                        else
                             createSphere(50, new THREE.Vector3(j, i, z));
                     }
                 }
             }
-            
+
             function createCube(s, p){
-                var cube = new THREE.Mesh(new Cube(s, s, s, 1, 1, 1), new THREE.MeshLambertMaterial({
+                var cube = new THREE.Mesh(new THREE.Cube(s, s, s, 1, 1, 1), new THREE.MeshLambertMaterial({
                     color: 0x003300
                 }));
                 cube.position = p;
@@ -128,41 +128,41 @@
                 geoms.push(cube);
                 THREE.Collisions.colliders.push(THREE.CollisionUtils.MeshAABB(cube, p));
             }
-            
+
             function createSphere(rad, p){
-                var sphere = new THREE.Mesh(new Sphere(rad, 10, 10), new THREE.MeshLambertMaterial({
+                var sphere = new THREE.Mesh(new THREE.Sphere(rad, 10, 10), new THREE.MeshLambertMaterial({
                     color: 0x003300
                 }));
                 sphere.position = p;
                 scene.addObject(sphere);
                 geoms.push(sphere);
-                
+
                 var sc = new THREE.SphereCollider(p, rad);
                 sc.mesh = sphere;
                 THREE.Collisions.colliders.push(sc);
             }
-            
+
             function onDocumentMouseMove(event){
                 event.preventDefault();
                 mouse2d.x = (event.clientX / window.innerWidth) * 2 - 1;
                 mouse2d.y = -(event.clientY / window.innerHeight) * 2 + 1;
                 mouse2d.z = 1;
             }
-            
+
             function animate(){
                 requestAnimationFrame(animate);
-                
+
                 var r = new THREE.Ray();
                 r.origin = mouse2d.clone();
                 var matrix = camera.matrixWorld.clone();
                 matrix.multiplySelf(THREE.Matrix4.makeInvert(camera.projectionMatrix));
                 matrix.multiplyVector3(r.origin);
                 r.direction = r.origin.clone().subSelf(camera.position);
-                
+
                 for (var i = 0; i < geoms.length; i++) {
                     geoms[i].materials[0].color = new THREE.Color(0x007700);
                 }
-                
+
                 if ( !document.getElementById( "nearest" ).checked ) {
 
                     // Raycast all
@@ -176,7 +176,7 @@
                         info.innerHTML = cs.length + " colliders found in " + tt;
 
                         for ( var i = 0; i < cs.length; i++ ) {
-						
+
                             cs[ i ].mesh.materials[ 0 ].color.setHex( 0xaa0000 );
 
                         }
@@ -188,7 +188,7 @@
                     }
 
                 } else {
-				
+
                     // Raycast nearest
 
                     ts = new Date().getTime();
@@ -207,26 +207,26 @@
                     }
 
                 }
-                
+
                 camera.position.x = camdist * Math.cos(theta);
                 camera.position.z = camdist * Math.sin(theta);
                 camera.position.y = camdist / 2 * Math.sin(theta * 2);
                 sun.position = camera.position.clone();
                 sun.position.normalize();
                 theta += 0.005;
-                
+
                 renderer.render( scene, camera );
-				
+
 				stats.update();
             }
-            
+
             function vts(v){
-                if (!v) 
+                if (!v)
                     return "undefined<br>";
-                else 
+                else
                     return v.x + " , " + v.y + " , " + v.z + "<br>";
             }
-            
+
         </script>
     </head>
     <body onload="init();">

+ 45 - 45
examples/webgl_collisions_reaction.html

@@ -3,18 +3,18 @@
         <title>three.js webgl - collision reaction</title>
         <meta http-equiv="content-type" content="text/html; charset=utf-8">
         <style type="text/css">
-            
+
             body {
                 font-family: Monospace;
                 background-color: #f0f0f0;
                 margin: 0px;
                 overflow: hidden;
             }
-            
+
             #oldie {
                 background-color: #ddd !important
             }
-            
+
             #info {
                 position: absolute;
                 top: 30px;
@@ -27,7 +27,7 @@
                 text-align: left;
                 z-index: 100;
             }
-            
+
             #options {
                 position: absolute;
                 top: 10px;
@@ -40,137 +40,137 @@
                 text-align: left;
                 z-index: 100;
             }
-            
+
         </style>
         <script type="text/javascript" src="../build/Three.js">
         </script>
         <script type="text/javascript" src="js/RequestAnimationFrame.js">
         </script>
         <script type="text/javascript">
-            
+
             var scene, camera, renderer, info, mouse2d, sun, loader, sphere, debugNormal;
-            
+
             var range = 400;
             var speed = 1;
             var sphereSize = 4;
-			
+
 			var cubes = [];
-            
-            
+
+
             function init(){
                 container = document.createElement('div');
                 document.body.appendChild(container);
-                
+
                 info = document.getElementById("info");
-                
+
                 camera = new THREE.Camera(40, window.innerWidth / window.innerHeight, 1, 10000);
                 camera.position.y = 120;
 				camera.position.x = 300;
 				camera.position.z = 0;
                 mouse2d = new THREE.Vector3(0, 0, 1);
-                
+
                 loader = new THREE.Loader(true);
-                
+
                 scene = new THREE.Scene();
-                
-                sphere = new THREE.Mesh(new Sphere(sphereSize, 10, 10), new THREE.MeshLambertMaterial({
+
+                sphere = new THREE.Mesh(new THREE.Sphere(sphereSize, 10, 10), new THREE.MeshLambertMaterial({
                     color: 0xff0000
                 }));
                 scene.addObject(sphere);
-                
+
                 renderer = new THREE.WebGLRenderer();
                 renderer.setSize(window.innerWidth, window.innerHeight);
                 container.appendChild(renderer.domElement);
-                
+
                 var ambientLight = new THREE.AmbientLight(0xdddddd);
                 scene.addLight(ambientLight);
-                
+
                 sun = new THREE.DirectionalLight(0xffffff);
                 sun.position = new THREE.Vector3(1, -1, 1).normalize();
                 scene.addLight(sun);
-                
+
                 createObstacles();
-				
+
 				var geometry = new THREE.Geometry();
 				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(0,  0,  0) ) );
 				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(10, 0,  0) ) );
 				debugNormal = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xff0000 } ) );
 				scene.addObject( debugNormal );
-                
+
                 container.onmousemove = onDocumentMouseMove;
                 animate();
             }
-            
+
             function createObstacles(){
                 				createCube(100, 50, 10, new THREE.Vector3( 20, 0, 100), Math.PI / 4);
 				camera.target = createCube(100, 50, 10, new THREE.Vector3(-20, 0, 200), -Math.PI / 4);
 								createCube(100, 50, 10, new THREE.Vector3( 20, 0, 300), Math.PI / 4);
             }
-            
+
             function createCube(sx, sy, sz, p, ry){
-                var cube = new THREE.Mesh(new Cube(sx, sy, sz, 1, 1, 1), new THREE.MeshLambertMaterial({
+                var cube = new THREE.Mesh(new THREE.Cube(sx, sy, sz, 1, 1, 1), new THREE.MeshLambertMaterial({
                     color: 0x003300//, wireframe: true
                 }));
                 cube.position = p;
 				cube.rotation.y = ry;
                 scene.addObject(cube);
-                THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) );	
+                THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) );
 				cubes.push(cube);
 				return cube;
             }
-            
+
             function onDocumentMouseMove(event){
                 event.preventDefault();
                 mouse2d.x = (event.clientX / window.innerWidth) * 2 - 1;
                 mouse2d.y = -(event.clientY / window.innerHeight) * 2 + 1;
                 mouse2d.z = 1;
             }
-            
+
             function animate(){
                 requestAnimationFrame(animate);
 
 				for (var i = 0; i < cubes.length; i++) {
 					cubes[i].materials[0].color = new THREE.Color(0x003300);
 				}
-				
+
 				var ray = new THREE.Ray( sphere.position, new THREE.Vector3(0,0,1) );
-				
+
 				//debugNormal.position = sphere.position;
-				
-				
-				
+
+
+
 				var c = THREE.Collisions.rayCastNearest(ray);
-				
+
 				if (!c || c.distance > speed) {
 					sphere.position.z += speed;
-				} 
+				}
 
 				if(c && c.normal) {
-					info.innerHTML = vts(c.normal);	
+					info.innerHTML = vts(c.normal);
 					var poi = ray.origin.clone().addSelf( ray.direction.clone().multiplyScalar( c.distance ) );
 					debugNormal.geometry.vertices[0].position = poi.clone().addSelf( new THREE.Vector3(2,2,2) );
 					debugNormal.geometry.vertices[1].position = poi.clone().addSelf( c.normal.clone() );
 				}
-				
-				
-				
+
+
+
 
                 if(sphere.position.z > range) sphere.position = new THREE.Vector3(0,0,0);
-				
+
 				camera.position.x = Math.cos(mouse2d.x * Math.PI) * 300;
 				camera.position.y = Math.cos(mouse2d.y * Math.PI) * 300;
 				camera.position.z = 200 + Math.sin(mouse2d.x * Math.PI) * 300 +  Math.sin(mouse2d.y * Math.PI) * 300;
-                
+
                 renderer.render(scene, camera);
             }
-            
+
             function vts(v){
-                if (!v) 
+                if (!v)
                     return "undefined<br>";
-                else 
+                else
                     return v.x + " , " + v.y + " , " + v.z + "<br>";
             }
-            
+
         </script>
     </head>
     <body onload="init();">

+ 31 - 31
examples/webgl_collisions_terrain.html

@@ -1,9 +1,9 @@
-<html> 
- 
-<head> 
-<title>three.js webgl - intersection: ray with terrain mesh (through box)</title> 
-<meta http-equiv="content-type" content="text/html; charset=utf-8"> 
-<style type="text/css"> 
+<html>
+
+<head>
+<title>three.js webgl - intersection: ray with terrain mesh (through box)</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<style type="text/css">
 
 body {
 	font-family: Monospace;
@@ -11,7 +11,7 @@ body {
 	margin: 0px;
 	overflow: hidden;
 }
- 
+
 #oldie { background-color: #ddd !important }
 
 #info {
@@ -37,11 +37,11 @@ body {
 }
 
 </style>
- 
+
 <script type="text/javascript" src="../build/Three.js"></script>
 <script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 
-<script type="text/javascript"> 
+<script type="text/javascript">
 
 var scene, camera, renderer, info, mouse2d, sun, loader, sphere, ray;
 
@@ -54,46 +54,46 @@ var sphereSize = 4;
 function init() {
 	container = document.createElement( 'div' );
 	document.body.appendChild( container );
-	
+
 	info = document.getElementById("info");
-	
+
 	camera = new THREE.Camera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 	camera.position.y = 120;
 	mouse2d = new THREE.Vector3( 0, 0, 1 );
-	
+
 	loader = new THREE.JSONLoader();
 
 	scene = new THREE.Scene();
-	
+
 	ray = new THREE.Ray();
 	ray.origin.y = 10000;
 	ray.direction = new THREE.Vector3(0, -1, 0);
-	
-	sphere = new THREE.Mesh( new Sphere( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) );
+
+	sphere = new THREE.Mesh( new THREE.Sphere( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) );
 	scene.addObject(sphere);
 	camera.target = sphere;
 
 	renderer = new THREE.WebGLRenderer();
 	renderer.setSize( window.innerWidth, window.innerHeight );
 	container.appendChild(renderer.domElement);
-	
+
 	var ambientLight = new THREE.AmbientLight( 0x444444 );
 	scene.addLight( ambientLight );
 
 	sun = new THREE.DirectionalLight( 0xaaaaaa );
 	sun.position = new THREE.Vector3(-1,1, -1).normalize();
 	scene.addLight( sun );
-	
+
 	loadCube();
-	
-	
+
+
 
 	container.onmousemove = onDocumentMouseMove;
 	animate();
 }
 
 function loadCube(p) {
-	var onGeometry = function( geometry ) {		
+	var onGeometry = function( geometry ) {
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xf3e4b8 } ) );
 		scene.addObject( mesh );
 		THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshColliderWBox(mesh) );
@@ -103,7 +103,7 @@ function loadCube(p) {
 }
 
 function onDocumentMouseMove( event ) {
-	event.preventDefault();	
+	event.preventDefault();
 	mouse2d.x = ( event.clientX / window.innerWidth ) * 2 - 1;
 	mouse2d.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
 	mouse2d.z = 1;
@@ -111,10 +111,10 @@ function onDocumentMouseMove( event ) {
 
 function animate() {
 	requestAnimationFrame( animate );
-		
+
 	ray.origin.x = radius * Math.cos(theta);
 	ray.origin.z = radius * Math.sin(theta);
-	
+
 	var c = THREE.Collisions.rayCastNearest(ray);
 	if(c) {
 		//info.innerHTML = "Found @ distance " + c.distance;
@@ -123,11 +123,11 @@ function animate() {
 		//info.innerHTML = "No intersection";
 	}
 
-	
-	
-	
+
+
+
 	theta += speed;
-	
+
 	renderer.render( scene, camera );
 }
 
@@ -138,11 +138,11 @@ function vts(v) {
 
 </script>
 
-</head> 
+</head>
 
-<body onload="init();"> 
+<body onload="init();">
 <div id="info"></div>
 <div id="options"></div>
-</body> 
+</body>
 
-</html> 
+</html>

+ 43 - 42
examples/webgl_collisions_trigger.html

@@ -3,18 +3,18 @@
         <title>three.js webgl - collision detection</title>
         <meta http-equiv="content-type" content="text/html; charset=utf-8">
         <style type="text/css">
-            
+
             body {
                 font-family: Monospace;
                 background-color: #f0f0f0;
                 margin: 0px;
                 overflow: hidden;
             }
-            
+
             #oldie {
                 background-color: #ddd !important
             }
-            
+
             #info {
                 position: absolute;
                 top: 30px;
@@ -27,7 +27,7 @@
                 text-align: left;
                 z-index: 100;
             }
-            
+
             #options {
                 position: absolute;
                 top: 10px;
@@ -40,122 +40,123 @@
                 text-align: left;
                 z-index: 100;
             }
-            
+
         </style>
-		
+
         <script type="text/javascript" src="../build/Three.js">
         </script>
         <script type="text/javascript" src="js/RequestAnimationFrame.js">
         </script>
 
         <script type="text/javascript">
-            
+
             var scene, camera, renderer, info, mouse2d, sun, loader, sphere;
-            
+
             var range = 400;
             var speed = 1;
             var sphereSize = 4;
-			
+
 			var cubes = [];
-            
-            
+
+
             function init(){
                 container = document.createElement('div');
                 document.body.appendChild(container);
-                
+
                 info = document.getElementById("info");
-                
+
                 camera = new THREE.Camera(40, window.innerWidth / window.innerHeight, 1, 10000);
-                camera.position.y = 120;
-				camera.position.x = 300;
-				camera.position.z = 0;
+		camera.position.y = 120;
+		camera.position.x = 300;
+		camera.position.z = 0;
+
                 mouse2d = new THREE.Vector3(0, 0, 1);
-                
+
                 loader = new THREE.Loader(true);
-                
+
                 scene = new THREE.Scene();
-                
-                sphere = new THREE.Mesh(new Sphere(sphereSize, 10, 10), new THREE.MeshLambertMaterial({
+
+                sphere = new THREE.Mesh(new THREE.Sphere(sphereSize, 10, 10), new THREE.MeshLambertMaterial({
                     color: 0xff0000
                 }));
                 scene.addObject(sphere);
-                
+
                 renderer = new THREE.WebGLRenderer();
                 renderer.setSize(window.innerWidth, window.innerHeight);
                 container.appendChild(renderer.domElement);
-                
+
                 var ambientLight = new THREE.AmbientLight(0xdddddd);
                 scene.addLight(ambientLight);
-                
+
                 sun = new THREE.DirectionalLight(0xffffff);
                 sun.position = new THREE.Vector3(1, -1, 1).normalize();
                 scene.addLight(sun);
-                
+
                 createObstacles();
-                
+
                 container.onmousemove = onDocumentMouseMove;
                 animate();
             }
-            
+
             function createObstacles(){
                 createCube(100, 50, 10, new THREE.Vector3(0, 0, 100));
 				camera.target = createCube(100, 50, 10, new THREE.Vector3(0, 0, 200));
 				createCube(100, 50, 10, new THREE.Vector3(0, 0, 300));
             }
-            
+
             function createCube(sx, sy, sz, p){
-                var cube = new THREE.Mesh(new Cube(sx, sy, sz, 1, 1, 1), new THREE.MeshLambertMaterial({
+                var cube = new THREE.Mesh(new THREE.Cube(sx, sy, sz, 1, 1, 1), new THREE.MeshLambertMaterial({
                     color: 0x003300//, wireframe: true
                 }));
                 cube.position = p;
                 scene.addObject(cube);
-                THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) );	
+                THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) );
 				cubes.push(cube);
 				return cube;
             }
-            
+
             function onDocumentMouseMove(event){
                 event.preventDefault();
                 mouse2d.x = (event.clientX / window.innerWidth) * 2 - 1;
                 mouse2d.y = -(event.clientY / window.innerHeight) * 2 + 1;
                 mouse2d.z = 1;
             }
-            
+
             function animate(){
                 requestAnimationFrame(animate);
-                
+
                 sphere.position.z += speed;
                 if(sphere.position.z > range) sphere.position.z = 0;
-				
+
 				for (var i = 0; i < cubes.length; i++) {
 					cubes[i].materials[0].color = new THREE.Color(0x003300);
 				}
-				
+
 				var ray = new THREE.Ray( sphere.position, new THREE.Vector3(0,0,1) );
-				
+
 				var c = THREE.Collisions.rayCastNearest(ray);
 				if (c && c.distance == -1) {
 					info.innerHTML = "Colliding!";
-					c.mesh.materials[0].color = new THREE.Color(0xff0000); 
+					c.mesh.materials[0].color = new THREE.Color(0xff0000);
 				} else if(c && c.distance >= 0) {
 					info.innerHTML = "Approaching @ " + c.distance;
 				} else {
 					info.innerHTML = "No collider in sight.";
 				}
-				
+
 				camera.position.x = Math.cos(mouse2d.x * Math.PI) * 300;
 				camera.position.z = 200 + Math.sin(mouse2d.x * Math.PI) * 300;
-                
+
                 renderer.render(scene, camera);
             }
-            
+
             function vts(v){
-                if (!v) 
+                if (!v)
                     return "undefined<br>";
-                else 
+                else
                     return v.x + " , " + v.y + " , " + v.z + "<br>";
             }
-            
+
         </script>
     </head>
     <body onload="init();">

+ 9 - 9
examples/webgl_geometries.html

@@ -54,30 +54,30 @@
 				scene.addLight( light );
 
 				material = [
-					new THREE.MeshLambertMaterial( { map: ImageUtils.loadTexture( 'textures/UV.jpg' ) } ),
+					new THREE.MeshLambertMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/UV.jpg' ) } ),
 					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, opacity: 0.1 } )
 				];
 
-				object = new THREE.Mesh( new Cube( 100, 100, 100, 4, 4, 4 ), material );
+				object = new THREE.Mesh( new THREE.Cube( 100, 100, 100, 4, 4, 4 ), material );
 				object.position.x = - 200;
 				object.position.z = 200;
 				scene.addObject( object );
 
-				object = new THREE.Mesh( new Cylinder( 50, 25, 75, 100 ), material );
+				object = new THREE.Mesh( new THREE.Cylinder( 50, 25, 75, 100 ), material );
 				object.position.z = 200;
 				scene.addObject( object );
 
-				object = new THREE.Mesh( new Icosahedron( 2 ), material );
+				object = new THREE.Mesh( new THREE.Icosahedron( 2 ), material );
 				object.position.x = 200;
 				object.position.z = 200;
 				object.scale.x = object.scale.y = object.scale.z = 75;
 				scene.addObject( object );
 
-				object = new THREE.Mesh( new Plane( 100, 100, 4, 4 ), material );
+				object = new THREE.Mesh( new THREE.Plane( 100, 100, 4, 4 ), material );
 				object.position.x = - 200;
 				scene.addObject( object );
 
-				object = new THREE.Mesh( new Sphere( 75, 20, 10 ), material );
+				object = new THREE.Mesh( new THREE.Sphere( 75, 20, 10 ), material );
 				scene.addObject( object );
 
 				var points = [];
@@ -88,16 +88,16 @@
 
 				}
 
-				object = new THREE.Mesh( new Lathe( points, 20 ), material );
+				object = new THREE.Mesh( new THREE.Lathe( points, 20 ), material );
 				object.position.x = 200;
 				scene.addObject( object );
 
-				object = new THREE.Mesh( new Torus( 50, 20, 20, 20 ), material );
+				object = new THREE.Mesh( new THREE.Torus( 50, 20, 20, 20 ), material );
 				object.position.x = - 200;
 				object.position.z = - 200;
 				scene.addObject( object );
 
-				object = new THREE.Mesh( new TorusKnot( 50, 10, 50, 20 ), material );
+				object = new THREE.Mesh( new THREE.TorusKnot( 50, 10, 50, 20 ), material );
 				object.position.z = - 200;
 				scene.addObject( object );
 

+ 3 - 3
examples/webgl_geometry_blenderexport_colors.html

@@ -34,7 +34,7 @@
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - io blender - vertex colors</div>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -97,7 +97,7 @@
 
 				var material = [ new THREE.MeshFaceMaterial(), new THREE.MeshLambertMaterial( { color: 0xffffff, opacity:0.9, shading:THREE.FlatShading, wireframe: true, wireframeLinewidth: 2 } ) ];
 
-				mesh = SceneUtils.addMesh( scene, geometry, 250, 400, 0, 0, 0, 0, 0, material );
+				mesh = THREE.SceneUtils.addMesh( scene, geometry, 250, 400, 0, 0, 0, 0, 0, material );
 
 			}
 
@@ -107,7 +107,7 @@
 
 				var material = new THREE.MeshFaceMaterial();
 
-				mesh2 = SceneUtils.addMesh( scene, geometry, 250, -400, 0, 0, 0, 0, 0, material );
+				mesh2 = THREE.SceneUtils.addMesh( scene, geometry, 250, -400, 0, 0, 0, 0, 0, material );
 
 			}
 

+ 16 - 16
examples/webgl_geometry_colors.html

@@ -71,8 +71,8 @@
 				light.position.normalize();
 				scene.addLight( light );
 
-				var shadowMaterial = new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/shadow.png' ) } );
-				var shadowGeo = new Plane( 300, 300, 1, 1 );
+				var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } );
+				var shadowGeo = new THREE.Plane( 300, 300, 1, 1 );
 
 				mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
 				mesh.position.y = - 250;
@@ -92,44 +92,44 @@
 				scene.addObject( mesh );
 
 				var faceIndices = [ 'a', 'b', 'c', 'd' ];
-				
+
 				var color, f, f2, f3, p, n, vertexIndex,
 
-					geometry  = new Icosahedron( 1 ),
-					geometry2 = new Icosahedron( 1 ),
-					geometry3 = new Icosahedron( 1 );
+					geometry  = new THREE.Icosahedron( 1 ),
+					geometry2 = new THREE.Icosahedron( 1 ),
+					geometry3 = new THREE.Icosahedron( 1 );
+
+				for ( var i = 0; i < geometry.faces.length; i++ ) {
 
-				for( var i = 0; i < geometry.faces.length; i++ ) {
-				
 					f  = geometry.faces[ i ];
 					f2 = geometry2.faces[ i ];
 					f3 = geometry3.faces[ i ];
-					
+
 					n = ( f instanceof THREE.Face3 ) ? 3 : 4;
-					
+
 					for( var j = 0; j < n; j++ ) {
-					
+
 						vertexIndex = f[ faceIndices[ j ] ];
-						
+
 						p = geometry.vertices[ vertexIndex ].position;
 
 						color = new THREE.Color( 0xffffff );
 						color.setHSV( ( p.y + 1 ) / 2, 1.0, 1.0 );
-						
+
 						f.vertexColors[ j ] = color;
 
 						color = new THREE.Color( 0xffffff );
 						color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
-						
+
 						f2.vertexColors[ j ] = color;
 
 						color = new THREE.Color( 0xffffff );
 						color.setHSV( 0.125 * vertexIndex/geometry.vertices.length, 1.0, 1.0 );
-						
+
 						f3.vertexColors[ j ] = color;
 
 					}
-					
+
 				}
 
 

+ 8 - 4
examples/webgl_geometry_dynamic.html

@@ -70,8 +70,12 @@
 
 				container = document.getElementById( 'container' );
 
-				camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
-												  movementSpeed: 10, lookSpeed: 0.004, noFly: false, lookVertical: true } );
+				camera = new THREE.QuakeCamera( {
+
+					fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
+					movementSpeed: 10, lookSpeed: 0.004, noFly: false, lookVertical: true
+
+				} );
 
 				camera.target.position.z = - 100;
 
@@ -85,7 +89,7 @@
 				camera.position.y = 200;
 				camera.target.position.y = camera.position.y;
 
-				geometry = new Plane( 20000, 20000, worldWidth - 1, worldDepth - 1 );
+				geometry = new THREE.Plane( 20000, 20000, worldWidth - 1, worldDepth - 1 );
 
 				var i, j, il, jl;
 
@@ -113,7 +117,7 @@
 				geometry.computeFaceNormals();
 				geometry.computeVertexNormals();
 
-				var texture = ImageUtils.loadTexture( "textures/water.jpg" );
+				var texture = THREE.ImageUtils.loadTexture( "textures/water.jpg" );
 				texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
 				material = new THREE.MeshBasicMaterial( { color:0x0044ff, opacity:1, map: texture } );
 

+ 2 - 2
examples/webgl_geometry_hierarchy.html

@@ -16,7 +16,7 @@
 	<body>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
@@ -49,7 +49,7 @@
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );
 
-				var geometry = new Cube( 100, 100, 100 );
+				var geometry = new THREE.Cube( 100, 100, 100 );
 				var material = new THREE.MeshNormalMaterial();
 
 				group = new THREE.Object3D();

+ 2 - 2
examples/webgl_geometry_hierarchy2.html

@@ -16,7 +16,7 @@
 	<body>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
@@ -49,7 +49,7 @@
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );
 
-				var geometry = new Cube( 100, 100, 100 );
+				var geometry = new THREE.Cube( 100, 100, 100 );
 				var material = new THREE.MeshNormalMaterial();
 
 				var mesh = new THREE.Mesh( geometry, material );

+ 5 - 9
examples/webgl_geometry_large_mesh.html

@@ -45,7 +45,7 @@
 		<pre id="log"></pre>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
@@ -55,12 +55,9 @@
 			var SCREEN_HEIGHT = window.innerHeight;
 			var FLOOR = -250;
 
-			var container;
-			var stats;
+			var container, stats;
 
-			var camera;
-			var scene;
-			var canvasRenderer, webglRenderer;
+			var camera, scene, canvasRenderer, webglRenderer;
 
 			var loader;
 
@@ -68,8 +65,7 @@
 
 			var directionalLight, pointLight;
 
-			var mouseX = 0;
-			var mouseY = 0;
+			var mouseX = 0, mouseY = 0;
 
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
@@ -135,7 +131,7 @@
 				scene.addLight( pointLight );
 
 				// light representation
-				sphere = new Sphere( 100, 16, 8, 1 );
+				sphere = new THREE.Sphere( 100, 16, 8, 1 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;

+ 16 - 12
examples/webgl_geometry_minecraft.html

@@ -75,25 +75,29 @@
 
 				container = document.getElementById( 'container' );
 
-				camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
-												   movementSpeed: 15, lookSpeed: 0.005, noFly: false, lookVertical: true } );
+				camera = new THREE.QuakeCamera( {
+
+					fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
+					movementSpeed: 15, lookSpeed: 0.005, noFly: false, lookVertical: true
+
+				} );
 
 				camera.target.position.z = - 100;
 
 				scene = new THREE.Scene();
 
 				var grass_dirt = loadTexture( 'textures/minecraft/grass_dirt.png' ),
-					grass 	   = loadTexture( 'textures/minecraft/grass.png' ),
-					dirt	   = loadTexture( 'textures/minecraft/dirt.png' );
+				grass = loadTexture( 'textures/minecraft/grass.png' ),
+				dirt = loadTexture( 'textures/minecraft/dirt.png' );
 
 				var materials = [
 
 					grass_dirt, // right
 					grass_dirt, // left
-					grass, 		// top
-					dirt, 		// bottom
+					grass, // top
+					dirt, // bottom
 					grass_dirt, // back
-					grass_dirt 	// front
+					grass_dirt  // front
 
 				];
 
@@ -101,11 +105,11 @@
 
 				for ( var i = 0; i < 16; i++ ) {
 
-					px = (i & 8) == 8;
-					nx = (i & 4) == 4;
-					pz = (i & 2) == 2;
-					nz = (i & 1) == 1;
-					cubes[ i ] = new Cube( 100, 100, 100, 1, 1, 1, materials, false, { px: px, nx: nx, py: true, ny: false, pz: pz, nz: nz } );
+					px = ( i & 8 ) == 8;
+					nx = ( i & 4 ) == 4;
+					pz = ( i & 2 ) == 2;
+					nz = ( i & 1 ) == 1;
+					cubes[ i ] = new THREE.Cube( 100, 100, 100, 1, 1, 1, materials, false, { px: px, nx: nx, py: true, ny: false, pz: pz, nz: nz } );
 
 				}
 

+ 10 - 8
examples/webgl_geometry_minecraft_ao.html

@@ -70,9 +70,7 @@
 
 			var camera, scene, renderer;
 
-			var mesh;
-			
-			var mat;
+			var mesh, mat;
 
 			var worldWidth = 128, worldDepth = 128,
 			worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2,
@@ -85,9 +83,13 @@
 
 				container = document.getElementById( 'container' );
 
-				camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
-												  constrainVertical: true, verticalMin: 1.1, verticalMax: 2.2,
-												  movementSpeed: 15, lookSpeed: 0.005, noFly: false, lookVertical: true } );
+				camera = new THREE.QuakeCamera( {
+
+					fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
+					constrainVertical: true, verticalMin: 1.1, verticalMax: 2.2,
+					movementSpeed: 15, lookSpeed: 0.005, noFly: false, lookVertical: true
+
+				} );
 
 				camera.target.position.z = - 100;
 
@@ -369,11 +371,11 @@
 
 						sides = { px: px, nx: nx, py: true, ny: false, pz: pz, nz: nz };
 
-						cube = new Cube( 100, 100, 100, 1, 1, 1, materials, false, sides );
+						cube = new THREE.Cube( 100, 100, 100, 1, 1, 1, materials, false, sides );
 
 						// set UV tiles
 
-						for ( i = 0; i < cube.faceVertexUvs[ 0 ].length; i++ ) {
+						for ( i = 0; i < cube.faceVertexUvs[ 0 ].length; i ++ ) {
 
 							uv = cube.faceVertexUvs[ 0 ][ i ];
 

+ 8 - 4
examples/webgl_geometry_terrain.html

@@ -67,8 +67,12 @@
 
 				container = document.getElementById( 'container' );
 
-				camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
-												  movementSpeed: 15, lookSpeed: 0.004, noFly: false, lookVertical: true } );
+				camera = new THREE.QuakeCamera( {
+
+					fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
+					movementSpeed: 15, lookSpeed: 0.004, noFly: false, lookVertical: true
+
+				} );
 
 				camera.target.position.z = - 100;
 
@@ -79,7 +83,7 @@
 				camera.position.y = data[ worldHalfWidth + worldHalfDepth * worldWidth ] + 500;
 				camera.target.position.y = camera.position.y;
 
-				var geometry = new Plane( 7500, 7500, worldWidth - 1, worldDepth - 1 );
+				var geometry = new THREE.Plane( 7500, 7500, worldWidth - 1, worldDepth - 1 );
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 
@@ -89,7 +93,7 @@
 
 				texture = new THREE.Texture( generateTexture( data, worldWidth, worldDepth ), new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping );
 				texture.needsUpdate = true;
-				
+
 				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) );
 				mesh.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject( mesh );

+ 8 - 4
examples/webgl_geometry_terrain_fog.html

@@ -66,8 +66,12 @@
 
 				container = document.getElementById( 'container' );
 
-				camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
-												  movementSpeed: 5, lookSpeed: 0.004, noFly: false, lookVertical: true } );
+				camera = new THREE.QuakeCamera( {
+
+					fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
+					movementSpeed: 5, lookSpeed: 0.004, noFly: false, lookVertical: true
+
+				} );
 
 				camera.target.position.z = - 100;
 
@@ -79,7 +83,7 @@
 				camera.position.y = data[ worldHalfWidth + worldHalfDepth * worldWidth ] * 10 + 500;
 				camera.target.position.y = camera.position.y;
 
-				var geometry = new Plane( 7500, 7500, worldWidth - 1, worldDepth - 1 );
+				var geometry = new THREE.Plane( 7500, 7500, worldWidth - 1, worldDepth - 1 );
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 
@@ -89,7 +93,7 @@
 
 				texture = new THREE.Texture( generateTexture( data, worldWidth, worldDepth ), new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping );
 				texture.needsUpdate = true;
-				
+
 				mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) );
 				mesh.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject( mesh );

+ 2 - 2
examples/webgl_hdr.html

@@ -127,7 +127,7 @@
 				directionalLight.position.normalize();
 				scene.addLight( directionalLight );
 
-				var texture = ImageUtils.loadTexture( "textures/memorial.png" );
+				var texture = THREE.ImageUtils.loadTexture( "textures/memorial.png" );
 				texture.minFilter = THREE.LinearFilter;
 				texture.magFilter = THREE.NearestFilter;
 
@@ -143,7 +143,7 @@
 
 				} );
 
-				var plane = new Plane( 512, 768 );
+				var plane = new THREE.Plane( 512, 768 );
 
 				quad = new THREE.Mesh( plane, materialHDR );
 				quad.position.z = -100;

+ 5 - 5
examples/webgl_interactive_voxelpainter.html

@@ -61,7 +61,7 @@
 
 				// roll-over helpers
 
-				rollOverGeo = new Cube( 50, 50, 50 );
+				rollOverGeo = new THREE.Cube( 50, 50, 50 );
 				rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } );
 				rollOverMesh = new THREE.Mesh( rollOverGeo, rollOverMaterial );
 				scene.addObject( rollOverMesh );
@@ -69,8 +69,8 @@
 
 				// cubes
 
-				cubeGeo = new Cube( 50, 50, 50 );
-				cubeMaterial = new THREE.MeshLambertMaterial( { color: 0x00ff80, shading: THREE.FlatShading, map: ImageUtils.loadTexture( "textures/square-outline-textured.png" ) } );
+				cubeGeo = new THREE.Cube( 50, 50, 50 );
+				cubeMaterial = new THREE.MeshLambertMaterial( { color: 0x00ff80, shading: THREE.FlatShading, map: THREE.ImageUtils.loadTexture( "textures/square-outline-textured.png" ) } );
 				cubeMaterial.color.setHSV( 0.1, 0.7, 1.0 );
 				// picking
 
@@ -78,7 +78,7 @@
 
 				// grid
 
-				plane = new THREE.Mesh( new Plane( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x555555, wireframe: true } ) );
+				plane = new THREE.Mesh( new THREE.Plane( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x555555, wireframe: true } ) );
 				plane.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject( plane );
 
@@ -107,7 +107,7 @@
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
-				container.appendChild(renderer.domElement);
+				container.appendChild( renderer.domElement );
 
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';

+ 1 - 1
examples/webgl_lights_pointlights.html

@@ -106,7 +106,7 @@
 				light3 = new THREE.PointLight( 0x80ff80, 2, 50 );
 				scene.addLight( light3 );
 
-				var sphere = new Sphere( 0.5, 16, 8 );
+				var sphere = new THREE.Sphere( 0.5, 16, 8 );
 
 				var l1 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0040 } ) );
 				l1.position = light1.position;

+ 9 - 9
examples/webgl_lines_colors.html

@@ -191,7 +191,7 @@
 			}
 
 			//
-			
+
 			function initPostprocessing() {
 
 				postprocessing.scene = new THREE.Scene();
@@ -205,8 +205,8 @@
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
@@ -221,15 +221,15 @@
 
 				} );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
 				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
 
 				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -239,11 +239,11 @@
 
 				} );
 
-				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
-				postprocessing.quad.position.z = -500;
+				postprocessing.quad = new THREE.Mesh( new THREE.Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad.position.z = - 500;
 				postprocessing.scene.addObject( postprocessing.quad );
 
-			}			
+			}
 
 			function onDocumentMouseMove(event) {
 

+ 6 - 6
examples/webgl_lines_splines.html

@@ -158,8 +158,8 @@
 				rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
@@ -173,15 +173,15 @@
 
 				} );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				blurx = new THREE.Vector2( 0.001953125, 0.0 ),
 				blury = new THREE.Vector2( 0.0, 0.001953125 );
 
 				convolution_uniforms["tDiffuse"].texture = rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -191,7 +191,7 @@
 
 				} );
 
-				var plane = new Plane( window.innerWidth, window.innerHeight );
+				var plane = new THREE.Plane( window.innerWidth, window.innerHeight );
 
 				quadScreen = new THREE.Mesh( plane, materialConvolution );
 				quadScreen.position.z = -100;

+ 13 - 9
examples/webgl_lod.html

@@ -82,16 +82,20 @@
 				scene.addLight( light );
 
 				var material = [
-							new THREE.MeshLambertMaterial( { color: 0xffffff } ),
-							new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, wireframe: true } )
-						];
+
+					new THREE.MeshLambertMaterial( { color: 0xffffff } ),
+					new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, wireframe: true } )
+
+				];
 
 				var geometry = [
-							[ new Sphere( 100, 64, 32 ), 300 ],
-							[ new Sphere( 100, 32, 16 ), 1000 ],
-							[ new Sphere( 100, 16, 8 ), 2000 ],
-							[ new Sphere( 100, 8, 4 ), 10000 ]
-						  ];
+
+					[ new THREE.Sphere( 100, 64, 32 ), 300 ],
+					[ new THREE.Sphere( 100, 32, 16 ), 1000 ],
+					[ new THREE.Sphere( 100, 16, 8 ), 2000 ],
+					[ new THREE.Sphere( 100, 8, 4 ), 10000 ]
+
+				];
 
 				var i, j, mesh, lod;
 
@@ -117,7 +121,7 @@
 
 
 
-				renderer = new THREE.WebGLRenderer( { clearColor:0x000000, clearAlpha: 1 } );
+				renderer = new THREE.WebGLRenderer( { antialias: true, clearColor:0x000000, clearAlpha: 1 } );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.sortObjects = false;
 				container.appendChild( renderer.domElement );

+ 4 - 4
examples/webgl_materials.html

@@ -88,9 +88,9 @@
 
 				// Spheres geometry
 
-				var geometry_smooth = new Sphere( 70, 32, 16 );
-				var geometry_flat = new Sphere( 70, 32, 16 );
-				var geometry_pieces = new Sphere( 70, 32, 16 ); // Extra geometry to be broken down for MeshFaceMaterial
+				var geometry_smooth = new THREE.Sphere( 70, 32, 16 );
+				var geometry_flat = new THREE.Sphere( 70, 32, 16 );
+				var geometry_pieces = new THREE.Sphere( 70, 32, 16 ); // Extra geometry to be broken down for MeshFaceMaterial
 
 				for ( var i = 0, l = geometry_pieces.faces.length; i < l; i ++ ) {
 
@@ -127,7 +127,7 @@
 
 				}
 
-				particleLight = new THREE.Mesh( new Sphere( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
+				particleLight = new THREE.Mesh( new THREE.Sphere( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
 				scene.addObject( particleLight );
 
 				// Lights

+ 3 - 3
examples/webgl_materials_cars.html

@@ -196,7 +196,7 @@
 				pointLight.position.z = 10000;
 				scene.addLight( pointLight );
 
-				SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
 
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
@@ -221,7 +221,7 @@
 							 r + "posy.jpg", r + "negy.jpg",
 							 r + "posz.jpg", r + "negz.jpg" ];
 
-				var textureCube = ImageUtils.loadTextureCube( urls );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
 
 				// common materials
 
@@ -552,7 +552,7 @@
 
 				}
 
-				CARS[ car ].object = SceneUtils.addMesh( scene, geometry, s, 0, 0, 0, r[0], r[1], r[2], m );
+				CARS[ car ].object = THREE.SceneUtils.addMesh( scene, geometry, s, 0, 0, 0, r[0], r[1], r[2], m );
 
 				CARS[ car ].buttons = createButtons( materials.body, car );
 				attachButtonMaterials( materials.body, geometry, bm, car );

+ 19 - 19
examples/webgl_materials_cars_camaro.html

@@ -92,7 +92,7 @@
 				scene.addLight( pointLight );
 
 
-				sphere = new Sphere( 100, 16, 8, 1 );
+				sphere = new THREE.Sphere( 100, 16, 8, 1 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;
@@ -119,17 +119,17 @@
 							 r + "py.jpg", r + "ny.jpg",
 							 r + "pz.jpg", r + "nz.jpg" ];
 
-				var textureCube = ImageUtils.loadTextureCube( urls );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
 
 				var camaroMaterials = {
 
-					body: 		[],
-					chrome: 	new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
+					body: [],
+					chrome: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
 					darkchrome: new THREE.MeshLambertMaterial( { color: 0x444444, envMap: textureCube } ),
-					glass:		new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25, transparent: true } ),
-					tire:       new THREE.MeshLambertMaterial( { color: 0x050505 } ),
-					interior:   new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
-					black:      new THREE.MeshLambertMaterial( { color: 0x000000 } )
+					glass: new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25, transparent: true } ),
+					tire: new THREE.MeshLambertMaterial( { color: 0x050505 } ),
+					interior: new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
+					black: new THREE.MeshLambertMaterial( { color: 0x000000 } )
 
 				}
 
@@ -177,17 +177,17 @@
 
 				var s = 75, m = new THREE.MeshFaceMaterial();
 
-				geometry.materials[ 0 ][ 0 ] = materials.body[ 0 ][ 1 ]; 	// car body
-				geometry.materials[ 1 ][ 0 ] = materials.chrome; 			// wheels chrome
-				geometry.materials[ 2 ][ 0 ] = materials.chrome; 			// grille chrome
-				geometry.materials[ 3 ][ 0 ] = materials.darkchrome; 		// door lines
-				geometry.materials[ 4 ][ 0 ] = materials.glass; 			// windshield
-				geometry.materials[ 5 ][ 0 ] = materials.interior;          // interior
-				geometry.materials[ 6 ][ 0 ] = materials.tire;              // tire
-				geometry.materials[ 7 ][ 0 ] = materials.black;             // tireling
-				geometry.materials[ 8 ][ 0 ] = materials.black;             // behind grille
-
-				SceneUtils.addMesh( scene, geometry, s, 0, 0, 0, 0.0, 1.0, 0.0, m );
+				geometry.materials[ 0 ][ 0 ] = materials.body[ 0 ][ 1 ]; // car body
+				geometry.materials[ 1 ][ 0 ] = materials.chrome; // wheels chrome
+				geometry.materials[ 2 ][ 0 ] = materials.chrome; // grille chrome
+				geometry.materials[ 3 ][ 0 ] = materials.darkchrome; // door lines
+				geometry.materials[ 4 ][ 0 ] = materials.glass; // windshield
+				geometry.materials[ 5 ][ 0 ] = materials.interior; // interior
+				geometry.materials[ 6 ][ 0 ] = materials.tire; // tire
+				geometry.materials[ 7 ][ 0 ] = materials.black; // tireling
+				geometry.materials[ 8 ][ 0 ] = materials.black; // behind grille
+
+				THREE.SceneUtils.addMesh( scene, geometry, s, 0, 0, 0, 0.0, 1.0, 0.0, m );
 
 				createButtons( materials.body, geometry );
 

+ 9 - 9
examples/webgl_materials_cubemap.html

@@ -70,8 +70,8 @@
 
 			function init() {
 
-				container = document.createElement('div');
-				document.body.appendChild(container);
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
 
 				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 5000 );
 				camera.position.z = 2000;
@@ -90,7 +90,7 @@
 				scene.addLight( pointLight );
 
 				// light representation
-				sphere = new Sphere( 100, 16, 8 );
+				sphere = new THREE.Sphere( 100, 16, 8 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) );
 				lightMesh.position = pointLight.position;
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
@@ -104,15 +104,15 @@
 						path + 'pz' + format, path + 'nz' + format
 					];
 
-				var reflectionCube = ImageUtils.loadTextureCube( urls );
+				var reflectionCube = THREE.ImageUtils.loadTextureCube( urls );
 				var refractionCube = new THREE.Texture( reflectionCube.image, new THREE.CubeRefractionMapping() );
-				
+
 				//var cubeMaterial3 = new THREE.MeshPhongMaterial( { color: 0x000000, specular:0xaa0000, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.25 } );
 				var cubeMaterial3 = new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.3 } );
 				var cubeMaterial2 = new THREE.MeshLambertMaterial( { color: 0xffee00, envMap: refractionCube, refractionRatio: 0.95 } );
 				var cubeMaterial1 = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: reflectionCube } )
 
-				SceneUtils.addPanoramaCubeWebGL( sceneCube, 10, reflectionCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( sceneCube, 10, reflectionCube );
 
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
@@ -137,9 +137,9 @@
 
 				var s = 15;
 
-				SceneUtils.addMesh( scene, geometry, s,      0, 0, -100, 0,0,0, m1 );
-				SceneUtils.addMesh( scene, geometry, s,   -900, 0, -100, 0,0,0, m2 );
-				SceneUtils.addMesh( scene, geometry, s,    900, 0, -100, 0,0,0, m3 );
+				THREE.SceneUtils.addMesh( scene, geometry, s,      0, 0, -100, 0,0,0, m1 );
+				THREE.SceneUtils.addMesh( scene, geometry, s,   -900, 0, -100, 0,0,0, m2 );
+				THREE.SceneUtils.addMesh( scene, geometry, s,    900, 0, -100, 0,0,0, m3 );
 
 				loader.statusDomElement.style.display = "none";
 

+ 5 - 5
examples/webgl_materials_cubemap_balls_reflection.html

@@ -77,7 +77,7 @@
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();
 
-				var geometry = new Sphere( 100, 32, 16 );
+				var geometry = new THREE.Sphere( 100, 32, 16 );
 
 				var path = "textures/cube/pisa/";
 				var format = '.png';
@@ -87,7 +87,7 @@
 					path + 'pz' + format, path + 'nz' + format
 				];
 
-				var textureCube = ImageUtils.loadTextureCube( urls );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
 				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } );
 
 				for ( var i = 0; i < 500; i ++ ) {
@@ -96,16 +96,16 @@
 					mesh.position.x = Math.random() * 10000 - 5000;
 					mesh.position.y = Math.random() * 10000 - 5000;
 					mesh.position.z = Math.random() * 10000 - 5000;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 2 + 1;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1;
 					scene.addObject( mesh );
 
 					spheres.push( mesh );
 
 				}
 
-				SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
 
-				webglRenderer = new THREE.WebGLRenderer( { antialias: false } );
+				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
 				webglRenderer.autoClear = false;
 				container.appendChild( webglRenderer.domElement );

+ 5 - 6
examples/webgl_materials_cubemap_balls_refraction.html

@@ -38,7 +38,6 @@
 
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
-		<script type="text/javascript" src="js/Stats.js"></script>
 
 		<script type="text/javascript">
 
@@ -77,7 +76,7 @@
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();
 
-				var geometry = new Sphere( 100, 32, 16 );
+				var geometry = new THREE.Sphere( 100, 32, 16 );
 
 				var path = "textures/cube/skybox/";
 				var format = '.jpg';
@@ -87,7 +86,7 @@
 					path + 'pz' + format, path + 'nz' + format
 				];
 
-				var textureCube = ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
 				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
 
 				for ( var i = 0; i < 500; i ++ ) {
@@ -96,16 +95,16 @@
 					mesh.position.x = Math.random() * 10000 - 5000;
 					mesh.position.y = Math.random() * 10000 - 5000;
 					mesh.position.z = Math.random() * 10000 - 5000;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 2 + 1;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1;
 					scene.addObject( mesh );
 
 					spheres.push( mesh );
 
 				}
 
-				SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
 
-				webglRenderer = new THREE.WebGLRenderer( { antialias: false } );
+				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
 				webglRenderer.autoClear = false;
 				container.appendChild( webglRenderer.domElement );

+ 3 - 3
examples/webgl_materials_cubemap_escher.html

@@ -79,15 +79,15 @@
 							 r + "py.jpg", r + "ny.jpg", 
 							 r + "pz.jpg", r + "nz.jpg" ];
 
-				var textureCube = ImageUtils.loadTextureCube( urls );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
 				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } )
-				var geometry = new Sphere( 100, 96, 64 );
+				var geometry = new THREE.Sphere( 100, 96, 64 );
 
 				var mesh = new THREE.Mesh( geometry, material );
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 16;
 				scene.addObject( mesh );
 
-				SceneUtils.addPanoramaCubeWebGL( scene, 6000, textureCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( scene, 6000, textureCube );
 
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );

+ 6 - 8
examples/webgl_materials_cubemap_refraction.html

@@ -88,7 +88,7 @@
 				scene.addLight( pointLight );
 
 				// light representation
-				sphere = new Sphere( 100, 16, 8 );
+				sphere = new THREE.Sphere( 100, 16, 8 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) );
 				lightMesh.position = pointLight.position;
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
@@ -102,15 +102,13 @@
 							 r + "py.jpg", r + "ny.jpg", 
 							 r + "pz.jpg", r + "nz.jpg" ];
 
-				var textureCube = ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
 
 				var cubeMaterial3 = new THREE.MeshBasicMaterial( { color: 0xccddff, envMap: textureCube, refractionRatio: 0.98, reflectivity:0.9 } );
 				var cubeMaterial2 = new THREE.MeshBasicMaterial( { color: 0xccfffd, envMap: textureCube, refractionRatio: 0.985 } );
 				var cubeMaterial1 = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.98 } )
 
-				//SceneUtils.addPanoramaCubePlanes( sceneCube, 100000, images );
-				//SceneUtils.addPanoramaCube( sceneCube, 100000, images );
-				SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
 
 				webglRenderer = new THREE.WebGLRenderer();
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );
@@ -136,9 +134,9 @@
 
 				var s = 1.5, z = -1000;
 
-				SceneUtils.addMesh( scene, geometry, s,      0, 0, z, 0,0,0, m1 );
-				SceneUtils.addMesh( scene, geometry, s,   -900, 0, z, 0,0,0, m2 );
-				SceneUtils.addMesh( scene, geometry, s,    900, 0, z, 0,0,0, m3 );
+				THREE.SceneUtils.addMesh( scene, geometry, s,      0, 0, z, 0,0,0, m1 );
+				THREE.SceneUtils.addMesh( scene, geometry, s,   -900, 0, z, 0,0,0, m2 );
+				THREE.SceneUtils.addMesh( scene, geometry, s,    900, 0, z, 0,0,0, m3 );
 
 				loader.statusDomElement.style.display = "none";
 

+ 2 - 2
examples/webgl_materials_grass.html

@@ -40,7 +40,7 @@
 
 				scene = new THREE.Scene();
 
-				var geometry = new Plane( 100, 100 );
+				var geometry = new THREE.Plane( 100, 100 );
 
 				var texture = generateTextureBase();
 				texture.needsUpdate = true;
@@ -55,7 +55,7 @@
 
 				}
 
-				renderer = new THREE.WebGLRenderer( { antialias: false } );
+				renderer = new THREE.WebGLRenderer();
 				renderer.sortObjects = false;
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				document.body.appendChild( renderer.domElement );

+ 11 - 11
examples/webgl_materials_normalmap.html

@@ -54,7 +54,7 @@
 		</div>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -116,7 +116,7 @@
 
 				// light representation
 
-				var sphere = new Sphere( 100, 16, 8 );
+				var sphere = new THREE.Sphere( 100, 16, 8 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) );
 				lightMesh.position = pointLight.position;
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
@@ -128,17 +128,17 @@
 
 				// normal map shader
 
-				var shader = ShaderUtils.lib[ "normal" ];
-				var uniforms = Uniforms.clone( shader.uniforms );
+				var shader = THREE.ShaderUtils.lib[ "normal" ];
+				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
 				uniforms[ "enableAO" ].value = true;
 				uniforms[ "enableDiffuse" ].value = false;
 
-				uniforms[ "tNormal" ].texture = ImageUtils.loadTexture( "textures/normal/ninja/normal.jpg" );
-				uniforms[ "tAO" ].texture = ImageUtils.loadTexture( "textures/normal/ninja/ao.jpg" );
+				uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "textures/normal/ninja/normal.jpg" );
+				uniforms[ "tAO" ].texture = THREE.ImageUtils.loadTexture( "textures/normal/ninja/ao.jpg" );
 
-				uniforms[ "tDisplacement" ].texture = ImageUtils.loadTexture( "textures/normal/ninja/displacement.jpg" );
-				uniforms[ "uDisplacementBias" ].value = -0.428408 * scale;
+				uniforms[ "tDisplacement" ].texture = THREE.ImageUtils.loadTexture( "textures/normal/ninja/displacement.jpg" );
+				uniforms[ "uDisplacementBias" ].value = - 0.428408 * scale;
 				uniforms[ "uDisplacementScale" ].value = 2.436143 * scale;
 
 				uniforms[ "uPointLightPos" ].value = pointLight.position;
@@ -188,9 +188,9 @@
 			function createScene( geometry, scale, material1, material2 ) {
 
 				geometry.computeTangents();
-				
-				mesh1 = SceneUtils.addMesh( scene, geometry, scale, -scale * 12, 0, 0, 0,0,0, material1 );
-				mesh2 = SceneUtils.addMesh( scene, geometry, scale,  scale * 12, 0, 0, 0,0,0, material2 );
+
+				mesh1 = THREE.SceneUtils.addMesh( scene, geometry, scale, -scale * 12, 0, 0, 0,0,0, material1 );
+				mesh2 = THREE.SceneUtils.addMesh( scene, geometry, scale,  scale * 12, 0, 0, 0,0,0, material2 );
 
 				loader.statusDomElement.style.display = "none";
 

+ 6 - 6
examples/webgl_materials_normalmap2.html

@@ -28,7 +28,7 @@
 
 			#oldie {
 				background:rgb(200,100,0) !important;
-				color:#fff;				
+				color:#fff;
 			}
 
 			#vt { display:none }
@@ -113,13 +113,13 @@
 
 				var ambient = 0x444444, diffuse = 0x888888, specular = 0x080810, shininess = 2;
 
-				var shader = ShaderUtils.lib[ "normal" ];
-				var uniforms = Uniforms.clone( shader.uniforms );
+				var shader = THREE.ShaderUtils.lib[ "normal" ];
+				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
  
-				uniforms[ "tNormal" ].texture = ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
+				uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
 				uniforms[ "uNormalScale" ].value = - 0.75;
 
-				uniforms[ "tDiffuse" ].texture = ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
+				uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
 
 				uniforms[ "enableAO" ].value = false;
 				uniforms[ "enableDiffuse" ].value = true;
@@ -168,7 +168,7 @@
 
 				geometry.computeTangents();
 
-				mesh1 = SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );
+				mesh1 = THREE.SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );
 
 				loader.statusDomElement.style.display = "none";
 

+ 9 - 5
examples/webgl_materials_shaders.html

@@ -125,18 +125,18 @@
 				scene.addLight( pointLight );
 
 				// light representation
-				sphere = new Sphere( 100, 16, 8 );
+				sphere = new THREE.Sphere( 100, 16, 8 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
 				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
 				lightMesh.position = pointLight.position;
 				lightMesh.overdraw = true;
 				lightMesh.updateMatrix();
-				scene.addObject(lightMesh);
+				scene.addObject( lightMesh );
 
 				// material samples
-				sphere = new Sphere( 100, 32, 32 );
+				sphere = new THREE.Sphere( 100, 32, 32 );
 
-				var y1 = 0, y2 = -200;
+				var y1 = 0, y2 = - 200;
 
 				addMesh( sphere, 1, -600, y1, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x050505, color: 0x000000, specular: 0x555555, shininess: 30 } ) );
 				addMesh( sphere, 1, -600, y2, 0, 0,0,0, new THREE.MeshLambertMaterial( { color: 0x050505 } ) );
@@ -160,6 +160,7 @@
 				addMesh( sphere, 1,  600, y2, 0, 0,0,0, new THREE.MeshLambertMaterial( { color: 0x5500ff } ) );
 
 				if ( render_gl ) {
+
 					try {
 						webglRenderer = new THREE.WebGLRenderer();
 						webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
@@ -169,12 +170,15 @@
 					}
 					catch (e) {
 					}
+
 				}
 
-				if( render_canvas ) {
+				if ( render_canvas ) {
+
 					canvasRenderer = new THREE.CanvasRenderer();
 					canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 					container.appendChild( canvasRenderer.domElement );
+
 				}
 
 

+ 6 - 7
examples/webgl_materials_shaders_fresnel.html

@@ -41,7 +41,6 @@
 
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
-		<script type="text/javascript" src="js/Stats.js"></script>
 
 		<script type="text/javascript">
 
@@ -80,7 +79,7 @@
 				scene = new THREE.Scene();
 				sceneCube = new THREE.Scene();
 
-				var geometry = new Sphere( 100, 32, 16 );
+				var geometry = new THREE.Sphere( 100, 32, 16 );
 
 				var path = "textures/cube/Park2/";
 				var format = '.jpg';
@@ -91,10 +90,10 @@
 					];
 
 
-				var textureCube = ImageUtils.loadTextureCube( urls );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
 
-				var shader = ShaderUtils.lib["fresnel"];
-				var uniforms = Uniforms.clone( shader.uniforms );
+				var shader = THREE.ShaderUtils.lib["fresnel"];
+				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
 				uniforms["tCube"].texture = textureCube;
 
@@ -107,7 +106,7 @@
 					mesh.position.x = Math.random() * 10000 - 5000;
 					mesh.position.y = Math.random() * 10000 - 5000;
 					mesh.position.z = Math.random() * 10000 - 5000;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 2 + 1;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1;
 					scene.addObject( mesh );
 
 					spheres.push( mesh );
@@ -116,7 +115,7 @@
 
 				scene.matrixAutoUpdate = false;
 
-				SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
+				THREE.SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
 
 				webglRenderer = new THREE.WebGLRenderer( { antialias: false } );
 				webglRenderer.setSize( window.innerWidth, window.innerHeight );

+ 39 - 40
examples/webgl_materials_texture_filters.html

@@ -21,16 +21,16 @@
 				padding: 5px;
 				z-index:100;
 			}
-			
+
 			.lbl { color:#fff; font-size:16px; font-weight:bold; position: absolute; bottom:0px; z-index:100; text-shadow:#000 1px 1px 1px; background-color:rgba(0,0,0,0.85); padding:1em }
 			#lbl_left { text-align:left; left:0px }
 			#lbl_right { text-align:left; right:0px }
-			
+
 			.g { color:#aaa }
 			.c { color:#fa0 }
-			
-			a { color:red }						
-			
+
+			a { color:red }
+
 		</style>
 	</head>
 
@@ -38,8 +38,8 @@
 		<div id="info">
 			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - texture filtering example
 			- painting by <a href="http://en.wikipedia.org/wiki/Basket_of_Fruit_%28Caravaggio%29">Caravaggio</a>
-		</div>		
-		
+		</div>
+
 		<div id="lbl_left" class="lbl">
 		Floor <span class="g">(128x128)</span><br/>
 		mag: <span class="c">Linear</span><br/>
@@ -69,7 +69,7 @@
 		<script type="text/javascript">
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
-			
+
 			var SCREEN_WIDTH = window.innerWidth;
 			var SCREEN_HEIGHT = window.innerHeight;
 
@@ -96,10 +96,10 @@
 
 				scene = new THREE.Scene();
 				scene2 = new THREE.Scene();
-				
+
 				scene.fog = new THREE.Fog( 0x000000, 1500, 4000 );
 				scene2.fog = scene.fog;
-				
+
 				// GROUND
 
 				var imageCanvas = document.createElement( "canvas" ),
@@ -112,7 +112,7 @@
 				context.fillStyle = "#fff";
 				context.fillRect( 0, 0, 64, 64);
 				context.fillRect( 64, 64, 64, 64 );
-				
+
 				var textureCanvas = new THREE.Texture( imageCanvas, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping );
 					materialCanvas = new THREE.MeshBasicMaterial( { map: textureCanvas } );
 
@@ -123,53 +123,52 @@
 
 				textureCanvas2.needsUpdate = true;
 
-				var i, j, uvs,
-					geometryRepeat = new Plane( 100, 100, 1, 1 );
-					
-				for( i = 0; i < geometryRepeat.faceVertexUvs[ 0 ].length; i++ ) {
-					
+				var i, j, uvs, geometryRepeat = new THREE.Plane( 100, 100, 1, 1 );
+
+				for ( i = 0; i < geometryRepeat.faceVertexUvs[ 0 ].length; i ++ ) {
+
 					uvs = geometryRepeat.faceVertexUvs[ 0 ][ i ];
-					
-					for ( j = 0; j < uvs.length; j++ ) {
-					
+
+					for ( j = 0; j < uvs.length; j ++ ) {
+
 						uvs[ j ].u *= 1000;
 						uvs[ j ].v *= 1000;
 
 					}
 
 				}
-				
-				
+
+
 				var meshCanvas = new THREE.Mesh( geometryRepeat, materialCanvas );
 				meshCanvas.rotation.x = Math.PI / 2;
 				meshCanvas.scale.x = meshCanvas.scale.y = meshCanvas.scale.z = 1000;
 				meshCanvas.doubleSided = true;
-				
+
 				var meshCanvas2 = new THREE.Mesh( geometryRepeat, materialCanvas2 );
 				meshCanvas2.rotation.x = Math.PI / 2;
 				meshCanvas2.scale.x = meshCanvas2.scale.y = meshCanvas2.scale.z = 1000;
 				meshCanvas2.doubleSided = true;
-				
+
 
 				// PAINTING
-				
+
 				var callbackPainting = function( image ) {
-				
+
 					texturePainting2.image = image;
 					texturePainting2.needsUpdate = true;
 
 					scene.addObject( meshCanvas );
 					scene2.addObject( meshCanvas2 );
 
-					var geometry = new Plane( 100, 100, 1, 1 ),
+					var geometry = new THREE.Plane( 100, 100, 1, 1 ),
 						mesh = new THREE.Mesh( geometry, materialPainting ),
 						mesh2 = new THREE.Mesh( geometry, materialPainting2 );
 
 					addPainting( scene, mesh );
 					addPainting( scene2, mesh2 );
-					
+
 					function addPainting( zscene, zmesh ) {
-						
+
 						zmesh.scale.x = image.width / 100;
 						zmesh.scale.y = image.height / 100;
 
@@ -180,7 +179,7 @@
 						meshFrame.position.z = -0.5;
 						meshFrame.scale.x = 1.1 * image.width / 100;
 						meshFrame.scale.y = 1.1 * image.height / 100;
-						
+
 						zscene.addObject( meshFrame );
 
 						var meshShadow = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.9 } )  );
@@ -192,20 +191,20 @@
 						zscene.addObject( meshShadow );
 
 						meshShadow.position.y = - 1.1 * image.height/2;
-						
+
 						var floorHeight = - 1.117 * image.height/2;
 						meshCanvas.position.y = meshCanvas2.position.y = floorHeight;
 
 					}
 
-					
+
 				};
-				
-				var texturePainting = ImageUtils.loadTexture( "textures/758px-Canestra_di_frutta_(Caravaggio).jpg", THREE.UVMapping, callbackPainting ),
+
+				var texturePainting = THREE.ImageUtils.loadTexture( "textures/758px-Canestra_di_frutta_(Caravaggio).jpg", THREE.UVMapping, callbackPainting ),
 					texturePainting2 = new THREE.Texture(),
 					materialPainting = new THREE.MeshBasicMaterial( { color:0xffffff, map: texturePainting } ),
 					materialPainting2 = new THREE.MeshBasicMaterial( { color:0xffccaa, map: texturePainting2 } );
-					
+
 				texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter;
 				texturePainting.minFilter = texturePainting.magFilter = THREE.LinearFilter;
 
@@ -214,16 +213,16 @@
 				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 				renderer.domElement.style.position = "relative";
 				container.appendChild( renderer.domElement );
-				
+
 				renderer.setClearColor( scene.fog.color, 1 );
 				renderer.autoClear = false;
-				
+
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
 				stats.domElement.style.top = '0px';
 				stats.domElement.style.zIndex = 100;
 				//container.appendChild( stats.domElement );
-				
+
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 
 			}
@@ -254,16 +253,16 @@
 				renderer.enableScissorTest( false );
 				renderer.clear();
 				renderer.enableScissorTest( true );
-				
+
 				//renderer.setViewport( 0, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT );
 				renderer.setScissor( 0, 0, SCREEN_WIDTH/2 - 2, SCREEN_HEIGHT );
 				renderer.render( scene, camera );
 
-				
+
 				//renderer.setViewport( SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT );
 				renderer.setScissor( SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2 - 2, SCREEN_HEIGHT  );
 				renderer.render( scene2, camera );
-				
+
 
 			}
 

+ 9 - 9
examples/webgl_materials_video.html

@@ -124,13 +124,13 @@
 
 				cube_count = 0;
 
-				for( i = 0; i < xgrid; i++)
-				for( j = 0; j < ygrid; j++) {
+				for ( i = 0; i < xgrid; i ++ )
+				for ( j = 0; j < ygrid; j ++ ) {
 
 					ox = i;
 					oy = j;
 
-					geometry = new Cube( xsize, ysize, xsize );
+					geometry = new THREE.Cube( xsize, ysize, xsize );
 					change_uvs( geometry, ux, uy, ox, oy );
 
 					materials[ cube_count ] = new THREE.MeshLambertMaterial( parameters );
@@ -208,8 +208,8 @@
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
@@ -224,15 +224,15 @@
 
 				} );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
 				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
 
 				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -242,7 +242,7 @@
 
 				} );
 
-				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad = new THREE.Mesh( new THREE.Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
 				postprocessing.quad.position.z = -500;
 				postprocessing.scene.addObject( postprocessing.quad );
 

+ 20 - 20
examples/webgl_morphtargets.html

@@ -26,7 +26,7 @@
 
 			#ctrl {
 				position: absolute;
-				top: 0px; 
+				top: 0px;
 				left: 0px;
 				width: 200px;
 				color: #ffffff;
@@ -59,7 +59,7 @@
 			<input type="range" value="0" min="0" max="100" onchange="mesh.morphTargetInfluences[ 6 ] = this.value/100;" />
 			<input type="range" value="0" min="0" max="100" onchange="mesh.morphTargetInfluences[ 7 ] = this.value/100;" />
 		</div>
-		
+
 
 		<script type="text/javascript" src="../build/Three.js"></script>
 
@@ -109,31 +109,31 @@
 				scene.addLight( light );
 
 
+				var geometry = new THREE.Cube( 100, 100, 100 );
 				var material = new THREE.MeshLambertMaterial( { color: 0xffffff, morphTargets: true } );
-				var geometry = new Cube( 100, 100, 100 );
 
 				// construct 8 blend shapes
-				
-				for( var i = 0; i < geometry.vertices.length; i++ ) {
-					
+
+				for ( var i = 0; i < geometry.vertices.length; i ++ ) {
+
 					var vertices = [];
-					
-					for( var v = 0; v < geometry.vertices.length; v++ ) {
-						
+
+					for ( var v = 0; v < geometry.vertices.length; v ++ ) {
+
 						vertices.push( new THREE.Vertex( geometry.vertices[ v ].position.clone() ) )
-						
-						if( v === i ) {
-							
-							vertices[ vertices.length -1 ].position.x *= 2;
-							vertices[ vertices.length -1 ].position.y *= 2;
-							vertices[ vertices.length -1 ].position.z *= 2;
-							
+
+						if ( v === i ) {
+
+							vertices[ vertices.length - 1 ].position.x *= 2;
+							vertices[ vertices.length - 1 ].position.y *= 2;
+							vertices[ vertices.length - 1 ].position.z *= 2;
+
 						}
-						
+
 					}
-					
+
 					geometry.morphTargets.push( { name: "target" + i, vertices: vertices } );
-					
+
 				}
 
 				mesh = new THREE.Mesh( geometry, material );
@@ -174,7 +174,7 @@
 				renderer.render( scene, camera );
 
 			}
-			
+
 			function log( text ) {
 
 				var e = document.getElementById("log");

+ 9 - 9
examples/webgl_objconvert_test.html

@@ -110,14 +110,14 @@
 
 				var xm = new THREE.MeshBasicMaterial( { map: new THREE.Texture( x, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping ) } );
 				xm.map.needsUpdate = true;
-				
-				geometry = new Plane( 100, 100, 15, 10 );
+
+				geometry = new THREE.Plane( 100, 100, 15, 10 );
 				for( var i = 0; i < geometry.faceVertexUvs[ 0 ].length; i++ ) {
-					
+
 					var uvs = geometry.faceVertexUvs[ 0 ][ i ];
-					
+
 					for ( j = 0, jl = uvs.length; j < jl; j++ ) {
-					
+
 						uvs[ j ].u *= 10;
 						uvs[ j ].v *= 10;
 
@@ -137,7 +137,7 @@
 				// SPHERES
 
 				var material_spheres = new THREE.MeshLambertMaterial( { color: 0xdddddd } ),
-					sphere = new Sphere( 100, 16, 8 );
+					sphere = new THREE.Sphere( 100, 16, 8 );
 				for (var i=0; i<10; i++) {
 					mesh = new THREE.Mesh( sphere, material_spheres );
 					mesh.position.x = 500 * (Math.random() - 0.5);
@@ -222,10 +222,10 @@
 
 			function createMaterialsPalette( materials, size, bottom ) {
 
-				for ( var i = 0; i < materials.length; ++i ) {
+				for ( var i = 0; i < materials.length; i ++ ) {
 
 					// material
-					mesh = new THREE.Mesh( new Plane( size, size ), materials[i] );
+					mesh = new THREE.Mesh( new THREE.Plane( size, size ), materials[i] );
 					mesh.position.x = i * (size + 5) - ( ( materials.length - 1 )* ( size + 5 )/2);
 					mesh.position.y = FLOOR + size/2 + bottom;
 					mesh.position.z = -100;
@@ -247,7 +247,7 @@
 					var xm = new THREE.MeshBasicMaterial( { map: new THREE.Texture( x ) } );
 					xm.map.needsUpdate = true;
 
-					mesh = new THREE.Mesh( new Plane( size, size ), xm );
+					mesh = new THREE.Mesh( new THREE.Plane( size, size ), xm );
 					mesh.position.x = i * (size + 5) - ( ( materials.length - 1 )* ( size + 5 )/2);
 					mesh.position.y = FLOOR + size/2 + bottom;
 					mesh.position.z = -99;

+ 1 - 1
examples/webgl_panorama_equirectangular.html

@@ -59,7 +59,7 @@
 
 				scene = new THREE.Scene();
 
-				mesh = new THREE.Mesh( new Sphere( 500, 60, 40 ), new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg' ) } ) );
+				mesh = new THREE.Mesh( new THREE.Sphere( 500, 60, 40 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg' ) } ) );
 				mesh.scale.x = -1;
 				scene.addObject( mesh );
 

+ 2 - 2
examples/webgl_particles_billboards.html

@@ -68,7 +68,7 @@
 
 				geometry = new THREE.Geometry();
 
-				sprite = ImageUtils.loadTexture( "textures/sprites/circle.png" );
+				sprite = THREE.ImageUtils.loadTexture( "textures/sprites/circle.png" );
 
 				for ( i = 0; i < 10000; i++ ) {
 
@@ -95,7 +95,7 @@
 				light.position.z = 1;
 				scene.addLight( light );
 
-				renderer = new THREE.WebGLRenderer( { antialias: false, clearAlpha: 1 });
+				renderer = new THREE.WebGLRenderer( { clearAlpha: 1 });
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
 

+ 2 - 2
examples/webgl_particles_billboards_colors.html

@@ -68,7 +68,7 @@
 
 				geometry = new THREE.Geometry();
 
-				sprite = ImageUtils.loadTexture( "textures/sprites/ball.png" );
+				sprite = THREE.ImageUtils.loadTexture( "textures/sprites/ball.png" );
 
 				for ( i = 0; i < 5000; i++ ) {
 
@@ -99,7 +99,7 @@
 				light.position.z = 1;
 				scene.addLight( light );
 
-				renderer = new THREE.WebGLRenderer( { antialias: false, clearAlpha: 1 });
+				renderer = new THREE.WebGLRenderer( { clearAlpha: 1 });
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
 

+ 7 - 7
examples/webgl_particles_sprites.html

@@ -69,13 +69,13 @@
 
 				geometry = new THREE.Geometry();
 
-				sprite1 = ImageUtils.loadTexture( "textures/sprites/snowflake1.png" );
-				sprite2 = ImageUtils.loadTexture( "textures/sprites/snowflake2.png" );
-				sprite3 = ImageUtils.loadTexture( "textures/sprites/snowflake3.png" );
-				sprite4 = ImageUtils.loadTexture( "textures/sprites/snowflake4.png" );
-				sprite5 = ImageUtils.loadTexture( "textures/sprites/snowflake5.png" );
+				sprite1 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake1.png" );
+				sprite2 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake2.png" );
+				sprite3 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake3.png" );
+				sprite4 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake4.png" );
+				sprite5 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake5.png" );
 
-				for ( i = 0; i < 2000; i++ ) {
+				for ( i = 0; i < 2000; i ++ ) {
 
 					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
 					geometry.vertices.push( new THREE.Vertex( vector ) );
@@ -102,7 +102,7 @@
 
 				}
 
-				renderer = new THREE.WebGLRenderer( { antialias: false, clearAlpha: 1 });
+				renderer = new THREE.WebGLRenderer( { clearAlpha: 1 });
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
 

+ 12 - 12
examples/webgl_postprocessing.html

@@ -122,8 +122,8 @@
 
 				} );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = rtTexture1;
 				screen_uniforms["opacity"].value = 0.4;
@@ -138,8 +138,8 @@
 
 				} );
 
-				var film_shader = ShaderUtils.lib["film"];
-				var film_uniforms = Uniforms.clone( film_shader.uniforms );
+				var film_shader = THREE.ShaderUtils.lib["film"];
+				var film_uniforms = THREE.UniformsUtils.clone( film_shader.uniforms );
 
 				film_uniforms["tDiffuse"].texture = rtTexture1;
 				film_uniforms["nIntensity"].value = 0.25;
@@ -158,12 +158,12 @@
 				blurx = new THREE.Vector2( increment, 0.0 ),
 				blury = new THREE.Vector2( 0.0, increment );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				convolution_uniforms["tDiffuse"].texture = rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -173,7 +173,7 @@
 
 				} );
 
-				var plane = new Plane( window.innerWidth, window.innerHeight );
+				var plane = new THREE.Plane( window.innerWidth, window.innerHeight );
 
 				quadBG = new THREE.Mesh( plane, materialColor );
 				quadBG.position.z = -500;
@@ -211,13 +211,13 @@
 
 				var ambient = 0x444444, diffuse = 0x888888, specular = 0x080810, shininess = 2;
 
-				var shader = ShaderUtils.lib[ "normal" ];
-				var uniforms = Uniforms.clone( shader.uniforms );
+				var shader = THREE.ShaderUtils.lib[ "normal" ];
+				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-				uniforms[ "tNormal" ].texture = ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
+				uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
 				uniforms[ "uNormalScale" ].value = - 0.75;
 
-				uniforms[ "tDiffuse" ].texture = ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
+				uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "obj/leeperrysmith/Map-COL.jpg" );
 
 				uniforms[ "enableAO" ].value = false;
 				uniforms[ "enableDiffuse" ].value = true;

+ 9 - 9
examples/webgl_postprocessing_dof.html

@@ -93,7 +93,7 @@
 						path + 'pz' + format, path + 'nz' + format
 					];
 
-				var textureCube = ImageUtils.loadTextureCube( urls );
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
 
 				parameters = { color: 0xff1100, envMap: textureCube, shading: THREE.FlatShading };
 				cubeMaterial = new THREE.MeshBasicMaterial( parameters );
@@ -102,12 +102,12 @@
 
 				if( singleMaterial ) zmaterial = [ cubeMaterial ];
 
-				//var geo = new Cube( 1, 1, 1 );
-				//var geo = new Icosahedron( 2 );
-				var geo = new Sphere( 1, 20, 10 );
+				//var geo = new THREE.Cube( 1, 1, 1 );
+				//var geo = new THREE.Icosahedron( 2 );
+				var geo = new THREE.Sphere( 1, 20, 10 );
 
 				var start = new Date().getTime();
-				
+
 				renderer.initMaterial( cubeMaterial, scene.lights, scene.fog );
 
 				var xgrid = 14,
@@ -155,7 +155,7 @@
 				}
 
 				//console.log("init time: ", new Date().getTime() - start );
-				
+
 				scene.matrixAutoUpdate = false;
 
 				initPostprocessing();
@@ -244,7 +244,7 @@
 
 				var bokeh_shader = ShaderExtras["bokeh"];
 
-				postprocessing.bokeh_uniforms = Uniforms.clone( bokeh_shader.uniforms );
+				postprocessing.bokeh_uniforms = THREE.UniformsUtils.clone( bokeh_shader.uniforms );
 
 				postprocessing.bokeh_uniforms["tColor"].texture = postprocessing.rtTextureColor;
 				postprocessing.bokeh_uniforms["tDepth"].texture = postprocessing.rtTextureDepth;
@@ -259,8 +259,8 @@
 
 				} );
 
-				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialBokeh );
-				postprocessing.quad.position.z = -500;
+				postprocessing.quad = new THREE.Mesh( new THREE.Plane( window.innerWidth, window.innerHeight ), postprocessing.materialBokeh );
+				postprocessing.quad.position.z = - 500;
 				postprocessing.scene.addObject( postprocessing.quad );
 
 			}

+ 6 - 6
examples/webgl_ribbons.html

@@ -236,8 +236,8 @@
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
@@ -252,15 +252,15 @@
 
 				} );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
 				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
 
 				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -270,7 +270,7 @@
 
 				} );
 
-				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad = new THREE.Mesh( new THREE.Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
 				postprocessing.quad.position.z = -500;
 				postprocessing.scene.addObject( postprocessing.quad );
 

+ 2 - 2
examples/webgl_rtt.html

@@ -150,7 +150,7 @@
 
 				// var mt = new THREE.MeshBasicMaterial( { color:0xffffff, map: ImageUtils.loadTexture( "textures/land_ocean_ice_cloud_2048.jpg" ) } );
 
-				var plane = new Plane( window.innerWidth, window.innerHeight );
+				var plane = new THREE.Plane( window.innerWidth, window.innerHeight );
 
 				quad = new THREE.Mesh( plane, material );
 				quad.position.z = -100;
@@ -164,7 +164,7 @@
 				sceneScreen.addObject( quad );
 
 				var n = 5,
-					geometry = new Sphere( 10, 64, 32 ),
+					geometry = new THREE.Sphere( 10, 64, 32 ),
 					material2 = new THREE.MeshLambertMaterial( { color:0xffffff, map: rtTexture } );
 					//material2 = new THREE.MeshBasicMaterial( { color:0xffffff, map: rtTexture } );
 

+ 6 - 7
examples/webgl_sandbox.html

@@ -74,7 +74,6 @@
 		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/Texture.js"></script>
-		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
 		<script type="text/javascript" src="../src/objects/Particle.js"></script>
 		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
 		<script type="text/javascript" src="../src/objects/Line.js"></script>
@@ -153,11 +152,11 @@
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );
 
-				var geometry = new Sphere( 50, 32, 16 );
+				var geometry = new THREE.Sphere( 50, 32, 16 );
 
-				var uniforms = ShaderUtils.lib[ 'basic' ].uniforms;
-				var vertexShader = ShaderUtils.lib[ 'basic' ].vertexShader;
-				var fragmentShader = ShaderUtils.lib[ 'basic' ].fragmentShader;
+				var uniforms = THREE.ShaderUtils.lib[ 'basic' ].uniforms;
+				var vertexShader = THREE.ShaderUtils.lib[ 'basic' ].vertexShader;
+				var fragmentShader = THREE.ShaderUtils.lib[ 'basic' ].fragmentShader;
 
 				var texture = new THREE.Texture( generateTexture( 0, 0.5, 1 ), new THREE.UVMapping() );
 				var texture2 = new THREE.Texture( generateTexture( 0, 1, 0 ), new THREE.SphericalReflectionMapping() );
@@ -168,8 +167,8 @@
 					new THREE.MeshDepthMaterial(),
 					new THREE.MeshBasicMaterial( { color: 0x0066ff, blending: THREE.AdditiveBlending } ),
 					new THREE.MeshBasicMaterial( { map: texture, fog: false } ),
-					new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ),
-					new THREE.MeshBasicMaterial( { map: texture2, envMap: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ),
+					new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ),
+					new THREE.MeshBasicMaterial( { map: texture2, envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ),
 					new THREE.MeshShaderMaterial( { uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader } )
 
 					/*

+ 1 - 1
examples/webgl_scene_test.html

@@ -353,7 +353,7 @@
 				var object, geometry, material, light, count = 500, range = 200;
 
 				material = new THREE.MeshLambertMaterial( { color:0xffffff } );
-				geometry = new Cube( 5, 5, 5 );
+				geometry = new THREE.Cube( 5, 5, 5 );
 
 				for( var i = 0; i < count; i++ ) {
 

+ 2 - 2
examples/webgl_scene_test_blender.html

@@ -150,7 +150,7 @@
 		<pre id="log"></pre>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
+
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -342,7 +342,7 @@
 				var object, geometry, material, light, count = 500, range = 200;
 
 				material = new THREE.MeshLambertMaterial( { color:0xffffff } );
-				geometry = new Cube( 5, 5, 5 );
+				geometry = new THREE.Cube( 5, 5, 5 );
 
 				for( var i = 0; i < count; i++ ) {
 

+ 1 - 1
examples/webgl_shader.html

@@ -125,7 +125,7 @@
 
 					} );
 
-				mesh = new THREE.Mesh( new Plane( 2, 2 ), material );
+				mesh = new THREE.Mesh( new THREE.Plane( 2, 2 ), material );
 				scene.addObject( mesh );
 
 				renderer = new THREE.WebGLRenderer();

+ 3 - 3
examples/webgl_shader2.html

@@ -208,7 +208,7 @@
 				uniforms2 = {
 					time: { type: "f", value: 1.0 },
 					resolution: { type: "v2", value: new THREE.Vector2() },
-					texture: { type: "t", value: 0, texture: ImageUtils.loadTexture( "textures/disturb.jpg" ) }
+					texture: { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/disturb.jpg" ) }
 				};
 
 				uniforms2.texture.texture.wrapS = uniforms2.texture.texture.wrapT = THREE.Repeat;
@@ -228,8 +228,8 @@
 
 					mlib[ i ] = material;
 
-					mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, 1, [ mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ] ], false ), new THREE.MeshFaceMaterial() );
-					mesh.position.x = i - (params.length - 1)/2;
+					mesh = new THREE.Mesh( new THREE.Cube( size, size, size, 1, 1, 1, [ mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ] ], false ), new THREE.MeshFaceMaterial() );
+					mesh.position.x = i - ( params.length - 1 ) / 2;
 					mesh.position.y = i % 2 - 0.5;
 					scene.addObject( mesh );
 

+ 27 - 27
examples/webgl_shader_lava.html

@@ -45,7 +45,7 @@
 
 			uniform float time;
 			uniform vec2 resolution;
-			
+
 			uniform float fogDensity;
 			uniform vec3 fogColor;
 
@@ -61,28 +61,28 @@
 				vec4 noise = texture2D( texture1, vUv );
 				vec2 T1 = vUv + vec2( 1.5, -1.5 ) * time  *0.02;
 				vec2 T2 = vUv + vec2( -0.5, 2.0 ) * time * 0.01;
-				
+
 				T1.x += noise.x * 2.0;
 				T1.y += noise.y * 2.0;
 				T2.x -= noise.y * 0.2;
 				T2.y += noise.z * 0.2;
-				
+
 				float p = texture2D( texture1, T1 * 2.0 ).a;
-				
+
 				vec4 color = texture2D( texture2, T2 * 2.0 );
 				vec4 temp = color * ( vec4( p, p, p, p ) * 2.0 ) + ( color * color - 0.1 );
-				
+
 				if( temp.r > 1.0 ){ temp.bg += clamp( temp.r - 2.0, 0.0, 100.0 ); }
 				if( temp.g > 1.0 ){ temp.rb += temp.g - 1.0; }
 				if( temp.b > 1.0 ){ temp.rg += temp.b - 1.0; }
-				
+
 				gl_FragColor = temp;
 
 				float depth = gl_FragCoord.z / gl_FragCoord.w;
 				const float LOG2 = 1.442695;
 				float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );
 				fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );
-				
+
 				gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );
 
 			}
@@ -123,7 +123,7 @@
 			var windowHalfY = window.innerHeight / 2;
 
 			var postprocessing = { enabled : true };
-			
+
 			init();
 			animate();
 
@@ -139,14 +139,14 @@
 				start_time = new Date().getTime();
 
 				uniforms = {
-				
+
 					fogDensity: { type: "f", value: 0.45 },
-					fogColor: 	{ type: "v3", value: new THREE.Vector3( 0, 0, 0 ) },
-					time: 		{ type: "f", value: 1.0 },
+					fogColor: { type: "v3", value: new THREE.Vector3( 0, 0, 0 ) },
+					time: { type: "f", value: 1.0 },
 					resolution: { type: "v2", value: new THREE.Vector2() },
-					uvScale: 	{ type: "v2", value: new THREE.Vector2( 3.0, 1.0 ) },
-					texture1: 	{ type: "t", value: 0, texture: ImageUtils.loadTexture( "textures/lava/cloud.png" ) },
-					texture2: 	{ type: "t", value: 1, texture: ImageUtils.loadTexture( "textures/lava/lavatile.jpg" ) }
+					uvScale: { type: "v2", value: new THREE.Vector2( 3.0, 1.0 ) },
+					texture1: { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/lava/cloud.png" ) },
+					texture2: { type: "t", value: 1, texture: THREE.ImageUtils.loadTexture( "textures/lava/lavatile.jpg" ) }
 
 				};
 
@@ -163,7 +163,7 @@
 
 				} );
 
-				mesh = new THREE.Mesh( new Torus( size, 0.3, 30, 30 ), [ material /*, new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 2 } ) */ ] );
+				mesh = new THREE.Mesh( new THREE.Torus( size, 0.3, 30, 30 ), [ material /*, new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 2 } ) */ ] );
 				mesh.position.x = 0;
 				mesh.position.y = 0;
 				mesh.rotation.x = 0.3;
@@ -212,8 +212,8 @@
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
 
-				var screen_shader = ShaderUtils.lib["screen"];
-				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
 
 				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
@@ -228,15 +228,15 @@
 
 				} );
 
-				var convolution_shader = ShaderUtils.lib["convolution"];
-				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
 
 				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
 				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
 
 				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
-				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
 
 				postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
 
@@ -246,23 +246,23 @@
 
 				} );
 
-				var film_shader = ShaderUtils.lib["film"];
-				var film_uniforms = Uniforms.clone( film_shader.uniforms );
-				
+				var film_shader = THREE.ShaderUtils.lib["film"];
+				var film_uniforms = THREE.UniformsUtils.clone( film_shader.uniforms );
+
 				film_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
-				
+
 				postprocessing.materialFilm = new THREE.MeshShaderMaterial( { uniforms: film_uniforms, vertexShader: film_shader.vertexShader, fragmentShader: film_shader.fragmentShader } );
 				postprocessing.materialFilm.uniforms.grayscale.value = 0;
 				postprocessing.materialFilm.uniforms.nIntensity.value = 0.35;
 				postprocessing.materialFilm.uniforms.sIntensity.value = 0.95;
 				postprocessing.materialFilm.uniforms.sCount.value = 2048;
 
-				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
-				postprocessing.quad.position.z = -500;
+				postprocessing.quad = new THREE.Mesh( new THREE.Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad.position.z = - 500;
 				postprocessing.scene.addObject( postprocessing.quad );
 
 			}
-			
+
 			//
 
 			function animate() {

+ 3 - 3
examples/webgl_sprites.html

@@ -51,8 +51,8 @@
 
 				var amount = 200;
 				var radius = 500;
-				var mapA =  ImageUtils.loadTexture( "textures/sprite0.png" );
-				var mapB =  ImageUtils.loadTexture( "textures/sprite1.png" );
+				var mapA = THREE.ImageUtils.loadTexture( "textures/sprite0.png" );
+				var mapB = THREE.ImageUtils.loadTexture( "textures/sprite1.png" );
 
 				group = new THREE.Object3D();
 
@@ -98,7 +98,7 @@
 
 				// renderer
 
-				renderer = new THREE.WebGLRenderer( { antialias: false } );
+				renderer = new THREE.WebGLRenderer();
 				renderer.setClearColorHex( 0x000000, 1 );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.sortObjects = true;

+ 9 - 9
examples/webgl_stencil.html

@@ -51,22 +51,22 @@
 
 				// world
 
-				var cube = new Cube( 300, 300, 10 );
+				var cube = new THREE.Cube( 300, 300, 10 );
 				var material0 = new THREE.MeshPhongMaterial( { color:0xff00ff } );
 				var material1 = new THREE.MeshLambertMaterial( { color:0x00ff00 } );
 				var material2 = new THREE.MeshLambertMaterial( { color:0x0000ff } );
 
 				var mesh1 = new THREE.Mesh( cube, material0 );
-				mesh1.position.z = -150;
+				mesh1.position.z = - 150;
 				scene.addChild( mesh1 );
 
 				var mesh2 = new THREE.Mesh( cube, material1 );
-				mesh2.position.x = -150;
+				mesh2.position.x = - 150;
 				mesh2.rotation.y = 90 * Math.PI / 180;
 				scene.addChild( mesh2 );
 
 				var mesh3 = new THREE.Mesh( cube, material2 );
-				mesh3.position.y = -150;
+				mesh3.position.y = - 150;
 				mesh3.rotation.x = 90 * Math.PI / 180;
 				scene.addChild( mesh3 );
 
@@ -77,10 +77,10 @@
 
 				// moving objects
 
-				var cube = new Cube( 40, 40, 40 );
-				var torus = new Torus( 40, 10 );
-				var sphere = new Sphere( 40 );
-				var cylinder = new Cylinder( 10, 10, 20, 40, 0, 0 );
+				var cube = new THREE.Cube( 40, 40, 40 );
+				var torus = new THREE.Torus( 40, 10 );
+				var sphere = new THREE.Sphere( 40 );
+				var cylinder = new THREE.Cylinder( 10, 10, 20, 40, 0, 0 );
 				mesh = new THREE.Mesh( torus, material1 );
 				scene.addChild( mesh );
 
@@ -97,7 +97,7 @@
 				light.position.set( 0, 1, 0 );
 				scene.addChild( light );
 
-				var cube = new Sphere( 5 );
+				var cube = new THREE.Sphere( 5 );
 				lightCube = new THREE.Mesh( cube, material2 );
 				scene.addChild( lightCube );
 

+ 8 - 8
examples/webgl_stencilLensFlare.html

@@ -50,7 +50,7 @@
 
 				// world
 
-				var cube = new Cube( 300, 300, 10 );
+				var cube = new THREE.Cube( 300, 300, 10 );
 				var material0 = new THREE.MeshPhongMaterial( { color:0xff00ff } );
 				var material1 = new THREE.MeshLambertMaterial( { color:0x00ff00 } );
 				var material2 = new THREE.MeshLambertMaterial( { color:0x0000ff } );
@@ -76,10 +76,10 @@
 
 				// moving objects
 
-				var cube = new Cube( 40, 40, 40 );
-				var torus = new Torus( 40, 10 );
-				var sphere = new Sphere( 40 );
-				var cylinder = new Cylinder( 10, 10, 20, 40, 0, 0 );
+				var cube = new THREE.Cube( 40, 40, 40 );
+				var torus = new THREE.Torus( 40, 10 );
+				var sphere = new THREE.Sphere( 40 );
+				var cylinder = new THREE.Cylinder( 10, 10, 20, 40, 0, 0 );
 				mesh = new THREE.Mesh( torus, material1 );
 				scene.addChild( mesh );
 
@@ -101,13 +101,13 @@
 				scene.addChild( light );
 
 
-				var cube = new Sphere( 2 );
+				var cube = new THREE.Sphere( 2 );
 				lightCube = new THREE.Mesh( cube, material2 );
 				lightCube.visible = false;
 				scene.addChild( lightCube );
 
-				var lensFlare = new THREE.LensFlare( ImageUtils.loadTexture( "textures/lensflare0.png" ), 128, 0.0, THREE.AdditiveBlending );
-				lensFlare.add( ImageUtils.loadTexture( "textures/lensflare1.png" ), 256, 0.33, THREE.AdditiveBlending );
+				var lensFlare = new THREE.LensFlare( THREE.ImageUtils.loadTexture( "textures/lensflare0.png" ), 128, 0.0, THREE.AdditiveBlending );
+				lensFlare.add( THREE.ImageUtils.loadTexture( "textures/lensflare1.png" ), 256, 0.33, THREE.AdditiveBlending );
 				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 300, 0.66, THREE.AdditiveBlending );
 				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 400, 1.0, THREE.AdditiveBlending );
 

+ 7 - 0
src/Three.js

@@ -3,3 +3,10 @@
  */
 
 var THREE = THREE || {};
+
+if ( ! window.Int32Array ) {
+
+	window.Int32Array = Array;
+	window.Float32Array = Array;
+
+}

+ 10 - 6
src/extras/ImageUtils.js

@@ -1,11 +1,15 @@
-var ImageUtils = {
+/**
+ * @author alteredq / http://alteredqualia.com/
+ */
+
+THREE.ImageUtils = {
 
 	loadTexture: function ( path, mapping, callback ) {
 
 		var image = new Image(),
 			texture = new THREE.Texture( image, mapping );
 
-		image.onload = function () { texture.needsUpdate = true; if( callback ) callback( this ); };
+		image.onload = function () { texture.needsUpdate = true; if ( callback ) callback( this ); };
 		image.src = path;
 
 		return texture;
@@ -25,11 +29,11 @@ var ImageUtils = {
 			images[ i ] = new Image();
 			images[ i ].onload = function () {
 
-					images.loadCount += 1; 
-					if( images.loadCount == 6 ) texture.needsUpdate = true; 
-					if( callback ) callback( this ); 
+				images.loadCount += 1; 
+				if ( images.loadCount == 6 ) texture.needsUpdate = true; 
+				if ( callback ) callback( this );
 
-				};
+			};
 
 			images[ i ].src = array[ i ];
 

+ 31 - 27
src/extras/SceneUtils.js

@@ -2,7 +2,7 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-var SceneUtils = {
+THREE.SceneUtils = {
 
 	addMesh : function ( scene, geometry, scale, x, y, z, rx, ry, rz, material ) {
 
@@ -22,15 +22,18 @@ var SceneUtils = {
 
 	addPanoramaCubeWebGL : function ( scene, size, textureCube ) {
 
-		var shader = ShaderUtils.lib["cube"];
+		var shader = THREE.ShaderUtils.lib["cube"];
 		shader.uniforms["tCube"].texture = textureCube;
 
-		var material = new THREE.MeshShaderMaterial( { fragmentShader: shader.fragmentShader,
-								   vertexShader: shader.vertexShader,
-								   uniforms: shader.uniforms
-								} ),
+		var material = new THREE.MeshShaderMaterial( {
 
-		mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, 1, null, true ), material );
+			fragmentShader: shader.fragmentShader,
+			vertexShader: shader.vertexShader,
+			uniforms: shader.uniforms
+
+		} ),
+
+		mesh = new THREE.Mesh( new THREE.Cube( size, size, size, 1, 1, 1, null, true ), material );
 		scene.addObject( mesh );
 
 		return mesh;
@@ -40,6 +43,7 @@ var SceneUtils = {
 	addPanoramaCube : function( scene, size, images ) {
 
 		var materials = [], mesh;
+
 		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 0 ] ) } ) );
 		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 1 ] ) } ) );
 		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 2 ] ) } ) );
@@ -47,7 +51,7 @@ var SceneUtils = {
 		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 4 ] ) } ) );
 		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 5 ] ) } ) );
 
-		mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, materials, true ), new THREE.MeshFaceMaterial() );
+		mesh = new THREE.Mesh( new THREE.Cube( size, size, size, 1, 1, materials, true ), new THREE.MeshFaceMaterial() );
 		scene.addObject( mesh );
 
 		return mesh;
@@ -57,36 +61,36 @@ var SceneUtils = {
 	addPanoramaCubePlanes : function ( scene, size, images ) {
 
 
-		var hsize = size / 2, plane = new Plane( size, size ), pi = Math.PI, pi2 = Math.PI / 2;
+		var hsize = size / 2, plane = new THREE.Plane( size, size ), pi = Math.PI, pi2 = Math.PI / 2;
 
-		SceneUtils.addMesh( scene, plane, 1,      0,     0,  -hsize,  0,      0,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[5] ) } ) );
-		SceneUtils.addMesh( scene, plane, 1, -hsize,     0,       0,  0,    pi2,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[0] ) } ) );
-		SceneUtils.addMesh( scene, plane, 1,  hsize,     0,       0,  0,   -pi2,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[1] ) } ) );
-		SceneUtils.addMesh( scene, plane, 1,     0,  hsize,       0,  pi2,    0, pi, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[2] ) } ) );
-		SceneUtils.addMesh( scene, plane, 1,     0, -hsize,       0, -pi2,    0, pi, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[3] ) } ) );
+		THREE.SceneUtils.addMesh( scene, plane, 1,      0,     0,  -hsize,  0,      0,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[5] ) } ) );
+		THREE.SceneUtils.addMesh( scene, plane, 1, -hsize,     0,       0,  0,    pi2,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[0] ) } ) );
+		THREE.SceneUtils.addMesh( scene, plane, 1,  hsize,     0,       0,  0,   -pi2,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[1] ) } ) );
+		THREE.SceneUtils.addMesh( scene, plane, 1,     0,  hsize,       0,  pi2,    0, pi, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[2] ) } ) );
+		THREE.SceneUtils.addMesh( scene, plane, 1,     0, -hsize,       0, -pi2,    0, pi, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[3] ) } ) );
 
 	},
-	
+
 	showHierarchy : function ( root, visible ) {
-		
-		SceneUtils.traverseHierarchy( root, function( node ) { node.visible = visible; } );
-		
+
+		THREE.SceneUtils.traverseHierarchy( root, function( node ) { node.visible = visible; } );
+
 	},
-	
+
 	traverseHierarchy : function ( root, callback ) {
-		
+
 		var n, i, l = root.children.length;
-		
-		for( i = 0; i < l; i++ ) {
-			
+
+		for ( i = 0; i < l; i ++ ) {
+
 			n = root.children[ i ];
-			
+
 			callback( n );
-			
+
 			SceneUtils.traverseHierarchy( n, callback );
-			
+
 		}
-		
+
 	}
 
 };

+ 384 - 376
src/extras/ShaderUtils.js

@@ -2,392 +2,394 @@
  * @author alteredq / http://alteredqualia.com/
  * @author mr.doob / http://mrdoob.com/
  */
- 
-var ShaderUtils = {
 
-	lib: { 
-		
+THREE.ShaderUtils = {
+
+	lib: {
+
 		/* -------------------------------------------------------------------------
 		//	Fresnel shader
 		//	- based on Nvidia Cg tutorial
 		 ------------------------------------------------------------------------- */
-		
+
 		'fresnel': {
 
-		uniforms: {
+			uniforms: {
 
-		"mRefractionRatio": { type: "f", value: 1.02 },
-		"mFresnelBias": { type: "f", value: 0.1 },
-		"mFresnelPower": { type: "f", value: 2.0 },
-		"mFresnelScale": { type: "f", value: 1.0 },
-		"tCube": { type: "t", value: 1, texture: null }
+				"mRefractionRatio": { type: "f", value: 1.02 },
+				"mFresnelBias": { type: "f", value: 0.1 },
+				"mFresnelPower": { type: "f", value: 2.0 },
+				"mFresnelScale": { type: "f", value: 1.0 },
+				"tCube": { type: "t", value: 1, texture: null }
 
-		},
+			},
+
+			fragmentShader: [
+
+				"uniform samplerCube tCube;",
 
-		fragmentShader: [
+				"varying vec3 vReflect;",
+				"varying vec3 vRefract[3];",
+				"varying float vReflectionFactor;",
 
-		"uniform samplerCube tCube;",
+				"void main() {",
 
-		"varying vec3 vReflect;",
-		"varying vec3 vRefract[3];",
-		"varying float vReflectionFactor;",
+					"vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
+					"vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );",
 
-		"void main() {",
-		
-			"vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
-			"vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );",
+					"refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
+					"refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
+					"refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
+					"refractedColor.a = 1.0;",
 
-			"refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;",
-			"refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;",
-			"refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;",
-			"refractedColor.a = 1.0;",
+					"gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
 
-			"gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );",
-		
-		"}"
+				"}"
 
-		].join("\n"),
+			].join("\n"),
 
-		vertexShader: [
+			vertexShader: [
 
-		"uniform float mRefractionRatio;",
-		"uniform float mFresnelBias;",
-		"uniform float mFresnelScale;",
-		"uniform float mFresnelPower;",
+				"uniform float mRefractionRatio;",
+				"uniform float mFresnelBias;",
+				"uniform float mFresnelScale;",
+				"uniform float mFresnelPower;",
 
-		"varying vec3 vReflect;",
-		"varying vec3 vRefract[3];",
-		"varying float vReflectionFactor;",
+				"varying vec3 vReflect;",
+				"varying vec3 vRefract[3];",
+				"varying float vReflectionFactor;",
 
-		"void main() {",
-		
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
+				"void main() {",
 
-			"vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );",
+					"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+					"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
 
-			"vec3 I = mPosition.xyz - cameraPosition;",
+					"vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );",
 
-			"vReflect = reflect( I, nWorld );",
-			"vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );",
-			"vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );",
-			"vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );",
-			"vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );",
+					"vec3 I = mPosition.xyz - cameraPosition;",
 
-			"gl_Position = projectionMatrix * mvPosition;",
-			
-		"}"
+					"vReflect = reflect( I, nWorld );",
+					"vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );",
+					"vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );",
+					"vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );",
+					"vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );",
 
-		].join("\n")
+					"gl_Position = projectionMatrix * mvPosition;",
+
+				"}"
+
+			].join("\n")
 
 		},
 
 		/* -------------------------------------------------------------------------
-		//	Normal map shader 
-		//		- Blinn-Phong 
+		//	Normal map shader
+		//		- Blinn-Phong
 		//		- normal + diffuse + AO + displacement maps
 		//		- 1 point and 1 directional lights
 		 ------------------------------------------------------------------------- */
-		
+
 		'normal' : {
 
-		uniforms: {
+			uniforms: {
 
-		"enableAO": { type: "i", value: 0 },
-		"enableDiffuse": { type: "i", value: 0 },
+				"enableAO": { type: "i", value: 0 },
+				"enableDiffuse": { type: "i", value: 0 },
 
-		"tDiffuse": { type: "t", value: 0, texture: null },
-		"tNormal": { type: "t", value: 2, texture: null },
-		"tAO": { type: "t", value: 3, texture: null },
+				"tDiffuse": { type: "t", value: 0, texture: null },
+				"tNormal": { type: "t", value: 2, texture: null },
+				"tAO": { type: "t", value: 3, texture: null },
 
-		"uNormalScale": { type: "f", value: 1.0 },
+				"uNormalScale": { type: "f", value: 1.0 },
 
-		"tDisplacement": { type: "t", value: 4, texture: null },
-		"uDisplacementBias": { type: "f", value: -0.5 },
-		"uDisplacementScale": { type: "f", value: 2.5 },
+				"tDisplacement": { type: "t", value: 4, texture: null },
+				"uDisplacementBias": { type: "f", value: -0.5 },
+				"uDisplacementScale": { type: "f", value: 2.5 },
 
-		"uPointLightPos": { type: "v3", value: new THREE.Vector3() },
-		"uPointLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+				"uPointLightPos": { type: "v3", value: new THREE.Vector3() },
+				"uPointLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
 
-		"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
-		"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+				"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
+				"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
 
-		"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) },
+				"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) },
 
-		"uDiffuseColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
-		"uSpecularColor": { type: "c", value: new THREE.Color( 0x111111 ) },
-		"uAmbientColor": { type: "c", value: new THREE.Color( 0x050505 ) },
-		"uShininess": { type: "f", value: 30 }
+				"uDiffuseColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+				"uSpecularColor": { type: "c", value: new THREE.Color( 0x111111 ) },
+				"uAmbientColor": { type: "c", value: new THREE.Color( 0x050505 ) },
+				"uShininess": { type: "f", value: 30 }
 
-		},
+			},
+
+			fragmentShader: [
 
-		fragmentShader: [
+				"uniform vec3 uDirLightPos;",
 
-		"uniform vec3 uDirLightPos;",
+				"uniform vec3 uAmbientLightColor;",
+				"uniform vec3 uDirLightColor;",
+				"uniform vec3 uPointLightColor;",
 
-		"uniform vec3 uAmbientLightColor;",
-		"uniform vec3 uDirLightColor;",
-		"uniform vec3 uPointLightColor;",
+				"uniform vec3 uAmbientColor;",
+				"uniform vec3 uDiffuseColor;",
+				"uniform vec3 uSpecularColor;",
+				"uniform float uShininess;",
 
-		"uniform vec3 uAmbientColor;",
-		"uniform vec3 uDiffuseColor;",
-		"uniform vec3 uSpecularColor;",
-		"uniform float uShininess;",
+				"uniform bool enableDiffuse;",
+				"uniform bool enableAO;",
 
-		"uniform bool enableDiffuse;",
-		"uniform bool enableAO;",
+				"uniform sampler2D tDiffuse;",
+				"uniform sampler2D tNormal;",
+				"uniform sampler2D tAO;",
 
-		"uniform sampler2D tDiffuse;",
-		"uniform sampler2D tNormal;",
-		"uniform sampler2D tAO;",
+				"uniform float uNormalScale;",
 
-		"uniform float uNormalScale;",
+				"varying vec3 vTangent;",
+				"varying vec3 vBinormal;",
+				"varying vec3 vNormal;",
+				"varying vec2 vUv;",
 
-		"varying vec3 vTangent;",
-		"varying vec3 vBinormal;",
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
+				"varying vec3 vPointLightVector;",
+				"varying vec3 vViewPosition;",
 
-		"varying vec3 vPointLightVector;",
-		"varying vec3 vViewPosition;",
+				"void main() {",
 
-		"void main() {",
+					"vec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );",
+					"vec3 aoTex = vec3( 1.0, 1.0, 1.0 );",
 
-			"vec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );",
-			"vec3 aoTex = vec3( 1.0, 1.0, 1.0 );",
+					"vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;",
+					"normalTex.xy *= uNormalScale;",
+					"normalTex = normalize( normalTex );",
 
-			"vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;",
-			"normalTex.xy *= uNormalScale;",
-			"normalTex = normalize( normalTex );",
+					"if( enableDiffuse )",
+						"diffuseTex = texture2D( tDiffuse, vUv ).xyz;",
 
-			"if( enableDiffuse )",
-				"diffuseTex = texture2D( tDiffuse, vUv ).xyz;",
+					"if( enableAO )",
+						"aoTex = texture2D( tAO, vUv ).xyz;",
 
-			"if( enableAO )",
-				"aoTex = texture2D( tAO, vUv ).xyz;",
+					"mat3 tsb = mat3( vTangent, vBinormal, vNormal );",
+					"vec3 finalNormal = tsb * normalTex;",
 
-			"mat3 tsb = mat3( vTangent, vBinormal, vNormal );",
-			"vec3 finalNormal = tsb * normalTex;",
+					"vec3 normal = normalize( finalNormal );",
+					"vec3 viewPosition = normalize( vViewPosition );",
 
-			"vec3 normal = normalize( finalNormal );",
-			"vec3 viewPosition = normalize( vViewPosition );",
+					// point light
 
-			// point light
+					"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );",
+					"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );",
 
-			"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );",
-			"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );",
+					"vec3 pointVector = normalize( vPointLightVector );",
+					"vec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );",
 
-			"vec3 pointVector = normalize( vPointLightVector );",
-			"vec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );",
+					"float pointDotNormalHalf = dot( normal, pointHalfVector );",
+					"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );",
 
-			"float pointDotNormalHalf = dot( normal, pointHalfVector );",
-			"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );",
+					"float pointSpecularWeight = 0.0;",
+					"if ( pointDotNormalHalf >= 0.0 )",
+						"pointSpecularWeight = pow( pointDotNormalHalf, uShininess );",
 
-			"float pointSpecularWeight = 0.0;",
-			"if ( pointDotNormalHalf >= 0.0 )",
-				"pointSpecularWeight = pow( pointDotNormalHalf, uShininess );",
+					"pointDiffuse  += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;",
+					"pointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;",
 
-			"pointDiffuse  += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;",
-			"pointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;",
+					// directional light
 
-			// directional light
+					"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );",
+					"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );",
 
-			"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );",
-			"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );",
+					"vec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );",
 
-			"vec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );",
+					"vec3 dirVector = normalize( lDirection.xyz );",
+					"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );",
 
-			"vec3 dirVector = normalize( lDirection.xyz );",
-			"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );",
+					"float dirDotNormalHalf = dot( normal, dirHalfVector );",
+					"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
 
-			"float dirDotNormalHalf = dot( normal, dirHalfVector );",
-			"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
+					"float dirSpecularWeight = 0.0;",
+					"if ( dirDotNormalHalf >= 0.0 )",
+						"dirSpecularWeight = pow( dirDotNormalHalf, uShininess );",
 
-			"float dirSpecularWeight = 0.0;",
-			"if ( dirDotNormalHalf >= 0.0 )",
-				"dirSpecularWeight = pow( dirDotNormalHalf, uShininess );",
+					"dirDiffuse  += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;",
+					"dirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;",
 
-			"dirDiffuse  += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;",
-			"dirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;",
+					// all lights contribution summation
 
-			// all lights contribution summation
+					"vec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );",
+					"totalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );",
+					"totalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );",
 
-			"vec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );",
-			"totalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );",
-			"totalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );",
+					"gl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );",
 
-			"gl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );",
+				"}"
 
-		"}"
-		].join("\n"),
+			].join("\n"),
 
-		vertexShader: [
+			vertexShader: [
 
-		"attribute vec4 tangent;",
+				"attribute vec4 tangent;",
 
-		"uniform vec3 uPointLightPos;",
+				"uniform vec3 uPointLightPos;",
 
-		"#ifdef VERTEX_TEXTURES",
+				"#ifdef VERTEX_TEXTURES",
 
-			"uniform sampler2D tDisplacement;",
-			"uniform float uDisplacementScale;",
-			"uniform float uDisplacementBias;",
+					"uniform sampler2D tDisplacement;",
+					"uniform float uDisplacementScale;",
+					"uniform float uDisplacementBias;",
 
-		"#endif",
+				"#endif",
 
-		"varying vec3 vTangent;",
-		"varying vec3 vBinormal;",
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
+				"varying vec3 vTangent;",
+				"varying vec3 vBinormal;",
+				"varying vec3 vNormal;",
+				"varying vec2 vUv;",
 
-		"varying vec3 vPointLightVector;",
-		"varying vec3 vViewPosition;",
+				"varying vec3 vPointLightVector;",
+				"varying vec3 vViewPosition;",
 
-		"void main() {",
+				"void main() {",
 
-			"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
-			"vViewPosition = cameraPosition - mPosition.xyz;",
+					"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
+					"vViewPosition = cameraPosition - mPosition.xyz;",
 
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vNormal = normalize( normalMatrix * normal );",
+					"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
+					"vNormal = normalize( normalMatrix * normal );",
 
-			// tangent and binormal vectors
+					// tangent and binormal vectors
 
-			"vTangent = normalize( normalMatrix * tangent.xyz );",
+					"vTangent = normalize( normalMatrix * tangent.xyz );",
 
-			"vBinormal = cross( vNormal, vTangent ) * tangent.w;",
-			"vBinormal = normalize( vBinormal );",
+					"vBinormal = cross( vNormal, vTangent ) * tangent.w;",
+					"vBinormal = normalize( vBinormal );",
 
-			"vUv = uv;",
+					"vUv = uv;",
 
-			// point light
+					// point light
 
-			"vec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );",
-			"vPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );",
+					"vec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );",
+					"vPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );",
 
-			// displacement mapping
+					// displacement mapping
 
-			"#ifdef VERTEX_TEXTURES",
+					"#ifdef VERTEX_TEXTURES",
 
-				"vec3 dv = texture2D( tDisplacement, uv ).xyz;",
-				"float df = uDisplacementScale * dv.x + uDisplacementBias;",
-				"vec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;",
-				"gl_Position = projectionMatrix * displacedPosition;",
+						"vec3 dv = texture2D( tDisplacement, uv ).xyz;",
+						"float df = uDisplacementScale * dv.x + uDisplacementBias;",
+						"vec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;",
+						"gl_Position = projectionMatrix * displacedPosition;",
 
-			"#else",
+					"#else",
 
-				"gl_Position = projectionMatrix * mvPosition;",
+						"gl_Position = projectionMatrix * mvPosition;",
 
-			"#endif",
+					"#endif",
 
-		"}"
+				"}"
 
-		].join("\n")
+			].join("\n")
 
 		},
 
 		/* -------------------------------------------------------------------------
 		//	Cube map shader
 		 ------------------------------------------------------------------------- */
-		
+
 		'cube': {
 
-		uniforms: { "tCube": { type: "t", value: 1, texture: null } },
+			uniforms: { "tCube": { type: "t", value: 1, texture: null } },
 
-		vertexShader: [
+			vertexShader: [
 
-		"varying vec3 vViewPosition;",
+				"varying vec3 vViewPosition;",
 
-		"void main() {",
+				"void main() {",
 
-			"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
-			"vViewPosition = cameraPosition - mPosition.xyz;",
+					"vec4 mPosition = objectMatrix * vec4( position, 1.0 );",
+					"vViewPosition = cameraPosition - mPosition.xyz;",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
-		"}"
+				"}"
 
-		].join("\n"),
+			].join("\n"),
 
-		fragmentShader: [
+			fragmentShader: [
 
-		"uniform samplerCube tCube;",
+				"uniform samplerCube tCube;",
 
-		"varying vec3 vViewPosition;",
+				"varying vec3 vViewPosition;",
 
-		"void main() {",
+				"void main() {",
 
-			"vec3 wPos = cameraPosition - vViewPosition;",
-			"gl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );",
+					"vec3 wPos = cameraPosition - vViewPosition;",
+					"gl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );",
 
-		"}"
+				"}"
 
-		].join("\n")
+			].join("\n")
 
 		},
 
 		/* ------------------------------------------------------------------------
-		//	Convolution shader 
+		//	Convolution shader
 		//	  - ported from o3d sample to WebGL / GLSL
 		//			http://o3d.googlecode.com/svn/trunk/samples/convolution.html
 		------------------------------------------------------------------------ */
-		
+
 		'convolution': {
 
-		uniforms: {  
-			
-		"tDiffuse" : { type: "t", value: 0, texture: null },
-		"uImageIncrement" : { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
-		"cKernel" : { type: "fv1", value: [] }
-		},
+			uniforms: {
+
+				"tDiffuse" : { type: "t", value: 0, texture: null },
+				"uImageIncrement" : { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
+				"cKernel" : { type: "fv1", value: [] }
+
+			},
+
+			vertexShader: [
+
+				"varying vec2 vUv;",
+
+				"uniform vec2 uImageIncrement;",
+				//"#define KERNEL_SIZE 25.0",
+
+				"void main(void) {",
+
+					"vUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;",
+					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
-		vertexShader: [
-
-		"varying vec2 vUv;",
-		
-		"uniform vec2 uImageIncrement;",
-		//"#define KERNEL_SIZE 25.0",
-		
-		"void main(void) {",
-		
-			"vUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-		
-		"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-		"varying vec2 vUv;",
-		
-		"uniform sampler2D tDiffuse;",
-		"uniform vec2 uImageIncrement;",
-		
-		//"#define KERNEL_SIZE 25",
-		"uniform float cKernel[KERNEL_SIZE];",
-		
-		"void main(void) {",
-		
-			"vec2 imageCoord = vUv;",
-			"vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
-			"for( int i=0; i<KERNEL_SIZE; ++i ) {",
-				"sum += texture2D( tDiffuse, imageCoord ) * cKernel[i];",
-				"imageCoord += uImageIncrement;",
-			"}",
-			"gl_FragColor = sum;",
-			
-		"}"
-			
-
-		].join("\n")
+				"}"
+
+			].join("\n"),
+
+			fragmentShader: [
+
+				"varying vec2 vUv;",
+
+				"uniform sampler2D tDiffuse;",
+				"uniform vec2 uImageIncrement;",
+
+				//"#define KERNEL_SIZE 25",
+				"uniform float cKernel[KERNEL_SIZE];",
+
+				"void main(void) {",
+
+					"vec2 imageCoord = vUv;",
+					"vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
+					"for( int i=0; i<KERNEL_SIZE; ++i ) {",
+						"sum += texture2D( tDiffuse, imageCoord ) * cKernel[i];",
+						"imageCoord += uImageIncrement;",
+					"}",
+					"gl_FragColor = sum;",
+
+				"}"
+
+
+			].join("\n")
 
 		},
 
 		/* -------------------------------------------------------------------------
-		
+
 		// Film grain & scanlines shader
-		
+
 		//	- ported from HLSL to WebGL / GLSL
 		//	  http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html
 
@@ -400,189 +402,195 @@ var ShaderUtils = {
 		//
 		// Optimized scanlines + noise version with intensity scaling
 		// Georg 'Leviathan' Steinrohder
-		
+
 		// This version is provided under a Creative Commons Attribution 3.0 License
 		// http://creativecommons.org/licenses/by/3.0/
 		 ------------------------------------------------------------------------- */
 
 		'film': {
 
-		uniforms: { tDiffuse:   { type: "t", value: 0, texture: null },
-					time: 	    { type: "f", value: 0.0 },
-					nIntensity: { type: "f", value: 0.5 },
-					sIntensity: { type: "f", value: 0.05 },
-					sCount: 	{ type: "f", value: 4096 },
-					grayscale:  { type: "i", value: 1 }
-				  },
-
-		vertexShader: [
-            
-		"varying vec2 vUv;",
-
-		"void main() {",
-               
-			"vUv = vec2( uv.x, 1.0 - uv.y );",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-		
-		"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-		
-		"varying vec2 vUv;",
-		"uniform sampler2D tDiffuse;",
-		
-		// control parameter
-		"uniform float time;",
-		
-		"uniform bool grayscale;",
-
-		// noise effect intensity value (0 = no effect, 1 = full effect)
-		"uniform float nIntensity;",
-		
-		// scanlines effect intensity value (0 = no effect, 1 = full effect)
-		"uniform float sIntensity;",
-		
-		// scanlines effect count value (0 = no effect, 4096 = full effect)
-		"uniform float sCount;",
-		
-		"void main() {",
-			
-			// sample the source
-			"vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
-
-			// make some noise
-			"float x = vUv.x * vUv.y * time *  1000.0;",
-			"x = mod( x, 13.0 ) * mod( x, 123.0 );",
-			"float dx = mod( x, 0.01 );",
-
-			// add noise
-			"vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );",
-
-			// get us a sine and cosine
-			"vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
-
-			// add scanlines
-			"cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
-			
-			// interpolate between source and result by intensity
-			"cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
-
-			// convert to grayscale if desired
-			"if( grayscale ) {",
-				"cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
-			"}",
-
-			"gl_FragColor =  vec4( cResult, cTextureScreen.a );",
-		
-		"}"
-
-		].join("\n")
+			uniforms: {
+
+				tDiffuse:   { type: "t", value: 0, texture: null },
+				time: 	    { type: "f", value: 0.0 },
+				nIntensity: { type: "f", value: 0.5 },
+				sIntensity: { type: "f", value: 0.05 },
+				sCount: 	{ type: "f", value: 4096 },
+				grayscale:  { type: "i", value: 1 }
+
+			},
+
+			vertexShader: [
+
+				"varying vec2 vUv;",
+
+				"void main() {",
+
+					"vUv = vec2( uv.x, 1.0 - uv.y );",
+					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+				"}"
+
+			].join("\n"),
+
+			fragmentShader: [
+
+				"varying vec2 vUv;",
+				"uniform sampler2D tDiffuse;",
+
+				// control parameter
+				"uniform float time;",
+
+				"uniform bool grayscale;",
+
+				// noise effect intensity value (0 = no effect, 1 = full effect)
+				"uniform float nIntensity;",
+
+				// scanlines effect intensity value (0 = no effect, 1 = full effect)
+				"uniform float sIntensity;",
+
+				// scanlines effect count value (0 = no effect, 4096 = full effect)
+				"uniform float sCount;",
+
+				"void main() {",
+
+					// sample the source
+					"vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
+
+					// make some noise
+					"float x = vUv.x * vUv.y * time *  1000.0;",
+					"x = mod( x, 13.0 ) * mod( x, 123.0 );",
+					"float dx = mod( x, 0.01 );",
+
+					// add noise
+					"vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );",
+
+					// get us a sine and cosine
+					"vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
+
+					// add scanlines
+					"cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
+
+					// interpolate between source and result by intensity
+					"cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
+
+					// convert to grayscale if desired
+					"if( grayscale ) {",
+						"cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",
+					"}",
+
+					"gl_FragColor =  vec4( cResult, cTextureScreen.a );",
+
+				"}"
+
+			].join("\n")
 
 		},
 
 		/* -------------------------------------------------------------------------
 		//	Full-screen textured quad shader
 		 ------------------------------------------------------------------------- */
-		
+
 		'screen': {
 
-		uniforms: { tDiffuse: { type: "t", value: 0, texture: null },
-					opacity: { type: "f", value: 1.0 } 
-				  },
+			uniforms: {
+
+				tDiffuse: { type: "t", value: 0, texture: null },
+				opacity: { type: "f", value: 1.0 }
+
+			},
 
-		vertexShader: [
+			vertexShader: [
 
-		"varying vec2 vUv;",
+				"varying vec2 vUv;",
 
-		"void main() {",
-			
-			"vUv = vec2( uv.x, 1.0 - uv.y );",
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-			
-		"}"
+				"void main() {",
 
-		].join("\n"),
+					"vUv = vec2( uv.x, 1.0 - uv.y );",
+					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
-		fragmentShader: [
-		
-		"varying vec2 vUv;",
-		"uniform sampler2D tDiffuse;",
-		"uniform float opacity;",
-		
-		"void main() {",
-		
-			"vec4 texel = texture2D( tDiffuse, vUv );",
-			"gl_FragColor = opacity * texel;",
-			
-		"}"
+				"}"
 
-		].join("\n")
+			].join("\n"),
+
+			fragmentShader: [
+
+				"varying vec2 vUv;",
+				"uniform sampler2D tDiffuse;",
+				"uniform float opacity;",
+
+				"void main() {",
+
+					"vec4 texel = texture2D( tDiffuse, vUv );",
+					"gl_FragColor = opacity * texel;",
+
+				"}"
+
+			].join("\n")
 
 		},
 
-		
+
 		/* -------------------------------------------------------------------------
 		//	Simple test shader
 		 ------------------------------------------------------------------------- */
-		
+
 		'basic': {
 
-		uniforms: {},
+			uniforms: {},
 
-		vertexShader: [
+			vertexShader: [
 
-		"void main() {",
+				"void main() {",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+					"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
-		"}"
+				"}"
 
-		].join("\n"),
+			].join("\n"),
 
-		fragmentShader: [
+			fragmentShader: [
 
-		"void main() {",
+				"void main() {",
 
-			"gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );",
+					"gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );",
 
-		"}"
+				"}"
 
-		].join("\n")
+			].join("\n")
 
 		}
 
 	},
-	
+
 	buildKernel: function( sigma ) {
-		
+
 		// We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway.
-		
+
 		function gauss( x, sigma ) {
-		
-			return Math.exp( - (x * x) / (2.0 * sigma * sigma) );
-			
+
+			return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) );
+
 		}
-		
+
 		var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1;
-		
+
 		if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize;
 		halfWidth = ( kernelSize - 1 ) * 0.5
-		
+
 		values = new Array( kernelSize );
 		sum = 0.0;
-		for( i = 0; i < kernelSize; ++i ) {
-		
+		for ( i = 0; i < kernelSize; ++i ) {
+
 			values[ i ] = gauss( i - halfWidth, sigma );
 			sum += values[ i ];
-			
+
 		}
-		
+
 		// normalize the kernel
-		
-		for( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
-		
+
+		for ( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
+
 		return values;
 
 	}

+ 65 - 65
src/extras/cameras/PathCamera.js

@@ -10,19 +10,19 @@
 
  *  waypoints: <Array>,	// [ [x,y,z], [x,y,z] ... ]
  *  duration: <float>, 	// seconds
- 
+
  *  useConstantSpeed: <bool>,
  *  resamplingCoef: <float>,
- 
+
  *  createDebugPath: <bool>,
  *  createDebugDummy: <bool>,
- 
+
  *  lookSpeed: <float>,
  *  lookVertical: <bool>,
  *  lookHorizontal: <bool>,
  *  verticalAngleMap: { srcRange: [ <float>, <float> ], dstRange: [ <float>, <float> ] }
  *  horizontalAngleMap: { srcRange: [ <float>, <float> ], dstRange: [ <float>, <float> ] }
- 
+
  *  domElement: <HTMLElement>,
  * }
  */
@@ -32,13 +32,13 @@ THREE.PathCamera = function ( parameters ) {
 	THREE.Camera.call( this, parameters.fov, parameters.aspect, parameters.near, parameters.far, parameters.target );
 
 	this.id = "PathCamera" + THREE.PathCameraIdCounter ++;
-	
+
 	this.duration = 10 * 1000; // milliseconds
 	this.waypoints = [];
-	
+
 	this.useConstantSpeed = true;
 	this.resamplingCoef = 50;
-	
+
 	this.debugPath = new THREE.Object3D();
 	this.debugDummy = new THREE.Object3D();
 
@@ -56,7 +56,7 @@ THREE.PathCamera = function ( parameters ) {
 
 		if ( parameters.duration !== undefined ) this.duration = parameters.duration * 1000;
 		if ( parameters.waypoints !== undefined ) this.waypoints = parameters.waypoints;
-		
+
 		if ( parameters.useConstantSpeed !== undefined ) this.useConstantSpeed = parameters.useConstantSpeed;
 		if ( parameters.resamplingCoef !== undefined ) this.resamplingCoef = parameters.resamplingCoef;
 
@@ -93,7 +93,7 @@ THREE.PathCamera = function ( parameters ) {
 	this.update = function ( parentMatrixWorld, forceUpdate, camera ) {
 
 		var srcRange, dstRange;
-		
+
 		if( this.lookHorizontal ) this.lon += this.mouseX * this.lookSpeed;
 		if( this.lookVertical )   this.lat -= this.mouseY * this.lookSpeed;
 
@@ -105,29 +105,29 @@ THREE.PathCamera = function ( parameters ) {
 
 		this.phi = normalize_angle_rad( this.phi );
 
-		// constrain vertical look angle 
-		
+		// constrain vertical look angle
+
 		srcRange = this.verticalAngleMap.srcRange;
 		dstRange = this.verticalAngleMap.dstRange;
-		
-		this.phi = map_linear( this.phi, srcRange[ 0 ], srcRange[ 1 ], 
-										 dstRange[ 0 ], dstRange[ 1 ] );
+
+		this.phi = map_linear( this.phi, srcRange[ 0 ], srcRange[ 1 ], dstRange[ 0 ], dstRange[ 1 ] );
 
 		// constrain horizontal look angle
-		
+
 		srcRange = this.horizontalAngleMap.srcRange;
 		dstRange = this.horizontalAngleMap.dstRange;
-		
-		this.theta = map_linear( this.theta, srcRange[ 0 ], srcRange[ 1 ], 
-										     dstRange[ 0 ], dstRange[ 1 ] );
-		
+
+		this.theta = map_linear( this.theta, srcRange[ 0 ], srcRange[ 1 ], dstRange[ 0 ], dstRange[ 1 ] );
+
 		var targetPosition = this.target.position,
 			position = this.position;
-/*
+
+		/*
 		targetPosition.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
 		targetPosition.y = position.y + 100 * Math.cos( this.phi );
 		targetPosition.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
-*/
+		*/
+
 		targetPosition.x = 100 * Math.sin( this.phi ) * Math.cos( this.theta );
 		targetPosition.y = 100 * Math.cos( this.phi );
 		targetPosition.z = 100 * Math.sin( this.phi ) * Math.sin( this.theta );
@@ -135,42 +135,42 @@ THREE.PathCamera = function ( parameters ) {
 		this.supr.update.call( this, parentMatrixWorld, forceUpdate, camera );
 
 	};
-	
+
 	this.onMouseMove = function ( event ) {
 
 		this.mouseX = event.clientX - this.windowHalfX;
 		this.mouseY = event.clientY - this.windowHalfY;
 
 	};
-	
+
 	// utils
-	
+
 	function normalize_angle_rad( a ) {
-		
+
 		var b = a % PI2;
 		return b >= 0 ? b : b + PI2;
 
 	};
-	
+
 	function cap( x, a, b ) {
-	
+
 		return ( x < a ) ? a : ( ( x > b ) ? b : x );
 
 	};
-	
+
 	function map_linear( x, sa, sb, ea, eb ) {
-		
+
 		return ( x  - sa ) * ( eb - ea ) / ( sb - sa ) + ea;
-		
+
 	};
 
 
 	function distance( a, b ) {
-	
+
 		var dx = a[ 0 ] - b[ 0 ],
 			dy = a[ 1 ] - b[ 1 ],
 			dz = a[ 2 ] - b[ 2 ];
-		
+
 		return Math.sqrt( dx * dx + dy * dy + dz * dz );
 
 	};
@@ -197,7 +197,7 @@ THREE.PathCamera = function ( parameters ) {
 
 		};
 
-		var i, 
+		var i,
 			parentAnimation, childAnimation,
 			path = spline.getControlPointsArray(),
 			sl = spline.getLength(),
@@ -205,23 +205,23 @@ THREE.PathCamera = function ( parameters ) {
 			t = 0,
 			first = 0,
 			last  = pl - 1;
-		
+
 		parentAnimation = { parent: -1, keys: [] };
 		parentAnimation.keys[ first ] = { time: 0,        pos: path[ first ], rot: [ 0, 0, 0, 1 ], scl: [ 1, 1, 1 ] };
 		parentAnimation.keys[ last  ] = { time: duration, pos: path[ last ],  rot: [ 0, 0, 0, 1 ], scl: [ 1, 1, 1 ] };
-		
+
 		for ( i = 1; i < pl - 1; i++ ) {
 
 			// real distance (approximation via linear segments)
-			
+
 			t = duration * sl.chunks[ i ] / sl.total;
-			
+
 			// equal distance
-			
-			//t = duration * ( i / pl );			
-			
+
+			//t = duration * ( i / pl );
+
 			// linear distance
-			
+
 			//t += duration * distance( path[ i ], path[ i - 1 ] ) / sl.total;
 
 			parentAnimation.keys[ i ] = { time: t, pos: path[ i ] };
@@ -231,28 +231,28 @@ THREE.PathCamera = function ( parameters ) {
 		animationData.hierarchy[ 0 ] = parentAnimation;
 
 		THREE.AnimationHandler.add( animationData );
-		
+
 		return new THREE.Animation( parent, name, THREE.AnimationHandler.CATMULLROM_FORWARD, false );
 
 	};
 
 
 	function createSplineGeometry( spline, n_sub ) {
-	
+
 		var i, index, position,
 			geometry = new THREE.Geometry();
-		
+
 		for ( i = 0; i < spline.points.length * n_sub; i ++ ) {
-		
+
 			index = i / ( spline.points.length * n_sub );
 			position = spline.getPoint( index );
-			
+
 			geometry.vertices[ i ] = new THREE.Vertex( new THREE.Vector3( position.x, position.y, position.z ) );
 
 		}
-		
+
 		return geometry;
-	
+
 	};
 
 	function createPath( parent, spline ) {
@@ -262,57 +262,57 @@ THREE.PathCamera = function ( parameters ) {
 			lineMat = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 3 } );
 			lineObj = new THREE.Line( lineGeo, lineMat );
 			particleObj = new THREE.ParticleSystem( particleGeo, new THREE.ParticleBasicMaterial( { color: 0xffaa00, size: 3 } ) );
-			
+
 		lineObj.scale.set( 1, 1, 1 );
 		parent.addChild( lineObj );
 
 		particleObj.scale.set( 1, 1, 1 );
 		parent.addChild( particleObj );
-			
+
 		var waypoint,
 			geo = new Sphere( 1, 16, 8 ),
 			mat = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
-		
-		for( i = 0; i < spline.points.length; i++ ) {
-			
+
+		for ( i = 0; i < spline.points.length; i++ ) {
+
 			waypoint = new THREE.Mesh( geo, mat );
 			waypoint.position.copy( spline.points[ i ] );
 			waypoint.updateMatrix();
 			parent.addChild( waypoint );
-			
+
 		}
 
 	};
 
 	// constructor
-	
+
 	this.spline = new THREE.Spline();
 	this.spline.initFromArray( this.waypoints );
 
 	if ( this.useConstantSpeed ) {
-		
+
 		this.spline.reparametrizeByArcLength( this.resamplingCoef );
 
 	}
-	
+
 	if ( this.createDebugDummy ) {
 
 		var dummyParentMaterial = new THREE.MeshLambertMaterial( { color: 0x0077ff } ),
 		dummyChildMaterial  = new THREE.MeshLambertMaterial( { color: 0x00ff00 } ),
-		dummyParentGeo = new Cube( 10, 10, 20 ),
-		dummyChildGeo  = new Cube( 2, 2, 10 );
+		dummyParentGeo = new THREE.Cube( 10, 10, 20 ),
+		dummyChildGeo  = new THREE.Cube( 2, 2, 10 );
 
 		this.animationParent = new THREE.Mesh( dummyParentGeo, dummyParentMaterial );
 
 		var dummyChild = new THREE.Mesh( dummyChildGeo, dummyChildMaterial );
 		dummyChild.position.set( 0, 10, 0 );
-		
+
 		this.animation = initAnimationPath( this.animationParent, this.spline, this.id, this.duration );
 
 		this.animationParent.addChild( this );
 		this.animationParent.addChild( this.target );
 		this.animationParent.addChild( dummyChild );
-		
+
 	} else {
 
 		this.animation = initAnimationPath( this.animationParent, this.spline, this.id, this.duration );
@@ -322,17 +322,17 @@ THREE.PathCamera = function ( parameters ) {
 	}
 
 	if ( this.createDebugPath ) {
-		
+
 		createPath( this.debugPath, this.spline );
 
 	}
 
-	this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );	
-	
+	this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );
+
 };
 
 THREE.PathCamera.prototype = new THREE.Camera();
 THREE.PathCamera.prototype.constructor = THREE.PathCamera;
 THREE.PathCamera.prototype.supr = THREE.Camera.prototype;
 
-THREE.PathCameraIdCounter = 0;
+THREE.PathCameraIdCounter = 0;

+ 24 - 24
src/extras/cameras/QuakeCamera.js

@@ -20,7 +20,7 @@
  *  constrainVertical: <bool>,
  *  verticalMin: <float>,
  *  verticalMax: <float>,
- 
+
  *  heightSpeed: <bool>,
  *  heightCoef: <float>,
  *  heightMin: <float>,
@@ -50,7 +50,7 @@ THREE.QuakeCamera = function ( parameters ) {
 	this.constrainVertical = false;
 	this.verticalMin = 0;
 	this.verticalMax = 3.14;
-	
+
 	this.domElement = document;
 
 	if ( parameters ) {
@@ -68,7 +68,7 @@ THREE.QuakeCamera = function ( parameters ) {
 		if ( parameters.heightCoef !== undefined ) this.heightCoef = parameters.heightCoef;
 		if ( parameters.heightMin !== undefined ) this.heightMin = parameters.heightMin;
 		if ( parameters.heightMax !== undefined ) this.heightMax = parameters.heightMax;
-		
+
 		if ( parameters.constrainVertical !== undefined ) this.constrainVertical = parameters.constrainVertical;
 		if ( parameters.verticalMin !== undefined ) this.verticalMin = parameters.verticalMin;
 		if ( parameters.verticalMax !== undefined ) this.verticalMax = parameters.verticalMax;
@@ -160,7 +160,7 @@ THREE.QuakeCamera = function ( parameters ) {
 
 			case 39: /*right*/
 			case 68: /*D*/ this.moveRight = true; break;
-			
+
 			case 81: this.freeze = !this.freeze; break;
 
 		}
@@ -190,44 +190,44 @@ THREE.QuakeCamera = function ( parameters ) {
 	this.update = function() {
 
 		if ( !this.freeze ) {
-			
+
 
 			if ( this.heightSpeed ) {
-	
+
 				var y = clamp( this.position.y, this.heightMin, this.heightMax ),
 					delta = y - this.heightMin;
-	
+
 				this.autoSpeedFactor = delta * this.heightCoef;
-	
+
 			} else {
-	
+
 				this.autoSpeedFactor = 0.0;
-	
+
 			}
-	
+
 			if ( this.moveForward || this.autoForward ) this.translateZ( - ( this.movementSpeed + this.autoSpeedFactor ) );
 			if ( this.moveBackward ) this.translateZ( this.movementSpeed );
 			if ( this.moveLeft ) this.translateX( - this.movementSpeed );
 			if ( this.moveRight ) this.translateX( this.movementSpeed );
-	
+
 			var actualLookSpeed = this.lookSpeed;
-	
+
 			if ( !this.activeLook ) {
-	
+
 				actualLookSpeed = 0;
-	
+
 			}
-	
+
 			this.lon += this.mouseX * actualLookSpeed;
 			if( this.lookVertical ) this.lat -= this.mouseY * actualLookSpeed;
-	
+
 			this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
 			this.phi = ( 90 - this.lat ) * Math.PI / 180;
 			this.theta = this.lon * Math.PI / 180;
-	
+
 			var targetPosition = this.target.position,
 				position = this.position;
-	
+
 			targetPosition.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
 			targetPosition.y = position.y + 100 * Math.cos( this.phi );
 			targetPosition.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
@@ -243,9 +243,9 @@ THREE.QuakeCamera = function ( parameters ) {
 		if ( this.constrainVertical ) {
 
 			this.phi = map_linear( this.phi, 0, 3.14, this.verticalMin, this.verticalMax );
-			
+
 		}
-		
+
 		var targetPosition = this.target.position,
 			position = this.position;
 
@@ -277,11 +277,11 @@ THREE.QuakeCamera = function ( parameters ) {
 	};
 
 	function map_linear( x, sa, sb, ea, eb ) {
-		
+
 		return ( x  - sa ) * ( eb - ea ) / ( sb - sa ) + ea;
-		
+
 	};
-	
+
 	function clamp_bottom( x, a ) {
 
 		return x < a ? a : x;

+ 5 - 5
src/extras/geometries/Cube.js

@@ -3,10 +3,10 @@
  * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as
  */
 
-var Cube = function ( width, height, depth, segmentsWidth, segmentsHeight, segmentsDepth, materials, flipped, sides ) {
+THREE.Cube = function ( width, height, depth, segmentsWidth, segmentsHeight, segmentsDepth, materials, flipped, sides ) {
 
 	THREE.Geometry.call( this );
-	
+
 	var scope = this,
 	width_half = width / 2,
 	height_half = height / 2,
@@ -106,7 +106,7 @@ var Cube = function ( width, height, depth, segmentsWidth, segmentsHeight, segme
 			}
 
 		}
-		
+
 		for( iy = 0; iy < gridY; iy++ ) {
 
 			for( ix = 0; ix < gridX; ix++ ) {
@@ -182,5 +182,5 @@ var Cube = function ( width, height, depth, segmentsWidth, segmentsHeight, segme
 
 };
 
-Cube.prototype = new THREE.Geometry();
-Cube.prototype.constructor = Cube;
+THREE.Cube.prototype = new THREE.Geometry();
+THREE.Cube.prototype.constructor = THREE.Cube;

+ 3 - 3
src/extras/geometries/Cylinder.js

@@ -4,7 +4,7 @@
  * @author fuzzthink
  */
 
-var Cylinder = function ( numSegs, topRad, botRad, height, topOffset, botOffset ) {
+THREE.Cylinder = function ( numSegs, topRad, botRad, height, topOffset, botOffset ) {
 
 	THREE.Geometry.call( this );
 
@@ -119,5 +119,5 @@ var Cylinder = function ( numSegs, topRad, botRad, height, topOffset, botOffset
 
 };
 
-Cylinder.prototype = new THREE.Geometry();
-Cylinder.prototype.constructor = Cylinder;
+THREE.Cylinder.prototype = new THREE.Geometry();
+THREE.Cylinder.prototype.constructor = THREE.Cylinder;

+ 3 - 3
src/extras/geometries/Icosahedron.js

@@ -6,7 +6,7 @@
  * so it draws the entire texture on the seam-faces, I think...
  */
 
-var Icosahedron = function ( subdivisions ) {
+THREE.Icosahedron = function ( subdivisions ) {
 
 	var scope = this;
 	var tempScope = new THREE.Geometry();
@@ -173,5 +173,5 @@ var Icosahedron = function ( subdivisions ) {
 
 }
 
-Icosahedron.prototype = new THREE.Geometry();
-Icosahedron.prototype.constructor = Icosahedron;
+THREE.Icosahedron.prototype = new THREE.Geometry();
+THREE.Icosahedron.prototype.constructor = THREE.Icosahedron;

+ 3 - 3
src/extras/geometries/Lathe.js

@@ -2,7 +2,7 @@
  * @author astrodud / http://astrodud.isgreat.org/
  */
 
-function Lathe( points, steps, angle ) {
+THREE.Lathe = function ( points, steps, angle ) {
 
 	THREE.Geometry.call( this );
 
@@ -67,5 +67,5 @@ function Lathe( points, steps, angle ) {
 
 };
 
-Lathe.prototype = new THREE.Geometry();
-Lathe.prototype.constructor = Lathe;
+THREE.Lathe.prototype = new THREE.Geometry();
+THREE.Lathe.prototype.constructor = THREE.Lathe;

+ 4 - 4
src/extras/geometries/Plane.js

@@ -3,7 +3,7 @@
  * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
  */
 
-var Plane = function ( width, height, segmentsWidth, segmentsHeight ) {
+THREE.Plane = function ( width, height, segmentsWidth, segmentsHeight ) {
 
 	THREE.Geometry.call( this );
 
@@ -30,7 +30,7 @@ var Plane = function ( width, height, segmentsWidth, segmentsHeight ) {
 		}
 
 	}
-	
+
 	for( iy = 0; iy < gridY; iy++ ) {
 
 		for( ix = 0; ix < gridX; ix++ ) {
@@ -57,5 +57,5 @@ var Plane = function ( width, height, segmentsWidth, segmentsHeight ) {
 
 };
 
-Plane.prototype = new THREE.Geometry();
-Plane.prototype.constructor = Plane;
+THREE.Plane.prototype = new THREE.Geometry();
+THREE.Plane.prototype.constructor = THREE.Plane;

+ 3 - 3
src/extras/geometries/Sphere.js

@@ -3,7 +3,7 @@
  * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Sphere.as
  */
 
-var Sphere = function ( radius, segmentsWidth, segmentsHeight ) {
+THREE.Sphere = function ( radius, segmentsWidth, segmentsHeight ) {
 
 	THREE.Geometry.call( this );
 
@@ -111,5 +111,5 @@ var Sphere = function ( radius, segmentsWidth, segmentsHeight ) {
 
 };
 
-Sphere.prototype = new THREE.Geometry();
-Sphere.prototype.constructor = Sphere;
+THREE.Sphere.prototype = new THREE.Geometry();
+THREE.Sphere.prototype.constructor = THREE.Sphere;

+ 5 - 5
src/extras/geometries/Torus.js

@@ -3,7 +3,9 @@
  * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888
  */
 
-var Torus = function ( radius, tube, segmentsR, segmentsT ) {
+THREE.Torus = function ( radius, tube, segmentsR, segmentsT ) {
+
+	THREE.Geometry.call( this );
 
 	var scope = this;
 
@@ -13,8 +15,6 @@ var Torus = function ( radius, tube, segmentsR, segmentsT ) {
 	this.segmentsT = segmentsT || 6;
 
 	var temp_uv = [];
-	
-	THREE.Geometry.call( this );
 
 	for ( var j = 0; j <= this.segmentsR; ++j ) {
 
@@ -74,5 +74,5 @@ var Torus = function ( radius, tube, segmentsR, segmentsT ) {
 
 };
 
-Torus.prototype = new THREE.Geometry();
-Torus.prototype.constructor = Torus;
+THREE.Torus.prototype = new THREE.Geometry();
+THREE.Torus.prototype.constructor = THREE.Torus;

+ 5 - 4
src/extras/geometries/TorusKnot.js

@@ -3,11 +3,12 @@
  * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473
  */
 
-var TorusKnot = function ( radius, tube, segmentsR, segmentsT, p, q, heightScale ) {
+THREE.TorusKnot = function ( radius, tube, segmentsR, segmentsT, p, q, heightScale ) {
 
-	var scope = this;
 	THREE.Geometry.call( this );
 
+	var scope = this;
+
 	this.radius = radius || 200;
 	this.tube = tube || 40;
 	this.segmentsR = segmentsR || 64;
@@ -103,5 +104,5 @@ var TorusKnot = function ( radius, tube, segmentsR, segmentsT, p, q, heightScale
 
 };
 
-TorusKnot.prototype = new THREE.Geometry();
-TorusKnot.prototype.constructor = TorusKnot;
+THREE.TorusKnot.prototype = new THREE.Geometry();
+THREE.TorusKnot.prototype.constructor = THREE.TorusKnot;

+ 49 - 49
src/extras/io/BinaryLoader.js

@@ -5,7 +5,7 @@
 THREE.BinaryLoader = function ( showStatus ) {
 
 	THREE.Loader.call( this, showStatus );
-	
+
 };
 
 THREE.BinaryLoader.prototype = new THREE.Loader();
@@ -24,21 +24,21 @@ THREE.BinaryLoader.prototype = {
 	//		- texture_path (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
 
 	load: function( parameters ) {
-	
+
 		// #1 load JS part via web worker
 
 		//  This isn't really necessary, JS part is tiny,
 		//  could be done by more ordinary means.
 
 		var url = parameters.model,
-			callback = parameters.callback, 
+			callback = parameters.callback,
 		    texture_path = parameters.texture_path ? parameters.texture_path : THREE.Loader.prototype.extractUrlbase( url ),
 			bin_path = parameters.bin_path ? parameters.bin_path : THREE.Loader.prototype.extractUrlbase( url ),
 
 			s = (new Date).getTime(),
 			worker = new Worker( url ),
 			callback_progress = this.showProgress ? THREE.Loader.prototype.updateProgress : null;
-		
+
 		worker.onmessage = function( event ) {
 
 			var materials = event.data.materials,
@@ -47,8 +47,8 @@ THREE.BinaryLoader.prototype = {
 			// #2 load BIN part via Ajax
 
 			//  For some reason it is faster doing loading from here than from within the worker.
-			//  Maybe passing of ginormous string as message between threads is costly? 
-			//  Also, worker loading huge data by Ajax still freezes browser. Go figure, 
+			//  Maybe passing of ginormous string as message between threads is costly?
+			//  Also, worker loading huge data by Ajax still freezes browser. Go figure,
 			//  worker with baked ascii JSON data keeps browser more responsive.
 
 			THREE.BinaryLoader.prototype.loadAjaxBuffers( buffers, materials, callback, bin_path, texture_path, callback_progress );
@@ -79,9 +79,9 @@ THREE.BinaryLoader.prototype = {
 			url = bin_path + "/" + buffers;
 
 		var length = 0;
-		
+
 		xhr.onreadystatechange = function() {
-			
+
 			if ( xhr.readyState == 4 ) {
 
 				if ( xhr.status == 200 || xhr.status == 0 ) {
@@ -93,27 +93,27 @@ THREE.BinaryLoader.prototype = {
 					alert( "Couldn't load [" + url + "] [" + xhr.status + "]" );
 
 				}
-						
+
 			} else if ( xhr.readyState == 3 ) {
-				
+
 				if ( callback_progress ) {
-				
+
 					if ( length == 0 ) {
-						
+
 						length = xhr.getResponseHeader( "Content-Length" );
-						
+
 					}
-					
+
 					callback_progress( { total: length, loaded: xhr.responseText.length } );
-					
+
 				}
-				
+
 			} else if ( xhr.readyState == 2 ) {
-				
+
 				length = xhr.getResponseHeader( "Content-Length" );
-				
+
 			}
-			
+
 		}
 
 		xhr.open("GET", url, true);
@@ -130,7 +130,7 @@ THREE.BinaryLoader.prototype = {
 			//var s = (new Date).getTime();
 
 			var scope = this,
-				currentOffset = 0, 
+				currentOffset = 0,
 				md,
 				normals = [],
 				uvs = [],
@@ -152,14 +152,14 @@ THREE.BinaryLoader.prototype = {
 			currentOffset += md.header_bytes;
 
 			// cache offsets
-			
-			tri_b   = md.vertex_index_bytes, 
-			tri_c   = md.vertex_index_bytes*2, 
+
+			tri_b   = md.vertex_index_bytes,
+			tri_c   = md.vertex_index_bytes*2,
 			tri_m   = md.vertex_index_bytes*3,
 			tri_na  = md.vertex_index_bytes*3 + md.material_index_bytes,
 			tri_nb  = md.vertex_index_bytes*3 + md.material_index_bytes + md.normal_index_bytes,
 			tri_nc  = md.vertex_index_bytes*3 + md.material_index_bytes + md.normal_index_bytes*2,
-		
+
 			quad_b  = md.vertex_index_bytes,
 			quad_c  = md.vertex_index_bytes*2,
 			quad_d  = md.vertex_index_bytes*3,
@@ -168,16 +168,16 @@ THREE.BinaryLoader.prototype = {
 			quad_nb = md.vertex_index_bytes*4 + md.material_index_bytes + md.normal_index_bytes,
 			quad_nc = md.vertex_index_bytes*4 + md.material_index_bytes + md.normal_index_bytes*2,
 			quad_nd = md.vertex_index_bytes*4 + md.material_index_bytes + md.normal_index_bytes*3,
-		
+
 			tri_uvb = md.uv_index_bytes,
 			tri_uvc = md.uv_index_bytes * 2,
-		
+
 			quad_uvb = md.uv_index_bytes,
 			quad_uvc = md.uv_index_bytes * 2,
 			quad_uvd = md.uv_index_bytes * 3;
-			
+
 			// buffers sizes
-			
+
 			tri_size =  md.vertex_index_bytes * 3 + md.material_index_bytes;
 			quad_size = md.vertex_index_bytes * 4 + md.material_index_bytes;
 
@@ -190,18 +190,18 @@ THREE.BinaryLoader.prototype = {
 			len_quad_smooth    = md.nquad_smooth    * ( quad_size + md.normal_index_bytes * 4 );
 			len_quad_flat_uv   = md.nquad_flat_uv   * ( quad_size + md.uv_index_bytes * 4 );
 			len_quad_smooth_uv = md.nquad_smooth_uv * ( quad_size + md.normal_index_bytes * 4 + md.uv_index_bytes * 4 );
-			
+
 			// read buffers
-			
+
 			currentOffset += init_vertices( currentOffset );
 			currentOffset += init_normals( currentOffset );
 			currentOffset += init_uvs( currentOffset );
 
-			start_tri_flat 		= currentOffset; 
+			start_tri_flat 		= currentOffset;
 			start_tri_smooth    = start_tri_flat    + len_tri_flat;
 			start_tri_flat_uv   = start_tri_smooth  + len_tri_smooth;
 			start_tri_smooth_uv = start_tri_flat_uv + len_tri_flat_uv;
-			
+
 			start_quad_flat     = start_tri_smooth_uv + len_tri_smooth_uv;
 			start_quad_smooth   = start_quad_flat     + len_quad_flat;
 			start_quad_flat_uv  = start_quad_smooth   + len_quad_smooth;
@@ -209,7 +209,7 @@ THREE.BinaryLoader.prototype = {
 
 			// have to first process faces with uvs
 			// so that face and uv indices match
-			
+
 			init_triangles_flat_uv( start_tri_flat_uv );
 			init_triangles_smooth_uv( start_tri_smooth_uv );
 
@@ -217,7 +217,7 @@ THREE.BinaryLoader.prototype = {
 			init_quads_smooth_uv( start_quad_smooth_uv );
 
 			// now we can process untextured faces
-			
+
 			init_triangles_flat( start_tri_flat );
 			init_triangles_smooth( start_tri_smooth );
 
@@ -366,7 +366,7 @@ THREE.BinaryLoader.prototype = {
 
 			function init_vertices( start ) {
 
-				var i, x, y, z, 
+				var i, x, y, z,
 					stride = md.vertex_coordinate_bytes * 3,
 					end = start + md.nvertices * stride;
 
@@ -386,7 +386,7 @@ THREE.BinaryLoader.prototype = {
 
 			function init_normals( start ) {
 
-				var i, x, y, z, 
+				var i, x, y, z,
 					stride = md.normal_coordinate_bytes * 3,
 					end = start + md.nnormals * stride;
 
@@ -406,7 +406,7 @@ THREE.BinaryLoader.prototype = {
 
 			function init_uvs( start ) {
 
-				var i, u, v, 
+				var i, u, v,
 					stride = md.uv_coordinate_bytes * 2,
 					end = start + md.nuvs * stride;
 
@@ -418,11 +418,11 @@ THREE.BinaryLoader.prototype = {
 					uvs.push( u, v );
 
 				}
-				
+
 				return md.nuvs * stride;
 
-			}			
-			
+			}
+
 			function add_tri( i ) {
 
 				var a, b, c, m;
@@ -648,7 +648,7 @@ THREE.BinaryLoader.prototype = {
 
 			function init_quads_smooth_uv( start ) {
 
-				var i, offset = md.vertex_index_bytes * 4 + md.material_index_bytes + md.normal_index_bytes * 4, 
+				var i, offset = md.vertex_index_bytes * 4 + md.material_index_bytes + md.normal_index_bytes * 4,
 					stride =  offset + md.uv_index_bytes * 4,
 					end = start + md.nquad_smooth_uv * stride;
 
@@ -678,7 +678,7 @@ THREE.BinaryLoader.prototype = {
 		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 
 	},
-	
+
 	f3: function( scope, a, b, c, mi ) {
 
 		var material = scope.materials[ mi ];
@@ -708,9 +708,9 @@ THREE.BinaryLoader.prototype = {
 			ncy = normals[ nc*3 + 1 ],
 			ncz = normals[ nc*3 + 2 ];
 
-		scope.faces.push( new THREE.Face3( a, b, c, 
-						  [new THREE.Vector3( nax, nay, naz ), 
-						   new THREE.Vector3( nbx, nby, nbz ), 
+		scope.faces.push( new THREE.Face3( a, b, c,
+						  [new THREE.Vector3( nax, nay, naz ),
+						   new THREE.Vector3( nbx, nby, nbz ),
 						   new THREE.Vector3( ncx, ncy, ncz )],
 						  null,
 						  material ) );
@@ -737,9 +737,9 @@ THREE.BinaryLoader.prototype = {
 			ndz = normals[ nd*3 + 2 ];
 
 		scope.faces.push( new THREE.Face4( a, b, c, d,
-						  [new THREE.Vector3( nax, nay, naz ), 
-						   new THREE.Vector3( nbx, nby, nbz ), 
-						   new THREE.Vector3( ncx, ncy, ncz ), 
+						  [new THREE.Vector3( nax, nay, naz ),
+						   new THREE.Vector3( nbx, nby, nbz ),
+						   new THREE.Vector3( ncx, ncy, ncz ),
 						   new THREE.Vector3( ndx, ndy, ndz )],
 						  null,
 						  material ) );
@@ -767,4 +767,4 @@ THREE.BinaryLoader.prototype = {
 
 	}
 
-};	
+};

+ 12 - 12
src/extras/io/JSONLoader.js

@@ -77,9 +77,9 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		var i, j, fi,
 
 		offset, zLength, nVertices,
-		
+
 		colorIndex, normalIndex, uvIndex, materialIndex,
-		
+
 		type,
 		isQuad, 
 		hasMaterial, 
@@ -88,7 +88,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		hasFaceColor, hasFaceVertexColor,
 
 		vertex, face, color, normal,
-		
+
 		uvLayer, uvs, u, v,
 
 		faces = json.faces,
@@ -97,7 +97,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		colors = json.colors,
 
 		scale = ( json.scale !== undefined ) ? json.scale : 1.0,
-		
+
 		nUvLayers = 0;
 
 		// disregard empty arrays
@@ -293,7 +293,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 		if ( json.skinWeights ) {
 
-			for( i = 0, l = json.skinWeights.length; i < l; i += 2 ) {
+			for ( i = 0, l = json.skinWeights.length; i < l; i += 2 ) {
 
 				x = json.skinWeights[ i     ];
 				y = json.skinWeights[ i + 1 ];
@@ -308,7 +308,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 		if ( json.skinIndices ) {
 
-			for( i = 0, l = json.skinIndices.length; i < l; i += 2 ) {
+			for ( i = 0, l = json.skinIndices.length; i < l; i += 2 ) {
 
 				a = json.skinIndices[ i     ];
 				b = json.skinIndices[ i + 1 ];
@@ -328,11 +328,11 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	function init_morphing() {
 
-		if( json.morphTargets !== undefined ) {
+		if ( json.morphTargets !== undefined ) {
 
 			var i, l, v, vl, dstVertices, srcVertices;
 
-			for( i = 0, l = json.morphTargets.length; i < l; i++ ) {
+			for ( i = 0, l = json.morphTargets.length; i < l; i++ ) {
 
 				geometry.morphTargets[ i ] = {};
 				geometry.morphTargets[ i ].name = json.morphTargets[ i ].name;
@@ -350,12 +350,12 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 			} 
 
 		}
-		
-		if( json.morphColors !== undefined ) {
+
+		if ( json.morphColors !== undefined ) {
 
 			var i, l, c, cl, dstColors, srcColors, color;
 
-			for( i = 0, l = json.morphColors.length; i < l; i++ ) {
+			for ( i = 0, l = json.morphColors.length; i < l; i++ ) {
 
 				geometry.morphColors[ i ] = {};
 				geometry.morphColors[ i ].name = json.morphColors[ i ].name;
@@ -364,7 +364,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 				dstColors = geometry.morphColors[ i ].colors;
 				srcColors = json.morphColors [ i ].colors;
 
-				for( c = 0, cl = srcColors.length; c < cl; c += 3 ) {
+				for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {
 
 					color = new THREE.Color( 0xffaa00 );
 					color.setRGB( srcColors[ v ], srcColors[ v + 1 ], srcColors[ v + 2 ] );

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio