Browse Source

Updated Clock to be more compatible with Timer (now uses seconds and getDelta API).

Lots of code got cleaner with seconds, seems we used them before all around.

Also changed examples that didn't need deltas to simple Date.now() plus some more examples cleaning, trying to get rid of obsolescence warnings.
alteredq 14 years ago
parent
commit
942a6c89c9
79 changed files with 300 additions and 345 deletions
  1. 15 15
      build/Three.js
  2. 2 2
      build/custom/ThreeCanvas.js
  3. 2 2
      build/custom/ThreeDOM.js
  4. 11 11
      build/custom/ThreeExtras.js
  5. 2 2
      build/custom/ThreeSVG.js
  6. 2 2
      build/custom/ThreeWebGL.js
  7. 2 2
      examples/misc_camera_path.html
  8. 1 1
      examples/misc_camera_roll.html
  9. 1 1
      examples/misc_lookat.html
  10. 7 3
      examples/misc_materials_multimaterials.html
  11. 2 2
      examples/misc_sound.html
  12. 5 6
      examples/webgl_animation_skinning.html
  13. 2 6
      examples/webgl_collada.html
  14. 1 1
      examples/webgl_collisions_mesh.html
  15. 5 3
      examples/webgl_collisions_terrain.html
  16. 7 14
      examples/webgl_custom_attributes.html
  17. 2 10
      examples/webgl_custom_attributes_particles.html
  18. 2 11
      examples/webgl_custom_attributes_particles2.html
  19. 8 16
      examples/webgl_custom_attributes_particles3.html
  20. 4 4
      examples/webgl_flycamera_earth.html
  21. 12 14
      examples/webgl_geometries.html
  22. 2 2
      examples/webgl_geometry_blenderexport_colors.html
  23. 3 3
      examples/webgl_geometry_dynamic.html
  24. 7 3
      examples/webgl_geometry_hierarchy.html
  25. 6 5
      examples/webgl_geometry_hierarchy2.html
  26. 19 17
      examples/webgl_geometry_large_mesh.html
  27. 1 1
      examples/webgl_geometry_minecraft.html
  28. 1 1
      examples/webgl_geometry_minecraft_ao.html
  29. 1 1
      examples/webgl_geometry_shapes.html
  30. 1 1
      examples/webgl_geometry_terrain.html
  31. 3 1
      examples/webgl_geometry_terrain_fog.html
  32. 4 8
      examples/webgl_geometry_text.html
  33. 4 5
      examples/webgl_hdr.html
  34. 1 1
      examples/webgl_lights_pointlights.html
  35. 1 1
      examples/webgl_lines_colors.html
  36. 10 6
      examples/webgl_lines_cubes.html
  37. 4 5
      examples/webgl_lines_sphere.html
  38. 3 3
      examples/webgl_lines_splines.html
  39. 2 2
      examples/webgl_materials.html
  40. 1 3
      examples/webgl_materials_cars.html
  41. 1 1
      examples/webgl_materials_cars_anaglyph.html
  42. 2 2
      examples/webgl_materials_cars_camaro.html
  43. 1 1
      examples/webgl_materials_cars_camaro_crosseyed.html
  44. 1 1
      examples/webgl_materials_cars_parallaxbarrier.html
  45. 1 1
      examples/webgl_materials_cubemap.html
  46. 2 2
      examples/webgl_materials_cubemap_balls_reflection.html
  47. 2 2
      examples/webgl_materials_cubemap_balls_reflection_anaglyph.html
  48. 2 2
      examples/webgl_materials_cubemap_balls_refraction.html
  49. 2 2
      examples/webgl_materials_cubemap_balls_refraction_crosseyed.html
  50. 1 1
      examples/webgl_materials_cubemap_dynamic.html
  51. 1 1
      examples/webgl_materials_cubemap_refraction.html
  52. 1 1
      examples/webgl_materials_grass.html
  53. 1 1
      examples/webgl_materials_normalmap2.html
  54. 1 1
      examples/webgl_materials_shaders.html
  55. 2 2
      examples/webgl_materials_shaders_fresnel.html
  56. 1 1
      examples/webgl_materials_skin.html
  57. 1 1
      examples/webgl_materials_video.html
  58. 1 1
      examples/webgl_morphtargets_horse.html
  59. 4 4
      examples/webgl_particles_billboards.html
  60. 2 2
      examples/webgl_particles_billboards_colors.html
  61. 8 12
      examples/webgl_particles_dynamic.html
  62. 5 5
      examples/webgl_particles_random.html
  63. 2 5
      examples/webgl_particles_shapes.html
  64. 11 7
      examples/webgl_particles_sprites.html
  65. 2 3
      examples/webgl_postprocessing.html
  66. 6 7
      examples/webgl_postprocessing_dof.html
  67. 1 1
      examples/webgl_rtt.html
  68. 3 3
      examples/webgl_shader2.html
  69. 4 6
      examples/webgl_shader_lava.html
  70. 2 2
      examples/webgl_shading_physical.html
  71. 31 31
      examples/webgl_shadowmap.html
  72. 7 9
      examples/webgl_trackballcamera_earth.html
  73. 5 5
      src/core/Clock.js
  74. 0 2
      src/extras/controls/FirstPersonControls.js
  75. 0 2
      src/extras/controls/FlyControls.js
  76. 0 2
      src/extras/controls/PathControls.js
  77. 0 2
      src/extras/controls/RollControls.js
  78. 3 3
      src/objects/Bone.js
  79. 11 11
      src/objects/SkinnedMesh.js

+ 15 - 15
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r46dev - http://github.com/mrdoob/three.js
 // Three.js r46dev - http://github.com/mrdoob/three.js
-var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(b){this.autoStart=b!==void 0?b:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.elapsed();this.running=!1};THREE.Clock.prototype.elapsed=function(){this.elapsedTime+=this.delta();return this.elapsedTime};
-THREE.Clock.prototype.delta=function(){var b=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),b=c-this.oldTime;this.oldTime=c;this.elapsedTime+=b}return b};THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
+var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(b){this.autoStart=b!==void 0?b:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
+THREE.Clock.prototype.getDelta=function(){var b=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),b=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=b}return b};THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},copyGammaToLinear:function(b){this.r=b.r*b.r;this.g=b.g*b.g;this.b=b.b*b.b;return this},copyLinearToGamma:function(b){this.r=Math.sqrt(b.r);this.g=Math.sqrt(b.g);this.b=Math.sqrt(b.b);return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,k;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),k=e*(1-
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},copyGammaToLinear:function(b){this.r=b.r*b.r;this.g=b.g*b.g;this.b=b.b*b.b;return this},copyLinearToGamma:function(b){this.r=Math.sqrt(b.r);this.g=Math.sqrt(b.g);this.b=Math.sqrt(b.b);return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,k;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),k=e*(1-
 c*h),c=e*(1-c*(1-h)),f){case 1:this.r=k;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=k;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=e;this.g=b;this.b=k;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 c*h),c=e*(1-c*(1-h)),f){case 1:this.r=k;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=k;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=e;this.g=b;this.b=k;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
@@ -130,9 +130,9 @@ THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.material
 e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;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=function(b){THREE.Object3D.call(this);this.skin=b;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(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
-c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
+c,e)};THREE.Bone.prototype.add=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
 THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,h,k,m,n;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],k=h.pos,m=h.rotq,n=h.scl,f=this.addBone(),f.name=h.name,f.position.set(k[0],k[1],k[2]),f.quaternion.set(m[0],m[1],m[2],m[3]),f.useQuaternion=!0,n!==void 0?f.scale.set(n[0],n[1],n[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
 THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,h,k,m,n;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],k=h.pos,m=h.rotq,n=h.scl,f=this.addBone(),f.name=h.name,f.position.set(k[0],k[1],k[2]),f.quaternion.set(m[0],m[1],m[2],m[3]),f.useQuaternion=!0,n!==void 0?f.scale.set(n[0],n[1],n[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
-f=this.bones[e],h.parent===-1?this.addChild(f):this.bones[h.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+f=this.bones[e],h.parent===-1?this.add(f):this.bones[h.parent].add(f);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(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,k=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
 THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,k=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
@@ -450,14 +450,14 @@ THREE.FirstPersonControls=function(b,c){function e(b,e){return function(){e.appl
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
 function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
-!1;break;case 70:this.moveDown=!1}};this.update=function(b){b*=0.0010;if(!this.freeze){if(this.heightSpeed){var e=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=b*e*this.heightCoef}else this.autoSpeedFactor=0;e=b*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(e+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(e);this.moveLeft&&this.object.translateX(-e);this.moveRight&&
-this.object.translateX(e);this.moveUp&&this.object.translateY(e);this.moveDown&&this.object.translateY(-e);e=b*this.lookSpeed;this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=
-1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*
-Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
+!1;break;case 70:this.moveDown=!1}};this.update=function(b){if(!this.freeze){if(this.heightSpeed){var e=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=b*e*this.heightCoef}else this.autoSpeedFactor=0;e=b*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(e+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(e);this.moveLeft&&this.object.translateX(-e);this.moveRight&&this.object.translateX(e);
+this.moveUp&&this.object.translateY(e);this.moveDown&&this.object.translateY(-e);e=b*this.lookSpeed;this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&
+(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
+this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
 THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),y=m.length,D=0;k=y-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<y-1;k++)D=f*n.chunks[k]/n.total,e.keys[k]={time:D,pos:m[k]};h.hierarchy[0]=
 THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),y=m.length,D=0;k=y-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<y-1;k++)D=f*n.chunks[k]/n.total,e.keys[k]={time:D,pos:m[k]};h.hierarchy[0]=
 e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(b){b*=0.0010;var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*b);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*b);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;c=this.verticalAngleMap.srcRange;
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(b){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*b);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*b);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;c=this.verticalAngleMap.srcRange;
 b=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],b[0],b[1]);var f=b[1]-b[0];this.phi=e((c-b[0])/f)*f+b[0];c=this.horizontalAngleMap.srcRange;b=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],b[0],b[1]);f=b[1]-b[0];this.theta=e((c-b[0])/f)*f+b[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 b=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],b[0],b[1]);var f=b[1]-b[0];this.phi=e((c-b[0])/f)*f+b[0];c=this.horizontalAngleMap.srcRange;b=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],b[0],b[1]);f=b[1]-b[0];this.theta=e((c-b[0])/f)*f+b[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),e=new THREE.MeshLambertMaterial({color:65280}),
 function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),e=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,b);b=new THREE.Mesh(m,e);b.position.set(0,10,0);this.animation=h(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(b)}else this.animation=h(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var b=
 c=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,b);b=new THREE.Mesh(m,e);b.position.set(0,10,0);this.animation=h(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(b)}else this.animation=h(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var b=
@@ -468,15 +468,15 @@ THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,argu
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward=
 !0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),c=e.size[0]/2,m=e.size[1]/2;this.moveState.yawLeft=-(b.pageX-e.offset[0]-c)/c;this.moveState.pitchDown=(b.pageY-e.offset[1]-m)/m;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=
 !0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),c=e.size[0]/2,m=e.size[1]/2;this.moveState.yawLeft=-(b.pageX-e.offset[0]-c)/c;this.moveState.pitchDown=(b.pageY-e.offset[1]-m)/m;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(b){b*=0.0010;var e=b*this.movementSpeed;b*=this.rollSpeed;this.object.translateX(this.moveVector.x*e);this.object.translateY(this.moveVector.y*e);this.object.translateZ(this.moveVector.z*e);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
+!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(b){var e=b*this.movementSpeed;b*=this.rollSpeed;this.object.translateX(this.moveVector.x*e);this.object.translateY(this.moveVector.y*e);this.object.translateZ(this.moveVector.z*e);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",e(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",e(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",e(this,
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",e(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",e(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",e(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",e(this,this.keydown),!1);this.domElement.addEventListener("keyup",e(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 this.mouseup),!1);this.domElement.addEventListener("keydown",e(this,this.keydown),!1);this.domElement.addEventListener("keyup",e(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,t=0,w=0,u=0,x=0,v=window.innerWidth/2,A=window.innerHeight/2;this.update=function(b){b*=0.0010;if(this.mouseLook){var c=
-b*this.lookSpeed;this.rotateHorizontally(c*u);this.rotateVertically(c*x)}c=b*this.movementSpeed;this.object.translateZ(-c*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(c*t);this.object.translateY(c*w);m&&(this.roll+=this.rollSpeed*b*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);f.set(0,
-1,0);e.cross(f,h).normalize();f.cross(h,e).normalize();this.object.matrix.n11=e.x;this.object.matrix.n12=f.x;this.object.matrix.n13=h.x;this.object.matrix.n21=e.y;this.object.matrix.n22=f.y;this.object.matrix.n23=h.y;this.object.matrix.n31=e.z;this.object.matrix.n32=f.z;this.object.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(k);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=
-this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=
-this.object.matrix.n13*b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){e.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);e.multiplyScalar(b);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
+THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,t=0,w=0,u=0,x=0,v=window.innerWidth/2,A=window.innerHeight/2;this.update=function(b){if(this.mouseLook){var c=b*this.lookSpeed;
+this.rotateHorizontally(c*u);this.rotateVertically(c*x)}c=b*this.movementSpeed;this.object.translateZ(-c*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(c*t);this.object.translateY(c*w);m&&(this.roll+=this.rollSpeed*b*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);f.set(0,1,0);e.cross(f,
+h).normalize();f.cross(h,e).normalize();this.object.matrix.n11=e.x;this.object.matrix.n12=f.x;this.object.matrix.n13=h.x;this.object.matrix.n21=e.y;this.object.matrix.n22=f.y;this.object.matrix.n23=h.y;this.object.matrix.n31=e.z;this.object.matrix.n32=f.z;this.object.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(k);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=this.object.matrix.n13*
+b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){e.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);e.multiplyScalar(b);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
 function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){u=(b.clientX-v)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",
 function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){u=(b.clientX-v)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",
 function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-1;break;case 82:w=1;break;case 70:w=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:w=0;break;case 70:w=0}},!1)};
 function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-1;break;case 82:w=1;break;case 70:w=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:w=0;break;case 70:w=0}},!1)};
 THREE.TrackballControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
 THREE.TrackballControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,

