Browse Source

Reverted Camera::FOV,zNear,zFar to Camera::fov,near,far.
Most of the examples or working again as usual. Only `webgl_scene_test.html` and `webgl_ribbons.html` left.

Mr.doob 14 years ago
parent
commit
45ec0f329b

File diff suppressed because it is too large
+ 14 - 14
build/Three.js


+ 52 - 52
build/custom/ThreeCanvas.js

@@ -1,6 +1,6 @@
 // ThreeCanvas.js r32 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,h,j,g;if(c==0)d=e=f=0;else{h=Math.floor(a*6);j=a*6-h;a=c*(1-b);g=c*(1-b*j);b=c*(1-b*(1-j));switch(h){case 1:d=g;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=g;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=g;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,f,e,h,j,g;if(c==0)d=f=e=0;else{h=Math.floor(a*6);j=a*6-h;a=c*(1-b);g=c*(1-b*j);b=c*(1-b*(1-j));switch(h){case 1:d=g;f=c;e=a;break;case 2:d=a;f=c;e=b;break;case 3:d=a;f=g;e=c;break;case 4:d=b;f=a;e=c;break;case 5:d=c;f=a;e=g;break;case 6:case 0:d=c;f=b;e=a}}this.r=d;this.g=f;this.b=e;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
@@ -13,66 +13,66 @@ 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 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()};
-this.add3Points=function(g,i,m,n,o,p){if(j){j=!1;b=g<m?g<o?g:o:m<o?m:o;c=i<n?i<p?i:p:n<p?n:p;d=g>m?g>o?g:o:m>o?m:o;e=i>n?i>p?i:p:n>p?n:p}else{b=g<m?g<o?g<b?g:b:o<b?o:b:m<o?m<b?m:b:o<b?o:b;c=i<n?i<p?i<c?i:c:p<c?p:c:n<p?n<c?n:c:p<c?p:c;d=g>m?g>o?g>d?g:d:o>d?o:d:m>o?m>d?m:d:o>d?o:d;e=i>n?i>p?i>e?i:e:p>e?p:e:n>p?n>e?n:e:p>e?p:e}a()};this.addRectangle=function(g){if(j){j=!1;b=g.getLeft();c=g.getTop();d=g.getRight();e=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();d=d>g.getRight()?
-d:g.getRight();e=e>g.getBottom()?e:g.getBottom()}a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.instersects=function(g){return Math.min(d,g.getRight())-Math.max(b,g.getLeft())>=0&&Math.min(e,g.getBottom())-Math.max(c,g.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j};this.toString=function(){return"THREE.Rectangle ( left: "+
-b+", right: "+d+", top: "+c+", bottom: "+e+", width: "+f+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,h,j,g,i,m,n,o,p,t,u){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=e||0;this.n22=f||1;this.n23=h||0;this.n24=j||0;this.n31=g||0;this.n32=i||0;this.n33=m||1;this.n34=n||0;this.n41=o||0;this.n42=p||0;this.n43=t||0;this.n44=u||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,d,e,f,h,j,g,i,m,n,o,p,t,u){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=h;this.n24=j;this.n31=g;this.n32=i;this.n33=m;this.n34=n;this.n41=o;this.n42=p;this.n43=t;this.n44=u;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
-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,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=
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(e,h){return e.distance-h.distance});return f},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,f,e,h,j,g,i,m,n,
+o,p=a.geometry,t=p.vertices,u=[];c=0;for(d=p.faces.length;c<d;c++){f=p.faces[c];n=this.origin.clone();o=this.direction.clone();g=a.globalMatrix;g.extractRotationMatrix(a.matrixRotation);e=g.multiplyVector3(t[f.a].position.clone());h=g.multiplyVector3(t[f.b].position.clone());j=g.multiplyVector3(t[f.c].position.clone());g=f instanceof THREE.Face4?g.multiplyVector3(t[f.d].position.clone()):null;i=a.matrixRotation.multiplyVector3(f.normal.clone());m=o.dot(i);if(m<0){i=i.dot((new THREE.Vector3).sub(e,
+n))/m;n=n.addSelf(o.multiplyScalar(i));if(f instanceof THREE.Face3){if(b(n,e,h,j)){f={distance:this.origin.distanceTo(n),point:n,face:f,object:a};u.push(f)}}else if(f instanceof THREE.Face4&&(b(n,e,h,g)||b(n,h,j,g))){f={distance:this.origin.distanceTo(n),point:n,face:f,object:a};u.push(f)}}}return u}};
+THREE.Rectangle=function(){function a(){e=d-b;h=f-c}var b,c,d,f,e,h,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,i,m,n){j=!1;b=g;c=i;d=m;f=n;a()};this.addPoint=function(g,i){if(j){j=!1;b=g;c=i;d=g;f=i}else{b=b<g?b:g;c=c<i?c:i;d=d>g?d:g;f=f>i?f:i}a()};
+this.add3Points=function(g,i,m,n,o,p){if(j){j=!1;b=g<m?g<o?g:o:m<o?m:o;c=i<n?i<p?i:p:n<p?n:p;d=g>m?g>o?g:o:m>o?m:o;f=i>n?i>p?i:p:n>p?n:p}else{b=g<m?g<o?g<b?g:b:o<b?o:b:m<o?m<b?m:b:o<b?o:b;c=i<n?i<p?i<c?i:c:p<c?p:c:n<p?n<c?n:c:p<c?p:c;d=g>m?g>o?g>d?g:d:o>d?o:d:m>o?m>d?m:d:o>d?o:d;f=i>n?i>p?i>f?i:f:p>f?p:f:n>p?n>f?n:f:p>f?p:f}a()};this.addRectangle=function(g){if(j){j=!1;b=g.getLeft();c=g.getTop();d=g.getRight();f=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();d=d>g.getRight()?
+d:g.getRight();f=f>g.getBottom()?f:g.getBottom()}a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.instersects=function(g){return Math.min(d,g.getRight())-Math.max(b,g.getLeft())>=0&&Math.min(f,g.getBottom())-Math.max(c,g.getTop())>=0};this.empty=function(){j=!0;f=d=c=b=0;a()};this.isEmpty=function(){return j};this.toString=function(){return"THREE.Rectangle ( left: "+
+b+", right: "+d+", top: "+c+", bottom: "+f+", width: "+e+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
+THREE.Matrix4=function(a,b,c,d,f,e,h,j,g,i,m,n,o,p,t,u){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=e||1;this.n23=h||0;this.n24=j||0;this.n31=g||0;this.n32=i||0;this.n33=m||1;this.n34=n||0;this.n41=o||0;this.n42=p||0;this.n43=t||0;this.n44=u||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,d,f,e,h,j,g,i,m,n,o,p,t,u){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=h;this.n24=j;this.n31=g;this.n32=i;this.n33=m;this.n34=n;this.n41=o;this.n42=p;this.n43=t;this.n44=u;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+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,f=THREE.Matrix4.__tmpVec2,e=THREE.Matrix4.__tmpVec3;e.sub(a,b).normalize();d.cross(c,e).normalize();f.cross(e,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
+this.n31=e.x;this.n32=e.y;this.n33=e.z;this.n34=-e.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,f=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)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;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,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;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,f=a.n13,e=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+f*x+e*s;this.n12=c*D+d*B+f*L+e*O;this.n13=c*I+d*z+f*C+e*v;this.n14=c*F+d*K+f*w+e*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,f=a.n12,e=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+f*N+e*x+h*s;this.n12=d*D+f*B+e*L+h*O;this.n13=d*I+f*z+e*C+h*v;this.n14=d*F+f*K+e*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,f=this.n14,e=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+f*I;this.n12=b*F+c*N+d*B+f*z;this.n13=b*K+c*x+d*L+f*C;this.n14=b*w+c*s+d*O+f*a;this.n21=e*k+h*E+j*D+g*I;this.n22=e*F+h*N+j*B+g*z;this.n23=e*K+h*x+j*L+g*C;this.n24=e*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,f=this.n21,e=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*e*m*o+b*j*m*o+c*e*n*o-b*h*n*o-d*h*g*p+c*j*g*p+d*f*m*p-a*j*m*p-c*f*n*p+a*h*n*p+d*e*g*t-b*j*g*t-d*f*i*t+a*j*i*t+b*f*n*
+t-a*e*n*t-c*e*g*u+b*h*g*u+c*f*i*u-a*h*i*u-b*f*m*u+a*e*m*u},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}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*=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;
+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,e=a.x,h=a.y,j=a.z,g=f*e,i=f*h;this.set(g*e+c,g*h-d*j,g*j+d*h,0,g*h+d*j,
+i*h+c,i*j-d*e,0,g*j-d*h,i*j+d*e,f*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 f=Math.cos(c);c=Math.sin(c);var e=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=f*e;this.n12=-f*d;this.n13=c;this.n21=j*e+a*d;this.n22=-j*d+a*e;this.n23=-b*f;this.n31=-h*e+b*d;this.n32=h*d+b*e;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=
+a.w,e=b+b,h=c+c,j=d+d;a=b*e;var g=b*h;b*=j;var i=c*h;c*=j;d*=j;e*=f;h*=f;f*=j;this.n11=1-(i+d);this.n12=g-f;this.n13=b+h;this.n21=g+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-h;this.n32=c+e;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;
-b.n24=e*i*m-f*g*m+f*h*o-c*i*o-e*h*p+c*g*p;b.n31=j*p*t-i*n*t+i*m*u-h*p*u-j*m*k+h*n*k;b.n32=f*n*t-d*p*t-f*m*u+c*p*u+d*m*k-c*n*k;b.n33=e*i*t-f*j*t+f*h*u-c*i*u-d*h*k+c*j*k;b.n34=f*j*m-d*i*m-f*h*n+c*i*n+d*h*p-c*j*p;b.n41=g*n*t-j*o*t-g*m*u+h*o*u+j*m*r-h*n*r;b.n42=d*o*t-e*n*t+e*m*u-c*o*u-d*m*r+c*n*r;b.n43=e*j*t-d*g*t-e*h*u+c*g*u+d*h*r-c*j*r;b.n44=d*g*m-e*j*m+e*h*n-c*g*n-d*h*o+c*j*o;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*h;c[4]=a*j;c[5]=a*g;c[6]=a*i;c[7]=a*m;c[8]=a*n;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var h;h=new THREE.Matrix4;h.n11=2*e/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*e/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+e)/(f-e);h.n34=-2*f*e/(f-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-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.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=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=e*o*u-f*p*u-e*n*r+d*p*r+f*n*k-d*o*k;b.n13=f*i*u-e*g*u+e*j*r-d*i*r-f*j*k+d*g*k;b.n14=e*g*n-f*i*n-e*j*o+d*i*o+f*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=f*p*t-e*o*t+e*m*r-c*p*r-f*m*k+c*o*k;b.n23=e*g*t-f*i*t-e*h*r+c*i*r+f*h*k-c*g*k;
+b.n24=f*i*m-e*g*m+e*h*o-c*i*o-f*h*p+c*g*p;b.n31=j*p*t-i*n*t+i*m*u-h*p*u-j*m*k+h*n*k;b.n32=e*n*t-d*p*t-e*m*u+c*p*u+d*m*k-c*n*k;b.n33=f*i*t-e*j*t+e*h*u-c*i*u-d*h*k+c*j*k;b.n34=e*j*m-d*i*m-e*h*n+c*i*n+d*h*p-c*j*p;b.n41=g*n*t-j*o*t-g*m*u+h*o*u+j*m*r-h*n*r;b.n42=d*o*t-f*n*t+f*m*u-c*o*u-d*m*r+c*n*r;b.n43=f*j*t-d*g*t-f*h*u+c*g*u+d*h*r-c*j*r;b.n44=d*g*m-f*j*m+f*h*n-c*g*n-d*h*o+c*j*o;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*h;c[4]=a*j;c[5]=a*g;c[6]=a*i;c[7]=a*m;c[8]=a*n;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(e+f)/(e-f);h.n34=-2*e*f/(e-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var h,j,g,i;h=new THREE.Matrix4;j=b-a;g=c-d;i=e-f;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=-((e+f)/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.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};
+THREE.Face3=function(a,b,c,d,f){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=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=e instanceof Array?e:[e]};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};
 THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-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,
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,e,h,j=new THREE.Vector3,g=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){e=this.vertices[d];e.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){j.set(0,0,0);b=0;for(c=e.normal.length;b<c;b++)j.addSelf(e.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[e.a];c=this.vertices[e.b];h=this.vertices[e.c];j.sub(h.position,
+c.position);g.sub(b.position,c.position);j.crossSelf(g)}j.isZero()||j.normalize();e.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,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]);
+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){e=w.vertices[s].position;h=w.vertices[O].position;j=w.vertices[v].position;g=f[P];i=f[Y];m=f[J];n=h.x-e.x;o=j.x-e.x;p=h.y-e.y;t=j.y-e.y;
+u=h.z-e.z;r=j.z-e.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,f,e,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];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++){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>
-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(m){var n=[];b=0;for(c=m.length;b<c;b++)m[b]==undefined?n.push("undefined"):n.push(m[b].id);return n.join("_")}var b,c,d,e,f,h,j,g,i={};d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];
-h=f.materials;j=a(h);i[j]==undefined&&(i[j]={hash:j,counter:0});g=i[j].hash+"_"+i[j].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){i[j].counter+=1;g=i[j].hash+"_"+i[j].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: "+
+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(m){var n=[];b=0;for(c=m.length;b<c;b++)m[b]==undefined?n.push("undefined"):n.push(m[b].id);return n.join("_")}var b,c,d,f,e,h,j,g,i={};d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];
+h=e.materials;j=a(h);i[j]==undefined&&(i[j]={hash:j,counter:0});g=i[j].hash+"_"+i[j].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0});e=e instanceof THREE.Face3?3:4;if(this.geometryChunks[g].vertices+e>65535){i[j].counter+=1;g=i[j].hash+"_"+i[j].counter;this.geometryChunks[g]==undefined&&(this.geometryChunks[g]={faces:[],materials:h,vertices:0})}this.geometryChunks[g].faces.push(d);this.geometryChunks[g].vertices+=e}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,c,d,e,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h,j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);if(j)this.tmpVec.y=
-0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h,j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);if(j)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
+THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(e,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(e);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(e,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(e);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,e=this.inverseMatrix,f=a.boundRadius*a.boundRadiusScale,h=e.n31*b+e.n32*c+e.n33*d+e.n34;if(h-f>-this.zNear)return!1;if(h+f<-this.zFar)return!1;h-=f;var j=this.projectionMatrix,g=1/(j.n43*h),i=g*this.screenCenterX,m=(e.n11*b+e.n12*c+e.n13*d+e.n14)*j.n11*i;f=j.n11*f*i;if(m+f<-this.screenCenterX)return!1;if(m-f>this.screenCenterX)return!1;b=(e.n21*b+e.n22*c+e.n23*d+e.n24)*j.n22*g*this.screenCenterY;
-if(b+f<-this.screenCenterY)return!1;if(b-f>this.screenCenterY)return!1;a.screenPosition.set(m,b,h,f);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,e=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-e>-this.near)return!1;if(h+e<-this.far)return!1;h-=e;var j=this.projectionMatrix,g=1/(j.n43*h),i=g*this.screenCenterX,m=(f.n11*b+f.n12*c+f.n13*d+f.n14)*j.n11*i;e=j.n11*e*i;if(m+e<-this.screenCenterX)return!1;if(m-e>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*j.n22*g*this.screenCenterY;
+if(b+e<-this.screenCenterY)return!1;if(b-e>this.screenCenterY)return!1;a.screenPosition.set(m,b,h,e);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
@@ -102,7 +102,7 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th
 undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=e!==undefined?e:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
+THREE.Texture=function(a,b,c,d,f,e){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=e!==undefined?e:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
 THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.CubeReflectionMapping=function(){};
 THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
@@ -112,22 +112,22 @@ 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,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,
+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,f=[],e,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],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,
+O){w=!1;break a}}w=!0}w=!w}if(!w){c=f[d]=f[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.near,C=z.far,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=
+(U.positionScreen.y-v.positionScreen.y)*(P.positionScreen.x-v.positionScreen.x)<0)){e=g[j]=g[j]||new THREE.RenderableFace3;e.v1.positionWorld.copy(v.positionWorld);e.v2.positionWorld.copy(P.positionWorld);e.v3.positionWorld.copy(U.positionWorld);e.v1.positionScreen.copy(v.positionScreen);e.v2.positionScreen.copy(P.positionScreen);e.v3.positionScreen.copy(U.positionScreen);e.normalWorld.copy(H.normal);ma.multiplyVector3(e.normalWorld);e.centroidWorld.copy(H.centroid);ja.multiplyVector3(e.centroidWorld);
+e.centroidScreen.copy(e.centroidWorld);k.multiplyVector3(e.centroidScreen);U=H.vertexNormals;N=e.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)}e.z=e.centroidScreen.z;e.meshMaterials=ka;e.faceMaterials=H.materials;e.overdraw=la;if(J.geometry.uvs[s]){e.uvs[0]=J.geometry.uvs[s][0];e.uvs[1]=J.geometry.uvs[s][1];e.uvs[2]=J.geometry.uvs[s][2]}x.push(e);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))){e=g[j]=g[j]||new THREE.RenderableFace3;e.v1.positionWorld.copy(v.positionWorld);e.v2.positionWorld.copy(P.positionWorld);
+e.v3.positionWorld.copy(R.positionWorld);e.v1.positionScreen.copy(v.positionScreen);e.v2.positionScreen.copy(P.positionScreen);e.v3.positionScreen.copy(R.positionScreen);e.normalWorld.copy(H.normal);ma.multiplyVector3(e.normalWorld);e.centroidWorld.copy(H.centroid);ja.multiplyVector3(e.centroidWorld);e.centroidScreen.copy(e.centroidWorld);k.multiplyVector3(e.centroidScreen);e.z=e.centroidScreen.z;e.meshMaterials=ka;e.faceMaterials=H.materials;e.overdraw=la;if(J.geometry.uvs[s]){e.uvs[0]=J.geometry.uvs[s][0];
+e.uvs[1]=J.geometry.uvs[s][1];e.uvs[2]=J.geometry.uvs[s][3]}x.push(e);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(e.normalWorld);h.centroidWorld.copy(e.centroidWorld);h.centroidScreen.copy(e.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,
+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,f=document.createElement("canvas"),e,h,j,g,i=f.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=
+ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(V,da){e=V;h=da;j=e/2;g=h/2;f.width=e;f.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;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=

+ 5 - 5
build/custom/ThreeDOM.js

@@ -54,12 +54,12 @@ THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld
 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};
 THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};
-THREE.Camera=function(a,b,c,e,d,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(i)this.tmpVec.y=
-0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(i)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
+THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=d||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(f,g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);if(g)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(f,g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);if(g)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,e=a.globalMatrix.n34,d=this.inverseMatrix,f=a.boundRadius*a.boundRadiusScale,g=d.n31*b+d.n32*c+d.n33*e+d.n34;if(g-f>-this.zNear)return!1;if(g+f<-this.zFar)return!1;g-=f;var i=this.projectionMatrix,h=1/(i.n43*g),j=h*this.screenCenterX,m=(d.n11*b+d.n12*c+d.n13*e+d.n14)*i.n11*j;f=i.n11*f*j;if(m+f<-this.screenCenterX)return!1;if(m-f>this.screenCenterX)return!1;b=(d.n21*b+d.n22*c+d.n23*e+d.n24)*i.n22*h*this.screenCenterY;
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,e=a.globalMatrix.n34,d=this.inverseMatrix,f=a.boundRadius*a.boundRadiusScale,g=d.n31*b+d.n32*c+d.n33*e+d.n34;if(g-f>-this.near)return!1;if(g+f<-this.far)return!1;g-=f;var i=this.projectionMatrix,h=1/(i.n43*g),j=h*this.screenCenterX,m=(d.n11*b+d.n12*c+d.n13*e+d.n14)*i.n11*j;f=i.n11*f*j;if(m+f<-this.screenCenterX)return!1;if(m-f>this.screenCenterX)return!1;b=(d.n21*b+d.n22*c+d.n23*e+d.n24)*i.n22*h*this.screenCenterY;
 if(b+f<-this.screenCenterY)return!1;if(b-f>this.screenCenterY)return!1;a.screenPosition.set(m,b,g,f);return!0};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.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)};
