Browse Source

Fixed Matrix4::scale
Fixed matrix rotation in Projector (not fully done yet, need to implement herarchies still)

Mr.doob 14 years ago
parent
commit
033a372c70

+ 66 - 65
build/Three.js

@@ -36,8 +36,8 @@ a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;retur
 this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);
 return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*
 g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,k=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
-a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
+a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;
+a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
 THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};
 THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,q=a.n33,p=a.n34,x=a.n41,A=a.n42,G=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*p*A-m*q*A+m*w*G-k*p*G-j*w*v+k*q*v;b.n12=g*q*A-f*p*A-g*w*G+d*p*G+f*w*v-d*q*v;b.n13=f*m*A-g*j*A+g*k*G-d*m*G-f*k*v+d*j*v;b.n14=g*j*w-f*m*w-g*k*q+d*m*q+f*k*p-d*j*p;b.n21=m*q*x-j*p*x-m*n*G+h*p*G+j*n*v-h*q*v;b.n22=f*p*x-g*q*x+g*n*G-c*p*G-f*n*v+c*q*v;b.n23=g*j*x-f*m*x-g*h*G+c*m*G+f*h*v-c*j*v;
@@ -47,9 +47,10 @@ THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
 1;this.visible=!0};
-THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
-if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
-THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==undefined?d:1};THREE.Quaternion.prototype.set=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);
+this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRotation.n12;this.localMatrix.n13=this.matrixRotation.n13;this.localMatrix.n21=this.matrixRotation.n21;this.localMatrix.n22=this.matrixRotation.n22;this.localMatrix.n23=this.matrixRotation.n23;this.localMatrix.n31=this.matrixRotation.n31;this.localMatrix.n32=this.matrixRotation.n32;this.localMatrix.n33=this.matrixRotation.n33;if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=
+Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==undefined?d:1};
+THREE.Quaternion.prototype.set=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this};
 THREE.Quaternion.prototype.calculateW=function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this};THREE.Quaternion.prototype.inverse=function(){this.x*=-1;this.y*=-1;this.z*=-1;return this};THREE.Quaternion.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)};
 THREE.Quaternion.prototype.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};THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this};
 THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,n=j*d+k*c-g*f,w=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+n*-k-w*-h;b.y=n*j+c*-h+w*-g-m*-k;b.z=w*j+c*-k+m*-h-n*-g;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