+ 2 - 2
build/custom/ThreeCanvas.js

@@ -119,8 +119,8 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 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=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.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,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.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,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.matrixWorld,!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!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
-THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};

+ 2 - 2
build/custom/ThreeDOM.js

@@ -83,8 +83,8 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.full
 this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;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;
 this.far)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;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.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
-THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};

+ 11 - 11
build/custom/ThreeExtras.js

@@ -97,14 +97,14 @@ THREE.FirstPersonControls=function(a,b){function c(a,c){return function(){c.appl
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
-!1;break;case 70:this.moveDown=!1}};this.update=function(a){a*=0.0010;if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;c=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(c);this.moveLeft&&this.object.translateX(-c);this.moveRight&&
-this.object.translateX(c);this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
-1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
-Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
+!1;break;case 70:this.moveDown=!1}};this.update=function(a){if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;c=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(c);this.moveLeft&&this.object.translateX(-c);this.moveRight&&this.object.translateX(c);
+this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
+(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta);
+this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),k=c.getLength(),p=f.length,z=0;h=p-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=e*k.chunks[h]/k.total,c.keys[h]={time:z,pos:f[h]};g.hierarchy[0]=
 THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),k=c.getLength(),p=f.length,z=0;h=p-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)z=e*k.chunks[h]/k.total,c.keys[h]={time:z,pos:f[h]};g.hierarchy[0]=
 c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,c){var b,e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,c){var b,e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
-this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,k=Math.PI/180;this.update=function(a){a*=0.0010;var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,k=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var e=a[1]-a[0];this.phi=c((b-a[0])/e)*e+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);e=a[1]-a[0];this.theta=c((b-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var e=a[1]-a[0];this.phi=c((b-a[0])/e)*e+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);e=a[1]-a[0];this.theta=c((b-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),c=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),c=new THREE.MeshLambertMaterial({color:65280}),
 b=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(b,a);a=new THREE.Mesh(g,c);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 b=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(b,a);a=new THREE.Mesh(g,c);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
@@ -115,15 +115,15 @@ THREE.FlyControls=function(a,b){function c(a,c){return function(){c.apply(a,argu
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
 !0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),b=c.size[0]/2,g=c.size[1]/2;this.moveState.yawLeft=-(a.pageX-c.offset[0]-b)/b;this.moveState.pitchDown=(a.pageY-c.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),b=c.size[0]/2,g=c.size[1]/2;this.moveState.yawLeft=-(a.pageX-c.offset[0]-b)/b;this.moveState.pitchDown=(a.pageY-c.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){a*=0.0010;var c=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*c);this.object.translateY(this.moveVector.y*c);this.object.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
+!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var c=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*c);this.object.translateY(this.moveVector.y*c);this.object.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,v=window.innerHeight/2;this.update=function(a){a*=0.0010;if(this.mouseLook){var b=
-a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*t)}b=a*this.movementSpeed;this.object.translateZ(-b*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(b*m);this.object.translateY(b*n);g&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,
-1,0);c.cross(e,f).normalize();e.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=
-this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=
-this.object.matrix.n13*a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,g=!1,k=1,l=0,m=0,n=0,o=0,t=0,u=window.innerWidth/2,v=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*o);this.rotateVertically(b*t)}b=a*this.movementSpeed;this.object.translateZ(-b*(l>0||this.autoForward&&!(l<0)?1:l));this.object.translateX(b*m);this.object.translateY(b*n);g&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);c.cross(e,
+f).normalize();e.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
+this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
+a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
 function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
 function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-u)/window.innerWidth;t=(a.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:g=!0;k=1;break;case 69:g=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
 function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:m=-1;break;case 40:case 83:l=-1;break;case 39:case 68:m=1;break;case 81:g=!0;k=1;break;case 69:g=!0;k=-1;break;case 82:n=1;break;case 70:n=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:m=0;break;case 40:case 83:l=0;break;case 39:case 68:m=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:n=0;break;case 70:n=0}},!1)};
 THREE.TrackballControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
 THREE.TrackballControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,

+ 2 - 2
build/custom/ThreeSVG.js

@@ -114,8 +114,8 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 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=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.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,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.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,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.matrixWorld,!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!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
-THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
+THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};

+ 2 - 2
build/custom/ThreeWebGL.js

@@ -126,9 +126,9 @@ THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.material
 d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;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=function(b){THREE.Object3D.call(this);this.skin=b;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(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
-c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
+c,d)};THREE.Bone.prototype.add=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
 THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,h,i,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],i=h.pos,j=h.rotq,k=h.scl,f=this.addBone(),f.name=h.name,f.position.set(i[0],i[1],i[2]),f.quaternion.set(j[0],j[1],j[2],j[3]),f.useQuaternion=!0,k!==void 0?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
 THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,h,i,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],i=h.pos,j=h.rotq,k=h.scl,f=this.addBone(),f.name=h.name,f.position.set(i[0],i[1],i[2]),f.quaternion.set(j[0],j[1],j[2],j[3]),f.useQuaternion=!0,k!==void 0?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
-f=this.bones[d],h.parent===-1?this.addChild(f):this.bones[h.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+f=this.bones[d],h.parent===-1?this.add(f):this.bones[h.parent].add(f);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(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;f=new THREE.Vector3(d.x,
 THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;f=new THREE.Vector3(d.x,

+ 2 - 2
examples/misc_camera_path.html

@@ -158,9 +158,9 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = clock.delta();
+				var delta = clock.getDelta();
 
 
-				THREE.AnimationHandler.update( 0.001 * delta );
+				THREE.AnimationHandler.update( delta );
 
 
 				controls.update( delta );
 				controls.update( delta );
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );

+ 1 - 1
examples/misc_camera_roll.html

@@ -142,7 +142,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				controls.update( clock.delta() );
+				controls.update( clock.getDelta() );
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 			}
 			}

+ 1 - 1
examples/misc_lookat.html

@@ -119,7 +119,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 
 				sphere.position.x = Math.sin( time * 0.7 ) * 2000;
 				sphere.position.x = Math.sin( time * 0.7 ) * 2000;
 				sphere.position.y = Math.cos( time * 0.5 ) * 2000;
 				sphere.position.y = Math.cos( time * 0.5 ) * 2000;

+ 7 - 3
examples/misc_materials_multimaterials.html

@@ -129,15 +129,19 @@
 				scene.add( mesh );
 				scene.add( mesh );
 
 
 				if ( render_gl ) {
 				if ( render_gl ) {
+
 					try {
 					try {
+
 						webglRenderer = new THREE.WebGLRenderer();
 						webglRenderer = new THREE.WebGLRenderer();
 						webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 						webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 						webglRenderer.domElement.style.position = "relative";
 						webglRenderer.domElement.style.position = "relative";
 						container.appendChild( webglRenderer.domElement );
 						container.appendChild( webglRenderer.domElement );
 						has_gl = 1;
 						has_gl = 1;
+
 					}
 					}
 					catch (e) {
 					catch (e) {
 					}
 					}
+
 				}
 				}
 
 
 				if ( render_canvas ) {
 				if ( render_canvas ) {
@@ -160,10 +164,10 @@
 
 
 				//var loader = new THREE.BinaryLoader(),
 				//var loader = new THREE.BinaryLoader(),
 				var loader = new THREE.JSONLoader(),
 				var loader = new THREE.JSONLoader(),
-					callback = function( geometry ) { createScene( geometry) };
+					callback = function( geometry ) { createScene( geometry ) };
 
 
-				loader.load( { model: "obj/female02/Female02_slim.js", callback: callback } );
-				//loader.load( { model: "obj/female02/Female02_bin.js", callback: callback } );
+				loader.load( "obj/female02/Female02_slim.js", callback );
+				//loader.load( "obj/female02/Female02_bin.js", callback );
 
 
 			}
 			}
 
 

+ 2 - 2
examples/misc_sound.html

@@ -192,8 +192,8 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = clock.delta(),
-					time = clock.elapsedTime * 0.005;
+				var delta = clock.getDelta(),
+					time = clock.getElapsedTime() * 5;
 
 
 				controls.update( delta );
 				controls.update( delta );
 
 

+ 5 - 6
examples/webgl_animation_skinning.html

@@ -86,8 +86,7 @@
 				scene.fog.color.setHSV( 0.1, 0.10, 1 );
 				scene.fog.color.setHSV( 0.1, 0.10, 1 );
 
 
 				light = new THREE.DirectionalLight( 0xffffff, 1.5 );
 				light = new THREE.DirectionalLight( 0xffffff, 1.5 );
-				light.position.set( 0, 1, 1 );
-				light.position.normalize();
+				light.position.set( 0, 1, 1 ).normalize();
 				scene.add( light );
 				scene.add( light );
 
 
 				var planeSimple = new THREE.PlaneGeometry( 200, 300 );
 				var planeSimple = new THREE.PlaneGeometry( 200, 300 );
@@ -123,7 +122,7 @@
 				document.addEventListener( 'click', startAnimation, false );
 				document.addEventListener( 'click', startAnimation, false );
 
 
 				var loader = new THREE.JSONLoader();
 				var loader = new THREE.JSONLoader();
-				loader.load( { model: "obj/buffalo/buffalo.js", callback: createScene } );
+				loader.load( "obj/buffalo/buffalo.js", createScene );
 
 
 				loop();
 				loop();
 
 
@@ -204,16 +203,16 @@
 
 
 				requestAnimationFrame( loop, renderer.domElement );
 				requestAnimationFrame( loop, renderer.domElement );
 
 
-				var delta = clock.delta();
+				var delta = clock.getDelta();
 
 
-				THREE.AnimationHandler.update( 0.001 * delta );
+				THREE.AnimationHandler.update( delta );
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
 				if ( buffalos && playback ) {
 				if ( buffalos && playback ) {
 
 
-					var elapsed = clock.elapsed() * 0.001;
+					var elapsed = clock.getElapsedTime();
 
 
 					camera.position.z += 2 * Math.sin( elapsed );
 					camera.position.z += 2 * Math.sin( elapsed );
 
 

+ 2 - 6
examples/webgl_collada.html

@@ -93,7 +93,7 @@
 				scene.add( directionalLight );
 				scene.add( directionalLight );
 
 
 				pointLight = new THREE.PointLight( 0xffffff, 4 );
 				pointLight = new THREE.PointLight( 0xffffff, 4 );
-				pointLight.position.x = 10000;
+				pointLight.position = particleLight.position;
 				scene.add( pointLight );
 				scene.add( pointLight );
 
 
 				renderer = new THREE.WebGLRenderer();
 				renderer = new THREE.WebGLRenderer();
@@ -145,7 +145,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = new Date().getTime() * 0.0005;
+				var timer = Date.now() * 0.0005;
 
 
 				camera.position.x = Math.cos( timer ) * 10;
 				camera.position.x = Math.cos( timer ) * 10;
 				camera.position.y = 2;
 				camera.position.y = 2;
@@ -157,10 +157,6 @@
 				particleLight.position.y = Math.cos( timer * 5 ) * 4000;
 				particleLight.position.y = Math.cos( timer * 5 ) * 4000;
 				particleLight.position.z = Math.cos( timer * 4 ) * 3009;
 				particleLight.position.z = Math.cos( timer * 4 ) * 3009;
 
 
-				pointLight.position.x = particleLight.position.x;
-				pointLight.position.y = particleLight.position.y;
-				pointLight.position.z = particleLight.position.z;
-
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 			}
 			}

+ 1 - 1
examples/webgl_collisions_mesh.html

@@ -151,7 +151,7 @@
 				};
 				};
 
 
 
 
