Browse Source

Merged with mrdoob's skinning branch.

Not fully tested (need to update bookmarks yet again), but random sample of examples seem to work ;).
alteredq 14 years ago
parent
commit
d05053c493
89 changed files with 841 additions and 637 deletions
  1. 19 19
      build/Three.js
  2. 20 20
      build/ThreeExtras.js
  3. 0 0
      examples/canvas_camera_orthographic.html
  4. 0 0
      examples/canvas_geometry_birds.html
  5. 0 0
      examples/canvas_geometry_cube.html
  6. 0 0
      examples/canvas_geometry_earth.html
  7. 0 0
      examples/canvas_geometry_panorama.html
  8. 0 0
      examples/canvas_geometry_panorama_fisheye.html
  9. 0 0
      examples/canvas_geometry_terrain.html
  10. 0 0
      examples/canvas_interactive_cubes.html
  11. 0 0
      examples/canvas_interactive_cubes_tween.html
  12. 0 0
      examples/canvas_interactive_voxelpainter.html
  13. 0 0
      examples/canvas_lights_pointlights.html
  14. 0 0
      examples/canvas_lights_pointlights_smooth.html
  15. 0 0
      examples/canvas_lines.html
  16. 0 0
      examples/canvas_lines_sphere.html
  17. 0 0
      examples/canvas_materials.html
  18. 0 0
      examples/canvas_materials_depth.html
  19. 0 0
      examples/canvas_materials_normal.html
  20. 0 0
      examples/canvas_materials_reflection.html
  21. 0 0
      examples/canvas_materials_video.html
  22. 0 0
      examples/canvas_particles_floor.html
  23. 0 0
      examples/canvas_particles_random.html
  24. 0 0
      examples/canvas_particles_sprites.html
  25. 0 0
      examples/canvas_particles_waves.html
  26. 216 0
      examples/canvas_performance.html
  27. 3 2
      examples/canvas_sandbox.html
  28. 0 0
      examples/misc_lights_test.html
  29. 0 0
      examples/misc_materials_multimaterials.html
  30. 0 0
      examples/misc_uqbiquity_test.html
  31. 1 1
      examples/misc_webglrenderer2_sandbox.html
  32. 0 0
      examples/webgl_geometry_blenderexport_colors.html
  33. 0 0
      examples/webgl_geometry_colors.html
  34. 0 0
      examples/webgl_geometry_dynamic.html
  35. 0 0
      examples/webgl_geometry_large_mesh.html
  36. 0 0
      examples/webgl_geometry_minecraft.html
  37. 0 0
      examples/webgl_geometry_minecraft_ao.html
  38. 0 0
      examples/webgl_geometry_terrain.html
  39. 0 0
      examples/webgl_geometry_terrain2.html
  40. 0 0
      examples/webgl_geometry_terrain_fog.html
  41. 0 0
      examples/webgl_hdr.html
  42. 0 0
      examples/webgl_interactive_voxelpainter.html
  43. 0 0
      examples/webgl_lights_pointlights.html
  44. 0 0
      examples/webgl_lines_colors.html
  45. 0 0
      examples/webgl_lines_cubes.html
  46. 0 0
      examples/webgl_lines_sphere.html
  47. 0 0
      examples/webgl_materials.html
  48. 0 0
      examples/webgl_materials_cars.html
  49. 0 0
      examples/webgl_materials_cars_camaro.html
  50. 0 0
      examples/webgl_materials_cubemap.html
  51. 0 0
      examples/webgl_materials_cubemap_balls_reflection.html
  52. 0 0
      examples/webgl_materials_cubemap_balls_refraction.html
  53. 0 0
      examples/webgl_materials_cubemap_escher.html
  54. 0 0
      examples/webgl_materials_cubemap_refraction.html
  55. 0 0
      examples/webgl_materials_grass.html
  56. 0 0
      examples/webgl_materials_normalmap.html
  57. 0 0
      examples/webgl_materials_normalmap2.html
  58. 0 0
      examples/webgl_materials_shaders.html
  59. 4 4
      examples/webgl_materials_shaders_fresnel.html
  60. 0 0
      examples/webgl_objconvert_test.html
  61. 0 0
      examples/webgl_particles_billboards.html
  62. 0 0
      examples/webgl_particles_billboards_colors.html
  63. 0 0
      examples/webgl_particles_random.html
  64. 0 0
      examples/webgl_particles_sprites.html
  65. 0 0
      examples/webgl_postprocessing.html
  66. 86 86
      examples/webgl_ribbons.html
  67. 0 0
      examples/webgl_rtt.html
  68. 111 111
      examples/webgl_scene_test.html
  69. 0 0
      examples/webgl_shader.html
  70. 0 0
      examples/webgl_shader2.html
  71. 5 5
      src/animation/Animation.js
  72. 32 40
      src/cameras/Camera.js
  73. 16 16
      src/core/Color.js
  74. 36 38
      src/core/Matrix4.js
  75. 3 3
      src/core/Ray.js
  76. 1 1
      src/extras/GeometryUtils.js
  77. 5 5
      src/objects/Bone.js
  78. 3 3
      src/objects/LOD.js
  79. 3 3
      src/objects/Mesh.js
  80. 56 56
      src/objects/Object3D.js
  81. 1 1
      src/objects/Particle.js
  82. 3 3
      src/objects/SkinnedMesh.js
  83. 2 2
      src/renderers/CanvasRenderer.js
  84. 14 14
      src/renderers/Projector.js
  85. 196 196
      src/renderers/WebGLRenderer.js
  86. 2 2
      src/renderers/WebGLRenderer2.js
  87. 1 3
      utils/build.bat
  88. 2 2
      utils/build.py
  89. 0 1
      utils/build.sh

+ 19 - 19
build/Three.js

@@ -1,7 +1,7 @@
 // Three.js r32 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
-THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,n,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);n=a*6-l;a=d*(1-b);k=d*(1-b*n);b=d*(1-b*(1-n));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
-setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
+var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,n,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);n=a*6-l;a=d*(1-b);k=d*(1-b*n);b=d*(1-b*(1-n));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();
+this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
 this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
@@ -14,7 +14,7 @@ THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(H,r,Z,E){E=E.clone().subSelf(r);Z=Z.clone().subSelf(r);var L=H.clone().subSelf(r);H=E.dot(E);r=E.dot(Z);E=E.dot(L);var c=Z.dot(Z);Z=Z.dot(L);L=1/(H*c-r*r);c=(c*E-r*Z)*L;H=(H*Z-r*E)*L;return c>0&&H>0&&c+H<1}var d,e,g,i,l,n,k,o,s,w,
-u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];w=this.origin.clone();u=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());n=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;o=a.rotationMatrix.multiplyVector3(g.normal.clone());s=u.dot(o);if(s<0){o=o.dot((new THREE.Vector3).sub(i,
+u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];w=this.origin.clone();u=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.matrixRotation);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());n=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;o=a.matrixRotation.multiplyVector3(g.normal.clone());s=u.dot(o);if(s<0){o=o.dot((new THREE.Vector3).sub(i,
 w))/s;w=w.addSelf(u.multiplyScalar(o));if(g instanceof THREE.Face3){if(b(w,i,l,n)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,n,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}}return I}};
 THREE.Rectangle=function(){function a(){i=e-b;l=g-d}var b,d,e,g,i,l,n=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,o,s,w){n=!1;b=k;d=o;e=s;g=w;a()};this.addPoint=function(k,o){if(n){n=!1;b=k;d=o;e=k;g=o}else{b=b<k?b:k;d=d<o?d:o;e=e>k?e:k;g=g>o?g:o}a()};
 this.add3Points=function(k,o,s,w,u,x){if(n){n=!1;b=k<s?k<u?k:u:s<u?s:u;d=o<w?o<x?o:x:w<x?w:x;e=k>s?k>u?k:u:s>u?s:u;g=o>w?o>x?o:x:w>x?w:x}else{b=k<s?k<u?k<b?k:b:u<b?u:b:s<u?s<b?s:b:u<b?u:b;d=o<w?o<x?o<d?o:d:x<d?x:d:w<x?w<d?w:d:x<d?x:d;e=k>s?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=o>w?o>x?o>g?o:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();e=e>k.getRight()?
@@ -67,19 +67,19 @@ z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(d=s.length;b<d;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,d,e,g,i,l,n,k,o={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
 l=i.materials;n=a(l);o[n]==undefined&&(o[n]={hash:n,counter:0});k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){o[n].counter+=1;k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
-new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,d)}};
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
+1;this.visible=!0};THREE.Object3D.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,d)}};
 THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
+THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Mesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
+THREE.Mesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,d){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.globalMatrix,!0,d)}}else for(e=
-0;e<g;e++)this.children[e].update(this.skinMatrix,b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.globalMatrix,!0,d)}}else for(e=0;e<
+g;e++)this.children[e].update(this.skinMatrix,b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
 THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,i,l,n;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];i=g.pos;l=g.rotq;n=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);n!==undefined?e.scale.set(n[0],n[1],n[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];e=this.bones[d];
 g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.globalMatrix,b,d)}}};
+THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.globalMatrix,b,d)}}};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
 e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