@@ -62,7 +63,7 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(H,V,la,Y,ka,ia,fa){g=H.vertices[V].position;h=H.vertices[la].position;k=H.vertices[Y].position;j=f[ka];m=f[ia];n=f[fa];w=h.x-g.x;q=k.x-g.x;p=h.y-g.y;x=
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(H,V,la,Y,ka,ia,ga){g=H.vertices[V].position;h=H.vertices[la].position;k=H.vertices[Y].position;j=f[ka];m=f[ia];n=f[ga];w=h.x-g.x;q=k.x-g.x;p=h.y-g.y;x=
 k.y-g.y;A=h.z-g.z;G=k.z-g.z;v=m.u-j.u;I=n.u-j.u;o=m.v-j.v;M=n.v-j.v;e=1/(v*M-I*o);P.set((M*w-o*q)*e,(M*p-o*x)*e,(M*A-o*G)*e);W.set((v*q-I*w)*e,(v*x-I*p)*e,(v*G-I*A)*e);ea[V].addSelf(P);ea[la].addSelf(P);ea[Y].addSelf(P);O[V].addSelf(W);O[la].addSelf(W);O[Y].addSelf(W)}var b,c,d,f,g,h,k,j,m,n,w,q,p,x,A,G,v,I,o,M,e,ea=[],O=[],P=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3,aa=new THREE.Vector3,ba=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ea[b]=new THREE.Vector3;O[b]=new THREE.Vector3}b=
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ba.copy(this.vertices[b].normal);d=ea[b];S.copy(d);S.subSelf(ba.multiplyScalar(ba.dot(d))).normalize();aa.cross(this.vertices[b].normal,d);d=aa.dot(O[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
@@ -148,56 +149,56 @@ THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light
 THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Projector=function(){function a(O,P){return P.z-O.z}function b(O,P){var W=0,S=1,aa=O.z+O.w,ba=P.z+P.w,H=-O.z+O.w,V=-P.z+P.w;if(aa>=0&&ba>=0&&H>=0&&V>=0)return!0;else if(aa<0&&ba<0||H<0&&V<0)return!1;else{if(aa<0)W=Math.max(W,aa/(aa-ba));else ba<0&&(S=Math.min(S,aa/(aa-ba)));if(H<0)W=Math.max(W,H/(H-V));else V<0&&(S=Math.min(S,H/(H-V)));if(S<W)return!1;else{O.lerpSelf(P,W);P.lerpSelf(O,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,n,w=[],q,p,x=[],A=new THREE.Vector4,G=new THREE.Vector4,v=new THREE.Matrix4,
 I=new THREE.Matrix4,o=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,e=new THREE.Vector4,ea;this.projectObjects=function(O,P,W){P=[];var S,aa,ba;d=0;aa=O.objects;O=0;for(S=aa.length;O<S;O++){ba=aa[O];var H;if(!(H=!ba.visible))if(H=ba instanceof THREE.Mesh){a:{H=void 0;for(var V=ba.globalMatrix,la=-ba.geometry.boundingSphere.radius*Math.max(ba.scale.x,Math.max(ba.scale.y,ba.scale.z)),Y=0;Y<6;Y++){H=o[Y].x*V.n14+o[Y].y*
-V.n24+o[Y].z*V.n34+o[Y].w;if(H<=la){H=!1;break a}}H=!0}H=!H}if(!H){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(ba.position);v.multiplyVector3(A);c.object=ba;c.z=A.z;P.push(c);d++}}W&&P.sort(a);return P};this.projectScene=function(O,P,W){var S=[],aa=P.zNear,ba=P.zFar,H,V,la,Y,ka,ia,fa,ra,xa,l,y,B,t,u,E,C;k=n=p=0;P.matrixAutoUpdate&&P.update();v.multiply(P.projectionMatrix,P.globalMatrix);o[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);o[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+
-v.n14);o[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);o[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);o[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);o[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(H=0;H<6;H++){ia=o[H];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}O.update(undefined,!1,P);ia=this.projectObjects(O,P,!0);O=0;for(H=ia.length;O<H;O++){fa=ia[O].object;if(fa.visible){fa.matrixAutoUpdate&&fa.updateMatrix();ra=fa.globalMatrix;ra.extractRotationMatrix(fa.matrixRotation);
-y=fa.matrixRotation;xa=fa.materials;l=fa.overdraw;if(fa instanceof THREE.Mesh){B=fa.geometry;t=B.vertices;V=0;for(la=t.length;V<la;V++){u=t[V];u.positionWorld.copy(u.position);ra.multiplyVector3(u.positionWorld);Y=u.positionScreen;Y.copy(u.positionWorld);v.multiplyVector4(Y);Y.x/=Y.w;Y.y/=Y.w;u.__visible=Y.z>aa&&Y.z<ba}B=B.faces;V=0;for(la=B.length;V<la;V++){u=B[V];if(u instanceof THREE.Face3){Y=t[u.a];ka=t[u.b];E=t[u.c];if(Y.__visible&&ka.__visible&&E.__visible&&(fa.doubleSided||fa.flipSided!=(E.positionScreen.x-
-Y.positionScreen.x)*(ka.positionScreen.y-Y.positionScreen.y)-(E.positionScreen.y-Y.positionScreen.y)*(ka.positionScreen.x-Y.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(Y.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(Y.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(u.normal);y.multiplyVector3(g.normalWorld);
-g.centroidWorld.copy(u.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);E=u.vertexNormals;ea=g.vertexNormalsWorld;Y=0;for(ka=E.length;Y<ka;Y++){C=ea[Y]=ea[Y]||new THREE.Vector3;C.copy(E[Y]);y.multiplyVector3(C)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=u.materials;g.overdraw=l;if(fa.geometry.uvs[V]){g.uvs[0]=fa.geometry.uvs[V][0];g.uvs[1]=fa.geometry.uvs[V][1];g.uvs[2]=fa.geometry.uvs[V][2]}S.push(g);k++}}else if(u instanceof
-THREE.Face4){Y=t[u.a];ka=t[u.b];E=t[u.c];C=t[u.d];if(Y.__visible&&ka.__visible&&E.__visible&&C.__visible&&(fa.doubleSided||fa.flipSided!=((C.positionScreen.x-Y.positionScreen.x)*(ka.positionScreen.y-Y.positionScreen.y)-(C.positionScreen.y-Y.positionScreen.y)*(ka.positionScreen.x-Y.positionScreen.x)<0||(ka.positionScreen.x-E.positionScreen.x)*(C.positionScreen.y-E.positionScreen.y)-(ka.positionScreen.y-E.positionScreen.y)*(C.positionScreen.x-E.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;
-g.v1.positionWorld.copy(Y.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(C.positionWorld);g.v1.positionScreen.copy(Y.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(C.positionScreen);g.normalWorld.copy(u.normal);y.multiplyVector3(g.normalWorld);g.centroidWorld.copy(u.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=xa;
-g.faceMaterials=u.materials;g.overdraw=l;if(fa.geometry.uvs[V]){g.uvs[0]=fa.geometry.uvs[V][0];g.uvs[1]=fa.geometry.uvs[V][1];g.uvs[2]=fa.geometry.uvs[V][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ka.positionWorld);h.v2.positionWorld.copy(E.positionWorld);h.v3.positionWorld.copy(C.positionWorld);h.v1.positionScreen.copy(ka.positionScreen);h.v2.positionScreen.copy(E.positionScreen);h.v3.positionScreen.copy(C.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);
-h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=u.materials;h.overdraw=l;if(fa.geometry.uvs[V]){h.uvs[0]=fa.geometry.uvs[V][1];h.uvs[1]=fa.geometry.uvs[V][2];h.uvs[2]=fa.geometry.uvs[V][3]}S.push(h);k++}}}}else if(fa instanceof THREE.Line){I.multiply(v,ra);t=fa.geometry.vertices;u=t[0];u.positionScreen.copy(u.position);I.multiplyVector4(u.positionScreen);V=1;for(la=t.length;V<la;V++){Y=t[V];Y.positionScreen.copy(Y.position);I.multiplyVector4(Y.positionScreen);
-ka=t[V-1];M.copy(Y.positionScreen);e.copy(ka.positionScreen);if(b(M,e)){M.multiplyScalar(1/M.w);e.multiplyScalar(1/e.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(M);m.v2.positionScreen.copy(e);m.z=Math.max(M.z,e.z);m.materials=fa.materials;S.push(m);n++}}}else if(fa instanceof THREE.Particle){G.set(fa.position.x,fa.position.y,fa.position.z,1);v.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){q=x[p]=x[p]||new THREE.RenderableParticle;q.x=G.x/G.w;q.y=G.y/G.w;q.z=G.z;q.rotation=fa.rotation.z;
-q.scale.x=fa.scale.x*Math.abs(q.x-(G.x+P.projectionMatrix.n11)/(G.w+P.projectionMatrix.n14));q.scale.y=fa.scale.y*Math.abs(q.y-(G.y+P.projectionMatrix.n22)/(G.w+P.projectionMatrix.n24));q.materials=fa.materials;S.push(q);p++}}}}W&&S.sort(a);return S};this.unprojectVector=function(O,P){var W=THREE.Matrix4.makeInvert(P.globalMatrix);W.multiplySelf(THREE.Matrix4.makeInvert(P.projectionMatrix));W.multiplyVector3(O);return O}};
+V.n24+o[Y].z*V.n34+o[Y].w;if(H<=la){H=!1;break a}}H=!0}H=!H}if(!H){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(ba.position);v.multiplyVector3(A);c.object=ba;c.z=A.z;P.push(c);d++}}W&&P.sort(a);return P};this.projectScene=function(O,P,W){var S=[],aa=P.zNear,ba=P.zFar,H,V,la,Y,ka,ia,ga,ua,xa,l,y,B,t,u,E,C;k=n=p=0;P.matrixAutoUpdate&&P.update();v.multiply(P.projectionMatrix,P.globalMatrix);o[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);o[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+
+v.n14);o[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);o[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);o[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);o[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(H=0;H<6;H++){ia=o[H];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}O.update(undefined,!1,P);ia=this.projectObjects(O,P,!0);O=0;for(H=ia.length;O<H;O++){ga=ia[O].object;if(ga.visible){ga.matrixAutoUpdate&&ga.updateMatrix();ua=ga.globalMatrix;y=ga.matrixRotation;
+xa=ga.materials;l=ga.overdraw;if(ga instanceof THREE.Mesh){B=ga.geometry;t=B.vertices;V=0;for(la=t.length;V<la;V++){u=t[V];u.positionWorld.copy(u.position);ua.multiplyVector3(u.positionWorld);Y=u.positionScreen;Y.copy(u.positionWorld);v.multiplyVector4(Y);Y.x/=Y.w;Y.y/=Y.w;u.__visible=Y.z>aa&&Y.z<ba}B=B.faces;V=0;for(la=B.length;V<la;V++){u=B[V];if(u instanceof THREE.Face3){Y=t[u.a];ka=t[u.b];E=t[u.c];if(Y.__visible&&ka.__visible&&E.__visible&&(ga.doubleSided||ga.flipSided!=(E.positionScreen.x-Y.positionScreen.x)*
+(ka.positionScreen.y-Y.positionScreen.y)-(E.positionScreen.y-Y.positionScreen.y)*(ka.positionScreen.x-Y.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(Y.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(Y.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(u.normal);y.multiplyVector3(g.normalWorld);g.centroidWorld.copy(u.centroid);
+ua.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);E=u.vertexNormals;ea=g.vertexNormalsWorld;Y=0;for(ka=E.length;Y<ka;Y++){C=ea[Y]=ea[Y]||new THREE.Vector3;C.copy(E[Y]);y.multiplyVector3(C)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=u.materials;g.overdraw=l;if(ga.geometry.uvs[V]){g.uvs[0]=ga.geometry.uvs[V][0];g.uvs[1]=ga.geometry.uvs[V][1];g.uvs[2]=ga.geometry.uvs[V][2]}S.push(g);k++}}else if(u instanceof THREE.Face4){Y=t[u.a];
+ka=t[u.b];E=t[u.c];C=t[u.d];if(Y.__visible&&ka.__visible&&E.__visible&&C.__visible&&(ga.doubleSided||ga.flipSided!=((C.positionScreen.x-Y.positionScreen.x)*(ka.positionScreen.y-Y.positionScreen.y)-(C.positionScreen.y-Y.positionScreen.y)*(ka.positionScreen.x-Y.positionScreen.x)<0||(ka.positionScreen.x-E.positionScreen.x)*(C.positionScreen.y-E.positionScreen.y)-(ka.positionScreen.y-E.positionScreen.y)*(C.positionScreen.x-E.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(Y.positionWorld);
+g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(C.positionWorld);g.v1.positionScreen.copy(Y.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(C.positionScreen);g.normalWorld.copy(u.normal);y.multiplyVector3(g.normalWorld);g.centroidWorld.copy(u.centroid);ua.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=u.materials;g.overdraw=l;
+if(ga.geometry.uvs[V]){g.uvs[0]=ga.geometry.uvs[V][0];g.uvs[1]=ga.geometry.uvs[V][1];g.uvs[2]=ga.geometry.uvs[V][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ka.positionWorld);h.v2.positionWorld.copy(E.positionWorld);h.v3.positionWorld.copy(C.positionWorld);h.v1.positionScreen.copy(ka.positionScreen);h.v2.positionScreen.copy(E.positionScreen);h.v3.positionScreen.copy(C.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
+h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=u.materials;h.overdraw=l;if(ga.geometry.uvs[V]){h.uvs[0]=ga.geometry.uvs[V][1];h.uvs[1]=ga.geometry.uvs[V][2];h.uvs[2]=ga.geometry.uvs[V][3]}S.push(h);k++}}}}else if(ga instanceof THREE.Line){I.multiply(v,ua);t=ga.geometry.vertices;u=t[0];u.positionScreen.copy(u.position);I.multiplyVector4(u.positionScreen);V=1;for(la=t.length;V<la;V++){Y=t[V];Y.positionScreen.copy(Y.position);I.multiplyVector4(Y.positionScreen);ka=t[V-1];M.copy(Y.positionScreen);
+e.copy(ka.positionScreen);if(b(M,e)){M.multiplyScalar(1/M.w);e.multiplyScalar(1/e.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(M);m.v2.positionScreen.copy(e);m.z=Math.max(M.z,e.z);m.materials=ga.materials;S.push(m);n++}}}else if(ga instanceof THREE.Particle){G.set(ga.position.x,ga.position.y,ga.position.z,1);v.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){q=x[p]=x[p]||new THREE.RenderableParticle;q.x=G.x/G.w;q.y=G.y/G.w;q.z=G.z;q.rotation=ga.rotation.z;q.scale.x=ga.scale.x*Math.abs(q.x-
+(G.x+P.projectionMatrix.n11)/(G.w+P.projectionMatrix.n14));q.scale.y=ga.scale.y*Math.abs(q.y-(G.y+P.projectionMatrix.n22)/(G.w+P.projectionMatrix.n24));q.materials=ga.materials;S.push(q);p++}}}}W&&S.sort(a);return S};this.unprojectVector=function(O,P){var W=THREE.Matrix4.makeInvert(P.globalMatrix);W.multiplySelf(THREE.Matrix4.makeInvert(P.projectionMatrix));W.multiplyVector3(O);return O}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,q,p,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){q=a[j];if(q instanceof THREE.RenderableParticle){x=q.x*f+f;A=q.y*g+g;n=0;for(w=q.material.length;n<w;n++){p=q.material[n];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=x+"px";p.style.top=A+"px"}}}}}};
 THREE.CanvasRenderer=function(){function a(ha){if(q!=ha)m.globalAlpha=q=ha}function b(ha){if(p!=ha){switch(ha){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}p=ha}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),n=new THREE.Color(0),w=0,q=1,p=0,x=null,A=null,G=1,v,I,o,M,e,ea,O,P,W,S=new THREE.Color,
-aa=new THREE.Color,ba=new THREE.Color,H=new THREE.Color,V=new THREE.Color,la,Y,ka,ia,fa,ra,xa,l,y,B=new THREE.Rectangle,t=new THREE.Rectangle,u=new THREE.Rectangle,E=!1,C=new THREE.Color,J=new THREE.Color,L=new THREE.Color,z=new THREE.Color,D=Math.PI*2,F=new THREE.Vector3,T,Q,ga,ma,sa,oa,na=16;T=document.createElement("canvas");T.width=T.height=2;Q=T.getContext("2d");Q.fillStyle="rgba(0,0,0,1)";Q.fillRect(0,0,2,2);ga=Q.getImageData(0,0,2,2);ma=ga.data;sa=document.createElement("canvas");sa.width=
-sa.height=na;oa=sa.getContext("2d");oa.translate(-na/2,-na/2);oa.scale(na,na);na--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ha,Ca){g=ha;h=Ca;k=g/2;j=h/2;f.width=g;f.height=h;B.set(-k,-j,k,j);q=1;p=0;A=x=null;G=1};this.setClearColor=function(ha,Ca){n=ha;w=Ca;t.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(ha,Ca){n.setHex(ha);w=Ca;t.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=
+aa=new THREE.Color,ba=new THREE.Color,H=new THREE.Color,V=new THREE.Color,la,Y,ka,ia,ga,ua,xa,l,y,B=new THREE.Rectangle,t=new THREE.Rectangle,u=new THREE.Rectangle,E=!1,C=new THREE.Color,J=new THREE.Color,L=new THREE.Color,z=new THREE.Color,D=Math.PI*2,F=new THREE.Vector3,T,Q,fa,ma,ra,oa,na=16;T=document.createElement("canvas");T.width=T.height=2;Q=T.getContext("2d");Q.fillStyle="rgba(0,0,0,1)";Q.fillRect(0,0,2,2);fa=Q.getImageData(0,0,2,2);ma=fa.data;ra=document.createElement("canvas");ra.width=
+ra.height=na;oa=ra.getContext("2d");oa.translate(-na/2,-na/2);oa.scale(na,na);na--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ha,Ca){g=ha;h=Ca;k=g/2;j=h/2;f.width=g;f.height=h;B.set(-k,-j,k,j);q=1;p=0;A=x=null;G=1};this.setClearColor=function(ha,Ca){n=ha;w=Ca;t.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(ha,Ca){n.setHex(ha);w=Ca;t.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=
 function(){m.setTransform(1,0,0,-1,k,j);if(!t.isEmpty()){t.inflate(1);t.minSelf(B);if(n.hex==0&&w==0)m.clearRect(t.getX(),t.getY(),t.getWidth(),t.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+w+")";m.fillRect(t.getX(),t.getY(),t.getWidth(),t.getHeight())}t.empty()}};this.render=function(ha,Ca){function R(K){var ja,ca,U,X=K.lights;J.setRGB(0,0,0);L.setRGB(0,0,0);z.setRGB(0,0,0);K=0;for(ja=X.length;K<ja;K++){ca=
 X[K];U=ca.color;if(ca instanceof THREE.AmbientLight){J.r+=U.r;J.g+=U.g;J.b+=U.b}else if(ca instanceof THREE.DirectionalLight){L.r+=U.r;L.g+=U.g;L.b+=U.b}else if(ca instanceof THREE.PointLight){z.r+=U.r;z.g+=U.g;z.b+=U.b}}}function Ga(K,ja,ca,U){var X,qa,Da,Ea,Ia=K.lights;K=0;for(X=Ia.length;K<X;K++){qa=Ia[K];Da=qa.color;Ea=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=ca.dot(qa.position)*Ea;if(qa>0){U.r+=Da.r*qa;U.g+=Da.g*qa;U.b+=Da.b*qa}}else if(qa instanceof THREE.PointLight){F.sub(qa.position,
 ja);F.normalize();qa=ca.dot(F)*Ea;if(qa>0){U.r+=Da.r*qa;U.g+=Da.g*qa;U.b+=Da.b*qa}}}}function Ha(K,ja,ca){if(ca.opacity!=0){a(ca.opacity);b(ca.blending);var U,X,qa,Da,Ea,Ia;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map){Da=ca.map.image;Ea=Da.width>>1;Ia=Da.height>>1;X=ja.scale.x*k;qa=ja.scale.y*j;ca=X*Ea;U=qa*Ia;u.set(K.x-ca,K.y-U,K.x+ca,K.y+U);if(B.instersects(u)){m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(X,-qa);m.translate(-Ea,-Ia);m.drawImage(Da,0,0);m.restore()}}}else if(ca instanceof
 THREE.ParticleCircleMaterial){if(E){C.r=J.r+L.r+z.r;C.g=J.g+L.g+z.g;C.b=J.b+L.b+z.b;S.r=ca.color.r*C.r;S.g=ca.color.g*C.g;S.b=ca.color.b*C.b;S.updateStyleString()}else S.__styleString=ca.color.__styleString;ca=ja.scale.x*k;U=ja.scale.y*j;u.set(K.x-ca,K.y-U,K.x+ca,K.y+U);if(B.instersects(u)){X=S.__styleString;if(A!=X)m.fillStyle=A=X;m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(ca,U);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function La(K,ja,ca,U){if(U.opacity!=
 0){a(U.opacity);b(U.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ja.positionScreen.x,ja.positionScreen.y);m.closePath();if(U instanceof THREE.LineBasicMaterial){S.__styleString=U.color.__styleString;K=U.linewidth;if(G!=K)m.lineWidth=G=K;K=S.__styleString;if(x!=K)m.strokeStyle=x=K;m.stroke();u.inflate(U.linewidth*2)}}}function da(K,ja,ca,U,X,qa){if(X.opacity!=0){a(X.opacity);b(X.blending);M=K.positionScreen.x;e=K.positionScreen.y;ea=ja.positionScreen.x;O=ja.positionScreen.y;
-P=ca.positionScreen.x;W=ca.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(ea,O);m.lineTo(P,W);m.lineTo(M,e);m.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&ta(M,e,ea,O,P,W,X.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(X.env_map){if(X.env_map.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.globalMatrix;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;fa=-(F.x*
-K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[1]);ra=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;xa=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[2]);l=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;y=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;ta(M,e,ea,O,P,W,X.env_map.image,ia,fa,ra,xa,l,y)}}else X.wireframe?Z(X.color.__styleString,X.wireframe_linewidth):$(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof
-THREE.UVMapping&&ta(M,e,ea,O,P,W,X.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!X.wireframe&&X.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){aa.r=ba.r=H.r=J.r;aa.g=ba.g=H.g=J.g;aa.b=ba.b=H.b=J.b;Ga(qa,U.v1.positionWorld,U.vertexNormalsWorld[0],aa);Ga(qa,U.v2.positionWorld,U.vertexNormalsWorld[1],ba);Ga(qa,U.v3.positionWorld,U.vertexNormalsWorld[2],H);V.r=(ba.r+H.r)*0.5;V.g=(ba.g+H.g)*0.5;V.b=(ba.b+H.b)*0.5;ka=Ja(aa,
-ba,H,V);ta(M,e,ea,O,P,W,ka,0,0,1,0,0,1)}else{C.r=J.r;C.g=J.g;C.b=J.b;Ga(qa,U.centroidWorld,U.normalWorld,C);S.r=X.color.r*C.r;S.g=X.color.g*C.g;S.b=X.color.b*C.b;S.updateStyleString();X.wireframe?Z(S.__styleString,X.wireframe_linewidth):$(S.__styleString)}else X.wireframe?Z(X.color.__styleString,X.wireframe_linewidth):$(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){la=Ca.near;Y=Ca.far;aa.r=aa.g=aa.b=1-Aa(K.positionScreen.z,la,Y);ba.r=ba.g=ba.b=1-Aa(ja.positionScreen.z,la,Y);
-H.r=H.g=H.b=1-Aa(ca.positionScreen.z,la,Y);V.r=(ba.r+H.r)*0.5;V.g=(ba.g+H.g)*0.5;V.b=(ba.b+H.b)*0.5;ka=Ja(aa,ba,H,V);ta(M,e,ea,O,P,W,ka,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){S.r=N(U.normalWorld.x);S.g=N(U.normalWorld.y);S.b=N(U.normalWorld.z);S.updateStyleString();X.wireframe?Z(S.__styleString,X.wireframe_linewidth):$(S.__styleString)}}}function Z(K,ja){if(x!=K)m.strokeStyle=x=K;if(G!=ja)m.lineWidth=G=ja;m.stroke();u.inflate(ja*2)}function $(K){if(A!=K)m.fillStyle=A=K;m.fill()}
-function ta(K,ja,ca,U,X,qa,Da,Ea,Ia,Ma,Ka,Fa,Sa){var Na,Oa;Na=Da.width-1;Oa=Da.height-1;Ea*=Na;Ia*=Oa;Ma*=Na;Ka*=Oa;Fa*=Na;Sa*=Oa;ca-=K;U-=ja;X-=K;qa-=ja;Ma-=Ea;Ka-=Ia;Fa-=Ea;Sa-=Ia;Na=Ma*Sa-Fa*Ka;if(Na!=0){Oa=1/Na;Na=(Sa*ca-Ka*X)*Oa;Ka=(Sa*U-Ka*qa)*Oa;ca=(Ma*X-Fa*ca)*Oa;U=(Ma*qa-Fa*U)*Oa;K=K-Na*Ea-ca*Ia;ja=ja-Ka*Ea-U*Ia;m.save();m.transform(Na,Ka,ca,U,K,ja);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ja(K,ja,ca,U){var X=~~(K.r*255),qa=~~(K.g*255);K=~~(K.b*255);var Da=~~(ja.r*255),Ea=~~(ja.g*
-255);ja=~~(ja.b*255);var Ia=~~(ca.r*255),Ma=~~(ca.g*255);ca=~~(ca.b*255);var Ka=~~(U.r*255),Fa=~~(U.g*255);U=~~(U.b*255);ma[0]=X<0?0:X>255?255:X;ma[1]=qa<0?0:qa>255?255:qa;ma[2]=K<0?0:K>255?255:K;ma[4]=Da<0?0:Da>255?255:Da;ma[5]=Ea<0?0:Ea>255?255:Ea;ma[6]=ja<0?0:ja>255?255:ja;ma[8]=Ia<0?0:Ia>255?255:Ia;ma[9]=Ma<0?0:Ma>255?255:Ma;ma[10]=ca<0?0:ca>255?255:ca;ma[12]=Ka<0?0:Ka>255?255:Ka;ma[13]=Fa<0?0:Fa>255?255:Fa;ma[14]=U<0?0:U>255?255:U;Q.putImageData(ga,0,0);oa.drawImage(T,0,0);return sa}function Aa(K,
-ja,ca){K=(K-ja)/(ca-ja);return K*K*(3-2*K)}function N(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Ba(K,ja){var ca=ja.x-K.x,U=ja.y-K.y,X=1/Math.sqrt(ca*ca+U*U);ca*=X;U*=X;ja.x+=ca;ja.y+=U;K.x-=ca;K.y-=U}var Pa,Ta,ua,pa,za,wa,ya,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ha,Ca,this.sortElements);(E=ha.lights.length>0)&&R(ha);Pa=0;for(Ta=c.length;Pa<Ta;Pa++){ua=c[Pa];u.empty();if(ua instanceof THREE.RenderableParticle){v=ua;v.x*=k;v.y*=j;pa=0;for(za=ua.materials.length;pa<
-za;pa++)Ha(v,ua,ua.materials[pa],ha)}else if(ua instanceof THREE.RenderableLine){v=ua.v1;I=ua.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;u.addPoint(v.positionScreen.x,v.positionScreen.y);u.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(u)){pa=0;for(za=ua.materials.length;pa<za;)La(v,I,ua,ua.materials[pa++],ha)}}else if(ua instanceof THREE.RenderableFace3){v=ua.v1;I=ua.v2;o=ua.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=
-k;I.positionScreen.y*=j;o.positionScreen.x*=k;o.positionScreen.y*=j;if(ua.overdraw){Ba(v.positionScreen,I.positionScreen);Ba(I.positionScreen,o.positionScreen);Ba(o.positionScreen,v.positionScreen)}u.add3Points(v.positionScreen.x,v.positionScreen.y,I.positionScreen.x,I.positionScreen.y,o.positionScreen.x,o.positionScreen.y);if(B.instersects(u)){pa=0;for(za=ua.meshMaterials.length;pa<za;){va=ua.meshMaterials[pa++];if(va instanceof THREE.MeshFaceMaterial){wa=0;for(ya=ua.faceMaterials.length;wa<ya;)(va=
-ua.faceMaterials[wa++])&&da(v,I,o,ua,va,ha)}else da(v,I,o,ua,va,ha)}}}t.addRectangle(u)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ia,fa,ra){var xa,l,y,B;xa=0;for(l=ia.lights.length;xa<l;xa++){y=ia.lights[xa];if(y instanceof THREE.DirectionalLight){B=fa.normalWorld.dot(y.position)*y.intensity;if(B>0){ra.r+=y.color.r*B;ra.g+=y.color.g*B;ra.b+=y.color.b*B}}else if(y instanceof THREE.PointLight){W.sub(y.position,fa.centroidWorld);W.normalize();B=fa.normalWorld.dot(W)*y.intensity;if(B>0){ra.r+=y.color.r*B;ra.g+=y.color.g*B;ra.b+=y.color.b*B}}}}function b(ia,fa,ra,xa,l,y){H=d(V++);H.setAttribute("d",
-"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(I){M.r=e.r;M.g=e.g;M.b=e.b;a(y,xa,M);o.r=l.color.r*M.r;o.g=l.color.g*M.g;o.b=l.color.b*M.b;o.updateStyleString()}else o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){P=1-l.__2near/(l.__farPlusNear-
-xa.z*l.__farMinusNear);o.setRGB(P,P,P)}else l instanceof THREE.MeshNormalMaterial&&o.setRGB(f(xa.normalWorld.x),f(xa.normalWorld.y),f(xa.normalWorld.z));l.wireframe?H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):H.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(H)}function c(ia,fa,ra,xa,
-l,y,B){H=d(V++);H.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)o.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(I){M.r=e.r;M.g=e.g;M.b=e.b;a(B,l,M);o.r=y.color.r*M.r;o.g=y.color.g*M.g;o.b=y.color.b*M.b;o.updateStyleString()}else o.__styleString=y.color.__styleString;
+P=ca.positionScreen.x;W=ca.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(ea,O);m.lineTo(P,W);m.lineTo(M,e);m.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&sa(M,e,ea,O,P,W,X.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(X.env_map){if(X.env_map.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.globalMatrix;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;ga=-(F.x*
+K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[1]);ua=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;xa=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[2]);l=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;y=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;sa(M,e,ea,O,P,W,X.env_map.image,ia,ga,ua,xa,l,y)}}else X.wireframe?Z(X.color.__styleString,X.wireframe_linewidth):$(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof
+THREE.UVMapping&&sa(M,e,ea,O,P,W,X.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!X.wireframe&&X.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){aa.r=ba.r=H.r=J.r;aa.g=ba.g=H.g=J.g;aa.b=ba.b=H.b=J.b;Ga(qa,U.v1.positionWorld,U.vertexNormalsWorld[0],aa);Ga(qa,U.v2.positionWorld,U.vertexNormalsWorld[1],ba);Ga(qa,U.v3.positionWorld,U.vertexNormalsWorld[2],H);V.r=(ba.r+H.r)*0.5;V.g=(ba.g+H.g)*0.5;V.b=(ba.b+H.b)*0.5;ka=Ja(aa,
+ba,H,V);sa(M,e,ea,O,P,W,ka,0,0,1,0,0,1)}else{C.r=J.r;C.g=J.g;C.b=J.b;Ga(qa,U.centroidWorld,U.normalWorld,C);S.r=X.color.r*C.r;S.g=X.color.g*C.g;S.b=X.color.b*C.b;S.updateStyleString();X.wireframe?Z(S.__styleString,X.wireframe_linewidth):$(S.__styleString)}else X.wireframe?Z(X.color.__styleString,X.wireframe_linewidth):$(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){la=Ca.near;Y=Ca.far;aa.r=aa.g=aa.b=1-Aa(K.positionScreen.z,la,Y);ba.r=ba.g=ba.b=1-Aa(ja.positionScreen.z,la,Y);
+H.r=H.g=H.b=1-Aa(ca.positionScreen.z,la,Y);V.r=(ba.r+H.r)*0.5;V.g=(ba.g+H.g)*0.5;V.b=(ba.b+H.b)*0.5;ka=Ja(aa,ba,H,V);sa(M,e,ea,O,P,W,ka,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){S.r=N(U.normalWorld.x);S.g=N(U.normalWorld.y);S.b=N(U.normalWorld.z);S.updateStyleString();X.wireframe?Z(S.__styleString,X.wireframe_linewidth):$(S.__styleString)}}}function Z(K,ja){if(x!=K)m.strokeStyle=x=K;if(G!=ja)m.lineWidth=G=ja;m.stroke();u.inflate(ja*2)}function $(K){if(A!=K)m.fillStyle=A=K;m.fill()}
+function sa(K,ja,ca,U,X,qa,Da,Ea,Ia,Ma,Ka,Fa,Sa){var Na,Oa;Na=Da.width-1;Oa=Da.height-1;Ea*=Na;Ia*=Oa;Ma*=Na;Ka*=Oa;Fa*=Na;Sa*=Oa;ca-=K;U-=ja;X-=K;qa-=ja;Ma-=Ea;Ka-=Ia;Fa-=Ea;Sa-=Ia;Na=Ma*Sa-Fa*Ka;if(Na!=0){Oa=1/Na;Na=(Sa*ca-Ka*X)*Oa;Ka=(Sa*U-Ka*qa)*Oa;ca=(Ma*X-Fa*ca)*Oa;U=(Ma*qa-Fa*U)*Oa;K=K-Na*Ea-ca*Ia;ja=ja-Ka*Ea-U*Ia;m.save();m.transform(Na,Ka,ca,U,K,ja);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ja(K,ja,ca,U){var X=~~(K.r*255),qa=~~(K.g*255);K=~~(K.b*255);var Da=~~(ja.r*255),Ea=~~(ja.g*
+255);ja=~~(ja.b*255);var Ia=~~(ca.r*255),Ma=~~(ca.g*255);ca=~~(ca.b*255);var Ka=~~(U.r*255),Fa=~~(U.g*255);U=~~(U.b*255);ma[0]=X<0?0:X>255?255:X;ma[1]=qa<0?0:qa>255?255:qa;ma[2]=K<0?0:K>255?255:K;ma[4]=Da<0?0:Da>255?255:Da;ma[5]=Ea<0?0:Ea>255?255:Ea;ma[6]=ja<0?0:ja>255?255:ja;ma[8]=Ia<0?0:Ia>255?255:Ia;ma[9]=Ma<0?0:Ma>255?255:Ma;ma[10]=ca<0?0:ca>255?255:ca;ma[12]=Ka<0?0:Ka>255?255:Ka;ma[13]=Fa<0?0:Fa>255?255:Fa;ma[14]=U<0?0:U>255?255:U;Q.putImageData(fa,0,0);oa.drawImage(T,0,0);return ra}function Aa(K,
+ja,ca){K=(K-ja)/(ca-ja);return K*K*(3-2*K)}function N(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Ba(K,ja){var ca=ja.x-K.x,U=ja.y-K.y,X=1/Math.sqrt(ca*ca+U*U);ca*=X;U*=X;ja.x+=ca;ja.y+=U;K.x-=ca;K.y-=U}var Pa,Ta,ta,pa,za,wa,ya,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ha,Ca,this.sortElements);(E=ha.lights.length>0)&&R(ha);Pa=0;for(Ta=c.length;Pa<Ta;Pa++){ta=c[Pa];u.empty();if(ta instanceof THREE.RenderableParticle){v=ta;v.x*=k;v.y*=j;pa=0;for(za=ta.materials.length;pa<
+za;pa++)Ha(v,ta,ta.materials[pa],ha)}else if(ta instanceof THREE.RenderableLine){v=ta.v1;I=ta.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;u.addPoint(v.positionScreen.x,v.positionScreen.y);u.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(u)){pa=0;for(za=ta.materials.length;pa<za;)La(v,I,ta,ta.materials[pa++],ha)}}else if(ta instanceof THREE.RenderableFace3){v=ta.v1;I=ta.v2;o=ta.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=
+k;I.positionScreen.y*=j;o.positionScreen.x*=k;o.positionScreen.y*=j;if(ta.overdraw){Ba(v.positionScreen,I.positionScreen);Ba(I.positionScreen,o.positionScreen);Ba(o.positionScreen,v.positionScreen)}u.add3Points(v.positionScreen.x,v.positionScreen.y,I.positionScreen.x,I.positionScreen.y,o.positionScreen.x,o.positionScreen.y);if(B.instersects(u)){pa=0;for(za=ta.meshMaterials.length;pa<za;){va=ta.meshMaterials[pa++];if(va instanceof THREE.MeshFaceMaterial){wa=0;for(ya=ta.faceMaterials.length;wa<ya;)(va=
+ta.faceMaterials[wa++])&&da(v,I,o,ta,va,ha)}else da(v,I,o,ta,va,ha)}}}t.addRectangle(u)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ia,ga,ua){var xa,l,y,B;xa=0;for(l=ia.lights.length;xa<l;xa++){y=ia.lights[xa];if(y instanceof THREE.DirectionalLight){B=ga.normalWorld.dot(y.position)*y.intensity;if(B>0){ua.r+=y.color.r*B;ua.g+=y.color.g*B;ua.b+=y.color.b*B}}else if(y instanceof THREE.PointLight){W.sub(y.position,ga.centroidWorld);W.normalize();B=ga.normalWorld.dot(W)*y.intensity;if(B>0){ua.r+=y.color.r*B;ua.g+=y.color.g*B;ua.b+=y.color.b*B}}}}function b(ia,ga,ua,xa,l,y){H=d(V++);H.setAttribute("d",
+"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(I){M.r=e.r;M.g=e.g;M.b=e.b;a(y,xa,M);o.r=l.color.r*M.r;o.g=l.color.g*M.g;o.b=l.color.b*M.b;o.updateStyleString()}else o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){P=1-l.__2near/(l.__farPlusNear-
+xa.z*l.__farMinusNear);o.setRGB(P,P,P)}else l instanceof THREE.MeshNormalMaterial&&o.setRGB(f(xa.normalWorld.x),f(xa.normalWorld.y),f(xa.normalWorld.z));l.wireframe?H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):H.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(H)}function c(ia,ga,ua,xa,
+l,y,B){H=d(V++);H.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)o.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(I){M.r=e.r;M.g=e.g;M.b=e.b;a(B,l,M);o.r=y.color.r*M.r;o.g=y.color.g*M.g;o.b=y.color.b*M.b;o.updateStyleString()}else o.__styleString=y.color.__styleString;
 else if(y instanceof THREE.MeshDepthMaterial){P=1-y.__2near/(y.__farPlusNear-l.z*y.__farMinusNear);o.setRGB(P,P,P)}else y instanceof THREE.MeshNormalMaterial&&o.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));y.wireframe?H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):H.setAttribute("style","fill: "+o.__styleString+
 "; fill-opacity: "+y.opacity);k.appendChild(H)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");ka==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,q,p,x,A,G=new THREE.Rectangle,v=new THREE.Rectangle,I=!1,o=new THREE.Color(16777215),M=new THREE.Color(16777215),
-e=new THREE.Color(0),ea=new THREE.Color(0),O=new THREE.Color(0),P,W=new THREE.Vector3,S=[],aa=[],ba=[],H,V,la,Y,ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(ia,fa){j=ia;m=fa;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);G.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(ia,fa){var ra,xa,l,y,B,t,u,E;this.autoClear&&this.clear();g=h.projectScene(ia,fa,this.sortElements);Y=la=V=0;if(I=ia.lights.length>0){u=ia.lights;e.setRGB(0,0,0);ea.setRGB(0,0,0);O.setRGB(0,0,0);ra=0;for(xa=u.length;ra<xa;ra++){l=u[ra];y=l.color;if(l instanceof THREE.AmbientLight){e.r+=y.r;e.g+=y.g;e.b+=y.b}else if(l instanceof THREE.DirectionalLight){ea.r+=y.r;ea.g+=y.g;ea.b+=y.b}else if(l instanceof THREE.PointLight){O.r+=y.r;O.g+=y.g;O.b+=y.b}}}ra=0;for(xa=g.length;ra<xa;ra++){u=
-g[ra];v.empty();if(u instanceof THREE.RenderableParticle){q=u;q.x*=n;q.y*=-w;l=0;for(y=u.materials.length;l<y;l++)if(E=u.materials[l]){B=q;t=u;var C=la++;if(aa[C]==null){aa[C]=document.createElementNS("http://www.w3.org/2000/svg","circle");ka==0&&aa[C].setAttribute("shape-rendering","crispEdges")}H=aa[C];H.setAttribute("cx",B.x);H.setAttribute("cy",B.y);H.setAttribute("r",t.scale.x*n);if(E instanceof THREE.ParticleCircleMaterial){if(I){M.r=e.r+ea.r+O.r;M.g=e.g+ea.g+O.g;M.b=e.b+ea.b+O.b;o.r=E.color.r*
+e=new THREE.Color(0),ea=new THREE.Color(0),O=new THREE.Color(0),P,W=new THREE.Vector3,S=[],aa=[],ba=[],H,V,la,Y,ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(ia,ga){j=ia;m=ga;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);G.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ia,ga){var ua,xa,l,y,B,t,u,E;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);Y=la=V=0;if(I=ia.lights.length>0){u=ia.lights;e.setRGB(0,0,0);ea.setRGB(0,0,0);O.setRGB(0,0,0);ua=0;for(xa=u.length;ua<xa;ua++){l=u[ua];y=l.color;if(l instanceof THREE.AmbientLight){e.r+=y.r;e.g+=y.g;e.b+=y.b}else if(l instanceof THREE.DirectionalLight){ea.r+=y.r;ea.g+=y.g;ea.b+=y.b}else if(l instanceof THREE.PointLight){O.r+=y.r;O.g+=y.g;O.b+=y.b}}}ua=0;for(xa=g.length;ua<xa;ua++){u=
+g[ua];v.empty();if(u instanceof THREE.RenderableParticle){q=u;q.x*=n;q.y*=-w;l=0;for(y=u.materials.length;l<y;l++)if(E=u.materials[l]){B=q;t=u;var C=la++;if(aa[C]==null){aa[C]=document.createElementNS("http://www.w3.org/2000/svg","circle");ka==0&&aa[C].setAttribute("shape-rendering","crispEdges")}H=aa[C];H.setAttribute("cx",B.x);H.setAttribute("cy",B.y);H.setAttribute("r",t.scale.x*n);if(E instanceof THREE.ParticleCircleMaterial){if(I){M.r=e.r+ea.r+O.r;M.g=e.g+ea.g+O.g;M.b=e.b+ea.b+O.b;o.r=E.color.r*
 M.r;o.g=E.color.g*M.g;o.b=E.color.b*M.b;o.updateStyleString()}else o=E.color;H.setAttribute("style","fill: "+o.__styleString)}k.appendChild(H)}}else if(u instanceof THREE.RenderableLine){q=u.v1;p=u.v2;q.positionScreen.x*=n;q.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);if(G.instersects(v)){l=0;for(y=u.materials.length;l<y;)if(E=u.materials[l++]){B=q;t=p;C=Y++;if(ba[C]==null){ba[C]=
 document.createElementNS("http://www.w3.org/2000/svg","line");ka==0&&ba[C].setAttribute("shape-rendering","crispEdges")}H=ba[C];H.setAttribute("x1",B.positionScreen.x);H.setAttribute("y1",B.positionScreen.y);H.setAttribute("x2",t.positionScreen.x);H.setAttribute("y2",t.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){o.__styleString=E.color.__styleString;H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+
 E.linecap+"; stroke-linejoin: "+E.linejoin);k.appendChild(H)}}}}else if(u instanceof THREE.RenderableFace3){q=u.v1;p=u.v2;x=u.v3;q.positionScreen.x*=n;q.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(G.instersects(v)){l=0;for(y=u.meshMaterials.length;l<y;){E=u.meshMaterials[l++];if(E instanceof
 THREE.MeshFaceMaterial){B=0;for(t=u.faceMaterials.length;B<t;)(E=u.faceMaterials[B++])&&b(q,p,x,u,E,ia)}else E&&b(q,p,x,u,E,ia)}}}else if(u instanceof THREE.RenderableFace4){q=u.v1;p=u.v2;x=u.v3;A=u.v4;q.positionScreen.x*=n;q.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;A.positionScreen.x*=n;A.positionScreen.y*=-w;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,
 x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(v)){l=0;for(y=u.meshMaterials.length;l<y;){E=u.meshMaterials[l++];if(E instanceof THREE.MeshFaceMaterial){B=0;for(t=u.faceMaterials.length;B<t;)(E=u.faceMaterials[B++])&&c(q,p,x,A,u,E,ia)}else E&&c(q,p,x,A,u,E,ia)}}}}}};
-THREE.WebGLRenderer=function(a){function b(l,y,B){var t,u,E,C=l.vertices,J=C.length,L=l.colors,z=L.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,Q=l.__dirtyVertices,ga=l.__dirtyColors;if(B.sortParticles){V.multiplySelf(B.globalMatrix);for(t=0;t<J;t++){u=C[t].position;ia.copy(u);V.multiplyVector3(ia);T[t]=[ia.z,t]}T.sort(function(ma,sa){return sa[0]-ma[0]});for(t=0;t<J;t++){u=C[T[t][1]].position;E=t*3;D[E]=u.x;D[E+1]=u.y;D[E+2]=u.z}for(t=0;t<z;t++){E=t*3;color=L[T[t][1]];F[E]=color.r;F[E+
-1]=color.g;F[E+2]=color.b}}else{if(Q)for(t=0;t<J;t++){u=C[t].position;E=t*3;D[E]=u.x;D[E+1]=u.y;D[E+2]=u.z}if(ga)for(t=0;t<z;t++){color=L[t];E=t*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(Q||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,y)}if(ga||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,y)}}function c(l,y){l.fragment_shader=y.fragment_shader;l.vertex_shader=y.vertex_shader;l.uniforms=
+THREE.WebGLRenderer=function(a){function b(l,y,B){var t,u,E,C=l.vertices,J=C.length,L=l.colors,z=L.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,Q=l.__dirtyVertices,fa=l.__dirtyColors;if(B.sortParticles){V.multiplySelf(B.globalMatrix);for(t=0;t<J;t++){u=C[t].position;ia.copy(u);V.multiplyVector3(ia);T[t]=[ia.z,t]}T.sort(function(ma,ra){return ra[0]-ma[0]});for(t=0;t<J;t++){u=C[T[t][1]].position;E=t*3;D[E]=u.x;D[E+1]=u.y;D[E+2]=u.z}for(t=0;t<z;t++){E=t*3;color=L[T[t][1]];F[E]=color.r;F[E+
+1]=color.g;F[E+2]=color.b}}else{if(Q)for(t=0;t<J;t++){u=C[t].position;E=t*3;D[E]=u.x;D[E+1]=u.y;D[E+2]=u.z}if(fa)for(t=0;t<z;t++){color=L[t];E=t*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(Q||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,y)}if(fa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,y)}}function c(l,y){l.fragment_shader=y.fragment_shader;l.vertex_shader=y.vertex_shader;l.uniforms=
 Uniforms.clone(y.uniforms)}function d(l,y,B,t,u){t.program||P.initMaterial(t,y,B);var E=t.program,C=E.uniforms,J=t.uniforms;if(E!=ea){e.useProgram(E);ea=E;e.uniformMatrix4fv(C.projectionMatrix,!1,la)}if(B&&(t instanceof THREE.MeshBasicMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshPhongMaterial||t instanceof THREE.LineBasicMaterial||t instanceof THREE.ParticleBasicMaterial)){J.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){J.fogNear.value=B.near;J.fogFar.value=
-B.far}else if(B instanceof THREE.FogExp2)J.fogDensity.value=B.density}if(t instanceof THREE.MeshPhongMaterial||t instanceof THREE.MeshLambertMaterial){var L,z,D=0,F=0,T=0,Q,ga,ma,sa=P.lights,oa=sa.directional.colors,na=sa.directional.positions,ha=sa.point.colors,Ca=sa.point.positions,R=0,Ga=0;B=z=z=0;for(L=y.length;B<L;B++){z=y[B];Q=z.color;ga=z.position;ma=z.intensity;if(z instanceof THREE.AmbientLight){D+=Q.r;F+=Q.g;T+=Q.b}else if(z instanceof THREE.DirectionalLight){z=R*3;oa[z]=Q.r*ma;oa[z+1]=
-Q.g*ma;oa[z+2]=Q.b*ma;na[z]=ga.x;na[z+1]=ga.y;na[z+2]=ga.z;R+=1}else if(z instanceof THREE.PointLight){z=Ga*3;ha[z]=Q.r*ma;ha[z+1]=Q.g*ma;ha[z+2]=Q.b*ma;Ca[z]=ga.x;Ca[z+1]=ga.y;Ca[z+2]=ga.z;Ga+=1}}for(B=R*3;B<oa.length;B++)oa[B]=0;for(B=Ga*3;B<ha.length;B++)ha[B]=0;sa.point.length=Ga;sa.directional.length=R;sa.ambient[0]=D;sa.ambient[1]=F;sa.ambient[2]=T;y=P.lights;J.enableLighting.value=y.directional.length+y.point.length;J.ambientLightColor.value=y.ambient;J.directionalLightColor.value=y.directional.colors;
+B.far}else if(B instanceof THREE.FogExp2)J.fogDensity.value=B.density}if(t instanceof THREE.MeshPhongMaterial||t instanceof THREE.MeshLambertMaterial){var L,z,D=0,F=0,T=0,Q,fa,ma,ra=P.lights,oa=ra.directional.colors,na=ra.directional.positions,ha=ra.point.colors,Ca=ra.point.positions,R=0,Ga=0;B=z=z=0;for(L=y.length;B<L;B++){z=y[B];Q=z.color;fa=z.position;ma=z.intensity;if(z instanceof THREE.AmbientLight){D+=Q.r;F+=Q.g;T+=Q.b}else if(z instanceof THREE.DirectionalLight){z=R*3;oa[z]=Q.r*ma;oa[z+1]=
+Q.g*ma;oa[z+2]=Q.b*ma;na[z]=fa.x;na[z+1]=fa.y;na[z+2]=fa.z;R+=1}else if(z instanceof THREE.PointLight){z=Ga*3;ha[z]=Q.r*ma;ha[z+1]=Q.g*ma;ha[z+2]=Q.b*ma;Ca[z]=fa.x;Ca[z+1]=fa.y;Ca[z+2]=fa.z;Ga+=1}}for(B=R*3;B<oa.length;B++)oa[B]=0;for(B=Ga*3;B<ha.length;B++)ha[B]=0;ra.point.length=Ga;ra.directional.length=R;ra.ambient[0]=D;ra.ambient[1]=F;ra.ambient[2]=T;y=P.lights;J.enableLighting.value=y.directional.length+y.point.length;J.ambientLightColor.value=y.ambient;J.directionalLightColor.value=y.directional.colors;
 J.directionalLightDirection.value=y.directional.positions;J.pointLightColor.value=y.point.colors;J.pointLightPosition.value=y.point.positions}if(t instanceof THREE.MeshBasicMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshPhongMaterial){J.diffuse.value.setRGB(t.color.r*t.opacity,t.color.g*t.opacity,t.color.b*t.opacity);J.opacity.value=t.opacity;J.map.texture=t.map;J.light_map.texture=t.light_map;J.env_map.texture=t.env_map;J.reflectivity.value=t.reflectivity;J.refraction_ratio.value=
 t.refraction_ratio;J.combine.value=t.combine;J.useRefract.value=t.env_map&&t.env_map.mapping instanceof THREE.CubeRefractionMapping}if(t instanceof THREE.LineBasicMaterial){J.diffuse.value.setRGB(t.color.r*t.opacity,t.color.g*t.opacity,t.color.b*t.opacity);J.opacity.value=t.opacity}else if(t instanceof THREE.ParticleBasicMaterial){J.psColor.value.setRGB(t.color.r*t.opacity,t.color.g*t.opacity,t.color.b*t.opacity);J.opacity.value=t.opacity;J.size.value=t.size;J.map.texture=t.map}else if(t instanceof
 THREE.MeshPhongMaterial){J.ambient.value.setRGB(t.ambient.r,t.ambient.g,t.ambient.b);J.specular.value.setRGB(t.specular.r,t.specular.g,t.specular.b);J.shininess.value=t.shininess}else if(t instanceof THREE.MeshDepthMaterial){J.mNear.value=l.zNear;J.mFar.value=l.zFar;J.opacity.value=t.opacity}else if(t instanceof THREE.MeshNormalMaterial)J.opacity.value=t.opacity;for(var Ha in J)if(D=E.uniforms[Ha]){B=J[Ha];L=B.type;y=B.value;if(L=="i")e.uniform1i(D,y);else if(L=="f")e.uniform1f(D,y);else if(L=="fv1")e.uniform1fv(D,
@@ -221,9 +222,9 @@ l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(l.wrap_s));e.t
 e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,t,u;if(l){B=l.__webGLFramebuffer;t=l.width;u=l.height}else{B=null;t=M.width;u=M.height}if(B!=O){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,t,u);y&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);O=B}}function I(l,y){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l==
 "vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,y);e.compileShader(B);if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function o(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
-case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),e,ea=null,O=null,P=this,W=null,S=null,aa=null,ba=null,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Matrix4,la=new Float32Array(16),Y=new Float32Array(16),ka=new Float32Array(16),ia=new THREE.Vector4,fa=
-!0,ra=new THREE.Color(0),xa=0;if(a){if(a.antialias!==undefined)fa=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!1;(function(l,y,B){try{e=M.getContext("experimental-webgl",{antialias:l})}catch(t){console.log(t)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
-e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,B);_cullEnabled=!0})(fa,ra,xa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;e.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){e.clearColor(l.r,l.g,l.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
+case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),e,ea=null,O=null,P=this,W=null,S=null,aa=null,ba=null,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Matrix4,la=new Float32Array(16),Y=new Float32Array(16),ka=new Float32Array(16),ia=new THREE.Vector4,ga=
+!0,ua=new THREE.Color(0),xa=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!1;(function(l,y,B){try{e=M.getContext("experimental-webgl",{antialias:l})}catch(t){console.log(t)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
+e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,B);_cullEnabled=!0})(ga,ua,xa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;e.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){e.clearColor(l.r,l.g,l.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
 e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,y,B){var t,u;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
 THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,C,J,L;u=J=L=0;for(E=y.length;u<E;u++){C=y[u];C instanceof THREE.DirectionalLight&&J++;C instanceof THREE.PointLight&&L++}if(L+J<=4)y=J;else{y=Math.ceil(4*J/(L+J));L=4-y}u={directional:y,point:L};L=l.fragment_shader;y=l.vertex_shader;E={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:u.directional,maxPointLights:u.point};B=e.createProgram();u=["#ifdef GL_ES\nprecision highp float;\n#endif",
 "#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+
@@ -232,29 +233,29 @@ e.attachShader(B,I("fragment",u+L));e.attachShader(B,I("vertex",E+y));e.linkProg
 y;L++){u=B[L];t.uniforms[u]=e.getUniformLocation(t,u)}t=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];L=0;for(y=B.length;L<y;L++){u=B[L];t.attributes[u]=e.getAttribLocation(t,u)}t=l.program.attributes;e.enableVertexAttribArray(t.position);t.color>=0&&e.enableVertexAttribArray(t.color);t.normal>=0&&e.enableVertexAttribArray(t.normal);t.tangent>=0&&e.enableVertexAttribArray(t.tangent);if(l.skinning&&t.skinVertexA>=0&&t.skinVertexB>=
 0&&t.skinIndex>=0&&t.skinWeight>=0){e.enableVertexAttribArray(t.skinVertexA);e.enableVertexAttribArray(t.skinVertexB);e.enableVertexAttribArray(t.skinIndex);e.enableVertexAttribArray(t.skinWeight)}};this.render=function(l,y,B,t){var u,E,C,J,L,z,D,F,T=l.lights,Q=l.fog;y.matrixAutoUpdate&&y.update();y.globalMatrix.flattenToArray(ka);y.projectionMatrix.flattenToArray(la);y.inverseMatrix.flattenToArray(Y);V.multiply(y.projectionMatrix,y.globalMatrix);j(V);THREE.AnimationHandler&&THREE.AnimationHandler.update();
 l.update(undefined,!1,y);this.initWebGLObjects(l,y);v(B,t!==undefined?t:!0);this.autoClear&&this.clear();L=l.__webGLObjects.length;for(t=0;t<L;t++){u=l.__webGLObjects[t];D=u.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);q(u);u.render=!0;if(this.sortObjects){ia.copy(D.position);V.multiplyVector3(ia);u.z=ia.z}}else u.render=!1;else u.render=!1}this.sortObjects&&l.__webGLObjects.sort(p);z=l.__webGLObjectsImmediate.length;for(t=0;t<
-z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){D.matrixAutoUpdate&&D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);w(u)}}G(THREE.NormalBlending);for(t=0;t<L;t++){u=l.__webGLObjects[t];if(u.render){D=u.object;F=u.buffer;C=u.opaque;h(D);for(u=0;u<C.count;u++){J=C.list[u];k(J.depth_test);f(y,T,Q,J,F,D)}}}for(t=0;t<z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){C=u.opaque;h(D);for(u=0;u<C.count;u++){J=C.list[u];k(J.depth_test);E=d(y,T,Q,J,D);D.render(function(ga){g(ga,
-E)})}}}for(t=0;t<L;t++){u=l.__webGLObjects[t];if(u.render){D=u.object;F=u.buffer;C=u.transparent;h(D);for(u=0;u<C.count;u++){J=C.list[u];G(J.blending);k(J.depth_test);f(y,T,Q,J,F,D)}}}for(t=0;t<z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){C=u.transparent;h(D);for(u=0;u<C.count;u++){J=C.list[u];G(J.blending);k(J.depth_test);E=d(y,T,Q,J,D);D.render(function(ga){g(ga,E)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
+z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){D.matrixAutoUpdate&&D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);w(u)}}G(THREE.NormalBlending);for(t=0;t<L;t++){u=l.__webGLObjects[t];if(u.render){D=u.object;F=u.buffer;C=u.opaque;h(D);for(u=0;u<C.count;u++){J=C.list[u];k(J.depth_test);f(y,T,Q,J,F,D)}}}for(t=0;t<z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){C=u.opaque;h(D);for(u=0;u<C.count;u++){J=C.list[u];k(J.depth_test);E=d(y,T,Q,J,D);D.render(function(fa){g(fa,
+E)})}}}for(t=0;t<L;t++){u=l.__webGLObjects[t];if(u.render){D=u.object;F=u.buffer;C=u.transparent;h(D);for(u=0;u<C.count;u++){J=C.list[u];G(J.blending);k(J.depth_test);f(y,T,Q,J,F,D)}}}for(t=0;t<z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){C=u.transparent;h(D);for(u=0;u<C.count;u++){J=C.list[u];G(J.blending);k(J.depth_test);E=d(y,T,Q,J,D);D.render(function(fa){g(fa,E)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
 e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l,y){var B,t,u;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}B=0;for(t=l.objects.length;B<t;B++){u=l.objects[B];var E=l,C=y,J=void 0,L=void 0,z=void 0,D=void 0;L=u.geometry;if(E.__webGLObjectsMap[u.id]==undefined){E.__webGLObjectsMap[u.id]={};u._modelViewMatrix=new THREE.Matrix4;u._normalMatrixArray=new Float32Array(9);u._modelViewMatrixArray=new Float32Array(16);
 u._objectMatrixArray=new Float32Array(16);u.globalMatrix.flattenToArray(u._objectMatrixArray)}D=E.__webGLObjectsMap[u.id];objlist=E.__webGLObjects;if(u instanceof THREE.Mesh){for(J in L.geometryChunks){z=L.geometryChunks[J];if(!z.__webGLVertexBuffer){C=z;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=
-e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=z;var F=u,T=void 0,Q=void 0,ga=0,ma=E=0,sa=F.geometry.faces,oa=C.faces;T=0;for(Q=oa.length;T<Q;T++){fi=oa[T];face=sa[fi];if(face instanceof THREE.Face3){ga+=3;E+=1;ma+=3}else if(face instanceof THREE.Face4){ga+=4;E+=2;ma+=4}}C.__vertexArray=new Float32Array(ga*3);C.__normalArray=
-new Float32Array(ga*3);C.__tangentArray=new Float32Array(ga*4);C.__colorArray=new Float32Array(ga*3);C.__uvArray=new Float32Array(ga*2);C.__uv2Array=new Float32Array(ga*2);C.__skinVertexAArray=new Float32Array(ga*4);C.__skinVertexBArray=new Float32Array(ga*4);C.__skinIndexArray=new Float32Array(ga*4);C.__skinWeightArray=new Float32Array(ga*4);C.__faceArray=new Uint16Array(E*3);C.__lineArray=new Uint16Array(ma*2);Q=T=C;ga=void 0;sa=void 0;var na=void 0,ha=void 0;na=void 0;oa=!1;ga=0;for(sa=F.materials.length;ga<
-sa;ga++){na=F.materials[ga];if(na instanceof THREE.MeshFaceMaterial){na=0;for(ha=Q.materials.length;na<ha;na++)if(Q.materials[na]&&Q.materials[na].shading!=undefined&&Q.materials[na].shading==THREE.SmoothShading){oa=!0;break}}else if(na&&na.shading!=undefined&&na.shading==THREE.SmoothShading){oa=!0;break}if(oa)break}T.__needsSmoothNormals=oa;C.__webGLFaceCount=E*3;C.__webGLLineCount=ma*2;L.__dirtyVertices=!0;L.__dirtyElements=!0;L.__dirtyUvs=!0;L.__dirtyNormals=!0;L.__dirtyTangents=!0;L.__dirtyColors=
-!0}if(L.__dirtyVertices||L.__dirtyElements||L.__dirtyUvs||L.__dirtyNormals||L.__dirtyColors||L.__dirtyTangents){C=z;E=e.DYNAMIC_DRAW;ma=void 0;T=void 0;var Ca=void 0,R=void 0,Ga=void 0,Ha=void 0,La=void 0;Ca=void 0;var da=void 0,Z=void 0,$=void 0,ta=void 0;da=void 0;Z=void 0;$=void 0;R=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;R=void 0;Ha=void 0;
-Ga=void 0;La=void 0;var Ja=ha=na=oa=sa=ga=F=Q=0,Aa=0,N=0,Ba=C.__vertexArray,Pa=C.__uvArray,Ta=C.__uv2Array,ua=C.__normalArray,pa=C.__tangentArray,za=C.__colorArray,wa=C.__skinVertexAArray,ya=C.__skinVertexBArray,va=C.__skinIndexArray,K=C.__skinWeightArray,ja=C.__faceArray,ca=C.__lineArray,U=C.__needsSmoothNormals,X=u.geometry,qa=X.__dirtyVertices,Da=X.__dirtyElements,Ea=X.__dirtyUvs,Ia=X.__dirtyNormals,Ma=X.__dirtyTangents,Ka=X.__dirtyColors,Fa=X.vertices,Sa=C.faces,Na=X.faces,Oa=X.uvs,Xa=X.uvs2,
+e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=z;var F=u,T=void 0,Q=void 0,fa=0,ma=E=0,ra=F.geometry.faces,oa=C.faces;T=0;for(Q=oa.length;T<Q;T++){fi=oa[T];face=ra[fi];if(face instanceof THREE.Face3){fa+=3;E+=1;ma+=3}else if(face instanceof THREE.Face4){fa+=4;E+=2;ma+=4}}C.__vertexArray=new Float32Array(fa*3);C.__normalArray=
+new Float32Array(fa*3);C.__tangentArray=new Float32Array(fa*4);C.__colorArray=new Float32Array(fa*3);C.__uvArray=new Float32Array(fa*2);C.__uv2Array=new Float32Array(fa*2);C.__skinVertexAArray=new Float32Array(fa*4);C.__skinVertexBArray=new Float32Array(fa*4);C.__skinIndexArray=new Float32Array(fa*4);C.__skinWeightArray=new Float32Array(fa*4);C.__faceArray=new Uint16Array(E*3);C.__lineArray=new Uint16Array(ma*2);Q=T=C;fa=void 0;ra=void 0;var na=void 0,ha=void 0;na=void 0;oa=!1;fa=0;for(ra=F.materials.length;fa<
+ra;fa++){na=F.materials[fa];if(na instanceof THREE.MeshFaceMaterial){na=0;for(ha=Q.materials.length;na<ha;na++)if(Q.materials[na]&&Q.materials[na].shading!=undefined&&Q.materials[na].shading==THREE.SmoothShading){oa=!0;break}}else if(na&&na.shading!=undefined&&na.shading==THREE.SmoothShading){oa=!0;break}if(oa)break}T.__needsSmoothNormals=oa;C.__webGLFaceCount=E*3;C.__webGLLineCount=ma*2;L.__dirtyVertices=!0;L.__dirtyElements=!0;L.__dirtyUvs=!0;L.__dirtyNormals=!0;L.__dirtyTangents=!0;L.__dirtyColors=
+!0}if(L.__dirtyVertices||L.__dirtyElements||L.__dirtyUvs||L.__dirtyNormals||L.__dirtyColors||L.__dirtyTangents){C=z;E=e.DYNAMIC_DRAW;ma=void 0;T=void 0;var Ca=void 0,R=void 0,Ga=void 0,Ha=void 0,La=void 0;Ca=void 0;var da=void 0,Z=void 0,$=void 0,sa=void 0;da=void 0;Z=void 0;$=void 0;R=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;R=void 0;Ha=void 0;
+Ga=void 0;La=void 0;var Ja=ha=na=oa=ra=fa=F=Q=0,Aa=0,N=0,Ba=C.__vertexArray,Pa=C.__uvArray,Ta=C.__uv2Array,ta=C.__normalArray,pa=C.__tangentArray,za=C.__colorArray,wa=C.__skinVertexAArray,ya=C.__skinVertexBArray,va=C.__skinIndexArray,K=C.__skinWeightArray,ja=C.__faceArray,ca=C.__lineArray,U=C.__needsSmoothNormals,X=u.geometry,qa=X.__dirtyVertices,Da=X.__dirtyElements,Ea=X.__dirtyUvs,Ia=X.__dirtyNormals,Ma=X.__dirtyTangents,Ka=X.__dirtyColors,Fa=X.vertices,Sa=C.faces,Na=X.faces,Oa=X.uvs,Xa=X.uvs2,
 Qa=X.colors,Ua=X.skinVerticesA,Va=X.skinVerticesB,Wa=X.skinIndices,Ra=X.skinWeights;ma=0;for(T=Sa.length;ma<T;ma++){Ca=Sa[ma];R=Na[Ca];La=Oa[Ca];Ca=Xa[Ca];Ga=R.vertexNormals;Ha=R.normal;if(R instanceof THREE.Face3){if(qa){da=Fa[R.a].position;Z=Fa[R.b].position;$=Fa[R.c].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;F+=9}if(Ra.length){da=Ra[R.a];Z=Ra[R.b];$=Ra[R.c];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+3]=da.w;K[N+4]=Z.x;K[N+5]=
 Z.y;K[N+6]=Z.z;K[N+7]=Z.w;K[N+8]=$.x;K[N+9]=$.y;K[N+10]=$.z;K[N+11]=$.w;da=Wa[R.a];Z=Wa[R.b];$=Wa[R.c];va[N]=da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;da=Ua[R.a];Z=Ua[R.b];$=Ua[R.c];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;da=Va[R.a];Z=Va[R.b];$=Va[R.c];ya[N]=da.x;ya[N+1]=da.y;ya[N+2]=da.z;ya[N+3]=1;
 ya[N+4]=Z.x;ya[N+5]=Z.y;ya[N+6]=Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;N+=12}if(Ka&&Qa.length){da=Qa[R.a];Z=Qa[R.b];$=Qa[R.c];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;Aa+=9}if(Ma&&X.hasTangents){da=Fa[R.a].tangent;Z=Fa[R.b].tangent;$=Fa[R.c].tangent;pa[ha]=da.x;pa[ha+1]=da.y;pa[ha+2]=da.z;pa[ha+3]=da.w;pa[ha+4]=Z.x;pa[ha+5]=Z.y;pa[ha+6]=Z.z;pa[ha+7]=Z.w;pa[ha+8]=$.x;pa[ha+9]=$.y;pa[ha+10]=$.z;pa[ha+
-11]=$.w;ha+=12}if(Ia)if(Ga.length==3&&U)for(R=0;R<3;R++){Ha=Ga[R];ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}else for(R=0;R<3;R++){ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}if(Ea&&La)for(R=0;R<3;R++){Ga=La[R];Pa[ga]=Ga.u;Pa[ga+1]=Ga.v;ga+=2}if(Ea&&Ca)for(R=0;R<3;R++){La=Ca[R];Ta[sa]=La.u;Ta[sa+1]=La.v;sa+=2}if(Da){ja[oa]=Q;ja[oa+1]=Q+1;ja[oa+2]=Q+2;oa+=3;ca[Ja]=Q;ca[Ja+1]=Q+1;ca[Ja+2]=Q;ca[Ja+3]=Q+2;ca[Ja+4]=Q+1;ca[Ja+5]=Q+2;Ja+=6;Q+=3}}else if(R instanceof THREE.Face4){if(qa){da=Fa[R.a].position;
-Z=Fa[R.b].position;$=Fa[R.c].position;ta=Fa[R.d].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;Ba[F+9]=ta.x;Ba[F+10]=ta.y;Ba[F+11]=ta.z;F+=12}if(Ra.length){da=Ra[R.a];Z=Ra[R.b];$=Ra[R.c];ta=Ra[R.d];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+3]=da.w;K[N+4]=Z.x;K[N+5]=Z.y;K[N+6]=Z.z;K[N+7]=Z.w;K[N+8]=$.x;K[N+9]=$.y;K[N+10]=$.z;K[N+11]=$.w;K[N+12]=ta.x;K[N+13]=ta.y;K[N+14]=ta.z;K[N+15]=ta.w;da=Wa[R.a];Z=Wa[R.b];$=Wa[R.c];ta=Wa[R.d];va[N]=
-da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;va[N+12]=ta.x;va[N+13]=ta.y;va[N+14]=ta.z;va[N+15]=ta.w;da=Ua[R.a];Z=Ua[R.b];$=Ua[R.c];ta=Ua[R.d];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;wa[N+12]=ta.x;wa[N+13]=ta.y;wa[N+14]=ta.z;wa[N+15]=1;da=Va[R.a];Z=Va[R.b];$=Va[R.c];ta=Va[R.d];ya[N]=da.x;ya[N+1]=da.y;ya[N+
-2]=da.z;ya[N+3]=1;ya[N+4]=Z.x;ya[N+5]=Z.y;ya[N+6]=Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;ya[N+12]=ta.x;ya[N+13]=ta.y;ya[N+14]=ta.z;ya[N+15]=1;N+=16}if(Ka&&Qa.length){da=Qa[R.a];Z=Qa[R.b];$=Qa[R.c];ta=Qa[R.d];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;za[Aa+9]=ta.r;za[Aa+10]=ta.g;za[Aa+11]=ta.b;Aa+=12}if(Ma&&X.hasTangents){da=Fa[R.a].tangent;Z=Fa[R.b].tangent;$=Fa[R.c].tangent;R=Fa[R.d].tangent;pa[ha]=
-da.x;pa[ha+1]=da.y;pa[ha+2]=da.z;pa[ha+3]=da.w;pa[ha+4]=Z.x;pa[ha+5]=Z.y;pa[ha+6]=Z.z;pa[ha+7]=Z.w;pa[ha+8]=$.x;pa[ha+9]=$.y;pa[ha+10]=$.z;pa[ha+11]=$.w;pa[ha+12]=R.x;pa[ha+13]=R.y;pa[ha+14]=R.z;pa[ha+15]=R.w;ha+=16}if(Ia)if(Ga.length==4&&U)for(R=0;R<4;R++){Ha=Ga[R];ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}else for(R=0;R<4;R++){ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}if(Ea&&La)for(R=0;R<4;R++){Ga=La[R];Pa[ga]=Ga.u;Pa[ga+1]=Ga.v;ga+=2}if(Ea&&Ca)for(R=0;R<4;R++){La=Ca[R];Ta[sa]=La.u;Ta[sa+
-1]=La.v;sa+=2}if(Da){ja[oa]=Q;ja[oa+1]=Q+1;ja[oa+2]=Q+2;ja[oa+3]=Q;ja[oa+4]=Q+2;ja[oa+5]=Q+3;oa+=6;ca[Ja]=Q;ca[Ja+1]=Q+1;ca[Ja+2]=Q;ca[Ja+3]=Q+3;ca[Ja+4]=Q+1;ca[Ja+5]=Q+2;ca[Ja+6]=Q+2;ca[Ja+7]=Q+3;Ja+=8;Q+=4}}}if(qa){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,E)}if(Ka&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,za,E)}if(Ia){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ua,E)}if(Ma&&
-X.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,pa,E)}if(Ea&&ga>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,E)}if(Ea&&sa>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ta,E)}if(Da){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja,E);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ca,E)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,
+11]=$.w;ha+=12}if(Ia)if(Ga.length==3&&U)for(R=0;R<3;R++){Ha=Ga[R];ta[na]=Ha.x;ta[na+1]=Ha.y;ta[na+2]=Ha.z;na+=3}else for(R=0;R<3;R++){ta[na]=Ha.x;ta[na+1]=Ha.y;ta[na+2]=Ha.z;na+=3}if(Ea&&La)for(R=0;R<3;R++){Ga=La[R];Pa[fa]=Ga.u;Pa[fa+1]=Ga.v;fa+=2}if(Ea&&Ca)for(R=0;R<3;R++){La=Ca[R];Ta[ra]=La.u;Ta[ra+1]=La.v;ra+=2}if(Da){ja[oa]=Q;ja[oa+1]=Q+1;ja[oa+2]=Q+2;oa+=3;ca[Ja]=Q;ca[Ja+1]=Q+1;ca[Ja+2]=Q;ca[Ja+3]=Q+2;ca[Ja+4]=Q+1;ca[Ja+5]=Q+2;Ja+=6;Q+=3}}else if(R instanceof THREE.Face4){if(qa){da=Fa[R.a].position;
+Z=Fa[R.b].position;$=Fa[R.c].position;sa=Fa[R.d].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;Ba[F+9]=sa.x;Ba[F+10]=sa.y;Ba[F+11]=sa.z;F+=12}if(Ra.length){da=Ra[R.a];Z=Ra[R.b];$=Ra[R.c];sa=Ra[R.d];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+3]=da.w;K[N+4]=Z.x;K[N+5]=Z.y;K[N+6]=Z.z;K[N+7]=Z.w;K[N+8]=$.x;K[N+9]=$.y;K[N+10]=$.z;K[N+11]=$.w;K[N+12]=sa.x;K[N+13]=sa.y;K[N+14]=sa.z;K[N+15]=sa.w;da=Wa[R.a];Z=Wa[R.b];$=Wa[R.c];sa=Wa[R.d];va[N]=
+da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;va[N+12]=sa.x;va[N+13]=sa.y;va[N+14]=sa.z;va[N+15]=sa.w;da=Ua[R.a];Z=Ua[R.b];$=Ua[R.c];sa=Ua[R.d];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;wa[N+12]=sa.x;wa[N+13]=sa.y;wa[N+14]=sa.z;wa[N+15]=1;da=Va[R.a];Z=Va[R.b];$=Va[R.c];sa=Va[R.d];ya[N]=da.x;ya[N+1]=da.y;ya[N+
+2]=da.z;ya[N+3]=1;ya[N+4]=Z.x;ya[N+5]=Z.y;ya[N+6]=Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;ya[N+12]=sa.x;ya[N+13]=sa.y;ya[N+14]=sa.z;ya[N+15]=1;N+=16}if(Ka&&Qa.length){da=Qa[R.a];Z=Qa[R.b];$=Qa[R.c];sa=Qa[R.d];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;za[Aa+9]=sa.r;za[Aa+10]=sa.g;za[Aa+11]=sa.b;Aa+=12}if(Ma&&X.hasTangents){da=Fa[R.a].tangent;Z=Fa[R.b].tangent;$=Fa[R.c].tangent;R=Fa[R.d].tangent;pa[ha]=
+da.x;pa[ha+1]=da.y;pa[ha+2]=da.z;pa[ha+3]=da.w;pa[ha+4]=Z.x;pa[ha+5]=Z.y;pa[ha+6]=Z.z;pa[ha+7]=Z.w;pa[ha+8]=$.x;pa[ha+9]=$.y;pa[ha+10]=$.z;pa[ha+11]=$.w;pa[ha+12]=R.x;pa[ha+13]=R.y;pa[ha+14]=R.z;pa[ha+15]=R.w;ha+=16}if(Ia)if(Ga.length==4&&U)for(R=0;R<4;R++){Ha=Ga[R];ta[na]=Ha.x;ta[na+1]=Ha.y;ta[na+2]=Ha.z;na+=3}else for(R=0;R<4;R++){ta[na]=Ha.x;ta[na+1]=Ha.y;ta[na+2]=Ha.z;na+=3}if(Ea&&La)for(R=0;R<4;R++){Ga=La[R];Pa[fa]=Ga.u;Pa[fa+1]=Ga.v;fa+=2}if(Ea&&Ca)for(R=0;R<4;R++){La=Ca[R];Ta[ra]=La.u;Ta[ra+
+1]=La.v;ra+=2}if(Da){ja[oa]=Q;ja[oa+1]=Q+1;ja[oa+2]=Q+2;ja[oa+3]=Q;ja[oa+4]=Q+2;ja[oa+5]=Q+3;oa+=6;ca[Ja]=Q;ca[Ja+1]=Q+1;ca[Ja+2]=Q;ca[Ja+3]=Q+3;ca[Ja+4]=Q+1;ca[Ja+5]=Q+2;ca[Ja+6]=Q+2;ca[Ja+7]=Q+3;Ja+=8;Q+=4}}}if(qa){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,E)}if(Ka&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,za,E)}if(Ia){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,E)}if(Ma&&
+X.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,pa,E)}if(Ea&&fa>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,E)}if(Ea&&ra>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ta,E)}if(Da){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja,E);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ca,E)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,
 C.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,wa,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,va,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,K,E)}}x(objlist,D,J,z,u)}L.__dirtyVertices=!1;L.__dirtyElements=!1;L.__dirtyUvs=!1;L.__dirtyNormals=!1;L.__dirtyTangents=!1;L.__dirtyColors=!1}else if(u instanceof THREE.Ribbon){if(!L.__webGLVertexBuffer){J=
-L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__webGLVertexCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}if(L.__dirtyVertices||L.__dirtyColors){J=L;z=e.DYNAMIC_DRAW;Q=void 0;Q=void 0;F=void 0;C=void 0;ga=J.vertices;E=J.colors;sa=ga.length;ma=E.length;oa=J.__vertexArray;T=J.__colorArray;na=J.__dirtyColors;if(J.__dirtyVertices){for(Q=0;Q<sa;Q++){F=ga[Q].position;C=
+L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__webGLVertexCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}if(L.__dirtyVertices||L.__dirtyColors){J=L;z=e.DYNAMIC_DRAW;Q=void 0;Q=void 0;F=void 0;C=void 0;fa=J.vertices;E=J.colors;ra=fa.length;ma=E.length;oa=J.__vertexArray;T=J.__colorArray;na=J.__dirtyColors;if(J.__dirtyVertices){for(Q=0;Q<ra;Q++){F=fa[Q].position;C=
 Q*3;oa[C]=F.x;oa[C+1]=F.y;oa[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,oa,z)}if(na){for(Q=0;Q<ma;Q++){color=E[Q];C=Q*3;T[C]=color.r;T[C+1]=color.g;T[C+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,z)}}x(objlist,D,0,L,u);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(u instanceof THREE.Line){if(!L.__webGLVertexBuffer){J=L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;
-J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__webGLLineCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}if(L.__dirtyVertices||L.__dirtyColors){J=L;z=e.DYNAMIC_DRAW;Q=void 0;Q=void 0;F=void 0;C=void 0;ga=J.vertices;E=J.colors;sa=ga.length;ma=E.length;oa=J.__vertexArray;T=J.__colorArray;na=J.__dirtyColors;if(J.__dirtyVertices){for(Q=0;Q<sa;Q++){F=ga[Q].position;C=Q*3;oa[C]=F.x;oa[C+1]=F.y;oa[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
+J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__webGLLineCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}if(L.__dirtyVertices||L.__dirtyColors){J=L;z=e.DYNAMIC_DRAW;Q=void 0;Q=void 0;F=void 0;C=void 0;fa=J.vertices;E=J.colors;ra=fa.length;ma=E.length;oa=J.__vertexArray;T=J.__colorArray;na=J.__dirtyColors;if(J.__dirtyVertices){for(Q=0;Q<ra;Q++){F=fa[Q].position;C=Q*3;oa[C]=F.x;oa[C+1]=F.y;oa[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
 oa,z)}if(na){for(Q=0;Q<ma;Q++){color=E[Q];C=Q*3;T[C]=color.r;T[C+1]=color.g;T[C+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,z)}}x(objlist,D,0,L,u);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(u instanceof THREE.ParticleSystem){if(!L.__webGLVertexBuffer){J=L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__sortArray=[];
 J.__webGLParticleCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}(L.__dirtyVertices||L.__dirtyColors||u.sortParticles)&&b(L,e.DYNAMIC_DRAW,u,C);x(objlist,D,0,L,u);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&u instanceof THREE.MarchingCubes){L=D;if(L[0]==undefined){E.__webGLObjectsImmediate.push({object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}});L[0]=1}}}};this.removeObject=function(l,y){var B,t;for(B=l.__webGLObjects.length-1;B>=0;B--){t=l.__webGLObjects[B].object;
 y==t&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,y){if(l){!y||y=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
@@ -365,13 +366,13 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,b,c,d){var f=function(g){function h(z,D){var F=n(z,D),T=n(z,D+1),Q=n(z,D+2),ga=n(z,D+3),ma=(ga<<1&255|Q>>7)-127;F|=(Q&127)<<16|T<<8;if(F==0&&ma==-127)return 0;return(1-2*(ga>>7))*(1+F*Math.pow(2,-23))*Math.pow(2,ma)}function k(z,D){var F=n(z,D),T=n(z,D+1),Q=n(z,D+2);return(n(z,D+3)<<24)+(Q<<16)+(T<<8)+F}function j(z,D){var F=n(z,D);return(n(z,D+1)<<8)+F}function m(z,D){var F=n(z,D);return F>127?F-256:F}function n(z,D){return z.charCodeAt(D)&255}function w(z){var D,F,T;D=
-k(a,z);F=k(a,z+ea);T=k(a,z+O);z=j(a,z+P);THREE.Loader.prototype.f3(v,D,F,T,z)}function q(z){var D,F,T,Q,ga,ma;D=k(a,z);F=k(a,z+ea);T=k(a,z+O);Q=j(a,z+P);ga=k(a,z+W);ma=k(a,z+S);z=k(a,z+aa);THREE.Loader.prototype.f3n(v,M,D,F,T,Q,ga,ma,z)}function p(z){var D,F,T,Q;D=k(a,z);F=k(a,z+ba);T=k(a,z+H);Q=k(a,z+V);z=j(a,z+la);THREE.Loader.prototype.f4(v,D,F,T,Q,z)}function x(z){var D,F,T,Q,ga,ma,sa,oa;D=k(a,z);F=k(a,z+ba);T=k(a,z+H);Q=k(a,z+V);ga=j(a,z+la);ma=k(a,z+Y);sa=k(a,z+ka);oa=k(a,z+ia);z=k(a,z+fa);
-THREE.Loader.prototype.f4n(v,M,D,F,T,Q,ga,ma,sa,oa,z)}function A(z){var D,F;D=k(a,z);F=k(a,z+ra);z=k(a,z+xa);THREE.Loader.prototype.uv3(v.uvs,e[D*2],e[D*2+1],e[F*2],e[F*2+1],e[z*2],e[z*2+1])}function G(z){var D,F,T;D=k(a,z);F=k(a,z+l);T=k(a,z+y);z=k(a,z+B);THREE.Loader.prototype.uv4(v.uvs,e[D*2],e[D*2+1],e[F*2],e[F*2+1],e[T*2],e[T*2+1],e[z*2],e[z*2+1])}var v=this,I=0,o,M=[],e=[],ea,O,P,W,S,aa,ba,H,V,la,Y,ka,ia,fa,ra,xa,l,y,B,t,u,E,C,J,L;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,
+createBinModel:function(a,b,c,d){var f=function(g){function h(z,D){var F=n(z,D),T=n(z,D+1),Q=n(z,D+2),fa=n(z,D+3),ma=(fa<<1&255|Q>>7)-127;F|=(Q&127)<<16|T<<8;if(F==0&&ma==-127)return 0;return(1-2*(fa>>7))*(1+F*Math.pow(2,-23))*Math.pow(2,ma)}function k(z,D){var F=n(z,D),T=n(z,D+1),Q=n(z,D+2);return(n(z,D+3)<<24)+(Q<<16)+(T<<8)+F}function j(z,D){var F=n(z,D);return(n(z,D+1)<<8)+F}function m(z,D){var F=n(z,D);return F>127?F-256:F}function n(z,D){return z.charCodeAt(D)&255}function w(z){var D,F,T;D=
+k(a,z);F=k(a,z+ea);T=k(a,z+O);z=j(a,z+P);THREE.Loader.prototype.f3(v,D,F,T,z)}function q(z){var D,F,T,Q,fa,ma;D=k(a,z);F=k(a,z+ea);T=k(a,z+O);Q=j(a,z+P);fa=k(a,z+W);ma=k(a,z+S);z=k(a,z+aa);THREE.Loader.prototype.f3n(v,M,D,F,T,Q,fa,ma,z)}function p(z){var D,F,T,Q;D=k(a,z);F=k(a,z+ba);T=k(a,z+H);Q=k(a,z+V);z=j(a,z+la);THREE.Loader.prototype.f4(v,D,F,T,Q,z)}function x(z){var D,F,T,Q,fa,ma,ra,oa;D=k(a,z);F=k(a,z+ba);T=k(a,z+H);Q=k(a,z+V);fa=j(a,z+la);ma=k(a,z+Y);ra=k(a,z+ka);oa=k(a,z+ia);z=k(a,z+ga);
+THREE.Loader.prototype.f4n(v,M,D,F,T,Q,fa,ma,ra,oa,z)}function A(z){var D,F;D=k(a,z);F=k(a,z+ua);z=k(a,z+xa);THREE.Loader.prototype.uv3(v.uvs,e[D*2],e[D*2+1],e[F*2],e[F*2+1],e[z*2],e[z*2+1])}function G(z){var D,F,T;D=k(a,z);F=k(a,z+l);T=k(a,z+y);z=k(a,z+B);THREE.Loader.prototype.uv4(v.uvs,e[D*2],e[D*2+1],e[F*2],e[F*2+1],e[T*2],e[T*2+1],e[z*2],e[z*2+1])}var v=this,I=0,o,M=[],e=[],ea,O,P,W,S,aa,ba,H,V,la,Y,ka,ia,ga,ua,xa,l,y,B,t,u,E,C,J,L;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,
 d,g);o={signature:a.substr(I,8),header_bytes:n(a,I+8),vertex_coordinate_bytes:n(a,I+9),normal_coordinate_bytes:n(a,I+10),uv_coordinate_bytes:n(a,I+11),vertex_index_bytes:n(a,I+12),normal_index_bytes:n(a,I+13),uv_index_bytes:n(a,I+14),material_index_bytes:n(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),
 nquad_smooth_uv:k(a,I+16+40)};I+=o.header_bytes;ea=o.vertex_index_bytes;O=o.vertex_index_bytes*2;P=o.vertex_index_bytes*3;W=o.vertex_index_bytes*3+o.material_index_bytes;S=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;aa=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;ba=o.vertex_index_bytes;H=o.vertex_index_bytes*2;V=o.vertex_index_bytes*3;la=o.vertex_index_bytes*4;Y=o.vertex_index_bytes*4+o.material_index_bytes;ka=o.vertex_index_bytes*4+o.material_index_bytes+
-o.normal_index_bytes;ia=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;fa=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;ra=o.uv_index_bytes;xa=o.uv_index_bytes*2;l=o.uv_index_bytes;y=o.uv_index_bytes*2;B=o.uv_index_bytes*3;g=o.vertex_index_bytes*3+o.material_index_bytes;L=o.vertex_index_bytes*4+o.material_index_bytes;t=o.ntri_flat*g;u=o.ntri_smooth*(g+o.normal_index_bytes*3);E=o.ntri_flat_uv*(g+o.uv_index_bytes*3);C=o.ntri_smooth_uv*(g+o.normal_index_bytes*
-3+o.uv_index_bytes*3);J=o.nquad_flat*L;g=o.nquad_smooth*(L+o.normal_index_bytes*4);L=o.nquad_flat_uv*(L+o.uv_index_bytes*4);I+=function(z){for(var D,F,T,Q=o.vertex_coordinate_bytes*3,ga=z+o.nvertices*Q;z<ga;z+=Q){D=h(a,z);F=h(a,z+o.vertex_coordinate_bytes);T=h(a,z+o.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,D,F,T)}return o.nvertices*Q}(I);I+=function(z){for(var D,F,T,Q=o.normal_coordinate_bytes*3,ga=z+o.nnormals*Q;z<ga;z+=Q){D=m(a,z);F=m(a,z+o.normal_coordinate_bytes);T=m(a,z+o.normal_coordinate_bytes*
+o.normal_index_bytes;ia=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;ga=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;ua=o.uv_index_bytes;xa=o.uv_index_bytes*2;l=o.uv_index_bytes;y=o.uv_index_bytes*2;B=o.uv_index_bytes*3;g=o.vertex_index_bytes*3+o.material_index_bytes;L=o.vertex_index_bytes*4+o.material_index_bytes;t=o.ntri_flat*g;u=o.ntri_smooth*(g+o.normal_index_bytes*3);E=o.ntri_flat_uv*(g+o.uv_index_bytes*3);C=o.ntri_smooth_uv*(g+o.normal_index_bytes*
+3+o.uv_index_bytes*3);J=o.nquad_flat*L;g=o.nquad_smooth*(L+o.normal_index_bytes*4);L=o.nquad_flat_uv*(L+o.uv_index_bytes*4);I+=function(z){for(var D,F,T,Q=o.vertex_coordinate_bytes*3,fa=z+o.nvertices*Q;z<fa;z+=Q){D=h(a,z);F=h(a,z+o.vertex_coordinate_bytes);T=h(a,z+o.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,D,F,T)}return o.nvertices*Q}(I);I+=function(z){for(var D,F,T,Q=o.normal_coordinate_bytes*3,fa=z+o.nnormals*Q;z<fa;z+=Q){D=m(a,z);F=m(a,z+o.normal_coordinate_bytes);T=m(a,z+o.normal_coordinate_bytes*
 2);M.push(D/127,F/127,T/127)}return o.nnormals*Q}(I);I+=function(z){for(var D,F,T=o.uv_coordinate_bytes*2,Q=z+o.nuvs*T;z<Q;z+=T){D=h(a,z);F=h(a,z+o.uv_coordinate_bytes);e.push(D,F)}return o.nuvs*T}(I);t=I+t;u=t+u;E=u+E;C=E+C;J=C+J;g=J+g;L=g+L;(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes,T=F+o.uv_index_bytes*3,Q=z+o.ntri_flat_uv*T;for(D=z;D<Q;D+=T){w(D);A(D+F)}return Q-z})(u);(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,T=F+o.uv_index_bytes*
 3,Q=z+o.ntri_smooth_uv*T;for(D=z;D<Q;D+=T){q(D);A(D+F)}return Q-z})(E);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes,T=F+o.uv_index_bytes*4,Q=z+o.nquad_flat_uv*T;for(D=z;D<Q;D+=T){p(D);G(D+F)}return Q-z})(g);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,T=F+o.uv_index_bytes*4,Q=z+o.nquad_smooth_uv*T;for(D=z;D<Q;D+=T){x(D);G(D+F)}return Q-z})(L);(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes,T=z+o.ntri_flat*F;for(D=
 z;D<T;D+=F)w(D);return T-z})(I);(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,T=z+o.ntri_smooth*F;for(D=z;D<T;D+=F)q(D);return T-z})(t);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes,T=z+o.nquad_flat*F;for(D=z;D<T;D+=F)p(D);return T-z})(C);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,T=z+o.nquad_smooth*F;for(D=z;D<T;D+=F)x(D);return T-z})(J);this.computeCentroids();this.computeFaceNormals();

+ 39 - 38
build/custom/ThreeCanvas.js

@@ -13,7 +13,7 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a||
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,h){return f.distance-h.distance});return e},intersectObject:function(a){function b(r,k,E,D){D=D.clone().subSelf(k);E=E.clone().subSelf(k);var J=r.clone().subSelf(k);r=D.dot(D);k=D.dot(E);D=D.dot(J);var F=E.dot(E);E=E.dot(J);J=1/(r*F-k*k);F=(F*D-k*E)*J;r=(r*E-k*D)*J;return F>0&&r>0&&F+r<1}var c,d,e,f,h,j,g,i,m,n,
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,h){return f.distance-h.distance});return e},intersectObject:function(a){function b(r,k,E,D){D=D.clone().subSelf(k);E=E.clone().subSelf(k);var I=r.clone().subSelf(k);r=D.dot(D);k=D.dot(E);D=D.dot(I);var F=E.dot(E);E=E.dot(I);I=1/(r*F-k*k);F=(F*D-k*E)*I;r=(r*E-k*D)*I;return F>0&&r>0&&F+r<1}var c,d,e,f,h,j,g,i,m,n,
 o,p=a.geometry,t=p.vertices,u=[];c=0;for(d=p.faces.length;c<d;c++){e=p.faces[c];n=this.origin.clone();o=this.direction.clone();g=a.globalMatrix;g.extractRotationMatrix(a.matrixRotation);f=g.multiplyVector3(t[e.a].position.clone());h=g.multiplyVector3(t[e.b].position.clone());j=g.multiplyVector3(t[e.c].position.clone());g=e instanceof THREE.Face4?g.multiplyVector3(t[e.d].position.clone()):null;i=a.matrixRotation.multiplyVector3(e.normal.clone());m=o.dot(i);if(m<0){i=i.dot((new THREE.Vector3).sub(f,
 n))/m;n=n.addSelf(o.multiplyScalar(i));if(e instanceof THREE.Face3){if(b(n,f,h,j)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};u.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,h,g)||b(n,h,j,g))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};u.push(e)}}}return u}};
 THREE.Rectangle=function(){function a(){f=d-b;h=e-c}var b,c,d,e,f,h,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,i,m,n){j=!1;b=g;c=i;d=m;e=n;a()};this.addPoint=function(g,i){if(j){j=!1;b=g;c=i;d=g;e=i}else{b=b<g?b:g;c=c<i?c:i;d=d>g?d:g;e=e>i?e:i}a()};