-				loader.load( { model: "obj/suzanne/suzanneHi.js", callback: onGeometry } );
+				loader.load( "obj/suzanne/suzanneHi.js", onGeometry );
 
 
 			}
 			}
 
 

+ 5 - 3
examples/webgl_collisions_terrain.html

@@ -91,11 +91,13 @@
 
 
 			function loadCube(p) {
 			function loadCube(p) {
 
 
-				loader.load( { model: "obj/terrain.js", callback: function( geometry ) {
+				loader.load( "obj/terrain.js", function( geometry ) {
+
 					var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xf3e4b8 } ) );
 					var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xf3e4b8 } ) );
 					scene.add( mesh );
 					scene.add( mesh );
-					THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshColliderWBox(mesh) );
-				} } );
+					THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshColliderWBox( mesh ) );
+
+				} );
 
 
 			}
 			}
 
 

+ 7 - 14
examples/webgl_custom_attributes.html

@@ -142,7 +142,6 @@
 			var vertices = sphere.geometry.vertices;
 			var vertices = sphere.geometry.vertices;
 			var values = attributes.displacement.value;
 			var values = attributes.displacement.value;
 
 
-
 			for( var v = 0; v < vertices.length; v++ ) {
 			for( var v = 0; v < vertices.length; v++ ) {
 
 
 				values[ v ] = 0;
 				values[ v ] = 0;
@@ -165,13 +164,6 @@
 
 
 		}
 		}
 
 