@@ -87,16 +87,16 @@ THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materi
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(d){for(var e=0;e<a.length;e++)a[e].update(d)};b.add=function(d){a.indexOf(d)===-1&&a.push(d)};b.remove=function(d){a.indexOf(d)!==-1&&a.splice(childIndex,1)};b.initData=function(d){if(d.initialized!==!0){for(var e=0;e<d.hierarchy.length;e++)for(var g=0;g<d.hierarchy[e].keys.length;g++){if(d.hierarchy[e].keys[g].time<0)d.hierarchy[e].keys[g].time=0;d.hierarchy[e].keys[g].index=g;if(d.hierarchy[e].keys[g].rot!==undefined&&!(d.hierarchy[e].keys[g].rot instanceof
 THREE.Quaternion)){var i=d.hierarchy[e].keys[g].rot;d.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(d.length*d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(e=0;e<d.hierarchy.length;e++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};return b}();
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var d=0;d<this.root.bones.length;d++)this.hierarchy.push(this.root.bones[d])};
-THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
+THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
 THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,d,e,g,i,l,n=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,o=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(n[s][l]!==
-undefined){i.skinMatrix=n[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var u=0;u<3;u++){d=a[u];e=i.prevKey[d];g=i.nextKey[d];if(g.time<o){if(k<o)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(d,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(d,s,g.index+1)}while(g.time<k)}i.prevKey[d]=e;i.nextKey[d]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[d];
-g=g[d];if(d==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)n[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
+undefined){i.skinMatrix=n[s][l];i.matrixAutoUpdate=!1;i.matrixNeedsUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var u=0;u<3;u++){d=a[u];e=i.prevKey[d];g=i.nextKey[d];if(g.time<o){if(k<o)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(d,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(d,s,g.index+1)}while(g.time<k)}i.prevKey[d]=e;i.nextKey[d]=g}i.matrixAutoUpdate=!0;i.matrixNeedsUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[d];g=
+g[d];if(d==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)n[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
 THREE.Animation.prototype.getNextKeyWith=function(a,b,d){for(var e=this.data.hierarchy[b].keys;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
 THREE.Camera=function(a,b,d,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=d||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
-THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
+THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)};
 THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,d=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*d+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var n=this.projectionMatrix,k=1/(n.n43*l),o=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*n.n11*o;i=n.n11*i*o;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*n.n22*k*this.screenCenterY;
 if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
@@ -144,8 +144,8 @@ THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light
 THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Projector=function(){function a(T,O){return O.z-T.z}function b(T,O){var ca=0,S=1,ba=T.z+T.w,V=O.z+O.w,D=-T.z+T.w,J=-O.z+O.w;if(ba>=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(S<ca)return!1;else{T.lerpSelf(O,ca);O.lerpSelf(T,1-S);return!0}}}var d,e,g=[],i,l,n,k=[],o,s,w=[],u,x,F=[],I=new THREE.Vector4,H=new THREE.Vector4,r=new THREE.Matrix4,
 Z=new THREE.Matrix4,E=[],L=new THREE.Vector4,c=new THREE.Vector4,ia;this.projectObjects=function(T,O,ca){O=[];var S,ba,V;e=0;ba=T.objects;T=0;for(S=ba.length;T<S;T++){V=ba[T];var D;if(!(D=!V.visible))if(D=V instanceof THREE.Mesh){a:{D=void 0;for(var J=V.globalMatrix,la=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),Q=0;Q<6;Q++){D=E[Q].x*J.n14+E[Q].y*J.n24+E[Q].z*J.n34+E[Q].w;if(D<=la){D=!1;break a}}D=!0}D=!D}if(!D){d=g[e]=g[e]||new THREE.RenderableObject;I.copy(V.position);
-r.multiplyVector3(I);d.object=V;d.z=I.z;O.push(d);e++}}ca&&O.sort(a);return O};this.projectScene=function(T,O,ca){var S=[],ba=O.near,V=O.far,D,J,la,Q,ja,ea,R,ra,wa,f,m,p,j,h,q,t;n=s=x=0;O.autoUpdateMatrix&&O.update();r.multiply(O.projectionMatrix,O.globalMatrix);E[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);E[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);E[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);E[3]=new THREE.Vector4(r.n41-
-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);E[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);E[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);D=0;for(ea=E.length;D<ea;D++){R=E[D];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}T.update(undefined,!1,O);ea=this.projectObjects(T,O,!0);T=0;for(D=ea.length;T<D;T++){R=ea[T].object;if(R.visible){R.autoUpdateMatrix&&R.updateMatrix();ra=R.globalMatrix;ra.extractRotationMatrix(R.rotationMatrix);m=R.rotationMatrix;
+r.multiplyVector3(I);d.object=V;d.z=I.z;O.push(d);e++}}ca&&O.sort(a);return O};this.projectScene=function(T,O,ca){var S=[],ba=O.zNear,V=O.zFar,D,J,la,Q,ja,ea,R,ra,wa,f,m,p,j,h,q,t;n=s=x=0;O.matrixAutoUpdate&&O.update();r.multiply(O.projectionMatrix,O.globalMatrix);E[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);E[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);E[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);E[3]=new THREE.Vector4(r.n41-
+r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);E[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);E[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);D=0;for(ea=E.length;D<ea;D++){R=E[D];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}T.update(undefined,!1,O);ea=this.projectObjects(T,O,!0);T=0;for(D=ea.length;T<D;T++){R=ea[T].object;if(R.visible){R.matrixAutoUpdate&&R.updateMatrix();ra=R.globalMatrix;ra.extractRotationMatrix(R.matrixRotation);m=R.matrixRotation;
 wa=R.materials;f=R.overdraw;if(R instanceof THREE.Mesh){p=R.geometry;j=p.vertices;J=0;for(la=j.length;J<la;J++){h=j[J];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);Q=h.positionScreen;Q.copy(h.positionWorld);r.multiplyVector4(Q);Q.x/=Q.w;Q.y/=Q.w;h.__visible=Q.z>ba&&Q.z<V}p=p.faces;J=0;for(la=p.length;J<la;J++){h=p[J];if(h instanceof THREE.Face3){Q=j[h.a];ja=j[h.b];q=j[h.c];if(Q.__visible&&ja.__visible&&q.__visible&&(R.doubleSided||R.flipSided!=(q.positionScreen.x-Q.positionScreen.x)*
 (ja.positionScreen.y-Q.positionScreen.y)-(q.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0)){i=k[n]=k[n]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);m.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
 ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ia=i.vertexNormalsWorld;Q=0;for(ja=q.length;Q<ja;Q++){t=ia[Q]=ia[Q]||new THREE.Vector3;t.copy(q[Q]);m.multiplyVector3(t)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][2]}S.push(i);n++}}else if(h instanceof THREE.Face4){Q=j[h.a];
@@ -225,9 +225,9 @@ light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLi
 q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
 c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+m));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(m=p.length;W<
 m;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(m=p.length;W<m;W++){h=p[W];j.attributes[h]=c.getAttribLocation(j,h)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
-0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,m,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;m.autoUpdateMatrix&&m.update();m.globalMatrix.flattenToArray(ja);m.projectionMatrix.flattenToArray(la);m.inverseMatrix.flattenToArray(Q);J.multiply(m.projectionMatrix,m.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,m,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;m.matrixAutoUpdate&&m.update();m.globalMatrix.flattenToArray(ja);m.projectionMatrix.flattenToArray(la);m.inverseMatrix.flattenToArray(Q);J.multiply(m.projectionMatrix,m.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update();
 f.update(undefined,!1,m);this.initWebGLObjects(f,m);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];M=h.object;if(M.visible)if(!(M instanceof THREE.Mesh)||o(M)){M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,m);u(h);h.render=!0;if(this.sortObjects){ea.copy(M.position);J.multiplyVector3(ea);h.z=ea.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);G=f.__webGLObjectsImmediate.length;for(j=0;j<
-G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){M.autoUpdateMatrix&&M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,m);w(h)}}H(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];n(A.depth_test);g(m,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];n(A.depth_test);q=e(m,aa,da,A,M);M.render(function(ua){i(ua,
+G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){M.matrixAutoUpdate&&M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,m);w(h)}}H(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];n(A.depth_test);g(m,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];n(A.depth_test);q=e(m,aa,da,A,M);M.render(function(ua){i(ua,
 q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);n(A.depth_test);g(m,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);n(A.depth_test);q=e(m,aa,da,A,M);M.render(function(ua){i(ua,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);
 c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var m,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}m=0;for(p=f.objects.length;m<p;m++){j=f.objects[m];var h=f,q=void 0,t=void 0,A=void 0,W=void 0;t=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
 j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in t.geometryChunks){A=t.geometryChunks[q];if(!A.__webGLVertexBuffer){h=A;h.__webGLVertexBuffer=c.createBuffer();h.__webGLNormalBuffer=c.createBuffer();h.__webGLTangentBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h.__webGLUVBuffer=c.createBuffer();h.__webGLUV2Buffer=c.createBuffer();h.__webGLSkinVertexABuffer=

+ 20 - 20
build/ThreeExtras.js

@@ -1,7 +1,7 @@
 // ThreeExtras.js r32 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
-THREE.Color.prototype={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 d,f,g,h,k,j;if(c==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
-setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
+var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
+THREE.Color.prototype={autoUpdate:!0,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 d,f,g,h,k,j;if(c==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();
+this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
 this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
@@ -14,7 +14,7 @@ THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,v,I,q){q=q.clone().subSelf(v);I=I.clone().subSelf(v);var J=F.clone().subSelf(v);F=q.dot(q);v=q.dot(I);q=q.dot(J);var e=I.dot(I);I=I.dot(J);J=1/(F*e-v*v);e=(e*q-v*I)*J;F=(F*I-v*q)*J;return e>0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w,
-u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.rotationMatrix);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
+u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.matrixRotation);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotation.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
 w))/o;w=w.addSelf(u.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
 THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,w){k=!1;b=j;c=m;d=o;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
 this.add3Points=function(j,m,o,w,u,t){if(k){k=!1;b=j<o?j<u?j:u:o<u?o:u;c=m<w?m<t?m:t:w<t?w:t;d=j>o?j>u?j:u:o>u?o:u;f=m>w?m>t?m:t:w>t?w:t}else{b=j<o?j<u?j<b?j:b:u<b?u:b:o<u?o<b?o:b:u<b?u:b;c=m<w?m<t?m<c?m:c:t<c?t:c:w<t?w<c?w:c:t<c?t:c;d=j>o?j>u?j>d?j:d:u>d?u:d:o>u?o>d?o:d:u>d?u:d;f=m>w?m>t?m>f?m:f:t>f?t:f:w>t?w>f?w:f:t>f?t:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
@@ -67,19 +67,19 @@ z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(o){var w=[];b=0;for(c=o.length;b<c;b++)o[b]==undefined?w.push("undefined"):w.push(o[b].id);return w.join("_")}var b,c,d,f,g,h,k,j,m={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];
 h=g.materials;k=a(h);m[k]==undefined&&(m[k]={hash:k,counter:0});j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0});g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+g>65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0})}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
-new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
+1;this.visible=!0};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
 THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
+THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Mesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
+THREE.Mesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(d=
-0;d<f;d++)this.children[d].update(this.skinMatrix,b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(d=0;d<
+f;d++)this.children[d].update(this.skinMatrix,b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
 THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,k;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];g=f.pos;h=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];d=this.bones[c];
 f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
+THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
 d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
@@ -87,16 +87,16 @@ THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materi
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
 THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
-THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
+THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
 THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,w=this.hierarchy.length;o<w;o++){g=this.hierarchy[o];if(k[o][h]!==
-undefined){g.skinMatrix=k[o][h];g.autoUpdateMatrix=!1;g.matrixNeedsToUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.autoUpdateMatrix=!0;g.matrixNeedsToUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];
-f=f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
+undefined){g.skinMatrix=k[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=
+f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
 THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Camera=function(a,b,c,d,f,g){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
 THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.zNear)return!1;if(h+g<-this.zFar)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,o=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(o+g<-this.screenCenterX)return!1;if(o-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
 if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(o,b,h,g);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
@@ -144,8 +144,8 @@ THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light
 THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Projector=function(){function a(L,M){return M.z-L.z}function b(L,M){var V=0,S=1,Y=L.z+L.w,Z=M.z+M.w,G=-L.z+L.w,U=-M.z+M.w;if(Y>=0&&Z>=0&&G>=0&&U>=0)return!0;else if(Y<0&&Z<0||G<0&&U<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-U));else U<0&&(S=Math.min(S,G/(G-U)));if(S<V)return!1;else{L.lerpSelf(M,V);M.lerpSelf(L,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,w=[],u,t,x=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,I=new THREE.Matrix4,
 q=[],J=new THREE.Vector4,e=new THREE.Vector4,ba;this.projectObjects=function(L,M,V){M=[];var S,Y,Z;d=0;Y=L.objects;L=0;for(S=Y.length;L<S;L++){Z=Y[L];var G;if(!(G=!Z.visible))if(G=Z instanceof THREE.Mesh){a:{G=void 0;for(var U=Z.globalMatrix,na=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),W=0;W<6;W++){G=q[W].x*U.n14+q[W].y*U.n24+q[W].z*U.n34+q[W].w;if(G<=na){G=!1;break a}}G=!0}G=!G}if(!G){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(Z.position);v.multiplyVector3(A);
-c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.near,Z=M.far,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H;k=o=t=0;M.autoUpdateMatrix&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);q[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,
-v.n43-v.n23,v.n44-v.n24);q[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);G=0;for(ia=q.length;G<ia;G++){$=q[G];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(G=ia.length;L<G;L++){$=ia[L].object;if($.visible){$.autoUpdateMatrix&&$.updateMatrix();ra=$.globalMatrix;ra.extractRotationMatrix($.rotationMatrix);z=$.rotationMatrix;ya=$.materials;
+c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.zNear,Z=M.zFar,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H;k=o=t=0;M.matrixAutoUpdate&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);q[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,
+v.n43-v.n23,v.n44-v.n24);q[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);G=0;for(ia=q.length;G<ia;G++){$=q[G];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(G=ia.length;L<G;L++){$=ia[L].object;if($.visible){$.matrixAutoUpdate&&$.updateMatrix();ra=$.globalMatrix;ra.extractRotationMatrix($.matrixRotation);z=$.matrixRotation;ya=$.materials;
 l=$.overdraw;if($ instanceof THREE.Mesh){C=$.geometry;p=C.vertices;U=0;for(na=p.length;U<na;U++){n=p[U];n.positionWorld.copy(n.position);ra.multiplyVector3(n.positionWorld);W=n.positionScreen;W.copy(n.positionWorld);v.multiplyVector4(W);W.x/=W.w;W.y/=W.w;n.__visible=W.z>Y&&W.z<Z}C=C.faces;U=0;for(na=C.length;U<na;U++){n=C[U];if(n instanceof THREE.Face3){W=p[n.a];ka=p[n.b];B=p[n.c];if(W.__visible&&ka.__visible&&B.__visible&&($.doubleSided||$.flipSided!=(B.positionScreen.x-W.positionScreen.x)*(ka.positionScreen.y-
 W.positionScreen.y)-(B.positionScreen.y-W.positionScreen.y)*(ka.positionScreen.x-W.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(B.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(B.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);
 g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);B=n.vertexNormals;ba=g.vertexNormalsWorld;W=0;for(ka=B.length;W<ka;W++){H=ba[W]=ba[W]||new THREE.Vector3;H.copy(B[W]);z.multiplyVector3(H)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if($.geometry.uvs[U]){g.uvs[0]=$.geometry.uvs[U][0];g.uvs[1]=$.geometry.uvs[U][1];g.uvs[2]=$.geometry.uvs[U][2]}S.push(g);k++}}else if(n instanceof THREE.Face4){W=p[n.a];ka=p[n.b];B=p[n.c];H=p[n.d];if(W.__visible&&
@@ -225,9 +225,9 @@ light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLi
 B=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":"",B.vertex_colors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
 e.attachShader(C,I("fragment",n+ca));e.attachShader(C,I("vertex",B+z));e.linkProgram(C);e.getProgramParameter(C,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(C,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");C.uniforms={};C.attributes={};l.program=C;C=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(p in l.uniforms)C.push(p);p=l.program;ca=0;for(z=C.length;ca<
 z;ca++){n=C[ca];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;C=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];ca=0;for(z=C.length;ca<z;ca++){n=C[ca];p.attributes[n]=e.getAttribLocation(p,n)}p=l.program.attributes;e.enableVertexAttribArray(p.position);p.color>=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
-0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,C,p){var n,B,H,N,ca,y,E,D,P=l.lights,T=l.fog;z.autoUpdateMatrix&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,C,p){var n,B,H,N,ca,y,E,D,P=l.lights,T=l.fog;z.matrixAutoUpdate&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update();
 l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(C,p!==undefined?p:!0);this.autoClear&&this.clear();ca=l.__webGLObjects.length;for(p=0;p<ca;p++){n=l.__webGLObjects[p];E=n.object;if(E.visible)if(!(E instanceof THREE.Mesh)||m(E)){E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);u(n);n.render=!0;if(this.sortObjects){ia.copy(E.position);U.multiplyVector3(ia);n.z=ia.z}}else n.render=!1;else n.render=!1}this.sortObjects&&l.__webGLObjects.sort(t);y=l.__webGLObjectsImmediate.length;for(p=0;p<
-y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){E.autoUpdateMatrix&&E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,
+y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){E.matrixAutoUpdate&&E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,
 B)})}}}for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,B)})}}}if(C&&C.min_filter!==THREE.NearestFilter&&C.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,C.__webGLTexture);
 e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var z,C,p;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}z=0;for(C=l.objects.length;z<C;z++){p=l.objects[z];var n=l,B=void 0,H=void 0,N=void 0,ca=void 0;H=p.geometry;if(n.__webGLObjectsMap[p.id]==undefined){n.__webGLObjectsMap[p.id]={};p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);
 p._objectMatrixArray=new Float32Array(16);p.globalMatrix.flattenToArray(p._objectMatrixArray)}ca=n.__webGLObjectsMap[p.id];objlist=n.__webGLObjects;if(p instanceof THREE.Mesh){for(B in H.geometryChunks){N=H.geometryChunks[B];if(!N.__webGLVertexBuffer){n=N;n.__webGLVertexBuffer=e.createBuffer();n.__webGLNormalBuffer=e.createBuffer();n.__webGLTangentBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n.__webGLUVBuffer=e.createBuffer();n.__webGLUV2Buffer=e.createBuffer();n.__webGLSkinVertexABuffer=
@@ -278,7 +278,7 @@ THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=ne
 THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
 THREE.Detector={canvas:!!window.CanvasRenderingContext2D,webgl:!!window.WebGLRenderingContext,workers:!!window.Worker,addGetWebGLMessage:function(a){var b=document.body,c="oldie";if(a){if(a.parent!==undefined)b=a.parent;if(a.id!==undefined)c=a.id}a=document.createElement("center");var d=document.createElement("div");d.innerHTML='Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>\n<br/>\nPlease try in\n<a href="http://www.google.com/chrome">Chrome 9+</a> /\n<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /\n<a href="http://nightly.webkit.org/">Safari OSX 10.6+</a>';d.id=
 c;c=d.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.background="#eee";c.color="#000";c.padding="1em";c.width="475px";c.margin="5em auto 0";a.appendChild(d);b.appendChild(a);return d}};
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
 d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();k.push(t)}o=0;for(w=f.length;o<w;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image;d.onload=function(){this.loaded=!0;c&&c(this)};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a,b){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<
 d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=!0;b&&b(this)};f[c].src=a[c]}return f}};if(!window.requestAnimationFrame)window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();
 var SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in L.objects)if(!G.objects[o]){A=L.objects[o];if(q=G.geometries[A.geometry]){ba=[];for(i=0;i<A.materials.length;i++)ba[i]=G.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(q,ba);object.position.set(F[0],F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;G.scene.addObject(object);G.objects[o]=

+ 0 - 0
examples/camera_orthographic.html → examples/canvas_camera_orthographic.html


+ 0 - 0
examples/geometry_birds.html → examples/canvas_geometry_birds.html


+ 0 - 0
examples/geometry_cube.html → examples/canvas_geometry_cube.html


+ 0 - 0
examples/geometry_earth.html → examples/canvas_geometry_earth.html


+ 0 - 0
examples/geometry_panorama.html → examples/canvas_geometry_panorama.html


+ 0 - 0
examples/geometry_panorama_fisheye.html → examples/canvas_geometry_panorama_fisheye.html


+ 0 - 0
examples/geometry_terrain.html → examples/canvas_geometry_terrain.html


+ 0 - 0
examples/interactive_cubes.html → examples/canvas_interactive_cubes.html


+ 0 - 0
examples/interactive_cubes_tween.html → examples/canvas_interactive_cubes_tween.html


+ 0 - 0
examples/interactive_voxelpainter.html → examples/canvas_interactive_voxelpainter.html


+ 0 - 0
examples/lights_pointlights.html → examples/canvas_lights_pointlights.html


+ 0 - 0
examples/lights_pointlights_smooth.html → examples/canvas_lights_pointlights_smooth.html


+ 0 - 0
examples/lines_test.html → examples/canvas_lines.html


+ 0 - 0
examples/lines_sphere.html → examples/canvas_lines_sphere.html


+ 0 - 0
examples/materials.html → examples/canvas_materials.html


+ 0 - 0
examples/materials_depth.html → examples/canvas_materials_depth.html


+ 0 - 0
examples/materials_normal.html → examples/canvas_materials_normal.html


+ 0 - 0
examples/materials_reflection.html → examples/canvas_materials_reflection.html


+ 0 - 0
examples/materials_video.html → examples/canvas_materials_video.html


+ 0 - 0
examples/particles_floor.html → examples/canvas_particles_floor.html


+ 0 - 0
examples/particles_random.html → examples/canvas_particles_random.html


+ 0 - 0
examples/particles_sprites.html → examples/canvas_particles_sprites.html


+ 0 - 0
examples/particles_waves.html → examples/canvas_particles_waves.html


+ 216 - 0
examples/canvas_performance.html

@@ -0,0 +1,216 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - geometry - sphere</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				font-family: Monospace;
+				background-color: #f0f0f0;
+				margin: 0px;
+				overflow: hidden;
+			}
+		</style>
+	</head>
+	<body>
+
+		<!-- <script type="text/javascript" src="../build/Three.js"></script> -->
+
+			<script type="text/javascript" src="../src/Three.js"></script>
+		<script type="text/javascript" src="../src/core/Color.js"></script>
+		<script type="text/javascript" src="../src/core/Vector2.js"></script>
+		<script type="text/javascript" src="../src/core/Vector3.js"></script>
+		<script type="text/javascript" src="../src/core/Vector4.js"></script>
+		<script type="text/javascript" src="../src/core/Ray.js"></script>
+		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
+		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
+		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
+		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
+		<script type="text/javascript" src="../src/core/Vertex.js"></script>
+		<script type="text/javascript" src="../src/core/Face3.js"></script>
+		<script type="text/javascript" src="../src/core/Face4.js"></script>
+		<script type="text/javascript" src="../src/core/UV.js"></script>
+		<script type="text/javascript" src="../src/core/Geometry.js"></script>
+		<script type="text/javascript" src="../src/objects/Object3D.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>
+		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Bone.js"></script>
+		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
+		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
+		<script type="text/javascript" src="../src/animation/Animation.js"></script>
+		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
+		<script type="text/javascript" src="../src/lights/Light.js"></script>
+		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
+		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
+		<script type="text/javascript" src="../src/lights/PointLight.js"></script>
+		<script type="text/javascript" src="../src/materials/Material.js"></script>
+		<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.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/RenderTarget.js"></script>
+		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/CubeReflectionMapping.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/CubeRefractionMapping.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/LatitudeReflectionMapping.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/LatitudeRefractionMapping.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/SphericalReflectionMapping.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/SphericalRefractionMapping.js"></script>
+		<script type="text/javascript" src="../src/materials/mappings/UVMapping.js"></script>
+		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
+		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
+		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
+		<script type="text/javascript" src="../src/renderers/Projector.js"></script>
+		<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
+
+		<script type="text/javascript" src="../src/extras/primitives/Sphere.js"></script>
+
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			var container, stats;
+
+			var camera, scene, renderer;
+
+			var sphere, plane;
+
+			var targetRotation = 0;
+			var targetRotationOnMouseDown = 0;
+
+			var mouseX = 0;
+			var mouseXOnMouseDown = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			init();
+
+			/*
+			var accum = 0, result = 0, results = [], amount = 100;
+
+			for ( var i = 0; i < amount; i ++ ) {
+
+				var timer = new Date().getTime();
+
+				loop();
+
+				accum += result = new Date().getTime() - timer;
+				results.push( result );
+			}
+
+			console.log( results );
+			console.log( accum / amount );
+			*/
+
+			// loop();
+
+			setInterval( loop, 1000 / 60 );
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.position.z = 1000;
+				camera.position.y = 1000;
+				camera.position.z = 1000;
+
+				scene = new THREE.Scene();
+
+				// Grid
+
+				var geometry = new THREE.Geometry();
+				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( - 500, 0, 0 ) ) );
+				geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 500, 0, 0 ) ) );
+
+				var material = new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.5 } );
+
+				for ( var i = 0; i <= 10; i ++ ) {
+
+					var line = new THREE.Line( geometry, material );
+					line.position.z = ( i * 100 ) - 500;
+					scene.addObject( line );
+
+					var line = new THREE.Line( geometry, material );
+					line.position.x = ( i * 100 ) - 500;
+					line.rotation.y = 90 * Math.PI / 180;
+					scene.addObject( line );
+
+				}
+
+				// Spheres
+
+				geometry = new Sphere( 100, 26, 18 );
+				material = new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, opacity: 1 } );
+
+				for ( var i = 0; i < 20; i ++ ) {
+
+					sphere = new THREE.Mesh( geometry, material );
+					sphere.overdraw = true;
+
+					sphere.position.x = ( i % 5 ) * 200 - 400;
+					sphere.position.z = Math.floor( i / 5 ) * 200 - 400;
+
+					scene.addObject( sphere );
+
+				}
+
+				// Lights
+
+				var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 );
+				scene.addLight( ambientLight );
+
+				var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff );
+				directionalLight.position.x = 0;
+				directionalLight.position.y = 1;
+				directionalLight.position.z = 0;
+				scene.addLight( directionalLight );
+
+				var pointLight = new THREE.PointLight( 0xff0000, 1 );
+				scene.addLight( pointLight );
+
+				renderer = new THREE.CanvasRenderer();
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+				container.appendChild( renderer.domElement );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild(stats.domElement);
+
+			}
+
+			//
+
+			function loop() {
+
+				renderer.render( scene, camera );
+
+				stats.update();
+			}
+
+		</script>
+
+	</body>
+</html>

+ 3 - 2
examples/canvasrenderer_sandbox.html → examples/canvas_sandbox.html

@@ -114,7 +114,7 @@
 			var debugContext;
 
 			init();
-			setInterval( loop, 1000 / 60 );
+			setInterval( render, 1000 / 60 );
 
 			function init() {
 
@@ -259,7 +259,7 @@
 
 			//
 
-			function loop() {
+			function render() {
 
 				if ( moveForward ) camera.position.z -= 5;
 				if ( moveBackwards ) camera.position.z += 5;
@@ -316,6 +316,7 @@
 				renderer.render(scene, camera);
 
 				stats.update();
+
 			}
 
 		</script>

+ 0 - 0
examples/lights_test.html → examples/misc_lights_test.html


+ 0 - 0
examples/materials_multimaterials.html → examples/misc_materials_multimaterials.html


+ 0 - 0
examples/uqbiquity_test.html → examples/misc_uqbiquity_test.html


+ 1 - 1
examples/webglrenderer2_sandbox.html → examples/misc_webglrenderer2_sandbox.html

@@ -191,8 +191,8 @@
 					mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
 					mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 4 + 1;
+					mesh.matrixAutoUpdate = false;
 					mesh.updateMatrix();
-					mesh.autoUpdateMatrix = false;
 					scene.addObject( mesh );
 
 				}

+ 0 - 0
examples/io_blender_colors.html → examples/webgl_geometry_blenderexport_colors.html


+ 0 - 0
examples/geometry_colors.html → examples/webgl_geometry_colors.html


+ 0 - 0
examples/geometry_dynamic_gl.html → examples/webgl_geometry_dynamic.html


+ 0 - 0
examples/geometry_large_mesh.html → examples/webgl_geometry_large_mesh.html


+ 0 - 0
examples/geometry_minecraft.html → examples/webgl_geometry_minecraft.html


+ 0 - 0
examples/geometry_minecraft_ao.html → examples/webgl_geometry_minecraft_ao.html


+ 0 - 0
examples/geometry_terrain_gl.html → examples/webgl_geometry_terrain.html


+ 0 - 0
examples/geometry_terrain_gl2.html → examples/webgl_geometry_terrain2.html


+ 0 - 0
examples/geometry_terrain_fog_gl.html → examples/webgl_geometry_terrain_fog.html


+ 0 - 0
examples/hdr.html → examples/webgl_hdr.html


+ 0 - 0
examples/interactive_voxelpainter_gl.html → examples/webgl_interactive_voxelpainter.html


+ 0 - 0
examples/lights_pointlights_gl.html → examples/webgl_lights_pointlights.html


+ 0 - 0
examples/lines_colors_gl.html → examples/webgl_lines_colors.html


+ 0 - 0
examples/lines_cubes_gl.html → examples/webgl_lines_cubes.html


+ 0 - 0
examples/lines_sphere_gl.html → examples/webgl_lines_sphere.html


+ 0 - 0
examples/materials_gl.html → examples/webgl_materials.html


+ 0 - 0
examples/materials_cars.html → examples/webgl_materials_cars.html


+ 0 - 0
examples/materials_cars_camaro.html → examples/webgl_materials_cars_camaro.html


+ 0 - 0
examples/materials_cubemap.html → examples/webgl_materials_cubemap.html


+ 0 - 0
examples/materials_cubemap_balls_reflection.html → examples/webgl_materials_cubemap_balls_reflection.html


+ 0 - 0
examples/materials_cubemap_balls_refraction.html → examples/webgl_materials_cubemap_balls_refraction.html


+ 0 - 0
examples/materials_cubemap_escher.html → examples/webgl_materials_cubemap_escher.html


+ 0 - 0
examples/materials_cubemap_refraction.html → examples/webgl_materials_cubemap_refraction.html


+ 0 - 0
examples/materials_grass.html → examples/webgl_materials_grass.html


+ 0 - 0
examples/materials_normalmap.html → examples/webgl_materials_normalmap.html


+ 0 - 0
examples/materials_normalmap2.html → examples/webgl_materials_normalmap2.html


+ 0 - 0
examples/materials_shaders.html → examples/webgl_materials_shaders.html


+ 4 - 4
examples/materials_shaders_fresnel.html → examples/webgl_materials_shaders_fresnel.html

@@ -108,14 +108,14 @@
 					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() * 4 + 1;
-					mesh.autoUpdateMatrix = false;
+					mesh.matrixAutoUpdate = false;
 					mesh.updateMatrix();
 					scene.addObject( mesh );
-					
+
 				}
 
-				scene.autoUpdateMatrix = false;
-				
+				scene.matrixAutoUpdate = false;
+
 				SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, textureCube );
 
 				webglRenderer = new THREE.WebGLRenderer();

+ 0 - 0
examples/obj_convert_test.html → examples/webgl_objconvert_test.html


+ 0 - 0
examples/particles_billboards_gl.html → examples/webgl_particles_billboards.html


+ 0 - 0
examples/particles_billboards_colors_gl.html → examples/webgl_particles_billboards_colors.html


+ 0 - 0
examples/particles_random_gl.html → examples/webgl_particles_random.html


+ 0 - 0
examples/particles_sprites_gl.html → examples/webgl_particles_sprites.html


+ 0 - 0
examples/postprocessing.html → examples/webgl_postprocessing.html


+ 86 - 86
examples/ribbons_gl.html → examples/webgl_ribbons.html

@@ -18,49 +18,49 @@
 			a {
 				color:#0078ff;
 			}
-			
+
             #info {
 				color:#fff;
                 position: absolute;
                 top: 0px; width: 100%;
                 padding: 5px;
 				z-index:100;
-				
-            }			
-		</style>		
+
+            }
+		</style>
 	</head>
-	
+
 	<body>
-		
+
 		<script type="text/javascript" src="../build/ThreeExtras.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
         <div id="info">
 			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl ribbons example
 		</div>
-		
+
 
 		<script type="text/javascript">
 
 			if ( ! THREE.Detector.webgl ) THREE.Detector.addGetWebGLMessage();
-			
+
 			window.onload = init;
 
 			var container, stats;
 			var camera, scene, renderer, ribbon, geometry, geometry2, materials = [], ribbons = [],
 				parameters, i, i2, h, color, x, y, z, z2, s, n, n2, nribbons, grid;
-				
+
 			var mouseX = 0, mouseY = 0;
 
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
 			var postprocessing = {
-				
+
 				enabled  : true
-				
+
 			};
-			
+
 			function init() {
 
 				container = document.createElement( 'div' );
@@ -71,32 +71,32 @@
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.0016 );
-				
+
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
-				
+
 				renderer.setClearColor( scene.fog.color, 1 );
-				
-				geometry = new THREE.Geometry();			
+
+				geometry = new THREE.Geometry();
 				geometry2 = new THREE.Geometry();
-				
+
 				n = 1000;
 				n2 = 2 * n;
-				
+
 				for ( i = -n; i < n; i++ ) {
 
 					i2 = i + n;
-					
+
 					x = i * 1.175;
 					y = ( i2 % 2 ) * 5;
-					
+
 					if ( i2 % 2 )  {
-					
+
 						z = 10 * Math.sin( i2 * 0.3 ) * Math.cos( i2 * 0.1 );
-						
+
 					}
-					
+
 					vector = new THREE.Vector3( x, y, z );
 					geometry.vertices.push( new THREE.Vertex( vector ) );
 
@@ -113,19 +113,19 @@
 					geometry2.colors.push( color );
 
 				}
-				
+
 				var material_base = new THREE.MeshBasicMaterial( { color:0xffffff, vertex_colors:true } );
-				
+
 				renderer.initMaterial( material_base, scene.lights, scene.fog );
-				
+
 				xgrid = 34;
 				ygrid = 15;
 				nribbons = xgrid * ygrid;
-				
+
 				c = 0;
 				for ( i = 0; i < xgrid; i++ )
 				for ( j = 0; j < ygrid; j++ ) {
-					
+
 					materials[c] = new THREE.MeshBasicMaterial( { color:0xffffff, vertex_colors:true } );
 					materials[c].program = material_base.program;
 					materials[c].uniforms = Uniforms.clone( THREE.ShaderLib[ 'basic' ].uniforms );
@@ -134,30 +134,30 @@
 					ribbon.rotation.x = 1.57;
 					ribbon.rotation.y = 1.57;
 					ribbon.rotation.z = -3.14;
-					
+
 					x = 40 * ( i - xgrid/2 );
 					y = 40 * ( j - ygrid/2 );
 					z = 0;
 					ribbon.position.set( x, y, z );
-					
-					materials[c].color.setHSV( i/xgrid, 0.3 +  0.7*j/ygrid, 1 );					
-					
+
+					materials[c].color.setHSV( i/xgrid, 0.3 +  0.7*j/ygrid, 1 );
+
 					ribbon.doubleSided = true;
-					ribbon.autoUpdateMatrix = false;
+					ribbon.matrixAutoUpdate = false;
 					ribbon.updateMatrix();
-					
+
 					ribbons.push( ribbon );
 					scene.addObject( ribbon );
-					
+
 					c++;
-					
+
 				}
 
-				scene.autoUpdateMatrix = false;				
+				scene.matrixAutoUpdate = false;
 
 				initPostprocessing();
 				renderer.autoClear = false;
-				
+
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
 				stats.domElement.style.top = '0px';
@@ -166,16 +166,16 @@
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
 				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
-				
+
 				loop();
-				
+
 			}
 
 			function onDocumentMouseMove( event ) {
 
 				mouseX = event.clientX - windowHalfX;
 				mouseY = event.clientY - windowHalfY;
-				
+
 			}
 
 			function onDocumentTouchStart( event ) {
@@ -186,7 +186,7 @@
 
 					mouseX = event.touches[ 0 ].pageX - windowHalfX;
 					mouseY = event.touches[ 0 ].pageY - windowHalfY;
-					
+
 				}
 			}
 
