提交 01a15e24 编写于 作者: M Mr.doob

Merge remote-tracking branch 'alteredq/dev' into dev

因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -18,67 +18,67 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this. ...@@ -18,67 +18,67 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]}; normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}; THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3; THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
THREE.Ray=function(a,b){function c(a,b,c){k.sub(c,a);q=k.dot(b);x=p.add(a,i.copy(b).multiplyScalar(q));return v=c.distanceTo(x)}function d(a,b,c,d){k.sub(d,b);p.sub(c,b);i.sub(a,b);H=k.dot(k);E=k.dot(p);t=k.dot(i);G=p.dot(p);z=p.dot(i);F=1/(H*G-E*E);s=(G*t-E*z)*F;u=(H*z-E*t)*F;return 0<=s&&0<=u&&1>s+u}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b])); THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);D=p.dot(b);u=k.add(a,r.copy(b).multiplyScalar(D));return G=c.distanceTo(u)}function d(a,b,c,d){p.sub(d,b);k.sub(c,b);r.sub(a,b);I=p.dot(p);v=p.dot(k);H=p.dot(r);A=k.dot(k);F=k.dot(r);s=1/(I*A-v*v);w=(A*H-v*F)*s;z=(I*F-v*H)*s;return 0<=w&&0<=z&&1>w+z}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,i=[];if(a instanceof THREE.Particle){var k=c(this.origin,this.direction,a.matrixWorld.getPosition());if(k>a.scale.x)return[];b={distance:k,point:a.position,face:null,object:a};i.push(b)}else if(a instanceof THREE.Mesh){var k= d.sort(function(a,b){return a.distance-b.distance});return d};var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,k=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};
c(this.origin,this.direction,a.matrixWorld.getPosition()),p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(k>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return i;var q,s,u=a.geometry,t=u.vertices,D;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(k=0,p=u.faces.length;k<p;k++)if(b=u.faces[k],m.copy(this.origin),j.copy(this.direction),D=a.matrixWorld,l=D.multiplyVector3(l.copy(b.centroid)).subSelf(m), k.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return k;var s,w,v=a.geometry,E=v.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,r=v.faces.length;p<r;p++)if(b=v.faces[p],j.copy(this.origin),i.copy(this.direction),
o=a.matrixRotationWorld.multiplyVector3(o.copy(b.normal)),q=j.dot(o),!(1.0E-4>Math.abs(q))&&(s=o.dot(l)/q,!(0>s)&&(a.doubleSided||(a.flipSided?0<q:0>q))))if(n.add(m,j.multiplyScalar(s)),b instanceof THREE.Face3)e=D.multiplyVector3(e.copy(t[b.a].position)),f=D.multiplyVector3(f.copy(t[b.b].position)),g=D.multiplyVector3(g.copy(t[b.c].position)),d(n,e,f,g)&&(b={distance:m.distanceTo(n),point:n.clone(),face:b,object:a},i.push(b));else if(b instanceof THREE.Face4&&(e=D.multiplyVector3(e.copy(t[b.a].position)), u=a.matrixWorld,o=u.multiplyVector3(o.copy(b.centroid)).subSelf(j),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),s=i.dot(m),!(Math.abs(s)<e)&&(w=m.dot(o)/s,!(0>w)&&(a.doubleSided||(a.flipSided?0<s:0>s))))if(n.add(j,i.multiplyScalar(w)),b instanceof THREE.Face3)f=u.multiplyVector3(f.copy(E[b.a].position)),g=u.multiplyVector3(g.copy(E[b.b].position)),h=u.multiplyVector3(h.copy(E[b.c].position)),d(n,f,g,h)&&(b={distance:j.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b));else if(b instanceof
f=D.multiplyVector3(f.copy(t[b.b].position)),g=D.multiplyVector3(g.copy(t[b.c].position)),h=D.multiplyVector3(h.copy(t[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:m.distanceTo(n),point:n.clone(),face:b,object:a},i.push(b)}return i};var k=new THREE.Vector3,p=new THREE.Vector3,i=new THREE.Vector3,q,x,v,H,E,t,G,z,F,s,u}; THREE.Face4&&(f=u.multiplyVector3(f.copy(E[b.a].position)),g=u.multiplyVector3(g.copy(E[b.b].position)),h=u.multiplyVector3(h.copy(E[b.c].position)),l=u.multiplyVector3(l.copy(E[b.d].position)),d(n,f,g,l)||d(n,g,h,l)))b={distance:j.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b)}return k};var p=new THREE.Vector3,k=new THREE.Vector3,r=new THREE.Vector3,D,u,G,I,v,H,A,F,s,w,z};
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,o){h=!1;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points= THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,i,o){h=!1;b=f;c=g;d=i;e=o;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
function(f,g,l,o,n,k){h?(h=!1,b=f<l?f<n?f:n:l<n?l:n,c=g<o?g<k?g:k:o<k?o:k,d=f>l?f>n?f:n:l>n?l:n,e=g>o?g>k?g:k:o>k?o:k):(b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<o?g<k?g<c?g:c:k<c?k:c:o<k?o<c?o:c:k<c?k:c,d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,e=g>o?g>k?g>e?g:e:k>e?k:e:o>k?o>e?o:e:k>e?k:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e> function(f,g,i,o,m,n){h?(h=!1,b=f<i?f<m?f:m:i<m?i:m,c=g<o?g<n?g:n:o<n?o:n,d=f>i?f>m?f:m:i>m?i:m,e=g>o?g>n?g:n:o>n?o:n):(b=f<i?f<m?f<b?f:b:m<b?m:b:i<m?i<b?i:b:m<b?m:b,c=g<o?g<n?g<c?g:c:n<c?n:c:o<n?o<c?o:c:n<c?n:c,d=f>i?f>m?f>d?f:d:m>d?m:d:i>m?i>d?i:d:m>d?m:d,e=g>o?g>n?g>e?g:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}}; f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]}; THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,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.Matrix3.prototype={constructor:THREE.Matrix3,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,g,h,m,j,l,o,n,k,p,i){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,m||0,j||0,void 0!==l?l:1,o||0,n||0,k||0,p||0,void 0!==i?i:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,j,i,o,m,n,p,k){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,l||0,j||0,void 0!==i?i:1,o||0,m||0,n||0,p||0,void 0!==k?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,m,j,l,o,n,k,p,i){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=m;this.n32=j;this.n33=l;this.n34=o;this.n41=n;this.n42=k;this.n43=p;this.n44=i;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,j,i,o,m,n,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=l;this.n32=j;this.n33=i;this.n34=o;this.n41=m;this.n42=n;this.n43=p;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,m=a.n23,j=a.n24,l=a.n31,o=a.n32,n=a.n33,k=a.n34,p=a.n41,i=a.n42,q=a.n43, b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,l=a.n23,j=a.n24,i=a.n31,o=a.n32,m=a.n33,n=a.n34,p=a.n41,k=a.n42,r=a.n43,
x=a.n44,v=b.n11,H=b.n12,E=b.n13,t=b.n14,G=b.n21,z=b.n22,F=b.n23,s=b.n24,u=b.n31,C=b.n32,J=b.n33,Z=b.n34,ca=b.n41,M=b.n42,O=b.n43,S=b.n44;this.n11=c*v+d*G+e*u+f*ca;this.n12=c*H+d*z+e*C+f*M;this.n13=c*E+d*F+e*J+f*O;this.n14=c*t+d*s+e*Z+f*S;this.n21=g*v+h*G+m*u+j*ca;this.n22=g*H+h*z+m*C+j*M;this.n23=g*E+h*F+m*J+j*O;this.n24=g*t+h*s+m*Z+j*S;this.n31=l*v+o*G+n*u+k*ca;this.n32=l*H+o*z+n*C+k*M;this.n33=l*E+o*F+n*J+k*O;this.n34=l*t+o*s+n*Z+k*S;this.n41=p*v+i*G+q*u+x*ca;this.n42=p*H+i*z+q*C+x*M;this.n43=p* D=a.n44,u=b.n11,G=b.n12,I=b.n13,v=b.n14,H=b.n21,A=b.n22,F=b.n23,s=b.n24,w=b.n31,z=b.n32,K=b.n33,$=b.n34,da=b.n41,N=b.n42,P=b.n43,T=b.n44;this.n11=c*u+d*H+e*w+f*da;this.n12=c*G+d*A+e*z+f*N;this.n13=c*I+d*F+e*K+f*P;this.n14=c*v+d*s+e*$+f*T;this.n21=g*u+h*H+l*w+j*da;this.n22=g*G+h*A+l*z+j*N;this.n23=g*I+h*F+l*K+j*P;this.n24=g*v+h*s+l*$+j*T;this.n31=i*u+o*H+m*w+n*da;this.n32=i*G+o*A+m*z+n*N;this.n33=i*I+o*F+m*K+n*P;this.n34=i*v+o*s+m*$+n*T;this.n41=p*u+k*H+r*w+D*da;this.n42=p*G+k*A+r*z+D*N;this.n43=p*
E+i*F+q*J+x*O;this.n44=p*t+i*s+q*Z+x*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(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},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*= I+k*F+r*K+D*P;this.n44=p*v+k*s+r*$+D*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(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},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},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},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* 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},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},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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();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* 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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,m=this.n31,j=this.n32,l=this.n33,o=this.n34,n=this.n41,k=this.n42,p=this.n43,i=this.n44;return d*g*j*n-c*h*j*n-d*f*l*n+b*h*l*n+c*f*o*n-b*g*o*n-d*g*m*k+c*h*m*k+d*e*l*k-a*h*l*k-c*e*o*k+a*g*o*k+d*f*m*p-b*h*m*p-d*e*j*p+a*h*j*p+b*e*o*p-a*f*o*p-c*f*m*i+b*g*m*i+c*e*j*i-a*g*j*i-b*e*l*i+a*f*l*i},transpose:function(){var a; 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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,l=this.n31,j=this.n32,i=this.n33,o=this.n34,m=this.n41,n=this.n42,p=this.n43,k=this.n44;return d*g*j*m-c*h*j*m-d*f*i*m+b*h*i*m+c*f*o*m-b*g*o*m-d*g*l*n+c*h*l*n+d*e*i*n-a*h*i*n-c*e*o*n+a*g*o*n+d*f*l*p-b*h*l*p-d*e*j*p+a*h*j*p+b*e*o*p-a*f*o*p-c*f*l*k+b*g*l*k+c*e*j*k-a*g*j*k-b*e*i*k+a*f*i*k},transpose:function(){var a;
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;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=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;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(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31; a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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}, 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},setRotationX: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},setRotationY: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},setRotationZ: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}, 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},setRotationX: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},setRotationY: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},setRotationZ: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},
setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,m=e*f,j=e*g;this.set(m*f+c,m*g-d*h,m*h+d*g,0,m*g+d*h,j*g+c,j*h-d*f,0,m*h-d*g,j*h+d*f,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12, setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,j=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,j*g+c,j*h-d*f,0,l*h-d*g,j*h+d*f,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,m=a.n24,j=a.n31,l=a.n32,o=a.n33,n=a.n34,k=a.n41,p=a.n42,i=a.n43,q=a.n44;this.n11=h*n*p-m*o*p+m*l*i-g*n*i-h*l*q+g*o*q;this.n12=e*o*p-d*n*p-e*l*i+c*n*i+d*l*q-c*o*q;this.n13=d*m*p-e*h*p+e*g*i-c*m*i-d*g*q+c*h*q;this.n14=e*h*l-d*m*l-e*g*o+c*m*o+d*g*n-c*h*n;this.n21=m*o*k-h*n*k-m*j*i+f*n*i+h*j*q-f*o*q;this.n22=d*n*k-e*o*k+ this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,l=a.n24,j=a.n31,i=a.n32,o=a.n33,m=a.n34,n=a.n41,p=a.n42,k=a.n43,r=a.n44;this.n11=h*m*p-l*o*p+l*i*k-g*m*k-h*i*r+g*o*r;this.n12=e*o*p-d*m*p-e*i*k+c*m*k+d*i*r-c*o*r;this.n13=d*l*p-e*h*p+e*g*k-c*l*k-d*g*r+c*h*r;this.n14=e*h*i-d*l*i-e*g*o+c*l*o+d*g*m-c*h*m;this.n21=l*o*n-h*m*n-l*j*k+f*m*k+h*j*r-f*o*r;this.n22=d*m*n-e*o*n+
e*j*i-b*n*i-d*j*q+b*o*q;this.n23=e*h*k-d*m*k-e*f*i+b*m*i+d*f*q-b*h*q;this.n24=d*m*j-e*h*j+e*f*o-b*m*o-d*f*n+b*h*n;this.n31=g*n*k-m*l*k+m*j*p-f*n*p-g*j*q+f*l*q;this.n32=e*l*k-c*n*k-e*j*p+b*n*p+c*j*q-b*l*q;this.n33=c*m*k-e*g*k+e*f*p-b*m*p-c*f*q+b*g*q;this.n34=e*g*j-c*m*j-e*f*l+b*m*l+c*f*n-b*g*n;this.n41=h*l*k-g*o*k-h*j*p+f*o*p+g*j*i-f*l*i;this.n42=c*o*k-d*l*k+d*j*p-b*o*p-c*j*i+b*l*i;this.n43=d*g*k-c*h*k-d*f*p+b*h*p+c*f*i-b*g*i;this.n44=c*h*j-d*g*j+d*f*l-b*h*l-c*f*o+b*g*o;this.multiplyScalar(1/a.determinant()); e*j*k-b*m*k-d*j*r+b*o*r;this.n23=e*h*n-d*l*n-e*f*k+b*l*k+d*f*r-b*h*r;this.n24=d*l*j-e*h*j+e*f*o-b*l*o-d*f*m+b*h*m;this.n31=g*m*n-l*i*n+l*j*p-f*m*p-g*j*r+f*i*r;this.n32=e*i*n-c*m*n-e*j*p+b*m*p+c*j*r-b*i*r;this.n33=c*l*n-e*g*n+e*f*p-b*l*p-c*f*r+b*g*r;this.n34=e*g*j-c*l*j-e*f*i+b*l*i+c*f*m-b*g*m;this.n41=h*i*n-g*o*n-h*j*p+f*o*p+g*j*k-f*i*k;this.n42=c*o*n-d*i*n+d*j*p-b*o*p-c*j*k+b*i*k;this.n43=d*g*n-c*h*n-d*f*p+b*h*p+c*f*k-b*g*k;this.n44=c*h*j-d*g*j+d*f*i-b*h*i-c*f*o+b*g*o;this.multiplyScalar(1/a.determinant());
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var m=g*h,j=g*e,l=d*h,o=d*e;this.n11=m+o*c;this.n12=l*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=j*c-l;this.n32=o+m*c;this.n33=f*g;break;case "ZXY":m=g*h;j=g*e;l=d*h;o=d*e;this.n11=m-o*c;this.n12=-f*e;this.n13=l+j*c;this.n21=j+l*c;this.n22=f*h;this.n23=o-m*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":m= return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=g*h,j=g*e,i=d*h,o=d*e;this.n11=l+o*c;this.n12=i*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=j*c-i;this.n32=o+l*c;this.n33=f*g;break;case "ZXY":l=g*h;j=g*e;i=d*h;o=d*e;this.n11=l-o*c;this.n12=-f*e;this.n13=i+j*c;this.n21=j+i*c;this.n22=f*h;this.n23=o-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l=
f*h;j=f*e;l=c*h;o=c*e;this.n11=g*h;this.n12=l*d-j;this.n13=m*d+o;this.n21=g*e;this.n22=o*d+m;this.n23=j*d-l;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":m=f*g;j=f*d;l=c*g;o=c*d;this.n11=g*h;this.n12=o-m*e;this.n13=l*e+j;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+l;this.n33=m-o*e;break;case "XZY":m=f*g;j=f*d;l=c*g;o=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=m*e+o;this.n22=f*h;this.n23=j*e-l;this.n31=l*e-j;this.n32=c*h;this.n33=o*e+m;break;default:m=f*h,j=f* f*h;j=f*e;i=c*h;o=c*e;this.n11=g*h;this.n12=i*d-j;this.n13=l*d+o;this.n21=g*e;this.n22=o*d+l;this.n23=j*d-i;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;j=f*d;i=c*g;o=c*d;this.n11=g*h;this.n12=o-l*e;this.n13=i*e+j;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+i;this.n33=l-o*e;break;case "XZY":l=f*g;j=f*d;i=c*g;o=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=l*e+o;this.n22=f*h;this.n23=j*e-i;this.n31=i*e-j;this.n32=c*h;this.n33=o*e+l;break;default:l=f*h,j=f*
e,l=c*h,o=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=j+l*d,this.n22=m-o*d,this.n23=-c*g,this.n31=o-m*d,this.n32=l+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,m=b*g,b=b*h,j=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(j+d);this.n12=m-e;this.n13=b+g;this.n21=m+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*= e,i=c*h,o=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=j+i*d,this.n22=l-o*d,this.n23=-c*g,this.n31=o-l*d,this.n32=i+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,l=b*g,b=b*h,j=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(j+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34; this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1=== return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,m=Math.cos(b),j=Math.sin(b),l=1-m,o=c*d*l,n=c*e*l,l=d*e*l,c=c*j,k=d*j,j=e*j,e=f+(1-f)*m,f=o+j,d=n-k,o=o-j,g=g+(1-g)*m,j=l+c,n=n+k,l=l-c,h=h+(1-h)*m,m=this.n11,c=this.n21,k=this.n31,p=this.n41,i=this.n12,q=this.n22,x=this.n32,v=this.n42,H=this.n13,E=this.n23,t=this.n33,G=this.n43;this.n11=e*m+f*i+d*H;this.n21=e*c+f*q+d*E;this.n31=e*k+f*x+d*t;this.n41=e*p+f*v+d*G;this.n12=o*m+g*i+j*H;this.n22= a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,l=Math.cos(b),j=Math.sin(b),i=1-l,o=c*d*i,m=c*e*i,i=d*e*i,c=c*j,n=d*j,j=e*j,e=f+(1-f)*l,f=o+j,d=m-n,o=o-j,g=g+(1-g)*l,j=i+c,m=m+n,i=i-c,h=h+(1-h)*l,l=this.n11,c=this.n21,n=this.n31,p=this.n41,k=this.n12,r=this.n22,D=this.n32,u=this.n42,G=this.n13,I=this.n23,v=this.n33,H=this.n43;this.n11=e*l+f*k+d*G;this.n21=e*c+f*r+d*I;this.n31=e*n+f*D+d*v;this.n41=e*p+f*u+d*H;this.n12=o*l+g*k+j*G;this.n22=
o*c+g*q+j*E;this.n32=o*k+g*x+j*t;this.n42=o*p+g*v+j*G;this.n13=n*m+l*i+h*H;this.n23=n*c+l*q+h*E;this.n33=n*k+l*x+h*t;this.n43=n*p+l*v+h*G;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,m=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*f;this.n22=j*c+a*g;this.n32=j*d+a*h;this.n42=j*e+a*m;this.n13=j*f-a*b;this.n23=j*g-a*c;this.n33=j*h-a*d;this.n43=j*m-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41, o*c+g*r+j*I;this.n32=o*n+g*D+j*v;this.n42=o*p+g*u+j*H;this.n13=m*l+i*k+h*G;this.n23=m*c+i*r+h*I;this.n33=m*n+i*D+h*v;this.n43=m*p+i*u+h*H;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*f;this.n22=j*c+a*g;this.n32=j*d+a*h;this.n42=j*e+a*l;this.n13=j*f-a*b;this.n23=j*g-a*c;this.n33=j*h-a*d;this.n43=j*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
f=this.n13,g=this.n23,h=this.n33,m=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*f;this.n21=j*c-a*g;this.n31=j*d-a*h;this.n41=j*e-a*m;this.n13=j*f+a*b;this.n23=j*g+a*c;this.n33=j*h+a*d;this.n43=j*m+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,m=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*f;this.n21=j*c+a*g;this.n31=j*d+a*h;this.n41=j*e+a*m;this.n12=j*f-a*b;this.n22=j*g-a*c;this.n32=j*h-a*d;this.n42=j*m-a*e;return this}, f=this.n13,g=this.n23,h=this.n33,l=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*f;this.n21=j*c-a*g;this.n31=j*d-a*h;this.n41=j*e-a*l;this.n13=j*f+a*b;this.n23=j*g+a*c;this.n33=j*h+a*d;this.n43=j*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*f;this.n21=j*c+a*g;this.n31=j*d+a*h;this.n41=j*e+a*l;this.n12=j*f-a*b;this.n22=j*g-a*c;this.n32=j*h-a*d;this.n42=j*l-a*e;return this},
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}}; translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
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,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*m;c[6]=a*j;c[7]=a*l;c[8]=a*o;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,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*j;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*j;c[7]=a*i;c[8]=a*o;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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 g,h,m,j;g=new THREE.Matrix4;h=b-a;m=c-d;j=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/m;g.n23=0;g.n24=-((c+d)/m);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,l,j;g=new THREE.Matrix4;h=b-a;l=c-d;j=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(a=== THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(a===
this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}}, this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},
getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y, getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0; this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[m]=j[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0} THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[l]=j[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
var e,f,g=[],h,m,j=[],l,o,n=[],k,p=[],i,q,x=[],v,H,E=[],t={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,z=new THREE.Vector4,F=new THREE.Matrix4,s=new THREE.Matrix4,u=new THREE.Frustum,C=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);F.multiply(b.matrixWorld, var e,f,g=[],h,l,j=[],i,o,m=[],n,p=[],k,r,D=[],u,G,I=[],v={objects:[],sprites:[],lights:[],elements:[]},H=new THREE.Vector3,A=new THREE.Vector4,F=new THREE.Matrix4,s=new THREE.Matrix4,w=new THREE.Frustum,z=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);F.multiply(b.matrixWorld,
b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||u.contains(b))?(F.multiplyVector3(G.copy(b.position)),e=a(),e.object= b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||w.contains(b))?(F.multiplyVector3(H.copy(b.position)),e=a(),e.object=
b,e.z=G.z,t.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(F.multiplyVector3(G.copy(b.position)),e=a(),e.object=b,e.z=G.z,t.sprites.push(e)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,G=e.far,P=!1,T,D,I,Q,A,N,L,U,r,y,w,B,K,ka,ea;H=q=k=o=0;t.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), b,e.z=H.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(F.multiplyVector3(H.copy(b.position)),e=a(),e.object=b,e.z=H.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,H=e.far,Q=!1,U,E,J,R,B,O,M,V,t,y,x,C,L,la,fa;G=r=n=o=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);u.setFromMatrix(F);t=this.projectGraph(a,!1);for(a=0,T=t.objects.length;a<T;a++)if(r=t.objects[a].object,y=r.matrixWorld,m=0,r instanceof THREE.Mesh){w=r.geometry;B=r.geometry.materials;Q=w.vertices;K=w.faces;ka=w.faceVertexUvs;w=r.matrixRotationWorld.extractRotation(y);for(D=0,I=Q.length;D<I;D++)h=b(),h.positionWorld.copy(Q[D].position),y.multiplyVector3(h.positionWorld), a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);w.setFromMatrix(F);v=this.projectGraph(a,!1);for(a=0,U=v.objects.length;a<U;a++)if(t=v.objects[a].object,y=t.matrixWorld,l=0,t instanceof THREE.Mesh){x=t.geometry;C=t.geometry.materials;R=x.vertices;L=x.faces;la=x.faceVertexUvs;x=t.matrixRotationWorld.extractRotation(y);for(E=0,J=R.length;E<J;E++)h=b(),h.positionWorld.copy(R[E].position),y.multiplyVector3(h.positionWorld),
h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<G;for(Q=0,D=K.length;Q<D;Q++){I=K[Q];if(I instanceof THREE.Face3)if(A=j[I.a],N=j[I.b],L=j[I.c],A.visible&&N.visible&&L.visible)if(P=0>(L.positionScreen.x-A.positionScreen.x)*(N.positionScreen.y-A.positionScreen.y)-(L.positionScreen.y-A.positionScreen.y)*(N.positionScreen.x-A.positionScreen.x),r.doubleSided|| h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<H;for(R=0,E=L.length;R<E;R++){J=L[R];if(J instanceof THREE.Face3)if(B=j[J.a],O=j[J.b],M=j[J.c],B.visible&&O.visible&&M.visible)if(Q=0>(M.positionScreen.x-B.positionScreen.x)*(O.positionScreen.y-B.positionScreen.y)-(M.positionScreen.y-B.positionScreen.y)*(O.positionScreen.x-B.positionScreen.x),t.doubleSided||
P!=r.flipSided)U=n[o]=n[o]||new THREE.RenderableFace3,o++,l=U,l.v1.copy(A),l.v2.copy(N),l.v3.copy(L);else continue;else continue;else if(I instanceof THREE.Face4)if(A=j[I.a],N=j[I.b],L=j[I.c],U=j[I.d],A.visible&&N.visible&&L.visible&&U.visible)if(P=0>(U.positionScreen.x-A.positionScreen.x)*(N.positionScreen.y-A.positionScreen.y)-(U.positionScreen.y-A.positionScreen.y)*(N.positionScreen.x-A.positionScreen.x)||0>(N.positionScreen.x-L.positionScreen.x)*(U.positionScreen.y-L.positionScreen.y)-(N.positionScreen.y- Q!=t.flipSided)V=m[o]=m[o]||new THREE.RenderableFace3,o++,i=V,i.v1.copy(B),i.v2.copy(O),i.v3.copy(M);else continue;else continue;else if(J instanceof THREE.Face4)if(B=j[J.a],O=j[J.b],M=j[J.c],V=j[J.d],B.visible&&O.visible&&M.visible&&V.visible)if(Q=0>(V.positionScreen.x-B.positionScreen.x)*(O.positionScreen.y-B.positionScreen.y)-(V.positionScreen.y-B.positionScreen.y)*(O.positionScreen.x-B.positionScreen.x)||0>(O.positionScreen.x-M.positionScreen.x)*(V.positionScreen.y-M.positionScreen.y)-(O.positionScreen.y-
L.positionScreen.y)*(U.positionScreen.x-L.positionScreen.x),r.doubleSided||P!=r.flipSided)ea=p[k]=p[k]||new THREE.RenderableFace4,k++,l=ea,l.v1.copy(A),l.v2.copy(N),l.v3.copy(L),l.v4.copy(U);else continue;else continue;l.normalWorld.copy(I.normal);!P&&(r.flipSided||r.doubleSided)&&l.normalWorld.negate();w.multiplyVector3(l.normalWorld);l.centroidWorld.copy(I.centroid);y.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);F.multiplyVector3(l.centroidScreen);L=I.vertexNormals;for(A= M.positionScreen.y)*(V.positionScreen.x-M.positionScreen.x),t.doubleSided||Q!=t.flipSided)fa=p[n]=p[n]||new THREE.RenderableFace4,n++,i=fa,i.v1.copy(B),i.v2.copy(O),i.v3.copy(M),i.v4.copy(V);else continue;else continue;i.normalWorld.copy(J.normal);!Q&&(t.flipSided||t.doubleSided)&&i.normalWorld.negate();x.multiplyVector3(i.normalWorld);i.centroidWorld.copy(J.centroid);y.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);F.multiplyVector3(i.centroidScreen);M=J.vertexNormals;for(B=
0,N=L.length;A<N;A++)U=l.vertexNormalsWorld[A],U.copy(L[A]),!P&&(r.flipSided||r.doubleSided)&&U.negate(),w.multiplyVector3(U);for(A=0,N=ka.length;A<N;A++)if(ea=ka[A][Q])for(L=0,U=ea.length;L<U;L++)l.uvs[A][L]=ea[L];l.material=r.material;l.faceMaterial=null!==I.materialIndex?B[I.materialIndex]:null;l.z=l.centroidScreen.z;t.elements.push(l)}}else if(r instanceof THREE.Line){s.multiply(F,y);Q=r.geometry.vertices;A=b();A.positionScreen.copy(Q[0].position);s.multiplyVector4(A.positionScreen);for(D=1,I= 0,O=M.length;B<O;B++)V=i.vertexNormalsWorld[B],V.copy(M[B]),!Q&&(t.flipSided||t.doubleSided)&&V.negate(),x.multiplyVector3(V);for(B=0,O=la.length;B<O;B++)if(fa=la[B][R])for(M=0,V=fa.length;M<V;M++)i.uvs[B][M]=fa[M];i.material=t.material;i.faceMaterial=null!==J.materialIndex?C[J.materialIndex]:null;i.z=i.centroidScreen.z;v.elements.push(i)}}else if(t instanceof THREE.Line){s.multiply(F,y);R=t.geometry.vertices;B=b();B.positionScreen.copy(R[0].position);s.multiplyVector4(B.positionScreen);for(E=1,J=
Q.length;D<I;D++)if(A=b(),A.positionScreen.copy(Q[D].position),s.multiplyVector4(A.positionScreen),N=j[m-2],C.copy(A.positionScreen),J.copy(N.positionScreen),d(C,J))C.multiplyScalar(1/C.w),J.multiplyScalar(1/J.w),y=x[q]=x[q]||new THREE.RenderableLine,q++,i=y,i.v1.positionScreen.copy(C),i.v2.positionScreen.copy(J),i.z=Math.max(C.z,J.z),i.material=r.material,t.elements.push(i)}for(a=0,T=t.sprites.length;a<T;a++)if(r=t.sprites[a].object,y=r.matrixWorld,r instanceof THREE.Particle&&(z.set(y.n14,y.n24, R.length;E<J;E++)if(B=b(),B.positionScreen.copy(R[E].position),s.multiplyVector4(B.positionScreen),O=j[l-2],z.copy(B.positionScreen),K.copy(O.positionScreen),d(z,K))z.multiplyScalar(1/z.w),K.multiplyScalar(1/K.w),y=D[r]=D[r]||new THREE.RenderableLine,r++,k=y,k.v1.positionScreen.copy(z),k.v2.positionScreen.copy(K),k.z=Math.max(z.z,K.z),k.material=t.material,v.elements.push(k)}for(a=0,U=v.sprites.length;a<U;a++)if(t=v.sprites[a].object,y=t.matrixWorld,t instanceof THREE.Particle&&(A.set(y.n14,y.n24,
y.n34,1),F.multiplyVector4(z),z.z/=z.w,0<z.z&&1>z.z))g=E[H]=E[H]||new THREE.RenderableParticle,H++,v=g,v.x=z.x/z.w,v.y=z.y/z.w,v.z=z.z,v.rotation=r.rotation.z,v.scale.x=r.scale.x*Math.abs(v.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),v.scale.y=r.scale.y*Math.abs(v.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),v.material=r.material,t.elements.push(v);f&&t.elements.sort(c);return t}}; y.n34,1),F.multiplyVector4(A),A.z/=A.w,0<A.z&&1>A.z))g=I[G]=I[G]||new THREE.RenderableParticle,G++,u=g,u.x=A.x/A.w,u.y=A.y/A.w,u.z=A.z,u.rotation=t.rotation.z,u.scale.x=t.scale.x*Math.abs(u.x-(A.x+e.projectionMatrix.n11)/(A.w+e.projectionMatrix.n14)),u.scale.y=t.scale.y*Math.abs(u.y-(A.y+e.projectionMatrix.n22)/(A.w+e.projectionMatrix.n24)),u.material=t.material,v.elements.push(u);f&&v.elements.sort(c);return v}};
THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e* THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*
f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31? f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z= -Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b= this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,m=this.w,j=m*c+g*e-h*d,l=m*d+h*c-f*e,o=m*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*m+c*-f+l*-h-o*-g;b.y=l*m+c*-g+o*-f-j*-h;b.z=o*m+c*-h+j*-g-l*-f;return b}}; a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,j=l*c+g*e-h*d,i=l*d+h*c-f*e,o=l*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*l+c*-f+i*-h-o*-g;b.y=i*l+c*-g+o*-f-j*-h;b.z=o*l+c*-h+j*-g-i*-f;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone(); THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
...@@ -92,11 +92,11 @@ b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a< ...@@ -92,11 +92,11 @@ b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<
this.faces[a],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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal), this.faces[a],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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],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])):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]))},computeMorphNormals:function(){var a, d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],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])):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]))},computeMorphNormals:function(){var a,
b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]= b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,m,j;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],m=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(m),h.push(j)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals(); {};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,l,j;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(l),h.push(j)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],m=g.faceNormals[c],j=g.vertexNormals[c],m.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a, f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=g.faceNormals[c],j=g.vertexNormals[c],l.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
b,c,d,e,f,A){h=a.vertices[b].position;m=a.vertices[c].position;j=a.vertices[d].position;l=g[e];o=g[f];n=g[A];k=m.x-h.x;p=j.x-h.x;i=m.y-h.y;q=j.y-h.y;x=m.z-h.z;v=j.z-h.z;H=o.u-l.u;E=n.u-l.u;t=o.v-l.v;G=n.v-l.v;z=1/(H*G-E*t);C.set((G*k-t*p)*z,(G*i-t*q)*z,(G*x-t*v)*z);J.set((H*p-E*k)*z,(H*q-E*i)*z,(H*v-E*x)*z);s[b].addSelf(C);s[c].addSelf(C);s[d].addSelf(C);u[b].addSelf(J);u[c].addSelf(J);u[d].addSelf(J)}var b,c,d,e,f,g,h,m,j,l,o,n,k,p,i,q,x,v,H,E,t,G,z,F,s=[],u=[],C=new THREE.Vector3,J=new THREE.Vector3, b,c,d,e,f,B){h=a.vertices[b].position;l=a.vertices[c].position;j=a.vertices[d].position;i=g[e];o=g[f];m=g[B];n=l.x-h.x;p=j.x-h.x;k=l.y-h.y;r=j.y-h.y;D=l.z-h.z;u=j.z-h.z;G=o.u-i.u;I=m.u-i.u;v=o.v-i.v;H=m.v-i.v;A=1/(G*H-I*v);z.set((H*n-v*p)*A,(H*k-v*r)*A,(H*D-v*u)*A);K.set((G*p-I*n)*A,(G*r-I*k)*A,(G*u-I*D)*A);s[b].addSelf(z);s[c].addSelf(z);s[d].addSelf(z);w[b].addSelf(K);w[c].addSelf(K);w[d].addSelf(K)}var b,c,d,e,f,g,h,l,j,i,o,m,n,p,k,r,D,u,G,I,v,H,A,F,s=[],w=[],z=new THREE.Vector3,K=new THREE.Vector3,
Z=new THREE.Vector3,ca=new THREE.Vector3,M=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)s[b]=new THREE.Vector3,u[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var O=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)M.copy(f.vertexNormals[d]),e=f[O[d]], $=new THREE.Vector3,da=new THREE.Vector3,N=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)s[b]=new THREE.Vector3,w[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var P=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)N.copy(f.vertexNormals[d]),e=f[P[d]],
F=s[e],Z.copy(F),Z.subSelf(M.multiplyScalar(M.dot(F))).normalize(),ca.cross(f.vertexNormals[d],F),e=ca.dot(u[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d< F=s[e],$.copy(F),$.subSelf(N.multiplyScalar(N.dot(F))).normalize(),da.cross(f.vertexNormals[d],F),e=da.dot(w[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10, e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0; 4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera; THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
...@@ -127,7 +127,7 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi ...@@ -127,7 +127,7 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi
THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps= THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){}; !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.DataTexture=function(a,b,c,d,e,f,g,h,m,j){THREE.Texture.call(this,null,f,g,h,m,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture; 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.DataTexture=function(a,b,c,d,e,f,g,h,l,j){THREE.Texture.call(this,null,f,g,h,l,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle; THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={}; THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
...@@ -141,38 +141,38 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce ...@@ -141,38 +141,38 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene; THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])}; THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])}; THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
THREE.CanvasRenderer=function(a){function b(a){if(v!=a)i.globalAlpha=v=a}function c(a){if(H!=a){switch(a){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}H=a}}function d(a){if(E!=a)i.strokeStyle=E=a}function e(a){if(t!=a)i.fillStyle=t=a}var a=a||{},f=this,g,h,m,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:document.createElement("canvas"), THREE.CanvasRenderer=function(a){function b(a){if(u!=a)k.globalAlpha=u=a}function c(a){if(G!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}G=a}}function d(a){if(I!=a)k.strokeStyle=I=a}function e(a){if(v!=a)k.fillStyle=v=a}var a=a||{},f=this,g,h,l,j=new THREE.Projector,i=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
o,n,k,p,i=l.getContext("2d"),q=new THREE.Color(0),x=0,v=1,H=0,E=null,t=null,G=null,z=null,F=null,s,u,C,J,Z=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,M,O,S,P,T,D,I,Q,A,N,L,U,r=new THREE.Color,y=new THREE.Color,w=new THREE.Color,B=new THREE.Color,K=new THREE.Color,ka=[],ea=[],fa,ga,da,$,Ba,Ca,Da,Ea,Fa,Ga,la=new THREE.Rectangle,Y=new THREE.Rectangle,X=new THREE.Rectangle,xa=!1,W=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,R=new THREE.Vector3,ra,sa,ya,aa,ta,ua,a=16;ra=document.createElement("canvas"); o,m,n,p,k=i.getContext("2d"),r=new THREE.Color(0),D=0,u=1,G=0,I=null,v=null,H=null,A=null,F=null,s,w,z,K,$=new THREE.RenderableVertex,da=new THREE.RenderableVertex,N,P,T,Q,U,E,J,R,B,O,M,V,t=new THREE.Color,y=new THREE.Color,x=new THREE.Color,C=new THREE.Color,L=new THREE.Color,la=[],fa=[],ga,ha,ea,aa,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,Y=new THREE.Rectangle,ya=!1,X=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,S=new THREE.Vector3,sa,ta,za,ba,ua,va,a=16;sa=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);ya=sa.getImageData(0,0,2,2);aa=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;ua=ta.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;n=b;k=Math.floor(o/2);p=Math.floor(n/2);l.width=o;l.height=n;la.set(-k,-p,k,p);Y.set(-k,-p,k,p);v=1;H=0; sa.width=sa.height=2;ta=sa.getContext("2d");ta.fillStyle="rgba(0,0,0,1)";ta.fillRect(0,0,2,2);za=ta.getImageData(0,0,2,2);ba=za.data;ua=document.createElement("canvas");ua.width=ua.height=a;va=ua.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;n=Math.floor(o/2);p=Math.floor(m/2);i.width=o;i.height=m;ma.set(-n,-p,n,p);Z.set(-n,-p,n,p);u=1;G=0;
F=z=G=t=E=null};this.setClearColor=function(a,b){q.copy(a);x=b;Y.set(-k,-p,k,p)};this.setClearColorHex=function(a,b){q.setHex(a);x=b;Y.set(-k,-p,k,p)};this.clear=function(){i.setTransform(1,0,0,-1,k,p);Y.isEmpty()||(Y.minSelf(la),Y.inflate(2),1>x&&i.clearRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight())),0<x&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*q.r)+","+Math.floor(255*q.g)+","+Math.floor(255*q.b)+","+x+")"),i.fillRect(Math.floor(Y.getX()), F=A=H=v=I=null};this.setClearColor=function(a,b){r.copy(a);D=b;Z.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){r.setHex(a);D=b;Z.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),1>D&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),0<D&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*r.b)+","+D+")"),k.fillRect(Math.floor(Z.getX()),
Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,l){function o(a){var b,c,d,e;W.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(W.r+=e.r,W.g+=e.g,W.b+=e.b):d instanceof THREE.DirectionalLight?(ma.r+=e.r,ma.g+=e.g,ma.b+=e.b):d instanceof THREE.PointLight&&(na.r+=e.r,na.g+=e.g,na.b+=e.b)}function n(a,b,c,d){var e,f,g,h,j,l;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color, Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,i){function o(a){var b,c,d,e;X.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.DirectionalLight?(na.r+=e.r,na.g+=e.g,na.b+=e.b):d instanceof THREE.PointLight&&(oa.r+=e.r,oa.g+=e.g,oa.b+=e.b)}function m(a,b,c,d){var e,f,g,h,j,i;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,
g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),l=c.dot(j),0>=l||(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),l=c.dot(R.sub(j,b).normalize()),0>=l||(l*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=l&&(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function q(a,f,g){b(g.opacity);c(g.blending);var h,l,j,m,za,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,za=m.width>>1,o=m.height>> g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),0>=i||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(S.sub(j,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function r(a,f,g){b(g.opacity);c(g.blending);var h,i,j,l,q,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=g.map.image,q=l.width>>1,o=l.height>>
1,g=f.scale.x*k,j=f.scale.y*p,h=g*za,l=j*o,X.set(a.x-h,a.y-l,a.x+h,a.y+l),la.intersects(X)&&(i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(g,-j),i.translate(-za,-o),i.drawImage(m,0,0),i.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*k,l=f.scale.y*p,X.set(a.x-h,a.y-l,a.x+h,a.y+l),la.intersects(X)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(h,l),g.program(i),i.restore()))}function t(a, 1,g=f.scale.x*n,j=f.scale.y*p,h=g*q,i=j*o,Y.set(a.x-h,a.y-i,a.x+h,a.y+i),ma.intersects(Y)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-j),k.translate(-q,-o),k.drawImage(l,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*n,i=f.scale.y*p,Y.set(a.x-h,a.y-i,a.x+h,a.y+i),ma.intersects(Y)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,i),g.program(k),k.restore()))}function u(a,e,
e,f,g){b(g.opacity);c(g.blending);i.beginPath();i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(G!=a)i.lineWidth=G=a;a=g.linecap;if(z!=a)i.lineCap=z=a;a=g.linejoin;if(F!=a)i.lineJoin=F=a;d(g.color.getContextStyle());i.stroke();X.inflate(2*g.linewidth)}}function v(a,d,e,g,h,j,i,k){f.info.render.vertices+=3;f.info.render.faces++;b(k.opacity);c(k.blending);M=a.positionScreen.x;O=a.positionScreen.y; f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(H!=a)k.lineWidth=H=a;a=g.linecap;if(A!=a)k.lineCap=A=a;a=g.linejoin;if(F!=a)k.lineJoin=F=a;d(g.color.getContextStyle());k.stroke();Y.inflate(2*g.linewidth)}}function v(a,d,e,g,h,j,k,q){f.info.render.vertices+=3;f.info.render.faces++;b(q.opacity);c(q.blending);N=a.positionScreen.x;P=a.positionScreen.y;
S=d.positionScreen.x;P=d.positionScreen.y;T=e.positionScreen.x;D=e.positionScreen.y;x(M,O,S,P,T,D);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&($=i.uvs[0],Aa(M,O,S,P,T,D,$[g].u,$[g].v,$[h].u,$[h].v,$[j].u,$[j].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,R.copy(i.vertexNormalsWorld[g]),Ba=0.5*(R.x*a.n11+R.y*a.n12+R.z*a.n13)+0.5,Ca=0.5*-(R.x*a.n21+R.y*a.n22+R.z*a.n23)+0.5,R.copy(i.vertexNormalsWorld[h]), T=d.positionScreen.x;Q=d.positionScreen.y;U=e.positionScreen.x;E=e.positionScreen.y;G(N,P,T,Q,U,E);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],Aa(N,P,T,Q,U,E,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[j].u,aa[j].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=i.matrixWorldInverse,S.copy(k.vertexNormalsWorld[g]),Ba=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ca=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,S.copy(k.vertexNormalsWorld[h]),
Da=0.5*(R.x*a.n11+R.y*a.n12+R.z*a.n13)+0.5,Ea=0.5*-(R.x*a.n21+R.y*a.n22+R.z*a.n23)+0.5,R.copy(i.vertexNormalsWorld[j]),Fa=0.5*(R.x*a.n11+R.y*a.n12+R.z*a.n13)+0.5,Ga=0.5*-(R.x*a.n21+R.y*a.n22+R.z*a.n23)+0.5,Aa(M,O,S,P,T,D,Ba,Ca,Da,Ea,Fa,Ga,k.envMap)}else k.wireframe?ia(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ha(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&(k.map.mapping instanceof THREE.UVMapping&&($=i.uvs[0],Aa(M,O,S,P,T,D,$[g].u,$[g].v, Da=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ea=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,S.copy(k.vertexNormalsWorld[j]),Fa=0.5*(S.x*a.n11+S.y*a.n12+S.z*a.n13)+0.5,Ga=0.5*-(S.x*a.n21+S.y*a.n22+S.z*a.n23)+0.5,Aa(N,P,T,Q,U,E,Ba,Ca,Da,Ea,Fa,Ga,q.envMap)}else q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],Aa(N,P,T,Q,U,E,aa[g].u,aa[g].v,
$[h].u,$[h].v,$[j].u,$[j].v,k.map)),c(THREE.SubtractiveBlending)),xa?!k.wireframe&&k.shading==THREE.SmoothShading&&3==i.vertexNormalsWorld.length?(y.r=w.r=B.r=W.r,y.g=w.g=B.g=W.g,y.b=w.b=B.b=W.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],y),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],w),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],B),y.r=Math.max(0,Math.min(k.color.r*y.r,1)),y.g=Math.max(0,Math.min(k.color.g*y.g,1)),y.b=Math.max(0,Math.min(k.color.b*y.b,1)),w.r=Math.max(0,Math.min(k.color.r* aa[h].u,aa[h].v,aa[j].u,aa[j].v,q.map)),c(THREE.SubtractiveBlending)),ya?!q.wireframe&&q.shading==THREE.SmoothShading&&3==k.vertexNormalsWorld.length?(y.r=x.r=C.r=X.r,y.g=x.g=C.g=X.g,y.b=x.b=C.b=X.b,m(l,k.v1.positionWorld,k.vertexNormalsWorld[0],y),m(l,k.v2.positionWorld,k.vertexNormalsWorld[1],x),m(l,k.v3.positionWorld,k.vertexNormalsWorld[2],C),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),x.r=Math.max(0,Math.min(q.color.r*
w.r,1)),w.g=Math.max(0,Math.min(k.color.g*w.g,1)),w.b=Math.max(0,Math.min(k.color.b*w.b,1)),B.r=Math.max(0,Math.min(k.color.r*B.r,1)),B.g=Math.max(0,Math.min(k.color.g*B.g,1)),B.b=Math.max(0,Math.min(k.color.b*B.b,1)),K.r=0.5*(w.r+B.r),K.g=0.5*(w.g+B.g),K.b=0.5*(w.b+B.b),da=va(y,w,B,K),pa(M,O,S,P,T,D,0,0,1,0,0,1,da)):(r.r=W.r,r.g=W.g,r.b=W.b,n(m,i.centroidWorld,i.normalWorld,r),r.r=Math.max(0,Math.min(k.color.r*r.r,1)),r.g=Math.max(0,Math.min(k.color.g*r.g,1)),r.b=Math.max(0,Math.min(k.color.b*r.b, x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),L.r=0.5*(x.r+C.r),L.g=0.5*(x.g+C.g),L.b=0.5*(x.b+C.b),ea=wa(y,x,C,L),qa(N,P,T,Q,U,E,0,0,1,0,0,1,ea)):(t.r=X.r,t.g=X.g,t.b=X.b,m(l,k.centroidWorld,k.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,
1)),k.wireframe?ia(r,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ha(r)):k.wireframe?ia(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ha(k.color);else if(k instanceof THREE.MeshDepthMaterial)fa=l.near,ga=l.far,y.r=y.g=y.b=1-oa(a.positionScreen.z,fa,ga),w.r=w.g=w.b=1-oa(d.positionScreen.z,fa,ga),B.r=B.g=B.b=1-oa(e.positionScreen.z,fa,ga),K.r=0.5*(w.r+B.r),K.g=0.5*(w.g+B.g),K.b=0.5*(w.b+B.b),da=va(y,w,B,K),pa(M,O,S,P,T,D,0,0,1,0,0,1,da);else if(k instanceof THREE.MeshNormalMaterial)r.r= 1)),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ga=i.near,ha=i.far,y.r=y.g=y.b=1-pa(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-pa(d.positionScreen.z,ga,ha),C.r=C.g=C.b=1-pa(e.positionScreen.z,ga,ha),L.r=0.5*(x.r+C.r),L.g=0.5*(x.g+C.g),L.b=0.5*(x.b+C.b),ea=wa(y,x,C,L),qa(N,P,T,Q,U,E,0,0,1,0,0,1,ea);else if(q instanceof THREE.MeshNormalMaterial)t.r=
qa(i.normalWorld.x),r.g=qa(i.normalWorld.y),r.b=qa(i.normalWorld.z),k.wireframe?ia(r,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ha(r)}function H(a,d,e,g,h,k,j,i,o){f.info.render.vertices+=4;f.info.render.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)v(a,d,g,0,1,3,j,i,o),v(h,e,k,1,2,3,j,i,o);else if(M=a.positionScreen.x,O=a.positionScreen.y,S=d.positionScreen.x,P=d.positionScreen.y,T=e.positionScreen.x,D=e.positionScreen.y,I=g.positionScreen.x,Q=g.positionScreen.y,A=h.positionScreen.x, ra(k.normalWorld.x),t.g=ra(k.normalWorld.y),t.b=ra(k.normalWorld.z),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)}function D(a,d,e,g,h,j,k,q,n){f.info.render.vertices+=4;f.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)v(a,d,g,0,1,3,k,q,n),v(h,e,j,1,2,3,k,q,n);else if(N=a.positionScreen.x,P=a.positionScreen.y,T=d.positionScreen.x,Q=d.positionScreen.y,U=e.positionScreen.x,E=e.positionScreen.y,J=g.positionScreen.x,R=g.positionScreen.y,B=h.positionScreen.x,
N=h.positionScreen.y,L=k.positionScreen.x,U=k.positionScreen.y,i instanceof THREE.MeshBasicMaterial)E(M,O,S,P,T,D,I,Q),i.wireframe?ia(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)xa?!i.wireframe&&i.shading==THREE.SmoothShading&&4==j.vertexNormalsWorld.length?(y.r=w.r=B.r=K.r=W.r,y.g=w.g=B.g=K.g=W.g,y.b=w.b=B.b=K.b=W.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],y),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],w), O=h.positionScreen.y,M=j.positionScreen.x,V=j.positionScreen.y,q instanceof THREE.MeshBasicMaterial)I(N,P,T,Q,U,E,J,R),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)ya?!q.wireframe&&q.shading==THREE.SmoothShading&&4==k.vertexNormalsWorld.length?(y.r=x.r=C.r=L.r=X.r,y.g=x.g=C.g=L.g=X.g,y.b=x.b=C.b=L.b=X.b,m(l,k.v1.positionWorld,k.vertexNormalsWorld[0],y),m(l,k.v2.positionWorld,k.vertexNormalsWorld[1],x),
n(m,j.v4.positionWorld,j.vertexNormalsWorld[3],B),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],K),y.r=Math.max(0,Math.min(i.color.r*y.r,1)),y.g=Math.max(0,Math.min(i.color.g*y.g,1)),y.b=Math.max(0,Math.min(i.color.b*y.b,1)),w.r=Math.max(0,Math.min(i.color.r*w.r,1)),w.g=Math.max(0,Math.min(i.color.g*w.g,1)),w.b=Math.max(0,Math.min(i.color.b*w.b,1)),B.r=Math.max(0,Math.min(i.color.r*B.r,1)),B.g=Math.max(0,Math.min(i.color.g*B.g,1)),B.b=Math.max(0,Math.min(i.color.b*B.b,1)),K.r=Math.max(0,Math.min(i.color.r* m(l,k.v4.positionWorld,k.vertexNormalsWorld[3],C),m(l,k.v3.positionWorld,k.vertexNormalsWorld[2],L),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),L.r=Math.max(0,Math.min(q.color.r*
K.r,1)),K.g=Math.max(0,Math.min(i.color.g*K.g,1)),K.b=Math.max(0,Math.min(i.color.b*K.b,1)),da=va(y,w,B,K),x(M,O,S,P,I,Q),pa(M,O,S,P,I,Q,0,0,1,0,0,1,da),x(A,N,T,D,L,U),pa(A,N,T,D,L,U,1,0,1,1,0,1,da)):(r.r=W.r,r.g=W.g,r.b=W.b,n(m,j.centroidWorld,j.normalWorld,r),r.r=Math.max(0,Math.min(i.color.r*r.r,1)),r.g=Math.max(0,Math.min(i.color.g*r.g,1)),r.b=Math.max(0,Math.min(i.color.b*r.b,1)),E(M,O,S,P,T,D,I,Q),i.wireframe?ia(r,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(r)):(E(M,O,S, L.r,1)),L.g=Math.max(0,Math.min(q.color.g*L.g,1)),L.b=Math.max(0,Math.min(q.color.b*L.b,1)),ea=wa(y,x,C,L),G(N,P,T,Q,J,R),qa(N,P,T,Q,J,R,0,0,1,0,0,1,ea),G(B,O,U,E,M,V),qa(B,O,U,E,M,V,1,0,1,1,0,1,ea)):(t.r=X.r,t.g=X.g,t.b=X.b,m(l,k.centroidWorld,k.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,1)),I(N,P,T,Q,U,E,J,R),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):(I(N,P,T,
P,T,D,I,Q),i.wireframe?ia(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)r.r=qa(j.normalWorld.x),r.g=qa(j.normalWorld.y),r.b=qa(j.normalWorld.z),E(M,O,S,P,T,D,I,Q),i.wireframe?ia(r,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(r);else if(i instanceof THREE.MeshDepthMaterial)fa=l.near,ga=l.far,y.r=y.g=y.b=1-oa(a.positionScreen.z,fa,ga),w.r=w.g=w.b=1-oa(d.positionScreen.z,fa,ga),B.r=B.g=B.b=1-oa(g.positionScreen.z, Q,U,E,J,R),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)t.r=ra(k.normalWorld.x),t.g=ra(k.normalWorld.y),t.b=ra(k.normalWorld.z),I(N,P,T,Q,U,E,J,R),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t);else if(q instanceof THREE.MeshDepthMaterial)ga=i.near,ha=i.far,y.r=y.g=y.b=1-pa(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-pa(d.positionScreen.z,ga,ha),C.r=C.g=C.b=1-pa(g.positionScreen.z,
fa,ga),K.r=K.g=K.b=1-oa(e.positionScreen.z,fa,ga),da=va(y,w,B,K),x(M,O,S,P,I,Q),pa(M,O,S,P,I,Q,0,0,1,0,0,1,da),x(A,N,T,D,L,U),pa(A,N,T,D,L,U,1,0,1,1,0,1,da)}function x(a,b,c,d,e,f){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(a,b);i.closePath()}function E(a,b,c,d,e,f,g,h){i.beginPath();i.moveTo(a,b);i.lineTo(c,d);i.lineTo(e,f);i.lineTo(g,h);i.lineTo(a,b);i.closePath()}function ia(a,b,c,e){if(G!=b)i.lineWidth=G=b;if(z!=c)i.lineCap=z=c;if(F!=e)i.lineJoin=F=e;d(a.getContextStyle()); ga,ha),L.r=L.g=L.b=1-pa(e.positionScreen.z,ga,ha),ea=wa(y,x,C,L),G(N,P,T,Q,J,R),qa(N,P,T,Q,J,R,0,0,1,0,0,1,ea),G(B,O,U,E,M,V),qa(B,O,U,E,M,V,1,0,1,1,0,1,ea)}function G(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function I(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ja(a,b,c,e){if(H!=b)k.lineWidth=H=b;if(A!=c)k.lineCap=A=c;if(F!=e)k.lineJoin=F=e;d(a.getContextStyle());
i.stroke();X.inflate(2*b)}function ha(a){e(a.getContextStyle());i.fill()}function Aa(a,b,c,d,f,g,h,k,j,l,m,o,n){if(0!=n.image.width){if(!0==n.needsUpdate||void 0==ka[n.id]){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;ka[n.id]=i.createPattern(n.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");n.needsUpdate=!1}e(ka[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y,h=(h+p)*s,k=(k+q)*t,c=c-a,d=d- k.stroke();Y.inflate(2*b)}function ia(a){e(a.getContextStyle());k.fill()}function Aa(a,b,c,d,f,g,h,j,i,l,n,o,m){if(0!=m.image.width){if(!0==m.needsUpdate||void 0==la[m.id]){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;la[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}e(la[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=m.image.width*m.repeat.x,u=m.image.height*m.repeat.y,h=(h+p)*s,j=(j+r)*u,c=c-a,d=d-
b,f=f-a,g=g-b,j=(j+p)*s-h,l=(l+q)*t-k,m=(m+p)*s-h,o=(o+q)*t-k,p=j*o-m*l;if(0==p){if(void 0===ea[n.id])b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ea[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data;b=ea[n.id];h=4*(Math.floor(h)+Math.floor(k)*n.image.width);r.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ha(r)}else p=1/p,n=(o*c-l*f)*p,l=(o*d-l*g)*p,c=(j*f-m*c)*p,d=(j*g-m*d)*p,a=a-n*h-c*k,h=b-l*h-d*k,i.save(),i.transform(n, b,f=f-a,g=g-b,i=(i+p)*s-h,l=(l+r)*u-j,n=(n+p)*s-h,o=(o+r)*u-j,p=i*o-n*l;if(0==p){if(void 0===fa[m.id])b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),fa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data;b=fa[m.id];h=4*(Math.floor(h)+Math.floor(j)*m.image.width);t.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(t)}else p=1/p,m=(o*c-l*f)*p,l=(o*d-l*g)*p,c=(i*f-n*c)*p,d=(i*g-n*d)*p,a=a-m*h-c*j,h=b-l*h-d*j,k.save(),k.transform(m,
l,c,d,a,h),i.fill(),i.restore()}}function pa(a,b,c,d,e,f,g,h,k,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;c-=a;d-=b;e-=a;f-=b;k=k*o-g;j=j*p-h;l=l*o-g;m=m*p-h;p=1/(k*m-l*j);o=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(k*e-l*c)*p;d=(k*f-l*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;i.save();i.transform(o,j,c,d,a,b);i.clip();i.drawImage(n,0,0);i.restore()}function va(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),i=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),k=~~(255*d.r),l= l,c,d,a,h),k.fill(),k.restore()}}function qa(a,b,c,d,e,f,g,h,j,i,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;c-=a;d-=b;e-=a;f-=b;j=j*o-g;i=i*p-h;l=l*o-g;m=m*p-h;p=1/(j*m-l*i);o=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-l*c)*p;d=(j*f-l*d)*p;a=a-o*g-c*h;b=b-i*g-d*h;k.save();k.transform(o,i,c,d,a,b);k.clip();k.drawImage(n,0,0);k.restore()}function wa(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),i=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),k=~~(255*d.r),l=
~~(255*d.g),d=~~(255*d.b);aa[0]=0>e?0:255<e?255:e;aa[1]=0>f?0:255<f?255:f;aa[2]=0>a?0:255<a?255:a;aa[4]=0>g?0:255<g?255:g;aa[5]=0>h?0:255<h?255:h;aa[6]=0>b?0:255<b?255:b;aa[8]=0>i?0:255<i?255:i;aa[9]=0>j?0:255<j?255:j;aa[10]=0>c?0:255<c?255:c;aa[12]=0>k?0:255<k?255:k;aa[13]=0>l?0:255<l?255:l;aa[14]=0>d?0:255<d?255:d;sa.putImageData(ya,0,0);ua.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function ja(a,b){var c=b.x-a.x, ~~(255*d.g),d=~~(255*d.b);ba[0]=0>e?0:255<e?255:e;ba[1]=0>f?0:255<f?255:f;ba[2]=0>a?0:255<a?255:a;ba[4]=0>g?0:255<g?255:g;ba[5]=0>h?0:255<h?255:h;ba[6]=0>b?0:255<b?255:b;ba[8]=0>i?0:255<i?255:i;ba[9]=0>j?0:255<j?255:j;ba[10]=0>c?0:255<c?255:c;ba[12]=0>k?0:255<k?255:k;ba[13]=0>l?0:255<l?255:l;ba[14]=0>d?0:255<d?255:d;ta.putImageData(za,0,0);va.drawImage(sa,0,0);return ua}function pa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ra(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function ka(a,b){var c=b.x-a.x,
d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var wa,Ha,V,ba;this.autoClear?this.clear():i.setTransform(1,0,0,-1,k,p);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortElements);h=g.elements;m=g.lights;(xa=0<m.length)&&o(m);for(wa=0,Ha=h.length;wa<Ha;wa++)if(V=h[wa],ba=V.material,ba=ba instanceof THREE.MeshFaceMaterial?V.faceMaterial:ba,!(null==ba||0==ba.opacity)){X.empty();if(V instanceof THREE.RenderableParticle)s=V,s.x*=k,s.y*=p,q(s, d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ha,W,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,i,this.sortElements);h=g.elements;l=g.lights;(ya=0<l.length)&&o(l);for(xa=0,Ha=h.length;xa<Ha;xa++)if(W=h[xa],ca=W.material,ca=ca instanceof THREE.MeshFaceMaterial?W.faceMaterial:ca,!(null==ca||0==ca.opacity)){Y.empty();if(W instanceof THREE.RenderableParticle)s=W,s.x*=n,s.y*=p,r(s,
V,ba,a);else if(V instanceof THREE.RenderableLine)s=V.v1,u=V.v2,s.positionScreen.x*=k,s.positionScreen.y*=p,u.positionScreen.x*=k,u.positionScreen.y*=p,X.addPoint(s.positionScreen.x,s.positionScreen.y),X.addPoint(u.positionScreen.x,u.positionScreen.y),la.intersects(X)&&t(s,u,V,ba,a);else if(V instanceof THREE.RenderableFace3)s=V.v1,u=V.v2,C=V.v3,s.positionScreen.x*=k,s.positionScreen.y*=p,u.positionScreen.x*=k,u.positionScreen.y*=p,C.positionScreen.x*=k,C.positionScreen.y*=p,ba.overdraw&&(ja(s.positionScreen, W,ca,a);else if(W instanceof THREE.RenderableLine)s=W.v1,w=W.v2,s.positionScreen.x*=n,s.positionScreen.y*=p,w.positionScreen.x*=n,w.positionScreen.y*=p,Y.addPoint(s.positionScreen.x,s.positionScreen.y),Y.addPoint(w.positionScreen.x,w.positionScreen.y),ma.intersects(Y)&&u(s,w,W,ca,a);else if(W instanceof THREE.RenderableFace3)s=W.v1,w=W.v2,z=W.v3,s.positionScreen.x*=n,s.positionScreen.y*=p,w.positionScreen.x*=n,w.positionScreen.y*=p,z.positionScreen.x*=n,z.positionScreen.y*=p,ca.overdraw&&(ka(s.positionScreen,
u.positionScreen),ja(u.positionScreen,C.positionScreen),ja(C.positionScreen,s.positionScreen)),X.add3Points(s.positionScreen.x,s.positionScreen.y,u.positionScreen.x,u.positionScreen.y,C.positionScreen.x,C.positionScreen.y),la.intersects(X)&&v(s,u,C,0,1,2,V,ba,a);else if(V instanceof THREE.RenderableFace4)s=V.v1,u=V.v2,C=V.v3,J=V.v4,s.positionScreen.x*=k,s.positionScreen.y*=p,u.positionScreen.x*=k,u.positionScreen.y*=p,C.positionScreen.x*=k,C.positionScreen.y*=p,J.positionScreen.x*=k,J.positionScreen.y*= w.positionScreen),ka(w.positionScreen,z.positionScreen),ka(z.positionScreen,s.positionScreen)),Y.add3Points(s.positionScreen.x,s.positionScreen.y,w.positionScreen.x,w.positionScreen.y,z.positionScreen.x,z.positionScreen.y),ma.intersects(Y)&&v(s,w,z,0,1,2,W,ca,a);else if(W instanceof THREE.RenderableFace4)s=W.v1,w=W.v2,z=W.v3,K=W.v4,s.positionScreen.x*=n,s.positionScreen.y*=p,w.positionScreen.x*=n,w.positionScreen.y*=p,z.positionScreen.x*=n,z.positionScreen.y*=p,K.positionScreen.x*=n,K.positionScreen.y*=
p,Z.positionScreen.copy(u.positionScreen),ca.positionScreen.copy(J.positionScreen),ba.overdraw&&(ja(s.positionScreen,u.positionScreen),ja(u.positionScreen,J.positionScreen),ja(J.positionScreen,s.positionScreen),ja(C.positionScreen,Z.positionScreen),ja(C.positionScreen,ca.positionScreen)),X.addPoint(s.positionScreen.x,s.positionScreen.y),X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(C.positionScreen.x,C.positionScreen.y),X.addPoint(J.positionScreen.x,J.positionScreen.y),la.intersects(X)&& p,$.positionScreen.copy(w.positionScreen),da.positionScreen.copy(K.positionScreen),ca.overdraw&&(ka(s.positionScreen,w.positionScreen),ka(w.positionScreen,K.positionScreen),ka(K.positionScreen,s.positionScreen),ka(z.positionScreen,$.positionScreen),ka(z.positionScreen,da.positionScreen)),Y.addPoint(s.positionScreen.x,s.positionScreen.y),Y.addPoint(w.positionScreen.x,w.positionScreen.y),Y.addPoint(z.positionScreen.x,z.positionScreen.y),Y.addPoint(K.positionScreen.x,K.positionScreen.y),ma.intersects(Y)&&
H(s,u,C,J,Z,ca,V,ba,a);Y.addRectangle(X)}i.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)}; D(s,w,z,K,$,da,W,ca,a);Z.addRectangle(Y)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null}; THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null}; THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a, THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,m=g.createImageData(d,e),j=m.data,l=0;l<d;l++)for(var o=1;o<e;o++){var n=0>o-1?e-1:o-1,k=(o+1)%e,p=0>l-1?d-1:l-1,i=(l+1)%d,q=[],x=[0,0,h[4*(o*d+l)]/255*b];q.push([-1,0,h[4*(o*d+p)]/255*b]);q.push([-1,-1,h[4*(n*d+p)]/255*b]);q.push([0,-1, b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,e),j=l.data,i=0;i<d;i++)for(var o=1;o<e;o++){var m=0>o-1?e-1:o-1,n=(o+1)%e,p=0>i-1?d-1:i-1,k=(i+1)%d,r=[],D=[0,0,h[4*(o*d+i)]/255*b];r.push([-1,0,h[4*(o*d+p)]/255*b]);r.push([-1,-1,h[4*(m*d+p)]/255*b]);r.push([0,-1,
h[4*(n*d+l)]/255*b]);q.push([1,-1,h[4*(n*d+i)]/255*b]);q.push([1,0,h[4*(o*d+i)]/255*b]);q.push([1,1,h[4*(k*d+i)]/255*b]);q.push([0,1,h[4*(k*d+l)]/255*b]);q.push([-1,1,h[4*(k*d+p)]/255*b]);n=[];p=q.length;for(k=0;k<p;k++){var i=q[k],v=q[(k+1)%p],i=[i[0]-x[0],i[1]-x[1],i[2]-x[2]],v=[v[0]-x[0],v[1]-x[1],v[2]-x[2]];n.push(c([i[1]*v[2]-i[2]*v[1],i[2]*v[0]-i[0]*v[2],i[0]*v[1]-i[1]*v[0]]))}q=[0,0,0];for(k=0;k<n.length;k++)q[0]+=n[k][0],q[1]+=n[k][1],q[2]+=n[k][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length; h[4*(m*d+i)]/255*b]);r.push([1,-1,h[4*(m*d+k)]/255*b]);r.push([1,0,h[4*(o*d+k)]/255*b]);r.push([1,1,h[4*(n*d+k)]/255*b]);r.push([0,1,h[4*(n*d+i)]/255*b]);r.push([-1,1,h[4*(n*d+p)]/255*b]);m=[];p=r.length;for(n=0;n<p;n++){var k=r[n],u=r[(n+1)%p],k=[k[0]-D[0],k[1]-D[1],k[2]-D[2]],u=[u[0]-D[0],u[1]-D[1],u[2]-D[2]];m.push(c([k[1]*u[2]-k[2]*u[1],k[2]*u[0]-k[0]*u[2],k[0]*u[1]-k[1]*u[0]]))}r=[0,0,0];for(n=0;n<m.length;n++)r[0]+=m[n][0],r[1]+=m[n][1],r[2]+=m[n][2];r[0]/=m.length;r[1]/=m.length;r[2]/=m.length;
x=4*(o*d+l);j[x]=255*((q[0]+1)/2)|0;j[x+1]=255*(q[1]+0.5)|0;j[x+2]=255*q[2]|0;j[x+3]=255}g.putImageData(m,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}}; D=4*(o*d+i);j[D]=255*((r[0]+1)/2)|0;j[D+1]=255*(r[1]+0.5)|0;j[D+2]=255*r[2]|0;j[D+3]=255}g.putImageData(l,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
...@@ -18,66 +18,66 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this. ...@@ -18,66 +18,66 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]}; normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}; THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3; THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
THREE.Ray=function(a,b){function c(a,b,c){m.sub(c,a);p=m.dot(b);s=q.add(a,o.copy(b).multiplyScalar(p));return r=c.distanceTo(s)}function d(a,b,c,d){m.sub(d,b);q.sub(c,b);o.sub(a,b);v=m.dot(m);D=m.dot(q);t=m.dot(o);A=q.dot(q);w=q.dot(o);y=1/(v*A-D*D);F=(A*t-D*w)*y;J=(v*w-D*t)*y;return 0<=F&&0<=J&&1>F+J}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b])); THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);u=q.dot(b);r=o.add(a,p.copy(b).multiplyScalar(u));return y=c.distanceTo(r)}function d(a,b,c,d){q.sub(d,b);o.sub(c,b);p.sub(a,b);D=q.dot(q);s=q.dot(o);B=q.dot(p);w=o.dot(o);z=o.dot(p);G=1/(D*w-s*s);J=(w*B-s*z)*G;E=(D*z-s*B)*G;return 0<=J&&0<=E&&1>J+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){var o= d.sort(function(a,b){return a.distance-b.distance});return d};var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};
c(this.origin,this.direction,a.matrixWorld.getPosition()),p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return m;var q,r,t=a.geometry,v=t.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,p=t.faces.length;o<p;o++)if(b=t.faces[o],k.copy(this.origin),i.copy(this.direction),s=a.matrixWorld,j=s.multiplyVector3(j.copy(b.centroid)).subSelf(k), o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return o;var r,s,u=a.geometry,y=u.vertices,v;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,q=u.faces.length;p<q;p++)if(b=u.faces[p],i.copy(this.origin),j.copy(this.direction),
l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal)),q=i.dot(l),!(1.0E-4>Math.abs(q))&&(r=l.dot(j)/q,!(0>r)&&(a.doubleSided||(a.flipSided?0<q:0>q))))if(n.add(k,i.multiplyScalar(r)),b instanceof THREE.Face3)e=s.multiplyVector3(e.copy(v[b.a].position)),f=s.multiplyVector3(f.copy(v[b.b].position)),g=s.multiplyVector3(g.copy(v[b.c].position)),d(n,e,f,g)&&(b={distance:k.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b));else if(b instanceof THREE.Face4&&(e=s.multiplyVector3(e.copy(v[b.a].position)), v=a.matrixWorld,k=v.multiplyVector3(k.copy(b.centroid)).subSelf(i),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),r=j.dot(n),!(Math.abs(r)<e)&&(s=n.dot(k)/r,!(0>s)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(m.add(i,j.multiplyScalar(s)),b instanceof THREE.Face3)f=v.multiplyVector3(f.copy(y[b.a].position)),g=v.multiplyVector3(g.copy(y[b.b].position)),h=v.multiplyVector3(h.copy(y[b.c].position)),d(m,f,g,h)&&(b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b));else if(b instanceof
f=s.multiplyVector3(f.copy(v[b.b].position)),g=s.multiplyVector3(g.copy(v[b.c].position)),h=s.multiplyVector3(h.copy(v[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:k.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var m=new THREE.Vector3,q=new THREE.Vector3,o=new THREE.Vector3,p,s,r,v,D,t,A,w,y,F,J}; THREE.Face4&&(f=v.multiplyVector3(f.copy(y[b.a].position)),g=v.multiplyVector3(g.copy(y[b.b].position)),h=v.multiplyVector3(h.copy(y[b.c].position)),l=v.multiplyVector3(l.copy(y[b.d].position)),d(m,f,g,l)||d(m,g,h,l)))b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},o.push(b)}return o};var q=new THREE.Vector3,o=new THREE.Vector3,p=new THREE.Vector3,u,r,y,D,s,B,w,z,G,J,E};
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,l){h=!1;b=f;c=g;d=j;e=l;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points= THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,k){h=!1;b=f;c=g;d=j;e=k;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
function(f,g,j,l,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<l?g<m?g:m:l<m?l:m,d=f>j?f>n?f:n:j>n?j:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e> function(f,g,j,k,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<k?g<m?g:m:k<m?k:m,d=f>j?f>n?f:n:j>n?j:n,e=g>k?g>m?g:m:k>m?k:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<k?g<m?g<c?g:c:m<c?m:c:k<m?k<c?k:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>k?g>m?g>e?g:e:m>e?m:e:k>m?k>e?k:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}}; f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]}; THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,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.Matrix3.prototype={constructor:THREE.Matrix3,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,g,h,k,i,j,l,n,m,q,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,k||0,i||0,void 0!==j?j:1,l||0,n||0,m||0,q||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,i,j,k,n,m,q,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,l||0,i||0,void 0!==j?j:1,k||0,n||0,m||0,q||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,i,j,l,n,m,q,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=k;this.n32=i;this.n33=j;this.n34=l;this.n41=n;this.n42=m;this.n43=q;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,i,j,k,n,m,q,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=l;this.n32=i;this.n33=j;this.n34=k;this.n41=n;this.n42=m;this.n43=q;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,q=a.n41,o=a.n42,p=a.n43, b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,l=a.n23,i=a.n24,j=a.n31,k=a.n32,n=a.n33,m=a.n34,q=a.n41,o=a.n42,p=a.n43,
s=a.n44,r=b.n11,v=b.n12,D=b.n13,t=b.n14,A=b.n21,w=b.n22,y=b.n23,F=b.n24,J=b.n31,H=b.n32,I=b.n33,P=b.n34,Q=b.n41,R=b.n42,S=b.n43,T=b.n44;this.n11=c*r+d*A+e*J+f*Q;this.n12=c*v+d*w+e*H+f*R;this.n13=c*D+d*y+e*I+f*S;this.n14=c*t+d*F+e*P+f*T;this.n21=g*r+h*A+k*J+i*Q;this.n22=g*v+h*w+k*H+i*R;this.n23=g*D+h*y+k*I+i*S;this.n24=g*t+h*F+k*P+i*T;this.n31=j*r+l*A+n*J+m*Q;this.n32=j*v+l*w+n*H+m*R;this.n33=j*D+l*y+n*I+m*S;this.n34=j*t+l*F+n*P+m*T;this.n41=q*r+o*A+p*J+s*Q;this.n42=q*v+o*w+p*H+s*R;this.n43=q*D+o* u=a.n44,r=b.n11,y=b.n12,D=b.n13,s=b.n14,B=b.n21,w=b.n22,z=b.n23,G=b.n24,J=b.n31,E=b.n32,I=b.n33,P=b.n34,Q=b.n41,R=b.n42,S=b.n43,T=b.n44;this.n11=c*r+d*B+e*J+f*Q;this.n12=c*y+d*w+e*E+f*R;this.n13=c*D+d*z+e*I+f*S;this.n14=c*s+d*G+e*P+f*T;this.n21=g*r+h*B+l*J+i*Q;this.n22=g*y+h*w+l*E+i*R;this.n23=g*D+h*z+l*I+i*S;this.n24=g*s+h*G+l*P+i*T;this.n31=j*r+k*B+n*J+m*Q;this.n32=j*y+k*w+n*E+m*R;this.n33=j*D+k*z+n*I+m*S;this.n34=j*s+k*G+n*P+m*T;this.n41=q*r+o*B+p*J+u*Q;this.n42=q*y+o*w+p*E+u*R;this.n43=q*D+o*
y+p*I+s*S;this.n44=q*t+o*F+p*P+s*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(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},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*= z+p*I+u*S;this.n44=q*s+o*G+p*P+u*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(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},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},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},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* 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},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},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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();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* 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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,k=this.n31,i=this.n32,j=this.n33,l=this.n34,n=this.n41,m=this.n42,q=this.n43,o=this.n44;return d*g*i*n-c*h*i*n-d*f*j*n+b*h*j*n+c*f*l*n-b*g*l*n-d*g*k*m+c*h*k*m+d*e*j*m-a*h*j*m-c*e*l*m+a*g*l*m+d*f*k*q-b*h*k*q-d*e*i*q+a*h*i*q+b*e*l*q-a*f*l*q-c*f*k*o+b*g*k*o+c*e*i*o-a*g*i*o-b*e*j*o+a*f*j*o},transpose:function(){var a; 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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,l=this.n31,i=this.n32,j=this.n33,k=this.n34,n=this.n41,m=this.n42,q=this.n43,o=this.n44;return d*g*i*n-c*h*i*n-d*f*j*n+b*h*j*n+c*f*k*n-b*g*k*n-d*g*l*m+c*h*l*m+d*e*j*m-a*h*j*m-c*e*k*m+a*g*k*m+d*f*l*q-b*h*l*q-d*e*i*q+a*h*i*q+b*e*k*q-a*f*k*q-c*f*l*o+b*g*l*o+c*e*i*o-a*g*i*o-b*e*j*o+a*f*j*o},transpose:function(){var a;
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;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=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;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(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31; a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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}, 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},setRotationX: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},setRotationY: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},setRotationZ: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}, 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},setRotationX: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},setRotationY: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},setRotationZ: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},
setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,i=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,i*g+c,i*h-d*f,0,k*h-d*g,i*h+d*f,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12, setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,i=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,i*g+c,i*h-d*f,0,l*h-d*g,i*h+d*f,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,k=a.n24,i=a.n31,j=a.n32,l=a.n33,n=a.n34,m=a.n41,q=a.n42,o=a.n43,p=a.n44;this.n11=h*n*q-k*l*q+k*j*o-g*n*o-h*j*p+g*l*p;this.n12=e*l*q-d*n*q-e*j*o+c*n*o+d*j*p-c*l*p;this.n13=d*k*q-e*h*q+e*g*o-c*k*o-d*g*p+c*h*p;this.n14=e*h*j-d*k*j-e*g*l+c*k*l+d*g*n-c*h*n;this.n21=k*l*m-h*n*m-k*i*o+f*n*o+h*i*p-f*l*p;this.n22=d*n*m-e*l*m+ this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,l=a.n24,i=a.n31,j=a.n32,k=a.n33,n=a.n34,m=a.n41,q=a.n42,o=a.n43,p=a.n44;this.n11=h*n*q-l*k*q+l*j*o-g*n*o-h*j*p+g*k*p;this.n12=e*k*q-d*n*q-e*j*o+c*n*o+d*j*p-c*k*p;this.n13=d*l*q-e*h*q+e*g*o-c*l*o-d*g*p+c*h*p;this.n14=e*h*j-d*l*j-e*g*k+c*l*k+d*g*n-c*h*n;this.n21=l*k*m-h*n*m-l*i*o+f*n*o+h*i*p-f*k*p;this.n22=d*n*m-e*k*m+
e*i*o-b*n*o-d*i*p+b*l*p;this.n23=e*h*m-d*k*m-e*f*o+b*k*o+d*f*p-b*h*p;this.n24=d*k*i-e*h*i+e*f*l-b*k*l-d*f*n+b*h*n;this.n31=g*n*m-k*j*m+k*i*q-f*n*q-g*i*p+f*j*p;this.n32=e*j*m-c*n*m-e*i*q+b*n*q+c*i*p-b*j*p;this.n33=c*k*m-e*g*m+e*f*q-b*k*q-c*f*p+b*g*p;this.n34=e*g*i-c*k*i-e*f*j+b*k*j+c*f*n-b*g*n;this.n41=h*j*m-g*l*m-h*i*q+f*l*q+g*i*o-f*j*o;this.n42=c*l*m-d*j*m+d*i*q-b*l*q-c*i*o+b*j*o;this.n43=d*g*m-c*h*m-d*f*q+b*h*q+c*f*o-b*g*o;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*l+b*g*l;this.multiplyScalar(1/a.determinant()); e*i*o-b*n*o-d*i*p+b*k*p;this.n23=e*h*m-d*l*m-e*f*o+b*l*o+d*f*p-b*h*p;this.n24=d*l*i-e*h*i+e*f*k-b*l*k-d*f*n+b*h*n;this.n31=g*n*m-l*j*m+l*i*q-f*n*q-g*i*p+f*j*p;this.n32=e*j*m-c*n*m-e*i*q+b*n*q+c*i*p-b*j*p;this.n33=c*l*m-e*g*m+e*f*q-b*l*q-c*f*p+b*g*p;this.n34=e*g*i-c*l*i-e*f*j+b*l*j+c*f*n-b*g*n;this.n41=h*j*m-g*k*m-h*i*q+f*k*q+g*i*o-f*j*o;this.n42=c*k*m-d*j*m+d*i*q-b*k*q-c*i*o+b*j*o;this.n43=d*g*m-c*h*m-d*f*q+b*h*q+c*f*o-b*g*o;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*k+b*g*k;this.multiplyScalar(1/a.determinant());
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*h,i=g*e,j=d*h,l=d*e;this.n11=k+l*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=l+k*c;this.n33=f*g;break;case "ZXY":k=g*h;i=g*e;j=d*h;l=d*e;this.n11=k-l*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=l-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k= return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=g*h,i=g*e,j=d*h,k=d*e;this.n11=l+k*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=k+l*c;this.n33=f*g;break;case "ZXY":l=g*h;i=g*e;j=d*h;k=d*e;this.n11=l-k*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=k-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l=
f*h;i=f*e;j=c*h;l=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=k*d+l;this.n21=g*e;this.n22=l*d+k;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;i=f*d;j=c*g;l=c*d;this.n11=g*h;this.n12=l-k*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=k-l*e;break;case "XZY":k=f*g;i=f*d;j=c*g;l=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+l;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=l*e+k;break;default:k=f*h,i=f* f*h;i=f*e;j=c*h;k=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=l*d+k;this.n21=g*e;this.n22=k*d+l;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;i=f*d;j=c*g;k=c*d;this.n11=g*h;this.n12=k-l*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=l-k*e;break;case "XZY":l=f*g;i=f*d;j=c*g;k=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=l*e+k;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=k*e+l;break;default:l=f*h,i=f*
e,j=c*h,l=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=k-l*d,this.n23=-c*g,this.n31=l-k*d,this.n32=j+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,k=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*= e,j=c*h,k=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=l-k*d,this.n23=-c*g,this.n31=k-l*d,this.n32=j+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,l=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34; this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1=== return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,k=Math.cos(b),i=Math.sin(b),j=1-k,l=c*d*j,n=c*e*j,j=d*e*j,c=c*i,m=d*i,i=e*i,e=f+(1-f)*k,f=l+i,d=n-m,l=l-i,g=g+(1-g)*k,i=j+c,n=n+m,j=j-c,h=h+(1-h)*k,k=this.n11,c=this.n21,m=this.n31,q=this.n41,o=this.n12,p=this.n22,s=this.n32,r=this.n42,v=this.n13,D=this.n23,t=this.n33,A=this.n43;this.n11=e*k+f*o+d*v;this.n21=e*c+f*p+d*D;this.n31=e*m+f*s+d*t;this.n41=e*q+f*r+d*A;this.n12=l*k+g*o+i*v;this.n22= a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,l=Math.cos(b),i=Math.sin(b),j=1-l,k=c*d*j,n=c*e*j,j=d*e*j,c=c*i,m=d*i,i=e*i,e=f+(1-f)*l,f=k+i,d=n-m,k=k-i,g=g+(1-g)*l,i=j+c,n=n+m,j=j-c,h=h+(1-h)*l,l=this.n11,c=this.n21,m=this.n31,q=this.n41,o=this.n12,p=this.n22,u=this.n32,r=this.n42,y=this.n13,D=this.n23,s=this.n33,B=this.n43;this.n11=e*l+f*o+d*y;this.n21=e*c+f*p+d*D;this.n31=e*m+f*u+d*s;this.n41=e*q+f*r+d*B;this.n12=k*l+g*o+i*y;this.n22=
l*c+g*p+i*D;this.n32=l*m+g*s+i*t;this.n42=l*q+g*r+i*A;this.n13=n*k+j*o+h*v;this.n23=n*c+j*p+h*D;this.n33=n*m+j*s+h*t;this.n43=n*q+j*r+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*k;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41, k*c+g*p+i*D;this.n32=k*m+g*u+i*s;this.n42=k*q+g*r+i*B;this.n13=n*l+j*o+h*y;this.n23=n*c+j*p+h*D;this.n33=n*m+j*u+h*s;this.n43=n*q+j*r+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*l;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*k;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,k=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*k;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*k-a*e;return this}, f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*l;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*l;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*l-a*e;return this},
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}}; translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
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,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;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,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*i;c[7]=a*j;c[8]=a*k;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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 g,h,k,i;g=new THREE.Matrix4;h=b-a;k=c-d;i=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,l,i;g=new THREE.Matrix4;h=b-a;l=c-d;i=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(a=== THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(a===
this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}}, this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},
getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y, getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0; this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[k]=i[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0} THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[l]=i[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
var e,f,g=[],h,k,i=[],j,l,n=[],m,q=[],o,p,s=[],r,v,D=[],t={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,w=new THREE.Vector4,y=new THREE.Matrix4,F=new THREE.Matrix4,J=new THREE.Frustum,H=new THREE.Vector4,I=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);y.multiply(b.projectionMatrix,b.matrixWorldInverse);y.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);y.multiply(b.matrixWorld, var e,f,g=[],h,l,i=[],j,k,n=[],m,q=[],o,p,u=[],r,y,D=[],s={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,w=new THREE.Vector4,z=new THREE.Matrix4,G=new THREE.Matrix4,J=new THREE.Frustum,E=new THREE.Vector4,I=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,
b.projectionMatrixInverse);y.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||J.contains(b))?(y.multiplyVector3(A.copy(b.position)),e=a(),e.object= b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||J.contains(b))?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=
b,e.z=A.z,t.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(y.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,t.sprites.push(e)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,A=e.far,N=!1,U,L,B,G,u,C,z,E,x,K,M,X,V,W,O;v=p=m=l=0;t.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), b,e.z=B.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,s.sprites.push(e)):b instanceof THREE.Light&&s.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,B=e.far,N=!1,U,L,v,H,t,C,A,F,x,K,M,X,V,W,O;y=p=m=k=0;s.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);y.multiply(e.projectionMatrix,e.matrixWorldInverse);J.setFromMatrix(y);t=this.projectGraph(a,!1);for(a=0,U=t.objects.length;a<U;a++)if(x=t.objects[a].object,K=x.matrixWorld,k=0,x instanceof THREE.Mesh){M=x.geometry;X=x.geometry.materials;G=M.vertices;V=M.faces;W=M.faceVertexUvs;M=x.matrixRotationWorld.extractRotation(K);for(L=0,B=G.length;L<B;L++)h=b(),h.positionWorld.copy(G[L].position),K.multiplyVector3(h.positionWorld), a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);J.setFromMatrix(z);s=this.projectGraph(a,!1);for(a=0,U=s.objects.length;a<U;a++)if(x=s.objects[a].object,K=x.matrixWorld,l=0,x instanceof THREE.Mesh){M=x.geometry;X=x.geometry.materials;H=M.vertices;V=M.faces;W=M.faceVertexUvs;M=x.matrixRotationWorld.extractRotation(K);for(L=0,v=H.length;L<v;L++)h=b(),h.positionWorld.copy(H[L].position),K.multiplyVector3(h.positionWorld),
h.positionScreen.copy(h.positionWorld),y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<A;for(G=0,L=V.length;G<L;G++){B=V[G];if(B instanceof THREE.Face3)if(u=i[B.a],C=i[B.b],z=i[B.c],u.visible&&C.visible&&z.visible)if(N=0>(z.positionScreen.x-u.positionScreen.x)*(C.positionScreen.y-u.positionScreen.y)-(z.positionScreen.y-u.positionScreen.y)*(C.positionScreen.x-u.positionScreen.x),x.doubleSided|| h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<B;for(H=0,L=V.length;H<L;H++){v=V[H];if(v instanceof THREE.Face3)if(t=i[v.a],C=i[v.b],A=i[v.c],t.visible&&C.visible&&A.visible)if(N=0>(A.positionScreen.x-t.positionScreen.x)*(C.positionScreen.y-t.positionScreen.y)-(A.positionScreen.y-t.positionScreen.y)*(C.positionScreen.x-t.positionScreen.x),x.doubleSided||
N!=x.flipSided)E=n[l]=n[l]||new THREE.RenderableFace3,l++,j=E,j.v1.copy(u),j.v2.copy(C),j.v3.copy(z);else continue;else continue;else if(B instanceof THREE.Face4)if(u=i[B.a],C=i[B.b],z=i[B.c],E=i[B.d],u.visible&&C.visible&&z.visible&&E.visible)if(N=0>(E.positionScreen.x-u.positionScreen.x)*(C.positionScreen.y-u.positionScreen.y)-(E.positionScreen.y-u.positionScreen.y)*(C.positionScreen.x-u.positionScreen.x)||0>(C.positionScreen.x-z.positionScreen.x)*(E.positionScreen.y-z.positionScreen.y)-(C.positionScreen.y- N!=x.flipSided)F=n[k]=n[k]||new THREE.RenderableFace3,k++,j=F,j.v1.copy(t),j.v2.copy(C),j.v3.copy(A);else continue;else continue;else if(v instanceof THREE.Face4)if(t=i[v.a],C=i[v.b],A=i[v.c],F=i[v.d],t.visible&&C.visible&&A.visible&&F.visible)if(N=0>(F.positionScreen.x-t.positionScreen.x)*(C.positionScreen.y-t.positionScreen.y)-(F.positionScreen.y-t.positionScreen.y)*(C.positionScreen.x-t.positionScreen.x)||0>(C.positionScreen.x-A.positionScreen.x)*(F.positionScreen.y-A.positionScreen.y)-(C.positionScreen.y-
z.positionScreen.y)*(E.positionScreen.x-z.positionScreen.x),x.doubleSided||N!=x.flipSided)O=q[m]=q[m]||new THREE.RenderableFace4,m++,j=O,j.v1.copy(u),j.v2.copy(C),j.v3.copy(z),j.v4.copy(E);else continue;else continue;j.normalWorld.copy(B.normal);!N&&(x.flipSided||x.doubleSided)&&j.normalWorld.negate();M.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);K.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);y.multiplyVector3(j.centroidScreen);z=B.vertexNormals;for(u= A.positionScreen.y)*(F.positionScreen.x-A.positionScreen.x),x.doubleSided||N!=x.flipSided)O=q[m]=q[m]||new THREE.RenderableFace4,m++,j=O,j.v1.copy(t),j.v2.copy(C),j.v3.copy(A),j.v4.copy(F);else continue;else continue;j.normalWorld.copy(v.normal);!N&&(x.flipSided||x.doubleSided)&&j.normalWorld.negate();M.multiplyVector3(j.normalWorld);j.centroidWorld.copy(v.centroid);K.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);z.multiplyVector3(j.centroidScreen);A=v.vertexNormals;for(t=
0,C=z.length;u<C;u++)E=j.vertexNormalsWorld[u],E.copy(z[u]),!N&&(x.flipSided||x.doubleSided)&&E.negate(),M.multiplyVector3(E);for(u=0,C=W.length;u<C;u++)if(O=W[u][G])for(z=0,E=O.length;z<E;z++)j.uvs[u][z]=O[z];j.material=x.material;j.faceMaterial=null!==B.materialIndex?X[B.materialIndex]:null;j.z=j.centroidScreen.z;t.elements.push(j)}}else if(x instanceof THREE.Line){F.multiply(y,K);G=x.geometry.vertices;u=b();u.positionScreen.copy(G[0].position);F.multiplyVector4(u.positionScreen);for(L=1,B=G.length;L< 0,C=A.length;t<C;t++)F=j.vertexNormalsWorld[t],F.copy(A[t]),!N&&(x.flipSided||x.doubleSided)&&F.negate(),M.multiplyVector3(F);for(t=0,C=W.length;t<C;t++)if(O=W[t][H])for(A=0,F=O.length;A<F;A++)j.uvs[t][A]=O[A];j.material=x.material;j.faceMaterial=null!==v.materialIndex?X[v.materialIndex]:null;j.z=j.centroidScreen.z;s.elements.push(j)}}else if(x instanceof THREE.Line){G.multiply(z,K);H=x.geometry.vertices;t=b();t.positionScreen.copy(H[0].position);G.multiplyVector4(t.positionScreen);for(L=1,v=H.length;L<
B;L++)if(u=b(),u.positionScreen.copy(G[L].position),F.multiplyVector4(u.positionScreen),C=i[k-2],H.copy(u.positionScreen),I.copy(C.positionScreen),d(H,I))H.multiplyScalar(1/H.w),I.multiplyScalar(1/I.w),K=s[p]=s[p]||new THREE.RenderableLine,p++,o=K,o.v1.positionScreen.copy(H),o.v2.positionScreen.copy(I),o.z=Math.max(H.z,I.z),o.material=x.material,t.elements.push(o)}for(a=0,U=t.sprites.length;a<U;a++)if(x=t.sprites[a].object,K=x.matrixWorld,x instanceof THREE.Particle&&(w.set(K.n14,K.n24,K.n34,1),y.multiplyVector4(w), v;L++)if(t=b(),t.positionScreen.copy(H[L].position),G.multiplyVector4(t.positionScreen),C=i[l-2],E.copy(t.positionScreen),I.copy(C.positionScreen),d(E,I))E.multiplyScalar(1/E.w),I.multiplyScalar(1/I.w),K=u[p]=u[p]||new THREE.RenderableLine,p++,o=K,o.v1.positionScreen.copy(E),o.v2.positionScreen.copy(I),o.z=Math.max(E.z,I.z),o.material=x.material,s.elements.push(o)}for(a=0,U=s.sprites.length;a<U;a++)if(x=s.sprites[a].object,K=x.matrixWorld,x instanceof THREE.Particle&&(w.set(K.n14,K.n24,K.n34,1),z.multiplyVector4(w),
w.z/=w.w,0<w.z&&1>w.z))g=D[v]=D[v]||new THREE.RenderableParticle,v++,r=g,r.x=w.x/w.w,r.y=w.y/w.w,r.z=w.z,r.rotation=x.rotation.z,r.scale.x=x.scale.x*Math.abs(r.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),r.scale.y=x.scale.y*Math.abs(r.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),r.material=x.material,t.elements.push(r);f&&t.elements.sort(c);return t}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; w.z/=w.w,0<w.z&&1>w.z))g=D[y]=D[y]||new THREE.RenderableParticle,y++,r=g,r.x=w.x/w.w,r.y=w.y/w.w,r.z=w.z,r.rotation=x.rotation.z,r.scale.x=x.scale.x*Math.abs(r.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),r.scale.y=x.scale.y*Math.abs(r.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),r.material=x.material,s.elements.push(r);f&&s.elements.sort(c);return s}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e* THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*
f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31? f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z= -Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b= this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,i=k*c+g*e-h*d,j=k*d+h*c-f*e,l=k*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=i*k+c*-f+j*-h-l*-g;b.y=j*k+c*-g+l*-f-i*-h;b.z=l*k+c*-h+i*-g-j*-f;return b}}; a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,i=l*c+g*e-h*d,j=l*d+h*c-f*e,k=l*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=i*l+c*-f+j*-h-k*-g;b.y=j*l+c*-g+k*-f-i*-h;b.z=k*l+c*-h+i*-g-j*-f;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone(); THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
...@@ -96,7 +96,7 @@ THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement= ...@@ -96,7 +96,7 @@ THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=
THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps= THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){}; !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.DataTexture=function(a,b,c,d,e,f,g,h,k,i){THREE.Texture.call(this,null,f,g,h,k,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture; 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.DataTexture=function(a,b,c,d,e,f,g,h,l,i){THREE.Texture.call(this,null,f,g,h,l,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle; THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={}; THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype; for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
...@@ -110,12 +110,12 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce ...@@ -110,12 +110,12 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene; THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])}; THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])}; THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var k,i,j,l,n,m,q,o;a=b.projectScene(c,d);for(k=0,i=a.length;k<i;k++)if(n=a[k],n instanceof THREE.RenderableParticle){q=n.x*e+e;o=n.y*f+f;for(j=0,l=n.material.length;j<l;j++)if(m=n.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=q+"px",m.style.top=o+"px"}}}; THREE.DOMRenderer=function(){var a,b,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(a,b){d=a;e=b;f=d/2;g=e/2};this.render=function(d,e){var i,j,k,n,m;a=c.projectScene(d,e);b=a.elements;for(i=0,j=b.length;i<j;i++)if(k=b[i],k instanceof THREE.RenderableParticle&&(n=k.x*f+f,m=k.y*g+g,k=k.material,k instanceof THREE.ParticleDOMMaterial))k=k.domElement,k.style.left=n+"px",k.style.top=m+"px"}};
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null}; THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null}; THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a, THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),i=k.data,j=0;j<d;j++)for(var l=1;l<e;l++){var n=0>l-1?e-1:l-1,m=(l+1)%e,q=0>j-1?d-1:j-1,o=(j+1)%d,p=[],s=[0,0,h[4*(l*d+j)]/255*b];p.push([-1,0,h[4*(l*d+q)]/255*b]);p.push([-1,-1,h[4*(n*d+q)]/255*b]);p.push([0,-1, b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,e),i=l.data,j=0;j<d;j++)for(var k=1;k<e;k++){var n=0>k-1?e-1:k-1,m=(k+1)%e,q=0>j-1?d-1:j-1,o=(j+1)%d,p=[],u=[0,0,h[4*(k*d+j)]/255*b];p.push([-1,0,h[4*(k*d+q)]/255*b]);p.push([-1,-1,h[4*(n*d+q)]/255*b]);p.push([0,-1,
h[4*(n*d+j)]/255*b]);p.push([1,-1,h[4*(n*d+o)]/255*b]);p.push([1,0,h[4*(l*d+o)]/255*b]);p.push([1,1,h[4*(m*d+o)]/255*b]);p.push([0,1,h[4*(m*d+j)]/255*b]);p.push([-1,1,h[4*(m*d+q)]/255*b]);n=[];q=p.length;for(m=0;m<q;m++){var o=p[m],r=p[(m+1)%q],o=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],r=[r[0]-s[0],r[1]-s[1],r[2]-s[2]];n.push(c([o[1]*r[2]-o[2]*r[1],o[2]*r[0]-o[0]*r[2],o[0]*r[1]-o[1]*r[0]]))}p=[0,0,0];for(m=0;m<n.length;m++)p[0]+=n[m][0],p[1]+=n[m][1],p[2]+=n[m][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length; h[4*(n*d+j)]/255*b]);p.push([1,-1,h[4*(n*d+o)]/255*b]);p.push([1,0,h[4*(k*d+o)]/255*b]);p.push([1,1,h[4*(m*d+o)]/255*b]);p.push([0,1,h[4*(m*d+j)]/255*b]);p.push([-1,1,h[4*(m*d+q)]/255*b]);n=[];q=p.length;for(m=0;m<q;m++){var o=p[m],r=p[(m+1)%q],o=[o[0]-u[0],o[1]-u[1],o[2]-u[2]],r=[r[0]-u[0],r[1]-u[1],r[2]-u[2]];n.push(c([o[1]*r[2]-o[2]*r[1],o[2]*r[0]-o[0]*r[2],o[0]*r[1]-o[1]*r[0]]))}p=[0,0,0];for(m=0;m<n.length;m++)p[0]+=n[m][0],p[1]+=n[m][1],p[2]+=n[m][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;
s=4*(l*d+j);i[s]=255*((p[0]+1)/2)|0;i[s+1]=255*(p[1]+0.5)|0;i[s+2]=255*p[2]|0;i[s+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}}; u=4*(k*d+j);i[u]=255*((p[0]+1)/2)|0;i[u+1]=255*(p[1]+0.5)|0;i[u+2]=255*p[2]|0;i[u+3]=255}g.putImageData(l,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
...@@ -18,66 +18,66 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this. ...@@ -18,66 +18,66 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]}; normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}; THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3; THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
THREE.Ray=function(a,b){function c(a,b,c){k.sub(c,a);q=k.dot(b);y=p.add(a,o.copy(b).multiplyScalar(q));return u=c.distanceTo(y)}function d(a,b,c,d){k.sub(d,b);p.sub(c,b);o.sub(a,b);D=k.dot(k);t=k.dot(p);v=k.dot(o);B=p.dot(p);x=p.dot(o);z=1/(D*B-t*t);E=(B*v-t*x)*z;C=(D*x-t*v)*z;return 0<=E&&0<=C&&1>E+C}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b])); THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);y=p.dot(b);v=o.add(a,q.copy(b).multiplyScalar(y));return D=c.distanceTo(v)}function d(a,b,c,d){p.sub(d,b);o.sub(c,b);q.sub(a,b);t=p.dot(p);u=p.dot(o);B=p.dot(q);x=o.dot(o);z=o.dot(q);E=1/(t*x-u*u);C=(x*B-u*z)*E;F=(t*z-u*B)*E;return 0<=C&&0<=F&&1>C+F}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,k=[];if(a instanceof THREE.Particle){var o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};k.push(b)}else if(a instanceof THREE.Mesh){var o= d.sort(function(a,b){return a.distance-b.distance});return d};var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){var b,o=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};
c(this.origin,this.direction,a.matrixWorld.getPosition()),p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return k;var q,t,v=a.geometry,u=v.vertices,s;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,p=v.faces.length;o<p;o++)if(b=v.faces[o],l.copy(this.origin),i.copy(this.direction),s=a.matrixWorld,j=s.multiplyVector3(j.copy(b.centroid)).subSelf(l), o.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return o;var t,u,v=a.geometry,s=v.vertices,r;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,q=v.faces.length;p<q;p++)if(b=v.faces[p],i.copy(this.origin),j.copy(this.direction),
m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),q=i.dot(m),!(1.0E-4>Math.abs(q))&&(t=m.dot(j)/q,!(0>t)&&(a.doubleSided||(a.flipSided?0<q:0>q))))if(n.add(l,i.multiplyScalar(t)),b instanceof THREE.Face3)e=s.multiplyVector3(e.copy(u[b.a].position)),f=s.multiplyVector3(f.copy(u[b.b].position)),g=s.multiplyVector3(g.copy(u[b.c].position)),d(n,e,f,g)&&(b={distance:l.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b));else if(b instanceof THREE.Face4&&(e=s.multiplyVector3(e.copy(u[b.a].position)), r=a.matrixWorld,m=r.multiplyVector3(m.copy(b.centroid)).subSelf(i),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),t=j.dot(n),!(Math.abs(t)<e)&&(u=n.dot(m)/t,!(0>u)&&(a.doubleSided||(a.flipSided?0<t:0>t))))if(l.add(i,j.multiplyScalar(u)),b instanceof THREE.Face3)f=r.multiplyVector3(f.copy(s[b.a].position)),g=r.multiplyVector3(g.copy(s[b.b].position)),h=r.multiplyVector3(h.copy(s[b.c].position)),d(l,f,g,h)&&(b={distance:i.distanceTo(l),point:l.clone(),face:b,object:a},o.push(b));else if(b instanceof
f=s.multiplyVector3(f.copy(u[b.b].position)),g=s.multiplyVector3(g.copy(u[b.c].position)),h=s.multiplyVector3(h.copy(u[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:l.distanceTo(n),point:n.clone(),face:b,object:a},k.push(b)}return k};var k=new THREE.Vector3,p=new THREE.Vector3,o=new THREE.Vector3,q,y,u,D,t,v,B,x,z,E,C}; THREE.Face4&&(f=r.multiplyVector3(f.copy(s[b.a].position)),g=r.multiplyVector3(g.copy(s[b.b].position)),h=r.multiplyVector3(h.copy(s[b.c].position)),k=r.multiplyVector3(k.copy(s[b.d].position)),d(l,f,g,k)||d(l,g,h,k)))b={distance:i.distanceTo(l),point:l.clone(),face:b,object:a},o.push(b)}return o};var p=new THREE.Vector3,o=new THREE.Vector3,q=new THREE.Vector3,y,v,D,t,u,B,x,z,E,C,F};
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,m){h=!1;b=f;c=g;d=j;e=m;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points= THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,m){h=!1;b=f;c=g;d=j;e=m;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
function(f,g,j,m,n,k){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<m?g<k?g:k:m<k?m:k,d=f>j?f>n?f:n:j>n?j:n,e=g>m?g>k?g:k:m>k?m:k):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<m?g<k?g<c?g:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>m?g>k?g>e?g:e:k>e?k:e:m>k?m>e?m:e:k>e?k:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e> function(f,g,j,m,n,l){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<m?g<l?g:l:m<l?m:l,d=f>j?f>n?f:n:j>n?j:n,e=g>m?g>l?g:l:m>l?m:l):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>m?g>l?g>e?g:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}}; f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]}; THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,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.Matrix3.prototype={constructor:THREE.Matrix3,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,g,h,l,i,j,m,n,k,p,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,l||0,i||0,void 0!==j?j:1,m||0,n||0,k||0,p||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4=function(a,b,c,d,e,f,g,h,k,i,j,m,n,l,p,o){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,k||0,i||0,void 0!==j?j:1,m||0,n||0,l||0,p||0,void 0!==o?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,i,j,m,n,k,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=l;this.n32=i;this.n33=j;this.n34=m;this.n41=n;this.n42=k;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,i,j,m,n,l,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=k;this.n32=i;this.n33=j;this.n34=m;this.n41=n;this.n42=l;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,l=a.n23,i=a.n24,j=a.n31,m=a.n32,n=a.n33,k=a.n34,p=a.n41,o=a.n42,q=a.n43, b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,o=a.n42,q=a.n43,
y=a.n44,u=b.n11,D=b.n12,t=b.n13,v=b.n14,B=b.n21,x=b.n22,z=b.n23,E=b.n24,C=b.n31,I=b.n32,A=b.n33,L=b.n34,O=b.n41,M=b.n42,Q=b.n43,T=b.n44;this.n11=c*u+d*B+e*C+f*O;this.n12=c*D+d*x+e*I+f*M;this.n13=c*t+d*z+e*A+f*Q;this.n14=c*v+d*E+e*L+f*T;this.n21=g*u+h*B+l*C+i*O;this.n22=g*D+h*x+l*I+i*M;this.n23=g*t+h*z+l*A+i*Q;this.n24=g*v+h*E+l*L+i*T;this.n31=j*u+m*B+n*C+k*O;this.n32=j*D+m*x+n*I+k*M;this.n33=j*t+m*z+n*A+k*Q;this.n34=j*v+m*E+n*L+k*T;this.n41=p*u+o*B+q*C+y*O;this.n42=p*D+o*x+q*I+y*M;this.n43=p*t+o* y=a.n44,v=b.n11,D=b.n12,t=b.n13,u=b.n14,B=b.n21,x=b.n22,z=b.n23,E=b.n24,C=b.n31,F=b.n32,A=b.n33,L=b.n34,O=b.n41,M=b.n42,Q=b.n43,T=b.n44;this.n11=c*v+d*B+e*C+f*O;this.n12=c*D+d*x+e*F+f*M;this.n13=c*t+d*z+e*A+f*Q;this.n14=c*u+d*E+e*L+f*T;this.n21=g*v+h*B+k*C+i*O;this.n22=g*D+h*x+k*F+i*M;this.n23=g*t+h*z+k*A+i*Q;this.n24=g*u+h*E+k*L+i*T;this.n31=j*v+m*B+n*C+l*O;this.n32=j*D+m*x+n*F+l*M;this.n33=j*t+m*z+n*A+l*Q;this.n34=j*u+m*E+n*L+l*T;this.n41=p*v+o*B+q*C+y*O;this.n42=p*D+o*x+q*F+y*M;this.n43=p*t+o*
z+q*A+y*Q;this.n44=p*v+o*E+q*L+y*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(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},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*= z+q*A+y*Q;this.n44=p*u+o*E+q*L+y*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(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},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},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},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* 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},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},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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();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* 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},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,l=this.n31,i=this.n32,j=this.n33,m=this.n34,n=this.n41,k=this.n42,p=this.n43,o=this.n44;return d*g*i*n-c*h*i*n-d*f*j*n+b*h*j*n+c*f*m*n-b*g*m*n-d*g*l*k+c*h*l*k+d*e*j*k-a*h*j*k-c*e*m*k+a*g*m*k+d*f*l*p-b*h*l*p-d*e*i*p+a*h*i*p+b*e*m*p-a*f*m*p-c*f*l*o+b*g*l*o+c*e*i*o-a*g*i*o-b*e*j*o+a*f*j*o},transpose:function(){var a; 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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,k=this.n31,i=this.n32,j=this.n33,m=this.n34,n=this.n41,l=this.n42,p=this.n43,o=this.n44;return d*g*i*n-c*h*i*n-d*f*j*n+b*h*j*n+c*f*m*n-b*g*m*n-d*g*k*l+c*h*k*l+d*e*j*l-a*h*j*l-c*e*m*l+a*g*m*l+d*f*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*m*p-a*f*m*p-c*f*k*o+b*g*k*o+c*e*i*o-a*g*i*o-b*e*j*o+a*f*j*o},transpose:function(){var a;
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;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=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;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(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31; a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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}, 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},setRotationX: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},setRotationY: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},setRotationZ: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}, 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},setRotationX: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},setRotationY: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},setRotationZ: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},
setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,i=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,i*g+c,i*h-d*f,0,l*h-d*g,i*h+d*f,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12, setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,i=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,i*g+c,i*h-d*f,0,k*h-d*g,i*h+d*f,e*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,l=a.n24,i=a.n31,j=a.n32,m=a.n33,n=a.n34,k=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*n*p-l*m*p+l*j*o-g*n*o-h*j*q+g*m*q;this.n12=e*m*p-d*n*p-e*j*o+c*n*o+d*j*q-c*m*q;this.n13=d*l*p-e*h*p+e*g*o-c*l*o-d*g*q+c*h*q;this.n14=e*h*j-d*l*j-e*g*m+c*l*m+d*g*n-c*h*n;this.n21=l*m*k-h*n*k-l*i*o+f*n*o+h*i*q-f*m*q;this.n22=d*n*k-e*m*k+ this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,k=a.n24,i=a.n31,j=a.n32,m=a.n33,n=a.n34,l=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*n*p-k*m*p+k*j*o-g*n*o-h*j*q+g*m*q;this.n12=e*m*p-d*n*p-e*j*o+c*n*o+d*j*q-c*m*q;this.n13=d*k*p-e*h*p+e*g*o-c*k*o-d*g*q+c*h*q;this.n14=e*h*j-d*k*j-e*g*m+c*k*m+d*g*n-c*h*n;this.n21=k*m*l-h*n*l-k*i*o+f*n*o+h*i*q-f*m*q;this.n22=d*n*l-e*m*l+
e*i*o-b*n*o-d*i*q+b*m*q;this.n23=e*h*k-d*l*k-e*f*o+b*l*o+d*f*q-b*h*q;this.n24=d*l*i-e*h*i+e*f*m-b*l*m-d*f*n+b*h*n;this.n31=g*n*k-l*j*k+l*i*p-f*n*p-g*i*q+f*j*q;this.n32=e*j*k-c*n*k-e*i*p+b*n*p+c*i*q-b*j*q;this.n33=c*l*k-e*g*k+e*f*p-b*l*p-c*f*q+b*g*q;this.n34=e*g*i-c*l*i-e*f*j+b*l*j+c*f*n-b*g*n;this.n41=h*j*k-g*m*k-h*i*p+f*m*p+g*i*o-f*j*o;this.n42=c*m*k-d*j*k+d*i*p-b*m*p-c*i*o+b*j*o;this.n43=d*g*k-c*h*k-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*m+b*g*m;this.multiplyScalar(1/a.determinant()); e*i*o-b*n*o-d*i*q+b*m*q;this.n23=e*h*l-d*k*l-e*f*o+b*k*o+d*f*q-b*h*q;this.n24=d*k*i-e*h*i+e*f*m-b*k*m-d*f*n+b*h*n;this.n31=g*n*l-k*j*l+k*i*p-f*n*p-g*i*q+f*j*q;this.n32=e*j*l-c*n*l-e*i*p+b*n*p+c*i*q-b*j*q;this.n33=c*k*l-e*g*l+e*f*p-b*k*p-c*f*q+b*g*q;this.n34=e*g*i-c*k*i-e*f*j+b*k*j+c*f*n-b*g*n;this.n41=h*j*l-g*m*l-h*i*p+f*m*p+g*i*o-f*j*o;this.n42=c*m*l-d*j*l+d*i*p-b*m*p-c*i*o+b*j*o;this.n43=d*g*l-c*h*l-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*m+b*g*m;this.multiplyScalar(1/a.determinant());
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=g*h,i=g*e,j=d*h,m=d*e;this.n11=l+m*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=m+l*c;this.n33=f*g;break;case "ZXY":l=g*h;i=g*e;j=d*h;m=d*e;this.n11=l-m*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=m-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l= return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*h,i=g*e,j=d*h,m=d*e;this.n11=k+m*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=m+k*c;this.n33=f*g;break;case "ZXY":k=g*h;i=g*e;j=d*h;m=d*e;this.n11=k-m*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=m-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=
f*h;i=f*e;j=c*h;m=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=l*d+m;this.n21=g*e;this.n22=m*d+l;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;i=f*d;j=c*g;m=c*d;this.n11=g*h;this.n12=m-l*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=l-m*e;break;case "XZY":l=f*g;i=f*d;j=c*g;m=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=l*e+m;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=m*e+l;break;default:l=f*h,i=f* f*h;i=f*e;j=c*h;m=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=k*d+m;this.n21=g*e;this.n22=m*d+k;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;i=f*d;j=c*g;m=c*d;this.n11=g*h;this.n12=m-k*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=k-m*e;break;case "XZY":k=f*g;i=f*d;j=c*g;m=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+m;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=m*e+k;break;default:k=f*h,i=f*
e,j=c*h,m=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=l-m*d,this.n23=-c*g,this.n31=m-l*d,this.n32=j+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,l=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*= e,j=c*h,m=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=k-m*d,this.n23=-c*g,this.n31=m-k*d,this.n32=j+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,k=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34; this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1=== return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,l=Math.cos(b),i=Math.sin(b),j=1-l,m=c*d*j,n=c*e*j,j=d*e*j,c=c*i,k=d*i,i=e*i,e=f+(1-f)*l,f=m+i,d=n-k,m=m-i,g=g+(1-g)*l,i=j+c,n=n+k,j=j-c,h=h+(1-h)*l,l=this.n11,c=this.n21,k=this.n31,p=this.n41,o=this.n12,q=this.n22,y=this.n32,u=this.n42,D=this.n13,t=this.n23,v=this.n33,B=this.n43;this.n11=e*l+f*o+d*D;this.n21=e*c+f*q+d*t;this.n31=e*k+f*y+d*v;this.n41=e*p+f*u+d*B;this.n12=m*l+g*o+i*D;this.n22= a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,k=Math.cos(b),i=Math.sin(b),j=1-k,m=c*d*j,n=c*e*j,j=d*e*j,c=c*i,l=d*i,i=e*i,e=f+(1-f)*k,f=m+i,d=n-l,m=m-i,g=g+(1-g)*k,i=j+c,n=n+l,j=j-c,h=h+(1-h)*k,k=this.n11,c=this.n21,l=this.n31,p=this.n41,o=this.n12,q=this.n22,y=this.n32,v=this.n42,D=this.n13,t=this.n23,u=this.n33,B=this.n43;this.n11=e*k+f*o+d*D;this.n21=e*c+f*q+d*t;this.n31=e*l+f*y+d*u;this.n41=e*p+f*v+d*B;this.n12=m*k+g*o+i*D;this.n22=
m*c+g*q+i*t;this.n32=m*k+g*y+i*v;this.n42=m*p+g*u+i*B;this.n13=n*l+j*o+h*D;this.n23=n*c+j*q+h*t;this.n33=n*k+j*y+h*v;this.n43=n*p+j*u+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*l;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41, m*c+g*q+i*t;this.n32=m*l+g*y+i*u;this.n42=m*p+g*v+i*B;this.n13=n*k+j*o+h*D;this.n23=n*c+j*q+h*t;this.n33=n*l+j*y+h*u;this.n43=n*p+j*v+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*k;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*l;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*l;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*l-a*e;return this}, f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*k;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,k=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*k;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*k-a*e;return this},
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}}; translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
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,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*i;c[7]=a*j;c[8]=a*m;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,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*i;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*m;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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 g,h,l,i;g=new THREE.Matrix4;h=b-a;l=c-d;i=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,k,i;g=new THREE.Matrix4;h=b-a;k=c-d;i=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(a=== THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(a===
this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}}, this)console.warn("THREE: Object3D.add(): An object can't be added as a child of itself.");else if(-1===this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},
getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y, getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0; this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[l]=i[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0} THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[k]=i[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
var e,f,g=[],h,l,i=[],j,m,n=[],k,p=[],o,q,y=[],u,D,t=[],v={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,x=new THREE.Vector4,z=new THREE.Matrix4,E=new THREE.Matrix4,C=new THREE.Frustum,I=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld, var e,f,g=[],h,k,i=[],j,m,n=[],l,p=[],o,q,y=[],v,D,t=[],u={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,x=new THREE.Vector4,z=new THREE.Matrix4,E=new THREE.Matrix4,C=new THREE.Frustum,F=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiply(b.matrixWorld,
b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||C.contains(b))?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object= b.projectionMatrixInverse);z.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||C.contains(b))?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=
b,e.z=B.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,B=e.far,R=!1,U,s,r,J,w,G,H,K,F,N,P,X,V,W,S;D=q=k=m=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."), b,e.z=B.z,u.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,u.sprites.push(e)):b instanceof THREE.Light&&u.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&u.objects.sort(c);return u};this.projectScene=function(a,e,f){var g=e.near,B=e.far,R=!1,U,s,r,J,w,H,I,K,G,N,P,X,V,W,S;D=q=l=m=0;u.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(z);v=this.projectGraph(a,!1);for(a=0,U=v.objects.length;a<U;a++)if(F=v.objects[a].object,N=F.matrixWorld,l=0,F instanceof THREE.Mesh){P=F.geometry;X=F.geometry.materials;J=P.vertices;V=P.faces;W=P.faceVertexUvs;P=F.matrixRotationWorld.extractRotation(N);for(s=0,r=J.length;s<r;s++)h=b(),h.positionWorld.copy(J[s].position),N.multiplyVector3(h.positionWorld), a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);C.setFromMatrix(z);u=this.projectGraph(a,!1);for(a=0,U=u.objects.length;a<U;a++)if(G=u.objects[a].object,N=G.matrixWorld,k=0,G instanceof THREE.Mesh){P=G.geometry;X=G.geometry.materials;J=P.vertices;V=P.faces;W=P.faceVertexUvs;P=G.matrixRotationWorld.extractRotation(N);for(s=0,r=J.length;s<r;s++)h=b(),h.positionWorld.copy(J[s].position),N.multiplyVector3(h.positionWorld),
h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<B;for(J=0,s=V.length;J<s;J++){r=V[J];if(r instanceof THREE.Face3)if(w=i[r.a],G=i[r.b],H=i[r.c],w.visible&&G.visible&&H.visible)if(R=0>(H.positionScreen.x-w.positionScreen.x)*(G.positionScreen.y-w.positionScreen.y)-(H.positionScreen.y-w.positionScreen.y)*(G.positionScreen.x-w.positionScreen.x),F.doubleSided|| h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<B;for(J=0,s=V.length;J<s;J++){r=V[J];if(r instanceof THREE.Face3)if(w=i[r.a],H=i[r.b],I=i[r.c],w.visible&&H.visible&&I.visible)if(R=0>(I.positionScreen.x-w.positionScreen.x)*(H.positionScreen.y-w.positionScreen.y)-(I.positionScreen.y-w.positionScreen.y)*(H.positionScreen.x-w.positionScreen.x),G.doubleSided||
R!=F.flipSided)K=n[m]=n[m]||new THREE.RenderableFace3,m++,j=K,j.v1.copy(w),j.v2.copy(G),j.v3.copy(H);else continue;else continue;else if(r instanceof THREE.Face4)if(w=i[r.a],G=i[r.b],H=i[r.c],K=i[r.d],w.visible&&G.visible&&H.visible&&K.visible)if(R=0>(K.positionScreen.x-w.positionScreen.x)*(G.positionScreen.y-w.positionScreen.y)-(K.positionScreen.y-w.positionScreen.y)*(G.positionScreen.x-w.positionScreen.x)||0>(G.positionScreen.x-H.positionScreen.x)*(K.positionScreen.y-H.positionScreen.y)-(G.positionScreen.y- R!=G.flipSided)K=n[m]=n[m]||new THREE.RenderableFace3,m++,j=K,j.v1.copy(w),j.v2.copy(H),j.v3.copy(I);else continue;else continue;else if(r instanceof THREE.Face4)if(w=i[r.a],H=i[r.b],I=i[r.c],K=i[r.d],w.visible&&H.visible&&I.visible&&K.visible)if(R=0>(K.positionScreen.x-w.positionScreen.x)*(H.positionScreen.y-w.positionScreen.y)-(K.positionScreen.y-w.positionScreen.y)*(H.positionScreen.x-w.positionScreen.x)||0>(H.positionScreen.x-I.positionScreen.x)*(K.positionScreen.y-I.positionScreen.y)-(H.positionScreen.y-
H.positionScreen.y)*(K.positionScreen.x-H.positionScreen.x),F.doubleSided||R!=F.flipSided)S=p[k]=p[k]||new THREE.RenderableFace4,k++,j=S,j.v1.copy(w),j.v2.copy(G),j.v3.copy(H),j.v4.copy(K);else continue;else continue;j.normalWorld.copy(r.normal);!R&&(F.flipSided||F.doubleSided)&&j.normalWorld.negate();P.multiplyVector3(j.normalWorld);j.centroidWorld.copy(r.centroid);N.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);z.multiplyVector3(j.centroidScreen);H=r.vertexNormals;for(w= I.positionScreen.y)*(K.positionScreen.x-I.positionScreen.x),G.doubleSided||R!=G.flipSided)S=p[l]=p[l]||new THREE.RenderableFace4,l++,j=S,j.v1.copy(w),j.v2.copy(H),j.v3.copy(I),j.v4.copy(K);else continue;else continue;j.normalWorld.copy(r.normal);!R&&(G.flipSided||G.doubleSided)&&j.normalWorld.negate();P.multiplyVector3(j.normalWorld);j.centroidWorld.copy(r.centroid);N.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);z.multiplyVector3(j.centroidScreen);I=r.vertexNormals;for(w=
0,G=H.length;w<G;w++)K=j.vertexNormalsWorld[w],K.copy(H[w]),!R&&(F.flipSided||F.doubleSided)&&K.negate(),P.multiplyVector3(K);for(w=0,G=W.length;w<G;w++)if(S=W[w][J])for(H=0,K=S.length;H<K;H++)j.uvs[w][H]=S[H];j.material=F.material;j.faceMaterial=null!==r.materialIndex?X[r.materialIndex]:null;j.z=j.centroidScreen.z;v.elements.push(j)}}else if(F instanceof THREE.Line){E.multiply(z,N);J=F.geometry.vertices;w=b();w.positionScreen.copy(J[0].position);E.multiplyVector4(w.positionScreen);for(s=1,r=J.length;s< 0,H=I.length;w<H;w++)K=j.vertexNormalsWorld[w],K.copy(I[w]),!R&&(G.flipSided||G.doubleSided)&&K.negate(),P.multiplyVector3(K);for(w=0,H=W.length;w<H;w++)if(S=W[w][J])for(I=0,K=S.length;I<K;I++)j.uvs[w][I]=S[I];j.material=G.material;j.faceMaterial=null!==r.materialIndex?X[r.materialIndex]:null;j.z=j.centroidScreen.z;u.elements.push(j)}}else if(G instanceof THREE.Line){E.multiply(z,N);J=G.geometry.vertices;w=b();w.positionScreen.copy(J[0].position);E.multiplyVector4(w.positionScreen);for(s=1,r=J.length;s<
r;s++)if(w=b(),w.positionScreen.copy(J[s].position),E.multiplyVector4(w.positionScreen),G=i[l-2],I.copy(w.positionScreen),A.copy(G.positionScreen),d(I,A))I.multiplyScalar(1/I.w),A.multiplyScalar(1/A.w),N=y[q]=y[q]||new THREE.RenderableLine,q++,o=N,o.v1.positionScreen.copy(I),o.v2.positionScreen.copy(A),o.z=Math.max(I.z,A.z),o.material=F.material,v.elements.push(o)}for(a=0,U=v.sprites.length;a<U;a++)if(F=v.sprites[a].object,N=F.matrixWorld,F instanceof THREE.Particle&&(x.set(N.n14,N.n24,N.n34,1),z.multiplyVector4(x), r;s++)if(w=b(),w.positionScreen.copy(J[s].position),E.multiplyVector4(w.positionScreen),H=i[k-2],F.copy(w.positionScreen),A.copy(H.positionScreen),d(F,A))F.multiplyScalar(1/F.w),A.multiplyScalar(1/A.w),N=y[q]=y[q]||new THREE.RenderableLine,q++,o=N,o.v1.positionScreen.copy(F),o.v2.positionScreen.copy(A),o.z=Math.max(F.z,A.z),o.material=G.material,u.elements.push(o)}for(a=0,U=u.sprites.length;a<U;a++)if(G=u.sprites[a].object,N=G.matrixWorld,G instanceof THREE.Particle&&(x.set(N.n14,N.n24,N.n34,1),z.multiplyVector4(x),
x.z/=x.w,0<x.z&&1>x.z))g=t[D]=t[D]||new THREE.RenderableParticle,D++,u=g,u.x=x.x/x.w,u.y=x.y/x.w,u.z=x.z,u.rotation=F.rotation.z,u.scale.x=F.scale.x*Math.abs(u.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),u.scale.y=F.scale.y*Math.abs(u.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),u.material=F.material,v.elements.push(u);f&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; x.z/=x.w,0<x.z&&1>x.z))g=t[D]=t[D]||new THREE.RenderableParticle,D++,v=g,v.x=x.x/x.w,v.y=x.y/x.w,v.z=x.z,v.rotation=G.rotation.z,v.scale.x=G.scale.x*Math.abs(v.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),v.scale.y=G.scale.y*Math.abs(v.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),v.material=G.material,u.elements.push(v);f&&u.elements.sort(c);return u}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e* THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*
f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31? f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z= -Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b= this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,i=l*c+g*e-h*d,j=l*d+h*c-f*e,m=l*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=i*l+c*-f+j*-h-m*-g;b.y=j*l+c*-g+m*-f-i*-h;b.z=m*l+c*-h+i*-g-j*-f;return b}}; a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,i=k*c+g*e-h*d,j=k*d+h*c-f*e,m=k*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=i*k+c*-f+j*-h-m*-g;b.y=j*k+c*-g+m*-f-i*-h;b.z=m*k+c*-h+i*-g-j*-f;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone(); THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
...@@ -91,9 +91,9 @@ b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a< ...@@ -91,9 +91,9 @@ b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<
this.faces[a],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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal), this.faces[a],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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],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])):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]))},computeMorphNormals:function(){var a, d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],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])):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]))},computeMorphNormals:function(){var a,
b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]= b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,l,i;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=new THREE.Vector3,i=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(l),h.push(i)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals(); {};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,k,i;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],k=new THREE.Vector3,i=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(k),h.push(i)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],l=g.faceNormals[c],i=g.vertexNormals[c],l.copy(e.normal),e instanceof THREE.Face3?(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])):(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2]),i.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a, f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],k=g.faceNormals[c],i=g.vertexNormals[c],k.copy(e.normal),e instanceof THREE.Face3?(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])):(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2]),i.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
b,c,d,e,f,w){h=a.vertices[b].position;l=a.vertices[c].position;i=a.vertices[d].position;j=g[e];m=g[f];n=g[w];k=l.x-h.x;p=i.x-h.x;o=l.y-h.y;q=i.y-h.y;y=l.z-h.z;u=i.z-h.z;D=m.u-j.u;t=n.u-j.u;v=m.v-j.v;B=n.v-j.v;x=1/(D*B-t*v);I.set((B*k-v*p)*x,(B*o-v*q)*x,(B*y-v*u)*x);A.set((D*p-t*k)*x,(D*q-t*o)*x,(D*u-t*y)*x);E[b].addSelf(I);E[c].addSelf(I);E[d].addSelf(I);C[b].addSelf(A);C[c].addSelf(A);C[d].addSelf(A)}var b,c,d,e,f,g,h,l,i,j,m,n,k,p,o,q,y,u,D,t,v,B,x,z,E=[],C=[],I=new THREE.Vector3,A=new THREE.Vector3, b,c,d,e,f,w){h=a.vertices[b].position;k=a.vertices[c].position;i=a.vertices[d].position;j=g[e];m=g[f];n=g[w];l=k.x-h.x;p=i.x-h.x;o=k.y-h.y;q=i.y-h.y;y=k.z-h.z;v=i.z-h.z;D=m.u-j.u;t=n.u-j.u;u=m.v-j.v;B=n.v-j.v;x=1/(D*B-t*u);F.set((B*l-u*p)*x,(B*o-u*q)*x,(B*y-u*v)*x);A.set((D*p-t*l)*x,(D*q-t*o)*x,(D*v-t*y)*x);E[b].addSelf(F);E[c].addSelf(F);E[d].addSelf(F);C[b].addSelf(A);C[c].addSelf(A);C[d].addSelf(A)}var b,c,d,e,f,g,h,k,i,j,m,n,l,p,o,q,y,v,D,t,u,B,x,z,E=[],C=[],F=new THREE.Vector3,A=new THREE.Vector3,
L=new THREE.Vector3,O=new THREE.Vector3,M=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)E[b]=new THREE.Vector3,C[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var Q=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)M.copy(f.vertexNormals[d]),e=f[Q[d]], L=new THREE.Vector3,O=new THREE.Vector3,M=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)E[b]=new THREE.Vector3,C[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var Q=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)M.copy(f.vertexNormals[d]),e=f[Q[d]],
z=E[e],L.copy(z),L.subSelf(M.multiplyScalar(M.dot(z))).normalize(),O.cross(f.vertexNormals[d],z),e=O.dot(C[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d< z=E[e],L.copy(z),L.subSelf(M.multiplyScalar(M.dot(z))).normalize(),O.cross(f.vertexNormals[d],z),e=O.dot(C[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10, e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
...@@ -125,7 +125,7 @@ THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this ...@@ -125,7 +125,7 @@ THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this
THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps= THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){}; !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.DataTexture=function(a,b,c,d,e,f,g,h,l,i){THREE.Texture.call(this,null,f,g,h,l,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture; 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.DataTexture=function(a,b,c,d,e,f,g,h,k,i){THREE.Texture.call(this,null,f,g,h,k,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle; THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={}; THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
...@@ -140,22 +140,22 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog= ...@@ -140,22 +140,22 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])}; THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])}; THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),0>=j||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(E.sub(i,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){null==C[a]&&(C[a]=document.createElementNS("http://www.w3.org/2000/svg", THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),0>=j||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(E.sub(i,b).normalize()),0>=j||(j*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=j&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){null==C[a]&&(C[a]=document.createElementNS("http://www.w3.org/2000/svg",
"path"),0==M&&C[a].setAttribute("shape-rendering","crispEdges"));return C[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,j,m,n,k,p,o,q,y=new THREE.Rectangle,u=new THREE.Rectangle,D=!1,t=new THREE.Color,v=new THREE.Color,B=new THREE.Color,x=new THREE.Color,z,E=new THREE.Vector3,C=[],I=[],A,L,O,M=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0, "path"),0==M&&C[a].setAttribute("shape-rendering","crispEdges"));return C[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,j,m,n,l,p,o,q,y=new THREE.Rectangle,v=new THREE.Rectangle,D=!1,t=new THREE.Color,u=new THREE.Color,B=new THREE.Color,x=new THREE.Color,z,E=new THREE.Vector3,C=[],F=[],A,L,O,M=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){i=a;j=b;m=i/2;n=j/2;l.setAttribute("viewBox",-m+" "+-n+" "+i+" "+j);l.setAttribute("width",i);l.setAttribute("height",j);y.set(-m,-n,m,n)};this.clear=function(){for(;0<l.childNodes.length;)l.removeChild(l.childNodes[0])};this.render=function(i,j){var C,E,s,r;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(i,j,this.sortElements);f=e.elements; faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){i=a;j=b;m=i/2;n=j/2;k.setAttribute("viewBox",-m+" "+-n+" "+i+" "+j);k.setAttribute("width",i);k.setAttribute("height",j);y.set(-m,-n,m,n)};this.clear=function(){for(;0<k.childNodes.length;)k.removeChild(k.childNodes[0])};this.render=function(i,j){var C,E,s,r;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(i,j,this.sortElements);f=e.elements;
g=e.lights;O=L=0;if(D=0<g.length){v.setRGB(0,0,0);B.setRGB(0,0,0);x.setRGB(0,0,0);for(C=0,E=g.length;C<E;C++)r=g[C],s=r.color,r instanceof THREE.AmbientLight?(v.r+=s.r,v.g+=s.g,v.b+=s.b):r instanceof THREE.DirectionalLight?(B.r+=s.r,B.g+=s.g,B.b+=s.b):r instanceof THREE.PointLight&&(x.r+=s.r,x.g+=s.g,x.b+=s.b)}for(C=0,E=f.length;C<E;C++)if(s=f[C],r=s.material,r=r instanceof THREE.MeshFaceMaterial?s.faceMaterial:r,!(null==r||0==r.opacity))if(u.empty(),s instanceof THREE.RenderableParticle)k=s,k.x*= g=e.lights;O=L=0;if(D=0<g.length){u.setRGB(0,0,0);B.setRGB(0,0,0);x.setRGB(0,0,0);for(C=0,E=g.length;C<E;C++)r=g[C],s=r.color,r instanceof THREE.AmbientLight?(u.r+=s.r,u.g+=s.g,u.b+=s.b):r instanceof THREE.DirectionalLight?(B.r+=s.r,B.g+=s.g,B.b+=s.b):r instanceof THREE.PointLight&&(x.r+=s.r,x.g+=s.g,x.b+=s.b)}for(C=0,E=f.length;C<E;C++)if(s=f[C],r=s.material,r=r instanceof THREE.MeshFaceMaterial?s.faceMaterial:r,!(null==r||0==r.opacity))if(v.empty(),s instanceof THREE.RenderableParticle)l=s,l.x*=
m,k.y*=-n;else if(s instanceof THREE.RenderableLine){if(k=s.v1,p=s.v2,k.positionScreen.x*=m,k.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,u.addPoint(k.positionScreen.x,k.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),y.intersects(u)){s=k;var J=p,w=O++;null==I[w]&&(I[w]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==M&&I[w].setAttribute("shape-rendering","crispEdges"));A=I[w];A.setAttribute("x1",s.positionScreen.x);A.setAttribute("y1",s.positionScreen.y); m,l.y*=-n;else if(s instanceof THREE.RenderableLine){if(l=s.v1,p=s.v2,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,v.addPoint(l.positionScreen.x,l.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),y.intersects(v)){s=l;var J=p,w=O++;null==F[w]&&(F[w]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==M&&F[w].setAttribute("shape-rendering","crispEdges"));A=F[w];A.setAttribute("x1",s.positionScreen.x);A.setAttribute("y1",s.positionScreen.y);
A.setAttribute("x2",J.positionScreen.x);A.setAttribute("y2",J.positionScreen.y);r instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+r.color.getContextStyle()+"; stroke-width: "+r.linewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.linecap+"; stroke-linejoin: "+r.linejoin),l.appendChild(A))}}else if(s instanceof THREE.RenderableFace3){if(k=s.v1,p=s.v2,o=s.v3,k.positionScreen.x*=m,k.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*= A.setAttribute("x2",J.positionScreen.x);A.setAttribute("y2",J.positionScreen.y);r instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+r.color.getContextStyle()+"; stroke-width: "+r.linewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.linecap+"; stroke-linejoin: "+r.linejoin),k.appendChild(A))}}else if(s instanceof THREE.RenderableFace3){if(l=s.v1,p=s.v2,o=s.v3,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=
m,o.positionScreen.y*=-n,u.addPoint(k.positionScreen.x,k.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),y.intersects(u)){var J=k,w=p,G=o;d.info.render.vertices+=3;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");r instanceof THREE.MeshBasicMaterial?t.copy(r.color):r instanceof THREE.MeshLambertMaterial? m,o.positionScreen.y*=-n,v.addPoint(l.positionScreen.x,l.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),y.intersects(v)){var J=l,w=p,H=o;d.info.render.vertices+=3;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+"z");r instanceof THREE.MeshBasicMaterial?t.copy(r.color):r instanceof THREE.MeshLambertMaterial?
D?(t.r=v.r,t.g=v.g,t.b=v.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(r.color.r*t.r,1)),t.g=Math.max(0,Math.min(r.color.g*t.g,1)),t.b=Math.max(0,Math.min(r.color.b*t.b,1))):t.copy(r.color):r instanceof THREE.MeshDepthMaterial?(z=1-r.__2near/(r.__farPlusNear-s.z*r.__farMinusNear),t.setRGB(z,z,z)):r instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));r.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+ D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(r.color.r*t.r,1)),t.g=Math.max(0,Math.min(r.color.g*t.g,1)),t.b=Math.max(0,Math.min(r.color.b*t.b,1))):t.copy(r.color):r instanceof THREE.MeshDepthMaterial?(z=1-r.__2near/(r.__farPlusNear-s.z*r.__farMinusNear),t.setRGB(z,z,z)):r instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));r.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+r.opacity);l.appendChild(A)}}else if(s instanceof THREE.RenderableFace4&&(k=s.v1,p=s.v2,o=s.v3,q=s.v4,k.positionScreen.x*=m,k.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,u.addPoint(k.positionScreen.x, r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+r.opacity);k.appendChild(A)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,p=s.v2,o=s.v3,q=s.v4,l.positionScreen.x*=m,l.positionScreen.y*=-n,p.positionScreen.x*=m,p.positionScreen.y*=-n,o.positionScreen.x*=m,o.positionScreen.y*=-n,q.positionScreen.x*=m,q.positionScreen.y*=-n,v.addPoint(l.positionScreen.x,
k.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),y.intersects(u))){var J=k,w=p,G=o,H=q;d.info.render.vertices+=4;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+"z");r instanceof THREE.MeshBasicMaterial? l.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(q.positionScreen.x,q.positionScreen.y),y.intersects(v))){var J=l,w=p,H=o,I=q;d.info.render.vertices+=4;d.info.render.faces++;A=b(L++);A.setAttribute("d","M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");r instanceof THREE.MeshBasicMaterial?
t.copy(r.color):r instanceof THREE.MeshLambertMaterial?D?(t.r=v.r,t.g=v.g,t.b=v.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(r.color.r*t.r,1)),t.g=Math.max(0,Math.min(r.color.g*t.g,1)),t.b=Math.max(0,Math.min(r.color.b*t.b,1))):t.copy(r.color):r instanceof THREE.MeshDepthMaterial?(z=1-r.__2near/(r.__farPlusNear-s.z*r.__farMinusNear),t.setRGB(z,z,z)):r instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));r.wireframe?A.setAttribute("style", t.copy(r.color):r instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(r.color.r*t.r,1)),t.g=Math.max(0,Math.min(r.color.g*t.g,1)),t.b=Math.max(0,Math.min(r.color.b*t.b,1))):t.copy(r.color):r instanceof THREE.MeshDepthMaterial?(z=1-r.__2near/(r.__farPlusNear-s.z*r.__farMinusNear),t.setRGB(z,z,z)):r instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));r.wireframe?A.setAttribute("style",
"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+r.opacity);l.appendChild(A)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0}; "fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+r.opacity);k.appendChild(A)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)}; THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null}; THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null}; THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a, THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,e),i=l.data,j=0;j<d;j++)for(var m=1;m<e;m++){var n=0>m-1?e-1:m-1,k=(m+1)%e,p=0>j-1?d-1:j-1,o=(j+1)%d,q=[],y=[0,0,h[4*(m*d+j)]/255*b];q.push([-1,0,h[4*(m*d+p)]/255*b]);q.push([-1,-1,h[4*(n*d+p)]/255*b]);q.push([0,-1, b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),i=k.data,j=0;j<d;j++)for(var m=1;m<e;m++){var n=0>m-1?e-1:m-1,l=(m+1)%e,p=0>j-1?d-1:j-1,o=(j+1)%d,q=[],y=[0,0,h[4*(m*d+j)]/255*b];q.push([-1,0,h[4*(m*d+p)]/255*b]);q.push([-1,-1,h[4*(n*d+p)]/255*b]);q.push([0,-1,
h[4*(n*d+j)]/255*b]);q.push([1,-1,h[4*(n*d+o)]/255*b]);q.push([1,0,h[4*(m*d+o)]/255*b]);q.push([1,1,h[4*(k*d+o)]/255*b]);q.push([0,1,h[4*(k*d+j)]/255*b]);q.push([-1,1,h[4*(k*d+p)]/255*b]);n=[];p=q.length;for(k=0;k<p;k++){var o=q[k],u=q[(k+1)%p],o=[o[0]-y[0],o[1]-y[1],o[2]-y[2]],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]];n.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}q=[0,0,0];for(k=0;k<n.length;k++)q[0]+=n[k][0],q[1]+=n[k][1],q[2]+=n[k][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length; h[4*(n*d+j)]/255*b]);q.push([1,-1,h[4*(n*d+o)]/255*b]);q.push([1,0,h[4*(m*d+o)]/255*b]);q.push([1,1,h[4*(l*d+o)]/255*b]);q.push([0,1,h[4*(l*d+j)]/255*b]);q.push([-1,1,h[4*(l*d+p)]/255*b]);n=[];p=q.length;for(l=0;l<p;l++){var o=q[l],v=q[(l+1)%p],o=[o[0]-y[0],o[1]-y[1],o[2]-y[2]],v=[v[0]-y[0],v[1]-y[1],v[2]-y[2]];n.push(c([o[1]*v[2]-o[2]*v[1],o[2]*v[0]-o[0]*v[2],o[0]*v[1]-o[1]*v[0]]))}q=[0,0,0];for(l=0;l<n.length;l++)q[0]+=n[l][0],q[1]+=n[l][1],q[2]+=n[l][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length;
y=4*(m*d+j);i[y]=255*((q[0]+1)/2)|0;i[y+1]=255*(q[1]+0.5)|0;i[y+2]=255*q[2]|0;i[y+3]=255}g.putImageData(l,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}}; y=4*(m*d+j);i[y]=255*((q[0]+1)/2)|0;i[y+1]=255*(q[1]+0.5)|0;i[y+2]=255*q[2]|0;i[y+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
因为 它太大了无法显示 source diff 。你可以改为 查看blob
<!doctype html>
<html lang="en">
<head>
<title>three.js webgl - performance</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
background:#fff;
padding:0;
margin:0;
font-weight: bold;
overflow:hidden;
}
</style>
</head>
<body>
<script src="../build/Three.js"></script>
<script src="js/Detector.js"></script>
<script src="js/Stats.js"></script>
<script>
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
var container, stats;
var camera, scene, renderer;
var mesh, geometry;
var mouseX = 0, mouseY = 0;
var SCREEN_WIDTH = window.innerWidth,
SCREEN_HEIGHT = window.innerHeight;
var windowHalfX = SCREEN_WIDTH / 2;
var windowHalfY = SCREEN_HEIGHT / 2;
var FANCY = true;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 50, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 20000 );
camera.position.z = 3200;
scene = new THREE.Scene();
scene.add( camera );
var light = new THREE.PointLight( 0x0011ff, 1, 5500 );
light.position.set( 4000, 0, 0 );
scene.add( light );
var light = new THREE.PointLight( 0xff1100, 1, 5500 );
light.position.set( -4000, 0, 0 );
scene.add( light );
if ( FANCY ) {
var light = new THREE.PointLight( 0xffaa00, 2, 3000 );
light.position.set( 0, 0, 0 );
scene.add( light );
var path = "textures/cube/SwedishRoyalCastle/";
var format = '.jpg';
var urls = [
path + 'px' + format, path + 'nx' + format,
path + 'py' + format, path + 'ny' + format,
path + 'pz' + format, path + 'nz' + format
];
var reflectionCube = THREE.ImageUtils.loadTextureCube( urls );
reflectionCube.format = THREE.RGBFormat;
var material = new THREE.MeshPhongMaterial( { specular: 0xffffff, shininess: 100, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.1, perPixel: true } );
material.wrapAround = true;
material.wrapRGB.set( 0.5, 0.5, 0.5 );
} else {
var material = new THREE.MeshPhongMaterial( { specular: 0xffffff, shading: THREE.SmoothShading, perPixel: true } );
}
var geometry = new THREE.SphereGeometry( 1, 32, 16, 0, Math.PI );
for ( var i = 0; i < 5000; i ++ ) {
var mesh = new THREE.Mesh( geometry, material );
mesh.position.x = Math.random() * 10000 - 5000;
mesh.position.y = Math.random() * 10000 - 5000;
mesh.position.z = Math.random() * 10000 - 5000;
mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 50 + 100;
mesh.matrixAutoUpdate = false;
mesh.updateMatrix();
mesh.doubleSided = true;
scene.add( mesh );
}
renderer = new THREE.WebGLRenderer( { clearColor: 0x050505, clearAlpha: 1, antialias: FANCY } );
renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
renderer.sortObjects = false;
renderer.gammaInput = true;
renderer.gammaOutput = true;
renderer.physicallyBasedShading = FANCY;
container.appendChild( renderer.domElement );
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
stats.domElement.style.zIndex = 100;
stats.domElement.children[ 0 ].children[ 0 ].style.color = "#eee";
stats.domElement.children[ 0 ].style.background = "transparent";
stats.domElement.children[ 0 ].children[ 1 ].style.display = "none";
container.appendChild( stats.domElement );
document.addEventListener( 'mousemove', onDocumentMouseMove, false );
window.addEventListener( 'resize', onWindowResize, false );
}
//
function onWindowResize( event ) {
SCREEN_WIDTH = window.innerWidth;
SCREEN_HEIGHT = window.innerHeight;
renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
camera.updateProjectionMatrix();
windowHalfX = SCREEN_WIDTH / 2;
windowHalfY = SCREEN_HEIGHT / 2;
}
function onDocumentMouseMove(event) {
mouseX = ( event.clientX - windowHalfX ) * 10;
mouseY = ( event.clientY - windowHalfY ) * 10;
}
//
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
function render() {
camera.position.x += ( mouseX - camera.position.x ) * .05;
camera.position.y += ( - mouseY - camera.position.y ) * .05;
camera.lookAt( scene.position );
renderer.render( scene, camera );
}
</script>
</body>
</html>
...@@ -4211,7 +4211,8 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -4211,7 +4211,8 @@ THREE.WebGLRenderer = function ( parameters ) {
alphaTest: material.alphaTest, alphaTest: material.alphaTest,
metal: material.metal, metal: material.metal,
perPixel: material.perPixel, perPixel: material.perPixel,
wrapAround: material.wrapAround wrapAround: material.wrapAround,
doubleSided: object && object.doubleSided
}; };
...@@ -5287,6 +5288,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -5287,6 +5288,7 @@ THREE.WebGLRenderer = function ( parameters ) {
parameters.morphNormals ? "#define USE_MORPHNORMALS" : "", parameters.morphNormals ? "#define USE_MORPHNORMALS" : "",
parameters.perPixel ? "#define PHONG_PER_PIXEL" : "", parameters.perPixel ? "#define PHONG_PER_PIXEL" : "",
parameters.wrapAround ? "#define WRAP_AROUND" : "", parameters.wrapAround ? "#define WRAP_AROUND" : "",
parameters.doubleSided ? "#define DOUBLE_SIDED" : "",
parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "",
parameters.shadowMapSoft ? "#define SHADOWMAP_SOFT" : "", parameters.shadowMapSoft ? "#define SHADOWMAP_SOFT" : "",
...@@ -5377,6 +5379,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -5377,6 +5379,7 @@ THREE.WebGLRenderer = function ( parameters ) {
parameters.metal ? "#define METAL" : "", parameters.metal ? "#define METAL" : "",
parameters.perPixel ? "#define PHONG_PER_PIXEL" : "", parameters.perPixel ? "#define PHONG_PER_PIXEL" : "",
parameters.wrapAround ? "#define WRAP_AROUND" : "", parameters.wrapAround ? "#define WRAP_AROUND" : "",
parameters.doubleSided ? "#define DOUBLE_SIDED" : "",
parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "",
parameters.shadowMapSoft ? "#define SHADOWMAP_SOFT" : "", parameters.shadowMapSoft ? "#define SHADOWMAP_SOFT" : "",
......
...@@ -74,7 +74,16 @@ THREE.ShaderChunk = { ...@@ -74,7 +74,16 @@ THREE.ShaderChunk = {
"#ifdef USE_ENVMAP", "#ifdef USE_ENVMAP",
"vec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );", "#ifdef DOUBLE_SIDED",
"float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );",
"vec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );",
"#else",
"vec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );",
"#endif",
"#ifdef GAMMA_INPUT", "#ifdef GAMMA_INPUT",
...@@ -285,7 +294,13 @@ THREE.ShaderChunk = { ...@@ -285,7 +294,13 @@ THREE.ShaderChunk = {
lights_lambert_vertex: [ lights_lambert_vertex: [
"vLightWeighting = vec3( 0.0 );", "vLightFront = vec3( 0.0 );",
"#ifdef DOUBLE_SIDED",
"vLightBack = vec3( 0.0 );",
"#endif",
"transformedNormal = normalize( transformedNormal );", "transformedNormal = normalize( transformedNormal );",
...@@ -296,20 +311,41 @@ THREE.ShaderChunk = { ...@@ -296,20 +311,41 @@ THREE.ShaderChunk = {
"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );", "vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );",
"vec3 dirVector = normalize( lDirection.xyz );", "vec3 dirVector = normalize( lDirection.xyz );",
"float dotProduct = dot( transformedNormal, dirVector );",
"vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );",
"#ifdef DOUBLE_SIDED",
"vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );",
"#ifdef WRAP_AROUND",
"vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );",
"#endif",
"#endif",
"#ifdef WRAP_AROUND", "#ifdef WRAP_AROUND",
"float directionalLightWeightingFull = max( dot( transformedNormal, dirVector ), 0.0 );", "vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );",
"float directionalLightWeightingHalf = max( 0.5 * dot( transformedNormal, dirVector ) + 0.5, 0.0 );", "directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );",
"vec3 directionalLightWeighting = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );", "#ifdef DOUBLE_SIDED",
"#else", "directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );",
"float directionalLightWeighting = max( dot( transformedNormal, dirVector ), 0.0 );", "#endif",
"#endif", "#endif",
"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;", "vLightFront += directionalLightColor[ i ] * directionalLightWeighting;",
"#ifdef DOUBLE_SIDED",
"vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;",
"#endif",
"}", "}",
...@@ -327,27 +363,54 @@ THREE.ShaderChunk = { ...@@ -327,27 +363,54 @@ THREE.ShaderChunk = {
"lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );", "lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );",
"lVector = normalize( lVector );", "lVector = normalize( lVector );",
"float dotProduct = dot( transformedNormal, lVector );",
"vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );",
"#ifdef DOUBLE_SIDED",
"vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );",
"#ifdef WRAP_AROUND",
"vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );",
"#endif",
"#endif",
"#ifdef WRAP_AROUND", "#ifdef WRAP_AROUND",
"float pointLightWeightingFull = max( dot( transformedNormal, lVector ), 0.0 );", "vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );",
"float pointLightWeightingHalf = max( 0.5 * dot( transformedNormal, lVector ) + 0.5, 0.0 );", "pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );",
"vec3 pointLightWeighting = mix( vec3 ( pointLightWeightingFull ), vec3( pointLightWeightingHalf ), wrapRGB );", "#ifdef DOUBLE_SIDED",
"#else", "pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );",
"float pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );", "#endif",
"#endif", "#endif",
"vLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;", "vLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;",
"#ifdef DOUBLE_SIDED",
"vLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;",
"#endif",
"}", "}",
"#endif", "#endif",
"vLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;", "vLightFront = vLightFront * diffuse + ambient * ambientLightColor;",
"#ifdef DOUBLE_SIDED",
"vLightBack = vLightBack * diffuse + ambient * ambientLightColor;",
"#endif",
].join("\n"), ].join("\n"),
...@@ -436,6 +499,12 @@ THREE.ShaderChunk = { ...@@ -436,6 +499,12 @@ THREE.ShaderChunk = {
"vec3 normal = normalize( vNormal );", "vec3 normal = normalize( vNormal );",
"vec3 viewPosition = normalize( vViewPosition );", "vec3 viewPosition = normalize( vViewPosition );",
"#ifdef DOUBLE_SIDED",
"normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );",
"#endif",
"#if MAX_POINT_LIGHTS > 0", "#if MAX_POINT_LIGHTS > 0",
"vec3 pointDiffuse = vec3( 0.0 );", "vec3 pointDiffuse = vec3( 0.0 );",
...@@ -463,16 +532,18 @@ THREE.ShaderChunk = { ...@@ -463,16 +532,18 @@ THREE.ShaderChunk = {
// diffuse // diffuse
"float dotProduct = dot( normal, lVector );",
"#ifdef WRAP_AROUND", "#ifdef WRAP_AROUND",
"float pointDiffuseWeightFull = max( dot( normal, lVector ), 0.0 );", "float pointDiffuseWeightFull = max( dotProduct, 0.0 );",
"float pointDiffuseWeightHalf = max( 0.5 * dot( normal, lVector ) + 0.5, 0.0 );", "float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );",
"vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );", "vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );",
"#else", "#else",
"float pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );", "float pointDiffuseWeight = max( dotProduct, 0.0 );",
"#endif", "#endif",
...@@ -511,16 +582,18 @@ THREE.ShaderChunk = { ...@@ -511,16 +582,18 @@ THREE.ShaderChunk = {
// diffuse // diffuse
"float dotProduct = dot( normal, dirVector );",
"#ifdef WRAP_AROUND", "#ifdef WRAP_AROUND",
"float dirDiffuseWeightFull = max( dot( normal, dirVector ), 0.0 );", "float dirDiffuseWeightFull = max( dotProduct, 0.0 );",
"float dirDiffuseWeightHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );", "float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );",
"vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );", "vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );",
"#else", "#else",
"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );", "float dirDiffuseWeight = max( dotProduct, 0.0 );",
"#endif", "#endif",
...@@ -1321,7 +1394,13 @@ THREE.ShaderLib = { ...@@ -1321,7 +1394,13 @@ THREE.ShaderLib = {
vertexShader: [ vertexShader: [
"varying vec3 vLightWeighting;", "varying vec3 vLightFront;",
"#ifdef DOUBLE_SIDED",
"varying vec3 vLightBack;",
"#endif",
THREE.ShaderChunk[ "map_pars_vertex" ], THREE.ShaderChunk[ "map_pars_vertex" ],
THREE.ShaderChunk[ "lightmap_pars_vertex" ], THREE.ShaderChunk[ "lightmap_pars_vertex" ],
...@@ -1358,7 +1437,13 @@ THREE.ShaderLib = { ...@@ -1358,7 +1437,13 @@ THREE.ShaderLib = {
"uniform float opacity;", "uniform float opacity;",
"varying vec3 vLightWeighting;", "varying vec3 vLightFront;",
"#ifdef DOUBLE_SIDED",
"varying vec3 vLightBack;",
"#endif",
THREE.ShaderChunk[ "color_pars_fragment" ], THREE.ShaderChunk[ "color_pars_fragment" ],
THREE.ShaderChunk[ "map_pars_fragment" ], THREE.ShaderChunk[ "map_pars_fragment" ],
...@@ -1374,7 +1459,21 @@ THREE.ShaderLib = { ...@@ -1374,7 +1459,21 @@ THREE.ShaderLib = {
THREE.ShaderChunk[ "map_fragment" ], THREE.ShaderChunk[ "map_fragment" ],
THREE.ShaderChunk[ "alphatest_fragment" ], THREE.ShaderChunk[ "alphatest_fragment" ],
"gl_FragColor.xyz = gl_FragColor.xyz * vLightWeighting;", "#ifdef DOUBLE_SIDED",
//"float isFront = float( gl_FrontFacing );",
//"gl_FragColor.xyz *= isFront * vLightFront + ( 1.0 - isFront ) * vLightBack;",
"if ( gl_FrontFacing )",
"gl_FragColor.xyz *= vLightFront;",
"else",
"gl_FragColor.xyz *= vLightBack;",
"#else",
"gl_FragColor.xyz *= vLightFront;",
"#endif",
THREE.ShaderChunk[ "lightmap_fragment" ], THREE.ShaderChunk[ "lightmap_fragment" ],
THREE.ShaderChunk[ "color_fragment" ], THREE.ShaderChunk[ "color_fragment" ],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册