-		function cap( x, a, b ) {
-
-			return ( x < a ) ? a : ( ( x > b ) ? b : x );
-		}
-
-		var i, value;
-
 		function animate() {
 		function animate() {
 
 
 			requestAnimationFrame( animate );
 			requestAnimationFrame( animate );
@@ -183,23 +175,24 @@
 
 
 		function render() {
 		function render() {
 
 
-			var time = new Date().getTime() * 0.01;
+			var time = Date.now() * 0.01;
 
 
-			sphere.rotation.y = 0.01 * time;
-			sphere.rotation.z = 0.01 * time;
+			sphere.rotation.y = sphere.rotation.z = 0.01 * time;
 
 
 			uniforms.amplitude.value = 2.5 * Math.sin( sphere.rotation.y * 0.125 );
 			uniforms.amplitude.value = 2.5 * Math.sin( sphere.rotation.y * 0.125 );
 			THREE.ColorUtils.adjustHSV( uniforms.color.value, 0.0005, 0, 0 );
 			THREE.ColorUtils.adjustHSV( uniforms.color.value, 0.0005, 0, 0 );
 
 
-			for( i = 0; i < attributes.displacement.value.length; i++ ) {
+			for( var i = 0; i < attributes.displacement.value.length; i ++ ) {
 
 
-				attributes.displacement.value[ i ] = Math.sin( 0.1*i + time );
+				attributes.displacement.value[ i ] = Math.sin( 0.1 * i + time );
 
 
 				noise[ i ] += 0.5 * ( 0.5 - Math.random() );
 				noise[ i ] += 0.5 * ( 0.5 - Math.random() );
-				noise[ i ] = cap( noise[ i ], -5, 5 );
+				noise[ i ] = THREE.Math.clamp( noise[ i ], -5, 5 );
+
 				attributes.displacement.value[ i ] += noise[ i ];
 				attributes.displacement.value[ i ] += noise[ i ];
 
 
 			}
 			}
+
 			attributes.displacement.needsUpdate = true;
 			attributes.displacement.needsUpdate = true;
 
 
 			renderer.render( scene, camera );
 			renderer.render( scene, camera );

+ 2 - 10
examples/webgl_custom_attributes_particles.html

@@ -181,14 +181,6 @@
 
 
 		}
 		}
 
 
-		function cap( x, a, b ) {
-
-			return ( x < a ) ? a : ( ( x > b ) ? b : x );
-
-		}
-
-		var i, value;
-
 		function animate() {
 		function animate() {
 
 
 			requestAnimationFrame( animate );
 			requestAnimationFrame( animate );
@@ -200,11 +192,11 @@
 
 
 		function render() {
 		function render() {
 
 
-			var time = new Date().getTime() * 0.005;
+			var time = Date.now() * 0.005;
 
 
 			sphere.rotation.z = 0.01 * time;
 			sphere.rotation.z = 0.01 * time;
 
 
-			for( i = 0; i < attributes.size.value.length; i++ ) {
+			for( var i = 0; i < attributes.size.value.length; i++ ) {
 
 
 				attributes.size.value[ i ] = 14 + 13 * Math.sin( 0.1 * i + time );
 				attributes.size.value[ i ] = 14 + 13 * Math.sin( 0.1 * i + time );
 
 

+ 2 - 11
examples/webgl_custom_attributes_particles2.html

@@ -144,7 +144,6 @@
 			var values_size = attributes.size.value;
 			var values_size = attributes.size.value;
 			var values_color = attributes.ca.value;
 			var values_color = attributes.ca.value;
 
 
-
 			for( var v = 0; v < vertices.length; v++ ) {
 			for( var v = 0; v < vertices.length; v++ ) {
 
 
 				values_size[ v ] = 10;
 				values_size[ v ] = 10;
@@ -178,14 +177,6 @@
 
 
 		}
 		}
 
 
-		function cap( x, a, b ) {
-
-			return ( x < a ) ? a : ( ( x > b ) ? b : x );
-
-		}
-
-		var i, value;
-
 		function animate() {
 		function animate() {
 
 
 			requestAnimationFrame( animate );
 			requestAnimationFrame( animate );
@@ -197,12 +188,12 @@
 
 
 		function render() {
 		function render() {
 
 
-			var time = new Date().getTime() * 0.005;
+			var time = Date.now() * 0.005;
 
 
 			sphere.rotation.y = 0.02 * time;
 			sphere.rotation.y = 0.02 * time;
 			sphere.rotation.z = 0.02 * time;
 			sphere.rotation.z = 0.02 * time;
 
 
-			for( i = 0; i < attributes.size.value.length; i++ ) {
+			for( var i = 0; i < attributes.size.value.length; i ++ ) {
 
 
 				if ( i < vc1 )
 				if ( i < vc1 )
 					attributes.size.value[ i ] = 16 + 12 * Math.sin( 0.1 * i + time );
 					attributes.size.value[ i ] = 16 + 12 * Math.sin( 0.1 * i + time );

+ 8 - 16
examples/webgl_custom_attributes_particles3.html

@@ -137,7 +137,7 @@
 			var radius = 100, inner = 0.6 * radius;
 			var radius = 100, inner = 0.6 * radius;
 			var geometry = new THREE.Geometry();
 			var geometry = new THREE.Geometry();
 
 
-			for ( var i = 0; i < 100000; i++ ) {
+			for ( var i = 0; i < 100000; i ++ ) {
 
 
 				vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 				vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 
 
@@ -161,8 +161,9 @@
 			function addGeo( geo, x, y, z, ry ) {
 			function addGeo( geo, x, y, z, ry ) {
 
 
 				m = new THREE.Mesh( geo, dummyMaterial );
 				m = new THREE.Mesh( geo, dummyMaterial );
-				m.rotation.y = ry;
 				m.position.set( x, y, z );
 				m.position.set( x, y, z );
+				m.rotation.y = ry;
+
 				THREE.GeometryUtils.merge( geometry, m );
 				THREE.GeometryUtils.merge( geometry, m );
 
 
 			}
 			}
@@ -202,7 +203,7 @@
 			var values_size = attributes.size.value;
 			var values_size = attributes.size.value;
 			var values_color = attributes.ca.value;
 			var values_color = attributes.ca.value;
 
 
-			for( var v = 0; v < vertices.length; v++ ) {
+			for( var v = 0; v < vertices.length; v ++ ) {
 
 
 				values_size[ v ] = 10;
 				values_size[ v ] = 10;
 				values_color[ v ] = new THREE.Color( 0xffffff );
 				values_color[ v ] = new THREE.Color( 0xffffff );
@@ -220,7 +221,7 @@
 
 
 			}
 			}
 
 
-			console.log( vertices.length );
+			//console.log( vertices.length );
 
 
 			scene.add( object );
 			scene.add( object );
 
 
@@ -237,14 +238,6 @@
 
 
 		}
 		}
 
 
-		function cap( x, a, b ) {
-
-			return ( x < a ) ? a : ( ( x > b ) ? b : x );
-
-		}
-
-		var i, value;
-
 		function animate() {
 		function animate() {
 
 
 			requestAnimationFrame( animate );
 			requestAnimationFrame( animate );
@@ -256,12 +249,11 @@
 
 
 		function render() {
 		function render() {
 
 
-			var time = new Date().getTime() * 0.01;
+			var time = Date.now() * 0.01;
 
 
-			object.rotation.y = 0.02 * time;
-			object.rotation.z = 0.02 * time;
+			object.rotation.y = object.rotation.z = 0.02 * time;
 
 
-			for( i = 0; i < attributes.size.value.length; i++ ) {
+			for( var i = 0; i < attributes.size.value.length; i ++ ) {
 
 
 				if ( i < vc1 )
 				if ( i < vc1 )
 					attributes.size.value[ i ] = 26 + 32 * Math.sin( 0.1 * i + 0.6 * time );
 					attributes.size.value[ i ] = 26 + 32 * Math.sin( 0.1 * i + 0.6 * time );

+ 4 - 4
examples/webgl_flycamera_earth.html

@@ -282,10 +282,10 @@
 
 
 				// rotate the planet and clouds
 				// rotate the planet and clouds
 
 
-				var delta = clock.delta();
+				var delta = clock.getDelta();
 
 
-				meshPlanet.rotation.y += 0.001 * rotationSpeed * delta;
-				meshClouds.rotation.y += 0.001 * 1.25 * rotationSpeed * delta;
+				meshPlanet.rotation.y += rotationSpeed * delta;
+				meshClouds.rotation.y += 1.25 * rotationSpeed * delta;
 
 
 				// slow down as we approach the surface
 				// slow down as we approach the surface
 
 
@@ -308,7 +308,7 @@
 				controls.update( delta );
 				controls.update( delta );
 
 
 				renderer.clear();
 				renderer.clear();
-				composer.render( 0.001 * delta );
+				composer.render( delta );
 
 
 			};
 			};
 
 

+ 12 - 14
examples/webgl_geometries.html

@@ -59,26 +59,25 @@
 				scene.add( group );
 				scene.add( group );
 
 
 				object = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), material );
 				object = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), material );
-				object.position.x = - 200;
-				object.position.z = 200;
+				object.position.set( -200, 0, 200 );
 				group.add( object );
 				group.add( object );
 
 
 
 
 				object = new THREE.Mesh( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), material );
 				object = new THREE.Mesh( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), material );
-				object.position.z = 200;
+				object.position.set( 0, 0, 200 );
 				group.add( object );
 				group.add( object );
 
 
 				object = new THREE.Mesh( new THREE.IcosahedronGeometry( 2 ), material );
 				object = new THREE.Mesh( new THREE.IcosahedronGeometry( 2 ), material );
-				object.position.x = 200;
-				object.position.z = 200;
+				object.position.set( 200, 0, 200 );
 				object.scale.x = object.scale.y = object.scale.z = 75;
 				object.scale.x = object.scale.y = object.scale.z = 75;
 				group.add( object );
 				group.add( object );
 
 
 				object = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100, 4, 4 ), material );
 				object = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100, 4, 4 ), material );
-				object.position.x = - 200;
+				object.position.set( -200, 0, 0 );
 				group.add( object );
 				group.add( object );
 
 
 				object = new THREE.Mesh( new THREE.SphereGeometry( 75, 20, 10 ), material );
 				object = new THREE.Mesh( new THREE.SphereGeometry( 75, 20, 10 ), material );
+				object.position.set( 0, 0, 0 );
 				group.add( object );
 				group.add( object );
 
 
 				var points = [];
 				var points = [];
@@ -90,21 +89,19 @@
 				}
 				}
 
 
 				object = new THREE.Mesh( new THREE.LatheGeometry( points, 20 ), material );
 				object = new THREE.Mesh( new THREE.LatheGeometry( points, 20 ), material );
-				object.position.x = 200;
+				object.position.set( 200, 0, 0 );
 				group.add( object );
 				group.add( object );
 
 
 				object = new THREE.Mesh( new THREE.TorusGeometry( 50, 20, 20, 20 ), material );
 				object = new THREE.Mesh( new THREE.TorusGeometry( 50, 20, 20, 20 ), material );
-				object.position.x = - 200;
-				object.position.z = - 200;
+				object.position.set( -200, 0, -200 );
 				group.add( object );
 				group.add( object );
 
 
 				object = new THREE.Mesh( new THREE.TorusKnotGeometry( 50, 10, 50, 20 ), material );
 				object = new THREE.Mesh( new THREE.TorusKnotGeometry( 50, 10, 50, 20 ), material );
-				object.position.z = - 200;
+				object.position.set( 0, 0, -200 );
 				group.add( object );
 				group.add( object );
 
 
 				object = new THREE.Axes();
 				object = new THREE.Axes();
-				object.position.x = 200;
-				object.position.z = - 200;
+				object.position.set( 200, 0, -200 );
 				object.scale.x = object.scale.y = object.scale.z = 0.5;
 				object.scale.x = object.scale.y = object.scale.z = 0.5;
 				group.add( object );
 				group.add( object );
 
 
@@ -133,13 +130,14 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = new Date().getTime() * 0.0001;
+				var timer = Date.now() * 0.0001;
 
 
 				camera.position.x = Math.cos( timer ) * 800;
 				camera.position.x = Math.cos( timer ) * 800;
 				camera.position.z = Math.sin( timer ) * 800;
 				camera.position.z = Math.sin( timer ) * 800;
+
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				for ( var i = 0, l = group.children.length; i < l; i++ ) {
+				for ( var i = 0, l = group.children.length; i < l; i ++ ) {
 
 
 					var object = group.children[ i ];
 					var object = group.children[ i ];
 
 

+ 2 - 2
examples/webgl_geometry_blenderexport_colors.html

@@ -72,8 +72,8 @@
 				scene.add( light );
 				scene.add( light );
 
 
 				var loader = new THREE.JSONLoader();
 				var loader = new THREE.JSONLoader();
-				loader.load( { model: "obj/cubecolors/cubecolors.js", callback: createScene1 } );
-				loader.load( { model: "obj/cubecolors/cube_fvc.js", callback: createScene2 } );
+				loader.load( "obj/cubecolors/cubecolors.js", createScene1 );
+				loader.load( "obj/cubecolors/cube_fvc.js", createScene2 );
 
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 3 - 3
examples/webgl_geometry_dynamic.html

@@ -59,7 +59,7 @@
 
 
 			var camera, controls, scene, renderer;
 			var camera, controls, scene, renderer;
 
 
-			var mesh, texture,geometry, material;
+			var mesh, texture, geometry, material;
 
 
 			var worldWidth = 128, worldDepth = 128,
 			var worldWidth = 128, worldDepth = 128,
 			worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
 			worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
@@ -139,8 +139,8 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = clock.delta(),
-					time = clock.elapsedTime * 0.01;
+				var delta = clock.getDelta(),
+					time = clock.getElapsedTime() * 10;
 
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 
 

+ 7 - 3
examples/webgl_geometry_hierarchy.html

@@ -61,8 +61,10 @@
 					mesh.position.x = Math.random() * 2000 - 1000;
 					mesh.position.x = Math.random() * 2000 - 1000;
 					mesh.position.y = Math.random() * 2000 - 1000;
 					mesh.position.y = Math.random() * 2000 - 1000;
 					mesh.position.z = Math.random() * 2000 - 1000;
 					mesh.position.z = Math.random() * 2000 - 1000;
+
 					mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
 					mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
 					mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
 					mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
+
 					mesh.matrixAutoUpdate = false;
 					mesh.matrixAutoUpdate = false;
 					mesh.updateMatrix();
 					mesh.updateMatrix();
 
 
@@ -106,9 +108,11 @@
 
 
 			function render() {
 			function render() {
 
 
-				var rx = Math.sin( new Date().getTime() * 0.0007 ) * 0.5,
-				ry = Math.sin( new Date().getTime() * 0.0003 ) * 0.5,
-				rz = Math.sin( new Date().getTime() * 0.0002 ) * 0.5;
+				var time = Date.now() * 0.001;
+
+				var rx = Math.sin( time * 0.7 ) * 0.5,
+					ry = Math.sin( time * 0.3 ) * 0.5,
+					rz = Math.sin( time * 0.2 ) * 0.5;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 6 - 5
examples/webgl_geometry_hierarchy2.html

@@ -44,11 +44,10 @@
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 				document.body.appendChild( container );
 
 
-				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 15000 );
 				camera.position.z = 500;
 				camera.position.z = 500;
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
-				scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );
 
 
 				var geometry = new THREE.CubeGeometry( 100, 100, 100 );
 				var geometry = new THREE.CubeGeometry( 100, 100, 100 );
 				var material = new THREE.MeshNormalMaterial();
 				var material = new THREE.MeshNormalMaterial();
@@ -179,9 +178,11 @@
 
 
 			function render() {
 			function render() {
 
 
-				var rx = Math.sin( new Date().getTime() * 0.0007 ) * 0.2,
-				ry = Math.sin( new Date().getTime() * 0.0003 ) * 0.1,
-				rz = Math.sin( new Date().getTime() * 0.0002 ) * 0.1;
+				var time = Date.now() * 0.001;
+
+				var rx = Math.sin( time * 0.7 ) * 0.2,
+					ry = Math.sin( time * 0.3 ) * 0.1,
+					rz = Math.sin( time * 0.2 ) * 0.1;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 19 - 17
examples/webgl_geometry_large_mesh.html

@@ -35,10 +35,10 @@
 			<p>Lucy model from <a href="http://graphics.stanford.edu/data/3Dscanrep/">Stanford 3d scanning repository</a>
 			<p>Lucy model from <a href="http://graphics.stanford.edu/data/3Dscanrep/">Stanford 3d scanning repository</a>
 			(decimated with <a href="http://meshlab.sourceforge.net/">Meshlab</a>).
 			(decimated with <a href="http://meshlab.sourceforge.net/">Meshlab</a>).
 
 
-			<p>Please be patient while the mesh is loading. It may take a while, it's 2MB file.
+			<p>Please be patient while the mesh is loading. It may take a while, it's 2 MB file.
 
 
 			<br/>
 			<br/>
-			<p>Best viewed in Chrome 8/9 or Firefox 4 using WebGL renderer.
+			<p>Best viewed in Chrome or Firefox using WebGL renderer.
 			<p>Canvas renderer is very slow for this demo and only diffuse material works there.
 			<p>Canvas renderer is very slow for this demo and only diffuse material works there.
 			<p>Use the flag --allow-file-access-from-files if working localy in Chrome.
 			<p>Use the flag --allow-file-access-from-files if working localy in Chrome.
 		</div>
 		</div>
@@ -89,14 +89,12 @@
 			function addMesh( geometry, scale, x, y, z, rx, ry, rz, material ) {
 			function addMesh( geometry, scale, x, y, z, rx, ry, rz, material ) {
 
 
 				mesh = new THREE.Mesh( geometry, material );
 				mesh = new THREE.Mesh( geometry, material );
-				mesh.scale.x = mesh.scale.y = mesh.scale.z = scale;
-				mesh.position.x = x;
-				mesh.position.y = y;
-				mesh.position.z = z;
-				mesh.rotation.x = rx;
-				mesh.rotation.y = ry;
-				mesh.rotation.z = rz;
-				scene.add(mesh);
+
+				mesh.scale.set( scale, scale, scale );
+				mesh.position.set( x, y, z );
+				mesh.rotation.set( rx, ry, rz );
+
+				scene.add( mesh );
 
 
 			}
 			}
 
 
@@ -127,27 +125,31 @@
 
 
 				sphere = new THREE.SphereGeometry( 100, 16, 8, 1 );
 				sphere = new THREE.SphereGeometry( 100, 16, 8, 1 );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
 				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
-				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
+				lightMesh.scale.set( 0.05, 0.05, 0.05 );
 				lightMesh.position = pointLight.position;
 				lightMesh.position = pointLight.position;
 				scene.add( lightMesh );
 				scene.add( lightMesh );
 
 
 
 
 				if ( render_gl ) {
 				if ( render_gl ) {
 					try {
 					try {
+
 						webglRenderer = new THREE.WebGLRenderer( { antialias: true } );
 						webglRenderer = new THREE.WebGLRenderer( { antialias: true } );
 						webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 						webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 						webglRenderer.domElement.style.position = "relative";
 						webglRenderer.domElement.style.position = "relative";
 						container.appendChild( webglRenderer.domElement );
 						container.appendChild( webglRenderer.domElement );
 						has_gl = 1;
 						has_gl = 1;
+
 					}
 					}
 					catch (e) {
 					catch (e) {
 					}
 					}
 				}
 				}
 
 
 				if( render_canvas ) {
 				if( render_canvas ) {
+
 					canvasRenderer = new THREE.CanvasRenderer();
 					canvasRenderer = new THREE.CanvasRenderer();
 					canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 					canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
 					container.appendChild( canvasRenderer.domElement );
 					container.appendChild( canvasRenderer.domElement );
+
 				}
 				}
 
 
 
 
@@ -164,7 +166,7 @@
 				//loader = new THREE.JSONLoader( true );
 				//loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 				document.body.appendChild( loader.statusDomElement );
 
 
-				var s = (new Date).getTime(),
+				var s = Date.now(),
 					callback = function( geometry ) { createScene( geometry, s ) };
 					callback = function( geometry ) { createScene( geometry, s ) };
 
 
 				//loader.load( { model: 'obj/lucy/Lucy100k_slim.js', callback: callback } );
 				//loader.load( { model: 'obj/lucy/Lucy100k_slim.js', callback: callback } );
@@ -185,11 +187,11 @@
 				log( "geometry.vertices: " + geometry.vertices.length );
 				log( "geometry.vertices: " + geometry.vertices.length );
 				log( "geometry.faces: " + geometry.faces.length );
 				log( "geometry.faces: " + geometry.faces.length );
 
 
-				log( "model loaded and created in " + ((new Date).getTime() - start) + " ms" );
+				log( "model loaded and created in " + ( Date.now() - start ) + " ms" );
 
 
 			}
 			}
 
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 
 				mouseX = ( event.clientX - windowHalfX );
 				mouseX = ( event.clientX - windowHalfX );
 				mouseY = ( event.clientY - windowHalfY );
 				mouseY = ( event.clientY - windowHalfY );
@@ -221,15 +223,14 @@
 
 
 				r += 0.01;
 				r += 0.01;
 
 
-
 				if ( render_canvas ) canvasRenderer.render( scene, camera );
 				if ( render_canvas ) canvasRenderer.render( scene, camera );
 				if ( render_gl && has_gl ) webglRenderer.render( scene, camera );
 				if ( render_gl && has_gl ) webglRenderer.render( scene, camera );
 
 
 			}
 			}
 
 
-			function log(text) {
+			function log( text ) {
 
 
-				var e = document.getElementById("log");
+				var e = document.getElementById( "log" );
 				e.innerHTML = text + "<br/>" + e.innerHTML;
 				e.innerHTML = text + "<br/>" + e.innerHTML;
 
 
 			}
 			}
@@ -263,6 +264,7 @@
 				canvasRenderer.domElement.style.display = render_canvas ? "block" : "none";
 				canvasRenderer.domElement.style.display = render_canvas ? "block" : "none";
 
 
 			}
 			}
+
 		</script>
 		</script>
 
 
 	</body>
 	</body>

+ 1 - 1
examples/webgl_geometry_minecraft.html

@@ -234,7 +234,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				controls.update( clock.delta() );
+				controls.update( clock.getDelta() );
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 			}
 			}

+ 1 - 1
examples/webgl_geometry_minecraft_ao.html

@@ -801,7 +801,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				controls.update( clock.delta() );
+				controls.update( clock.getDelta() );
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 			}
 			}