@@ -25,19 +25,19 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n
 a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=e.x;this.n22=e.y;this.n23=e.z;this.n24=-e.dot(a);
 this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
-a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,g=a.n23,i=a.n24,m=a.n31,n=a.n32,o=a.n33,p=a.n34,t=a.n41,u=a.n42,r=a.n43,k=a.n44,E=b.n11,D=b.n12,J=b.n13,F=b.n14,N=b.n21,B=b.n22,z=b.n23,K=b.n24,x=b.n31,L=b.n32,C=b.n33,w=b.n34,s=b.n41,O=b.n42,v=b.n43,P=b.n44;this.n11=c*E+d*N+e*x+f*s;this.n12=c*D+d*B+e*L+f*O;this.n13=c*J+d*z+e*C+f*v;this.n14=c*F+d*K+e*w+f*P;this.n21=h*E+j*N+g*x+i*s;this.n22=h*D+j*B+g*L+i*O;this.n23=h*J+
-j*z+g*C+i*v;this.n24=h*F+j*K+g*w+i*P;this.n31=m*E+n*N+o*x+p*s;this.n32=m*D+n*B+o*L+p*O;this.n33=m*J+n*z+o*C+p*v;this.n34=m*F+n*K+o*w+p*P;this.n41=t*E+u*N+r*x+k*s;this.n42=t*D+u*B+r*L+k*O;this.n43=t*J+u*z+r*C+k*v;this.n44=t*F+u*K+r*w+k*P;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,g=a.n22,i=a.n23,m=a.n24,n=a.n31,o=a.n32,p=a.n33,t=a.n34,u=a.n41,r=a.n42,k=a.n43;a=a.n44;var E=b.n11,D=b.n12,J=b.n13,F=b.n14,N=b.n21,B=b.n22,z=b.n23,K=b.n24,x=b.n31,L=b.n32,C=b.n33,
-w=b.n34,s=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*E+e*N+f*x+h*s;this.n12=d*D+e*B+f*L+h*O;this.n13=d*J+e*z+f*C+h*v;this.n14=d*F+e*K+f*w+h*b;this.n21=j*E+g*N+i*x+m*s;this.n22=j*D+g*B+i*L+m*O;this.n23=j*J+g*z+i*C+m*v;this.n24=j*F+g*K+i*w+m*b;this.n31=n*E+o*N+p*x+t*s;this.n32=n*D+o*B+p*L+t*O;this.n33=n*J+o*z+p*C+t*v;this.n34=n*F+o*K+p*w+t*b;this.n41=u*E+r*N+k*x+a*s;this.n42=u*D+r*B+k*L+a*O;this.n43=u*J+r*z+k*C+a*v;this.n44=u*F+r*K+k*w+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=
-this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,g=this.n24,i=this.n31,m=this.n32,n=this.n33,o=this.n34,p=this.n41,t=this.n42,u=this.n43,r=this.n44,k=a.n11,E=a.n21,D=a.n31,J=a.n41,F=a.n12,N=a.n22,B=a.n32,z=a.n42,K=a.n13,x=a.n23,L=a.n33,C=a.n43,w=a.n14,s=a.n24,O=
-a.n34;a=a.n44;this.n11=b*k+c*E+d*D+e*J;this.n12=b*F+c*N+d*B+e*z;this.n13=b*K+c*x+d*L+e*C;this.n14=b*w+c*s+d*O+e*a;this.n21=f*k+h*E+j*D+g*J;this.n22=f*F+h*N+j*B+g*z;this.n23=f*K+h*x+j*L+g*C;this.n24=f*w+h*s+j*O+g*a;this.n31=i*k+m*E+n*D+o*J;this.n32=i*F+m*N+n*B+o*z;this.n33=i*K+m*x+n*L+o*C;this.n34=i*w+m*s+n*O+o*a;this.n41=p*k+t*E+u*D+r*J;this.n42=p*F+t*N+u*B+r*z;this.n43=p*K+t*x+u*L+r*C;this.n44=p*w+t*s+u*O+r*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
+a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,g=a.n23,i=a.n24,m=a.n31,n=a.n32,o=a.n33,p=a.n34,t=a.n41,u=a.n42,r=a.n43,k=a.n44,E=b.n11,D=b.n12,I=b.n13,F=b.n14,N=b.n21,B=b.n22,z=b.n23,K=b.n24,x=b.n31,L=b.n32,C=b.n33,w=b.n34,s=b.n41,O=b.n42,v=b.n43,P=b.n44;this.n11=c*E+d*N+e*x+f*s;this.n12=c*D+d*B+e*L+f*O;this.n13=c*I+d*z+e*C+f*v;this.n14=c*F+d*K+e*w+f*P;this.n21=h*E+j*N+g*x+i*s;this.n22=h*D+j*B+g*L+i*O;this.n23=h*I+
+j*z+g*C+i*v;this.n24=h*F+j*K+g*w+i*P;this.n31=m*E+n*N+o*x+p*s;this.n32=m*D+n*B+o*L+p*O;this.n33=m*I+n*z+o*C+p*v;this.n34=m*F+n*K+o*w+p*P;this.n41=t*E+u*N+r*x+k*s;this.n42=t*D+u*B+r*L+k*O;this.n43=t*I+u*z+r*C+k*v;this.n44=t*F+u*K+r*w+k*P;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,g=a.n22,i=a.n23,m=a.n24,n=a.n31,o=a.n32,p=a.n33,t=a.n34,u=a.n41,r=a.n42,k=a.n43;a=a.n44;var E=b.n11,D=b.n12,I=b.n13,F=b.n14,N=b.n21,B=b.n22,z=b.n23,K=b.n24,x=b.n31,L=b.n32,C=b.n33,
+w=b.n34,s=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*E+e*N+f*x+h*s;this.n12=d*D+e*B+f*L+h*O;this.n13=d*I+e*z+f*C+h*v;this.n14=d*F+e*K+f*w+h*b;this.n21=j*E+g*N+i*x+m*s;this.n22=j*D+g*B+i*L+m*O;this.n23=j*I+g*z+i*C+m*v;this.n24=j*F+g*K+i*w+m*b;this.n31=n*E+o*N+p*x+t*s;this.n32=n*D+o*B+p*L+t*O;this.n33=n*I+o*z+p*C+t*v;this.n34=n*F+o*K+p*w+t*b;this.n41=u*E+r*N+k*x+a*s;this.n42=u*D+r*B+k*L+a*O;this.n43=u*I+r*z+k*C+a*v;this.n44=u*F+r*K+k*w+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=
+this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,g=this.n24,i=this.n31,m=this.n32,n=this.n33,o=this.n34,p=this.n41,t=this.n42,u=this.n43,r=this.n44,k=a.n11,E=a.n21,D=a.n31,I=a.n41,F=a.n12,N=a.n22,B=a.n32,z=a.n42,K=a.n13,x=a.n23,L=a.n33,C=a.n43,w=a.n14,s=a.n24,O=
+a.n34;a=a.n44;this.n11=b*k+c*E+d*D+e*I;this.n12=b*F+c*N+d*B+e*z;this.n13=b*K+c*x+d*L+e*C;this.n14=b*w+c*s+d*O+e*a;this.n21=f*k+h*E+j*D+g*I;this.n22=f*F+h*N+j*B+g*z;this.n23=f*K+h*x+j*L+g*C;this.n24=f*w+h*s+j*O+g*a;this.n31=i*k+m*E+n*D+o*I;this.n32=i*F+m*N+n*B+o*z;this.n33=i*K+m*x+n*L+o*C;this.n34=i*w+m*s+n*O+o*a;this.n41=p*k+t*E+u*D+r*I;this.n42=p*F+t*N+u*B+r*z;this.n43=p*K+t*x+u*L+r*C;this.n44=p*w+t*s+u*O+r*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
 this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,h=this.n23,j=this.n24,g=this.n31,i=this.n32,m=this.n33,n=this.n34,o=this.n41,p=this.n42,t=this.n43,u=this.n44;return d*h*i*o-c*j*i*o-d*f*m*o+b*j*m*o+c*f*n*o-b*h*n*o-d*h*g*p+c*j*g*p+d*e*m*p-a*j*m*p-c*e*n*p+a*h*n*p+d*f*g*t-b*j*g*t-d*e*i*t+a*j*i*t+b*e*n*
 t-a*f*n*t-c*f*g*u+b*h*g*u+c*e*i*u-a*h*i*u-b*e*m*u+a*f*m*u},transpose:function(){function a(b,c,d){var e=b[c];b[c]=b[d];b[d]=e}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=
 this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;
 a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,
 0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,j=a.z,g=e*f,i=e*h;this.set(g*f+c,g*h-d*j,g*j+d*h,0,g*h+d*j,
 i*h+c,i*j-d*f,0,g*j-d*h,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-h*f+b*d;this.n32=h*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=
-a.w,f=b+b,h=c+c,j=d+d;a=b*f;var g=b*h;b*=j;var i=c*h;c*=j;d*=j;f*=e;h*=e;e*=j;this.n11=1-(i+d);this.n12=g-e;this.n13=b+h;this.n21=g+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+i)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;
-a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
+a.w,f=b+b,h=c+c,j=d+d;a=b*f;var g=b*h;b*=j;var i=c*h;c*=j;d*=j;f*=e;h*=e;e*=j;this.n11=1-(i+d);this.n12=g-e;this.n13=b+h;this.n21=g+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+i)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;
+a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
 THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};
 THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,g=a.n23,i=a.n24,m=a.n31,n=a.n32,o=a.n33,p=a.n34,t=a.n41,u=a.n42,r=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*p*u-i*o*u+i*n*r-j*p*r-g*n*k+j*o*k;b.n12=f*o*u-e*p*u-f*n*r+d*p*r+e*n*k-d*o*k;b.n13=e*i*u-f*g*u+f*j*r-d*i*r-e*j*k+d*g*k;b.n14=f*g*n-e*i*n-f*j*o+d*i*o+e*j*p-d*g*p;b.n21=i*o*t-g*p*t-i*m*r+h*p*r+g*m*k-h*o*k;b.n22=e*p*t-f*o*t+f*m*r-c*p*r-e*m*k+c*o*k;b.n23=f*g*t-e*i*t-f*h*r+c*i*r+e*h*k-c*g*k;