@@ -198,19 +198,19 @@
 
 					mouseX = event.touches[ 0 ].pageX - windowHalfX;
 					mouseY = event.touches[ 0 ].pageY - windowHalfY;
-					
+
 				}
-				
+
 			}
-			
+
 			function initPostprocessing() {
-				
-				postprocessing.scene = new THREE.Scene();		
-				
+
+				postprocessing.scene = new THREE.Scene();
+
 				postprocessing.camera = new THREE.Camera();
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
-				
+
 				var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
                 postprocessing.rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
                 postprocessing.rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
@@ -218,10 +218,10 @@
 
 				var screen_shader = ShaderUtils.lib["screen"];
 				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
-				
+
 				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				screen_uniforms["opacity"].value = 1.0;
-				
+
                 postprocessing.materialScreen = new THREE.MeshShaderMaterial( {
 
                     uniforms: screen_uniforms,
@@ -230,8 +230,8 @@
 					blending: THREE.AdditiveBlending
 
                 } );
-				
-				
+
+
 				var convolution_shader = ShaderUtils.lib["convolution"];
 				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
 
@@ -241,7 +241,7 @@
 				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
 				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
 				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
-				
+
                 postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
 
                     uniforms: convolution_uniforms,
@@ -249,94 +249,94 @@
                     fragment_shader: "#define KERNEL_SIZE 25\n"   + convolution_shader.fragment_shader
 
                 } );