+ 1 - 1
examples/webgl_geometry_shapes.html

@@ -1,7 +1,7 @@
 <!doctype html>
 <!doctype html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js canvas - geometry - shapes</title>
+		<title>three.js webgl - geometry - shapes</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>

+ 1 - 1
examples/webgl_geometry_terrain.html

@@ -219,7 +219,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				controls.update( clock.delta() );
+				controls.update( clock.getDelta() );
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 			}
 			}

+ 3 - 1
examples/webgl_geometry_terrain_fog.html

@@ -60,6 +60,8 @@
 			var worldWidth = 256, worldDepth = 256,
 			var worldWidth = 256, worldDepth = 256,
 			worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
 			worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
 
 
+			var clock = new THREE.Clock();
+
 			init();
 			init();
 			animate();
 			animate();
 
 
@@ -220,7 +222,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				controls.update();
+				controls.update( clock.getDelta() );
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 			}
 			}

+ 4 - 8
examples/webgl_geometry_text.html

@@ -343,12 +343,16 @@
 				var renderModel = new THREE.RenderPass( scene, camera );
 				var renderModel = new THREE.RenderPass( scene, camera );
 				var effectBloom = new THREE.BloomPass( 0.25 );
 				var effectBloom = new THREE.BloomPass( 0.25 );
 				var effectFilm = new THREE.FilmPass( 0.5, 0.125, 2048, false );
 				var effectFilm = new THREE.FilmPass( 0.5, 0.125, 2048, false );
+				var effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
+
+				effectFXAA.uniforms[ 'resolution' ].value.set( 1 / window.innerWidth, 1 / window.innerHeight );
 
 
 				effectFilm.renderToScreen = true;
 				effectFilm.renderToScreen = true;
 
 
 				composer = new THREE.EffectComposer( renderer );
 				composer = new THREE.EffectComposer( renderer );
 
 
 				composer.addPass( renderModel );
 				composer.addPass( renderModel );
+				composer.addPass( effectFXAA );
 				composer.addPass( effectBloom );
 				composer.addPass( effectBloom );
 				composer.addPass( effectFilm );
 				composer.addPass( effectFilm );
 
 
@@ -604,16 +608,8 @@
 
 
 			}
 			}
 
 