@@ -47,8 +47,9 @@ THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var h;h=new THREE.Matrix4;h.n11=
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var h,j,g,i;h=new THREE.Matrix4;j=b-a;g=c-d;i=f-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((b+a)/j);h.n21=0;h.n22=2/g;h.n23=0;h.n24=-((c+d)/g);h.n31=0;h.n32=0;h.n33=-2/i;h.n34=-((f+e)/i);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
 1;this.visible=!0};
-THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
-if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);
+this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRotation.n12;this.localMatrix.n13=this.matrixRotation.n13;this.localMatrix.n21=this.matrixRotation.n21;this.localMatrix.n22=this.matrixRotation.n22;this.localMatrix.n23=this.matrixRotation.n23;this.localMatrix.n31=this.matrixRotation.n31;this.localMatrix.n32=this.matrixRotation.n32;this.localMatrix.n33=this.matrixRotation.n33;if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=
+Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 THREE.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.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 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.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 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.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -57,8 +58,8 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,h,j=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.normal.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];h=this.vertices[f.c];j.sub(h.position,
 c.position);g.sub(b.position,c.position);j.crossSelf(g)}j.isZero()||j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(w,s,O,v,P,Y,H){f=w.vertices[s].position;h=w.vertices[O].position;j=w.vertices[v].position;g=e[P];i=e[Y];m=e[H];n=h.x-f.x;o=j.x-f.x;p=h.y-f.y;t=j.y-f.y;
-u=h.z-f.z;r=j.z-f.z;k=i.u-g.u;E=m.u-g.u;D=i.v-g.v;J=m.v-g.v;F=1/(k*J-E*D);z.set((J*n-D*o)*F,(J*p-D*t)*F,(J*u-D*r)*F);K.set((k*o-E*n)*F,(k*t-E*p)*F,(k*r-E*u)*F);N[s].addSelf(z);N[O].addSelf(z);N[v].addSelf(z);B[s].addSelf(K);B[O].addSelf(K);B[v].addSelf(K)}var b,c,d,e,f,h,j,g,i,m,n,o,p,t,u,r,k,E,D,J,F,N=[],B=[],z=new THREE.Vector3,K=new THREE.Vector3,x=new THREE.Vector3,L=new THREE.Vector3,C=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){N[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(w,s,O,v,P,Y,J){f=w.vertices[s].position;h=w.vertices[O].position;j=w.vertices[v].position;g=e[P];i=e[Y];m=e[J];n=h.x-f.x;o=j.x-f.x;p=h.y-f.y;t=j.y-f.y;
+u=h.z-f.z;r=j.z-f.z;k=i.u-g.u;E=m.u-g.u;D=i.v-g.v;I=m.v-g.v;F=1/(k*I-E*D);z.set((I*n-D*o)*F,(I*p-D*t)*F,(I*u-D*r)*F);K.set((k*o-E*n)*F,(k*t-E*p)*F,(k*r-E*u)*F);N[s].addSelf(z);N[O].addSelf(z);N[v].addSelf(z);B[s].addSelf(K);B[O].addSelf(K);B[v].addSelf(K)}var b,c,d,e,f,h,j,g,i,m,n,o,p,t,u,r,k,E,D,I,F,N=[],B=[],z=new THREE.Vector3,K=new THREE.Vector3,x=new THREE.Vector3,L=new THREE.Vector3,C=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){N[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
 for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){C.copy(this.vertices[b].normal);d=N[b];x.copy(d);x.subSelf(C.multiplyScalar(C.dot(d))).normalize();L.cross(this.vertices[b].normal,d);d=L.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(x.x,x.y,x.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 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>
@@ -112,35 +113,35 @@ THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)th
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
 THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
 THREE.Projector=function(){function a(B,z){return z.z-B.z}function b(B,z){var K=0,x=1,L=B.z+B.w,C=z.z+z.w,w=-B.z+B.w,s=-z.z+z.w;if(L>=0&&C>=0&&w>=0&&s>=0)return!0;else if(L<0&&C<0||w<0&&s<0)return!1;else{if(L<0)K=Math.max(K,L/(L-C));else C<0&&(x=Math.min(x,L/(L-C)));if(w<0)K=Math.max(K,w/(w-s));else s<0&&(x=Math.min(x,w/(w-s)));if(x<K)return!1;else{B.lerpSelf(z,K);z.lerpSelf(B,1-x);return!0}}}var c,d,e=[],f,h,j,g=[],i,m,n=[],o,p,t=[],u=new THREE.Vector4,r=new THREE.Vector4,k=new THREE.Matrix4,E=new THREE.Matrix4,
-D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,F=new THREE.Vector4,N;this.projectObjects=function(B,z,K){z=[];var x,L,C;d=0;L=B.objects;B=0;for(x=L.length;B<x;B++){C=L[B];var w;if(!(w=!C.visible))if(w=C instanceof THREE.Mesh){a:{w=void 0;for(var s=C.globalMatrix,O=-C.geometry.boundingSphere.radius*Math.max(C.scale.x,Math.max(C.scale.y,C.scale.z)),v=0;v<6;v++){w=D[v].x*s.n14+D[v].y*s.n24+D[v].z*s.n34+D[v].w;if(w<=
-O){w=!1;break a}}w=!0}w=!w}if(!w){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(C.position);k.multiplyVector3(u);c.object=C;c.z=u.z;z.push(c);d++}}K&&z.sort(a);return z};this.projectScene=function(B,z,K){var x=[],L=z.zNear,C=z.zFar,w,s,O,v,P,Y,H,ga,ka,la,ma,$,Q,I,U,R;j=m=p=0;z.matrixAutoUpdate&&z.update();k.multiply(z.projectionMatrix,z.globalMatrix);D[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);D[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);D[2].set(k.n41+k.n21,k.n42+k.n22,
-k.n43+k.n23,k.n44+k.n24);D[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);D[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);D[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(w=0;w<6;w++){Y=D[w];Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z))}B.update(undefined,!1,z);Y=this.projectObjects(B,z,!0);B=0;for(w=Y.length;B<w;B++){H=Y[B].object;if(H.visible){H.matrixAutoUpdate&&H.updateMatrix();ga=H.globalMatrix;ga.extractRotationMatrix(H.matrixRotation);ma=H.matrixRotation;
-ka=H.materials;la=H.overdraw;if(H instanceof THREE.Mesh){$=H.geometry;Q=$.vertices;s=0;for(O=Q.length;s<O;s++){I=Q[s];I.positionWorld.copy(I.position);ga.multiplyVector3(I.positionWorld);v=I.positionScreen;v.copy(I.positionWorld);k.multiplyVector4(v);v.x/=v.w;v.y/=v.w;I.__visible=v.z>L&&v.z<C}$=$.faces;s=0;for(O=$.length;s<O;s++){I=$[s];if(I instanceof THREE.Face3){v=Q[I.a];P=Q[I.b];U=Q[I.c];if(v.__visible&&P.__visible&&U.__visible&&(H.doubleSided||H.flipSided!=(U.positionScreen.x-v.positionScreen.x)*
-(P.positionScreen.y-v.positionScreen.y)-(U.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0)){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(P.positionWorld);f.v3.positionWorld.copy(U.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(U.positionScreen);f.normalWorld.copy(I.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(I.centroid);
-ga.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);U=I.vertexNormals;N=f.vertexNormalsWorld;v=0;for(P=U.length;v<P;v++){R=N[v]=N[v]||new THREE.Vector3;R.copy(U[v]);ma.multiplyVector3(R)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=I.materials;f.overdraw=la;if(H.geometry.uvs[s]){f.uvs[0]=H.geometry.uvs[s][0];f.uvs[1]=H.geometry.uvs[s][1];f.uvs[2]=H.geometry.uvs[s][2]}x.push(f);j++}}else if(I instanceof THREE.Face4){v=Q[I.a];P=
-Q[I.b];U=Q[I.c];R=Q[I.d];if(v.__visible&&P.__visible&&U.__visible&&R.__visible&&(H.doubleSided||H.flipSided!=((R.positionScreen.x-v.positionScreen.x)*(P.positionScreen.y-v.positionScreen.y)-(R.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0||(P.positionScreen.x-U.positionScreen.x)*(R.positionScreen.y-U.positionScreen.y)-(P.positionScreen.y-U.positionScreen.y)*(R.positionScreen.x-U.positionScreen.x)<0))){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);
-f.v2.positionWorld.copy(P.positionWorld);f.v3.positionWorld.copy(R.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(R.positionScreen);f.normalWorld.copy(I.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(I.centroid);ga.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=I.materials;f.overdraw=la;
-if(H.geometry.uvs[s]){f.uvs[0]=H.geometry.uvs[s][0];f.uvs[1]=H.geometry.uvs[s][1];f.uvs[2]=H.geometry.uvs[s][3]}x.push(f);j++;h=g[j]=g[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(P.positionWorld);h.v2.positionWorld.copy(U.positionWorld);h.v3.positionWorld.copy(R.positionWorld);h.v1.positionScreen.copy(P.positionScreen);h.v2.positionScreen.copy(U.positionScreen);h.v3.positionScreen.copy(R.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);
-h.z=h.centroidScreen.z;h.meshMaterials=ka;h.faceMaterials=I.materials;h.overdraw=la;if(H.geometry.uvs[s]){h.uvs[0]=H.geometry.uvs[s][1];h.uvs[1]=H.geometry.uvs[s][2];h.uvs[2]=H.geometry.uvs[s][3]}x.push(h);j++}}}}else if(H instanceof THREE.Line){E.multiply(k,ga);Q=H.geometry.vertices;I=Q[0];I.positionScreen.copy(I.position);E.multiplyVector4(I.positionScreen);s=1;for(O=Q.length;s<O;s++){v=Q[s];v.positionScreen.copy(v.position);E.multiplyVector4(v.positionScreen);P=Q[s-1];J.copy(v.positionScreen);
-F.copy(P.positionScreen);if(b(J,F)){J.multiplyScalar(1/J.w);F.multiplyScalar(1/F.w);i=n[m]=n[m]||new THREE.RenderableLine;i.v1.positionScreen.copy(J);i.v2.positionScreen.copy(F);i.z=Math.max(J.z,F.z);i.materials=H.materials;x.push(i);m++}}}else if(H instanceof THREE.Particle){r.set(H.position.x,H.position.y,H.position.z,1);k.multiplyVector4(r);r.z/=r.w;if(r.z>0&&r.z<1){o=t[p]=t[p]||new THREE.RenderableParticle;o.x=r.x/r.w;o.y=r.y/r.w;o.z=r.z;o.rotation=H.rotation.z;o.scale.x=H.scale.x*Math.abs(o.x-
-(r.x+z.projectionMatrix.n11)/(r.w+z.projectionMatrix.n14));o.scale.y=H.scale.y*Math.abs(o.y-(r.y+z.projectionMatrix.n22)/(r.w+z.projectionMatrix.n24));o.materials=H.materials;x.push(o);p++}}}}K&&x.sort(a);return x};this.unprojectVector=function(B,z){var K=THREE.Matrix4.makeInvert(z.globalMatrix);K.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));K.multiplyVector3(B);return B}};
-THREE.CanvasRenderer=function(){function a(V){if(o!=V)i.globalAlpha=o=V}function b(V){if(p!=V){switch(V){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}p=V}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,h,j,g,i=e.getContext("2d"),m=new THREE.Color(0),n=0,o=1,p=0,t=null,u=null,r=1,k,E,D,J,F,N,B,z,K,x=new THREE.Color,
-L=new THREE.Color,C=new THREE.Color,w=new THREE.Color,s=new THREE.Color,O,v,P,Y,H,ga,ka,la,ma,$=new THREE.Rectangle,Q=new THREE.Rectangle,I=new THREE.Rectangle,U=!1,R=new THREE.Color,aa=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,La=Math.PI*2,S=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,pa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");
+D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,F=new THREE.Vector4,N;this.projectObjects=function(B,z,K){z=[];var x,L,C;d=0;L=B.objects;B=0;for(x=L.length;B<x;B++){C=L[B];var w;if(!(w=!C.visible))if(w=C instanceof THREE.Mesh){a:{w=void 0;for(var s=C.globalMatrix,O=-C.geometry.boundingSphere.radius*Math.max(C.scale.x,Math.max(C.scale.y,C.scale.z)),v=0;v<6;v++){w=D[v].x*s.n14+D[v].y*s.n24+D[v].z*s.n34+D[v].w;if(w<=
+O){w=!1;break a}}w=!0}w=!w}if(!w){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(C.position);k.multiplyVector3(u);c.object=C;c.z=u.z;z.push(c);d++}}K&&z.sort(a);return z};this.projectScene=function(B,z,K){var x=[],L=z.zNear,C=z.zFar,w,s,O,v,P,Y,J,ja,ka,la,ma,$,Q,H,U,R;j=m=p=0;z.matrixAutoUpdate&&z.update();k.multiply(z.projectionMatrix,z.globalMatrix);D[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);D[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);D[2].set(k.n41+k.n21,k.n42+k.n22,
+k.n43+k.n23,k.n44+k.n24);D[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);D[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);D[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(w=0;w<6;w++){Y=D[w];Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z))}B.update(undefined,!1,z);Y=this.projectObjects(B,z,!0);B=0;for(w=Y.length;B<w;B++){J=Y[B].object;if(J.visible){J.matrixAutoUpdate&&J.updateMatrix();ja=J.globalMatrix;ma=J.matrixRotation;ka=J.materials;la=J.overdraw;if(J instanceof
+THREE.Mesh){$=J.geometry;Q=$.vertices;s=0;for(O=Q.length;s<O;s++){H=Q[s];H.positionWorld.copy(H.position);ja.multiplyVector3(H.positionWorld);v=H.positionScreen;v.copy(H.positionWorld);k.multiplyVector4(v);v.x/=v.w;v.y/=v.w;H.__visible=v.z>L&&v.z<C}$=$.faces;s=0;for(O=$.length;s<O;s++){H=$[s];if(H instanceof THREE.Face3){v=Q[H.a];P=Q[H.b];U=Q[H.c];if(v.__visible&&P.__visible&&U.__visible&&(J.doubleSided||J.flipSided!=(U.positionScreen.x-v.positionScreen.x)*(P.positionScreen.y-v.positionScreen.y)-
+(U.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0)){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(P.positionWorld);f.v3.positionWorld.copy(U.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(U.positionScreen);f.normalWorld.copy(H.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(H.centroid);ja.multiplyVector3(f.centroidWorld);
+f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);U=H.vertexNormals;N=f.vertexNormalsWorld;v=0;for(P=U.length;v<P;v++){R=N[v]=N[v]||new THREE.Vector3;R.copy(U[v]);ma.multiplyVector3(R)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=H.materials;f.overdraw=la;if(J.geometry.uvs[s]){f.uvs[0]=J.geometry.uvs[s][0];f.uvs[1]=J.geometry.uvs[s][1];f.uvs[2]=J.geometry.uvs[s][2]}x.push(f);j++}}else if(H instanceof THREE.Face4){v=Q[H.a];P=Q[H.b];U=Q[H.c];R=Q[H.d];if(v.__visible&&
+P.__visible&&U.__visible&&R.__visible&&(J.doubleSided||J.flipSided!=((R.positionScreen.x-v.positionScreen.x)*(P.positionScreen.y-v.positionScreen.y)-(R.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0||(P.positionScreen.x-U.positionScreen.x)*(R.positionScreen.y-U.positionScreen.y)-(P.positionScreen.y-U.positionScreen.y)*(R.positionScreen.x-U.positionScreen.x)<0))){f=g[j]=g[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(P.positionWorld);
+f.v3.positionWorld.copy(R.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(P.positionScreen);f.v3.positionScreen.copy(R.positionScreen);f.normalWorld.copy(H.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(H.centroid);ja.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=H.materials;f.overdraw=la;if(J.geometry.uvs[s]){f.uvs[0]=J.geometry.uvs[s][0];
+f.uvs[1]=J.geometry.uvs[s][1];f.uvs[2]=J.geometry.uvs[s][3]}x.push(f);j++;h=g[j]=g[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(P.positionWorld);h.v2.positionWorld.copy(U.positionWorld);h.v3.positionWorld.copy(R.positionWorld);h.v1.positionScreen.copy(P.positionScreen);h.v2.positionScreen.copy(U.positionScreen);h.v3.positionScreen.copy(R.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
+ka;h.faceMaterials=H.materials;h.overdraw=la;if(J.geometry.uvs[s]){h.uvs[0]=J.geometry.uvs[s][1];h.uvs[1]=J.geometry.uvs[s][2];h.uvs[2]=J.geometry.uvs[s][3]}x.push(h);j++}}}}else if(J instanceof THREE.Line){E.multiply(k,ja);Q=J.geometry.vertices;H=Q[0];H.positionScreen.copy(H.position);E.multiplyVector4(H.positionScreen);s=1;for(O=Q.length;s<O;s++){v=Q[s];v.positionScreen.copy(v.position);E.multiplyVector4(v.positionScreen);P=Q[s-1];I.copy(v.positionScreen);F.copy(P.positionScreen);if(b(I,F)){I.multiplyScalar(1/
+I.w);F.multiplyScalar(1/F.w);i=n[m]=n[m]||new THREE.RenderableLine;i.v1.positionScreen.copy(I);i.v2.positionScreen.copy(F);i.z=Math.max(I.z,F.z);i.materials=J.materials;x.push(i);m++}}}else if(J instanceof THREE.Particle){r.set(J.position.x,J.position.y,J.position.z,1);k.multiplyVector4(r);r.z/=r.w;if(r.z>0&&r.z<1){o=t[p]=t[p]||new THREE.RenderableParticle;o.x=r.x/r.w;o.y=r.y/r.w;o.z=r.z;o.rotation=J.rotation.z;o.scale.x=J.scale.x*Math.abs(o.x-(r.x+z.projectionMatrix.n11)/(r.w+z.projectionMatrix.n14));
+o.scale.y=J.scale.y*Math.abs(o.y-(r.y+z.projectionMatrix.n22)/(r.w+z.projectionMatrix.n24));o.materials=J.materials;x.push(o);p++}}}}K&&x.sort(a);return x};this.unprojectVector=function(B,z){var K=THREE.Matrix4.makeInvert(z.globalMatrix);K.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));K.multiplyVector3(B);return B}};
+THREE.CanvasRenderer=function(){function a(V){if(o!=V)i.globalAlpha=o=V}function b(V){if(p!=V){switch(V){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}p=V}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,h,j,g,i=e.getContext("2d"),m=new THREE.Color(0),n=0,o=1,p=0,t=null,u=null,r=1,k,E,D,I,F,N,B,z,K,x=new THREE.Color,
+L=new THREE.Color,C=new THREE.Color,w=new THREE.Color,s=new THREE.Color,O,v,P,Y,J,ja,ka,la,ma,$=new THREE.Rectangle,Q=new THREE.Rectangle,H=new THREE.Rectangle,U=!1,R=new THREE.Color,aa=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,La=Math.PI*2,S=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,pa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");
 ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(V,da){f=V;h=da;j=f/2;g=h/2;e.width=f;e.height=h;$.set(-j,-g,j,g);o=1;p=0;u=t=null;r=1};this.setClearColor=function(V,da){m=V;n=da;Q.set(-j,-g,j,g);i.setTransform(1,0,0,-1,j,g);this.clear()};this.setClearColorHex=function(V,da){m.setHex(V);n=da;Q.set(-j,-g,j,g);i.setTransform(1,0,0,-1,j,g);this.clear()};this.clear=
 function(){i.setTransform(1,0,0,-1,j,g);if(!Q.isEmpty()){Q.inflate(1);Q.minSelf($);if(m.hex==0&&n==0)i.clearRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(m.r*255)+","+Math.floor(m.g*255)+","+Math.floor(m.b*255)+","+n+")";i.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight())}Q.empty()}};this.render=function(V,da){function Ma(l){var G,A,q,y=l.lights;aa.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);l=0;for(G=y.length;l<G;l++){A=
 y[l];q=A.color;if(A instanceof THREE.AmbientLight){aa.r+=q.r;aa.g+=q.g;aa.b+=q.b}else if(A instanceof THREE.DirectionalLight){na.r+=q.r;na.g+=q.g;na.b+=q.b}else if(A instanceof THREE.PointLight){oa.r+=q.r;oa.g+=q.g;oa.b+=q.b}}}function ya(l,G,A,q){var y,M,W,X,Z=l.lights;l=0;for(y=Z.length;l<y;l++){M=Z[l];W=M.color;X=M.intensity;if(M instanceof THREE.DirectionalLight){M=A.dot(M.position)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}else if(M instanceof THREE.PointLight){S.sub(M.position,G);S.normalize();
-M=A.dot(S)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}}}function Na(l,G,A){if(A.opacity!=0){a(A.opacity);b(A.blending);var q,y,M,W,X,Z;if(A instanceof THREE.ParticleBasicMaterial){if(A.map){W=A.map.image;X=W.width>>1;Z=W.height>>1;y=G.scale.x*j;M=G.scale.y*g;A=y*X;q=M*Z;I.set(l.x-A,l.y-q,l.x+A,l.y+q);if($.instersects(I)){i.save();i.translate(l.x,l.y);i.rotate(-G.rotation);i.scale(y,-M);i.translate(-X,-Z);i.drawImage(W,0,0);i.restore()}}}else if(A instanceof THREE.ParticleCircleMaterial){if(U){R.r=
-aa.r+na.r+oa.r;R.g=aa.g+na.g+oa.g;R.b=aa.b+na.b+oa.b;x.r=A.color.r*R.r;x.g=A.color.g*R.g;x.b=A.color.b*R.b;x.updateStyleString()}else x.__styleString=A.color.__styleString;A=G.scale.x*j;q=G.scale.y*g;I.set(l.x-A,l.y-q,l.x+A,l.y+q);if($.instersects(I)){y=x.__styleString;if(u!=y)i.fillStyle=u=y;i.save();i.translate(l.x,l.y);i.rotate(-G.rotation);i.scale(A,q);i.beginPath();i.arc(0,0,1,0,La,!0);i.closePath();i.fill();i.restore()}}}}function Oa(l,G,A,q){if(q.opacity!=0){a(q.opacity);b(q.blending);i.beginPath();
-i.moveTo(l.positionScreen.x,l.positionScreen.y);i.lineTo(G.positionScreen.x,G.positionScreen.y);i.closePath();if(q instanceof THREE.LineBasicMaterial){x.__styleString=q.color.__styleString;l=q.linewidth;if(r!=l)i.lineWidth=r=l;l=x.__styleString;if(t!=l)i.strokeStyle=t=l;i.stroke();I.inflate(q.linewidth*2)}}}function Ha(l,G,A,q,y,M){if(y.opacity!=0){a(y.opacity);b(y.blending);J=l.positionScreen.x;F=l.positionScreen.y;N=G.positionScreen.x;B=G.positionScreen.y;z=A.positionScreen.x;K=A.positionScreen.y;
-i.beginPath();i.moveTo(J,F);i.lineTo(N,B);i.lineTo(z,K);i.lineTo(J,F);i.closePath();if(y instanceof THREE.MeshBasicMaterial)if(y.map)y.map.mapping instanceof THREE.UVMapping&&ua(J,F,N,B,z,K,y.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);else if(y.env_map){if(y.env_map.mapping instanceof THREE.SphericalReflectionMapping){l=da.globalMatrix;S.copy(q.vertexNormalsWorld[0]);Y=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;H=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[1]);
-ga=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ka=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[2]);la=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ma=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;ua(J,F,N,B,z,K,y.env_map.image,Y,H,ga,ka,la,ma)}}else y.wireframe?za(y.color.__styleString,y.wireframe_linewidth):Aa(y.color.__styleString);else if(y instanceof THREE.MeshLambertMaterial){if(y.map&&!y.wireframe){y.map.mapping instanceof THREE.UVMapping&&ua(J,F,N,B,z,K,y.map.image,q.uvs[0].u,q.uvs[0].v,
-q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);b(THREE.SubtractiveBlending)}if(U)if(!y.wireframe&&y.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==3){L.r=C.r=w.r=aa.r;L.g=C.g=w.g=aa.g;L.b=C.b=w.b=aa.b;ya(M,q.v1.positionWorld,q.vertexNormalsWorld[0],L);ya(M,q.v2.positionWorld,q.vertexNormalsWorld[1],C);ya(M,q.v3.positionWorld,q.vertexNormalsWorld[2],w);s.r=(C.r+w.r)*0.5;s.g=(C.g+w.g)*0.5;s.b=(C.b+w.b)*0.5;P=Ia(L,C,w,s);ua(J,F,N,B,z,K,P,0,0,1,0,0,1)}else{R.r=aa.r;R.g=aa.g;R.b=aa.b;ya(M,q.centroidWorld,
+M=A.dot(S)*X;if(M>0){q.r+=W.r*M;q.g+=W.g*M;q.b+=W.b*M}}}}function Na(l,G,A){if(A.opacity!=0){a(A.opacity);b(A.blending);var q,y,M,W,X,Z;if(A instanceof THREE.ParticleBasicMaterial){if(A.map){W=A.map.image;X=W.width>>1;Z=W.height>>1;y=G.scale.x*j;M=G.scale.y*g;A=y*X;q=M*Z;H.set(l.x-A,l.y-q,l.x+A,l.y+q);if($.instersects(H)){i.save();i.translate(l.x,l.y);i.rotate(-G.rotation);i.scale(y,-M);i.translate(-X,-Z);i.drawImage(W,0,0);i.restore()}}}else if(A instanceof THREE.ParticleCircleMaterial){if(U){R.r=
+aa.r+na.r+oa.r;R.g=aa.g+na.g+oa.g;R.b=aa.b+na.b+oa.b;x.r=A.color.r*R.r;x.g=A.color.g*R.g;x.b=A.color.b*R.b;x.updateStyleString()}else x.__styleString=A.color.__styleString;A=G.scale.x*j;q=G.scale.y*g;H.set(l.x-A,l.y-q,l.x+A,l.y+q);if($.instersects(H)){y=x.__styleString;if(u!=y)i.fillStyle=u=y;i.save();i.translate(l.x,l.y);i.rotate(-G.rotation);i.scale(A,q);i.beginPath();i.arc(0,0,1,0,La,!0);i.closePath();i.fill();i.restore()}}}}function Oa(l,G,A,q){if(q.opacity!=0){a(q.opacity);b(q.blending);i.beginPath();
+i.moveTo(l.positionScreen.x,l.positionScreen.y);i.lineTo(G.positionScreen.x,G.positionScreen.y);i.closePath();if(q instanceof THREE.LineBasicMaterial){x.__styleString=q.color.__styleString;l=q.linewidth;if(r!=l)i.lineWidth=r=l;l=x.__styleString;if(t!=l)i.strokeStyle=t=l;i.stroke();H.inflate(q.linewidth*2)}}}function Ha(l,G,A,q,y,M){if(y.opacity!=0){a(y.opacity);b(y.blending);I=l.positionScreen.x;F=l.positionScreen.y;N=G.positionScreen.x;B=G.positionScreen.y;z=A.positionScreen.x;K=A.positionScreen.y;
+i.beginPath();i.moveTo(I,F);i.lineTo(N,B);i.lineTo(z,K);i.lineTo(I,F);i.closePath();if(y instanceof THREE.MeshBasicMaterial)if(y.map)y.map.mapping instanceof THREE.UVMapping&&ua(I,F,N,B,z,K,y.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);else if(y.env_map){if(y.env_map.mapping instanceof THREE.SphericalReflectionMapping){l=da.globalMatrix;S.copy(q.vertexNormalsWorld[0]);Y=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;J=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[1]);
+ja=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ka=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;S.copy(q.vertexNormalsWorld[2]);la=(S.x*l.n11+S.y*l.n12+S.z*l.n13)*0.5+0.5;ma=-(S.x*l.n21+S.y*l.n22+S.z*l.n23)*0.5+0.5;ua(I,F,N,B,z,K,y.env_map.image,Y,J,ja,ka,la,ma)}}else y.wireframe?za(y.color.__styleString,y.wireframe_linewidth):Aa(y.color.__styleString);else if(y instanceof THREE.MeshLambertMaterial){if(y.map&&!y.wireframe){y.map.mapping instanceof THREE.UVMapping&&ua(I,F,N,B,z,K,y.map.image,q.uvs[0].u,q.uvs[0].v,
+q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);b(THREE.SubtractiveBlending)}if(U)if(!y.wireframe&&y.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==3){L.r=C.r=w.r=aa.r;L.g=C.g=w.g=aa.g;L.b=C.b=w.b=aa.b;ya(M,q.v1.positionWorld,q.vertexNormalsWorld[0],L);ya(M,q.v2.positionWorld,q.vertexNormalsWorld[1],C);ya(M,q.v3.positionWorld,q.vertexNormalsWorld[2],w);s.r=(C.r+w.r)*0.5;s.g=(C.g+w.g)*0.5;s.b=(C.b+w.b)*0.5;P=Ia(L,C,w,s);ua(I,F,N,B,z,K,P,0,0,1,0,0,1)}else{R.r=aa.r;R.g=aa.g;R.b=aa.b;ya(M,q.centroidWorld,
 q.normalWorld,R);x.r=y.color.r*R.r;x.g=y.color.g*R.g;x.b=y.color.b*R.b;x.updateStyleString();y.wireframe?za(x.__styleString,y.wireframe_linewidth):Aa(x.__styleString)}else y.wireframe?za(y.color.__styleString,y.wireframe_linewidth):Aa(y.color.__styleString)}else if(y instanceof THREE.MeshDepthMaterial){O=da.near;v=da.far;L.r=L.g=L.b=1-Da(l.positionScreen.z,O,v);C.r=C.g=C.b=1-Da(G.positionScreen.z,O,v);w.r=w.g=w.b=1-Da(A.positionScreen.z,O,v);s.r=(C.r+w.r)*0.5;s.g=(C.g+w.g)*0.5;s.b=(C.b+w.b)*0.5;P=
-Ia(L,C,w,s);ua(J,F,N,B,z,K,P,0,0,1,0,0,1)}else if(y instanceof THREE.MeshNormalMaterial){x.r=Ea(q.normalWorld.x);x.g=Ea(q.normalWorld.y);x.b=Ea(q.normalWorld.z);x.updateStyleString();y.wireframe?za(x.__styleString,y.wireframe_linewidth):Aa(x.__styleString)}}}function za(l,G){if(t!=l)i.strokeStyle=t=l;if(r!=G)i.lineWidth=r=G;i.stroke();I.inflate(G*2)}function Aa(l){if(u!=l)i.fillStyle=u=l;i.fill()}function ua(l,G,A,q,y,M,W,X,Z,ha,ca,ia,va){var ea,ja;ea=W.width-1;ja=W.height-1;X*=ea;Z*=ja;ha*=ea;ca*=
-ja;ia*=ea;va*=ja;A-=l;q-=G;y-=l;M-=G;ha-=X;ca-=Z;ia-=X;va-=Z;ea=ha*va-ia*ca;if(ea!=0){ja=1/ea;ea=(va*A-ca*y)*ja;ca=(va*q-ca*M)*ja;A=(ha*y-ia*A)*ja;q=(ha*M-ia*q)*ja;l=l-ea*X-A*Z;G=G-ca*X-q*Z;i.save();i.transform(ea,ca,A,q,l,G);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(l,G,A,q){var y=~~(l.r*255),M=~~(l.g*255);l=~~(l.b*255);var W=~~(G.r*255),X=~~(G.g*255);G=~~(G.b*255);var Z=~~(A.r*255),ha=~~(A.g*255);A=~~(A.b*255);var ca=~~(q.r*255),ia=~~(q.g*255);q=~~(q.b*255);ba[0]=y<0?0:y>255?255:y;ba[1]=
-M<0?0:M>255?255:M;ba[2]=l<0?0:l>255?255:l;ba[4]=W<0?0:W>255?255:W;ba[5]=X<0?0:X>255?255:X;ba[6]=G<0?0:G>255?255:G;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ha<0?0:ha>255?255:ha;ba[10]=A<0?0:A>255?255:A;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ia<0?0:ia>255?255:ia;ba[14]=q<0?0:q>255?255:q;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,G,A){l=(l-G)/(A-G);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,G){var A=G.x-l.x,q=G.y-l.y,y=1/Math.sqrt(A*A+q*q);A*=y;q*=y;G.x+=
-A;G.y+=q;l.x-=A;l.y-=q}var Ba,Ja,T,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,g);c=d.projectScene(V,da,this.sortElements);(U=V.lights.length>0)&&Ma(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){T=c[Ba];I.empty();if(T instanceof THREE.RenderableParticle){k=T;k.x*=j;k.y*=g;fa=0;for(qa=T.materials.length;fa<qa;fa++)Na(k,T,T.materials[fa],V)}else if(T instanceof THREE.RenderableLine){k=T.v1;E=T.v2;k.positionScreen.x*=j;k.positionScreen.y*=g;E.positionScreen.x*=j;E.positionScreen.y*=g;
-I.addPoint(k.positionScreen.x,k.positionScreen.y);I.addPoint(E.positionScreen.x,E.positionScreen.y);if($.instersects(I)){fa=0;for(qa=T.materials.length;fa<qa;)Oa(k,E,T,T.materials[fa++],V)}}else if(T instanceof THREE.RenderableFace3){k=T.v1;E=T.v2;D=T.v3;k.positionScreen.x*=j;k.positionScreen.y*=g;E.positionScreen.x*=j;E.positionScreen.y*=g;D.positionScreen.x*=j;D.positionScreen.y*=g;if(T.overdraw){Fa(k.positionScreen,E.positionScreen);Fa(E.positionScreen,D.positionScreen);Fa(D.positionScreen,k.positionScreen)}I.add3Points(k.positionScreen.x,
-k.positionScreen.y,E.positionScreen.x,E.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if($.instersects(I)){fa=0;for(qa=T.meshMaterials.length;fa<qa;){wa=T.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=T.faceMaterials.length;Ga<Ka;)(wa=T.faceMaterials[Ga++])&&Ha(k,E,D,T,wa,V)}else Ha(k,E,D,T,wa,V)}}}Q.addRectangle(I)}i.setTransform(1,0,0,1,0,0)}};THREE.RenderableObject=function(){this.z=this.object=null};
+Ia(L,C,w,s);ua(I,F,N,B,z,K,P,0,0,1,0,0,1)}else if(y instanceof THREE.MeshNormalMaterial){x.r=Ea(q.normalWorld.x);x.g=Ea(q.normalWorld.y);x.b=Ea(q.normalWorld.z);x.updateStyleString();y.wireframe?za(x.__styleString,y.wireframe_linewidth):Aa(x.__styleString)}}}function za(l,G){if(t!=l)i.strokeStyle=t=l;if(r!=G)i.lineWidth=r=G;i.stroke();H.inflate(G*2)}function Aa(l){if(u!=l)i.fillStyle=u=l;i.fill()}function ua(l,G,A,q,y,M,W,X,Z,ga,ca,ha,va){var ea,ia;ea=W.width-1;ia=W.height-1;X*=ea;Z*=ia;ga*=ea;ca*=
+ia;ha*=ea;va*=ia;A-=l;q-=G;y-=l;M-=G;ga-=X;ca-=Z;ha-=X;va-=Z;ea=ga*va-ha*ca;if(ea!=0){ia=1/ea;ea=(va*A-ca*y)*ia;ca=(va*q-ca*M)*ia;A=(ga*y-ha*A)*ia;q=(ga*M-ha*q)*ia;l=l-ea*X-A*Z;G=G-ca*X-q*Z;i.save();i.transform(ea,ca,A,q,l,G);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(l,G,A,q){var y=~~(l.r*255),M=~~(l.g*255);l=~~(l.b*255);var W=~~(G.r*255),X=~~(G.g*255);G=~~(G.b*255);var Z=~~(A.r*255),ga=~~(A.g*255);A=~~(A.b*255);var ca=~~(q.r*255),ha=~~(q.g*255);q=~~(q.b*255);ba[0]=y<0?0:y>255?255:y;ba[1]=
+M<0?0:M>255?255:M;ba[2]=l<0?0:l>255?255:l;ba[4]=W<0?0:W>255?255:W;ba[5]=X<0?0:X>255?255:X;ba[6]=G<0?0:G>255?255:G;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ga<0?0:ga>255?255:ga;ba[10]=A<0?0:A>255?255:A;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ha<0?0:ha>255?255:ha;ba[14]=q<0?0:q>255?255:q;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,G,A){l=(l-G)/(A-G);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,G){var A=G.x-l.x,q=G.y-l.y,y=1/Math.sqrt(A*A+q*q);A*=y;q*=y;G.x+=
+A;G.y+=q;l.x-=A;l.y-=q}var Ba,Ja,T,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,g);c=d.projectScene(V,da,this.sortElements);(U=V.lights.length>0)&&Ma(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){T=c[Ba];H.empty();if(T instanceof THREE.RenderableParticle){k=T;k.x*=j;k.y*=g;fa=0;for(qa=T.materials.length;fa<qa;fa++)Na(k,T,T.materials[fa],V)}else if(T instanceof THREE.RenderableLine){k=T.v1;E=T.v2;k.positionScreen.x*=j;k.positionScreen.y*=g;E.positionScreen.x*=j;E.positionScreen.y*=g;
+H.addPoint(k.positionScreen.x,k.positionScreen.y);H.addPoint(E.positionScreen.x,E.positionScreen.y);if($.instersects(H)){fa=0;for(qa=T.materials.length;fa<qa;)Oa(k,E,T,T.materials[fa++],V)}}else if(T instanceof THREE.RenderableFace3){k=T.v1;E=T.v2;D=T.v3;k.positionScreen.x*=j;k.positionScreen.y*=g;E.positionScreen.x*=j;E.positionScreen.y*=g;D.positionScreen.x*=j;D.positionScreen.y*=g;if(T.overdraw){Fa(k.positionScreen,E.positionScreen);Fa(E.positionScreen,D.positionScreen);Fa(D.positionScreen,k.positionScreen)}H.add3Points(k.positionScreen.x,
+k.positionScreen.y,E.positionScreen.x,E.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if($.instersects(H)){fa=0;for(qa=T.meshMaterials.length;fa<qa;){wa=T.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=T.faceMaterials.length;Ga<Ka;)(wa=T.faceMaterials[Ga++])&&Ha(k,E,D,T,wa,V)}else Ha(k,E,D,T,wa,V)}}}Q.addRectangle(H)}i.setTransform(1,0,0,1,0,0)}};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};

+ 16 - 15
build/custom/ThreeDOM.js

@@ -36,8 +36,8 @@ this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.f
 a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,
 0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),d=1-c,f=a.x,g=a.y,i=a.z,h=d*f,j=d*g;this.set(h*f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,
 j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,d=
-a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;
-a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
+a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;
+a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
 THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};
 THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,n=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*r-j*l*r+j*n*p-i*o*p-h*n*k+i*l*k;b.n12=f*l*r-d*o*r-f*n*p+e*o*p+d*n*k-e*l*k;b.n13=d*j*r-f*h*r+f*i*p-e*j*p-d*i*k+e*h*k;b.n14=f*h*n-d*j*n-f*i*l+e*j*l+d*i*o-e*h*o;b.n21=j*l*q-h*o*q-j*m*p+g*o*p+h*m*k-g*l*k;b.n22=d*o*q-f*l*q+f*m*p-c*o*p-d*m*k+c*l*k;b.n23=f*h*q-d*j*q-f*g*p+c*j*p+d*g*k-c*h*k;
@@ -47,8 +47,9 @@ THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=
 THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
 1;this.visible=!0};
-THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
-if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);
+this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRotation.n12;this.localMatrix.n13=this.matrixRotation.n13;this.localMatrix.n21=this.matrixRotation.n21;this.localMatrix.n22=this.matrixRotation.n22;this.localMatrix.n23=this.matrixRotation.n23;this.localMatrix.n31=this.matrixRotation.n31;this.localMatrix.n32=this.matrixRotation.n32;this.localMatrix.n33=this.matrixRotation.n33;if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=
+Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 THREE.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.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Face3=function(a,b,c,e,d){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=d instanceof Array?d:[d]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 THREE.Face4=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -66,16 +67,16 @@ THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light
 THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
 THREE.Projector=function(){function a(w,u){return u.z-w.z}function b(w,u){var D=0,A=1,E=w.z+w.w,z=u.z+u.w,v=-w.z+w.w,t=-u.z+u.w;if(E>=0&&z>=0&&v>=0&&t>=0)return!0;else if(E<0&&z<0||v<0&&t<0)return!1;else{if(E<0)D=Math.max(D,E/(E-z));else z<0&&(A=Math.min(A,E/(E-z)));if(v<0)D=Math.max(D,v/(v-t));else t<0&&(A=Math.min(A,v/(v-t)));if(A<D)return!1;else{w.lerpSelf(u,D);u.lerpSelf(w,1-A);return!0}}}var c,e,d=[],f,g,i,h=[],j,m,n=[],l,o,q=[],r=new THREE.Vector4,p=new THREE.Vector4,k=new THREE.Matrix4,C=new THREE.Matrix4,
 y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4,J;this.projectObjects=function(w,u,D){u=[];var A,E,z;e=0;E=w.objects;w=0;for(A=E.length;w<A;w++){z=E[w];var v;if(!(v=!z.visible))if(v=z instanceof THREE.Mesh){a:{v=void 0;for(var t=z.globalMatrix,I=-z.geometry.boundingSphere.radius*Math.max(z.scale.x,Math.max(z.scale.y,z.scale.z)),s=0;s<6;s++){v=y[s].x*t.n14+y[s].y*t.n24+y[s].z*t.n34+y[s].w;if(v<=
-I){v=!1;break a}}v=!0}v=!v}if(!v){c=d[e]=d[e]||new THREE.RenderableObject;r.copy(z.position);k.multiplyVector3(r);c.object=z;c.z=r.z;u.push(c);e++}}D&&u.sort(a);return u};this.projectScene=function(w,u,D){var A=[],E=u.zNear,z=u.zFar,v,t,I,s,H,N,x,O,Q,R,S,P,L,B,K,M;i=m=o=0;u.matrixAutoUpdate&&u.update();k.multiply(u.projectionMatrix,u.globalMatrix);y[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);y[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);y[2].set(k.n41+k.n21,k.n42+k.n22,k.n43+
-k.n23,k.n44+k.n24);y[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);y[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);y[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(v=0;v<6;v++){N=y[v];N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z))}w.update(undefined,!1,u);N=this.projectObjects(w,u,!0);w=0;for(v=N.length;w<v;w++){x=N[w].object;if(x.visible){x.matrixAutoUpdate&&x.updateMatrix();O=x.globalMatrix;O.extractRotationMatrix(x.matrixRotation);S=x.matrixRotation;Q=x.materials;
-R=x.overdraw;if(x instanceof THREE.Mesh){P=x.geometry;L=P.vertices;t=0;for(I=L.length;t<I;t++){B=L[t];B.positionWorld.copy(B.position);O.multiplyVector3(B.positionWorld);s=B.positionScreen;s.copy(B.positionWorld);k.multiplyVector4(s);s.x/=s.w;s.y/=s.w;B.__visible=s.z>E&&s.z<z}P=P.faces;t=0;for(I=P.length;t<I;t++){B=P[t];if(B instanceof THREE.Face3){s=L[B.a];H=L[B.b];K=L[B.c];if(s.__visible&&H.__visible&&K.__visible&&(x.doubleSided||x.flipSided!=(K.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-
-s.positionScreen.y)-(K.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);f.v3.positionWorld.copy(K.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);O.multiplyVector3(f.centroidWorld);
-f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);K=B.vertexNormals;J=f.vertexNormalsWorld;s=0;for(H=K.length;s<H;s++){M=J[s]=J[s]||new THREE.Vector3;M.copy(K[s]);S.multiplyVector3(M)}f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(x.geometry.uvs[t]){f.uvs[0]=x.geometry.uvs[t][0];f.uvs[1]=x.geometry.uvs[t][1];f.uvs[2]=x.geometry.uvs[t][2]}A.push(f);i++}}else if(B instanceof THREE.Face4){s=L[B.a];H=L[B.b];K=L[B.c];M=L[B.d];if(s.__visible&&
-H.__visible&&K.__visible&&M.__visible&&(x.doubleSided||x.flipSided!=((M.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-s.positionScreen.y)-(M.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0||(H.positionScreen.x-K.positionScreen.x)*(M.positionScreen.y-K.positionScreen.y)-(H.positionScreen.y-K.positionScreen.y)*(M.positionScreen.x-K.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);
-f.v3.positionWorld.copy(M.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);O.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(x.geometry.uvs[t]){f.uvs[0]=x.geometry.uvs[t][0];
-f.uvs[1]=x.geometry.uvs[t][1];f.uvs[2]=x.geometry.uvs[t][3]}A.push(f);i++;g=h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(H.positionWorld);g.v2.positionWorld.copy(K.positionWorld);g.v3.positionWorld.copy(M.positionWorld);g.v1.positionScreen.copy(H.positionScreen);g.v2.positionScreen.copy(K.positionScreen);g.v3.positionScreen.copy(M.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=
-Q;g.faceMaterials=B.materials;g.overdraw=R;if(x.geometry.uvs[t]){g.uvs[0]=x.geometry.uvs[t][1];g.uvs[1]=x.geometry.uvs[t][2];g.uvs[2]=x.geometry.uvs[t][3]}A.push(g);i++}}}}else if(x instanceof THREE.Line){C.multiply(k,O);L=x.geometry.vertices;B=L[0];B.positionScreen.copy(B.position);C.multiplyVector4(B.positionScreen);t=1;for(I=L.length;t<I;t++){s=L[t];s.positionScreen.copy(s.position);C.multiplyVector4(s.positionScreen);H=L[t-1];F.copy(s.positionScreen);G.copy(H.positionScreen);if(b(F,G)){F.multiplyScalar(1/
-F.w);G.multiplyScalar(1/G.w);j=n[m]=n[m]||new THREE.RenderableLine;j.v1.positionScreen.copy(F);j.v2.positionScreen.copy(G);j.z=Math.max(F.z,G.z);j.materials=x.materials;A.push(j);m++}}}else if(x instanceof THREE.Particle){p.set(x.position.x,x.position.y,x.position.z,1);k.multiplyVector4(p);p.z/=p.w;if(p.z>0&&p.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=p.x/p.w;l.y=p.y/p.w;l.z=p.z;l.rotation=x.rotation.z;l.scale.x=x.scale.x*Math.abs(l.x-(p.x+u.projectionMatrix.n11)/(p.w+u.projectionMatrix.n14));
-l.scale.y=x.scale.y*Math.abs(l.y-(p.y+u.projectionMatrix.n22)/(p.w+u.projectionMatrix.n24));l.materials=x.materials;A.push(l);o++}}}}D&&A.sort(a);return A};this.unprojectVector=function(w,u){var D=THREE.Matrix4.makeInvert(u.globalMatrix);D.multiplySelf(THREE.Matrix4.makeInvert(u.projectionMatrix));D.multiplyVector3(w);return w}};
+I){v=!1;break a}}v=!0}v=!v}if(!v){c=d[e]=d[e]||new THREE.RenderableObject;r.copy(z.position);k.multiplyVector3(r);c.object=z;c.z=r.z;u.push(c);e++}}D&&u.sort(a);return u};this.projectScene=function(w,u,D){var A=[],E=u.zNear,z=u.zFar,v,t,I,s,H,N,x,P,Q,R,S,O,L,B,K,M;i=m=o=0;u.matrixAutoUpdate&&u.update();k.multiply(u.projectionMatrix,u.globalMatrix);y[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);y[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);y[2].set(k.n41+k.n21,k.n42+k.n22,k.n43+
+k.n23,k.n44+k.n24);y[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);y[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);y[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(v=0;v<6;v++){N=y[v];N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z))}w.update(undefined,!1,u);N=this.projectObjects(w,u,!0);w=0;for(v=N.length;w<v;w++){x=N[w].object;if(x.visible){x.matrixAutoUpdate&&x.updateMatrix();P=x.globalMatrix;S=x.matrixRotation;Q=x.materials;R=x.overdraw;if(x instanceof THREE.Mesh){O=
+x.geometry;L=O.vertices;t=0;for(I=L.length;t<I;t++){B=L[t];B.positionWorld.copy(B.position);P.multiplyVector3(B.positionWorld);s=B.positionScreen;s.copy(B.positionWorld);k.multiplyVector4(s);s.x/=s.w;s.y/=s.w;B.__visible=s.z>E&&s.z<z}O=O.faces;t=0;for(I=O.length;t<I;t++){B=O[t];if(B instanceof THREE.Face3){s=L[B.a];H=L[B.b];K=L[B.c];if(s.__visible&&H.__visible&&K.__visible&&(x.doubleSided||x.flipSided!=(K.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-s.positionScreen.y)-(K.positionScreen.y-
+s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);f.v3.positionWorld.copy(K.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);
+k.multiplyVector3(f.centroidScreen);K=B.vertexNormals;J=f.vertexNormalsWorld;s=0;for(H=K.length;s<H;s++){M=J[s]=J[s]||new THREE.Vector3;M.copy(K[s]);S.multiplyVector3(M)}f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(x.geometry.uvs[t]){f.uvs[0]=x.geometry.uvs[t][0];f.uvs[1]=x.geometry.uvs[t][1];f.uvs[2]=x.geometry.uvs[t][2]}A.push(f);i++}}else if(B instanceof THREE.Face4){s=L[B.a];H=L[B.b];K=L[B.c];M=L[B.d];if(s.__visible&&H.__visible&&K.__visible&&M.__visible&&
+(x.doubleSided||x.flipSided!=((M.positionScreen.x-s.positionScreen.x)*(H.positionScreen.y-s.positionScreen.y)-(M.positionScreen.y-s.positionScreen.y)*(H.positionScreen.x-s.positionScreen.x)<0||(H.positionScreen.x-K.positionScreen.x)*(M.positionScreen.y-K.positionScreen.y)-(H.positionScreen.y-K.positionScreen.y)*(M.positionScreen.x-K.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(H.positionWorld);f.v3.positionWorld.copy(M.positionWorld);
+f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(H.positionScreen);f.v3.positionScreen.copy(M.positionScreen);f.normalWorld.copy(B.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(B.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=B.materials;f.overdraw=R;if(x.geometry.uvs[t]){f.uvs[0]=x.geometry.uvs[t][0];f.uvs[1]=x.geometry.uvs[t][1];f.uvs[2]=
+x.geometry.uvs[t][3]}A.push(f);i++;g=h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(H.positionWorld);g.v2.positionWorld.copy(K.positionWorld);g.v3.positionWorld.copy(M.positionWorld);g.v1.positionScreen.copy(H.positionScreen);g.v2.positionScreen.copy(K.positionScreen);g.v3.positionScreen.copy(M.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=Q;g.faceMaterials=B.materials;
+g.overdraw=R;if(x.geometry.uvs[t]){g.uvs[0]=x.geometry.uvs[t][1];g.uvs[1]=x.geometry.uvs[t][2];g.uvs[2]=x.geometry.uvs[t][3]}A.push(g);i++}}}}else if(x instanceof THREE.Line){C.multiply(k,P);L=x.geometry.vertices;B=L[0];B.positionScreen.copy(B.position);C.multiplyVector4(B.positionScreen);t=1;for(I=L.length;t<I;t++){s=L[t];s.positionScreen.copy(s.position);C.multiplyVector4(s.positionScreen);H=L[t-1];F.copy(s.positionScreen);G.copy(H.positionScreen);if(b(F,G)){F.multiplyScalar(1/F.w);G.multiplyScalar(1/
+G.w);j=n[m]=n[m]||new THREE.RenderableLine;j.v1.positionScreen.copy(F);j.v2.positionScreen.copy(G);j.z=Math.max(F.z,G.z);j.materials=x.materials;A.push(j);m++}}}else if(x instanceof THREE.Particle){p.set(x.position.x,x.position.y,x.position.z,1);k.multiplyVector4(p);p.z/=p.w;if(p.z>0&&p.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=p.x/p.w;l.y=p.y/p.w;l.z=p.z;l.rotation=x.rotation.z;l.scale.x=x.scale.x*Math.abs(l.x-(p.x+u.projectionMatrix.n11)/(p.w+u.projectionMatrix.n14));l.scale.y=x.scale.y*
+Math.abs(l.y-(p.y+u.projectionMatrix.n22)/(p.w+u.projectionMatrix.n24));l.materials=x.materials;A.push(l);o++}}}}D&&A.sort(a);return A};this.unprojectVector=function(w,u){var D=THREE.Matrix4.makeInvert(u.globalMatrix);D.multiplySelf(THREE.Matrix4.makeInvert(u.projectionMatrix));D.multiplyVector3(w);return w}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,f;this.domElement=document.createElement("div");this.setSize=function(g,i){c=g;e=i;d=c/2;f=e/2};this.render=function(g,i){var h,j,m,n,l,o,q,r;a=b.projectScene(g,i);h=0;for(j=a.length;h<j;h++){l=a[h];if(l instanceof THREE.RenderableParticle){q=l.x*d+d;r=l.y*f+f;m=0;for(n=l.material.length;m<n;m++){o=l.material[m];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=q+"px";o.style.top=r+"px"}}}}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

+ 34 - 33
build/custom/ThreeSVG.js

@@ -25,19 +25,19 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n
 a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=e.x;this.n22=e.y;this.n23=e.z;this.n24=-e.dot(a);
 this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
-a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,g=a.n23,k=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,u=a.n42,s=a.n43,j=a.n44,I=b.n11,p=b.n12,z=b.n13,D=b.n14,M=b.n21,B=b.n22,w=b.n23,J=b.n24,E=b.n31,K=b.n32,H=b.n33,r=b.n34,x=b.n41,O=b.n42,v=b.n43,L=b.n44;this.n11=c*I+d*M+e*E+f*x;this.n12=c*p+d*B+e*K+f*O;this.n13=c*z+d*w+e*H+f*v;this.n14=c*D+d*J+e*r+f*L;this.n21=h*I+i*M+g*E+k*x;this.n22=h*p+i*B+g*K+k*O;this.n23=h*z+
-i*w+g*H+k*v;this.n24=h*D+i*J+g*r+k*L;this.n31=n*I+m*M+l*E+o*x;this.n32=n*p+m*B+l*K+o*O;this.n33=n*z+m*w+l*H+o*v;this.n34=n*D+m*J+l*r+o*L;this.n41=q*I+u*M+s*E+j*x;this.n42=q*p+u*B+s*K+j*O;this.n43=q*z+u*w+s*H+j*v;this.n44=q*D+u*J+s*r+j*L;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,g=a.n22,k=a.n23,n=a.n24,m=a.n31,l=a.n32,o=a.n33,q=a.n34,u=a.n41,s=a.n42,j=a.n43;a=a.n44;var I=b.n11,p=b.n12,z=b.n13,D=b.n14,M=b.n21,B=b.n22,w=b.n23,J=b.n24,E=b.n31,K=b.n32,H=b.n33,
-r=b.n34,x=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*I+e*M+f*E+h*x;this.n12=d*p+e*B+f*K+h*O;this.n13=d*z+e*w+f*H+h*v;this.n14=d*D+e*J+f*r+h*b;this.n21=i*I+g*M+k*E+n*x;this.n22=i*p+g*B+k*K+n*O;this.n23=i*z+g*w+k*H+n*v;this.n24=i*D+g*J+k*r+n*b;this.n31=m*I+l*M+o*E+q*x;this.n32=m*p+l*B+o*K+q*O;this.n33=m*z+l*w+o*H+q*v;this.n34=m*D+l*J+o*r+q*b;this.n41=u*I+s*M+j*E+a*x;this.n42=u*p+s*B+j*K+a*O;this.n43=u*z+s*w+j*H+a*v;this.n44=u*D+s*J+j*r+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=
-this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,g=this.n24,k=this.n31,n=this.n32,m=this.n33,l=this.n34,o=this.n41,q=this.n42,u=this.n43,s=this.n44,j=a.n11,I=a.n21,p=a.n31,z=a.n41,D=a.n12,M=a.n22,B=a.n32,w=a.n42,J=a.n13,E=a.n23,K=a.n33,H=a.n43,r=a.n14,x=a.n24,O=
-a.n34;a=a.n44;this.n11=b*j+c*I+d*p+e*z;this.n12=b*D+c*M+d*B+e*w;this.n13=b*J+c*E+d*K+e*H;this.n14=b*r+c*x+d*O+e*a;this.n21=f*j+h*I+i*p+g*z;this.n22=f*D+h*M+i*B+g*w;this.n23=f*J+h*E+i*K+g*H;this.n24=f*r+h*x+i*O+g*a;this.n31=k*j+n*I+m*p+l*z;this.n32=k*D+n*M+m*B+l*w;this.n33=k*J+n*E+m*K+l*H;this.n34=k*r+n*x+m*O+l*a;this.n41=o*j+q*I+u*p+s*z;this.n42=o*D+q*M+u*B+s*w;this.n43=o*J+q*E+u*K+s*H;this.n44=o*r+q*x+u*O+s*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
+a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,g=a.n23,k=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,u=a.n42,s=a.n43,j=a.n44,I=b.n11,p=b.n12,z=b.n13,D=b.n14,M=b.n21,A=b.n22,w=b.n23,J=b.n24,E=b.n31,K=b.n32,H=b.n33,r=b.n34,x=b.n41,O=b.n42,v=b.n43,L=b.n44;this.n11=c*I+d*M+e*E+f*x;this.n12=c*p+d*A+e*K+f*O;this.n13=c*z+d*w+e*H+f*v;this.n14=c*D+d*J+e*r+f*L;this.n21=h*I+i*M+g*E+k*x;this.n22=h*p+i*A+g*K+k*O;this.n23=h*z+
+i*w+g*H+k*v;this.n24=h*D+i*J+g*r+k*L;this.n31=n*I+m*M+l*E+o*x;this.n32=n*p+m*A+l*K+o*O;this.n33=n*z+m*w+l*H+o*v;this.n34=n*D+m*J+l*r+o*L;this.n41=q*I+u*M+s*E+j*x;this.n42=q*p+u*A+s*K+j*O;this.n43=q*z+u*w+s*H+j*v;this.n44=q*D+u*J+s*r+j*L;return this},multiplyToArray:function(a,b,c){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,g=a.n22,k=a.n23,n=a.n24,m=a.n31,l=a.n32,o=a.n33,q=a.n34,u=a.n41,s=a.n42,j=a.n43;a=a.n44;var I=b.n11,p=b.n12,z=b.n13,D=b.n14,M=b.n21,A=b.n22,w=b.n23,J=b.n24,E=b.n31,K=b.n32,H=b.n33,
+r=b.n34,x=b.n41,O=b.n42,v=b.n43;b=b.n44;this.n11=d*I+e*M+f*E+h*x;this.n12=d*p+e*A+f*K+h*O;this.n13=d*z+e*w+f*H+h*v;this.n14=d*D+e*J+f*r+h*b;this.n21=i*I+g*M+k*E+n*x;this.n22=i*p+g*A+k*K+n*O;this.n23=i*z+g*w+k*H+n*v;this.n24=i*D+g*J+k*r+n*b;this.n31=m*I+l*M+o*E+q*x;this.n32=m*p+l*A+o*K+q*O;this.n33=m*z+l*w+o*H+q*v;this.n34=m*D+l*J+o*r+q*b;this.n41=u*I+s*M+j*E+a*x;this.n42=u*p+s*A+j*K+a*O;this.n43=u*z+s*w+j*H+a*v;this.n44=u*D+s*J+j*r+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=
+this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,g=this.n24,k=this.n31,n=this.n32,m=this.n33,l=this.n34,o=this.n41,q=this.n42,u=this.n43,s=this.n44,j=a.n11,I=a.n21,p=a.n31,z=a.n41,D=a.n12,M=a.n22,A=a.n32,w=a.n42,J=a.n13,E=a.n23,K=a.n33,H=a.n43,r=a.n14,x=a.n24,O=
+a.n34;a=a.n44;this.n11=b*j+c*I+d*p+e*z;this.n12=b*D+c*M+d*A+e*w;this.n13=b*J+c*E+d*K+e*H;this.n14=b*r+c*x+d*O+e*a;this.n21=f*j+h*I+i*p+g*z;this.n22=f*D+h*M+i*A+g*w;this.n23=f*J+h*E+i*K+g*H;this.n24=f*r+h*x+i*O+g*a;this.n31=k*j+n*I+m*p+l*z;this.n32=k*D+n*M+m*A+l*w;this.n33=k*J+n*E+m*K+l*H;this.n34=k*r+n*x+m*O+l*a;this.n41=o*j+q*I+u*p+s*z;this.n42=o*D+q*M+u*A+s*w;this.n43=o*J+q*E+u*K+s*H;this.n44=o*r+q*x+u*O+s*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
 this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,h=this.n23,i=this.n24,g=this.n31,k=this.n32,n=this.n33,m=this.n34,l=this.n41,o=this.n42,q=this.n43,u=this.n44;return d*h*k*l-c*i*k*l-d*f*n*l+b*i*n*l+c*f*m*l-b*h*m*l-d*h*g*o+c*i*g*o+d*e*n*o-a*i*n*o-c*e*m*o+a*h*m*o+d*f*g*q-b*i*g*q-d*e*k*q+a*i*k*q+b*e*m*
 q-a*f*m*q-c*f*g*u+b*h*g*u+c*e*k*u-a*h*k*u-b*e*n*u+a*f*n*u},transpose:function(){function a(b,c,d){var e=b[c];b[c]=b[d];b[d]=e}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=
 this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;
 a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,
 0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,i=a.z,g=e*f,k=e*h;this.set(g*f+c,g*h-d*i,g*i+d*h,0,g*h+d*i,
 k*h+c,k*i-d*f,0,g*i-d*h,k*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-h*f+b*d;this.n32=h*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=
-a.w,f=b+b,h=c+c,i=d+d;a=b*f;var g=b*h;b*=i;var k=c*h;c*=i;d*=i;f*=e;h*=e;e*=i;this.n11=1-(k+d);this.n12=g-e;this.n13=b+h;this.n21=g+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+k)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;
-a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
+a.w,f=b+b,h=c+c,i=d+d;a=b*f;var g=b*h;b*=i;var k=c*h;c*=i;d*=i;f*=e;h*=e;e*=i;this.n11=1-(k+d);this.n12=g-e;this.n13=b+h;this.n21=g+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+k)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;
+a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
 THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};
 THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,g=a.n23,k=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,u=a.n42,s=a.n43,j=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*o*u-k*l*u+k*m*s-i*o*s-g*m*j+i*l*j;b.n12=f*l*u-e*o*u-f*m*s+d*o*s+e*m*j-d*l*j;b.n13=e*k*u-f*g*u+f*i*s-d*k*s-e*i*j+d*g*j;b.n14=f*g*m-e*k*m-f*i*l+d*k*l+e*i*o-d*g*o;b.n21=k*l*q-g*o*q-k*n*s+h*o*s+g*n*j-h*l*j;b.n22=e*o*q-f*l*q+f*n*s-c*o*s-e*n*j+c*l*j;b.n23=f*g*q-e*k*q-f*h*s+c*k*s+e*h*j-c*g*j;
@@ -47,8 +47,9 @@ THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var h;h=new THREE.Matrix4;h.n11=
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var h,i,g,k;h=new THREE.Matrix4;i=b-a;g=c-d;k=f-e;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/g;h.n23=0;h.n24=-((c+d)/g);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((f+e)/k);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
 1;this.visible=!0};
-THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
-if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
+THREE.Object3D.prototype={update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);
+this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRotation.n12;this.localMatrix.n13=this.matrixRotation.n13;this.localMatrix.n21=this.matrixRotation.n21;this.localMatrix.n22=this.matrixRotation.n22;this.localMatrix.n23=this.matrixRotation.n23;this.localMatrix.n31=this.matrixRotation.n31;this.localMatrix.n32=this.matrixRotation.n32;this.localMatrix.n33=this.matrixRotation.n33;if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=
+Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 THREE.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.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 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.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 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.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -57,10 +58,10 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,h,i=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.normal.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];h=this.vertices[f.c];i.sub(h.position,
 c.position);g.sub(b.position,c.position);i.crossSelf(g)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(r,x,O,v,L,F,A){f=r.vertices[x].position;h=r.vertices[O].position;i=r.vertices[v].position;g=e[L];k=e[F];n=e[A];m=h.x-f.x;l=i.x-f.x;o=h.y-f.y;q=i.y-f.y;
-u=h.z-f.z;s=i.z-f.z;j=k.u-g.u;I=n.u-g.u;p=k.v-g.v;z=n.v-g.v;D=1/(j*z-I*p);w.set((z*m-p*l)*D,(z*o-p*q)*D,(z*u-p*s)*D);J.set((j*l-I*m)*D,(j*q-I*o)*D,(j*s-I*u)*D);M[x].addSelf(w);M[O].addSelf(w);M[v].addSelf(w);B[x].addSelf(J);B[O].addSelf(J);B[v].addSelf(J)}var b,c,d,e,f,h,i,g,k,n,m,l,o,q,u,s,j,I,p,z,D,M=[],B=[],w=new THREE.Vector3,J=new THREE.Vector3,E=new THREE.Vector3,K=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){M[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(r,x,O,v,L,F,B){f=r.vertices[x].position;h=r.vertices[O].position;i=r.vertices[v].position;g=e[L];k=e[F];n=e[B];m=h.x-f.x;l=i.x-f.x;o=h.y-f.y;q=i.y-f.y;
+u=h.z-f.z;s=i.z-f.z;j=k.u-g.u;I=n.u-g.u;p=k.v-g.v;z=n.v-g.v;D=1/(j*z-I*p);w.set((z*m-p*l)*D,(z*o-p*q)*D,(z*u-p*s)*D);J.set((j*l-I*m)*D,(j*q-I*o)*D,(j*s-I*u)*D);M[x].addSelf(w);M[O].addSelf(w);M[v].addSelf(w);A[x].addSelf(J);A[O].addSelf(J);A[v].addSelf(J)}var b,c,d,e,f,h,i,g,k,n,m,l,o,q,u,s,j,I,p,z,D,M=[],A=[],w=new THREE.Vector3,J=new THREE.Vector3,E=new THREE.Vector3,K=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){M[b]=new THREE.Vector3;A[b]=new THREE.Vector3}b=0;
 for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=M[b];E.copy(d);E.subSelf(H.multiplyScalar(H.dot(d))).normalize();K.cross(this.vertices[b].normal,d);d=K.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(E.x,E.y,E.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=M[b];E.copy(d);E.subSelf(H.multiplyScalar(H.dot(d))).normalize();K.cross(this.vertices[b].normal,d);d=K.dot(A[b]);d=d<0?-1:1;this.vertices[b].tangent.set(E.x,E.y,E.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 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}},sortFacesByMaterial:function(){function a(n){var m=[];b=0;for(c=n.length;b<c;b++)n[b]==undefined?m.push("undefined"):m.push(n[b].id);return m.join("_")}var b,c,d,e,f,h,i,g,k={};d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];
 h=f.materials;i=a(h);k[i]==undefined&&(k[i]={hash:i,counter:0});g=k[i].hash+"_"+k[i].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0});f=f instanceof THREE.Face3?3:4;if(this.geometryChunks[g].vertices+f>65535){k[i].counter+=1;g=k[i].hash+"_"+k[i].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0})}this.geometryChunks[g].faces.push(d);this.geometryChunks[g].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+