-				
-				
+
+
 				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
 				postprocessing.quad.position.z = -500;
 				postprocessing.scene.addObject( postprocessing.quad );
 
-			}			
+			}
 
 			function loop() {
 
 				requestAnimationFrame( loop, renderer.domElement );
 
 				var time = new Date().getTime() * 0.00005;
-				
+
 				camera.position.x += ( mouseX - camera.position.x ) * 0.036;
 				camera.position.y += ( - (mouseY) - camera.position.y ) * 0.036;
-				
+
 				for ( i = -n; i < n; i++ ) {
 
 					i2 = i + n;
-					
+
 					z  =  10 * Math.sin( i2 * 0.1 + time*30 );
 					z2 =  20 * Math.cos( Math.sin( i2 * 0.1 + time * 20 ) );
-					
+
 					geometry.vertices[i2].position.z = z;
-					geometry2.vertices[i2].position.z = z2;	
-					
+					geometry2.vertices[i2].position.z = z2;
+
 				}
-				
+
 				geometry.__dirtyVertices = true;
 				geometry2.__dirtyVertices = true;
 
 
 				for( i = 0; i < nribbons; i++ ) {
-					
+
 					h = ( 360 * ( i/nribbons + time ) % 360 ) / 360;
-					materials[i].color.setHSV( h, 0.5+0.5*(i%20/20), 1 );					
-					
+					materials[i].color.setHSV( h, 0.5+0.5*(i%20/20), 1 );
+
 				}
 
 				if ( postprocessing.enabled ) {
-				
+
 					renderer.clear();
-					
+
 					// Render scene into texture
-					
+
 					renderer.render( scene, camera, postprocessing.rtTexture1 );
 
 					// Render quad with blured scene into texture (convolution pass 1)
-					
+
 					postprocessing.quad.materials = [ postprocessing.materialConvolution ];
-					
+
 					postprocessing.materialConvolution.uniforms.tDiffuse.texture = postprocessing.rtTexture1;
 					postprocessing.materialConvolution.uniforms.uImageIncrement.value = postprocessing.blurx;
-					
+
 					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture2 );
-					
+
 					// Render quad with blured scene into texture (convolution pass 2)
-					
+
 					postprocessing.materialConvolution.uniforms.tDiffuse.texture = postprocessing.rtTexture2;
 					postprocessing.materialConvolution.uniforms.uImageIncrement.value = postprocessing.blury;
-					
+
 					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture3 );