-			var delta, time, oldTime;
-
 			function render() {
 			function render() {
 
 
-				if ( ! oldTime ) oldTime = new Date().getTime();
-
-				time = new Date().getTime();
-				delta = 0.1 * ( time - oldTime );
-				oldTime = time;
-
 				parent.rotation.y += ( targetRotation - parent.rotation.y ) * 0.05;
 				parent.rotation.y += ( targetRotation - parent.rotation.y ) * 0.05;
 
 
 				camera.lookAt( cameraTarget );
 				camera.lookAt( cameraTarget );

+ 4 - 5
examples/webgl_hdr.html

@@ -115,7 +115,9 @@
 
 
 			var materialHDR, quad;
 			var materialHDR, quad;
 
 
-			var delta, current, old = 0, sign = 1, rate = 1;
+			var sign = 1, rate = 1;
+
+			var clock = new THREE.Clock();
 
 
 			init();
 			init();
 			animate();
 			animate();
@@ -185,10 +187,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				if ( ! old ) old = new Date().getTime();
-				current = new Date().getTime();
-				delta = (current  - old ) * 0.005;
-				old = current;
+				delta = clock.getDelta() * 5;
 
 
 				if ( materialHDR.uniforms.exposure.value > 0 || materialHDR.uniforms.exposure.value < 1 ) {
 				if ( materialHDR.uniforms.exposure.value > 0 || materialHDR.uniforms.exposure.value < 1 ) {
 
 

+ 1 - 1
examples/webgl_lights_pointlights.html

@@ -130,7 +130,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 
 				if( object ) object.rotation.y -= 0.01;
 				if( object ) object.rotation.y -= 0.01;
 
 

+ 1 - 1
examples/webgl_lines_colors.html

@@ -267,7 +267,7 @@
 
 
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 
 				for( var i = 0; i < scene.objects.length; i ++ ) {
 				for( var i = 0; i < scene.objects.length; i ++ ) {
 
 

+ 10 - 6
examples/webgl_lines_cubes.html

@@ -68,8 +68,8 @@
 
 
 				var i, material, container;
 				var i, material, container;
 
 
-				container = document.createElement('div');
-				document.body.appendChild(container);
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
 
 
 				camera = new THREE.PerspectiveCamera( 33, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera = new THREE.PerspectiveCamera( 33, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 700;
 				camera.position.z = 700;
@@ -105,14 +105,18 @@
 								   [ m1, scale*0.5, [2*d, -d, 0], g1 ], [ m1, scale*0.5, [-2*d, -d, 0], g1 ],
 								   [ m1, scale*0.5, [2*d, -d, 0], g1 ], [ m1, scale*0.5, [-2*d, -d, 0], g1 ],
 								   ];
 								   ];
 
 
-				for ( i = 0; i < parameters.length; ++i ) {
+				for ( i = 0; i < parameters.length; i ++ ) {
 
 
 					p = parameters[ i ];
 					p = parameters[ i ];
+
 					line = new THREE.Line( p[ 3 ],  p[ 0 ] );
 					line = new THREE.Line( p[ 3 ],  p[ 0 ] );
+
 					line.scale.x = line.scale.y = line.scale.z =  p[ 1 ];
 					line.scale.x = line.scale.y = line.scale.z =  p[ 1 ];
+
 					line.position.x = p[ 2 ][ 0 ];
 					line.position.x = p[ 2 ][ 0 ];
 					line.position.y = p[ 2 ][ 1 ];
 					line.position.y = p[ 2 ][ 1 ];
 					line.position.z = p[ 2 ][ 2 ];
 					line.position.z = p[ 2 ][ 2 ];
+
 					scene.add( line );
 					scene.add( line );
 
 
 				}
 				}
@@ -212,11 +216,11 @@
 
 
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				var time = new Date().getTime() * 0.0015;
+				var time = Date.now() * 0.0015;
 
 
-				for( var i = 0; i < scene.objects.length; i++ ) {
+				for( var i = 0; i < scene.objects.length; i ++ ) {
 
 
-					scene.objects[ i ].rotation.y = time * ( i % 2 ? 1 : -1);
+					scene.objects[ i ].rotation.y = time * ( i % 2 ? 1 : -1 );
 
 
 				}
 				}
 
 

+ 4 - 5
examples/webgl_lines_sphere.html

@@ -87,7 +87,7 @@
 					geometry = new THREE.Geometry();
 					geometry = new THREE.Geometry();
 
 
 
 
-				for ( i = 0; i < 1500; ++i ) {
+				for ( i = 0; i < 1500; i ++ ) {
 
 
 					vector1 = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 					vector1 = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 					vector1.normalize();
 					vector1.normalize();
@@ -169,17 +169,16 @@
 
 
 			function render() {
 			function render() {
 
 
-				//camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY + 200 - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY + 200 - camera.position.y ) * .05;
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
-				var time = new Date().getTime() * 0.0001;
+				var time = Date.now() * 0.0001;
 
 
-				for( var i = 0; i<scene.objects.length; i++ ) {
+				for( var i = 0; i < scene.objects.length; i ++ ) {
 
 
-					scene.objects[i].rotation.y = time * ( i < 4 ? i+1 : - (i+1) );
+					scene.objects[ i ].rotation.y = time * ( i < 4 ? ( i + 1 ) : - ( i + 1 ) );
 
 
 					if ( i < 5 ) scene.objects[i].scale.x = scene.objects[i].scale.y = scene.objects[i].scale.z = scene.objects[i].originalScale * (i/5+1) * (1 + 0.5 * Math.sin( 7*time ) );
 					if ( i < 5 ) scene.objects[i].scale.x = scene.objects[i].scale.y = scene.objects[i].scale.z = scene.objects[i].originalScale * (i/5+1) * (1 + 0.5 * Math.sin( 7*time ) );
 
 

+ 3 - 3
examples/webgl_lines_splines.html

@@ -200,7 +200,7 @@
 
 
 			//
 			//
 
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 
 				mouseX = event.clientX - windowHalfX;
 				mouseX = event.clientX - windowHalfX;
 				mouseY = event.clientY - windowHalfY;
 				mouseY = event.clientY - windowHalfY;
@@ -245,11 +245,11 @@
 
 
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				var time = new Date().getTime() * 0.0005;
+				var time = Date.now() * 0.0005;
 
 
 				for( var i = 0; i < scene.objects.length; i ++ ) {
 				for( var i = 0; i < scene.objects.length; i ++ ) {
 
 
-					scene.objects[ i ].rotation.y = time * ( i % 2 ? 1 : -1);
+					scene.objects[ i ].rotation.y = time * ( i % 2 ? 1 : -1 );
 
 
 				}
 				}
 
 

+ 2 - 2
examples/webgl_materials.html

@@ -201,14 +201,14 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = new Date().getTime() * 0.0001;
+				var timer = 0.0001 * Date.now();
 
 
 				camera.position.x = Math.cos( timer ) * 1000;
 				camera.position.x = Math.cos( timer ) * 1000;
 				camera.position.z = Math.sin( timer ) * 1000;
 				camera.position.z = Math.sin( timer ) * 1000;
 
 
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				for ( var i = 0, l = objects.length; i < l; i++ ) {
+				for ( var i = 0, l = objects.length; i < l; i ++ ) {
 
 
 					var object = objects[ i ];
 					var object = objects[ i ];
 
 

+ 1 - 3
examples/webgl_materials_cars.html

@@ -153,8 +153,6 @@
 			var loader = new THREE.BinaryLoader( true );
 			var loader = new THREE.BinaryLoader( true );
 			document.body.appendChild( loader.statusDomElement );
 			document.body.appendChild( loader.statusDomElement );
 
 
-			var clock = new THREE.Clock();
-
 			init();
 			init();
 			animate();
 			animate();
 
 
@@ -603,7 +601,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = -0.0002 * clock.elapsed();
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 
 

+ 1 - 1
examples/webgl_materials_cars_anaglyph.html

@@ -591,7 +591,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 
 

+ 2 - 2
examples/webgl_materials_cars_camaro.html

@@ -180,7 +180,7 @@
 
 
 				var mesh = new THREE.Mesh( geometry, m );
 				var mesh = new THREE.Mesh( geometry, m );
 				mesh.rotation.y = 1;
 				mesh.rotation.y = 1;
-				mesh.scale.x = mesh.scale.y = mesh.scale.z = s;
+				mesh.scale.set( s, s, s );
 				scene.add( mesh );
 				scene.add( mesh );
 
 
 				createButtons( materials.body, geometry );
 				createButtons( materials.body, geometry );
@@ -207,7 +207,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 1 - 1
examples/webgl_materials_cars_camaro_crosseyed.html

@@ -230,7 +230,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 1 - 1
examples/webgl_materials_cars_parallaxbarrier.html

@@ -592,7 +592,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 
 

+ 1 - 1
examples/webgl_materials_cubemap.html

@@ -201,7 +201,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 2 - 2
examples/webgl_materials_cubemap_balls_reflection.html

@@ -44,7 +44,7 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			var container, timer;
+			var container;
 
 
 			var camera, scene, renderer;
 			var camera, scene, renderer;
 			var cameraCube, sceneCube, cubeTarget;
 			var cameraCube, sceneCube, cubeTarget;
@@ -155,7 +155,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				timer = new Date().getTime() * 0.0001;
+				var timer = 0.0001 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 2 - 2
examples/webgl_materials_cubemap_balls_reflection_anaglyph.html

@@ -44,7 +44,7 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			var container, timer;
+			var container;
 
 
 			var camera, scene, renderer;
 			var camera, scene, renderer;
 
 
@@ -147,7 +147,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				timer = new Date().getTime() * 0.0001;
+				var timer = 0.0001 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 2 - 2
examples/webgl_materials_cubemap_balls_refraction.html

@@ -44,7 +44,7 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			var container, timer;
+			var container;
 
 
 			var camera, scene, renderer;
 			var camera, scene, renderer;
 			var cameraCube, sceneCube, cubeTarget;
 			var cameraCube, sceneCube, cubeTarget;
@@ -154,7 +154,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				timer = new Date().getTime() * 0.0001;
+				var timer = 0.0001 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 2 - 2
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -47,7 +47,7 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			var container, timer;
+			var container;
 
 
 			var camera, scene, renderer;
 			var camera, scene, renderer;
 
 
@@ -166,7 +166,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				timer = new Date().getTime() * 0.0001;
+				var timer = 0.0001 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 1 - 1
examples/webgl_materials_cubemap_dynamic.html

@@ -875,7 +875,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = 0.001 * clock.delta();
+				var delta = clock.getDelta();
 
 
 				// day / night
 				// day / night
 
 

+ 1 - 1
examples/webgl_materials_cubemap_refraction.html

@@ -194,7 +194,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 1 - 1
examples/webgl_materials_grass.html

@@ -113,7 +113,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() / 6000;
+				var time = Date.now() / 6000;
 
 
 				camera.position.x = 80 * Math.cos( time );
 				camera.position.x = 80 * Math.cos( time );
 				camera.position.z = 80 * Math.sin( time );
 				camera.position.z = 80 * Math.sin( time );

+ 1 - 1
examples/webgl_materials_normalmap2.html

@@ -132,7 +132,7 @@
 				loader = new THREE.JSONLoader( true );
 				loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 				document.body.appendChild( loader.statusDomElement );
 
 
-				loader.load( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createScene( geometry, 100, material ) } } );
+				loader.load( "obj/leeperrysmith/LeePerrySmith.js", function( geometry ) { createScene( geometry, 100, material ) } );
 
 
 				renderer = new THREE.WebGLRenderer();
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 1 - 1
examples/webgl_materials_shaders.html

@@ -227,7 +227,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var timer = - new Date().getTime() * 0.0002;
+				var timer = -0.0002 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 2 - 2
examples/webgl_materials_shaders_fresnel.html

@@ -43,7 +43,7 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			var container, timer;
+			var container;
 
 
 			var camera, scene, renderer;
 			var camera, scene, renderer;
 			var cameraCube, sceneCube;
 			var cameraCube, sceneCube;
@@ -162,7 +162,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				timer = new Date().getTime() * 0.0001;
+				var timer = 0.0001 * Date.now();
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 1 - 1
examples/webgl_materials_skin.html

@@ -147,7 +147,7 @@
 				loader = new THREE.JSONLoader( true );
 				loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 				document.body.appendChild( loader.statusDomElement );
 
 
-				loader.load( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createScene( geometry, 100, material ) } } );
+				loader.load(  "obj/leeperrysmith/LeePerrySmith.js", function( geometry ) { createScene( geometry, 100, material ) } );
 
 
 				// RENDERER
 				// RENDERER
 
 

+ 1 - 1
examples/webgl_materials_video.html

@@ -226,7 +226,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.00005;
+				var time = Date.now() * 0.00005;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;

+ 1 - 1
examples/webgl_morphtargets_horse.html

@@ -118,7 +118,7 @@
 
 
 					// Alternate morph targets
 					// Alternate morph targets
 
 
-					var time = new Date().getTime() % duration;
+					var time = Date.now() % duration;
 
 
 					var keyframe = Math.floor( time / interpolation ) + 1;
 					var keyframe = Math.floor( time / interpolation ) + 1;
 
 

+ 4 - 4
examples/webgl_particles_billboards.html

@@ -61,7 +61,7 @@
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 				document.body.appendChild( container );
 
 
-				camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 1, 3000 );
+				camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 2, 2000 );
 				camera.position.z = 1000;
 				camera.position.z = 1000;
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
@@ -71,7 +71,7 @@
 
 
 				sprite = THREE.ImageUtils.loadTexture( "textures/sprites/disc.png" );
 				sprite = THREE.ImageUtils.loadTexture( "textures/sprites/disc.png" );
 
 
-				for ( i = 0; i < 10000; i++ ) {
+				for ( i = 0; i < 10000; i ++ ) {
 
 
 					x = 2000 * Math.random() - 1000;
 					x = 2000 * Math.random() - 1000;
 					y = 2000 * Math.random() - 1000;
 					y = 2000 * Math.random() - 1000;
@@ -91,7 +91,7 @@
 
 
 				//
 				//
 
 
-				renderer = new THREE.WebGLRenderer( { clearAlpha: 1 });
+				renderer = new THREE.WebGLRenderer( { clearAlpha: 1 } );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				container.appendChild( renderer.domElement );
 				container.appendChild( renderer.domElement );
 
 
@@ -155,7 +155,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.00005;
+				var time = Date.now() * 0.00005;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;

+ 2 - 2
examples/webgl_particles_billboards_colors.html

@@ -71,7 +71,7 @@
 
 
 				sprite = THREE.ImageUtils.loadTexture( "textures/sprites/ball.png" );
 				sprite = THREE.ImageUtils.loadTexture( "textures/sprites/ball.png" );
 
 
-				for ( i = 0; i < 5000; i++ ) {
+				for ( i = 0; i < 5000; i ++ ) {
 
 
 					x = 2000 * Math.random() - 1000;
 					x = 2000 * Math.random() - 1000;
 					y = 2000 * Math.random() - 1000;
 					y = 2000 * Math.random() - 1000;
@@ -171,7 +171,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.00005;
+				var time = Date.now() * 0.00005;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;

+ 8 - 12
examples/webgl_particles_dynamic.html

@@ -75,6 +75,8 @@
 
 
 			var composer, effectFocus;
 			var composer, effectFocus;
 
 
+			var clock = new THREE.Clock();
+
 			init();
 			init();
 			animate();
 			animate();
 
 
@@ -98,7 +100,7 @@
 
 
 				document.body.appendChild( bloader.statusDomElement );
 				document.body.appendChild( bloader.statusDomElement );
 
 
-				aloader.load( { model: "obj/terrain.js", callback: function( geometry ) {
+				aloader.load( "obj/terrain.js", function( geometry ) {
 
 
 					createMesh( geometry, scene, 16.8, -11000, -200,  -5000, 0x00ff44, false );
 					createMesh( geometry, scene, 16.8, -11000, -200,  -5000, 0x00ff44, false );
 					createMesh( geometry, scene, 16.8,  11000, -200, -15000, 0x00ff33, false );
 					createMesh( geometry, scene, 16.8,  11000, -200, -15000, 0x00ff33, false );
@@ -109,7 +111,7 @@
 					createMesh( geometry, scene, 16.8,  13000, -200,   5000, 0x00ff55, false );
 					createMesh( geometry, scene, 16.8,  13000, -200,   5000, 0x00ff55, false );
 					createMesh( geometry, scene, 16.8,  13000, -200,  -5000, 0x00ff66, false );
 					createMesh( geometry, scene, 16.8,  13000, -200,  -5000, 0x00ff66, false );
 
 
-				} } );
+				} );
 
 
 				bloader.load( { model: "obj/veyron/VeyronNoUv_bin.js", callback: function( geometry ) { createMesh( geometry, scene, 6.8, 2200, -200, -100, 0x0055ff, false ) } } );
 				bloader.load( { model: "obj/veyron/VeyronNoUv_bin.js", callback: function( geometry ) { createMesh( geometry, scene, 6.8, 2200, -200, -100, 0x0055ff, false ) } } );
 
 
@@ -285,8 +287,7 @@
 			}
 			}
 
 
 
 
-			var j, jl, cm, data, vertices, vertices_tmp, vl, d, vt,
-				time, oldTime, delta;
+			var j, jl, cm, data, vertices, vertices_tmp, vl, d, vt;
 
 
 			function animate () {
 			function animate () {
 
 
@@ -297,25 +298,20 @@
 
 
 			function render () {
 			function render () {
 
 
-				if ( ! oldTime ) oldTime = Date.now();
-
-				time = Date.now();
-
-				delta = 0.01 * ( time - oldTime );
-				oldTime = time;
+				delta = 10 * clock.getDelta();;
 
 
 				delta = delta < 2 ? delta : 2;
 				delta = delta < 2 ? delta : 2;
 
 
 				parent.rotation.y += -0.02 * delta;
 				parent.rotation.y += -0.02 * delta;
 
 
-				for( j = 0, jl = clonemeshes.length; j < jl; j++ ) {
+				for( j = 0, jl = clonemeshes.length; j < jl; j ++ ) {
 
 
 					cm = clonemeshes[ j ];
 					cm = clonemeshes[ j ];
 					cm.mesh.rotation.y += -0.1 * delta * cm.speed;
 					cm.mesh.rotation.y += -0.1 * delta * cm.speed;
 
 
 				}
 				}
 
 
-				for( j = 0, jl = meshes.length; j < jl; j++ ) {
+				for( j = 0, jl = meshes.length; j < jl; j ++ ) {
 
 
 					data = meshes[ j ];
 					data = meshes[ j ];
 					mesh = data.mesh;
 					mesh = data.mesh;

+ 5 - 5
examples/webgl_particles_random.html

@@ -69,7 +69,7 @@
 
 
 				geometry = new THREE.Geometry();
 				geometry = new THREE.Geometry();
 
 
-				for ( i = 0; i < 4000; i++ ) {
+				for ( i = 0; i < 20000; i ++ ) {
 
 
 					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
 					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
 					geometry.vertices.push( new THREE.Vertex( vector ) );
 					geometry.vertices.push( new THREE.Vertex( vector ) );
@@ -80,7 +80,7 @@
 				//parameters = [ [ 0xff0000, 5 ], [ 0xff3300, 4 ], [ 0xff6600, 3 ], [ 0xff9900, 2 ], [ 0xffaa00, 1 ] ];
 				//parameters = [ [ 0xff0000, 5 ], [ 0xff3300, 4 ], [ 0xff6600, 3 ], [ 0xff9900, 2 ], [ 0xffaa00, 1 ] ];
 				//parameters = [ [ 0xffffff, 5 ], [ 0xdddddd, 4 ], [ 0xaaaaaa, 3 ], [ 0x999999, 2 ], [ 0x777777, 1 ] ];
 				//parameters = [ [ 0xffffff, 5 ], [ 0xdddddd, 4 ], [ 0xaaaaaa, 3 ], [ 0x999999, 2 ], [ 0x777777, 1 ] ];
 
 
-				for ( i = 0; i < parameters.length; i++ ) {
+				for ( i = 0; i < parameters.length; i ++ ) {
 
 
 					size  = parameters[i][1];
 					size  = parameters[i][1];
 					color = parameters[i][0];
 					color = parameters[i][0];
@@ -160,20 +160,20 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.00005;
+				var time = Date.now() * 0.00005;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 
 
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				for( i = 0; i < scene.objects.length; i++ ) {
+				for( i = 0; i < scene.objects.length; i ++ ) {
 
 
 					scene.objects[i].rotation.y = time * ( i < 4 ? i+1 : - (i+1) );
 					scene.objects[i].rotation.y = time * ( i < 4 ? i+1 : - (i+1) );
 
 
 				}
 				}
 
 
-				for( i = 0; i < materials.length; i++ ) {
+				for( i = 0; i < materials.length; i ++ ) {
 
 
 					color = parameters[i][0];
 					color = parameters[i][0];
 
 

+ 2 - 5
examples/webgl_particles_shapes.html

@@ -82,8 +82,6 @@
 
 
 			var text, plane;
 			var text, plane;
 
 
-			var oldTime = new Date().getTime() * 0.001;
-			var delta = 1;
 			var speed = 50;
 			var speed = 50;
 
 
 			var pointLight;
 			var pointLight;
@@ -97,6 +95,7 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 			var windowHalfY = window.innerHeight / 2;
 
 
+			var delta = 1, clock = new THREE.Clock();
 
 
 			var heartShape, particleCloud, sparksEmitter, emitterPos;
 			var heartShape, particleCloud, sparksEmitter, emitterPos;
 			var _rotation = 0;
 			var _rotation = 0;
@@ -624,9 +623,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.001;
-				delta = speed * ( time - oldTime );
-				oldTime = time;
+				delta = speed * clock.getDelta();
 
 
 				particleCloud.geometry.__dirtyVertices = true;
 				particleCloud.geometry.__dirtyVertices = true;
 
 

+ 11 - 7
examples/webgl_particles_sprites.html

@@ -62,7 +62,7 @@
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 				document.body.appendChild( container );
 
 
-				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 3000 );
+				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.z = 1000;
 				camera.position.z = 1000;
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
@@ -76,17 +76,21 @@
 				sprite4 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake4.png" );
 				sprite4 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake4.png" );
 				sprite5 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake5.png" );
 				sprite5 = THREE.ImageUtils.loadTexture( "textures/sprites/snowflake5.png" );
 
 
-				for ( i = 0; i < 2000; i ++ ) {
+				for ( i = 0; i < 10000; i ++ ) {
 
 
 					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
 					vector = new THREE.Vector3( Math.random() * 2000 - 1000, Math.random() * 2000 - 1000, Math.random() * 2000 - 1000 );
 					geometry.vertices.push( new THREE.Vertex( vector ) );
 					geometry.vertices.push( new THREE.Vertex( vector ) );
 
 
 				}
 				}
 
 
-				parameters = [ [ [1.0, 0.2, 1.0], sprite2, 20 ], [ [0.95, 0.1, 1], sprite3, 15 ], [ [0.90, 0.05, 1], sprite1, 10 ], [ [0.85, 0, 0.8], sprite5, 8 ], [ [0.80, 0, 0.7], sprite4, 5 ],
+				parameters = [ [ [1.0, 0.2, 1.0], sprite2, 20 ],
+							   [ [0.95, 0.1, 1], sprite3, 15 ],
+							   [ [0.90, 0.05, 1], sprite1, 10 ],
+							   [ [0.85, 0, 0.8], sprite5, 8 ],
+							   [ [0.80, 0, 0.7], sprite4, 5 ],
 							   ];
 							   ];
 
 
-				for ( i = 0; i < parameters.length; i++ ) {
+				for ( i = 0; i < parameters.length; i ++ ) {
 
 
 					color  = parameters[i][0];
 					color  = parameters[i][0];
 					sprite = parameters[i][1];
 					sprite = parameters[i][1];
@@ -165,20 +169,20 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.00005;
+				var time = Date.now() * 0.00005;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 
 
 				camera.lookAt( scene.position );
 				camera.lookAt( scene.position );
 
 
-				for( i = 0; i < scene.objects.length; i++ ) {
+				for( i = 0; i < scene.objects.length; i ++ ) {
 
 
 					scene.objects[i].rotation.y = time * ( i < 4 ? i+1 : - (i+1) );
 					scene.objects[i].rotation.y = time * ( i < 4 ? i+1 : - (i+1) );
 
 
 				}
 				}
 
 
-				for( i = 0; i < materials.length; i++ ) {
+				for( i = 0; i < materials.length; i ++ ) {
 
 
 					color = parameters[i][0];
 					color = parameters[i][0];
 
 

+ 2 - 3
examples/webgl_postprocessing.html

@@ -128,13 +128,12 @@
 				sceneModel = new THREE.Scene();
 				sceneModel = new THREE.Scene();
 
 
 				directionalLight = new THREE.DirectionalLight( 0xffffff );
 				directionalLight = new THREE.DirectionalLight( 0xffffff );
-				directionalLight.position.set( 0, 0, 1 );
-				directionalLight.position.normalize();
+				directionalLight.position.set( 0, 0, 1 ).normalize();
 				sceneModel.add( directionalLight );
 				sceneModel.add( directionalLight );
 
 
 				loader = new THREE.JSONLoader( true );
 				loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 				document.body.appendChild( loader.statusDomElement );
-				loader.load( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createMesh( geometry, sceneModel, 100 ) } } );
+				loader.load( "obj/leeperrysmith/LeePerrySmith.js", function( geometry ) { createMesh( geometry, sceneModel, 100 ) } );
 
 
 				//
 				//
 
 

+ 6 - 7
examples/webgl_postprocessing_dof.html

@@ -124,9 +124,9 @@
 				//var s = 0.25;
 				//var s = 0.25;
 				var s = 60;
 				var s = 60;
 
 
-				for ( i = 0; i < xgrid; i++ )
-				for ( j = 0; j < ygrid; j++ )
-				for ( k = 0; k < zgrid; k++ ) {
+				for ( i = 0; i < xgrid; i ++ )
+				for ( j = 0; j < ygrid; j ++ )
+				for ( k = 0; k < zgrid; k ++ ) {
 
 
 					if ( singleMaterial ) {
 					if ( singleMaterial ) {
 
 
@@ -153,7 +153,7 @@
 					scene.add( mesh );
 					scene.add( mesh );
 					objects.push( mesh );
 					objects.push( mesh );
 
 
-					c++;
+					c ++;
 
 
 				}
 				}
 
 
@@ -287,10 +287,9 @@
 
 
 				if ( !singleMaterial ) {
 				if ( !singleMaterial ) {
 
 
-					for( i = 0; i < nobjects; i++ ) {
+					for( i = 0; i < nobjects; i ++ ) {
 
 
-						h = ( 360 * ( i/nobjects + time ) % 360 ) / 360;
-						//materials[ i ].color.setHSV( h, 0.5 + 0.5 * ( i % 20 / 20 ), 1 );
+						h = ( 360 * ( i / nobjects + time ) % 360 ) / 360;
 						materials[ i ].color.setHSV( h, 1, 1 );
 						materials[ i ].color.setHSV( h, 1, 1 );
 
 
 					}
 					}

+ 1 - 1
examples/webgl_rtt.html

@@ -232,7 +232,7 @@
 
 
 			function render() {
 			function render() {
 
 
-				var time = new Date().getTime() * 0.0015;
+				var time = Date.now() * 0.0015;
 
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;

+ 3 - 3
examples/webgl_shader2.html

@@ -199,7 +199,7 @@
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 
-				start_time = new Date().getTime();
+				start_time = Date.now();
 
 
 				uniforms1 = {
 				uniforms1 = {
 					time: { type: "f", value: 1.0 },
 					time: { type: "f", value: 1.0 },
@@ -278,9 +278,9 @@
 			function render() {
 			function render() {
 
 
 				uniforms1.time.value += 0.05;
 				uniforms1.time.value += 0.05;
-				uniforms2.time.value = ( new Date().getTime() - start_time ) / 1000;
+				uniforms2.time.value = ( Date.now() - start_time ) / 1000;
 
 
-				for( var i = 0; i < meshes.length; ++i ) {
+				for( var i = 0; i < meshes.length; ++ i ) {
 
 
 					meshes[ i ].rotation.y += 0.01 * ( i % 2 ? 1 : -1 );
 					meshes[ i ].rotation.y += 0.01 * ( i % 2 ? 1 : -1 );
 					meshes[ i ].rotation.x += 0.01 * ( i % 2 ? -1 : 1 );
 					meshes[ i ].rotation.x += 0.01 * ( i % 2 ? -1 : 1 );

+ 4 - 6
examples/webgl_shader_lava.html

@@ -171,8 +171,6 @@
 				} );
 				} );
 
 
 				mesh = new THREE.Mesh( new THREE.TorusGeometry( size, 0.3, 30, 30 ), [ material /*, new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 2 } ) */ ] );
 				mesh = new THREE.Mesh( new THREE.TorusGeometry( size, 0.3, 30, 30 ), [ material /*, new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 2 } ) */ ] );
-				mesh.position.x = 0;
-				mesh.position.y = 0;
 				mesh.rotation.x = 0.3;
 				mesh.rotation.x = 0.3;
 				scene.add( mesh );
 				scene.add( mesh );
 
 
@@ -238,12 +236,12 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = 0.05 * clock.delta();
+				var delta = 5 * clock.getDelta();
 
 
-				uniforms.time.value += 0.02 * delta;
+				uniforms.time.value += 0.2 * delta;
 
 
-				mesh.rotation.y += 0.00125 * delta;
-				mesh.rotation.x += 0.005 * delta;
+				mesh.rotation.y += 0.0125 * delta;
+				mesh.rotation.x += 0.05 * delta;
 
 
 				renderer.clear();
 				renderer.clear();
 				composer.render( 0.01 );
 				composer.render( 0.01 );

+ 2 - 2
examples/webgl_shading_physical.html

@@ -593,10 +593,10 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = clock.delta();
+				var delta = 1000 * clock.getDelta();
 
 
 				TWEEN.update();
 				TWEEN.update();
-				controls.update( delta );
+				controls.update();
 
 
 				if ( morph ) morph.updateAnimation( delta );
 				if ( morph ) morph.updateAnimation( delta );
 
 

+ 31 - 31
examples/webgl_shadowmap.html

@@ -284,69 +284,69 @@
 
 
 				var loader = new THREE.JSONLoader();
 				var loader = new THREE.JSONLoader();
 
 
-				loader.load( { model: "models/animated/horse.js", callback: function( geometry ) {
+				loader.load( "models/animated/horse.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
 
 
-					addMorph( geometry, 0.55, 1000, 100 - Math.random() * 1000, FLOOR, 300, true );
-					addMorph( geometry, 0.55, 1000, 100 - Math.random() * 1000, FLOOR, 450, true );
-					addMorph( geometry, 0.55, 1000, 100 - Math.random() * 1000, FLOOR, 600, true );
+					addMorph( geometry, 550, 1000, 100 - Math.random() * 1000, FLOOR, 300, true );
+					addMorph( geometry, 550, 1000, 100 - Math.random() * 1000, FLOOR, 450, true );
+					addMorph( geometry, 550, 1000, 100 - Math.random() * 1000, FLOOR, 600, true );
 
 
-					addMorph( geometry, 0.55, 1000, 100 - Math.random() * 1000, FLOOR, -300, true );
-					addMorph( geometry, 0.55, 1000, 100 - Math.random() * 1000, FLOOR, -450, true );
-					addMorph( geometry, 0.55, 1000, 100 - Math.random() * 1000, FLOOR, -600, true );
+					addMorph( geometry, 550, 1000, 100 - Math.random() * 1000, FLOOR, -300, true );
+					addMorph( geometry, 550, 1000, 100 - Math.random() * 1000, FLOOR, -450, true );
+					addMorph( geometry, 550, 1000, 100 - Math.random() * 1000, FLOOR, -600, true );
 
 
-				} } );
+				} );
 
 
 				/*
 				/*
-				loader.load( { model: "obj/morphs/fox.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/fox.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.2, 1000, 100 - Math.random() * 500, FLOOR - 5, 600 );
+					addMorph( geometry, 200, 1000, 100 - Math.random() * 500, FLOOR - 5, 600 );
 
 
-				} } );
+				} );
 
 
-				loader.load( { model: "obj/morphs/shdw3walk.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/shdw3walk.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.04, 2000, -500, FLOOR + 60, 245 );
+					addMorph( geometry, 40, 2000, -500, FLOOR + 60, 245 );
 
 
-				} } );
+				} );
 
 
-				loader.load( { model: "obj/morphs/flamingo.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/flamingo.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.5, 1000, 500 - Math.random() * 500, FLOOR + 350, 40 );
+					addMorph( geometry, 500, 1000, 500 - Math.random() * 500, FLOOR + 350, 40 );
 
 
-				} } );
+				} );
 
 
-				loader.load( { model: "obj/morphs/stork.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/stork.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.35, 1000, 500 - Math.random() * 500, FLOOR + 350, 340 );
+					addMorph( geometry, 350, 1000, 500 - Math.random() * 500, FLOOR + 350, 340 );
 
 
-				} } );
+				} );
 
 
-				loader.load( { model: "obj/morphs/mountainlion.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/mountainlion.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.4, 1000, 500 - Math.random() * 500, FLOOR - 5, 700 );
+					addMorph( geometry, 400, 1000, 500 - Math.random() * 500, FLOOR - 5, 700 );
 
 
-				} } );
+				} );
 
 
-				loader.load( { model: "obj/morphs/bearBrown.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/bearBrown.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.3, 2500, -500, FLOOR - 5, -750 );
+					addMorph( geometry, 300, 2500, -500, FLOOR - 5, -750 );
 
 
-				} } );
+				} );
 
 
-				loader.load( { model: "obj/morphs/parrot.js", callback: function( geometry ) {
+				loader.load( "obj/morphs/parrot.js", function( geometry ) {
 
 
 					morphColorsToFaceColors( geometry );
 					morphColorsToFaceColors( geometry );
-					addMorph( geometry, 0.45, 500, 500 - Math.random() * 500, FLOOR + 300, 700 );
+					addMorph( geometry, 450, 500, 500 - Math.random() * 500, FLOOR + 300, 700 );
 
 
-				} } );
+				} );
 				*/
 				*/
 
 
 			}
 			}
@@ -364,13 +364,13 @@
 
 
 			function render() {
 			function render() {
 
 
-				var delta = clock.delta();
+				var delta = clock.getDelta();
 
 
 				for ( var i = 0; i < morphs.length; i ++ ) {
 				for ( var i = 0; i < morphs.length; i ++ ) {
 
 
 					morph = morphs[ i ];
 					morph = morphs[ i ];
 
 
-					morph.updateAnimation( delta );
+					morph.updateAnimation( 1000 * delta );
 
 
 					morph.position.x += morph.speed * delta;
 					morph.position.x += morph.speed * delta;
 
 

+ 7 - 9
examples/webgl_trackballcamera_earth.html

@@ -63,7 +63,7 @@
 			geometry, meshPlanet, meshClouds, meshMoon,
 			geometry, meshPlanet, meshClouds, meshMoon,
 			dirLight, ambientLight,
 			dirLight, ambientLight,
 
 
-			time = new Date().getTime();
+			clock = new THREE.Clock();
 
 
 			window.onload = function() {
 			window.onload = function() {
 
 
@@ -187,7 +187,7 @@
 				vector,
 				vector,
 				starsGeometry = new THREE.Geometry();
 				starsGeometry = new THREE.Geometry();
 
 
-				for ( i = 0; i < 1500; i++ ) {
+				for ( i = 0; i < 1500; i ++ ) {
 
 
 					vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 					vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
 					vector.multiplyScalar( radius );
 					vector.multiplyScalar( radius );
@@ -206,7 +206,7 @@
 					new THREE.ParticleBasicMaterial( { color: 0x1a1a1a, size: 1, sizeAttenuation: false } )
 					new THREE.ParticleBasicMaterial( { color: 0x1a1a1a, size: 1, sizeAttenuation: false } )
 				];
 				];
 
 
-				for ( i = 10; i < 30; i++ ) {
+				for ( i = 10; i < 30; i ++ ) {
 
 
 					stars = new THREE.ParticleSystem( starsGeometry, starsMaterials[ i % 6 ] );
 					stars = new THREE.ParticleSystem( starsGeometry, starsMaterials[ i % 6 ] );
 
 
@@ -262,14 +262,12 @@
 
 
 			function render() {
 			function render() {
 
 
-				var t = new Date().getTime(),
-				dt = ( t - time ) / 1000;
-				time = t;
+				var delta = clock.getDelta();
 
 
-				meshPlanet.rotation.y += rotationSpeed * dt;
-				meshClouds.rotation.y += 1.25 * rotationSpeed * dt;
+				meshPlanet.rotation.y += rotationSpeed * delta;
+				meshClouds.rotation.y += 1.25 * rotationSpeed * delta;
 
 
-				var angle = dt * rotationSpeed;
+				var angle = delta * rotationSpeed;
 
 
 				meshMoon.position = new THREE.Vector3(
 				meshMoon.position = new THREE.Vector3(
 					Math.cos( angle ) * meshMoon.position.x - Math.sin( angle ) * meshMoon.position.z,
 					Math.cos( angle ) * meshMoon.position.x - Math.sin( angle ) * meshMoon.position.z,

+ 5 - 5
src/core/Clock.js

@@ -25,22 +25,22 @@ THREE.Clock.prototype.start = function () {
 
 
 THREE.Clock.prototype.stop = function () {
 THREE.Clock.prototype.stop = function () {
 
 
-	this.elapsed();
+	this.getElapsedTime();
 
 
 	this.running = false;
 	this.running = false;
 
 
 };
 };
 
 
-THREE.Clock.prototype.elapsed = function () {
+THREE.Clock.prototype.getElapsedTime = function () {
 
 
-	this.elapsedTime += this.delta();
+	this.elapsedTime += this.getDelta();
 
 
 	return this.elapsedTime;
 	return this.elapsedTime;
 
 
 };
 };
 
 
 
 
-THREE.Clock.prototype.delta = function () {
+THREE.Clock.prototype.getDelta = function () {
 
 
 	var diff = 0;
 	var diff = 0;
 
 
@@ -53,7 +53,7 @@ THREE.Clock.prototype.delta = function () {
 	if ( this.running ) {
 	if ( this.running ) {
 
 
 		var newTime = Date.now();
 		var newTime = Date.now();
-		diff = newTime - this.oldTime;
+		diff = 0.001 * ( newTime - this.oldTime );
 		this.oldTime = newTime;
 		this.oldTime = newTime;
 
 
 		this.elapsedTime += diff;
 		this.elapsedTime += diff;

+ 0 - 2
src/extras/controls/FirstPersonControls.js

@@ -171,8 +171,6 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 
 	this.update = function( delta ) {
 	this.update = function( delta ) {
 
 
-		delta *= 0.001;
-
 		if ( !this.freeze ) {
 		if ( !this.freeze ) {
 
 
 			if ( this.heightSpeed ) {
 			if ( this.heightSpeed ) {

+ 0 - 2
src/extras/controls/FlyControls.js

@@ -182,8 +182,6 @@ THREE.FlyControls = function ( object, domElement ) {
 
 
 	this.update = function( delta ) {
 	this.update = function( delta ) {
 
 
-		delta *= 0.001;
-
 		var moveMult = delta * this.movementSpeed;
 		var moveMult = delta * this.movementSpeed;
 		var rotMult = delta * this.rollSpeed;
 		var rotMult = delta * this.rollSpeed;
 
 

+ 0 - 2
src/extras/controls/PathControls.js

@@ -61,8 +61,6 @@ THREE.PathControls = function ( object, domElement ) {
 
 
 	this.update = function ( delta ) {
 	this.update = function ( delta ) {
 
 
-		delta *= 0.001;
-
 		var srcRange, dstRange;
 		var srcRange, dstRange;
 
 
 		if( this.lookHorizontal ) this.lon += this.mouseX * this.lookSpeed * delta;
 		if( this.lookHorizontal ) this.lon += this.mouseX * this.lookSpeed * delta;

+ 0 - 2
src/extras/controls/RollControls.js

@@ -44,8 +44,6 @@ THREE.RollControls = function ( object, domElement ) {
 
 
 	this.update = function ( delta ) {
 	this.update = function ( delta ) {
 
 
-		delta *= 0.001;
-
 		if ( this.mouseLook ) {
 		if ( this.mouseLook ) {
 
 
 			var actualLookSpeed = delta * this.lookSpeed;
 			var actualLookSpeed = delta * this.lookSpeed;

+ 3 - 3
src/objects/Bone.js

@@ -59,7 +59,7 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera )
 		this.matrixWorld.multiply( this.skin.matrixWorld, this.skinMatrix );
 		this.matrixWorld.multiply( this.skin.matrixWorld, this.skinMatrix );
 
 
 
 
-		for ( i = 0; i < l; i++ ) {
+		for ( i = 0; i < l; i ++ ) {
 
 
 			child = this.children[ i ];
 			child = this.children[ i ];
 
 
@@ -77,7 +77,7 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera )
 
 
 	} else {
 	} else {
 
 
-		for ( i = 0; i < l; i++ ) {
+		for ( i = 0; i < l; i ++ ) {
 
 
 			this.children[ i ].update( this.skinMatrix, forceUpdate, camera );
 			this.children[ i ].update( this.skinMatrix, forceUpdate, camera );
 
 
@@ -92,7 +92,7 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera )
  * Add child
  * Add child
  */
  */
 
 
-THREE.Bone.prototype.addChild = function( child ) {
+THREE.Bone.prototype.add = function( child ) {
 
 
 	if ( this.children.indexOf( child ) === - 1 ) {
 	if ( this.children.indexOf( child ) === - 1 ) {
 
 

+ 11 - 11
src/objects/SkinnedMesh.js

@@ -16,7 +16,7 @@ THREE.SkinnedMesh = function( geometry, materials ) {
 
 
 	if ( this.geometry.bones !== undefined ) {
 	if ( this.geometry.bones !== undefined ) {
 
 
-		for ( b = 0; b < this.geometry.bones.length; b++ ) {
+		for ( b = 0; b < this.geometry.bones.length; b ++ ) {
 
 
 			gbone = this.geometry.bones[ b ];
 			gbone = this.geometry.bones[ b ];
 
 
@@ -27,7 +27,7 @@ THREE.SkinnedMesh = function( geometry, materials ) {
 			bone = this.addBone();
 			bone = this.addBone();
 
 
 			bone.name = gbone.name;
 			bone.name = gbone.name;
-			bone.position.set( p[0], p[1], p[2] ); 
+			bone.position.set( p[0], p[1], p[2] );
 			bone.quaternion.set( q[0], q[1], q[2], q[3] );
 			bone.quaternion.set( q[0], q[1], q[2], q[3] );
 			bone.useQuaternion = true;
 			bone.useQuaternion = true;
 
 
@@ -43,18 +43,18 @@ THREE.SkinnedMesh = function( geometry, materials ) {
 
 
 		}
 		}
 
 
-		for ( b = 0; b < this.bones.length; b++ ) {
+		for ( b = 0; b < this.bones.length; b ++ ) {
 
 
 			gbone = this.geometry.bones[ b ];
 			gbone = this.geometry.bones[ b ];
 			bone = this.bones[ b ];
 			bone = this.bones[ b ];
 
 
 			if ( gbone.parent === -1 ) {
 			if ( gbone.parent === -1 ) {
 
 
-				this.addChild( bone );
+				this.add( bone );
 
 
 			} else {
 			} else {
 
 
-				this.bones[ gbone.parent ].addChild( bone );
+				this.bones[ gbone.parent ].add( bone );
 
 
 			}
 			}
 
 
@@ -115,7 +115,7 @@ THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate,
 
 
 		var child, i, l = this.children.length;
 		var child, i, l = this.children.length;
 
 
-		for ( i = 0; i < l; i++ ) {
+		for ( i = 0; i < l; i ++ ) {
 
 
 			child = this.children[ i ];
 			child = this.children[ i ];
 
 
@@ -138,7 +138,7 @@ THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate,
 			ba = this.bones;
 			ba = this.bones;
 			bm = this.boneMatrices;
 			bm = this.boneMatrices;
 
 
-		for ( b = 0; b < bl; b++ ) {
+		for ( b = 0; b < bl; b ++ ) {
 
 
 			ba[ b ].skinMatrix.flattenToArrayOffset( bm, b * 16 );
 			ba[ b ].skinMatrix.flattenToArrayOffset( bm, b * 16 );
 
 
@@ -150,7 +150,7 @@ THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate,
 
 
 
 
 /*
 /*
- * Add 
+ * Add
  */
  */
 
 
 THREE.SkinnedMesh.prototype.addBone = function( bone ) {
 THREE.SkinnedMesh.prototype.addBone = function( bone ) {
@@ -177,7 +177,7 @@ THREE.SkinnedMesh.prototype.pose = function() {
 
 
 	var bim, bone, boneInverses = [];
 	var bim, bone, boneInverses = [];
 
 
-	for ( var b = 0; b < this.bones.length; b++ ) {
+	for ( var b = 0; b < this.bones.length; b ++ ) {
 
 
 		bone = this.bones[ b ];
 		bone = this.bones[ b ];
 
 
@@ -187,7 +187,7 @@ THREE.SkinnedMesh.prototype.pose = function() {
 
 
 	}
 	}
 
 
-	// project vertices to local 
+	// project vertices to local
 
 
 	if ( this.geometry.skinVerticesA === undefined ) {
 	if ( this.geometry.skinVerticesA === undefined ) {
 
 
@@ -196,7 +196,7 @@ THREE.SkinnedMesh.prototype.pose = function() {
 
 
 		var orgVertex, vertex;
 		var orgVertex, vertex;
 
 
-		for ( var i = 0; i < this.geometry.skinIndices.length; i++ ) {
+		for ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) {
 
 
 			orgVertex = this.geometry.vertices[ i ].position;
 			orgVertex = this.geometry.vertices[ i ].position;