@@ -67,7 +67,7 @@ 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,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+
+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.near,z=u.far,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);

File diff suppressed because it is too large
+ 2 - 2
build/custom/ThreeExtras.js


+ 5 - 5
build/custom/ThreeSVG.js

@@ -66,12 +66,12 @@ z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(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: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,c,d,e,f){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);if(i)this.tmpVec.y=
-0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);if(i)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
+THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=e||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(f,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(f,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,e=this.inverseMatrix,f=a.boundRadius*a.boundRadiusScale,h=e.n31*b+e.n32*c+e.n33*d+e.n34;if(h-f>-this.zNear)return!1;if(h+f<-this.zFar)return!1;h-=f;var i=this.projectionMatrix,g=1/(i.n43*h),k=g*this.screenCenterX,n=(e.n11*b+e.n12*c+e.n13*d+e.n14)*i.n11*k;f=i.n11*f*k;if(n+f<-this.screenCenterX)return!1;if(n-f>this.screenCenterX)return!1;b=(e.n21*b+e.n22*c+e.n23*d+e.n24)*i.n22*g*this.screenCenterY;
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,e=this.inverseMatrix,f=a.boundRadius*a.boundRadiusScale,h=e.n31*b+e.n32*c+e.n33*d+e.n34;if(h-f>-this.near)return!1;if(h+f<-this.far)return!1;h-=f;var i=this.projectionMatrix,g=1/(i.n43*h),k=g*this.screenCenterX,n=(e.n11*b+e.n12*c+e.n13*d+e.n14)*i.n11*k;f=i.n11*f*k;if(n+f<-this.screenCenterX)return!1;if(n-f>this.screenCenterX)return!1;b=(e.n21*b+e.n22*c+e.n23*d+e.n24)*i.n22*g*this.screenCenterY;
 if(b+f<-this.screenCenterY)return!1;if(b-f>this.screenCenterY)return!1;a.screenPosition.set(n,b,h,f);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
@@ -110,7 +110,7 @@ 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(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+
+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.near,H=w.far,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);

+ 5 - 5
build/custom/ThreeWebGL.js

@@ -66,12 +66,12 @@ z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(w){var x=[];c=0;for(d=w.length;c<d;c++)w[c]==undefined?x.push("undefined"):x.push(w[c].id);return x.join("_")}var c,d,f,g,j,k,o,i,s={};f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];
 k=j.materials;o=a(k);s[o]==undefined&&(s[o]={hash:o,counter:0});i=s[o].hash+"_"+s[o].counter;this.geometryChunks[i]==undefined&&(this.geometryChunks[i]={faces:[],materials:k,vertices:0});j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[i].vertices+j>65535){s[o].counter+=1;i=s[o].hash+"_"+s[o].counter;this.geometryChunks[i]==undefined&&(this.geometryChunks[i]={faces:[],materials:k,vertices:0})}this.geometryChunks[i].faces.push(f);this.geometryChunks[i].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,c,d,f,g,j){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=c||1;this.zNear=d||0.1;this.zFar=f||2E3;this.screenCenterY=this.screenCenterX=0;this.target=j||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(k,o){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.tmpVec.crossSelf(this.up);if(o)this.tmpVec.y=
-0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(k,o){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);if(o)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
+THREE.Camera=function(a,c,d,f,g){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=f||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(j,k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.tmpVec.crossSelf(this.up);if(k)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(j,k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);if(k)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);c=!0}else{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;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,c,d)};
-THREE.Camera.prototype.frustumContains=function(a){var c=a.globalMatrix.n14,d=a.globalMatrix.n24,f=a.globalMatrix.n34,g=this.inverseMatrix,j=a.boundRadius*a.boundRadiusScale,k=g.n31*c+g.n32*d+g.n33*f+g.n34;if(k-j>-this.zNear)return!1;if(k+j<-this.zFar)return!1;k-=j;var o=this.projectionMatrix,i=1/(o.n43*k),s=i*this.screenCenterX,w=(g.n11*c+g.n12*d+g.n13*f+g.n14)*o.n11*s;j=o.n11*j*s;if(w+j<-this.screenCenterX)return!1;if(w-j>this.screenCenterX)return!1;c=(g.n21*c+g.n22*d+g.n23*f+g.n24)*o.n22*i*this.screenCenterY;
+THREE.Camera.prototype.frustumContains=function(a){var c=a.globalMatrix.n14,d=a.globalMatrix.n24,f=a.globalMatrix.n34,g=this.inverseMatrix,j=a.boundRadius*a.boundRadiusScale,k=g.n31*c+g.n32*d+g.n33*f+g.n34;if(k-j>-this.near)return!1;if(k+j<-this.far)return!1;k-=j;var o=this.projectionMatrix,i=1/(o.n43*k),s=i*this.screenCenterX,w=(g.n11*c+g.n12*d+g.n13*f+g.n14)*o.n11*s;j=o.n11*j*s;if(w+j<-this.screenCenterX)return!1;if(w-j>this.screenCenterX)return!1;c=(g.n21*c+g.n22*d+g.n23*f+g.n24)*o.n22*i*this.screenCenterY;
 if(c+j<-this.screenCenterY)return!1;if(c-j>this.screenCenterY)return!1;a.screenPosition.set(w,c,k,j);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
@@ -125,7 +125,7 @@ THREE.FogExp2)q.fogDensity.value=m.density}if(h instanceof THREE.MeshPhongMateri
 O[G+2]=M.z;u+=1}else if(G instanceof THREE.PointLight){G=pa*3;N[G]=y.r*fa;N[G+1]=y.g*fa;N[G+2]=y.b*fa;ta[G]=M.x;ta[G+1]=M.y;ta[G+2]=M.z;pa+=1}}for(m=u*3;m<Q.length;m++)Q[m]=0;for(m=pa*3;m<N.length;m++)N[m]=0;$.point.length=pa;$.directional.length=u;$.ambient[0]=F;$.ambient[1]=I;$.ambient[2]=S;n=da.lights;q.enableLighting.value=n.directional.length+n.point.length;q.ambientLightColor.value=n.ambient;q.directionalLightColor.value=n.directional.colors;q.directionalLightDirection.value=n.directional.positions;
 q.pointLightColor.value=n.point.colors;q.pointLightPosition.value=n.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.map.texture=h.map;q.light_map.texture=h.light_map;q.env_map.texture=h.env_map;q.reflectivity.value=h.reflectivity;q.refraction_ratio.value=h.refraction_ratio;q.combine.value=h.combine;q.useRefract.value=
 h.env_map&&h.env_map.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){q.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.size.value=h.size;q.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){q.ambient.value.setRGB(h.ambient.r,h.ambient.g,
-h.ambient.b);q.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);q.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){q.mNear.value=e.zNear;q.mFar.value=e.zFar;q.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)q.opacity.value=h.opacity;for(var na in q)if(F=v.uniforms[na]){m=q[na];t=m.type;n=m.value;if(t=="i")b.uniform1i(F,n);else if(t=="f")b.uniform1f(F,n);else if(t=="fv1")b.uniform1fv(F,n);else if(t=="fv")b.uniform3fv(F,n);else if(t=="v2")b.uniform2f(F,
+h.ambient.b);q.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);q.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){q.mNear.value=e.near;q.mFar.value=e.far;q.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)q.opacity.value=h.opacity;for(var na in q)if(F=v.uniforms[na]){m=q[na];t=m.type;n=m.value;if(t=="i")b.uniform1i(F,n);else if(t=="f")b.uniform1f(F,n);else if(t=="fv1")b.uniform1fv(F,n);else if(t=="fv")b.uniform3fv(F,n);else if(t=="v2")b.uniform2f(F,
 n.x,n.y);else if(t=="v3")b.uniform3f(F,n.x,n.y,n.z);else if(t=="c")b.uniform3f(F,n.r,n.g,n.b);else if(t=="t"){b.uniform1i(F,n);if(m=m.texture)if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(!m.image.__webGLTextureCube)m.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
 b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(t=0;t<6;++t)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,m.image[t]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube)}}else{if(m.needsUpdate){if(m.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,
 m.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,m.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(m.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(m.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(m.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(m.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}else{m.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,m.__webGLTexture);b.texImage2D(b.TEXTURE_2D,

+ 1 - 1
examples/canvas_geometry_cube.html

@@ -83,7 +83,7 @@
 				scene.addObject( plane );
 
 				renderer = new THREE.CanvasRenderer();
-				renderer.setSize(  window.innerWidth, window.innerHeight );
+				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.appendChild( renderer.domElement );
 

+ 24 - 8
examples/canvas_performance.html

@@ -25,23 +25,17 @@
 		<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/objects/Ribbon.js"></script>
 		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
 		<script type="text/javascript" src="../src/animation/Animation.js"></script>
 		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
+		<script type="text/javascript" src="../src/cameras/QuakeCamera.js"></script>
 		<script type="text/javascript" src="../src/lights/Light.js"></script>
 		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
 		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
@@ -68,6 +62,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>
@@ -76,10 +78,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>
 

+ 55 - 54
examples/webgl_materials_video.html

@@ -15,7 +15,7 @@
 				font-weight: bold;
 				text-align:center;
 			}
-			
+
 			a {
 				color:#0078ff;
 			}
@@ -27,7 +27,7 @@
 				padding: 5px;
 				z-index:100;
 			}
-			
+
 		</style>
 	</head>
 	<body>
@@ -36,8 +36,9 @@
 			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl video demo. playing <a href="http://durian.blender.org/" target="_blank">sintel</a> trailer
 		</div>
 
-		<script type="text/javascript" src="js/ThreeExtrasVideo.js"></script>
-		
+		<script type="text/javascript" src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
@@ -48,7 +49,7 @@
 
 		<script type="text/javascript">
 
-			if ( ! THREE.Detector.webgl ) THREE.Detector.addGetWebGLMessage();
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 			var container, stats;
 
@@ -63,15 +64,15 @@
 			var windowHalfY = window.innerHeight / 2;
 
 			var postprocessing = { enabled: true };
-			
+
 			var cube_count,
-			
+
 				meshes = [],
 				materials = [],
-			
+
 				xgrid = 20,
 				ygrid = 10;
-			
+
 			init();
 			animate();
 
@@ -84,7 +85,7 @@
 				camera.position.z = 500;
 
 				scene = new THREE.Scene();
-				
+
 				var light = new THREE.DirectionalLight( 0xffffff );
 				light.position.set( 0.5, 1, 1 );
 				light.position.normalize();
@@ -92,11 +93,11 @@
 
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				
+
 				container.appendChild( renderer.domElement );
 
 				video = document.getElementById( 'video' );
-				
+
 				//video.volume = 0;
 				//video.muted = true;
 
@@ -106,13 +107,13 @@
 
 				//
 
-				var i, j, ux, uy, ox, oy, 
+				var i, j, ux, uy, ox, oy,
 					geometry,
 					xsize, ysize;
 
 				ux = 1 / xgrid;
 				uy = 1 / ygrid;
-				
+
 				xsize = 480 / xgrid;
 				ysize = 204 / ygrid;
 
@@ -120,22 +121,22 @@
 					material_base = new THREE.MeshLambertMaterial( parameters );
 
 				renderer.initMaterial( material_base, scene.lights, scene.fog );
-				
+
 				cube_count = 0;
-				
+
 				for( i = 0; i < xgrid; i++)
 				for( j = 0; j < ygrid; j++) {
-				
+
 					ox = i;
 					oy = j;
-					
+
 					geometry = new Cube( xsize, ysize, xsize );
 					change_uvs( geometry, ux, uy, ox, oy );
-					
+
 					materials[ cube_count ] = new THREE.MeshLambertMaterial( parameters );
-					
+
 					material = materials[ cube_count ];
-					
+
 					material.program = material_base.program;
 					material.uniforms = Uniforms.clone( THREE.ShaderLib[ 'lambert' ].uniforms );
 
@@ -143,20 +144,20 @@
 					material.saturation = j/ygrid;
 
 					material.color.setHSV( material.hue, material.saturation, 1 );
-					
+
 					mesh = new THREE.Mesh( geometry, material );
-					
+
 					mesh.position.x =   ( i - xgrid/2 ) * xsize;
 					mesh.position.y = - ( j - ygrid/2 ) * ysize;
-					mesh.position.z = 0;					
-					
+					mesh.position.z = 0;
+
 					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
-					
+
 					scene.addObject(mesh);
-					
+
 					mesh.dx = 0.001 * ( 0.5 - Math.random() );
 					mesh.dy = 0.001 * ( 0.5 - Math.random() );
-					
+
 					meshes[ cube_count ] = mesh;
 
 					cube_count += 1;
@@ -174,26 +175,26 @@
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 
 			}
-			
+
 			function change_uvs( geometry, unitx, unity, offsetx, offsety ) {
-				
+
 				var i, j, uv;
-				
+
 				for ( i = 0; i < geometry.uvs.length; i++ ) {
 
 					uv = geometry.uvs[ i ];
 
 					for ( j = 0; j < uv.length; j++ ) {
-						
+
 						uv[j].u = ( uv[j].u + offsetx ) * unitx;
 						uv[j].v = ( uv[j].v + offsety ) * unity;
 
 					}
 
 				}
-				
+
 			}
-			
+
 
 			function initPostprocessing() {
 
@@ -246,11 +247,11 @@
 				postprocessing.scene.addObject( postprocessing.quad );
 
 			}
-			
+
 			function onDocumentMouseMove(event) {
 
 				mouseX = ( event.clientX - windowHalfX );
-				mouseY = ( event.clientY - windowHalfY ) * 0.3;				
+				mouseY = ( event.clientY - windowHalfY ) * 0.3;
 
 			}
 
@@ -264,13 +265,13 @@
 				stats.update();
 
 			}
-				
+
 			var h, counter = 1;
-			
+
 			function render() {
 
 				var time = new Date().getTime() * 0.00005;
-				
+
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
 
@@ -279,22 +280,22 @@
 					if ( texture ) texture.needsUpdate = true;
 
 				}
-		
+
 				for( i = 0; i < cube_count; i++ ) {
-				
+
 					material = materials[i];
-					
+
 					h = ( 360 * ( material.hue + time ) % 360 ) / 360;
 					material.color.setHSV( h, material.saturation, 1 );
-					
+
 				}
-				
+
 				if( counter % 1000  > 200 ) {
-				
+
 					for( i = 0; i < cube_count; i++ ) {
 
 						mesh = meshes[i];
-						
+
 						mesh.rotation.x += 10 * mesh.dx;
 						mesh.rotation.y += 10 * mesh.dy;
 
@@ -303,24 +304,24 @@
 						mesh.position.z += 400 * mesh.dx;
 
 					}
-					
+
 				}
 
 				if( counter % 1000  == 0 ) {
-				
+
 					for( i = 0; i < cube_count; i++ ) {
-					
+
 						mesh = meshes[i];
-						
+
 						mesh.dx *= -1;
 						mesh.dy *= -1;
 
 					}
-					
+
 				}
-				
+
 				counter++;
-				
+
 				if ( postprocessing.enabled ) {
 
 					renderer.clear();
@@ -365,7 +366,7 @@
 					renderer.render( scene, camera );
 
 				}
-				
+
 			}
 
 

+ 25 - 17
src/cameras/Camera.js

@@ -3,19 +3,22 @@
  * @author mikael emtinger / http://gomo.se/
  */
 
-THREE.Camera = function( FOV, aspect, zNear, zFar, target ) {
+THREE.Camera = function( fov, aspect, near, far, target ) {
 
 	THREE.Object3D.call( this );
 
-	this.FOV              = FOV      || 50;
-	this.aspect           = aspect   || 1.0;
-	this.zNear            = zNear    || 0.1;
-	this.zFar             = zFar     || 2000;
-	this.screenCenterX    = 0;
-	this.screenCenterY    = 0;
-	this.target           = target   || new THREE.Object3D();
-	this.useTarget        = true;
-	this.up               = new THREE.Vector3( 0, 1, 0 );
+	this.fov = fov || 50;
+	this.aspect = aspect || 1.0;
+	this.near = near || 0.1;
+	this.far = far || 2000;
+
+	this.screenCenterX = 0;
+	this.screenCenterY = 0;
+
+	this.target = target || new THREE.Object3D();
+	this.useTarget = true;
+
+	this.up = new THREE.Vector3( 0, 1, 0 );
 
 	this.inverseMatrix     = new THREE.Matrix4();
 	this.projectionMatrix = null;
@@ -30,7 +33,7 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, target ) {
 		this.tmpVec.crossSelf( this.up );
 
 		if ( nofly ) this.tmpVec.y = 0;
-		
+
 		this.position.addSelf( this.tmpVec );
 		this.target.position.addSelf( this.tmpVec );
 
@@ -47,7 +50,7 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, target ) {
 		this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
 
 		if ( nofly ) this.tmpVec.y = 0;
-		
+
 		this.position.subSelf( this.tmpVec );
 		this.target.position.subSelf( this.tmpVec );
 
@@ -57,9 +60,9 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, target ) {
 
 }
 
-THREE.Camera.prototype             = new THREE.Object3D();
+THREE.Camera.prototype = new THREE.Object3D();
 THREE.Camera.prototype.constructor = THREE.Camera;
-THREE.Camera.prototype.supr        = THREE.Object3D.prototype;
+THREE.Camera.prototype.supr = THREE.Object3D.prototype;
 
 
 /*
@@ -70,7 +73,7 @@ THREE.Camera.prototype.supr        = THREE.Object3D.prototype;
 
 THREE.Camera.prototype.updateProjectionMatrix = function() {
 
-	this.projectionMatrix = THREE.Matrix4.makePerspective( this.FOV, this.aspect, this.zNear, this.zFar );
+	this.projectionMatrix = THREE.Matrix4.makePerspective( this.fov, this.aspect, this.near, this.far );
 
 }
 
@@ -152,12 +155,17 @@ THREE.Camera.prototype.frustumContains = function( object3D ) {
 	var radius  = object3D.boundRadius * object3D.boundRadiusScale;
 	var vz1     = ( inverse.n31 * vx0 + inverse.n32 * vy0 + inverse.n33 * vz0 + inverse.n34 );
 
-	if( vz1 - radius > -this.zNear )
+	if( vz1 - radius > - this.near ) {
+
 		return false;
 
-	if( vz1 + radius < -this.zFar )
+	}
+
+	if( vz1 + radius < - this.far ) {
+
 		return false;
 
+	}
 
 	// check x
 

+ 183 - 184
src/extras/SceneUtils.js

@@ -1,5 +1,5 @@
 var SceneUtils = {
-	
+
 	loadScene : function( url, callback_sync, callback_async, callback_progress ) {
 
 		var worker = new Worker( url );
@@ -9,22 +9,22 @@ var SceneUtils = {
 
 			var dg, dm, dd, dl, dc, df, dt,
 				g, o, m, l, p, c, t, f, tt, pp,
-				geometry, material, camera, fog, 
+				geometry, material, camera, fog,
 				texture, images,
 				materials,
-				data, loader, 
+				data, loader,
 				counter_models, counter_textures,
 				total_models, total_textures,
 				result;
 
 			data = event.data;
 			loader = new THREE.Loader();
-			
+
 			counter_models = 0;
 			counter_textures = 0;
-			
+
 			result = {
-				
+
 				scene: new THREE.Scene(),
 				geometries: {},
 				materials: {},
@@ -33,372 +33,372 @@ var SceneUtils = {
 				cameras: {},
 				lights: {},
 				fogs: {}
-			
+
 			};
-			
+
 			function handle_objects() {
-				
+
 				for( dd in data.objects ) {
-					
+
 					if ( !result.objects[ dd ] ) {
-						
+
 						o = data.objects[ dd ];
-						
+
 						geometry = result.geometries[ o.geometry ];
-						
+
 						if ( geometry ) {
-							
+
 							materials = [];
 							for( i = 0; i < o.materials.length; i++ ) {
-								
+
 								materials[ i ] = result.materials[ o.materials[i] ];
-								
+
 							}
-							
+
 							p = o.position;
 							r = o.rotation;
 							s = o.scale;
-							
+
 							object = new THREE.Mesh( geometry, materials );
 							object.position.set( p[0], p[1], p[2] );
 							object.rotation.set( r[0], r[1], r[2] );
 							object.scale.set( s[0], s[1], s[2] );
 							object.visible = o.visible;
-							
+
 							result.scene.addObject( object );
-							
+
 							result.objects[ dd ] = object;
-							
+
 						}
-						
+
 					}
-					
+
 				}
-				
+
 			};
-			
+
 			function handle_mesh( geo, id ) {
-				
-				result.geometries[ id ] = geo; 
+
+				result.geometries[ id ] = geo;
 				handle_objects();
-				
+
 			};
-			
+
 			function create_callback( id ) {
-				
+
 				return function( geo ) {
-					
+
 					handle_mesh( geo, id );
-					
+
 					counter_models -= 1;
-					
+
 					async_callback_gate();
-					
+
 				}
-				
+
 			};
-			
+
 			function async_callback_gate() {
-				
+
 				var progress = {
-					
+
 					total_models: total_models,
 					total_textures: total_textures,
 					loaded_models: total_models - counter_models,
 					loaded_textures: total_textures - counter_textures
-					
+
 				};
-				
+
 				callback_progress( progress, result );
-				
+
 				if( counter_models == 0 && counter_textures == 0 ) {
-					
+
 					callback_async( result );
-					
+
 				}
-				
+
 			};
-			
+
 			var callback_texture = function( images ) {
-				
+
 				counter_textures -= 1;
-				async_callback_gate();  
-				
+				async_callback_gate();
+
 			};
-			
+
 			// first go synchronous elements
-			
+
 			// cameras
-			
+
 			for( dc in data.cameras ) {
-				
+
 				c = data.cameras[ dc ];
-				
+
 				if ( c.type == "perspective" ) {
-					
+
 					camera = new THREE.Camera( c.fov, c.aspect, c.near, c.far );
-					
+
 				} else if ( c.type == "ortho" ) {
-					
+
 					camera = new THREE.Camera();
 					camera.projectionMatrix = THREE.Matrix4.makeOrtho( c.left, c.right, c.top, c.bottom, c.near, c.far );
-					
+
 				}
-				
+
 				p = c.position;
 				t = c.target;
 				camera.position.set( p[0], p[1], p[2] );
 				camera.target.position.set( t[0], t[1], t[2] );
-				
+
 				result.cameras[ dc ] = camera;
-				
+
 			}
-			
+
 			// lights
-			
+
 			for( dl in data.lights ) {
-				
+
 				l = data.lights[ dl ];
-				
+
 				if ( l.type == "directional" ) {
-				
+
 					p = l.direction;
-					
+
 					light = new THREE.DirectionalLight();
 					light.position.set( p[0], p[1], p[2] );
 					light.position.normalize();
-					
+
 				} else if ( l.type == "point" ) {
-				
+
 					p = l.position;
-					
+
 					light = new THREE.PointLight();
 					light.position.set( p[0], p[1], p[2] );
-					
+
 				}
-				
+
 				c = l.color;
 				i = l.intensity || 1;
 				light.color.setRGB( c[0] * i, c[1] * i, c[2] * i );
-				
+
 				result.scene.addLight( light );
-				
+
 				result.lights[ dl ] = light;
-				
+
 			}
-			
+
 			// fogs
-			
+
 			for( df in data.fogs ) {
-				
+
 				f = data.fogs[ df ];
-				
+
 				if ( f.type == "linear" ) {
-					
+
 					fog = new THREE.Fog( 0x000000, f.near, f.far );
-				
+
 				} else if ( f.type == "exp2" ) {
-					
+
 					fog = new THREE.FogExp2( 0x000000, f.density );
-					
+
 				}
-				
+
 				c = f.color;
 				fog.color.setRGB( c[0], c[1], c[2] );
-				
+
 				result.fogs[ df ] = fog;
-				
+
 			}
-			
+
 			// defaults
-			
+
 			if ( result.cameras && data.defaults.camera ) {
-				
+
 				result.currentCamera = result.cameras[ data.defaults.camera ];
-				
+
 			}
-			
+
 			if ( result.fogs && data.defaults.fog ) {
-			
+
 				result.scene.fog = result.fogs[ data.defaults.fog ];
-				
+
 			}
-			
+
 			c = data.defaults.bgcolor;
 			result.bgColor = new THREE.Color();
 			result.bgColor.setRGB( c[0], c[1], c[2] );
-			
+
 			result.bgColorAlpha = data.defaults.bgalpha;
 
 			// now come potentially asynchronous elements
-			
+
 			// geometries
-			
+
 			// count how many models will be loaded asynchronously
-			
+
 			for( dg in data.geometries ) {
-				
+
 				g = data.geometries[ dg ];
-				
+
 				if ( g.type == "bin_mesh" || g.type == "ascii_mesh" ) {
-					
+
 					counter_models += 1;
-					
+
 				}
-				
+
 			}
-			
+
 			total_models = counter_models;
-			
+
 			for( dg in data.geometries ) {
-				
+
 				g = data.geometries[ dg ];
-				
+
 				if ( g.type == "cube" ) {
-					
+
 					geometry = new Cube( g.width, g.height, g.depth, g.segments_width, g.segments_height, null, g.flipped, g.sides );
 					result.geometries[ dg ] = geometry;
-					
+
 				} else if ( g.type == "plane" ) {
-					
+
 					geometry = new Plane( g.width, g.height, g.segments_width, g.segments_height );
 					result.geometries[ dg ] = geometry;
-					
+
 				} else if ( g.type == "sphere" ) {
-					
+
 					geometry = new Sphere( g.radius, g.segments_width, g.segments_height );
 					result.geometries[ dg ] = geometry;
-					
+
 				} else if ( g.type == "cylinder" ) {
-					
+
 					geometry = new Cylinder( g.numSegs, g.topRad, g.botRad, g.height, g.topOffset, g.botOffset );
 					result.geometries[ dg ] = geometry;
 
 				} else if ( g.type == "torus" ) {
-					
+
 					geometry = new Torus( g.radius, g.tube, g.segmentsR, g.segmentsT );
 					result.geometries[ dg ] = geometry;
 
 				} else if ( g.type == "icosahedron" ) {
-					
+
 					geometry = new Icosahedron( g.subdivisions );
 					result.geometries[ dg ] = geometry;
-					
+
 				} else if ( g.type == "bin_mesh" ) {
-					
-					loader.loadBinary( { model: g.url, 
+
+					loader.loadBinary( { model: g.url,
 										 callback: create_callback( dg )
 										} );
-					
+
 				} else if ( g.type == "ascii_mesh" ) {
-					
-					loader.loadAscii( { model: g.url, 
+
+					loader.loadAscii( { model: g.url,
 										callback: create_callback( dg )
 										} );
-					
+
 				}
-				
+
 			}
 
 			// textures
-			
+
 			// count how many textures will be loaded asynchronously
-			
+
 			for( dt in data.textures ) {
-				
+
 				tt = data.textures[ dt ];
-				
+
 				if( tt.url instanceof Array ) {
-					
+
 					counter_textures += tt.url.length;
-					
+
 				} else {
-					
+
 					counter_textures += 1;
-					
+
 				}
-				
+
 			}
-			
+
 			total_textures = counter_textures;
-			
+
 			for( dt in data.textures ) {
-				
+
 				tt = data.textures[ dt ];
-				
+
 				if ( tt.mapping != undefined && THREE[ tt.mapping ] != undefined  ) {
-					
+
 					tt.mapping = new THREE[ tt.mapping ]();
-				
+
 				}
-				
+
 				if( tt.url instanceof Array ) {
-					
+
 					images = ImageUtils.loadArray( tt.url, callback_texture );
 					texture = new THREE.Texture( images, tt.mapping );
-					
+
 				} else {
-					
+
 					texture = ImageUtils.loadTexture( tt.url, tt.mapping, callback_texture );
-					
+
 					if ( THREE[ tt.min_filter ] != undefined )
 						texture.min_filter = THREE[ tt.min_filter ];
-					
+
 					if ( THREE[ tt.mag_filter ] != undefined )
 						texture.mag_filter = THREE[ tt.mag_filter ];
-					
+
 				}
-				
+
 				result.textures[ dt ] = texture;
-				
+
 			}
-			
+
 			// materials
-			
+
 			for( dm in data.materials ) {
-				
+
 				m = data.materials[ dm ];
-				
+
 				for( pp in m.parameters ) {
-					
+
 					if ( pp == "env_map" || pp == "map" || pp == "light_map" ) {
-						
+
 						m.parameters[ pp ] = result.textures[ m.parameters[ pp ] ];
-						
+
 					} else if ( pp == "shading" ) {
-						
+
 						m.parameters[ pp ] = ( m.parameters[ pp ] == "flat" ) ? THREE.FlatShading : THREE.SmoothShading;
-						
+
 					} else if ( pp == "blending" ) {
-						
+
 						m.parameters[ pp ] = THREE[ m.parameters[ pp ] ] ? THREE[ m.parameters[ pp ] ] : THREE.NormalBlending;
-						
+
 					} else if ( pp == "combine" ) {
-						
+
 						m.parameters[ pp ] = ( m.parameters[ pp ] == "MixOperation" ) ? THREE.MixOperation : THREE.MultiplyOperation;
-						
+
 					}
-					
+
 				}
-				
+
 				material = new THREE[ m.type ]( m.parameters );
 				result.materials[ dm ] = material;
-				
+
 			}
-			
+
 			// objects ( synchronous init of procedural primitives )
-			
+
 			handle_objects();
-			
+
 			// synchronous callback
-			
+
 			callback_sync( result );
 
 		};
-		
+
 	},
 
-	addMesh: function ( scene, geometry, scale, x, y, z, rx, ry, rz, material ) {
+	addMesh : function ( scene, geometry, scale, x, y, z, rx, ry, rz, material ) {
 
 		var mesh = new THREE.Mesh( geometry, material );
 		mesh.scale.x = mesh.scale.y = mesh.scale.z = scale;
@@ -414,33 +414,32 @@ var SceneUtils = {
 
 	},
 
-	addPanoramaCubeWebGL: function ( scene, size, textureCube ) {
+	addPanoramaCubeWebGL : function ( scene, size, textureCube ) {
 
 		var shader = ShaderUtils.lib["cube"];
 		shader.uniforms["tCube"].texture = textureCube;
 
 		var material = new THREE.MeshShaderMaterial( { fragment_shader: shader.fragment_shader,
-													   vertex_shader: shader.vertex_shader,
-													   uniforms: shader.uniforms
-													} ),
-
-			mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, null, true ), material );
+								   vertex_shader: shader.vertex_shader,
+								   uniforms: shader.uniforms
+								} ),
 
+		mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, null, true ), material );
 		scene.addObject( mesh );
 
 		return mesh;
 
 	},
 
-	addPanoramaCube: function( scene, size, images ) {
+	addPanoramaCube : function( scene, size, images ) {
 
 		var materials = [], mesh;
-		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[0] ) } ) );
-		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[1] ) } ) );
-		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[2] ) } ) );
-		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[3] ) } ) );
-		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[4] ) } ) );
-		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[5] ) } ) );
+		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 0 ] ) } ) );
+		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 1 ] ) } ) );
+		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 2 ] ) } ) );
+		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 3 ] ) } ) );
+		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 4 ] ) } ) );
+		materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[ 5 ] ) } ) );
 
 		mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, materials, true ), new THREE.MeshFaceMaterial() );
 		scene.addObject( mesh );
@@ -449,10 +448,10 @@ var SceneUtils = {
 
 	},
 
-	addPanoramaCubePlanes: function ( scene, size, images ) {
+	addPanoramaCubePlanes : function ( scene, size, images ) {
 
 
-		var hsize = size/2, plane = new Plane( size, size ), pi2 = Math.PI/2, pi = Math.PI;
+		var hsize = size / 2, plane = new Plane( size, size ), pi = Math.PI, pi2 = Math.PI / 2;
 
 		SceneUtils.addMesh( scene, plane, 1,      0,     0,  -hsize,  0,      0,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[5] ) } ) );
 		SceneUtils.addMesh( scene, plane, 1, -hsize,     0,       0,  0,    pi2,  0, new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[0] ) } ) );

+ 1 - 1
src/renderers/Projector.js

@@ -71,7 +71,7 @@ THREE.Projector = function() {
 
 	this.projectScene = function ( scene, camera, sort ) {
 
-		var renderList = [], near = camera.zNear, far = camera.zFar,
+		var renderList = [], near = camera.near, far = camera.far,
 		o, ol, v, vl, f, fl, n, nl, objects, object,
 		objectMatrix, objectMaterials, objectOverdraw,
 		objectMatrixRotation,

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -1450,8 +1450,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		} else if ( material instanceof THREE.MeshDepthMaterial ) {
 
-			m_uniforms.mNear.value = camera.zNear;
-			m_uniforms.mFar.value = camera.zFar;
+			m_uniforms.mNear.value = camera.near;
+			m_uniforms.mFar.value = camera.far;
 			m_uniforms.opacity.value = material.opacity;
 
 		} else if ( material instanceof THREE.MeshNormalMaterial ) {

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