@@ -107,28 +108,28 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
 THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(B,w){return w.z-B.z}function b(B,w){var J=0,E=1,K=B.z+B.w,H=w.z+w.w,r=-B.z+B.w,x=-w.z+w.w;if(K>=0&&H>=0&&r>=0&&x>=0)return!0;else if(K<0&&H<0||r<0&&x<0)return!1;else{if(K<0)J=Math.max(J,K/(K-H));else H<0&&(E=Math.min(E,K/(K-H)));if(r<0)J=Math.max(J,r/(r-x));else x<0&&(E=Math.min(E,r/(r-x)));if(E<J)return!1;else{B.lerpSelf(w,J);w.lerpSelf(B,1-E);return!0}}}var c,d,e=[],f,h,i,g=[],k,n,m=[],l,o,q=[],u=new THREE.Vector4,s=new THREE.Vector4,j=new THREE.Matrix4,I=new THREE.Matrix4,
-p=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],z=new THREE.Vector4,D=new THREE.Vector4,M;this.projectObjects=function(B,w,J){w=[];var E,K,H;d=0;K=B.objects;B=0;for(E=K.length;B<E;B++){H=K[B];var r;if(!(r=!H.visible))if(r=H instanceof THREE.Mesh){a:{r=void 0;for(var x=H.globalMatrix,O=-H.geometry.boundingSphere.radius*Math.max(H.scale.x,Math.max(H.scale.y,H.scale.z)),v=0;v<6;v++){r=p[v].x*x.n14+p[v].y*x.n24+p[v].z*x.n34+p[v].w;if(r<=
-O){r=!1;break a}}r=!0}r=!r}if(!r){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(H.position);j.multiplyVector3(u);c.object=H;c.z=u.z;w.push(c);d++}}J&&w.sort(a);return w};this.projectScene=function(B,w,J){var E=[],K=w.zNear,H=w.zFar,r,x,O,v,L,F,A,P,R,C,y,N,Q,t,G,S;i=n=o=0;w.matrixAutoUpdate&&w.update();j.multiply(w.projectionMatrix,w.globalMatrix);p[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);p[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);p[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+
-j.n23,j.n44+j.n24);p[3].set(j.n41-j.n21,j.n42-j.n22,j.n43-j.n23,j.n44-j.n24);p[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);p[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);for(r=0;r<6;r++){F=p[r];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}B.update(undefined,!1,w);F=this.projectObjects(B,w,!0);B=0;for(r=F.length;B<r;B++){A=F[B].object;if(A.visible){A.matrixAutoUpdate&&A.updateMatrix();P=A.globalMatrix;P.extractRotationMatrix(A.matrixRotation);y=A.matrixRotation;R=A.materials;
-C=A.overdraw;if(A instanceof THREE.Mesh){N=A.geometry;Q=N.vertices;x=0;for(O=Q.length;x<O;x++){t=Q[x];t.positionWorld.copy(t.position);P.multiplyVector3(t.positionWorld);v=t.positionScreen;v.copy(t.positionWorld);j.multiplyVector4(v);v.x/=v.w;v.y/=v.w;t.__visible=v.z>K&&v.z<H}N=N.faces;x=0;for(O=N.length;x<O;x++){t=N[x];if(t instanceof THREE.Face3){v=Q[t.a];L=Q[t.b];G=Q[t.c];if(v.__visible&&L.__visible&&G.__visible&&(A.doubleSided||A.flipSided!=(G.positionScreen.x-v.positionScreen.x)*(L.positionScreen.y-
-v.positionScreen.y)-(G.positionScreen.y-v.positionScreen.y)*(L.positionScreen.x-v.positionScreen.x)<0)){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(L.positionWorld);f.v3.positionWorld.copy(G.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(G.positionScreen);f.normalWorld.copy(t.normal);y.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);
-f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);G=t.vertexNormals;M=f.vertexNormalsWorld;v=0;for(L=G.length;v<L;v++){S=M[v]=M[v]||new THREE.Vector3;S.copy(G[v]);y.multiplyVector3(S)}f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(A.geometry.uvs[x]){f.uvs[0]=A.geometry.uvs[x][0];f.uvs[1]=A.geometry.uvs[x][1];f.uvs[2]=A.geometry.uvs[x][2]}E.push(f);i++}}else if(t instanceof THREE.Face4){v=Q[t.a];L=Q[t.b];G=Q[t.c];S=Q[t.d];if(v.__visible&&
-L.__visible&&G.__visible&&S.__visible&&(A.doubleSided||A.flipSided!=((S.positionScreen.x-v.positionScreen.x)*(L.positionScreen.y-v.positionScreen.y)-(S.positionScreen.y-v.positionScreen.y)*(L.positionScreen.x-v.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(S.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)*(S.positionScreen.x-G.positionScreen.x)<0))){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(L.positionWorld);
-f.v3.positionWorld.copy(S.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(S.positionScreen);f.normalWorld.copy(t.normal);y.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(A.geometry.uvs[x]){f.uvs[0]=A.geometry.uvs[x][0];
-f.uvs[1]=A.geometry.uvs[x][1];f.uvs[2]=A.geometry.uvs[x][3]}E.push(f);i++;h=g[i]=g[i]||new THREE.RenderableFace3;h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(G.positionWorld);h.v3.positionWorld.copy(S.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(G.positionScreen);h.v3.positionScreen.copy(S.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
-R;h.faceMaterials=t.materials;h.overdraw=C;if(A.geometry.uvs[x]){h.uvs[0]=A.geometry.uvs[x][1];h.uvs[1]=A.geometry.uvs[x][2];h.uvs[2]=A.geometry.uvs[x][3]}E.push(h);i++}}}}else if(A instanceof THREE.Line){I.multiply(j,P);Q=A.geometry.vertices;t=Q[0];t.positionScreen.copy(t.position);I.multiplyVector4(t.positionScreen);x=1;for(O=Q.length;x<O;x++){v=Q[x];v.positionScreen.copy(v.position);I.multiplyVector4(v.positionScreen);L=Q[x-1];z.copy(v.positionScreen);D.copy(L.positionScreen);if(b(z,D)){z.multiplyScalar(1/
-z.w);D.multiplyScalar(1/D.w);k=m[n]=m[n]||new THREE.RenderableLine;k.v1.positionScreen.copy(z);k.v2.positionScreen.copy(D);k.z=Math.max(z.z,D.z);k.materials=A.materials;E.push(k);n++}}}else if(A instanceof THREE.Particle){s.set(A.position.x,A.position.y,A.position.z,1);j.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=s.x/s.w;l.y=s.y/s.w;l.z=s.z;l.rotation=A.rotation.z;l.scale.x=A.scale.x*Math.abs(l.x-(s.x+w.projectionMatrix.n11)/(s.w+w.projectionMatrix.n14));
-l.scale.y=A.scale.y*Math.abs(l.y-(s.y+w.projectionMatrix.n22)/(s.w+w.projectionMatrix.n24));l.materials=A.materials;E.push(l);o++}}}}J&&E.sort(a);return E};this.unprojectVector=function(B,w){var J=THREE.Matrix4.makeInvert(w.globalMatrix);J.multiplySelf(THREE.Matrix4.makeInvert(w.projectionMatrix));J.multiplyVector3(B);return B}};
-THREE.SVGRenderer=function(){function a(F,A,P){var R,C,y,N;R=0;for(C=F.lights.length;R<C;R++){y=F.lights[R];if(y instanceof THREE.DirectionalLight){N=A.normalWorld.dot(y.position)*y.intensity;if(N>0){P.r+=y.color.r*N;P.g+=y.color.g*N;P.b+=y.color.b*N}}else if(y instanceof THREE.PointLight){J.sub(y.position,A.centroidWorld);J.normalize();N=A.normalWorld.dot(J)*y.intensity;if(N>0){P.r+=y.color.r*N;P.g+=y.color.g*N;P.b+=y.color.b*N}}}}function b(F,A,P,R,C,y){r=d(x++);r.setAttribute("d","M "+F.positionScreen.x+
-" "+F.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(I){z.r=D.r;z.g=D.g;z.b=D.b;a(y,R,z);p.r=C.color.r*z.r;p.g=C.color.g*z.g;p.b=C.color.b*z.b;p.updateStyleString()}else p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){w=1-C.__2near/(C.__farPlusNear-R.z*C.__farMinusNear);
-p.setRGB(w,w,w)}else C instanceof THREE.MeshNormalMaterial&&p.setRGB(e(R.normalWorld.x),e(R.normalWorld.y),e(R.normalWorld.z));C.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+C.opacity);i.appendChild(r)}function c(F,A,P,R,C,y,N){r=d(x++);r.setAttribute("d",
-"M "+F.positionScreen.x+" "+F.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(I){z.r=D.r;z.g=D.g;z.b=D.b;a(N,C,z);p.r=y.color.r*z.r;p.g=y.color.g*z.g;p.b=y.color.b*z.b;p.updateStyleString()}else p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){w=
+THREE.Projector=function(){function a(A,w){return w.z-A.z}function b(A,w){var J=0,E=1,K=A.z+A.w,H=w.z+w.w,r=-A.z+A.w,x=-w.z+w.w;if(K>=0&&H>=0&&r>=0&&x>=0)return!0;else if(K<0&&H<0||r<0&&x<0)return!1;else{if(K<0)J=Math.max(J,K/(K-H));else H<0&&(E=Math.min(E,K/(K-H)));if(r<0)J=Math.max(J,r/(r-x));else x<0&&(E=Math.min(E,r/(r-x)));if(E<J)return!1;else{A.lerpSelf(w,J);w.lerpSelf(A,1-E);return!0}}}var c,d,e=[],f,h,i,g=[],k,n,m=[],l,o,q=[],u=new THREE.Vector4,s=new THREE.Vector4,j=new THREE.Matrix4,I=new THREE.Matrix4,
+p=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],z=new THREE.Vector4,D=new THREE.Vector4,M;this.projectObjects=function(A,w,J){w=[];var E,K,H;d=0;K=A.objects;A=0;for(E=K.length;A<E;A++){H=K[A];var r;if(!(r=!H.visible))if(r=H instanceof THREE.Mesh){a:{r=void 0;for(var x=H.globalMatrix,O=-H.geometry.boundingSphere.radius*Math.max(H.scale.x,Math.max(H.scale.y,H.scale.z)),v=0;v<6;v++){r=p[v].x*x.n14+p[v].y*x.n24+p[v].z*x.n34+p[v].w;if(r<=
+O){r=!1;break a}}r=!0}r=!r}if(!r){c=e[d]=e[d]||new THREE.RenderableObject;u.copy(H.position);j.multiplyVector3(u);c.object=H;c.z=u.z;w.push(c);d++}}J&&w.sort(a);return w};this.projectScene=function(A,w,J){var E=[],K=w.zNear,H=w.zFar,r,x,O,v,L,F,B,P,R,C,y,N,Q,t,G,S;i=n=o=0;w.matrixAutoUpdate&&w.update();j.multiply(w.projectionMatrix,w.globalMatrix);p[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);p[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);p[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+
+j.n23,j.n44+j.n24);p[3].set(j.n41-j.n21,j.n42-j.n22,j.n43-j.n23,j.n44-j.n24);p[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);p[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);for(r=0;r<6;r++){F=p[r];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}A.update(undefined,!1,w);F=this.projectObjects(A,w,!0);A=0;for(r=F.length;A<r;A++){B=F[A].object;if(B.visible){B.matrixAutoUpdate&&B.updateMatrix();P=B.globalMatrix;y=B.matrixRotation;R=B.materials;C=B.overdraw;if(B instanceof THREE.Mesh){N=
+B.geometry;Q=N.vertices;x=0;for(O=Q.length;x<O;x++){t=Q[x];t.positionWorld.copy(t.position);P.multiplyVector3(t.positionWorld);v=t.positionScreen;v.copy(t.positionWorld);j.multiplyVector4(v);v.x/=v.w;v.y/=v.w;t.__visible=v.z>K&&v.z<H}N=N.faces;x=0;for(O=N.length;x<O;x++){t=N[x];if(t instanceof THREE.Face3){v=Q[t.a];L=Q[t.b];G=Q[t.c];if(v.__visible&&L.__visible&&G.__visible&&(B.doubleSided||B.flipSided!=(G.positionScreen.x-v.positionScreen.x)*(L.positionScreen.y-v.positionScreen.y)-(G.positionScreen.y-
+v.positionScreen.y)*(L.positionScreen.x-v.positionScreen.x)<0)){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(L.positionWorld);f.v3.positionWorld.copy(G.positionWorld);f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(G.positionScreen);f.normalWorld.copy(t.normal);y.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);
+j.multiplyVector3(f.centroidScreen);G=t.vertexNormals;M=f.vertexNormalsWorld;v=0;for(L=G.length;v<L;v++){S=M[v]=M[v]||new THREE.Vector3;S.copy(G[v]);y.multiplyVector3(S)}f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(B.geometry.uvs[x]){f.uvs[0]=B.geometry.uvs[x][0];f.uvs[1]=B.geometry.uvs[x][1];f.uvs[2]=B.geometry.uvs[x][2]}E.push(f);i++}}else if(t instanceof THREE.Face4){v=Q[t.a];L=Q[t.b];G=Q[t.c];S=Q[t.d];if(v.__visible&&L.__visible&&G.__visible&&S.__visible&&
+(B.doubleSided||B.flipSided!=((S.positionScreen.x-v.positionScreen.x)*(L.positionScreen.y-v.positionScreen.y)-(S.positionScreen.y-v.positionScreen.y)*(L.positionScreen.x-v.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(S.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)*(S.positionScreen.x-G.positionScreen.x)<0))){f=g[i]=g[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(v.positionWorld);f.v2.positionWorld.copy(L.positionWorld);f.v3.positionWorld.copy(S.positionWorld);
+f.v1.positionScreen.copy(v.positionScreen);f.v2.positionScreen.copy(L.positionScreen);f.v3.positionScreen.copy(S.positionScreen);f.normalWorld.copy(t.normal);y.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=t.materials;f.overdraw=C;if(B.geometry.uvs[x]){f.uvs[0]=B.geometry.uvs[x][0];f.uvs[1]=B.geometry.uvs[x][1];f.uvs[2]=
+B.geometry.uvs[x][3]}E.push(f);i++;h=g[i]=g[i]||new THREE.RenderableFace3;h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(G.positionWorld);h.v3.positionWorld.copy(S.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(G.positionScreen);h.v3.positionScreen.copy(S.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=R;h.faceMaterials=t.materials;
+h.overdraw=C;if(B.geometry.uvs[x]){h.uvs[0]=B.geometry.uvs[x][1];h.uvs[1]=B.geometry.uvs[x][2];h.uvs[2]=B.geometry.uvs[x][3]}E.push(h);i++}}}}else if(B instanceof THREE.Line){I.multiply(j,P);Q=B.geometry.vertices;t=Q[0];t.positionScreen.copy(t.position);I.multiplyVector4(t.positionScreen);x=1;for(O=Q.length;x<O;x++){v=Q[x];v.positionScreen.copy(v.position);I.multiplyVector4(v.positionScreen);L=Q[x-1];z.copy(v.positionScreen);D.copy(L.positionScreen);if(b(z,D)){z.multiplyScalar(1/z.w);D.multiplyScalar(1/
+D.w);k=m[n]=m[n]||new THREE.RenderableLine;k.v1.positionScreen.copy(z);k.v2.positionScreen.copy(D);k.z=Math.max(z.z,D.z);k.materials=B.materials;E.push(k);n++}}}else if(B instanceof THREE.Particle){s.set(B.position.x,B.position.y,B.position.z,1);j.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=s.x/s.w;l.y=s.y/s.w;l.z=s.z;l.rotation=B.rotation.z;l.scale.x=B.scale.x*Math.abs(l.x-(s.x+w.projectionMatrix.n11)/(s.w+w.projectionMatrix.n14));l.scale.y=B.scale.y*
+Math.abs(l.y-(s.y+w.projectionMatrix.n22)/(s.w+w.projectionMatrix.n24));l.materials=B.materials;E.push(l);o++}}}}J&&E.sort(a);return E};this.unprojectVector=function(A,w){var J=THREE.Matrix4.makeInvert(w.globalMatrix);J.multiplySelf(THREE.Matrix4.makeInvert(w.projectionMatrix));J.multiplyVector3(A);return A}};
+THREE.SVGRenderer=function(){function a(F,B,P){var R,C,y,N;R=0;for(C=F.lights.length;R<C;R++){y=F.lights[R];if(y instanceof THREE.DirectionalLight){N=B.normalWorld.dot(y.position)*y.intensity;if(N>0){P.r+=y.color.r*N;P.g+=y.color.g*N;P.b+=y.color.b*N}}else if(y instanceof THREE.PointLight){J.sub(y.position,B.centroidWorld);J.normalize();N=B.normalWorld.dot(J)*y.intensity;if(N>0){P.r+=y.color.r*N;P.g+=y.color.g*N;P.b+=y.color.b*N}}}}function b(F,B,P,R,C,y){r=d(x++);r.setAttribute("d","M "+F.positionScreen.x+
+" "+F.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshLambertMaterial)if(I){z.r=D.r;z.g=D.g;z.b=D.b;a(y,R,z);p.r=C.color.r*z.r;p.g=C.color.g*z.g;p.b=C.color.b*z.b;p.updateStyleString()}else p.__styleString=C.color.__styleString;else if(C instanceof THREE.MeshDepthMaterial){w=1-C.__2near/(C.__farPlusNear-R.z*C.__farMinusNear);
+p.setRGB(w,w,w)}else C instanceof THREE.MeshNormalMaterial&&p.setRGB(e(R.normalWorld.x),e(R.normalWorld.y),e(R.normalWorld.z));C.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+C.wireframe_linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframe_linecap+"; stroke-linejoin: "+C.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+C.opacity);i.appendChild(r)}function c(F,B,P,R,C,y,N){r=d(x++);r.setAttribute("d",
+"M "+F.positionScreen.x+" "+F.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(I){z.r=D.r;z.g=D.g;z.b=D.b;a(N,C,z);p.r=y.color.r*z.r;p.g=y.color.g*z.g;p.b=y.color.b*z.b;p.updateStyleString()}else p.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshDepthMaterial){w=
 1-y.__2near/(y.__farPlusNear-C.z*y.__farMinusNear);p.setRGB(w,w,w)}else y instanceof THREE.MeshNormalMaterial&&p.setRGB(e(C.normalWorld.x),e(C.normalWorld.y),e(C.normalWorld.z));y.wireframe?r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):r.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+y.opacity);i.appendChild(r)}
-function d(F){if(E[F]==null){E[F]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&E[F].setAttribute("shape-rendering","crispEdges")}return E[F]}function e(F){return F<0?Math.min((1+F)*0.5,0.5):0.5+Math.min(F*0.5,0.5)}var f=null,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,k,n,m,l,o,q,u,s=new THREE.Rectangle,j=new THREE.Rectangle,I=!1,p=new THREE.Color(16777215),z=new THREE.Color(16777215),D=new THREE.Color(0),M=new THREE.Color(0),B=new THREE.Color(0),
-w,J=new THREE.Vector3,E=[],K=[],H=[],r,x,O,v,L=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(F){switch(F){case "high":L=1;break;case "low":L=0}};this.setSize=function(F,A){g=F;k=A;n=g/2;m=k/2;i.setAttribute("viewBox",-n+" "+-m+" "+g+" "+k);i.setAttribute("width",g);i.setAttribute("height",k);s.set(-n,-m,n,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(F,A){var P,R,C,y,N,Q,t,G;this.autoClear&&
-this.clear();f=h.projectScene(F,A,this.sortElements);v=O=x=0;if(I=F.lights.length>0){t=F.lights;D.setRGB(0,0,0);M.setRGB(0,0,0);B.setRGB(0,0,0);P=0;for(R=t.length;P<R;P++){C=t[P];y=C.color;if(C instanceof THREE.AmbientLight){D.r+=y.r;D.g+=y.g;D.b+=y.b}else if(C instanceof THREE.DirectionalLight){M.r+=y.r;M.g+=y.g;M.b+=y.b}else if(C instanceof THREE.PointLight){B.r+=y.r;B.g+=y.g;B.b+=y.b}}}P=0;for(R=f.length;P<R;P++){t=f[P];j.empty();if(t instanceof THREE.RenderableParticle){l=t;l.x*=n;l.y*=-m;C=0;
-for(y=t.materials.length;C<y;C++)if(G=t.materials[C]){N=l;Q=t;var S=O++;if(K[S]==null){K[S]=document.createElementNS("http://www.w3.org/2000/svg","circle");L==0&&K[S].setAttribute("shape-rendering","crispEdges")}r=K[S];r.setAttribute("cx",N.x);r.setAttribute("cy",N.y);r.setAttribute("r",Q.scale.x*n);if(G instanceof THREE.ParticleCircleMaterial){if(I){z.r=D.r+M.r+B.r;z.g=D.g+M.g+B.g;z.b=D.b+M.b+B.b;p.r=G.color.r*z.r;p.g=G.color.g*z.g;p.b=G.color.b*z.b;p.updateStyleString()}else p=G.color;r.setAttribute("style",
+function d(F){if(E[F]==null){E[F]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&E[F].setAttribute("shape-rendering","crispEdges")}return E[F]}function e(F){return F<0?Math.min((1+F)*0.5,0.5):0.5+Math.min(F*0.5,0.5)}var f=null,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,k,n,m,l,o,q,u,s=new THREE.Rectangle,j=new THREE.Rectangle,I=!1,p=new THREE.Color(16777215),z=new THREE.Color(16777215),D=new THREE.Color(0),M=new THREE.Color(0),A=new THREE.Color(0),
+w,J=new THREE.Vector3,E=[],K=[],H=[],r,x,O,v,L=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(F){switch(F){case "high":L=1;break;case "low":L=0}};this.setSize=function(F,B){g=F;k=B;n=g/2;m=k/2;i.setAttribute("viewBox",-n+" "+-m+" "+g+" "+k);i.setAttribute("width",g);i.setAttribute("height",k);s.set(-n,-m,n,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(F,B){var P,R,C,y,N,Q,t,G;this.autoClear&&
+this.clear();f=h.projectScene(F,B,this.sortElements);v=O=x=0;if(I=F.lights.length>0){t=F.lights;D.setRGB(0,0,0);M.setRGB(0,0,0);A.setRGB(0,0,0);P=0;for(R=t.length;P<R;P++){C=t[P];y=C.color;if(C instanceof THREE.AmbientLight){D.r+=y.r;D.g+=y.g;D.b+=y.b}else if(C instanceof THREE.DirectionalLight){M.r+=y.r;M.g+=y.g;M.b+=y.b}else if(C instanceof THREE.PointLight){A.r+=y.r;A.g+=y.g;A.b+=y.b}}}P=0;for(R=f.length;P<R;P++){t=f[P];j.empty();if(t instanceof THREE.RenderableParticle){l=t;l.x*=n;l.y*=-m;C=0;
+for(y=t.materials.length;C<y;C++)if(G=t.materials[C]){N=l;Q=t;var S=O++;if(K[S]==null){K[S]=document.createElementNS("http://www.w3.org/2000/svg","circle");L==0&&K[S].setAttribute("shape-rendering","crispEdges")}r=K[S];r.setAttribute("cx",N.x);r.setAttribute("cy",N.y);r.setAttribute("r",Q.scale.x*n);if(G instanceof THREE.ParticleCircleMaterial){if(I){z.r=D.r+M.r+A.r;z.g=D.g+M.g+A.g;z.b=D.b+M.b+A.b;p.r=G.color.r*z.r;p.g=G.color.g*z.g;p.b=G.color.b*z.b;p.updateStyleString()}else p=G.color;r.setAttribute("style",
 "fill: "+p.__styleString)}i.appendChild(r)}}else if(t instanceof THREE.RenderableLine){l=t.v1;o=t.v2;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);if(s.instersects(j)){C=0;for(y=t.materials.length;C<y;)if(G=t.materials[C++]){N=l;Q=o;S=v++;if(H[S]==null){H[S]=document.createElementNS("http://www.w3.org/2000/svg","line");L==0&&H[S].setAttribute("shape-rendering",
 "crispEdges")}r=H[S];r.setAttribute("x1",N.positionScreen.x);r.setAttribute("y1",N.positionScreen.y);r.setAttribute("x2",Q.positionScreen.x);r.setAttribute("y2",Q.positionScreen.y);if(G instanceof THREE.LineBasicMaterial){p.__styleString=G.color.__styleString;r.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+G.linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.linecap+"; stroke-linejoin: "+G.linejoin);i.appendChild(r)}}}}else if(t instanceof THREE.RenderableFace3){l=
 t.v1;o=t.v2;q=t.v3;l.positionScreen.x*=n;l.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;q.positionScreen.x*=n;q.positionScreen.y*=-m;j.addPoint(l.positionScreen.x,l.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(q.positionScreen.x,q.positionScreen.y);if(s.instersects(j)){C=0;for(y=t.meshMaterials.length;C<y;){G=t.meshMaterials[C++];if(G instanceof THREE.MeshFaceMaterial){N=0;for(Q=t.faceMaterials.length;N<Q;)(G=t.faceMaterials[N++])&&b(l,o,q,t,

+ 6 - 5
build/custom/ThreeWebGL.js

@@ -36,9 +36,9 @@ this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.
 this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=
 this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,
 0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),g=1-d,j=a.x,k=a.y,o=a.z,i=g*j,s=g*k;this.set(i*j+d,i*k-f*o,i*o+f*k,0,i*k+f*o,s*k+d,s*o-f*j,0,i*o-f*k,s*o+f*j,g*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,f=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var j=Math.cos(f);f=Math.sin(f);var k=a*d,o=c*d;this.n11=g*j;this.n12=-g*f;this.n13=d;this.n21=
-o*j+a*f;this.n22=-o*f+a*j;this.n23=-c*g;this.n31=-k*j+c*f;this.n32=k*f+c*j;this.n33=a*g},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,f=a.z,g=a.w,j=c+c,k=d+d,o=f+f;a=c*j;var i=c*k;c*=o;var s=d*k;d*=o;f*=o;j*=g;k*=g;g*=o;this.n11=1-(s+f);this.n12=i-g;this.n13=c+k;this.n21=i+g;this.n22=1-(a+f);this.n23=d-j;this.n31=c-k;this.n32=d+j;this.n33=1-(a+s)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=c;this.n13*=c;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=
-a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+
-" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};
+o*j+a*f;this.n22=-o*f+a*j;this.n23=-c*g;this.n31=-k*j+c*f;this.n32=k*f+c*j;this.n33=a*g},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,f=a.z,g=a.w,j=c+c,k=d+d,o=f+f;a=c*j;var i=c*k;c*=o;var s=d*k;d*=o;f*=o;j*=g;k*=g;g*=o;this.n11=1-(s+f);this.n12=i-g;this.n13=c+k;this.n21=i+g;this.n22=1-(a+f);this.n23=d-j;this.n31=c-k;this.n32=d+j;this.n33=1-(a+s)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=
+a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+
+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};
 THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
 THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,f=a.n12,g=a.n13,j=a.n14,k=a.n21,o=a.n22,i=a.n23,s=a.n24,w=a.n31,x=a.n32,z=a.n33,A=a.n34,E=a.n41,H=a.n42,K=a.n43,J=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=i*A*H-s*z*H+s*x*K-o*A*K-i*x*J+o*z*J;c.n12=j*z*H-g*A*H-j*x*K+f*A*K+g*x*J-f*z*J;c.n13=g*s*H-j*i*H+j*o*K-f*s*K-g*o*J+f*i*J;c.n14=j*i*x-g*s*x-j*o*z+f*s*z+g*o*A-f*i*A;c.n21=s*z*E-i*A*E-s*w*K+k*A*K+i*w*J-k*z*J;c.n22=g*A*E-j*z*E+j*w*K-d*A*K-g*w*J+d*z*J;c.n23=j*i*E-g*s*E-j*k*K+d*s*K+g*k*J-d*i*J;
 c.n24=g*s*w-j*i*w+j*k*z-d*s*z-g*k*A+d*i*A;c.n31=o*A*E-s*x*E+s*w*H-k*A*H-o*w*J+k*x*J;c.n32=j*x*E-f*A*E-j*w*H+d*A*H+f*w*J-d*x*J;c.n33=g*s*E-j*o*E+j*k*H-d*s*H-f*k*J+d*o*J;c.n34=j*o*w-f*s*w-j*k*x+d*s*x+f*k*A-d*o*A;c.n41=i*x*E-o*z*E-i*w*H+k*z*H+o*w*K-k*x*K;c.n42=f*z*E-g*x*E+g*w*H-d*z*H-f*w*K+d*x*K;c.n43=g*o*E-f*i*E-g*k*H+d*i*H+f*k*K-d*o*K;c.n44=f*i*w-g*o*w+g*k*x-d*i*x-f*k*z+d*o*z;c.multiplyScalar(1/a.determinant());return c};
@@ -47,8 +47,9 @@ THREE.Matrix4.makeFrustum=function(a,c,d,f,g,j){var k;k=new THREE.Matrix4;k.n11=
 THREE.Matrix4.makeOrtho=function(a,c,d,f,g,j){var k,o,i,s;k=new THREE.Matrix4;o=c-a;i=d-f;s=j-g;k.n11=2/o;k.n12=0;k.n13=0;k.n14=-((c+a)/o);k.n21=0;k.n22=2/i;k.n23=0;k.n24=-((d+f)/i);k.n31=0;k.n32=0;k.n33=-2/s;k.n34=-((j+g)/s);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
 1;this.visible=!0};
-THREE.Object3D.prototype={update:function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.globalMatrix,c,d)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
-if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){this.children.splice(c,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
+THREE.Object3D.prototype={update:function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.globalMatrix,c,d)}},updateMatrix:function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.matrixRotation.setRotationFromQuaternion(this.quaternion):this.matrixRotation.setRotationFromEuler(this.rotation);
+this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRotation.n12;this.localMatrix.n13=this.matrixRotation.n13;this.localMatrix.n21=this.matrixRotation.n21;this.localMatrix.n22=this.matrixRotation.n22;this.localMatrix.n23=this.matrixRotation.n23;this.localMatrix.n31=this.matrixRotation.n31;this.localMatrix.n32=this.matrixRotation.n32;this.localMatrix.n33=this.matrixRotation.n33;if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=
+Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){this.children.splice(c,1);a.parent=undefined}}};THREE.Object3DCounter={value:0};
 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.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Face3=function(a,c,d,f,g){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 THREE.Face4=function(a,c,d,f,g,j){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};

+ 23 - 7
examples/canvas_sandbox.html

@@ -25,19 +25,13 @@
 		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
 		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
 		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
+		<script type="text/javascript" src="../src/core/Object3D.js"></script>
 		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
 		<script type="text/javascript" src="../src/core/Vertex.js"></script>
 		<script type="text/javascript" src="../src/core/Face3.js"></script>
 		<script type="text/javascript" src="../src/core/Face4.js"></script>
 		<script type="text/javascript" src="../src/core/UV.js"></script>
 		<script type="text/javascript" src="../src/core/Geometry.js"></script>
-		<script type="text/javascript" src="../src/objects/Object3D.js"></script>
-		<script type="text/javascript" src="../src/objects/Particle.js"></script>
-		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
-		<script type="text/javascript" src="../src/objects/Line.js"></script>
-		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Bone.js"></script>
-		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
 		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
 		<script type="text/javascript" src="../src/animation/Animation.js"></script>
 		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
@@ -67,6 +61,14 @@
 		<script type="text/javascript" src="../src/materials/mappings/SphericalReflectionMapping.js"></script>
 		<script type="text/javascript" src="../src/materials/mappings/SphericalRefractionMapping.js"></script>
 		<script type="text/javascript" src="../src/materials/mappings/UVMapping.js"></script>
+		<script type="text/javascript" src="../src/objects/Particle.js"></script>
+		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
+		<script type="text/javascript" src="../src/objects/Line.js"></script>
+		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Bone.js"></script>
+		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
+		<script type="text/javascript" src="../src/objects/Sound3D.js"></script>
 		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
 		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
 		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
@@ -75,10 +77,24 @@
 		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
+		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Cube.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Cylinder.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Plane.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Sphere.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Torus.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Icosahedron.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/LathedObject.js"></script>
+		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
+		<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
 
 		<script type="text/javascript" src="../src/extras/primitives/Sphere.js"></script>
 		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>

+ 4 - 3
src/core/Matrix4.js

@@ -565,9 +565,10 @@ THREE.Matrix4.prototype = {
 
 		var x = vec3.x, y = vec3.y, z = vec3.z;
 
-		this.n11 *= x; this.n12 *= x; this.n13 *= x;
-		this.n21 *= y; this.n22 *= y; this.n23 *= y;
-		this.n31 *= z; this.n32 *= z; this.n33 *= z;
+		this.n11 *= x; this.n12 *= y; this.n13 *= z;
+		this.n21 *= x; this.n22 *= y; this.n23 *= z;
+		this.n31 *= x; this.n32 *= y; this.n33 *= z;
+		this.n41 *= x; this.n42 *= y; this.n43 *= z;
 
 		return this;
 

+ 14 - 2
src/core/Object3D.js

@@ -87,14 +87,26 @@ THREE.Object3D.prototype = {
 
 		if ( this.useQuaternion )  {
 
-			this.localMatrix.setRotationFromQuaternion( this.quaternion );
+			this.matrixRotation.setRotationFromQuaternion( this.quaternion );
 
 		} else {
 
-			this.localMatrix.setRotationFromEuler( this.rotation );
+			this.matrixRotation.setRotationFromEuler( this.rotation );
 
 		}
 
+		this.localMatrix.n11 = this.matrixRotation.n11;
+		this.localMatrix.n12 = this.matrixRotation.n12;
+		this.localMatrix.n13 = this.matrixRotation.n13;
+
+		this.localMatrix.n21 = this.matrixRotation.n21;
+		this.localMatrix.n22 = this.matrixRotation.n22;
+		this.localMatrix.n23 = this.matrixRotation.n23;
+
+		this.localMatrix.n31 = this.matrixRotation.n31;
+		this.localMatrix.n32 = this.matrixRotation.n32;
+		this.localMatrix.n33 = this.matrixRotation.n33;
+
 		if ( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) {
 
 			this.localMatrix.scale( this.scale );

+ 1 - 2
src/renderers/Projector.js

@@ -15,7 +15,7 @@ THREE.Projector = function() {
 	_vector4 = new THREE.Vector4(),
 	_projScreenMatrix = new THREE.Matrix4(),
 	_projScreenObjectMatrix = new THREE.Matrix4(),
-	
+
 	_frustum = [
 		new THREE.Vector4(),
 		new THREE.Vector4(),
@@ -98,7 +98,6 @@ THREE.Projector = function() {
 			object.matrixAutoUpdate && object.updateMatrix();
 
 			objectMatrix = object.globalMatrix;
-			objectMatrix.extractRotationMatrix( object.matrixRotation );
 			objectMatrixRotation = object.matrixRotation;
 
 			objectMaterials = object.materials;