Browse Source

Fixed `Camera.updateMatrix()`.

Mr.doob 14 years ago
parent
commit
1413f96958

+ 1 - 0
REVISION

@@ -0,0 +1 @@
+36

+ 35 - 35
build/Three.js

@@ -1,4 +1,4 @@
-// Three.js r35 - http://github.com/mrdoob/three.js
+// Three.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,j,k;if(b==0)d=e=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
@@ -48,7 +48,7 @@ c,b)}}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
 multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,l=k*b+h*e-j*d,o=k*d+j*b-g*e,v=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=l*k+b*-g+o*-j-v*-h;c.y=o*k+b*-h+v*-g-l*-j;c.z=v*k+b*-j+l*-h-o*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
 THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};
 THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -80,10 +80,10 @@ THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,
 THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};
-THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};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}};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=
@@ -94,7 +94,7 @@ THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if
 THREE.PathCamera=function(a){function c(l,o){var v=l[0]-o[0],u=l[1]-o[1],t=l[2]-o[2];return Math.sqrt(v*v+u*u+t*t)}function b(l,o,v,u){var t={name:v,fps:0.6,length:u,hierarchy:[]},y,A;y=o.length;var D,w,F=[];A=new THREE.Spline;var x=0;for(D=0;D<o.length;D++){w=o[D];F[D]={x:w[0],y:w[1],z:w[2]}}var N=[o[0][0],o[0][1],o[0][2]];for(D=1;D<F.length*100;D++){w=D/(F.length*100);position=A.getPoint(F,w);x+=c([position.x,position.y,position.z],N);N=[position.x,position.y,position.z]}D=x;F=0;x=y-1;A={parent:-1,
 keys:[]};A.keys[0]={time:0,pos:o[0],rot:[0,0,0,1],scl:[1,1,1]};A.keys[x]={time:u,pos:o[x],rot:[0,0,0,1],scl:[1,1,1]};console.log("path totalLength: ",D);for(y=1;y<x;y++){F+=u*c(o[y],o[y-1])/D;A.keys[y]={time:F,pos:o[y]}}t.hierarchy[0]=A;THREE.AnimationHandler.add(t);return new THREE.Animation(l,v,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(l,o){var v,u,t=new THREE.Geometry,y=new THREE.Spline,A=[];for(v=0;v<o.length;v++){u=o[v];A[v]={x:u[0],y:u[1],z:u[2]}}for(v=0;v<A.length*10;v++){u=
 v/(A.length*10);u=y.getPoint(A,u);t.vertices[v]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,v);lineObj.scale.set(1,1,1);l.addChild(lineObj);v=new Sphere(1,16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.length;i++){t=new THREE.Mesh(v,y);t.position.set(o[i][0],o[i][1],o[i][2]);t.updateMatrix();l.addChild(t)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=
-[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
+[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.updateManual=function(){var l,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);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)*g;this.theta=this.lon*g;l=this.phi%e;this.phi=l>=0?l:l+e;l=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
 this.phi=(this.phi-l[0])*(o[1]-o[0])/(l[1]-l[0])+o[0];l=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-l[0])*(o[1]-o[0])/(l[1]-l[0])+o[0];l=this.target.position;o=this.position;l.x=o.x+100*Math.sin(this.phi)*Math.cos(this.theta);l.y=o.y+100*Math.cos(this.phi);l.z=o.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};if(this.createDebugDummy){a=
@@ -259,35 +259,35 @@ maxDirLights:z.directional,maxPointLights:z.point,maxBones:B};q=f.createProgram(
 B=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,"#define MAX_BONES "+B.maxBones,B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"",B.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
 f.attachShader(q,N("fragment",z+n));f.attachShader(q,N("vertex",B+H));f.linkProgram(q);f.getProgramParameter(q,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(q,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");q.uniforms={};q.attributes={};m.program=q;q=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(p in m.uniforms)q.push(p);p=m.program;n=0;for(H=q.length;n<
 H;n++){z=q[n];p.uniforms[z]=f.getUniformLocation(p,z)}p=m.program;q=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];n=0;for(H=q.length;n<H;n++){z=q[n];p.attributes[z]=f.getAttribLocation(p,z)}p=m.program.attributes;f.enableVertexAttribArray(p.position);p.color>=0&&f.enableVertexAttribArray(p.color);p.normal>=0&&f.enableVertexAttribArray(p.normal);p.tangent>=0&&f.enableVertexAttribArray(p.tangent);if(m.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
-0&&p.skinIndex>=0&&p.skinWeight>=0){f.enableVertexAttribArray(p.skinVertexA);f.enableVertexAttribArray(p.skinVertexB);f.enableVertexAttribArray(p.skinIndex);f.enableVertexAttribArray(p.skinWeight)}};this.render=function(m,z,q,n){var p,B,C,G,Q,H,O,la,ka=m.lights,ra=m.fog;z.matrixAutoUpdate&&z.parent===undefined&&z.update(undefined,!0);m.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ha);ya.multiply(z.projectionMatrix,z.matrixWorldInverse);k(ya);this.initWebGLObjects(m);
-x(q);(this.autoClear||n)&&this.clear();Q=m.__webglObjects.length;for(n=0;n<Q;n++){p=m.__webglObjects[n];O=p.object;if(O.visible)if(!(O instanceof THREE.Mesh)||l(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(p);p.render=!0;if(this.sortObjects){ma.copy(O.position);ya.multiplyVector3(ma);p.z=ma.z}}else p.render=!1;else p.render=!1}this.sortObjects&&m.__webglObjects.sort(t);H=m.__webglObjectsImmediate.length;for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){O.matrixAutoUpdate&&
-O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);v(p)}}w(THREE.NormalBlending);for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;
-la=p.buffer;C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}if(q&&q.minFilter!==THREE.NearestFilter&&q.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,q.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var z=m.__objectsAdded[0],q=m,n=void 0,p=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){p=z.geometry;p.geometryGroups==
-undefined&&A(p);for(n in p.geometryGroups){B=p.geometryGroups[n];if(!B.__webGLVertexBuffer){var C=B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();
-C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=void 0,O=0,la=0,ka=0,ra=G.geometry.faces,sa=C.faces;Q=0;for(H=sa.length;Q<H;Q++){fi=sa[Q];face=ra[fi];if(face instanceof THREE.Face3){O+=3;la+=1;ka+=3}else if(face instanceof THREE.Face4){O+=4;la+=2;ka+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=
-new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(la*3);C.__lineArray=new Uint16Array(ka*2);H=Q=C;O=void 0;ra=void 0;var oa=void 0,pa=void 0;oa=void 0;sa=!1;O=0;for(ra=G.materials.length;O<ra;O++){oa=G.materials[O];if(oa instanceof THREE.MeshFaceMaterial){oa=0;for(pa=H.materials.length;oa<pa;oa++)if(H.materials[oa]&&H.materials[oa].shading!=
-undefined&&H.materials[oa].shading==THREE.SmoothShading){sa=!0;break}}else if(oa&&oa.shading!=undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;p.__dirtyVertices=!0;p.__dirtyElements=!0;p.__dirtyUvs=!0;p.__dirtyNormals=!0;p.__dirtyTangents=!0;p.__dirtyColors=!0}D(q.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=
-f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLVertexCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.Line){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLLineCount=B;p.__dirtyVertices=!0;p.__dirtyColors=
-!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.ParticleSystem){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__sortArray=[];n.__webGLParticleCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&q.__webglObjectsImmediate.push({object:z,
-opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){z=m.__objectsRemoved[0];q=m;p=void 0;n=void 0;for(p=q.__webglObjects.length-1;p>=0;p--){n=q.__webglObjects[p].object;z==n&&q.__webglObjects.splice(p,1)}m.__objectsRemoved.splice(0,1)}z=0;for(q=m.__webglObjects.length;z<q;z++){n=m.__webglObjects[z].object;B=void 0;p=void 0;C=void 0;if(n instanceof THREE.Mesh){p=n.geometry;for(B in p.geometryGroups){C=p.geometryGroups[B];if(p.__dirtyVertices||
-p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents){la=f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var W=void 0,X=void 0,$=void 0,Aa=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=
-sa=ra=O=G=H=0,Da=0,E=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,Ba=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=n.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,
-Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=Za[ka];P=$a[Ja];Fa=ab[Ja];Ja=bb[Ja];Ga=P.vertexNormals;Ea=P.normal;if(P instanceof THREE.Face3){if(Pa){W=Oa[P.a].position;X=Oa[P.b].position;$=Oa[P.c].position;Ca[G]=W.x;Ca[G+1]=W.y;Ca[G+2]=W.z;Ca[G+3]=X.x;Ca[G+4]=X.y;Ca[G+5]=X.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;G+=9}if(Va.length){W=Va[P.a];X=Va[P.b];$=Va[P.c];S[E]=W.x;S[E+1]=W.y;S[E+2]=W.z;S[E+3]=W.w;S[E+4]=X.x;S[E+5]=X.y;S[E+6]=X.z;S[E+7]=X.w;S[E+8]=$.x;
-S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;W=Ya[P.a];X=Ya[P.b];$=Ya[P.c];K[E]=W.x;K[E+1]=W.y;K[E+2]=W.z;K[E+3]=W.w;K[E+4]=X.x;K[E+5]=X.y;K[E+6]=X.z;K[E+7]=X.w;K[E+8]=$.x;K[E+9]=$.y;K[E+10]=$.z;K[E+11]=$.w;W=Wa[P.a];X=Wa[P.b];$=Wa[P.c];Y[E]=W.x;Y[E+1]=W.y;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a+2]=H+2;ua[sa+3]=H;ua[sa+4]=H+2;ua[sa+5]=H+3;sa+=6;wa[Ha]=H;wa[Ha+1]=H+1;wa[Ha+2]=H;wa[Ha+3]=H+3;wa[Ha+4]=H+1;wa[Ha+5]=H+2;wa[Ha+6]=H+2;wa[Ha+
-7]=H+3;Ha+=8;H+=4}}}if(Pa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Ca,la)}if(Qa&&Sa.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,J,la)}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ma,la)}if(Na&&za.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,la)}if(La&&O>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,
-Ra,la)}if(La&&ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ua,la)}if(Ka){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ua,la);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,la)}if(E>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,la);f.bindBuffer(f.ARRAY_BUFFER,
-C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,K,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,S,la)}}}p.__dirtyVertices=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;
-oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Line){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=
-f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,
-Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){p=n.geometry;(p.__dirtyVertices||p.__dirtyColors||n.sortParticles)&&c(p,f.DYNAMIC_DRAW,n);p.__dirtyVertices=!1;p.__dirtyColors=!1}}};this.setFaceCulling=function(m,z){if(m){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0}};THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+0&&p.skinIndex>=0&&p.skinWeight>=0){f.enableVertexAttribArray(p.skinVertexA);f.enableVertexAttribArray(p.skinVertexB);f.enableVertexAttribArray(p.skinIndex);f.enableVertexAttribArray(p.skinWeight)}};this.render=function(m,z,q,n){var p,B,C,G,Q,H,O,la,ka=m.lights,ra=m.fog;z.matrixAutoUpdate&&z.updateMatrix();m.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ha);ya.multiply(z.projectionMatrix,z.matrixWorldInverse);k(ya);this.initWebGLObjects(m);x(q);(this.autoClear||
+n)&&this.clear();Q=m.__webglObjects.length;for(n=0;n<Q;n++){p=m.__webglObjects[n];O=p.object;if(O.visible)if(!(O instanceof THREE.Mesh)||l(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(p);p.render=!0;if(this.sortObjects){ma.copy(O.position);ya.multiplyVector3(ma);p.z=ma.z}}else p.render=!1;else p.render=!1}this.sortObjects&&m.__webglObjects.sort(t);H=m.__webglObjectsImmediate.length;for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);
+y(O,z);v(p)}}w(THREE.NormalBlending);for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.transparent;h(O);for(p=0;p<C.count;p++){G=
+C.list[p];w(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}if(q&&q.minFilter!==THREE.NearestFilter&&q.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,q.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=
+[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var z=m.__objectsAdded[0],q=m,n=void 0,p=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){p=z.geometry;p.geometryGroups==undefined&&A(p);for(n in p.geometryGroups){B=p.geometryGroups[n];if(!B.__webGLVertexBuffer){var C=
+B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=
+void 0,O=0,la=0,ka=0,ra=G.geometry.faces,sa=C.faces;Q=0;for(H=sa.length;Q<H;Q++){fi=sa[Q];face=ra[fi];if(face instanceof THREE.Face3){O+=3;la+=1;ka+=3}else if(face instanceof THREE.Face4){O+=4;la+=2;ka+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*
+4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(la*3);C.__lineArray=new Uint16Array(ka*2);H=Q=C;O=void 0;ra=void 0;var oa=void 0,pa=void 0;oa=void 0;sa=!1;O=0;for(ra=G.materials.length;O<ra;O++){oa=G.materials[O];if(oa instanceof THREE.MeshFaceMaterial){oa=0;for(pa=H.materials.length;oa<pa;oa++)if(H.materials[oa]&&H.materials[oa].shading!=undefined&&H.materials[oa].shading==THREE.SmoothShading){sa=!0;break}}else if(oa&&oa.shading!=
+undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;p.__dirtyVertices=!0;p.__dirtyElements=!0;p.__dirtyUvs=!0;p.__dirtyNormals=!0;p.__dirtyTangents=!0;p.__dirtyColors=!0}D(q.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);
+n.__colorArray=new Float32Array(B*3);n.__webGLVertexCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.Line){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLLineCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.ParticleSystem){p=
+z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__sortArray=[];n.__webGLParticleCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&q.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,
+1)}for(;m.__objectsRemoved.length;){z=m.__objectsRemoved[0];q=m;p=void 0;n=void 0;for(p=q.__webglObjects.length-1;p>=0;p--){n=q.__webglObjects[p].object;z==n&&q.__webglObjects.splice(p,1)}m.__objectsRemoved.splice(0,1)}z=0;for(q=m.__webglObjects.length;z<q;z++){n=m.__webglObjects[z].object;B=void 0;p=void 0;C=void 0;if(n instanceof THREE.Mesh){p=n.geometry;for(B in p.geometryGroups){C=p.geometryGroups[B];if(p.__dirtyVertices||p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents){la=
+f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var W=void 0,X=void 0,$=void 0,Aa=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=sa=ra=O=G=H=0,Da=0,E=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,
+Ba=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=n.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=
+Za[ka];P=$a[Ja];Fa=ab[Ja];Ja=bb[Ja];Ga=P.vertexNormals;Ea=P.normal;if(P instanceof THREE.Face3){if(Pa){W=Oa[P.a].position;X=Oa[P.b].position;$=Oa[P.c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ba[pa+4]=X.x;Ba[pa+5]=X.y;Ba[pa+6]=X.z;Ba[pa+7]=X.w;Ba[pa+8]=$.x;Ba[pa+9]=$.y;Ba[pa+10]=$.z;Ba[pa+11]=$.w;Ba[pa+12]=P.x;Ba[pa+13]=P.y;Ba[pa+14]=P.z;Ba[pa+15]=P.w;pa+=16}if(Ta)if(Ga.length==4&&Ia)for(P=0;P<4;P++){Ea=Ga[P];Ma[oa]=Ea.x;
+Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}else for(P=0;P<4;P++){Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}if(La&&Fa)for(P=0;P<4;P++){Ga=Fa[P];Ra[O]=Ga.u;Ra[O+1]=Ga.v;O+=2}if(La&&Ja)for(P=0;P<4;P++){Fa=Ja[P];Ua[ra]=Fa.u;Ua[ra+1]=Fa.v;ra+=2}if(Ka){ua[sa]=H;ua[sa+1]=H+1;ua[sa+2]=H+2;ua[sa+3]=H;ua[sa+4]=H+2;ua[sa+5]=H+3;sa+=6;wa[Ha]=H;wa[Ha+1]=H+1;wa[Ha+2]=H;wa[Ha+3]=H+3;wa[Ha+4]=H+1;wa[Ha+5]=H+2;wa[Ha+6]=H+2;wa[Ha+7]=H+3;Ha+=8;H+=4}}}if(Pa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
+Ca,la)}if(Qa&&Sa.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,J,la)}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ma,la)}if(Na&&za.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,la)}if(La&&O>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Ra,la)}if(La&&ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ua,la)}if(Ka){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ua,la);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,la)}if(E>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,K,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
+S,la)}}}p.__dirtyVertices=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);
+f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Line){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=
+0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){p=n.geometry;(p.__dirtyVertices||p.__dirtyColors||n.sortParticles)&&c(p,f.DYNAMIC_DRAW,n);p.__dirtyVertices=
+!1;p.__dirtyColors=!1}}};this.setFaceCulling=function(m,z){if(m){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
 var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,l=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,v=h.length;o<v;o++){var u=new THREE.Vertex(h[o].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}o=0;for(v=k.length;o<v;o++){h=k[o];var t,y=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
@@ -329,7 +329,7 @@ var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b|
 var Icosahedron=function(a){function c(v,u,t){var y=Math.sqrt(v*v+u*u+t*t);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(v/y,u/y,t/y)))-1}function b(v,u,t,y){y.faces.push(new THREE.Face3(v,u,t))}function d(v,u){var t=e.vertices[v].position,y=e.vertices[u].position;return c((t.x+y.x)/2,(t.y+y.y)/2,(t.z+y.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),l=d(g.faces[j].b,g.faces[j].c),o=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,o,h);b(g.faces[j].b,l,k,h);b(g.faces[j].c,
 o,l,h);b(k,l,o,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.0010;l+=this.stepSize){for(j=0;j<d.length;j++)if(l<b){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
+function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.001;l+=this.stepSize){for(j=0;j<d.length;j++)if(l<b){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
 g[j]=this.vertices.length-1}else g=h;l==0&&(h=e);for(j=0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(l/b,j/a.length),new THREE.UV(l/b,(j+1)/a.length),new THREE.UV((l-c)/b,(j+1)/a.length),new THREE.UV((l-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=

+ 3 - 3
build/custom/ThreeCanvas.js

@@ -1,4 +1,4 @@
-// ThreeCanvas.js r35 - http://github.com/mrdoob/three.js
+// ThreeCanvas.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,j,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);j=a*6-g;a=c*(1-b);h=c*(1-b*j);b=c*(1-b*(1-j));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
@@ -48,7 +48,7 @@ b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,p=h*d+j*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+p*-j-n*-g;b.y=p*h+c*-g+n*-f-i*-j;b.z=n*h+c*-j+i*-g-p*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -63,7 +63,7 @@ this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.leng
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;

+ 3 - 3
build/custom/ThreeDOM.js

@@ -1,4 +1,4 @@
-// ThreeDOM.js r35 - http://github.com/mrdoob/three.js
+// ThreeDOM.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,i,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
@@ -48,11 +48,11 @@ b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
-THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.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;

+ 2 - 2
build/custom/ThreeExtras.js

@@ -1,4 +1,4 @@
-// ThreeExtras.js r35 - http://github.com/mrdoob/three.js
+// ThreeExtras.js r36 - http://github.com/mrdoob/three.js
 var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,f=a.vertices.length,h=b?d.geometry:d,c=a.vertices,e=h.vertices,g=a.faces,j=h.faces,m=a.uvs;h=h.uvs;b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,v=e.length;k<v;k++){var q=new THREE.Vertex(e[k].position.clone());b&&d.matrix.multiplyVector3(q.position);c.push(q)}k=0;for(v=j.length;k<v;k++){e=j[k];var n,p=e.vertexNormals;if(e instanceof THREE.Face3)n=new THREE.Face3(e.a+f,e.b+f,e.c+f);else e instanceof THREE.Face4&&(n=new THREE.Face4(e.a+
 f,e.b+f,e.c+f,e.d+f));n.centroid.copy(e.centroid);n.normal.copy(e.normal);b=0;for(c=p.length;b<c;b++){q=p[b];n.vertexNormals.push(q.clone())}n.materials=e.materials.slice();g.push(n)}k=0;for(v=h.length;k<v;k++){f=h[k];g=[];b=0;for(c=f.length;b<c;b++)g.push(new THREE.UV(f[b].u,f[b].v));m.push(g)}}},ImageUtils={loadTexture:function(a,d,b){var f=new Image,h=new THREE.Texture(f,d);f.onload=function(){h.needsUpdate=!0;b&&b(this)};f.src=a;return h},loadTextureCube:function(a,d,b){var f,h=[],c=new THREE.Texture(h,
 d);d=h.loadCount=0;for(f=a.length;d<f;++d){h[d]=new Image;h[d].onload=function(){h.loadCount+=1;if(h.loadCount==6)c.needsUpdate=!0;b&&b(this)};h[d].src=a[d]}return c}},SceneUtils={loadScene:function(a,d,b,f){a=new Worker(a);a.postMessage(0);a.onmessage=function(h){function c(){for(k in C.objects)if(!G.objects[k]){u=C.objects[k];if(l=G.geometries[u.geometry]){I=[];for(i=0;i<u.materials.length;i++)I[i]=G.materials[u.materials[i]];z=u.position;r=u.rotation;s=u.scale;object=new THREE.Mesh(l,I);object.position.set(z[0],
@@ -38,7 +38,7 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
 var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var g in c.faces){var j=f(c.faces[g].a,c.faces[g].b),m=f(c.faces[g].b,c.faces[g].c),k=f(c.faces[g].c,c.faces[g].a);b(c.faces[g].a,j,k,e);b(c.faces[g].b,m,j,e);b(c.faces[g].c,
 k,m,e);b(j,m,k,e)}c.faces=e.faces}h.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
+function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
 c[g]=this.vertices.length-1}else c=e;m==0&&(e=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(c[g],c[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(m/b,g/a.length),new THREE.UV(m/b,(g+1)/a.length),new THREE.UV((m-d)/b,(g+1)/a.length),new THREE.UV((m-d)/b,g/a.length)])}h=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=

+ 3 - 3
build/custom/ThreeSVG.js

@@ -1,4 +1,4 @@
-// ThreeSVG.js r35 - http://github.com/mrdoob/three.js
+// ThreeSVG.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,i,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
@@ -48,7 +48,7 @@ b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,l=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=l*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-l*-i;b.z=m*h+c*-i+l*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -63,7 +63,7 @@ this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.leng
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;

+ 33 - 33
build/custom/ThreeWebGL.js

@@ -1,4 +1,4 @@
-// ThreeWebGL.js r35 - http://github.com/mrdoob/three.js
+// ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,l,m,p,o;if(d==0)e=g=l=0;else{m=Math.floor(a*6);p=a*6-m;a=d*(1-b);o=d*(1-b*p);b=d*(1-b*(1-p));switch(m){case 1:e=o;g=d;l=a;break;case 2:e=a;g=d;l=b;break;case 3:e=a;g=o;l=d;break;case 4:e=b;g=a;l=d;break;case 5:e=d;g=a;l=o;break;case 6:case 0:e=d;g=b;l=a}}this.r=e;this.g=g;this.b=l;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
@@ -48,7 +48,7 @@ b,d)}}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined
 THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var l=Math.cos(d);d=Math.sin(d);var m=a*b,p=e*g;this.w=m*l-p*d;this.x=m*d+p*l;this.y=e*b*l+a*g*d;this.z=a*g*l-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,l=a.x,m=a.y,p=a.z;a=a.w;this.x=b*a+g*l+d*p-e*m;this.y=d*a+g*m+e*l-b*p;this.z=e*a+g*p+b*m-d*l;this.w=g*a-b*l-d*m-e*p;return this},
 multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,l=this.x,m=this.y,p=this.z,o=this.w,q=o*d+m*g-p*e,u=o*e+p*d-l*g,x=o*g+l*e-m*d;d=-l*d-m*e-p*g;b.x=q*o+d*-l+u*-p-x*-m;b.y=u*o+d*-m+x*-l-q*-p;b.z=x*o+d*-p+q*-m-u*-l;return b}};
-THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
+THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,e,g,l){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=l instanceof Array?l:[l]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -63,10 +63,10 @@ this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.leng
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.Camera=function(a,b,d,e,g){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};
-THREE.QuakeCamera=function(a){function b(d,e){return function(){e.apply(d,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function b(d,e){return function(){e.apply(d,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(d){d.preventDefault();d.stopPropagation();if(!this.dragToLook)switch(d.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(d){d.preventDefault();d.stopPropagation();if(!this.dragToLook)switch(d.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(d){this.mouseX=d.clientX-this.windowHalfX;this.mouseY=d.clientY-this.windowHalfY};this.onKeyDown=function(d){switch(d.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}};this.onKeyUp=function(d){switch(d.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -77,7 +77,7 @@ THREE.QuakeCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if
 THREE.PathCamera=function(a){function b(q,u){var x=q[0]-u[0],A=q[1]-u[1],B=q[2]-u[2];return Math.sqrt(x*x+A*A+B*B)}function d(q,u,x,A){var B={name:x,fps:0.6,length:A,hierarchy:[]},G,H;G=u.length;var I,J,P=[];H=new THREE.Spline;var S=0;for(I=0;I<u.length;I++){J=u[I];P[I]={x:J[0],y:J[1],z:J[2]}}var Z=[u[0][0],u[0][1],u[0][2]];for(I=1;I<P.length*100;I++){J=I/(P.length*100);position=H.getPoint(P,J);S+=b([position.x,position.y,position.z],Z);Z=[position.x,position.y,position.z]}I=S;P=0;S=G-1;H={parent:-1,
 keys:[]};H.keys[0]={time:0,pos:u[0],rot:[0,0,0,1],scl:[1,1,1]};H.keys[S]={time:A,pos:u[S],rot:[0,0,0,1],scl:[1,1,1]};console.log("path totalLength: ",I);for(G=1;G<S;G++){P+=A*b(u[G],u[G-1])/I;H.keys[G]={time:P,pos:u[G]}}B.hierarchy[0]=H;THREE.AnimationHandler.add(B);return new THREE.Animation(q,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(q,u){var x,A,B=new THREE.Geometry,G=new THREE.Spline,H=[];for(x=0;x<u.length;x++){A=u[x];H[x]={x:A[0],y:A[1],z:A[2]}}for(x=0;x<H.length*10;x++){A=
 x/(H.length*10);A=G.getPoint(H,A);B.vertices[x]=new THREE.Vertex(new THREE.Vector3(A.x,A.y,A.z))}x=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(B,x);lineObj.scale.set(1,1,1);q.addChild(lineObj);x=new Sphere(1,16,8);G=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<u.length;i++){B=new THREE.Mesh(x,G);B.position.set(u[i][0],u[i][1],u[i][2]);B.updateMatrix();q.addChild(B)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=
-[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
+[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,l=Math.PI/180;this.updateManual=function(){var q,u;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);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)*l;this.theta=this.lon*l;q=this.phi%g;this.phi=q>=0?q:q+g;q=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange;
 this.phi=(this.phi-q[0])*(u[1]-u[0])/(q[1]-q[0])+u[0];q=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-q[0])*(u[1]-u[0])/(q[1]-q[0])+u[0];q=this.target.position;u=this.position;q.x=u.x+100*Math.sin(this.phi)*Math.cos(this.theta);q.y=u.y+100*Math.cos(this.phi);q.z=u.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.onMouseMove=function(q){this.mouseX=q.clientX-this.windowHalfX;this.mouseY=q.clientY-this.windowHalfY};if(this.createDebugDummy){a=
@@ -196,31 +196,31 @@ n=c.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define M
 "","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
 c.attachShader(n,Z("fragment",k+h));c.attachShader(n,Z("vertex",w+t));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};f.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(j in f.uniforms)n.push(j);j=f.program;h=0;for(t=n.length;h<
 t;h++){k=n[h];j.uniforms[k]=c.getUniformLocation(j,k)}j=f.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];h=0;for(t=n.length;h<t;h++){k=n[h];j.attributes[k]=c.getAttribLocation(j,k)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
-0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,k,n,h){var j,w,r,v,D,t,z,M,R=f.lights,O=f.fog;k.matrixAutoUpdate&&k.parent===undefined&&k.update(undefined,!0);f.update(undefined,!1,k);k.matrixWorldInverse.flattenToArray(La);k.projectionMatrix.flattenToArray(Ra);Ia.multiply(k.projectionMatrix,k.matrixWorldInverse);o(Ia);this.initWebGLObjects(f);
-S(n);(this.autoClear||h)&&this.clear();D=f.__webglObjects.length;for(h=0;h<D;h++){j=f.__webglObjects[h];z=j.object;if(z.visible)if(!(z instanceof THREE.Mesh)||q(z)){z.matrixWorld.flattenToArray(z._objectMatrixArray);G(z,k);A(j);j.render=!0;if(this.sortObjects){Da.copy(z.position);Ia.multiplyVector3(Da);j.z=Da.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webglObjects.sort(B);t=f.__webglObjectsImmediate.length;for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){z.matrixAutoUpdate&&
-z.matrixWorld.flattenToArray(z._objectMatrixArray);G(z,k);x(j)}}J(THREE.NormalBlending);for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){z=j.object;M=j.buffer;r=j.opaque;m(z);for(j=0;j<r.count;j++){v=r.list[j];p(v.depthTest);g(k,R,O,v,M,z)}}}for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){r=j.opaque;m(z);for(j=0;j<r.count;j++){v=r.list[j];p(v.depthTest);w=e(k,R,O,v,z);z.render(function(L){l(L,w)})}}}for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){z=j.object;M=j.buffer;
-r=j.transparent;m(z);for(j=0;j<r.count;j++){v=r.list[j];J(v.blending);p(v.depthTest);g(k,R,O,v,M,z)}}}for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){r=j.transparent;m(z);for(j=0;j<r.count;j++){v=r.list[j];J(v.blending);p(v.depthTest);w=e(k,R,O,v,z);z.render(function(L){l(L,w)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var k=f.__objectsAdded[0],n=f,h=void 0,j=void 0,w=void 0;if(k._modelViewMatrix==undefined){k._modelViewMatrix=new THREE.Matrix4;k._normalMatrixArray=new Float32Array(9);k._modelViewMatrixArray=new Float32Array(16);k._objectMatrixArray=new Float32Array(16);k.matrixWorld.flattenToArray(k._objectMatrixArray)}if(k instanceof THREE.Mesh){j=k.geometry;j.geometryGroups==undefined&&H(j);for(h in j.geometryGroups){w=
-j.geometryGroups[h];if(!w.__webGLVertexBuffer){var r=w;r.__webGLVertexBuffer=c.createBuffer();r.__webGLNormalBuffer=c.createBuffer();r.__webGLTangentBuffer=c.createBuffer();r.__webGLColorBuffer=c.createBuffer();r.__webGLUVBuffer=c.createBuffer();r.__webGLUV2Buffer=c.createBuffer();r.__webGLSkinVertexABuffer=c.createBuffer();r.__webGLSkinVertexBBuffer=c.createBuffer();r.__webGLSkinIndicesBuffer=c.createBuffer();r.__webGLSkinWeightsBuffer=c.createBuffer();r.__webGLFaceBuffer=c.createBuffer();r.__webGLLineBuffer=
-c.createBuffer();r=w;var v=k,D=void 0,t=void 0,z=0,M=0,R=0,O=v.geometry.faces,L=r.faces;D=0;for(t=L.length;D<t;D++){fi=L[D];face=O[fi];if(face instanceof THREE.Face3){z+=3;M+=1;R+=3}else if(face instanceof THREE.Face4){z+=4;M+=2;R+=4}}r.__vertexArray=new Float32Array(z*3);r.__normalArray=new Float32Array(z*3);r.__tangentArray=new Float32Array(z*4);r.__colorArray=new Float32Array(z*3);r.__uvArray=new Float32Array(z*2);r.__uv2Array=new Float32Array(z*2);r.__skinVertexAArray=new Float32Array(z*4);r.__skinVertexBArray=
-new Float32Array(z*4);r.__skinIndexArray=new Float32Array(z*4);r.__skinWeightArray=new Float32Array(z*4);r.__faceArray=new Uint16Array(M*3);r.__lineArray=new Uint16Array(R*2);t=D=r;z=void 0;O=void 0;var N=void 0,K=void 0;N=void 0;L=!1;z=0;for(O=v.materials.length;z<O;z++){N=v.materials[z];if(N instanceof THREE.MeshFaceMaterial){N=0;for(K=t.materials.length;N<K;N++)if(t.materials[N]&&t.materials[N].shading!=undefined&&t.materials[N].shading==THREE.SmoothShading){L=!0;break}}else if(N&&N.shading!=undefined&&
-N.shading==THREE.SmoothShading){L=!0;break}if(L)break}D.__needsSmoothNormals=L;r.__webGLFaceCount=M*3;r.__webGLLineCount=R*2;j.__dirtyVertices=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}I(n.__webglObjects,w,k)}}else if(k instanceof THREE.Ribbon){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=
-new Float32Array(w*3);h.__webGLVertexCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else if(k instanceof THREE.Line){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLLineCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else if(k instanceof THREE.ParticleSystem){j=k.geometry;
-if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__sortArray=[];h.__webGLParticleCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else THREE.MarchingCubes!==undefined&&k instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,
-1)}for(;f.__objectsRemoved.length;){k=f.__objectsRemoved[0];n=f;j=void 0;h=void 0;for(j=n.__webglObjects.length-1;j>=0;j--){h=n.__webglObjects[j].object;k==h&&n.__webglObjects.splice(j,1)}f.__objectsRemoved.splice(0,1)}k=0;for(n=f.__webglObjects.length;k<n;k++){h=f.__webglObjects[k].object;w=void 0;j=void 0;r=void 0;if(h instanceof THREE.Mesh){j=h.geometry;for(w in j.geometryGroups){r=j.geometryGroups[w];if(j.__dirtyVertices||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents){M=
-c.DYNAMIC_DRAW;R=void 0;D=void 0;var ja=void 0,y=void 0,ga=void 0,ea=void 0,ia=void 0;ja=void 0;var C=void 0,E=void 0,F=void 0,Q=void 0;C=void 0;E=void 0;F=void 0;y=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;y=void 0;ea=void 0;ga=void 0;ia=void 0;var ka=K=N=L=O=z=v=t=0,Y=0,s=0,aa=r.__vertexArray,Ja=r.__uvArray,Ka=r.__uv2Array,oa=r.__normalArray,T=r.__tangentArray,
-ca=r.__colorArray,U=r.__skinVertexAArray,V=r.__skinVertexBArray,W=r.__skinIndexArray,X=r.__skinWeightArray,ta=r.__faceArray,la=r.__lineArray,Wa=r.__needsSmoothNormals,ha=h.geometry,Ma=ha.__dirtyVertices,Na=ha.__dirtyElements,Ea=ha.__dirtyUvs,Oa=ha.__dirtyNormals,Pa=ha.__dirtyTangents,Qa=ha.__dirtyColors,ma=ha.vertices,Xa=r.faces,Ya=ha.faces,Za=ha.uvs,$a=ha.uvs2,ua=ha.colors,ya=ha.skinVerticesA,za=ha.skinVerticesB,Aa=ha.skinIndices,wa=ha.skinWeights;R=0;for(D=Xa.length;R<D;R++){ja=Xa[R];y=Ya[ja];ia=
-Za[ja];ja=$a[ja];ga=y.v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=y.w;K+=16}if(Oa)if(ga.length==4&&Wa)for(y=0;y<4;y++){ea=ga[y];oa[N]=ea.x;oa[N+1]=ea.y;oa[N+2]=ea.z;N+=3}else for(y=0;y<4;y++){oa[N]=ea.x;oa[N+1]=ea.y;oa[N+2]=ea.z;N+=3}if(Ea&&ia)for(y=0;y<4;y++){ga=
-ia[y];Ja[z]=ga.u;Ja[z+1]=ga.v;z+=2}if(Ea&&ja)for(y=0;y<4;y++){ia=ja[y];Ka[O]=ia.u;Ka[O+1]=ia.v;O+=2}if(Na){ta[L]=t;ta[L+1]=t+1;ta[L+2]=t+2;ta[L+3]=t;ta[L+4]=t+2;ta[L+5]=t+3;L+=6;la[ka]=t;la[ka+1]=t+1;la[ka+2]=t;la[ka+3]=t+3;la[ka+4]=t+1;la[ka+5]=t+2;la[ka+6]=t+2;la[ka+7]=t+3;ka+=8;t+=4}}}if(Ma){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,aa,M)}if(Qa&&ua.length){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,ca,M)}if(Oa){c.bindBuffer(c.ARRAY_BUFFER,
-r.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,oa,M)}if(Pa&&ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,T,M)}if(Ea&&z>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ja,M)}if(Ea&&O>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ka,M)}if(Na){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ta,M);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);
-c.bufferData(c.ELEMENT_ARRAY_BUFFER,la,M)}if(s>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,U,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,V,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,W,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,X,M)}}}j.__dirtyVertices=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=
-!1;j.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;t=void 0;t=void 0;v=void 0;r=void 0;z=h.vertices;M=h.colors;O=z.length;R=M.length;L=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(t=0;t<O;t++){v=z[t].position;r=t*3;L[r]=v.x;L[r+1]=v.y;L[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,L,w)}if(N){for(t=0;t<R;t++){color=M[t];r=t*3;D[r]=color.r;D[r+1]=
-color.g;D[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;t=void 0;t=void 0;v=void 0;r=void 0;z=h.vertices;M=h.colors;O=z.length;R=M.length;L=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(t=0;t<O;t++){v=z[t].position;r=t*3;L[r]=v.x;L[r+1]=v.y;L[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,
-h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,L,w)}if(N){for(t=0;t<R;t++){color=M[t];r=t*3;D[r]=color.r;D[r+1]=color.g;D[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){j=h.geometry;(j.__dirtyVertices||j.__dirtyColors||h.sortParticles)&&b(j,c.DYNAMIC_DRAW,h);j.__dirtyVertices=!1;j.__dirtyColors=!1}}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):
-c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,k,n,h){var j,w,r,v,D,t,z,M,R=f.lights,O=f.fog;k.matrixAutoUpdate&&k.updateMatrix();f.update(undefined,!1,k);k.matrixWorldInverse.flattenToArray(La);k.projectionMatrix.flattenToArray(Ra);Ia.multiply(k.projectionMatrix,k.matrixWorldInverse);o(Ia);this.initWebGLObjects(f);S(n);(this.autoClear||
+h)&&this.clear();D=f.__webglObjects.length;for(h=0;h<D;h++){j=f.__webglObjects[h];z=j.object;if(z.visible)if(!(z instanceof THREE.Mesh)||q(z)){z.matrixWorld.flattenToArray(z._objectMatrixArray);G(z,k);A(j);j.render=!0;if(this.sortObjects){Da.copy(z.position);Ia.multiplyVector3(Da);j.z=Da.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webglObjects.sort(B);t=f.__webglObjectsImmediate.length;for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray);
+G(z,k);x(j)}}J(THREE.NormalBlending);for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){z=j.object;M=j.buffer;r=j.opaque;m(z);for(j=0;j<r.count;j++){v=r.list[j];p(v.depthTest);g(k,R,O,v,M,z)}}}for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){r=j.opaque;m(z);for(j=0;j<r.count;j++){v=r.list[j];p(v.depthTest);w=e(k,R,O,v,z);z.render(function(L){l(L,w)})}}}for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){z=j.object;M=j.buffer;r=j.transparent;m(z);for(j=0;j<r.count;j++){v=r.list[j];
+J(v.blending);p(v.depthTest);g(k,R,O,v,M,z)}}}for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){r=j.transparent;m(z);for(j=0;j<r.count;j++){v=r.list[j];J(v.blending);p(v.depthTest);w=e(k,R,O,v,z);z.render(function(L){l(L,w)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=
+[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var k=f.__objectsAdded[0],n=f,h=void 0,j=void 0,w=void 0;if(k._modelViewMatrix==undefined){k._modelViewMatrix=new THREE.Matrix4;k._normalMatrixArray=new Float32Array(9);k._modelViewMatrixArray=new Float32Array(16);k._objectMatrixArray=new Float32Array(16);k.matrixWorld.flattenToArray(k._objectMatrixArray)}if(k instanceof THREE.Mesh){j=k.geometry;j.geometryGroups==undefined&&H(j);for(h in j.geometryGroups){w=j.geometryGroups[h];if(!w.__webGLVertexBuffer){var r=
+w;r.__webGLVertexBuffer=c.createBuffer();r.__webGLNormalBuffer=c.createBuffer();r.__webGLTangentBuffer=c.createBuffer();r.__webGLColorBuffer=c.createBuffer();r.__webGLUVBuffer=c.createBuffer();r.__webGLUV2Buffer=c.createBuffer();r.__webGLSkinVertexABuffer=c.createBuffer();r.__webGLSkinVertexBBuffer=c.createBuffer();r.__webGLSkinIndicesBuffer=c.createBuffer();r.__webGLSkinWeightsBuffer=c.createBuffer();r.__webGLFaceBuffer=c.createBuffer();r.__webGLLineBuffer=c.createBuffer();r=w;var v=k,D=void 0,t=
+void 0,z=0,M=0,R=0,O=v.geometry.faces,L=r.faces;D=0;for(t=L.length;D<t;D++){fi=L[D];face=O[fi];if(face instanceof THREE.Face3){z+=3;M+=1;R+=3}else if(face instanceof THREE.Face4){z+=4;M+=2;R+=4}}r.__vertexArray=new Float32Array(z*3);r.__normalArray=new Float32Array(z*3);r.__tangentArray=new Float32Array(z*4);r.__colorArray=new Float32Array(z*3);r.__uvArray=new Float32Array(z*2);r.__uv2Array=new Float32Array(z*2);r.__skinVertexAArray=new Float32Array(z*4);r.__skinVertexBArray=new Float32Array(z*4);
+r.__skinIndexArray=new Float32Array(z*4);r.__skinWeightArray=new Float32Array(z*4);r.__faceArray=new Uint16Array(M*3);r.__lineArray=new Uint16Array(R*2);t=D=r;z=void 0;O=void 0;var N=void 0,K=void 0;N=void 0;L=!1;z=0;for(O=v.materials.length;z<O;z++){N=v.materials[z];if(N instanceof THREE.MeshFaceMaterial){N=0;for(K=t.materials.length;N<K;N++)if(t.materials[N]&&t.materials[N].shading!=undefined&&t.materials[N].shading==THREE.SmoothShading){L=!0;break}}else if(N&&N.shading!=undefined&&N.shading==THREE.SmoothShading){L=
+!0;break}if(L)break}D.__needsSmoothNormals=L;r.__webGLFaceCount=M*3;r.__webGLLineCount=R*2;j.__dirtyVertices=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}I(n.__webglObjects,w,k)}}else if(k instanceof THREE.Ribbon){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLVertexCount=
+w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else if(k instanceof THREE.Line){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLLineCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else if(k instanceof THREE.ParticleSystem){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=
+c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__sortArray=[];h.__webGLParticleCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else THREE.MarchingCubes!==undefined&&k instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){k=f.__objectsRemoved[0];
+n=f;j=void 0;h=void 0;for(j=n.__webglObjects.length-1;j>=0;j--){h=n.__webglObjects[j].object;k==h&&n.__webglObjects.splice(j,1)}f.__objectsRemoved.splice(0,1)}k=0;for(n=f.__webglObjects.length;k<n;k++){h=f.__webglObjects[k].object;w=void 0;j=void 0;r=void 0;if(h instanceof THREE.Mesh){j=h.geometry;for(w in j.geometryGroups){r=j.geometryGroups[w];if(j.__dirtyVertices||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents){M=c.DYNAMIC_DRAW;R=void 0;D=void 0;var ja=void 0,
+y=void 0,ga=void 0,ea=void 0,ia=void 0;ja=void 0;var C=void 0,E=void 0,F=void 0,Q=void 0;C=void 0;E=void 0;F=void 0;y=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;y=void 0;ea=void 0;ga=void 0;ia=void 0;var ka=K=N=L=O=z=v=t=0,Y=0,s=0,aa=r.__vertexArray,Ja=r.__uvArray,Ka=r.__uv2Array,oa=r.__normalArray,T=r.__tangentArray,ca=r.__colorArray,U=r.__skinVertexAArray,
+V=r.__skinVertexBArray,W=r.__skinIndexArray,X=r.__skinWeightArray,ta=r.__faceArray,la=r.__lineArray,Wa=r.__needsSmoothNormals,ha=h.geometry,Ma=ha.__dirtyVertices,Na=ha.__dirtyElements,Ea=ha.__dirtyUvs,Oa=ha.__dirtyNormals,Pa=ha.__dirtyTangents,Qa=ha.__dirtyColors,ma=ha.vertices,Xa=r.faces,Ya=ha.faces,Za=ha.uvs,$a=ha.uvs2,ua=ha.colors,ya=ha.skinVerticesA,za=ha.skinVerticesB,Aa=ha.skinIndices,wa=ha.skinWeights;R=0;for(D=Xa.length;R<D;R++){ja=Xa[R];y=Ya[ja];ia=Za[ja];ja=$a[ja];ga=y.vertexNormals;ea=
+y.normal;if(y instanceof THREE.Face3){if(Ma){C=ma[y.a].position;E=ma[y.b].position;F=ma[y.c].position;aa[v]=C.x;aa[v+1]=C.y;aa[v+2]=C.z;aa[v+3]=E.x;aa[v+4]=E.y;aa[v+5]=E.z;aa[v+6]=F.x;aa[v+7]=F.y;aa[v+8]=F.z;v+=9}if(wa.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z]=ga.u;Ja[z+1]=ga.v;
+z+=2}if(Ea&&ja)for(y=0;y<4;y++){ia=ja[y];Ka[O]=ia.u;Ka[O+1]=ia.v;O+=2}if(Na){ta[L]=t;ta[L+1]=t+1;ta[L+2]=t+2;ta[L+3]=t;ta[L+4]=t+2;ta[L+5]=t+3;L+=6;la[ka]=t;la[ka+1]=t+1;la[ka+2]=t;la[ka+3]=t+3;la[ka+4]=t+1;la[ka+5]=t+2;la[ka+6]=t+2;la[ka+7]=t+3;ka+=8;t+=4}}}if(Ma){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,aa,M)}if(Qa&&ua.length){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,ca,M)}if(Oa){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLNormalBuffer);
+c.bufferData(c.ARRAY_BUFFER,oa,M)}if(Pa&&ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,T,M)}if(Ea&&z>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ja,M)}if(Ea&&O>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ka,M)}if(Na){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ta,M);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,
+la,M)}if(s>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,U,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,V,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,W,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,X,M)}}}j.__dirtyVertices=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1}else if(h instanceof
+THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;t=void 0;t=void 0;v=void 0;r=void 0;z=h.vertices;M=h.colors;O=z.length;R=M.length;L=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(t=0;t<O;t++){v=z[t].position;r=t*3;L[r]=v.x;L[r+1]=v.y;L[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,L,w)}if(N){for(t=0;t<R;t++){color=M[t];r=t*3;D[r]=color.r;D[r+1]=color.g;D[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,
+h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;t=void 0;t=void 0;v=void 0;r=void 0;z=h.vertices;M=h.colors;O=z.length;R=M.length;L=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(t=0;t<O;t++){v=z[t].position;r=t*3;L[r]=v.x;L[r+1]=v.y;L[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,
+L,w)}if(N){for(t=0;t<R;t++){color=M[t];r=t*3;D[r]=color.r;D[r+1]=color.g;D[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){j=h.geometry;(j.__dirtyVertices||j.__dirtyColors||h.sortParticles)&&b(j,c.DYNAMIC_DRAW,h);j.__dirtyVertices=!1;j.__dirtyColors=!1}}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);
+else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

+ 7 - 1
src/cameras/Camera.js

@@ -42,8 +42,14 @@ THREE.Camera.prototype.updateProjectionMatrix = function () {
 
 }
 
+THREE.Camera.prototype.updateMatrix = function () {
 
-THREE.Camera.prototype.update = function( parentMatrixWorld, forceUpdate, camera ) {
+	// this.parent === undefined && this.update( undefined, true );
+	this.update( undefined, true );
+
+}
+
+THREE.Camera.prototype.update = function ( parentMatrixWorld, forceUpdate, camera ) {
 
 	if ( this.useTarget ) {
 

+ 10 - 10
src/cameras/QuakeCamera.js

@@ -38,7 +38,7 @@ THREE.QuakeCamera = function ( parameters ) {
 	this.autoForward = false;
 
 	this.dragToLook = false;
-	
+
 	this.heightSpeed = false;
 	this.heightCoef = 1.0;
 	this.heightMin = 0.0;
@@ -53,7 +53,7 @@ THREE.QuakeCamera = function ( parameters ) {
 		if ( parameters.lookVertical !== undefined ) this.lookVertical = parameters.lookVertical;
 
 		if ( parameters.autoForward !== undefined ) this.autoForward = parameters.autoForward;
-		
+
 		if ( parameters.dragToLook !== undefined ) this.dragToLook = parameters.dragToLook;
 
 		if ( parameters.heightSpeed !== undefined ) this.heightSpeed = parameters.heightSpeed;
@@ -81,7 +81,7 @@ THREE.QuakeCamera = function ( parameters ) {
 	this.moveRight = false;
 
 	this.mouseDragOn = false;
-	
+
 	this.windowHalfX = window.innerWidth / 2;
 	this.windowHalfY = window.innerHeight / 2;
 
@@ -100,7 +100,7 @@ THREE.QuakeCamera = function ( parameters ) {
 			}
 
 		}
-		
+
 		this.mouseDragOn = true;
 
 	};
@@ -120,7 +120,7 @@ THREE.QuakeCamera = function ( parameters ) {
 			}
 
 		}
-		
+
 		this.mouseDragOn = false;
 
 	};
@@ -193,13 +193,13 @@ THREE.QuakeCamera = function ( parameters ) {
 		if ( this.moveRight ) this.translateX( this.movementSpeed );
 
 		var actualLookSpeed = this.lookSpeed;
-		
+
 		if ( this.dragToLook && !this.mouseDragOn ) {
 
 			actualLookSpeed = 0;
 
 		}
-		
+
 		this.lon += this.mouseX * actualLookSpeed;
 		if( this.lookVertical ) this.lat -= this.mouseY * actualLookSpeed;
 
@@ -260,13 +260,13 @@ THREE.QuakeCamera.prototype.supr = THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate = function ( distance, axis ) {
 
 	this.matrix.rotateAxis( axis );
-	
+
 	if ( this.noFly ) {
-		
+
 		axis.y = 0;
 
 	}
-	
+
 	this.position.addSelf( axis.multiplyScalar( distance ) );
 	this.target.position.addSelf( axis.multiplyScalar( distance ) );
 

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -1909,10 +1909,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 			fog = scene.fog,
 			ol;
 
-		if ( camera.matrixAutoUpdate && camera.parent === undefined) { camera.update( undefined, true ); }
+		camera.matrixAutoUpdate && camera.updateMatrix();
 
 		scene.update( undefined, false, camera );
-		
+
 		camera.matrixWorldInverse.flattenToArray( _viewMatrixArray );
 		camera.projectionMatrix.flattenToArray( _projectionMatrixArray );
 

+ 0 - 1
utils/REVISION

@@ -1 +0,0 @@
-35

+ 1 - 1
utils/build.py

@@ -318,7 +318,7 @@ def compress(text):
 
 
 def addHeader(text, endFilename):
-	with open(os.path.join('.', 'REVISION'), 'r') as handle:
+	with open(os.path.join('..', 'REVISION'), 'r') as handle:
 		revision = handle.read().rstrip()
 
 	return ("// %s r%s - http://github.com/mrdoob/three.js\n" % (endFilename, revision)) + text