-					
+
 					// Render original scene with superimposed blur to texture
-					
+
 					postprocessing.quad.materials = [ postprocessing.materialScreen ];
-					
+
 					postprocessing.materialScreen.uniforms.tDiffuse.texture = postprocessing.rtTexture3;
 					postprocessing.materialScreen.uniforms.opacity.value = 1.2;
-					
+
 					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture1, false );
 
 					// Render to screen
 
 					postprocessing.materialScreen.uniforms.tDiffuse.texture = postprocessing.rtTexture1;
-					renderer.render( postprocessing.scene, postprocessing.camera );					
-					
+					renderer.render( postprocessing.scene, postprocessing.camera );
+
 				} else {
-					
+
 					renderer.clear();
 					renderer.render( scene, camera );
-					
+
 				}
 
 				stats.update();
-				
-				
+
+
 
 			}
 

+ 0 - 0
examples/render_to_texture.html → examples/webgl_rtt.html


+ 111 - 111
examples/scene_test.html → examples/webgl_scene_test.html

@@ -13,7 +13,7 @@
 				font-family:georgia;
 				text-align:center;
 			}
-			
+
 			#info {
 				position: absolute;
 				top: 0px; width: 100%;
@@ -23,7 +23,7 @@
 				text-align: center;
 				z-index:100;
 			}
-			
+
 			#progress {
 				color:red;
 				top:7em;
@@ -37,7 +37,7 @@
 				text-shadow: #000 0px 0px 10px;
 				display:none;
 			}
-			
+
 			#start {
 				color:#fff;
 				text-shadow: #000 0px 0px 2px;
@@ -46,44 +46,44 @@
 				text-align: center;
 				display:none;
 			}
-			
+
 			.shadow {
 				-moz-box-shadow: 0px 0px 5px #000;
 				-webkit-box-shadow: 0px 0px 5px #000;
 				box-shadow: 0px 0px 5px #000;
 			}
-			
+
 			#progressbar {
 				text-align: center;
 				background: white;
 				width: 250px;
 				height: 10px;
 			}
-			
+
 			#bar {
 				background:#d00;
 				width:50px;
 				height:10px;
 			}
-			
+
 			.enabled {
 				color: lime!important;
 				cursor:pointer;
 			}
-			
+
 			.enabled:hover {
 				text-shadow: #0f0 0px 0px 5px !important;
 			}
-			
+
 			.disabled {
 				background:gray;
 				cursor:default;
 			}
-			
+
 			a { color:red }
 			canvas { pointer-events:none; z-index:10; }
 			#log { position:absolute; top:0; display:block; text-align:left; z-index:1000; pointer-events:none; }
-			
+
 			#scene_explorer {
 				background:transparent;
 				color:#fff;
@@ -94,20 +94,20 @@
 				z-index:200;
 				overflow:auto;
 			}
-			
+
 			#section_exp {
 				background:rgba(0,0,50,0.5);
 				padding:0.5em 0;
 				display:none;
 			}
-			
-			#scene_explorer h3 { 
+
+			#scene_explorer h3 {
 				font-size:1em;
 				padding:0;
 				margin:0;
 				color:orange;
 			}
-			
+
 			#scene_explorer a {
 				color:#555;
 				font-weight:bold;
@@ -119,12 +119,12 @@
 				background:#555;
 				color:rgba(0,0,50,1);
 			}
-			
+
 			.part {
 				display:none;
 				padding:0 0 0.5em 2em;
 			}
-			
+
 		</style>
 	</head>
 
@@ -132,7 +132,7 @@
 		<div id="info">
 			<a href="http://github.com/mrdoob/three.js">three.js</a> - scene loader test
 		</div>
-		
+
 		<div id="scene_explorer">
 			<a id="plus_exp" href="#">[+]</a>
 			<div id="section_exp"></div>
@@ -140,13 +140,13 @@
 
 		<div id="progress">
 			<span id="message">Loading ...</span>
-			
+
 			<center>
 				<div id="progressbar" class="shadow"><div id="bar" class="shadow"></div></div>
 				<div id="start" class="disabled">Start</div>
 			</center>
 		</div>
-		
+
 		<pre id="log"></pre>
 
 		<script type="text/javascript" src="../build/ThreeExtras.js"></script>
@@ -155,7 +155,7 @@
 		<script type="text/javascript">
 
 			if ( ! THREE.Detector.webgl ) THREE.Detector.addGetWebGLMessage();
-			
+
 			var SCREEN_WIDTH = window.innerWidth;
 			var SCREEN_HEIGHT = window.innerHeight;
 
@@ -176,44 +176,44 @@
 			init();
 
 			function $( id ) {
-				
+
 				return document.getElementById( id );
-				
+
 			}
-			
+
 			function handle_update( result, pieces ) {
-				
+
 				refreshSceneView( result );
 				renderer.initWebGLObjects( result.scene );
-				
+
 				var m, material, count = 0;
-				
+
 				for ( m in result.materials ) {
-				
+
 					material = result.materials[ m ];
 					if ( ! ( material instanceof THREE.MeshFaceMaterial ) ) {
-						
+
 						if( !material.program ) {
-						
+
 							console.log(m);
 							renderer.initMaterial( material, result.scene.lights, result.scene.fog );
-							
+
 							count += 1;
 							if( count > pieces ) {
-								
+
 								//console.log("xxxxxxxxx");
 								break;
-							
+
 							}
-							
+
 						}
-						
+
 					}
-					
+
 				}
-				
+
 			}
-			
+
 			function init() {
 
 				container = document.createElement( 'div' );
@@ -222,7 +222,7 @@
 				var loadScene = createLoadScene();
 				scene  = loadScene.scene;
 				camera = loadScene.camera;
-				
+
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 				renderer.domElement.style.position = "relative";
@@ -240,49 +240,49 @@
 				setInterval( loop, 1000/60 );
 
 				var callback_progress = function( progress, result ) {
-				
-					var bar = 250, 
+
+					var bar = 250,
 						total = progress.total_models + progress.total_textures,
 						loaded = progress.loaded_models + progress.loaded_textures;
-					
+
 					if ( total )
 						bar = Math.floor( bar * loaded / total );
-					
+
 					$( "bar" ).style.width = bar + "px";
-					
+
 					count = 0;
 					for ( var m in result.materials ) count++;
 
 					handle_update( result, Math.floor( count/total ) );
-					
+
 				}
-				
+
 				var callback_sync = function( result ) {
-				
+
 					/*
-					
+
 					// uncomment to see progressive scene loading
-					
+
 					scene = result.scene;
 					camera = result.currentCamera;
-					
+
 					camera.aspect = window.innerWidth / window.innerHeight;
 					camera.updateProjectionMatrix();
-					
+
 					renderer.setClearColor( result.bgColor, result.bgAlpha );
-					
+
 					*/
 
 					//handle_update( result, 1 );
-					
+
 				}
-				
+
 				var callback_async = function( result ) {
-				
+
 					loaded = result;
-					
+
 					var mat_veyron = result.geometries[ "veyron" ].materials;
-					
+
 					mat_veyron[ 0 ][ 0 ] = result.materials[ "interior" ];
 					mat_veyron[ 1 ][ 0 ] = result.materials[ "chrome" ];
 					mat_veyron[ 2 ][ 0 ] = result.materials[ "darkerchrome" ];
@@ -291,43 +291,43 @@
 					mat_veyron[ 5 ][ 0 ] = result.materials[ "chrome" ];
 					mat_veyron[ 6 ][ 0 ] = result.materials[ "backlights" ];
 					mat_veyron[ 7 ][ 0 ] = result.materials[ "backsignals" ];
-					
+
 					$( "message" ).style.display = "none";
 					$( "progressbar" ).style.display = "none";
 					$( "start" ).style.display = "block";
 					$( "start" ).className = "enabled";
-					
+
 					handle_update( result, 1 );
-					
+
 				}
-				
+
 				$( "progress" ).style.display = "block";
 				SceneUtils.loadScene( "scenes/test_scene.js", callback_sync, callback_async, callback_progress );
-				
+
 				$( "plus_exp" ).addEventListener( 'click', createToggle( "exp" ), false );
 
 			}
 
 			function setButtonActive( id ) {
-			
+
 				$( "start" ).style.backgroundColor = "green";
-					
+
 			}
-			
+
 			function onStartClick() {
-			
+
 				$( "progress" ).style.display = "none";
-				
+
 				scene = loaded.scene;
 				camera = loaded.currentCamera;
-				
+
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
-				
+
 				renderer.setClearColor( loaded.bgColor, loaded.bgAlpha );
-				
+
 			}
-			
+
 			function onDocumentMouseMove(event) {
 
 				mouseX = ( event.clientX - windowHalfX );
@@ -336,23 +336,23 @@
 			}
 
 			function createLoadScene() {
-			
+
 				var result = {
-				
+
 					scene:  new THREE.Scene(),
 					camera: new THREE.Camera( 65, window.innerWidth / window.innerHeight, 1, 1000 )
-					
+
 				};
-				
+
 				result.camera.position.z = 100;
-				
+
 				var object, geometry, material, light, count = 500, range = 200;
-				
+
 				material = new THREE.MeshLambertMaterial( { color:0xffffff } );
 				geometry = new Cube( 5, 5, 5 );
-				
+
 				for( var i = 0; i < count; i++ ) {
-				
+
 					object = new THREE.Mesh( geometry, material );
 					object.position.x = ( Math.random() - 0.5 ) * range;
 					object.position.y = ( Math.random() - 0.5 ) * range;
@@ -360,14 +360,14 @@
 					object.rotation.x = Math.random() * 6;
 					object.rotation.y = Math.random() * 6;
 					object.rotation.z = Math.random() * 6;
-					object.autoUpdateMatrix = false;
+					object.matrixAutoUpdate = false;
 					object.updateMatrix();
 					result.scene.addObject( object );
-					
+
 				}
-				
-				result.scene.autoUpdateMatrix = false;
-				
+
+				result.scene.matrixAutoUpdate = false;
+
 				light = new THREE.PointLight( 0xffffff );
 				result.scene.addLight( light );
 
@@ -376,9 +376,9 @@
 				result.scene.addLight( light );
 
 				return result;
-				
+
 			}
-			
+
 			function loop() {
 
 				camera.position.x += ( mouseX - camera.position.x ) * .001;
@@ -398,60 +398,60 @@
 			}
 
 			// Scene explorer user interface
-			
+
 			function toggle( id ) {
-				
+
 				var scn = $( "section_" + id ).style,
 					btn = $( "plus_" + id );
-				
+
 				if ( scn.display == "block" ) {
-				
+
 					scn.display = "none";
 					btn.innerHTML = "[+]";
-					
+
 				}
 				else {
-					
+
 					scn.display = "block";
 					btn.innerHTML = "[-]";
-					
+
 				}
-					
+
 			}
-			
+
 			function createToggle( label ) { return function() { toggle( label ) } };
-			
+
 			function refreshSceneView( result ) {
-				
+
 				$( "section_exp" ).innerHTML = generateSceneView( result );
 
 				var config = [ "obj", "geo", "mat", "tex", "lit", "cam" ];
-				
+
 				for ( var i = 0; i < config.length; i++ )
 					$( "plus_" + config[i] ).addEventListener( 'click', createToggle( config[i] ), false );
 
 			}
-			
+
 			function generateSection( label, id, objects ) {
-				
+
 				var html = "";
-				
+
 				html += "<h3><a id='plus_" + id + "' href='#'>[+]</a> " + label + "</h3>";
 				html += "<div id='section_" + id + "' class='part'>";
-				
+
 				for( var o in objects ) {
-				
+
 					html += o + "<br/>";
-					
+
 				}
 				html += "</div>";
-				
+
 				return html;
-			
+
 			}
-			
+
 			function generateSceneView( result ) {
-				
+
 				var config = [
 				[ "Objects",    "obj", result.objects ],
 				[ "Geometries", "geo", result.geometries ],
@@ -460,14 +460,14 @@
 				[ "Lights",     "lit", result.lights ],
 				[ "Cameras",    "cam", result.cameras ]
 				];
-				
+
 				var html = "";
-				
+
 				for ( var i = 0; i < config.length; i++ )
 					html += generateSection( config[i][0], config[i][1], config[i][2] );
 
 				return html;
-				
+
 			}
 
 		</script>

+ 0 - 0
examples/shader.html → examples/webgl_shader.html


+ 0 - 0
examples/shader2.html → examples/webgl_shader2.html


+ 5 - 5
src/animation/Animation.js

@@ -54,7 +54,7 @@ THREE.Animation.prototype.play = function( loop ) {
 		for( var h = 0; h < this.hierarchy.length; h++ ) {
 			
 			this.hierarchy[ h ].useQuaternion    = true;
-			this.hierarchy[ h ].autoUpdateMatrix = true;
+			this.hierarchy[ h ].matrixAutoUpdate = true;
 			
 			if( this.hierarchy[ h ].prevKey === undefined ) {
 				
@@ -159,8 +159,8 @@ THREE.Animation.prototype.update = function( time ) {
 		if( JIThierarchy[ h ][ frame ] !== undefined ) {
 
 			object.skinMatrix           = JIThierarchy[ h ][ frame ];
-			object.autoUpdateMatrix     = false;
-			object.matrixNeedsToUpdate  = false;
+			object.matrixAutoUpdate     = false;
+			object.matrixNeedsUpdate  = false;
 			
 			//object.skinMatrix.flattenToArray( this.root.boneMatrices[ h ] );
 			object.skinMatrix.flattenToArrayOffset( this.root.boneMatrices, h * 16 );
@@ -214,8 +214,8 @@ THREE.Animation.prototype.update = function( time ) {
 				
 				// interpolate rot (quaternion slerp)
 				
-				object.autoUpdateMatrix    = true;
-				object.matrixNeedsToUpdate = true;
+				object.matrixAutoUpdate = true;
+				object.matrixNeedsUpdate = true;
 				
 				scale   = ( currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );
 				prevXYZ = prevKey[ type ];

+ 32 - 40
src/cameras/Camera.js

@@ -4,14 +4,9 @@
  */
 
 THREE.Camera = function( FOV, aspect, zNear, zFar, renderer, target ) {
-	
-	// call super
-	
+
 	THREE.Object3D.call( this );
-	
 
-	// set arguments
-	
 	this.FOV              = FOV      || 50;
 	this.aspect           = aspect   || 1.0;
 	this.zNear            = zNear    || 0.1;
@@ -22,14 +17,11 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, renderer, target ) {
 	this.useTarget        = true;
 	this.up               = new THREE.Vector3( 0, 1, 0 );
 
-
-	// init
-	
 	this.inverseMatrix     = new THREE.Matrix4();
 	this.projectionMatrix = null;
 
 	// movement
-	
+
 	this.tmpVec = new THREE.Vector3();
 
 	this.translateX = function ( amount ) {
@@ -58,7 +50,7 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, renderer, target ) {
 	};
 
 	this.updateProjectionMatrix();
-	
+
 }
 
 THREE.Camera.prototype             = new THREE.Object3D();
@@ -73,10 +65,10 @@ THREE.Camera.prototype.supr        = THREE.Object3D.prototype;
 */
 
 THREE.Camera.prototype.updateProjectionMatrix = function() {
-	
+
 	this.projectionMatrix = THREE.Matrix4.makePerspective( this.FOV, this.aspect, this.zNear, this.zFar );
 
-} 
+}
 
 
 /*
@@ -84,39 +76,39 @@ THREE.Camera.prototype.updateProjectionMatrix = function() {
  */
 
 THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) {
-	
+
 	if( this.useTarget ) {
-		
+
 		// local
-		
+
 		this.localMatrix.lookAt( this.position, this.target.position, this.up );
-		
-		
+
+
 		// global
-		
+
 		if( parentGlobalMatrix )
 			this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
 		else
 			this.globalMatrix.copy( this.localMatrix );
 
 		THREE.Matrix4.makeInvert( this.globalMatrix, this.inverseMatrix );
-		//THREE.Matrix4.makeInvertTo( this.globalMatrix, this.inverseMatrix );	
-		
+		//THREE.Matrix4.makeInvertTo( this.globalMatrix, this.inverseMatrix );
+
 		forceUpdate = true;
-	
+
 	} else {
-		
-		if( this.autoUpdateMatrix )
-			forceUpdate |= this.updateMatrix();			
-			
-		if( forceUpdate || this.matrixNeedsToUpdate ) {
-			
+
+		if( this.matrixAutoUpdate )
+			forceUpdate |= this.updateMatrix();
+
+		if( forceUpdate || this.matrixNeedsUpdate ) {
+
 			if( parentGlobalMatrix )
 				this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
 			else
 				this.globalMatrix.copy( this.localMatrix );
-			
-			this.matrixNeedsToUpdate = false;
+
+			this.matrixNeedsUpdate = false;
 			forceUpdate              = true;
 
 			THREE.Matrix4.makeInvert( this.globalMatrix, this.inverseMatrix );
@@ -125,7 +117,7 @@ THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, camer
 		}
 
 	}
-	
+
 	// update children
 
 	for( var i = 0; i < this.children.length; i++ )
@@ -145,11 +137,11 @@ THREE.Camera.prototype.frustumContains = function( object3D ) {
 
 	// object pos
 
-	var vx0 = object3D.globalMatrix.n14, 
+	var vx0 = object3D.globalMatrix.n14,
 	    vy0 = object3D.globalMatrix.n24,
 		vz0 = object3D.globalMatrix.n34;
-		
-		
+
+
 	// check z
 
 	var inverse = this.inverseMatrix;
@@ -158,10 +150,10 @@ THREE.Camera.prototype.frustumContains = function( object3D ) {
 
 	if( vz1 - radius > -this.zNear )
 		return false;
-		
+
 	if( vz1 + radius < -this.zFar )
 		return false;
-	
+
 
 	// check x
 
@@ -183,18 +175,18 @@ THREE.Camera.prototype.frustumContains = function( object3D ) {
 	// check y
 
 	var vy1 = ( inverse.n21 * vx0 + inverse.n22 * vy0 + inverse.n23 * vz0 + inverse.n24 ) * perspective.n22 * ooZ * this.screenCenterY;
-		
+
 	if( vy1 + radius < -this.screenCenterY )
 		return false;
-		
+
 	if( vy1 - radius > this.screenCenterY )
-		return false;		
+		return false;
 
 
 	// inside
 
 	object3D.screenPosition.set( vx1, vy1, vz1, radius );
-	
+
 	return true;
 
 };

+ 16 - 16
src/core/Color.js

@@ -4,13 +4,14 @@
 
 THREE.Color = function ( hex ) {
 
-	this.autoUpdate = true;
 	this.setHex( hex );
 
 };
 
 THREE.Color.prototype = {
 
+	autoUpdate: true,
+
 	setRGB: function ( r, g, b ) {
 
 		this.r = r;
@@ -26,27 +27,27 @@ THREE.Color.prototype = {
 
 	},
 
-	// based on MochiKit implementation by Bob Ippolito
-	// h,s,v ranges are < 0.0 - 1.0 >
-	
 	setHSV: function ( h, s, v ) {
 
+		// based on MochiKit implementation by Bob Ippolito
+		// h,s,v ranges are < 0.0 - 1.0 >
+
 		var red, green, blue, i, f, p, q, t;
-		
+
 		if ( v == 0.0 ) {
-			
+
 			red = green = blue = 0;
-			
+
 		} else {
-			
+
 			i = Math.floor( h * 6 );
 			f = ( h * 6 ) - i;
 			p = v * ( 1 - s );
 			q = v * ( 1 - ( s * f ) );
 			t = v * ( 1 - ( s * ( 1 - f ) ) );
-			
+
 			switch ( i ) {
-				
+
 				case 1: red = q; green = v; blue = p; break;
 				case 2: red = p; green = v; blue = t; break;
 				case 3: red = p; green = q; blue = v; break;
@@ -54,11 +55,11 @@ THREE.Color.prototype = {
 				case 5: red = v; green = p; blue = q; break;
 				case 6: // fall through
 				case 0: red = v; green = t; blue = p; break;
-				
+
 			}
-		
+
 		}
-		
+
 		this.r = red;
 		this.g = green;
 		this.b = blue;
@@ -69,9 +70,9 @@ THREE.Color.prototype = {
 			this.updateStyleString();
 
 		}
-		
+
 	},
-	
+
 	setHex: function ( hex ) {
 
 		this.hex = ( ~~ hex ) & 0xffffff;
@@ -111,7 +112,6 @@ THREE.Color.prototype = {
 
 	},
 
-
 	toString: function () {
 
 		return 'THREE.Color ( r: ' + this.r + ', g: ' + this.g + ', b: ' + this.b + ', hex: ' + this.hex + ' )';

+ 36 - 38
src/core/Matrix4.js

@@ -17,7 +17,7 @@ THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33
 
 	this.flat = new Array( 16 );
 	this.m33 = new THREE.Matrix3();
-	
+
 };
 
 THREE.Matrix4.prototype = {
@@ -86,14 +86,14 @@ THREE.Matrix4.prototype = {
 	},
 
 	multiplyVector3OnlyZ: function( v ) {
-		
+
 		var vx = v.x, vy = v.y, vz = v.z,
 		d = 1 / ( this.n41 * vx + this.n42 * vy + this.n43 * vz + this.n44 );
 
 		return ( this.n31 * vx + this.n32 * vy + this.n33 * vz + this.n34 ) * d;
 
 	},
-	
+
 	multiplyVector4: function ( v ) {
 
 		var vx = v.x, vy = v.y, vz = v.z, vw = v.w;
@@ -208,7 +208,7 @@ THREE.Matrix4.prototype = {
 		r[ 13 ] = this.n24;
 		r[ 14 ] = this.n34;
 		r[ 15 ] = this.n44;
-		
+
 		return this;
 
 	},
@@ -338,7 +338,7 @@ THREE.Matrix4.prototype = {
 	flatten: function() {
 
 		var flat = this.flat;
-		
+
 		flat[ 0 ] = this.n11;
 		flat[ 1 ] = this.n21;
 		flat[ 2 ] = this.n31;
@@ -364,7 +364,7 @@ THREE.Matrix4.prototype = {
 	},
 
 	flattenToArray: function( flat ) {
-		
+
 		flat[ 0 ] = this.n11;
 		flat[ 1 ] = this.n21;
 		flat[ 2 ] = this.n31;
@@ -390,7 +390,7 @@ THREE.Matrix4.prototype = {
 	},
 
 	flattenToArrayOffset: function( flat, offset ) {
-		
+
 		flat[ offset ] 	   = this.n11;
 		flat[ offset + 1 ] = this.n21;
 		flat[ offset + 2 ] = this.n31;
@@ -421,7 +421,7 @@ THREE.Matrix4.prototype = {
 				  0, 1, 0, y,
 				  0, 0, 1, z,
 				  0, 0, 0, 1 );
-		 
+
 		return this;
 
 	},
@@ -432,7 +432,7 @@ THREE.Matrix4.prototype = {
 				  0, y, 0, 0,
 				  0, 0, z, 0,
 				  0, 0, 0, 1 );
-		
+
 		return this;
 
 	},
@@ -471,7 +471,7 @@ THREE.Matrix4.prototype = {
 				  s,  c, 0, 0,
 				  0,  0, 1, 0,
 				  0,  0, 0, 1 );
-		
+
 		return this;
 
 	},
@@ -500,82 +500,80 @@ THREE.Matrix4.prototype = {
 		this.n14 = vec3.x;
 		this.n24 = vec3.y;
 		this.n34 = vec3.z;
-		
+
 		return this;
-	
+
 	},
-	
+
 	setRotationFromEuler: function( vec3 ) {
-		
+
 		//var c = Math.PI / 180;
 		var x = vec3.x,// * c;
 			y = vec3.y,// * c;
 			z = vec3.z,// * c;
-		
+
 			ch = Math.cos( y  ),
 			sh = Math.sin( y  ),
 			ca = Math.cos( -z ),
 			sa = Math.sin( -z ),
 			cb = Math.cos( x  ),
 			sb = Math.sin( x  ),
-		
+
 			chsa = ch * sa,
 			shsa = sh * sa;
-	
+
 	    this.n11 = ch * ca;
 	    this.n12 = sh * sb - chsa * cb;
 	    this.n13 = chsa * sb + sh * cb;
-		
+
 	    this.n21 = sa;
 	    this.n22 = ca * cb;
 	    this.n23 = - ca * sb;
-		
+
 	    this.n31 = - sh * ca;
 	    this.n32 = shsa * cb + ch * sb;
 	    this.n33 = - shsa * sb + ch * cb;
-		
+
 	},
 
 	setRotationFromQuaternion: function( quat ) {
 
 		var x = quat.x, y = quat.y, z = quat.z, w = quat.w,
-	
+
 			x2 = x + x,
 			y2 = y + y,
 			z2 = z + z,
-	
+
 			xx = x * x2,
 			xy = x * y2,
 			xz = x * z2,
-	
+
 			yy = y * y2,
 			yz = y * z2,
 			zz = z * z2,
-	
+
 			wx = w * x2,
 			wy = w * y2,
 			wz = w * z2;
-	
+
 		this.n11 = 1 - ( yy + zz );
 		this.n12 = xy - wz;
 		this.n13 = xz + wy;
-	
+
 		this.n21 = xy + wz;
 		this.n22 = 1 - ( xx + zz );
 		this.n23 = yz - wx;
-	
+
 		this.n31 = xz - wy;
 		this.n32 = yz + wx;
 		this.n33 = 1 - ( xx + yy );
-		
+
 	},
-	
+
 	scale: function( vec3 ) {
-		
-		var x = vec3.x,
-			y = vec3.y,
-			z = vec3.z;
-		
+
+		var x = vec3.x, y = vec3.y, z = vec3.z;
+
 		this.n11 *= x; this.n12 *= x; this.n13 *= x;
 		this.n21 *= y; this.n22 *= y; this.n23 *= y;
 		this.n31 *= z; this.n32 *= z; this.n33 *= z;
@@ -583,16 +581,16 @@ THREE.Matrix4.prototype = {
 		return this;
 
 	},
-	
+
 	extractRotationMatrix: function( m ) {
-		
+
 		m.n11 = this.n11; m.n12 = this.n12; m.n13 = this.n13; m.n14 = 0;
 		m.n21 = this.n21; m.n22 = this.n22; m.n23 = this.n23; m.n24 = 0;
 		m.n31 = this.n31; m.n32 = this.n32; m.n33 = this.n33; m.n34 = 0;
-		m.n41 = 0; 		  m.n42 = 0; 		m.n43 = 0; 		  m.n44 = 1;
+		m.n41 = 0; m.n42 = 0; m.n43 = 0; m.n44 = 1;
 
 	},
-	
+
 	toString: function() {
 
 		return  "| " + this.n11 + " " + this.n12 + " " + this.n13 + " " + this.n14 + " |\n" +

+ 3 - 3
src/core/Ray.js

@@ -54,14 +54,14 @@ THREE.Ray.prototype = {
 			direction = this.direction.clone();
 
 			objMatrix = object.globalMatrix;
-			objMatrix.extractRotationMatrix( object.rotationMatrix );
-			
+			objMatrix.extractRotationMatrix( object.matrixRotation );
+
 			a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() );
 			b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() );
 			c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() );
 			d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null;
 
-			normal = object.rotationMatrix.multiplyVector3( face.normal.clone() );
+			normal = object.matrixRotation.multiplyVector3( face.normal.clone() );
 			dot = direction.dot( normal );
 
 			if ( dot < 0 ) { // Math.abs( dot ) > 0.0001

+ 1 - 1
src/extras/GeometryUtils.js

@@ -14,7 +14,7 @@ var GeometryUtils = {
 		uvs1 = geometry1.uvs,
 		uvs2 = geometry2.uvs;
 
-		isMesh && object2.autoUpdateMatrix && object2.updateMatrix();
+		isMesh && object2.matrixAutoUpdate && object2.updateMatrix();
 
 		for ( var i = 0, il = vertices2.length; i < il; i ++ ) {
 

+ 5 - 5
src/objects/Bone.js

@@ -25,21 +25,21 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera )
 	
 	// update local
 	
-	if( this.autoUpdateMatrix )
+	if( this.matrixAutoUpdate )
 		forceUpdate |= this.updateMatrix();			
 
 	
 	// update skin matrix
 
-	if( forceUpdate || this.matrixNeedsToUpdate ) {
+	if( forceUpdate || this.matrixNeedsUpdate ) {
 		
 		if( parentSkinMatrix )
 			this.skinMatrix.multiply( parentSkinMatrix, this.localMatrix );
 		else
 			this.skinMatrix.copy( this.localMatrix );
 		
-		this.matrixNeedsToUpdate = false;
-		forceUpdate              = true;
+		this.matrixNeedsUpdate = false;
+		forceUpdate = true;
 
 	}
 
@@ -96,4 +96,4 @@ THREE.Bone.prototype.addChild = function( child ) {
 
 /*
  * Todo: Remove Children: see if any remaining are none-Bone
- */
+ */

+ 3 - 3
src/objects/LOD.js

@@ -43,20 +43,20 @@ THREE.LOD.prototype.update = function( parentGlobalMatrix, forceUpdate, camera )
 	
 	// update local
 	
-	if( this.autoUpdateMatrix )
+	if( this.matrixAutoUpdate )
 		forceUpdate |= this.updateMatrix();
 
 
 	// update global
 
-	if( forceUpdate || this.matrixNeedsToUpdate ) {
+	if( forceUpdate || this.matrixNeedsUpdate ) {
 		
 		if( parentGlobalMatrix )
 			this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
 		else
 			this.globalMatrix.copy( this.localMatrix );
 		
-		this.matrixNeedsToUpdate = false;
+		this.matrixNeedsUpdate = false;
 		forceUpdate              = true;
 
 	}

+ 3 - 3
src/objects/Mesh.js

@@ -45,20 +45,20 @@ THREE.Mesh.prototype.update = function( parentGlobalMatrix, forceUpdate, camera
 
 		// update local
 		
-		if( this.autoUpdateMatrix )
+		if( this.matrixAutoUpdate )
 			forceUpdate |= this.updateMatrix();
 
 
 		// update global
 
-		if( forceUpdate || this.matrixNeedsToUpdate ) {
+		if( forceUpdate || this.matrixNeedsUpdate ) {
 			
 			if( parentGlobalMatrix )
 				this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
 			else
 				this.globalMatrix.copy( this.localMatrix );
 			
-			this.matrixNeedsToUpdate = false;
+			this.matrixNeedsUpdate = false;
 			forceUpdate               = true;			
 
 		}

+ 56 - 56
src/objects/Object3D.js

@@ -7,27 +7,29 @@
 THREE.Object3D = function() {
 
 	this.id = THREE.Object3DCounter.value ++;
-	
-	this.visible             = true;
-	this.autoUpdateMatrix    = true;
-	this.matrixNeedsToUpdate = true;
-	
-	this.parent		  		 = undefined;
-	this.children     		 = [];
-
-	this.position            = new THREE.Vector3();
-	this.rotation            = new THREE.Vector3();
-	this.scale               = new THREE.Vector3( 1.0, 1.0, 1.0 );
-	this.localMatrix         = new THREE.Matrix4();
-	this.globalMatrix        = new THREE.Matrix4();
-	this.quaternion          = new THREE.Quaternion();
-	this.useQuaternion       = false;
-	this.screenPosition      = new THREE.Vector4(); // xyzr
-	
-	this.boundRadius         = 0.0;
-	this.boundRadiusScale    = 1.0;
-	
-	this.rotationMatrix 	 = new THREE.Matrix4(); // this is just to cache it when somewhere it's computed somewhere else (stripped down globalMatrix)
+
+	this.parent = undefined;
+	this.children = [];
+
+	this.position = new THREE.Vector3();
+	this.rotation = new THREE.Vector3();
+	this.scale = new THREE.Vector3( 1.0, 1.0, 1.0 );
+
+	this.matrixRotation = new THREE.Matrix4(); // this is just to cache it when somewhere it's computed somewhere else (stripped down globalMatrix)
+
+	this.localMatrix = new THREE.Matrix4();
+	this.globalMatrix = new THREE.Matrix4();
+	this.matrixAutoUpdate = true;
+	this.matrixNeedsUpdate = true;
+
+	this.quaternion = new THREE.Quaternion();
+	this.useQuaternion = false;
+	this.screenPosition = new THREE.Vector4(); // xyzr
+
+	this.boundRadius = 0.0;
+	this.boundRadiusScale = 1.0;
+
+	this.visible = true;
 
 };
 
@@ -39,38 +41,38 @@ THREE.Object3D = function() {
 THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) {
 
 	// visible and auto update?
-	
+
 	if( this.visible ) {
 
 		// update local
-		
-		if( this.autoUpdateMatrix )
+
+		if( this.matrixAutoUpdate )
 			forceUpdate |= this.updateMatrix();
 
-	
+
 		// update global
 
-		if( forceUpdate || this.matrixNeedsToUpdate ) {
-			
+		if( forceUpdate || this.matrixNeedsUpdate ) {
+
 			if( parentGlobalMatrix )
 				this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
 			else
 				this.globalMatrix.copy( this.localMatrix );
-			
-			this.matrixNeedsToUpdate = false;
+
+			this.matrixNeedsUpdate = false;
 			forceUpdate              = true;
 
 		}
 
 
 		// update children
-	
+
 		var i, l = this.children.length;
-		
+
 		for( i = 0; i < l; i++ ) {
-			
+
 			this.children[ i ].update( this.globalMatrix, forceUpdate, camera );
-			
+
 		}
 
 	}
@@ -83,39 +85,39 @@ THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, cam
  */
 
 THREE.Object3D.prototype.updateMatrix = function() {
-	
+
 	// update position
-		
-	this.localMatrix.setPosition( this.position );	
-	
+
+	this.localMatrix.setPosition( this.position );
+
 	// update quaternion
-	
+
 	if( this.useQuaternion )  {
-		
+
 		if( this.quaternion.isDirty ) {
-			
+
 			this.localMatrix.setRotationFromQuaternion( this.quaternion );
 			this.quaternion.isDirty = false;
 
 		}
-		
+
 	// update rotation
-	
+
 	} else {
-		
+
 		this.localMatrix.setRotationFromEuler( this.rotation );
-	
+
 	}
 
 	// update scale
-	
+
 	if( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) {
-		
+
 		this.localMatrix.scale( this.scale );
 		this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z ) );
-	
+
 	}
-	
+
 	return true;
 
 };
@@ -126,12 +128,12 @@ THREE.Object3D.prototype.updateMatrix = function() {
  */
 
 THREE.Object3D.prototype.addChild = function( child ) {
-	
+
 	if( this.children.indexOf( child ) === -1 ) {
 
 		if( child.parent !== undefined )
 			child.parent.removeChild( child );
-		
+
 		child.parent = this;
 		this.children.push( child );
 
@@ -145,11 +147,11 @@ THREE.Object3D.prototype.addChild = function( child ) {
  */
 
 THREE.Object3D.prototype.removeChild = function( child ) {
-	
-	var childIndex = this.children.indexOf( child ); 
-	
+
+	var childIndex = this.children.indexOf( child );
+
 	if( childIndex !== -1 )	{
-		
+
 		this.children.splice( childIndex, 1 );
 		child.parent = undefined;
 
@@ -158,5 +160,3 @@ THREE.Object3D.prototype.removeChild = function( child ) {
 };
 
 THREE.Object3DCounter = { value: 0 };
-
-

+ 1 - 1
src/objects/Particle.js

@@ -8,7 +8,7 @@ THREE.Particle = function ( materials ) {
 
 	this.materials = materials instanceof Array ? materials : [ materials ];
 
-	this.autoUpdateMatrix = false;
+	this.matrixAutoUpdate = false;
 
 };
 

+ 3 - 3
src/objects/SkinnedMesh.js

@@ -83,20 +83,20 @@ THREE.SkinnedMesh.prototype.update = function( parentGlobalMatrix, forceUpdate,
 
 		// update local
 		
-		if( this.autoUpdateMatrix )
+		if( this.matrixAutoUpdate )
 			forceUpdate |= this.updateMatrix();
 
 
 		// update global
 
-		if( forceUpdate || this.matrixNeedsToUpdate ) {
+		if( forceUpdate || this.matrixNeedsUpdate ) {
 			
 			if( parentGlobalMatrix )
 				this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
 			else
 				this.globalMatrix.copy( this.localMatrix );
 			
-			this.matrixNeedsToUpdate = false;
+			this.matrixNeedsUpdate = false;
 			forceUpdate              = true;
 
 		}

+ 2 - 2
src/renderers/CanvasRenderer.js

@@ -153,7 +153,7 @@ THREE.CanvasRenderer = function () {
 		var e, el, element, m, ml, fm, fml, material;
 
 		this.autoClear ? this.clear() : _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
-		
+
 		_renderList = _projector.projectScene( scene, camera, this.sortElements );
 
 		/* DEBUG
@@ -546,7 +546,7 @@ THREE.CanvasRenderer = function () {
 
 						}/* else if ( material.env_map.mapping == THREE.RefractionMapping ) {
 
-						
+							
 
 						}*/
 

+ 14 - 14
src/renderers/Projector.js

@@ -52,7 +52,7 @@ THREE.Projector = function() {
 			_objectCount ++;
 
 		}
-		
+
 		sort && renderList.sort( painterSort );
 
 		return renderList;
@@ -63,20 +63,20 @@ THREE.Projector = function() {
 
 	this.projectScene = function ( scene, camera, sort ) {
 
-		var renderList = [], near = camera.near, far = camera.far,
+		var renderList = [], near = camera.zNear, far = camera.zFar,
 		o, ol, v, vl, f, fl, n, nl, objects, object,
 		objectMatrix, objectMaterials, objectOverdraw,
-		objectRotationMatrix,
+		objectMatrixRotation,
 		geometry, vertices, vertex, vertexPositionScreen,
 		faces, face, faceVertexNormals, normal, v1, v2, v3, v4;
 
 		_face3Count = _lineCount = _particleCount = 0;
 
-		camera.autoUpdateMatrix && camera.update();
-		
+		camera.matrixAutoUpdate && camera.update();
+
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.globalMatrix );
 		computeFrustum( _projScreenMatrix );
-		
+
 		scene.update( undefined, false, camera );
 
 		objects = this.projectObjects( scene, camera, true ); // scene.objects;
@@ -87,12 +87,12 @@ THREE.Projector = function() {
 
 			if ( !object.visible ) continue;
 
-			object.autoUpdateMatrix && object.updateMatrix();
+			object.matrixAutoUpdate && object.updateMatrix();
 
 			objectMatrix = object.globalMatrix;
-			objectMatrix.extractRotationMatrix( object.rotationMatrix );
-			objectRotationMatrix = object.rotationMatrix;
-			
+			objectMatrix.extractRotationMatrix( object.matrixRotation );
+			objectMatrixRotation = object.matrixRotation;
+
 			objectMaterials = object.materials;
 			objectOverdraw = object.overdraw;
 
@@ -151,7 +151,7 @@ THREE.Projector = function() {
 								_face3.v3.positionScreen.copy( v3.positionScreen );
 
 								_face3.normalWorld.copy( face.normal );
-								objectRotationMatrix.multiplyVector3( _face3.normalWorld );
+								objectMatrixRotation.multiplyVector3( _face3.normalWorld );
 
 								_face3.centroidWorld.copy( face.centroid );
 								objectMatrix.multiplyVector3( _face3.centroidWorld );
@@ -166,7 +166,7 @@ THREE.Projector = function() {
 
 									normal = _face3VertexNormals[ n ] = _face3VertexNormals[ n ] || new THREE.Vector3();
 									normal.copy( faceVertexNormals[ n ] );
-									objectRotationMatrix.multiplyVector3( normal );
+									objectMatrixRotation.multiplyVector3( normal );
 
 								}
 
@@ -215,7 +215,7 @@ THREE.Projector = function() {
 								_face3.v3.positionScreen.copy( v4.positionScreen );
 
 								_face3.normalWorld.copy( face.normal );
-								objectRotationMatrix.multiplyVector3( _face3.normalWorld );
+								objectMatrixRotation.multiplyVector3( _face3.normalWorld );
 
 								_face3.centroidWorld.copy( face.centroid );
 								objectMatrix.multiplyVector3( _face3.centroidWorld );
@@ -419,7 +419,7 @@ THREE.Projector = function() {
 		return true;
 
 	};
-	
+
 	function clipLine( s1, s2 ) {
 
 		var alpha1 = 0, alpha2 = 1,

File diff suppressed because it is too large
+ 196 - 196
src/renderers/WebGLRenderer.js


+ 2 - 2
src/renderers/WebGLRenderer2.js

@@ -97,7 +97,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
 
 		this.autoClear && this.clear();
 
-		camera.autoUpdateMatrix && camera.updateMatrix();
+		camera.matrixAutoUpdate && camera.updateMatrix();
 
 		// Setup camera matrices
 
@@ -127,7 +127,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
 			var geometry, material, m, ml,
 			program, uniforms, attributes;
 
-			object.autoUpdateMatrix && object.updateMatrix();
+			object.matrixAutoUpdate && object.updateMatrix();
 
 			// Setup object matrices
 

+ 1 - 3
utils/build.bat

@@ -1,4 +1,2 @@
 python build.py --common --includes
-python build.py --extras  --includes
-
-python build.py --common --debug
+python build.py --extras --includes

+ 2 - 2
utils/build.py

@@ -290,11 +290,11 @@ def compress(text):
 		handle.write(text)
 
 	# uncomment to get concatenated JS if you can't figure out Closure compiler errors :|
-	
+
 	#f = open( "debug.js" , "w" )
 	#f.write(text)
 	#f.close()
-	
+
 	out_tuple = tempfile.mkstemp()
 	# os.system("java -jar yuicompressor-2.4.2.jar %s --type js -o %s --charset utf-8 -v" % (in_tuple[1], out_tuple[1]))
 	os.system("java -jar compiler.jar --language_in=ECMASCRIPT5 --js %s --js_output_file %s" % (in_tuple[1], out_tuple[1]))

+ 0 - 1
utils/build.sh

@@ -1,5 +1,4 @@
 #!/bin/sh
 
 python build.py --common 
-python build.py --common --debug
 python build.py --extras

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