|
@@ -16,10 +16,10 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,e){this.x=
|
|
c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,w){e.copy(w).subSelf(b);
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,w){e.copy(w).subSelf(b);
|
|
-l.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);k=e.dot(l);n=e.dot(f);t=l.dot(l);u=l.dot(f);p=1/(h*t-k*k);x=(t*n-k*u)*p;v=(h*u-k*n)*p;return x>=0&&v>=0&&x+v<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,u,p,x,v,y,w=[],z=0,B=a.children.length;z<B;z++)Array.prototype.push.apply(w,this.intersectObject(a.children[z]));if(a instanceof THREE.Particle){z=c(this.origin,this.direction,a.matrixWorld.getPosition());if(z===null||z>a.scale.x)return[];y={distance:z,point:a.position,
|
|
|
|
-face:null,object:a};w.push(y)}else if(a instanceof THREE.Mesh){z=c(this.origin,this.direction,a.matrixWorld.getPosition());if(z===null||z>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return w;var C,A,D,K,P,F,Q,H,N=a.geometry,L=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);z=0;for(B=N.faces.length;z<B;z++)if(y=N.faces[z],Q=this.origin.clone(),H=this.direction.clone(),K=a.matrixWorld,C=K.multiplyVector3(y.centroid.clone()).subSelf(Q),F=C.dot(H),
|
|
|
|
-!(F<=0)&&(C=K.multiplyVector3(L[y.a].position.clone()),A=K.multiplyVector3(L[y.b].position.clone()),D=K.multiplyVector3(L[y.c].position.clone()),K=y instanceof THREE.Face4?K.multiplyVector3(L[y.d].position.clone()):null,P=a.matrixRotationWorld.multiplyVector3(y.normal.clone()),F=H.dot(P),a.doubleSided||(a.flipSided?F>0:F<0)))if(F=P.dot((new THREE.Vector3).sub(C,Q))/F,Q=Q.addSelf(H.multiplyScalar(F)),y instanceof THREE.Face3)b(Q,C,A,D)&&(y={distance:this.origin.distanceTo(Q),point:Q,face:y,object:a},
|
|
|
|
-w.push(y));else if(y instanceof THREE.Face4&&(b(Q,C,A,K)||b(Q,A,D,K)))y={distance:this.origin.distanceTo(Q),point:Q,face:y,object:a},w.push(y)}return w}};
|
|
|
|
|
|
+l.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);k=e.dot(l);n=e.dot(f);t=l.dot(l);u=l.dot(f);p=1/(h*t-k*k);x=(t*n-k*u)*p;v=(h*u-k*n)*p;return x>=0&&v>=0&&x+v<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,u,p,x,v,y,w=[],A=0,z=a.children.length;A<z;A++)Array.prototype.push.apply(w,this.intersectObject(a.children[A]));if(a instanceof THREE.Particle){A=c(this.origin,this.direction,a.matrixWorld.getPosition());if(A===null||A>a.scale.x)return[];y={distance:A,point:a.position,
|
|
|
|
+face:null,object:a};w.push(y)}else if(a instanceof THREE.Mesh){A=c(this.origin,this.direction,a.matrixWorld.getPosition());if(A===null||A>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return w;var C,B,D,K,O,F,P,H,M=a.geometry,J=M.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);A=0;for(z=M.faces.length;A<z;A++)if(y=M.faces[A],P=this.origin.clone(),H=this.direction.clone(),K=a.matrixWorld,C=K.multiplyVector3(y.centroid.clone()).subSelf(P),F=C.dot(H),
|
|
|
|
+!(F<=0)&&(C=K.multiplyVector3(J[y.a].position.clone()),B=K.multiplyVector3(J[y.b].position.clone()),D=K.multiplyVector3(J[y.c].position.clone()),K=y instanceof THREE.Face4?K.multiplyVector3(J[y.d].position.clone()):null,O=a.matrixRotationWorld.multiplyVector3(y.normal.clone()),F=H.dot(O),a.doubleSided||(a.flipSided?F>0:F<0)))if(F=O.dot((new THREE.Vector3).sub(C,P))/F,P=P.addSelf(H.multiplyScalar(F)),y instanceof THREE.Face3)b(P,C,B,D)&&(y={distance:this.origin.distanceTo(P),point:P,face:y,object:a},
|
|
|
|
+w.push(y));else if(y instanceof THREE.Face4&&(b(P,C,B,K)||b(P,B,D,K)))y={distance:this.origin.distanceTo(P),point:P,face:y,object:a},w.push(y)}return w}};
|
|
THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(f,h,u,p){k=!1;c=f;b=h;e=u;l=p;a()};this.addPoint=function(f,h){k?(k=!1,c=f,b=h,e=f,l=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,l=l>h?l:h);a()};this.add3Points=
|
|
THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(f,h,u,p){k=!1;c=f;b=h;e=u;l=p;a()};this.addPoint=function(f,h){k?(k=!1,c=f,b=h,e=f,l=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,l=l>h?l:h);a()};this.add3Points=
|
|
function(f,h,u,p,x,v){k?(k=!1,c=f<u?f<x?f:x:u<x?u:x,b=h<p?h<v?h:v:p<v?p:v,e=f>u?f>x?f:x:u>x?u:x,l=h>p?h>v?h:v:p>v?p:v):(c=f<u?f<x?f<c?f:c:x<c?x:c:u<x?u<c?u:c:x<c?x:c,b=h<p?h<v?h<b?h:b:v<b?v:b:p<v?p<b?p:b:v<b?v:b,e=f>u?f>x?f>e?f:e:x>e?x:e:u>x?u>e?u:e:x>e?x:e,l=h>p?h>v?h>l?h:l:v>l?v:l:p>v?p>l?p:l:v>l?v:l);a()};this.addRectangle=function(f){k?(k=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),l=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),l=l>
|
|
function(f,h,u,p,x,v){k?(k=!1,c=f<u?f<x?f:x:u<x?u:x,b=h<p?h<v?h:v:p<v?p:v,e=f>u?f>x?f:x:u>x?u:x,l=h>p?h>v?h:v:p>v?p:v):(c=f<u?f<x?f<c?f:c:x<c?x:c:u<x?u<c?u:c:x<c?x:c,b=h<p?h<v?h<b?h:b:v<b?v:b:p<v?p<b?p:b:v<b?v:b,e=f>u?f>x?f>e?f:e:x>e?x:e:u>x?u>e?u:e:x>e?x:e,l=h>p?h>v?h>l?h:l:v>l?v:l:p>v?p>l?p:l:v>l?v:l);a()};this.addRectangle=function(f){k?(k=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),l=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),l=l>
|
|
f.getBottom()?l:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;l+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e<f.getRight()?e:f.getRight();l=l<f.getBottom()?l:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
f.getBottom()?l:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;l+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e<f.getRight()?e:f.getRight();l=l<f.getBottom()?l:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
@@ -27,9 +27,9 @@ THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
THREE.Matrix4=function(a,c,b,e,l,f,h,k,n,t,u,p,x,v,y,w){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,f!==void 0?f:1,h||0,k||0,n||0,t||0,u!==void 0?u:1,p||0,x||0,v||0,y||0,w!==void 0?w:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
THREE.Matrix4=function(a,c,b,e,l,f,h,k,n,t,u,p,x,v,y,w){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,f!==void 0?f:1,h||0,k||0,n||0,t||0,u!==void 0?u:1,p||0,x||0,v||0,y||0,w!==void 0?w:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,f,h,k,n,t,u,p,x,v,y,w){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=f;this.n23=h;this.n24=k;this.n31=n;this.n32=t;this.n33=u;this.n34=p;this.n41=x;this.n42=v;this.n43=y;this.n44=w;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,c,b,e,l,f,h,k,n,t,u,p,x,v,y,w){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=f;this.n23=h;this.n24=k;this.n31=n;this.n32=t;this.n33=u;this.n34=p;this.n41=x;this.n42=v;this.n43=y;this.n44=w;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,
|
|
-c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,c).normalize();if(f.length()===0)f.z=1;e.cross(b,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(b,f).normalize());l.cross(f,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=f.x;this.n21=e.y;this.n22=l.y;this.n23=f.y;this.n31=e.z;this.n32=l.z;this.n33=f.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,f=a.n14,h=a.n21,k=a.n22,n=a.n23,t=a.n24,u=a.n31,p=a.n32,x=a.n33,v=a.n34,y=a.n41,w=a.n42,z=a.n43,
|
|
|
|
-B=a.n44,C=c.n11,A=c.n12,D=c.n13,K=c.n14,P=c.n21,F=c.n22,Q=c.n23,H=c.n24,N=c.n31,L=c.n32,G=c.n33,W=c.n34,ca=c.n41,X=c.n42,U=c.n43,o=c.n44;this.n11=b*C+e*P+l*N+f*ca;this.n12=b*A+e*F+l*L+f*X;this.n13=b*D+e*Q+l*G+f*U;this.n14=b*K+e*H+l*W+f*o;this.n21=h*C+k*P+n*N+t*ca;this.n22=h*A+k*F+n*L+t*X;this.n23=h*D+k*Q+n*G+t*U;this.n24=h*K+k*H+n*W+t*o;this.n31=u*C+p*P+x*N+v*ca;this.n32=u*A+p*F+x*L+v*X;this.n33=u*D+p*Q+x*G+v*U;this.n34=u*K+p*H+x*W+v*o;this.n41=y*C+w*P+z*N+B*ca;this.n42=y*A+w*F+z*L+B*X;this.n43=y*
|
|
|
|
-D+w*Q+z*G+B*U;this.n44=y*K+w*H+z*W+B*o;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[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*=
|
|
|
|
|
|
+c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,c).normalize();if(f.length()===0)f.z=1;e.cross(b,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(b,f).normalize());l.cross(f,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=f.x;this.n21=e.y;this.n22=l.y;this.n23=f.y;this.n31=e.z;this.n32=l.z;this.n33=f.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,f=a.n14,h=a.n21,k=a.n22,n=a.n23,t=a.n24,u=a.n31,p=a.n32,x=a.n33,v=a.n34,y=a.n41,w=a.n42,A=a.n43,
|
|
|
|
+z=a.n44,C=c.n11,B=c.n12,D=c.n13,K=c.n14,O=c.n21,F=c.n22,P=c.n23,H=c.n24,M=c.n31,J=c.n32,G=c.n33,X=c.n34,ca=c.n41,T=c.n42,S=c.n43,o=c.n44;this.n11=b*C+e*O+l*M+f*ca;this.n12=b*B+e*F+l*J+f*T;this.n13=b*D+e*P+l*G+f*S;this.n14=b*K+e*H+l*X+f*o;this.n21=h*C+k*O+n*M+t*ca;this.n22=h*B+k*F+n*J+t*T;this.n23=h*D+k*P+n*G+t*S;this.n24=h*K+k*H+n*X+t*o;this.n31=u*C+p*O+x*M+v*ca;this.n32=u*B+p*F+x*J+v*T;this.n33=u*D+p*P+x*G+v*S;this.n34=u*K+p*H+x*X+v*o;this.n41=y*C+w*O+A*M+z*ca;this.n42=y*B+w*F+A*J+z*T;this.n43=y*
|
|
|
|
+D+w*P+A*G+z*S;this.n44=y*K+w*H+A*X+z*o;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[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 c=a.x,b=a.y,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=this.n21*c+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 c=a.x,b=a.y,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=this.n21*c+this.n22*
|
|
b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,l=this.n21,f=this.n22,h=this.n23,k=this.n24,n=this.n31,t=this.n32,u=this.n33,p=this.n34,x=this.n41,v=this.n42,y=this.n43,w=this.n44;return e*h*t*x-b*k*t*x-e*f*u*x+c*k*u*x+b*f*p*x-c*h*p*x-e*h*n*v+b*k*n*v+e*l*u*v-a*k*u*v-b*l*p*v+a*h*p*v+e*f*n*y-c*k*n*y-e*l*t*y+a*k*t*y+c*l*p*y-a*f*p*y-b*f*n*w+c*h*n*w+b*l*t*w-a*h*t*w-c*l*u*w+a*f*u*w},transpose:function(){var a;
|
|
a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,l=this.n21,f=this.n22,h=this.n23,k=this.n24,n=this.n31,t=this.n32,u=this.n33,p=this.n34,x=this.n41,v=this.n42,y=this.n43,w=this.n44;return e*h*t*x-b*k*t*x-e*f*u*x+c*k*u*x+b*f*p*x-c*h*p*x-e*h*n*v+b*k*n*v+e*l*u*v-a*k*u*v-b*l*p*v+a*h*p*v+e*f*n*y-c*k*n*y-e*l*t*y+a*k*t*y+c*l*p*y-a*f*p*y-b*f*n*w+c*h*n*w+b*l*t*w-a*h*t*w-c*l*u*w+a*f*u*w},transpose:function(){var a;
|
|
@@ -38,8 +38,8 @@ a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11
|
|
a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},
|
|
a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},
|
|
setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},
|
|
setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},
|
|
setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),l=1-b,f=a.x,h=a.y,k=a.z,n=l*f,t=l*h;this.set(n*f+b,n*h-e*k,n*k+e*h,0,n*h+e*k,t*h+b,t*k-e*f,0,n*k-e*h,t*k+e*f,l*k*k+b,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,c){var b=Math.cos(c),e=Math.sin(c),l=1-b,f=a.x,h=a.y,k=a.z,n=l*f,t=l*h;this.set(n*f+b,n*h-e*k,n*k+e*h,0,n*h+e*k,t*h+b,t*k-e*f,0,n*k-e*h,t*k+e*f,l*k*k+b,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 c=a.n11,b=a.n12,e=a.n13,l=a.n14,f=a.n21,h=a.n22,k=a.n23,n=a.n24,t=a.n31,u=a.n32,p=a.n33,x=a.n34,v=a.n41,y=a.n42,w=a.n43,z=a.n44;this.n11=k*x*y-n*p*y+n*u*w-h*x*w-k*u*z+h*p*z;this.n12=l*p*y-e*x*y-l*u*w+b*x*w+e*u*z-b*p*z;this.n13=e*n*y-l*k*y+l*h*w-b*n*w-e*h*z+b*k*z;this.n14=l*k*u-e*n*u-l*h*p+b*n*p+e*h*x-b*k*x;this.n21=n*p*v-k*x*v-n*t*w+f*x*w+k*t*z-f*p*z;this.n22=e*x*v-l*p*v+
|
|
|
|
-l*t*w-c*x*w-e*t*z+c*p*z;this.n23=l*k*v-e*n*v-l*f*w+c*n*w+e*f*z-c*k*z;this.n24=e*n*t-l*k*t+l*f*p-c*n*p-e*f*x+c*k*x;this.n31=h*x*v-n*u*v+n*t*y-f*x*y-h*t*z+f*u*z;this.n32=l*u*v-b*x*v-l*t*y+c*x*y+b*t*z-c*u*z;this.n33=e*n*v-l*h*v+l*f*y-c*n*y-b*f*z+c*h*z;this.n34=l*h*t-b*n*t-l*f*u+c*n*u+b*f*x-c*h*x;this.n41=k*u*v-h*p*v-k*t*y+f*p*y+h*t*w-f*u*w;this.n42=b*p*v-e*u*v+e*t*y-c*p*y-b*t*w+c*u*w;this.n43=e*h*v-b*k*v-e*f*y+c*k*y+b*f*w-c*h*w;this.n44=b*k*t-e*h*t+e*f*u-c*k*u-b*f*p+c*h*p;this.multiplyScalar(1/a.determinant());
|
|
|
|
|
|
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,l=a.n14,f=a.n21,h=a.n22,k=a.n23,n=a.n24,t=a.n31,u=a.n32,p=a.n33,x=a.n34,v=a.n41,y=a.n42,w=a.n43,A=a.n44;this.n11=k*x*y-n*p*y+n*u*w-h*x*w-k*u*A+h*p*A;this.n12=l*p*y-e*x*y-l*u*w+b*x*w+e*u*A-b*p*A;this.n13=e*n*y-l*k*y+l*h*w-b*n*w-e*h*A+b*k*A;this.n14=l*k*u-e*n*u-l*h*p+b*n*p+e*h*x-b*k*x;this.n21=n*p*v-k*x*v-n*t*w+f*x*w+k*t*A-f*p*A;this.n22=e*x*v-l*p*v+
|
|
|
|
+l*t*w-c*x*w-e*t*A+c*p*A;this.n23=l*k*v-e*n*v-l*f*w+c*n*w+e*f*A-c*k*A;this.n24=e*n*t-l*k*t+l*f*p-c*n*p-e*f*x+c*k*x;this.n31=h*x*v-n*u*v+n*t*y-f*x*y-h*t*A+f*u*A;this.n32=l*u*v-b*x*v-l*t*y+c*x*y+b*t*A-c*u*A;this.n33=e*n*v-l*h*v+l*f*y-c*n*y-b*f*A+c*h*A;this.n34=l*h*t-b*n*t-l*f*u+c*n*u+b*f*x-c*h*x;this.n41=k*u*v-h*p*v-k*t*y+f*p*y+h*t*w-f*u*w;this.n42=b*p*v-e*u*v+e*t*y-c*p*y-b*t*w+c*u*w;this.n43=e*h*v-b*k*v-e*f*y+c*k*y+b*f*w-c*h*w;this.n44=b*k*t-e*h*t+e*f*u-c*k*u-b*f*p+c*h*p;this.multiplyScalar(1/a.determinant());
|
|
return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,f=Math.cos(b),b=Math.sin(b),h=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=h*k,t=h*l,u=e*k,p=e*l;this.n11=n+p*b;this.n12=u*b-t;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=t*b-u;this.n32=p+n*b;this.n33=f*h;break;case "ZXY":n=h*k;t=h*l;u=e*k;p=e*l;this.n11=n-p*b;this.n12=-f*l;this.n13=u+t*b;this.n21=t+u*b;this.n22=f*k;this.n23=p-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
|
|
return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,f=Math.cos(b),b=Math.sin(b),h=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=h*k,t=h*l,u=e*k,p=e*l;this.n11=n+p*b;this.n12=u*b-t;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=t*b-u;this.n32=p+n*b;this.n33=f*h;break;case "ZXY":n=h*k;t=h*l;u=e*k;p=e*l;this.n11=n-p*b;this.n12=-f*l;this.n13=u+t*b;this.n21=t+u*b;this.n22=f*k;this.n23=p-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
|
|
f*k;t=f*l;u=b*k;p=b*l;this.n11=h*k;this.n12=u*e-t;this.n13=n*e+p;this.n21=h*l;this.n22=p*e+n;this.n23=t*e-u;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;u=b*h;p=b*e;this.n11=h*k;this.n12=p-n*l;this.n13=u*l+t;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+u;this.n33=n-p*l;break;case "XZY":n=f*h;t=f*e;u=b*h;p=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+p;this.n22=f*k;this.n23=t*l-u;this.n31=u*l-t;this.n32=b*k;this.n33=p*l+n;break;default:n=f*k,t=f*
|
|
f*k;t=f*l;u=b*k;p=b*l;this.n11=h*k;this.n12=u*e-t;this.n13=n*e+p;this.n21=h*l;this.n22=p*e+n;this.n23=t*e-u;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;u=b*h;p=b*e;this.n11=h*k;this.n12=p-n*l;this.n13=u*l+t;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+u;this.n33=n-p*l;break;case "XZY":n=f*h;t=f*e;u=b*h;p=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+p;this.n22=f*k;this.n23=t*l-u;this.n31=u*l-t;this.n32=b*k;this.n33=p*l+n;break;default:n=f*k,t=f*
|
|
l,u=b*k,p=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=t+u*e,this.n22=n-p*e,this.n23=-b*h,this.n31=p-n*e,this.n32=u+t*e,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,f=c+c,h=b+b,k=e+e,a=c*f,n=c*h;c*=k;var t=b*h;b*=k;e*=k;f*=l;h*=l;l*=k;this.n11=1-(t+e);this.n12=n-l;this.n13=c+h;this.n21=n+l;this.n22=1-(a+e);this.n23=b-f;this.n31=c-h;this.n32=b+f;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
l,u=b*k,p=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=t+u*e,this.n22=n-p*e,this.n23=-b*h,this.n31=p-n*e,this.n32=u+t*e,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,f=c+c,h=b+b,k=e+e,a=c*f,n=c*h;c*=k;var t=b*h;b*=k;e*=k;f*=l;h*=l;l*=k;this.n11=1-(t+e);this.n12=n-l;this.n13=c+h;this.n21=n+l;this.n22=1-(a+e);this.n23=b-f;this.n31=c-h;this.n32=b+f;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
@@ -56,18 +56,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
|
|
if(c&&(l=l.getChildByName(a,c),l!==void 0))return l}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)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&&
|
|
if(c&&(l=l.getChildByName(a,c),l!==void 0))return l}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)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 c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
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 c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,f=a.z+a.w,l=b.z+b.w,h=-a.z+a.w,k=-b.z+b.w;return f>=0&&l>=0&&h>=0&&k>=0?!0:f<0&&l<0||h<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),h<0?c=Math.max(c,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,f,h=[],k,n,t=[],
|
|
THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,f=a.z+a.w,l=b.z+b.w,h=-a.z+a.w,k=-b.z+b.w;return f>=0&&l>=0&&h>=0&&k>=0?!0:f<0&&l<0||h<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),h<0?c=Math.max(c,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,f,h=[],k,n,t=[],
|
|
-u,p,x=[],v,y=[],w,z,B=[],C,A,D=[],K={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,F=new THREE.Vector4,Q=new THREE.Matrix4,H=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
|
-a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Q.multiply(b.projectionMatrix,b.matrixWorldInverse);Q.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
|
-Q.multiply(b.matrixWorld,b.projectionMatrixInverse);Q.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(c,e){f=0;K.objects.length=0;K.sprites.length=0;K.lights.length=0;var h=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
|
|
|
|
-f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=N[k].x*e.n14+N[k].y*e.n24+N[k].z*e.n34+N[k].w,c<=f){c=!1;break a}c=!0}c?(Q.multiplyVector3(P.copy(b.position)),l=a(),l.object=b,l.z=P.z,K.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(Q.multiplyVector3(P.copy(b.position)),l=a(),l.object=b,l.z=P.z,K.sprites.push(l)):b instanceof THREE.Light&&K.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(c);e&&
|
|
|
|
-K.objects.sort(b);return K};this.projectScene=function(a,f,l){var h=f.near,o=f.far,P,N,M,S,Y,la,aa,ma,na,ea,ka,fa,ia,ga,da,ta;A=z=v=p=0;K.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);Q.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(Q);K=this.projectGraph(a,!1);a=0;for(P=K.objects.length;a<P;a++)if(na=K.objects[a].object,ea=na.matrixWorld,
|
|
|
|
-fa=na.material,n=0,na instanceof THREE.Mesh){ka=na.geometry;ia=na.geometry.materials;S=ka.vertices;ga=ka.faces;da=ka.faceVertexUvs;ka=na.matrixRotationWorld.extractRotation(ea);N=0;for(M=S.length;N<M;N++)k=c(),k.positionWorld.copy(S[N].position),ea.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),Q.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<o;S=0;for(N=ga.length;S<
|
|
|
|
-N;S++){M=ga[S];if(M instanceof THREE.Face3)if(Y=t[M.a],la=t[M.b],aa=t[M.c],Y.visible&&la.visible&&aa.visible&&(na.doubleSided||na.flipSided!=(aa.positionScreen.x-Y.positionScreen.x)*(la.positionScreen.y-Y.positionScreen.y)-(aa.positionScreen.y-Y.positionScreen.y)*(la.positionScreen.x-Y.positionScreen.x)<0))ma=x[p]=x[p]||new THREE.RenderableFace3,p++,u=ma,u.v1.copy(Y),u.v2.copy(la),u.v3.copy(aa);else continue;else if(M instanceof THREE.Face4)if(Y=t[M.a],la=t[M.b],aa=t[M.c],ma=t[M.d],Y.visible&&la.visible&&
|
|
|
|
-aa.visible&&ma.visible&&(na.doubleSided||na.flipSided!=((ma.positionScreen.x-Y.positionScreen.x)*(la.positionScreen.y-Y.positionScreen.y)-(ma.positionScreen.y-Y.positionScreen.y)*(la.positionScreen.x-Y.positionScreen.x)<0||(la.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<0)))ta=y[v]=y[v]||new THREE.RenderableFace4,v++,u=ta,u.v1.copy(Y),u.v2.copy(la),u.v3.copy(aa),u.v4.copy(ma);else continue;
|
|
|
|
-u.normalWorld.copy(M.normal);ka.multiplyVector3(u.normalWorld);u.centroidWorld.copy(M.centroid);ea.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);Q.multiplyVector3(u.centroidScreen);aa=M.vertexNormals;Y=0;for(la=aa.length;Y<la;Y++)ma=u.vertexNormalsWorld[Y],ma.copy(aa[Y]),ka.multiplyVector3(ma);Y=0;for(la=da.length;Y<la;Y++)if(ta=da[Y][S]){aa=0;for(ma=ta.length;aa<ma;aa++)u.uvs[Y][aa]=ta[aa]}u.material=fa;u.faceMaterial=M.materialIndex!==null?ia[M.materialIndex]:null;u.z=
|
|
|
|
-u.centroidScreen.z;K.elements.push(u)}}else if(na instanceof THREE.Line){H.multiply(Q,ea);S=na.geometry.vertices;Y=c();Y.positionScreen.copy(S[0].position);H.multiplyVector4(Y.positionScreen);N=1;for(M=S.length;N<M;N++)if(Y=c(),Y.positionScreen.copy(S[N].position),H.multiplyVector4(Y.positionScreen),la=t[n-2],L.copy(Y.positionScreen),G.copy(la.positionScreen),e(L,G))L.multiplyScalar(1/L.w),G.multiplyScalar(1/G.w),na=B[z]=B[z]||new THREE.RenderableLine,z++,w=na,w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(G),
|
|
|
|
-w.z=Math.max(L.z,G.z),w.material=fa,K.elements.push(w)}a=0;for(P=K.sprites.length;a<P;a++)if(na=K.sprites[a].object,ea=na.matrixWorld,na instanceof THREE.Particle&&(F.set(ea.n14,ea.n24,ea.n34,1),Q.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))h=D[A]=D[A]||new THREE.RenderableParticle,A++,C=h,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=na.rotation.z,C.scale.x=na.scale.x*Math.abs(C.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),C.scale.y=na.scale.y*Math.abs(C.y-(F.y+f.projectionMatrix.n22)/
|
|
|
|
-(F.w+f.projectionMatrix.n24)),C.material=na.material,K.elements.push(C);l&&K.elements.sort(b);return K}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
|
|
|
+u,p,x=[],v,y=[],w,A,z=[],C,B,D=[],K={objects:[],sprites:[],lights:[],elements:[]},O=new THREE.Vector3,F=new THREE.Vector4,P=new THREE.Matrix4,H=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
|
+a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=M[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);P.multiply(b.projectionMatrix,b.matrixWorldInverse);P.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
|
+P.multiply(b.matrixWorld,b.projectionMatrixInverse);P.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(c,e){f=0;K.objects.length=0;K.sprites.length=0;K.lights.length=0;var h=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
|
|
|
|
+f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=M[k].x*e.n14+M[k].y*e.n24+M[k].z*e.n34+M[k].w,c<=f){c=!1;break a}c=!0}c?(P.multiplyVector3(O.copy(b.position)),l=a(),l.object=b,l.z=O.z,K.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(P.multiplyVector3(O.copy(b.position)),l=a(),l.object=b,l.z=O.z,K.sprites.push(l)):b instanceof THREE.Light&&K.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(c);e&&
|
|
|
|
+K.objects.sort(b);return K};this.projectScene=function(a,f,l){var h=f.near,o=f.far,O,M,L,Q,$,na,fa,sa,ia,Z,ma,da,ja,la,ga,pa;B=A=v=p=0;K.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);P.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(P);K=this.projectGraph(a,!1);a=0;for(O=K.objects.length;a<O;a++)if(ia=K.objects[a].object,Z=ia.matrixWorld,
|
|
|
|
+da=ia.material,n=0,ia instanceof THREE.Mesh){ma=ia.geometry;ja=ia.geometry.materials;Q=ma.vertices;la=ma.faces;ga=ma.faceVertexUvs;ma=ia.matrixRotationWorld.extractRotation(Z);M=0;for(L=Q.length;M<L;M++)k=c(),k.positionWorld.copy(Q[M].position),Z.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),P.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<o;Q=0;for(M=la.length;Q<
|
|
|
|
+M;Q++){L=la[Q];if(L instanceof THREE.Face3)if($=t[L.a],na=t[L.b],fa=t[L.c],$.visible&&na.visible&&fa.visible&&(ia.doubleSided||ia.flipSided!=(fa.positionScreen.x-$.positionScreen.x)*(na.positionScreen.y-$.positionScreen.y)-(fa.positionScreen.y-$.positionScreen.y)*(na.positionScreen.x-$.positionScreen.x)<0))sa=x[p]=x[p]||new THREE.RenderableFace3,p++,u=sa,u.v1.copy($),u.v2.copy(na),u.v3.copy(fa);else continue;else if(L instanceof THREE.Face4)if($=t[L.a],na=t[L.b],fa=t[L.c],sa=t[L.d],$.visible&&na.visible&&
|
|
|
|
+fa.visible&&sa.visible&&(ia.doubleSided||ia.flipSided!=((sa.positionScreen.x-$.positionScreen.x)*(na.positionScreen.y-$.positionScreen.y)-(sa.positionScreen.y-$.positionScreen.y)*(na.positionScreen.x-$.positionScreen.x)<0||(na.positionScreen.x-fa.positionScreen.x)*(sa.positionScreen.y-fa.positionScreen.y)-(na.positionScreen.y-fa.positionScreen.y)*(sa.positionScreen.x-fa.positionScreen.x)<0)))pa=y[v]=y[v]||new THREE.RenderableFace4,v++,u=pa,u.v1.copy($),u.v2.copy(na),u.v3.copy(fa),u.v4.copy(sa);else continue;
|
|
|
|
+u.normalWorld.copy(L.normal);ma.multiplyVector3(u.normalWorld);u.centroidWorld.copy(L.centroid);Z.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);P.multiplyVector3(u.centroidScreen);fa=L.vertexNormals;$=0;for(na=fa.length;$<na;$++)sa=u.vertexNormalsWorld[$],sa.copy(fa[$]),ma.multiplyVector3(sa);$=0;for(na=ga.length;$<na;$++)if(pa=ga[$][Q]){fa=0;for(sa=pa.length;fa<sa;fa++)u.uvs[$][fa]=pa[fa]}u.material=da;u.faceMaterial=L.materialIndex!==null?ja[L.materialIndex]:null;u.z=u.centroidScreen.z;
|
|
|
|
+K.elements.push(u)}}else if(ia instanceof THREE.Line){H.multiply(P,Z);Q=ia.geometry.vertices;$=c();$.positionScreen.copy(Q[0].position);H.multiplyVector4($.positionScreen);M=1;for(L=Q.length;M<L;M++)if($=c(),$.positionScreen.copy(Q[M].position),H.multiplyVector4($.positionScreen),na=t[n-2],J.copy($.positionScreen),G.copy(na.positionScreen),e(J,G))J.multiplyScalar(1/J.w),G.multiplyScalar(1/G.w),ia=z[A]=z[A]||new THREE.RenderableLine,A++,w=ia,w.v1.positionScreen.copy(J),w.v2.positionScreen.copy(G),
|
|
|
|
+w.z=Math.max(J.z,G.z),w.material=da,K.elements.push(w)}a=0;for(O=K.sprites.length;a<O;a++)if(ia=K.sprites[a].object,Z=ia.matrixWorld,ia instanceof THREE.Particle&&(F.set(Z.n14,Z.n24,Z.n34,1),P.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))h=D[B]=D[B]||new THREE.RenderableParticle,B++,C=h,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=ia.rotation.z,C.scale.x=ia.scale.x*Math.abs(C.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),C.scale.y=ia.scale.y*Math.abs(C.y-(F.y+f.projectionMatrix.n22)/(F.w+
|
|
|
|
+f.projectionMatrix.n24)),C.material=ia.material,K.elements.push(C);l&&K.elements.sort(b);return K}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),f=Math.cos(b),b=Math.sin(b),h=a*c,k=e*l;this.w=h*f-k*b;this.x=h*b+k*f;this.y=e*c*f+a*l*b;this.z=a*l*f-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),f=Math.cos(b),b=Math.sin(b),h=a*c,k=e*l;this.w=h*f-k*b;this.x=h*b+k*f;this.y=e*c*f+a*l*b;this.z=a*l*f-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-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);a===0?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 c=
|
|
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);a===0?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 c=
|
|
@@ -83,9 +83,9 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
|
|
b,e,l,f,h,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){f=this.faces[e];if(a&&f.vertexNormals.length){k.set(0,0,0);c=0;for(b=f.vertexNormals.length;c<b;c++)k.addSelf(f.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[f.a],b=this.vertices[f.b],h=this.vertices[f.c],k.sub(h.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();f.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
b,e,l,f,h,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){f=this.faces[e];if(a&&f.vertexNormals.length){k.set(0,0,0);c=0;for(b=f.vertexNormals.length;c<b;c++)k.addSelf(f.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[f.a],b=this.vertices[f.b],h=this.vertices[f.c],k.sub(h.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();f.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
-b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,f,l,U){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;u=h[f];p=h[l];x=h[U];v=n.x-k.x;y=t.x-k.x;w=n.y-k.y;z=t.y-k.y;B=n.z-k.z;C=t.z-k.z;A=p.u-u.u;D=x.u-u.u;K=p.v-u.v;P=x.v-u.v;F=1/(A*P-D*K);L.set((P*v-K*y)*F,(P*w-K*z)*F,(P*B-K*C)*F);G.set((A*y-D*v)*F,(A*z-D*w)*F,(A*C-D*B)*F);H[b].addSelf(L);H[c].addSelf(L);H[e].addSelf(L);N[b].addSelf(G);
|
|
|
|
-N[c].addSelf(G);N[e].addSelf(G)}var c,b,e,l,f,h,k,n,t,u,p,x,v,y,w,z,B,C,A,D,K,P,F,Q,H=[],N=[],L=new THREE.Vector3,G=new THREE.Vector3,W=new THREE.Vector3,ca=new THREE.Vector3,X=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)H[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],h=this.faceVertexUvs[0][c],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 U=["a",
|
|
|
|
-"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(e=0;e<f.vertexNormals.length;e++)X.copy(f.vertexNormals[e]),l=f[U[e]],Q=H[l],W.copy(Q),W.subSelf(X.multiplyScalar(X.dot(Q))).normalize(),ca.cross(f.vertexNormals[e],Q),l=ca.dot(N[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(W.x,W.y,W.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
|
|
|
+b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,f,l,S){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;u=h[f];p=h[l];x=h[S];v=n.x-k.x;y=t.x-k.x;w=n.y-k.y;A=t.y-k.y;z=n.z-k.z;C=t.z-k.z;B=p.u-u.u;D=x.u-u.u;K=p.v-u.v;O=x.v-u.v;F=1/(B*O-D*K);J.set((O*v-K*y)*F,(O*w-K*A)*F,(O*z-K*C)*F);G.set((B*y-D*v)*F,(B*A-D*w)*F,(B*C-D*z)*F);H[b].addSelf(J);H[c].addSelf(J);H[e].addSelf(J);M[b].addSelf(G);
|
|
|
|
+M[c].addSelf(G);M[e].addSelf(G)}var c,b,e,l,f,h,k,n,t,u,p,x,v,y,w,A,z,C,B,D,K,O,F,P,H=[],M=[],J=new THREE.Vector3,G=new THREE.Vector3,X=new THREE.Vector3,ca=new THREE.Vector3,T=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)H[c]=new THREE.Vector3,M[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],h=this.faceVertexUvs[0][c],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 S=["a",
|
|
|
|
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(e=0;e<f.vertexNormals.length;e++)T.copy(f.vertexNormals[e]),l=f[S[e]],P=H[l],X.copy(P),X.subSelf(T.multiplyScalar(T.dot(P))).normalize(),ca.cross(f.vertexNormals[e],P),l=ca.dot(M[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(X.x,X.y,X.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,l=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)e=this.vertices[f].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=f,c.push(this.vertices[f]),
|
|
a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,l=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)e=this.vertices[f].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=f,c.push(this.vertices[f]),
|
|
b[f]=c.length-1):b[f]=b[a[e]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
b[f]=c.length-1):b[f]=b[a[e]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
@@ -150,46 +150,46 @@ THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lig
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,f;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;f=e/2};this.render=function(b,e){var n,t,u,p,x,v,y,w;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){y=x.x*l+l;w=x.y*f+f;u=0;for(p=x.material.length;u<p;u++)if(v=x.material[u],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=y+"px",v.style.top=w+"px"}}};
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,f;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;f=e/2};this.render=function(b,e){var n,t,u,p,x,v,y,w;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){y=x.x*l+l;w=x.y*f+f;u=0;for(p=x.material.length;u<p;u++)if(v=x.material[u],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=y+"px",v.style.top=w+"px"}}};
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(C!=a)w.globalAlpha=C=a}function b(a){if(A!=a){switch(a){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}A=a}}function e(a){if(D!=a)w.strokeStyle=D=a}function l(a){if(K!=a)w.fillStyle=K=a}var f=this,h,k,n,t=new THREE.Projector,a=a||{},u=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
-p,x,v,y,w=u.getContext("2d"),z=new THREE.Color(0),B=0,C=1,A=0,D=null,K=null,P=null,F=null,Q=null,H,N,L,G,W=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,X,U,o,$,ha,M,S,Y,la,aa,ma,na,ea=new THREE.Color,ka=new THREE.Color,fa=new THREE.Color,ia=new THREE.Color,ga=new THREE.Color,da=[],ta,ua,qa,sa,Da,va,Ea,Ca,Ga,R,ja=new THREE.Rectangle,Z=new THREE.Rectangle,J=new THREE.Rectangle,O=!1,ra=new THREE.Color,xa=new THREE.Color,oa=new THREE.Color,pa=new THREE.Vector3,ya,za,Fa,Ba,Ha,V,a=16;ya=document.createElement("canvas");
|
|
|
|
-ya.width=ya.height=2;za=ya.getContext("2d");za.fillStyle="rgba(0,0,0,1)";za.fillRect(0,0,2,2);Fa=za.getImageData(0,0,2,2);Ba=Fa.data;Ha=document.createElement("canvas");Ha.width=Ha.height=a;V=Ha.getContext("2d");V.translate(-a/2,-a/2);V.scale(a,a);a--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;v=Math.floor(p/2);y=Math.floor(x/2);u.width=p;u.height=x;ja.set(-v,-y,v,y);Z.set(-v,-y,v,y);C=1;A=0;Q=F=
|
|
|
|
-P=K=D=null};this.setClearColor=function(a,b){z.copy(a);B=b;Z.set(-v,-y,v,y)};this.setClearColorHex=function(a,b){z.setHex(a);B=b;Z.set(-v,-y,v,y)};this.clear=function(){w.setTransform(1,0,0,-1,v,y);Z.isEmpty()||(Z.minSelf(ja),Z.inflate(2),B<1&&w.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),B>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+B+")"),w.fillRect(Math.floor(Z.getX()),
|
|
|
|
-Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,u){function p(a){var b,c,e,f;ra.setRGB(0,0,0);xa.setRGB(0,0,0);oa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b):e instanceof THREE.DirectionalLight?(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b):e instanceof THREE.PointLight&&(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b)}function x(a,b,c,e){var f,l,h,k,o,n;f=0;for(l=a.length;f<l;f++)h=a[f],k=h.color,
|
|
|
|
-h instanceof THREE.DirectionalLight?(o=h.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):h instanceof THREE.PointLight&&(o=h.matrixWorld.getPosition(),n=c.dot(pa.sub(o,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(o)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function z(a,f,h){c(h.opacity);b(h.blending);var k,o,n,t,u,wa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=h.map.image,u=t.width>>1,wa=
|
|
|
|
-t.height>>1,h=f.scale.x*v,n=f.scale.y*y,k=h*u,o=n*wa,J.set(a.x-k,a.y-o,a.x+k,a.y+o),ja.intersects(J)&&(w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(h,-n),w.translate(-u,-wa),w.drawImage(t,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*v,o=f.scale.y*y,J.set(a.x-k,a.y-o,a.x+k,a.y+o),ja.intersects(J)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(k,o),h.program(w),w.restore()))}function B(a,
|
|
|
|
-f,l,h){c(h.opacity);b(h.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(f.positionScreen.x,f.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(P!=a)w.lineWidth=P=a;a=h.linecap;if(F!=a)w.lineCap=F=a;a=h.linejoin;if(Q!=a)w.lineJoin=Q=a;e(h.color.getContextStyle());w.stroke();J.inflate(h.linewidth*2)}}function A(a,e,h,l,k,t,v,p){f.info.render.vertices+=3;f.info.render.faces++;c(p.opacity);b(p.blending);X=a.positionScreen.x;U=a.positionScreen.y;
|
|
|
|
-o=e.positionScreen.x;$=e.positionScreen.y;ha=h.positionScreen.x;M=h.positionScreen.y;Ua(X,U,o,$,ha,M);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Ya(X,U,o,$,ha,M,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[t].u,sa[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=u.matrixWorldInverse,pa.copy(v.vertexNormalsWorld[l]),Da=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,va=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*
|
|
|
|
-0.5+0.5,pa.copy(v.vertexNormalsWorld[k]),Ea=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,Ca=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(v.vertexNormalsWorld[t]),Ga=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,R=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,Ya(X,U,o,$,ha,M,Da,va,Ea,Ca,Ga,R,p.envMap)}else p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
|
|
|
|
-(sa=v.uvs[0],Ya(X,U,o,$,ha,M,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[t].u,sa[t].v,p.map)),b(THREE.SubtractiveBlending)),O?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ka.r=fa.r=ia.r=ra.r,ka.g=fa.g=ia.g=ra.g,ka.b=fa.b=ia.b=ra.b,x(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ka),x(n,v.v2.positionWorld,v.vertexNormalsWorld[1],fa),x(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),ka.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ka.b=
|
|
|
|
-Math.max(0,Math.min(p.color.b*ka.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),ga.r=(fa.r+ia.r)*0.5,ga.g=(fa.g+ia.g)*0.5,ga.b=(fa.b+ia.b)*0.5,qa=Va(ka,fa,ia,ga),Sa(X,U,o,$,ha,M,0,0,1,0,0,1,qa)):(ea.r=ra.r,ea.g=ra.g,ea.b=ra.b,x(n,v.centroidWorld,v.normalWorld,ea),ea.r=Math.max(0,
|
|
|
|
-Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),p.wireframe?D(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(ea)):p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color);else if(p instanceof THREE.MeshDepthMaterial)ta=u.near,ua=u.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,ua),fa.r=fa.g=fa.b=1-Ma(e.positionScreen.z,ta,ua),ia.r=ia.g=ia.b=1-Ma(h.positionScreen.z,ta,ua),ga.r=
|
|
|
|
-(fa.r+ia.r)*0.5,ga.g=(fa.g+ia.g)*0.5,ga.b=(fa.b+ia.b)*0.5,qa=Va(ka,fa,ia,ga),Sa(X,U,o,$,ha,M,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)ea.r=Ta(v.normalWorld.x),ea.g=Ta(v.normalWorld.y),ea.b=Ta(v.normalWorld.z),p.wireframe?D(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(ea)}function C(a,e,h,l,k,t,v,p,w){f.info.render.vertices+=4;f.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)A(a,e,l,0,1,3,v,p,w),A(k,h,t,1,2,3,v,p,w);else if(X=a.positionScreen.x,
|
|
|
|
-U=a.positionScreen.y,o=e.positionScreen.x,$=e.positionScreen.y,ha=h.positionScreen.x,M=h.positionScreen.y,S=l.positionScreen.x,Y=l.positionScreen.y,la=k.positionScreen.x,aa=k.positionScreen.y,ma=t.positionScreen.x,na=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Wa(X,U,o,$,ha,M,S,Y),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color);else if(p instanceof THREE.MeshLambertMaterial)O?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
|
-4?(ka.r=fa.r=ia.r=ga.r=ra.r,ka.g=fa.g=ia.g=ga.g=ra.g,ka.b=fa.b=ia.b=ga.b=ra.b,x(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ka),x(n,v.v2.positionWorld,v.vertexNormalsWorld[1],fa),x(n,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),x(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ga),ka.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(p.color.b*ka.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),
|
|
|
|
-fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),qa=Va(ka,fa,ia,ga),Ua(X,U,o,$,S,Y),Sa(X,U,o,$,S,Y,0,0,1,0,0,1,qa),Ua(la,aa,ha,M,ma,na),Sa(la,aa,ha,M,ma,na,1,0,1,1,0,1,qa)):(ea.r=ra.r,ea.g=ra.g,ea.b=ra.b,x(n,v.centroidWorld,v.normalWorld,ea),
|
|
|
|
-ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),Wa(X,U,o,$,ha,M,S,Y),p.wireframe?D(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(ea)):(Wa(X,U,o,$,ha,M,S,Y),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color));else if(p instanceof THREE.MeshNormalMaterial)ea.r=Ta(v.normalWorld.x),ea.g=Ta(v.normalWorld.y),ea.b=Ta(v.normalWorld.z),Wa(X,U,o,$,ha,M,S,Y),p.wireframe?
|
|
|
|
-D(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(ea);else if(p instanceof THREE.MeshDepthMaterial)ta=u.near,ua=u.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,ua),fa.r=fa.g=fa.b=1-Ma(e.positionScreen.z,ta,ua),ia.r=ia.g=ia.b=1-Ma(l.positionScreen.z,ta,ua),ga.r=ga.g=ga.b=1-Ma(h.positionScreen.z,ta,ua),qa=Va(ka,fa,ia,ga),Ua(X,U,o,$,S,Y),Sa(X,U,o,$,S,Y,0,0,1,0,0,1,qa),Ua(la,aa,ha,M,ma,na),Sa(la,aa,ha,M,ma,na,1,0,1,1,0,1,qa)}function Ua(a,b,c,e,f,h){w.beginPath();w.moveTo(a,b);w.lineTo(c,
|
|
|
|
-e);w.lineTo(f,h);w.lineTo(a,b);w.closePath()}function Wa(a,b,c,e,f,h,l,k){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(f,h);w.lineTo(l,k);w.lineTo(a,b);w.closePath()}function D(a,b,c,f){if(P!=b)w.lineWidth=P=b;if(F!=c)w.lineCap=F=c;if(Q!=f)w.lineJoin=Q=f;e(a.getContextStyle());w.stroke();J.inflate(b*2)}function K(a){l(a.getContextStyle());w.fill()}function Ya(a,b,c,e,f,h,k,o,n,p,t,v,u){if(u.image.width!=0){if(u.needsUpdate==!0||da[u.id]==void 0){var wa=u.wrapS==THREE.RepeatWrapping,x=u.wrapT==
|
|
|
|
-THREE.RepeatWrapping;da[u.id]=w.createPattern(u.image,wa&&x?"repeat":wa&&!x?"repeat-x":!wa&&x?"repeat-y":"no-repeat");u.needsUpdate=!1}l(da[u.id]);var wa=u.offset.x/u.repeat.x,x=u.offset.y/u.repeat.y,R=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,k=(k+wa)*R,o=(o+x)*u,n=(n+wa)*R,p=(p+x)*u,t=(t+wa)*R,v=(v+x)*u;c-=a;e-=b;f-=a;h-=b;n-=k;p-=o;t-=k;v-=o;wa=1/(n*v-t*p);u=(v*c-p*f)*wa;p=(v*e-p*h)*wa;c=(n*f-t*c)*wa;e=(n*h-t*e)*wa;a=a-u*k-c*o;b=b-p*k-e*o;w.save();w.transform(u,p,c,e,a,b);w.fill();
|
|
|
|
-w.restore()}}function Sa(a,b,c,e,f,h,l,k,o,n,p,t,v){var u,wa;u=v.width-1;wa=v.height-1;l*=u;k*=wa;o*=u;n*=wa;p*=u;t*=wa;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;p-=l;t-=k;wa=1/(o*t-p*n);u=(t*c-n*f)*wa;n=(t*e-n*h)*wa;c=(o*f-p*c)*wa;e=(o*h-p*e)*wa;a=a-u*l-c*k;b=b-n*l-e*k;w.save();w.transform(u,n,c,e,a,b);w.clip();w.drawImage(v,0,0);w.restore()}function Va(a,b,c,e){var f=~~(a.r*255),h=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),t=~~(e.g*
|
|
|
|
-255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=h<0?0:h>255?255:h;Ba[2]=a<0?0:a>255?255:a;Ba[4]=l<0?0:l>255?255:l;Ba[5]=k<0?0:k>255?255:k;Ba[6]=b<0?0:b>255?255:b;Ba[8]=o<0?0:o>255?255:o;Ba[9]=n<0?0:n>255?255:n;Ba[10]=c<0?0:c>255?255:c;Ba[12]=p<0?0:p>255?255:p;Ba[13]=t<0?0:t>255?255:t;Ba[14]=e<0?0:e>255?255:e;za.putImageData(Fa,0,0);V.drawImage(ya,0,0);return Ha}function Ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function La(a,b){var c=b.x-a.x,e=b.y-
|
|
|
|
-a.y,f=c*c+e*e;f!=0&&(f=1/Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Xa,Za,Aa,Ia;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,y);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,u,this.sortElements);k=h.elements;n=h.lights;(O=n.length>0)&&p(n);Xa=0;for(Za=k.length;Xa<Za;Xa++)if(Aa=k[Xa],Ia=Aa.material,Ia=Ia instanceof THREE.MeshFaceMaterial?Aa.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){J.empty();if(Aa instanceof THREE.RenderableParticle)H=Aa,H.x*=v,H.y*=y,z(H,
|
|
|
|
-Aa,Ia,a);else if(Aa instanceof THREE.RenderableLine)H=Aa.v1,N=Aa.v2,H.positionScreen.x*=v,H.positionScreen.y*=y,N.positionScreen.x*=v,N.positionScreen.y*=y,J.addPoint(H.positionScreen.x,H.positionScreen.y),J.addPoint(N.positionScreen.x,N.positionScreen.y),ja.intersects(J)&&B(H,N,Aa,Ia,a);else if(Aa instanceof THREE.RenderableFace3)H=Aa.v1,N=Aa.v2,L=Aa.v3,H.positionScreen.x*=v,H.positionScreen.y*=y,N.positionScreen.x*=v,N.positionScreen.y*=y,L.positionScreen.x*=v,L.positionScreen.y*=y,Ia.overdraw&&
|
|
|
|
-(La(H.positionScreen,N.positionScreen),La(N.positionScreen,L.positionScreen),La(L.positionScreen,H.positionScreen)),J.add3Points(H.positionScreen.x,H.positionScreen.y,N.positionScreen.x,N.positionScreen.y,L.positionScreen.x,L.positionScreen.y),ja.intersects(J)&&A(H,N,L,0,1,2,Aa,Ia,a);else if(Aa instanceof THREE.RenderableFace4)H=Aa.v1,N=Aa.v2,L=Aa.v3,G=Aa.v4,H.positionScreen.x*=v,H.positionScreen.y*=y,N.positionScreen.x*=v,N.positionScreen.y*=y,L.positionScreen.x*=v,L.positionScreen.y*=y,G.positionScreen.x*=
|
|
|
|
-v,G.positionScreen.y*=y,W.positionScreen.copy(N.positionScreen),ca.positionScreen.copy(G.positionScreen),Ia.overdraw&&(La(H.positionScreen,N.positionScreen),La(N.positionScreen,G.positionScreen),La(G.positionScreen,H.positionScreen),La(L.positionScreen,W.positionScreen),La(L.positionScreen,ca.positionScreen)),J.addPoint(H.positionScreen.x,H.positionScreen.y),J.addPoint(N.positionScreen.x,N.positionScreen.y),J.addPoint(L.positionScreen.x,L.positionScreen.y),J.addPoint(G.positionScreen.x,G.positionScreen.y),
|
|
|
|
-ja.intersects(J)&&C(H,N,L,G,W,ca,Aa,Ia,a);Z.addRectangle(J)}w.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,l,k,n,p;f=0;for(h=a.length;f<h;f++)l=a[f],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),p=c.dot(H.sub(n,b).normalize()),p<=0||(p*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),p!=0&&(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"path"),X==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,u,p,x,v,y,w,z,B=new THREE.Rectangle,C=new THREE.Rectangle,A=!1,D=new THREE.Color,K=new THREE.Color,P=new THREE.Color,F=new THREE.Color,Q,H=new THREE.Vector3,N=[],L=[],G,W,ca,X=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":X=1;break;case "low":X=0}};this.setSize=function(a,b){t=a;u=b;p=t/2;x=u/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+u);n.setAttribute("width",t);n.setAttribute("height",u);B.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var u,H,M,S;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);f=l.elements;
|
|
|
|
-h=l.lights;ca=W=0;if(A=h.length>0){K.setRGB(0,0,0);P.setRGB(0,0,0);F.setRGB(0,0,0);u=0;for(H=h.length;u<H;u++)S=h[u],M=S.color,S instanceof THREE.AmbientLight?(K.r+=M.r,K.g+=M.g,K.b+=M.b):S instanceof THREE.DirectionalLight?(P.r+=M.r,P.g+=M.g,P.b+=M.b):S instanceof THREE.PointLight&&(F.r+=M.r,F.g+=M.g,F.b+=M.b)}u=0;for(H=f.length;u<H;u++)if(M=f[u],S=M.material,S=S instanceof THREE.MeshFaceMaterial?M.faceMaterial:S,!(S==null||S.opacity==0))if(C.empty(),M instanceof THREE.RenderableParticle)v=M,v.x*=
|
|
|
|
-p,v.y*=-x,m=0,ml=M.materials.length;else if(M instanceof THREE.RenderableLine){if(v=M.v1,y=M.v2,v.positionScreen.x*=p,v.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),B.intersects(C)){M=v;var N=y,la=ca++;L[la]==null&&(L[la]=document.createElementNS("http://www.w3.org/2000/svg","line"),X==0&&L[la].setAttribute("shape-rendering","crispEdges"));G=L[la];G.setAttribute("x1",M.positionScreen.x);
|
|
|
|
-G.setAttribute("y1",M.positionScreen.y);G.setAttribute("x2",N.positionScreen.x);G.setAttribute("y2",N.positionScreen.y);S instanceof THREE.LineBasicMaterial&&(G.setAttribute("style","fill: none; stroke: "+S.color.getContextStyle()+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin),n.appendChild(G))}}else if(M instanceof THREE.RenderableFace3){if(v=M.v1,y=M.v2,w=M.v3,v.positionScreen.x*=p,v.positionScreen.y*=-x,y.positionScreen.x*=
|
|
|
|
-p,y.positionScreen.y*=-x,w.positionScreen.x*=p,w.positionScreen.y*=-x,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),B.intersects(C)){var N=v,la=y,aa=w;e.info.render.vertices+=3;e.info.render.faces++;G=c(W++);G.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");S instanceof THREE.MeshBasicMaterial?
|
|
|
|
-D.copy(S.color):S instanceof THREE.MeshLambertMaterial?A?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,M.centroidWorld,M.normalWorld,D),D.r=Math.max(0,Math.min(S.color.r*D.r,1)),D.g=Math.max(0,Math.min(S.color.g*D.g,1)),D.b=Math.max(0,Math.min(S.color.b*D.b,1))):D.copy(S.color):S instanceof THREE.MeshDepthMaterial?(Q=1-S.__2near/(S.__farPlusNear-M.z*S.__farMinusNear),D.setRGB(Q,Q,Q)):S instanceof THREE.MeshNormalMaterial&&D.setRGB(b(M.normalWorld.x),b(M.normalWorld.y),b(M.normalWorld.z));S.wireframe?G.setAttribute("style",
|
|
|
|
-"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):G.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+S.opacity);n.appendChild(G)}}else if(M instanceof THREE.RenderableFace4&&(v=M.v1,y=M.v2,w=M.v3,z=M.v4,v.positionScreen.x*=p,v.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,w.positionScreen.x*=p,w.positionScreen.y*=
|
|
|
|
--x,z.positionScreen.x*=p,z.positionScreen.y*=-x,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),B.intersects(C))){var N=v,la=y,aa=w,ma=z;e.info.render.vertices+=4;e.info.render.faces++;G=c(W++);G.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+
|
|
|
|
-" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");S instanceof THREE.MeshBasicMaterial?D.copy(S.color):S instanceof THREE.MeshLambertMaterial?A?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,M.centroidWorld,M.normalWorld,D),D.r=Math.max(0,Math.min(S.color.r*D.r,1)),D.g=Math.max(0,Math.min(S.color.g*D.g,1)),D.b=Math.max(0,Math.min(S.color.b*D.b,1))):D.copy(S.color):S instanceof THREE.MeshDepthMaterial?(Q=1-S.__2near/(S.__farPlusNear-M.z*S.__farMinusNear),D.setRGB(Q,Q,Q)):S instanceof THREE.MeshNormalMaterial&&
|
|
|
|
-D.setRGB(b(M.normalWorld.x),b(M.normalWorld.y),b(M.normalWorld.z));S.wireframe?G.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):G.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+S.opacity);n.appendChild(G)}}};
|
|
|
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(C!=a)w.globalAlpha=C=a}function b(a){if(B!=a){switch(a){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}B=a}}function e(a){if(D!=a)w.strokeStyle=D=a}function l(a){if(K!=a)w.fillStyle=K=a}var f=this,h,k,n,t=new THREE.Projector,a=a||{},u=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
+p,x,v,y,w=u.getContext("2d"),A=new THREE.Color(0),z=0,C=1,B=0,D=null,K=null,O=null,F=null,P=null,H,M,J,G,X=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,T,S,o,Y,ha,L,Q,$,na,fa,sa,ia,Z=new THREE.Color,ma=new THREE.Color,da=new THREE.Color,ja=new THREE.Color,la=new THREE.Color,ga=[],pa,va,qa,ka,wa,Fa,Da,ua,Ga,U,aa=new THREE.Rectangle,ea=new THREE.Rectangle,W=new THREE.Rectangle,N=!1,ra=new THREE.Color,Aa=new THREE.Color,ta=new THREE.Color,oa=new THREE.Vector3,Ba,ya,Ia,Ca,Ea,V,a=16;Ba=document.createElement("canvas");
|
|
|
|
+Ba.width=Ba.height=2;ya=Ba.getContext("2d");ya.fillStyle="rgba(0,0,0,1)";ya.fillRect(0,0,2,2);Ia=ya.getImageData(0,0,2,2);Ca=Ia.data;Ea=document.createElement("canvas");Ea.width=Ea.height=a;V=Ea.getContext("2d");V.translate(-a/2,-a/2);V.scale(a,a);a--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;v=Math.floor(p/2);y=Math.floor(x/2);u.width=p;u.height=x;aa.set(-v,-y,v,y);ea.set(-v,-y,v,y);C=1;B=0;P=
|
|
|
|
+F=O=K=D=null};this.setClearColor=function(a,b){A.copy(a);z=b;ea.set(-v,-y,v,y)};this.setClearColorHex=function(a,b){A.setHex(a);z=b;ea.set(-v,-y,v,y)};this.clear=function(){w.setTransform(1,0,0,-1,v,y);ea.isEmpty()||(ea.minSelf(aa),ea.inflate(2),z<1&&w.clearRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight())),z>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*255)+","+z+")"),w.fillRect(Math.floor(ea.getX()),
|
|
|
|
+Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight()))),ea.empty())};this.render=function(a,u){function p(a){var b,c,e,f;ra.setRGB(0,0,0);Aa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b):e instanceof THREE.DirectionalLight?(Aa.r+=f.r,Aa.g+=f.g,Aa.b+=f.b):e instanceof THREE.PointLight&&(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b)}function x(a,b,c,e){var f,l,h,k,o,n;f=0;for(l=a.length;f<l;f++)h=a[f],
|
|
|
|
+k=h.color,h instanceof THREE.DirectionalLight?(o=h.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):h instanceof THREE.PointLight&&(o=h.matrixWorld.getPosition(),n=c.dot(oa.sub(o,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(o)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function A(a,f,h){c(h.opacity);b(h.blending);var k,o,n,t,u,xa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=h.map.image,u=t.width>>
|
|
|
|
+1,xa=t.height>>1,h=f.scale.x*v,n=f.scale.y*y,k=h*u,o=n*xa,W.set(a.x-k,a.y-o,a.x+k,a.y+o),aa.intersects(W)&&(w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(h,-n),w.translate(-u,-xa),w.drawImage(t,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*v,o=f.scale.y*y,W.set(a.x-k,a.y-o,a.x+k,a.y+o),aa.intersects(W)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(k,o),h.program(w),w.restore()))}
|
|
|
|
+function z(a,f,l,h){c(h.opacity);b(h.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(f.positionScreen.x,f.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(O!=a)w.lineWidth=O=a;a=h.linecap;if(F!=a)w.lineCap=F=a;a=h.linejoin;if(P!=a)w.lineJoin=P=a;e(h.color.getContextStyle());w.stroke();W.inflate(h.linewidth*2)}}function B(a,e,h,l,k,t,v,p){f.info.render.vertices+=3;f.info.render.faces++;c(p.opacity);b(p.blending);T=a.positionScreen.x;
|
|
|
|
+S=a.positionScreen.y;o=e.positionScreen.x;Y=e.positionScreen.y;ha=h.positionScreen.x;L=h.positionScreen.y;Ua(T,S,o,Y,ha,L);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ka=v.uvs[0],$a(T,S,o,Y,ha,L,ka[l].u,ka[l].v,ka[k].u,ka[k].v,ka[t].u,ka[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=u.matrixWorldInverse,oa.copy(v.vertexNormalsWorld[l]),wa=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,Fa=-(oa.x*a.n21+oa.y*
|
|
|
|
+a.n22+oa.z*a.n23)*0.5+0.5,oa.copy(v.vertexNormalsWorld[k]),Da=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,ua=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*0.5+0.5,oa.copy(v.vertexNormalsWorld[t]),Ga=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,U=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*0.5+0.5,$a(T,S,o,Y,ha,L,wa,Fa,Da,ua,Ga,U,p.envMap)}else p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
|
|
|
|
+THREE.UVMapping&&(ka=v.uvs[0],$a(T,S,o,Y,ha,L,ka[l].u,ka[l].v,ka[k].u,ka[k].v,ka[t].u,ka[t].v,p.map)),b(THREE.SubtractiveBlending)),N?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ma.r=da.r=ja.r=ra.r,ma.g=da.g=ja.g=ra.g,ma.b=da.b=ja.b=ra.b,x(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ma),x(n,v.v2.positionWorld,v.vertexNormalsWorld[1],da),x(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),ma.r=Math.max(0,Math.min(p.color.r*ma.r,1)),ma.g=Math.max(0,Math.min(p.color.g*
|
|
|
|
+ma.g,1)),ma.b=Math.max(0,Math.min(p.color.b*ma.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=Math.max(0,Math.min(p.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(p.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(p.color.b*ja.b,1)),la.r=(da.r+ja.r)*0.5,la.g=(da.g+ja.g)*0.5,la.b=(da.b+ja.b)*0.5,qa=Va(ma,da,ja,la),Sa(T,S,o,Y,ha,L,0,0,1,0,0,1,qa)):(Z.r=ra.r,Z.g=ra.g,Z.b=ra.b,x(n,v.centroidWorld,v.normalWorld,Z),Z.r=
|
|
|
|
+Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),p.wireframe?D(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(Z)):p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color);else if(p instanceof THREE.MeshDepthMaterial)pa=u.near,va=u.far,ma.r=ma.g=ma.b=1-Ma(a.positionScreen.z,pa,va),da.r=da.g=da.b=1-Ma(e.positionScreen.z,pa,va),ja.r=ja.g=ja.b=1-Ma(h.positionScreen.z,pa,va),
|
|
|
|
+la.r=(da.r+ja.r)*0.5,la.g=(da.g+ja.g)*0.5,la.b=(da.b+ja.b)*0.5,qa=Va(ma,da,ja,la),Sa(T,S,o,Y,ha,L,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(v.normalWorld.x),Z.g=Ta(v.normalWorld.y),Z.b=Ta(v.normalWorld.z),p.wireframe?D(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(Z)}function C(a,e,h,l,k,t,v,p,w){f.info.render.vertices+=4;f.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)B(a,e,l,0,1,3,v,p,w),B(k,h,t,1,2,3,v,p,w);else if(T=a.positionScreen.x,
|
|
|
|
+S=a.positionScreen.y,o=e.positionScreen.x,Y=e.positionScreen.y,ha=h.positionScreen.x,L=h.positionScreen.y,Q=l.positionScreen.x,$=l.positionScreen.y,na=k.positionScreen.x,fa=k.positionScreen.y,sa=t.positionScreen.x,ia=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Wa(T,S,o,Y,ha,L,Q,$),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color);else if(p instanceof THREE.MeshLambertMaterial)N?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
|
+4?(ma.r=da.r=ja.r=la.r=ra.r,ma.g=da.g=ja.g=la.g=ra.g,ma.b=da.b=ja.b=la.b=ra.b,x(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ma),x(n,v.v2.positionWorld,v.vertexNormalsWorld[1],da),x(n,v.v4.positionWorld,v.vertexNormalsWorld[3],ja),x(n,v.v3.positionWorld,v.vertexNormalsWorld[2],la),ma.r=Math.max(0,Math.min(p.color.r*ma.r,1)),ma.g=Math.max(0,Math.min(p.color.g*ma.g,1)),ma.b=Math.max(0,Math.min(p.color.b*ma.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),
|
|
|
|
+da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=Math.max(0,Math.min(p.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(p.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(p.color.b*ja.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),qa=Va(ma,da,ja,la),Ua(T,S,o,Y,Q,$),Sa(T,S,o,Y,Q,$,0,0,1,0,0,1,qa),Ua(na,fa,ha,L,sa,ia),Sa(na,fa,ha,L,sa,ia,1,0,1,1,0,1,qa)):(Z.r=ra.r,Z.g=ra.g,Z.b=ra.b,x(n,v.centroidWorld,v.normalWorld,Z),Z.r=
|
|
|
|
+Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),Wa(T,S,o,Y,ha,L,Q,$),p.wireframe?D(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(Z)):(Wa(T,S,o,Y,ha,L,Q,$),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):K(p.color));else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(v.normalWorld.x),Z.g=Ta(v.normalWorld.y),Z.b=Ta(v.normalWorld.z),Wa(T,S,o,Y,ha,L,Q,$),p.wireframe?D(Z,p.wireframeLinewidth,
|
|
|
|
+p.wireframeLinecap,p.wireframeLinejoin):K(Z);else if(p instanceof THREE.MeshDepthMaterial)pa=u.near,va=u.far,ma.r=ma.g=ma.b=1-Ma(a.positionScreen.z,pa,va),da.r=da.g=da.b=1-Ma(e.positionScreen.z,pa,va),ja.r=ja.g=ja.b=1-Ma(l.positionScreen.z,pa,va),la.r=la.g=la.b=1-Ma(h.positionScreen.z,pa,va),qa=Va(ma,da,ja,la),Ua(T,S,o,Y,Q,$),Sa(T,S,o,Y,Q,$,0,0,1,0,0,1,qa),Ua(na,fa,ha,L,sa,ia),Sa(na,fa,ha,L,sa,ia,1,0,1,1,0,1,qa)}function Ua(a,b,c,e,f,h){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(f,h);w.lineTo(a,
|
|
|
|
+b);w.closePath()}function Wa(a,b,c,e,f,h,l,k){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(f,h);w.lineTo(l,k);w.lineTo(a,b);w.closePath()}function D(a,b,c,f){if(O!=b)w.lineWidth=O=b;if(F!=c)w.lineCap=F=c;if(P!=f)w.lineJoin=P=f;e(a.getContextStyle());w.stroke();W.inflate(b*2)}function K(a){l(a.getContextStyle());w.fill()}function $a(a,b,c,e,f,h,k,o,n,p,t,v,u){if(u.image.width!=0){if(u.needsUpdate==!0||ga[u.id]==void 0){var xa=u.wrapS==THREE.RepeatWrapping,x=u.wrapT==THREE.RepeatWrapping;ga[u.id]=
|
|
|
|
+w.createPattern(u.image,xa&&x?"repeat":xa&&!x?"repeat-x":!xa&&x?"repeat-y":"no-repeat");u.needsUpdate=!1}l(ga[u.id]);var xa=u.offset.x/u.repeat.x,x=u.offset.y/u.repeat.y,U=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,k=(k+xa)*U,o=(o+x)*u,n=(n+xa)*U,p=(p+x)*u,t=(t+xa)*U,v=(v+x)*u;c-=a;e-=b;f-=a;h-=b;n-=k;p-=o;t-=k;v-=o;xa=1/(n*v-t*p);u=(v*c-p*f)*xa;p=(v*e-p*h)*xa;c=(n*f-t*c)*xa;e=(n*h-t*e)*xa;a=a-u*k-c*o;b=b-p*k-e*o;w.save();w.transform(u,p,c,e,a,b);w.fill();w.restore()}}function Sa(a,
|
|
|
|
+b,c,e,f,h,l,k,o,n,p,t,v){var u,xa;u=v.width-1;xa=v.height-1;l*=u;k*=xa;o*=u;n*=xa;p*=u;t*=xa;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;p-=l;t-=k;xa=1/(o*t-p*n);u=(t*c-n*f)*xa;n=(t*e-n*h)*xa;c=(o*f-p*c)*xa;e=(o*h-p*e)*xa;a=a-u*l-c*k;b=b-n*l-e*k;w.save();w.transform(u,n,c,e,a,b);w.clip();w.drawImage(v,0,0);w.restore()}function Va(a,b,c,e){var f=~~(a.r*255),h=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);Ca[0]=
|
|
|
|
+f<0?0:f>255?255:f;Ca[1]=h<0?0:h>255?255:h;Ca[2]=a<0?0:a>255?255:a;Ca[4]=l<0?0:l>255?255:l;Ca[5]=k<0?0:k>255?255:k;Ca[6]=b<0?0:b>255?255:b;Ca[8]=o<0?0:o>255?255:o;Ca[9]=n<0?0:n>255?255:n;Ca[10]=c<0?0:c>255?255:c;Ca[12]=p<0?0:p>255?255:p;Ca[13]=t<0?0:t>255?255:t;Ca[14]=e<0?0:e>255?255:e;ya.putImageData(Ia,0,0);V.drawImage(Ba,0,0);return Ea}function Ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function La(a,b){var c=b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/
|
|
|
|
+Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Xa,bb,za,Ha;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,y);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,u,this.sortElements);k=h.elements;n=h.lights;(N=n.length>0)&&p(n);Xa=0;for(bb=k.length;Xa<bb;Xa++)if(za=k[Xa],Ha=za.material,Ha=Ha instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){W.empty();if(za instanceof THREE.RenderableParticle)H=za,H.x*=v,H.y*=y,A(H,za,Ha,a);else if(za instanceof
|
|
|
|
+THREE.RenderableLine)H=za.v1,M=za.v2,H.positionScreen.x*=v,H.positionScreen.y*=y,M.positionScreen.x*=v,M.positionScreen.y*=y,W.addPoint(H.positionScreen.x,H.positionScreen.y),W.addPoint(M.positionScreen.x,M.positionScreen.y),aa.intersects(W)&&z(H,M,za,Ha,a);else if(za instanceof THREE.RenderableFace3)H=za.v1,M=za.v2,J=za.v3,H.positionScreen.x*=v,H.positionScreen.y*=y,M.positionScreen.x*=v,M.positionScreen.y*=y,J.positionScreen.x*=v,J.positionScreen.y*=y,Ha.overdraw&&(La(H.positionScreen,M.positionScreen),
|
|
|
|
+La(M.positionScreen,J.positionScreen),La(J.positionScreen,H.positionScreen)),W.add3Points(H.positionScreen.x,H.positionScreen.y,M.positionScreen.x,M.positionScreen.y,J.positionScreen.x,J.positionScreen.y),aa.intersects(W)&&B(H,M,J,0,1,2,za,Ha,a);else if(za instanceof THREE.RenderableFace4)H=za.v1,M=za.v2,J=za.v3,G=za.v4,H.positionScreen.x*=v,H.positionScreen.y*=y,M.positionScreen.x*=v,M.positionScreen.y*=y,J.positionScreen.x*=v,J.positionScreen.y*=y,G.positionScreen.x*=v,G.positionScreen.y*=y,X.positionScreen.copy(M.positionScreen),
|
|
|
|
+ca.positionScreen.copy(G.positionScreen),Ha.overdraw&&(La(H.positionScreen,M.positionScreen),La(M.positionScreen,G.positionScreen),La(G.positionScreen,H.positionScreen),La(J.positionScreen,X.positionScreen),La(J.positionScreen,ca.positionScreen)),W.addPoint(H.positionScreen.x,H.positionScreen.y),W.addPoint(M.positionScreen.x,M.positionScreen.y),W.addPoint(J.positionScreen.x,J.positionScreen.y),W.addPoint(G.positionScreen.x,G.positionScreen.y),aa.intersects(W)&&C(H,M,J,G,X,ca,za,Ha,a);ea.addRectangle(W)}w.setTransform(1,
|
|
|
|
+0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,l,k,n,p;f=0;for(h=a.length;f<h;f++)l=a[f],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),p=c.dot(H.sub(n,b).normalize()),p<=0||(p*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),p!=0&&(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)))}function c(a){M[a]==null&&(M[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"path"),T==0&&M[a].setAttribute("shape-rendering","crispEdges"));return M[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,u,p,x,v,y,w,A,z=new THREE.Rectangle,C=new THREE.Rectangle,B=!1,D=new THREE.Color,K=new THREE.Color,O=new THREE.Color,F=new THREE.Color,P,H=new THREE.Vector3,M=[],J=[],G,X,ca,T=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":T=1;break;case "low":T=0}};this.setSize=function(a,b){t=a;u=b;p=t/2;x=u/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+u);n.setAttribute("width",t);n.setAttribute("height",u);z.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var u,H,L,Q;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);f=l.elements;
|
|
|
|
+h=l.lights;ca=X=0;if(B=h.length>0){K.setRGB(0,0,0);O.setRGB(0,0,0);F.setRGB(0,0,0);u=0;for(H=h.length;u<H;u++)Q=h[u],L=Q.color,Q instanceof THREE.AmbientLight?(K.r+=L.r,K.g+=L.g,K.b+=L.b):Q instanceof THREE.DirectionalLight?(O.r+=L.r,O.g+=L.g,O.b+=L.b):Q instanceof THREE.PointLight&&(F.r+=L.r,F.g+=L.g,F.b+=L.b)}u=0;for(H=f.length;u<H;u++)if(L=f[u],Q=L.material,Q=Q instanceof THREE.MeshFaceMaterial?L.faceMaterial:Q,!(Q==null||Q.opacity==0))if(C.empty(),L instanceof THREE.RenderableParticle)v=L,v.x*=
|
|
|
|
+p,v.y*=-x,m=0,ml=L.materials.length;else if(L instanceof THREE.RenderableLine){if(v=L.v1,y=L.v2,v.positionScreen.x*=p,v.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),z.intersects(C)){L=v;var M=y,na=ca++;J[na]==null&&(J[na]=document.createElementNS("http://www.w3.org/2000/svg","line"),T==0&&J[na].setAttribute("shape-rendering","crispEdges"));G=J[na];G.setAttribute("x1",L.positionScreen.x);
|
|
|
|
+G.setAttribute("y1",L.positionScreen.y);G.setAttribute("x2",M.positionScreen.x);G.setAttribute("y2",M.positionScreen.y);Q instanceof THREE.LineBasicMaterial&&(G.setAttribute("style","fill: none; stroke: "+Q.color.getContextStyle()+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin),n.appendChild(G))}}else if(L instanceof THREE.RenderableFace3){if(v=L.v1,y=L.v2,w=L.v3,v.positionScreen.x*=p,v.positionScreen.y*=-x,y.positionScreen.x*=
|
|
|
|
+p,y.positionScreen.y*=-x,w.positionScreen.x*=p,w.positionScreen.y*=-x,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),z.intersects(C)){var M=v,na=y,fa=w;e.info.render.vertices+=3;e.info.render.faces++;G=c(X++);G.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");Q instanceof THREE.MeshBasicMaterial?
|
|
|
|
+D.copy(Q.color):Q instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,L.centroidWorld,L.normalWorld,D),D.r=Math.max(0,Math.min(Q.color.r*D.r,1)),D.g=Math.max(0,Math.min(Q.color.g*D.g,1)),D.b=Math.max(0,Math.min(Q.color.b*D.b,1))):D.copy(Q.color):Q instanceof THREE.MeshDepthMaterial?(P=1-Q.__2near/(Q.__farPlusNear-L.z*Q.__farMinusNear),D.setRGB(P,P,P)):Q instanceof THREE.MeshNormalMaterial&&D.setRGB(b(L.normalWorld.x),b(L.normalWorld.y),b(L.normalWorld.z));Q.wireframe?G.setAttribute("style",
|
|
|
|
+"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):G.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+Q.opacity);n.appendChild(G)}}else if(L instanceof THREE.RenderableFace4&&(v=L.v1,y=L.v2,w=L.v3,A=L.v4,v.positionScreen.x*=p,v.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,w.positionScreen.x*=p,w.positionScreen.y*=
|
|
|
|
+-x,A.positionScreen.x*=p,A.positionScreen.y*=-x,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(A.positionScreen.x,A.positionScreen.y),z.intersects(C))){var M=v,na=y,fa=w,sa=A;e.info.render.vertices+=4;e.info.render.faces++;G=c(X++);G.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+
|
|
|
|
+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");Q instanceof THREE.MeshBasicMaterial?D.copy(Q.color):Q instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,L.centroidWorld,L.normalWorld,D),D.r=Math.max(0,Math.min(Q.color.r*D.r,1)),D.g=Math.max(0,Math.min(Q.color.g*D.g,1)),D.b=Math.max(0,Math.min(Q.color.b*D.b,1))):D.copy(Q.color):Q instanceof THREE.MeshDepthMaterial?(P=1-Q.__2near/(Q.__farPlusNear-L.z*Q.__farMinusNear),D.setRGB(P,P,P)):Q instanceof THREE.MeshNormalMaterial&&
|
|
|
|
+D.setRGB(b(L.normalWorld.x),b(L.normalWorld.y),b(L.normalWorld.z));Q.wireframe?G.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):G.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+Q.opacity);n.appendChild(G)}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
|
|
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
@@ -226,122 +226,122 @@ THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"v
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){originalAttribute=e.attributes[f];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
|
|
THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){originalAttribute=e.attributes[f];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
|
|
"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(c*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=f,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;a.__webglCustomAttributesList.push(attribute)}}}function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,l=a.vertices,
|
|
"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(c*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=f,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;a.__webglCustomAttributesList.push(attribute)}}}function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,l=a.vertices,
|
|
-k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,v=a.__colorArray,u=a.__sortArray,w=a.__dirtyVertices,x=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){Da.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=l[e].position,Ca.copy(f),Da.multiplyVector3(Ca),u[e]=[Ca.z,e];u.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)f=l[u[e][1]].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;for(e=0;e<p;e++)h=e*3,color=n[u[e][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(R){n=0;for(p=R.length;n<
|
|
|
|
-p;n++)if(k=R[n],k.boundTo===void 0||k.boundTo==="vertices"){h=0;f=k.value.length;for(e=0;e<f;e++)index=u[e][1],k.size===1?k.array[h]=k.value[index]:(l=k.value[index],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}else{if(w)for(e=0;e<k;e++)f=l[e].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;if(x)for(e=
|
|
|
|
-0;e<p;e++)color=n[e],h=e*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(R){n=0;for(p=R.length;n<p;n++)if(k=R[n],k.__original.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){f=k.value.length;for(e=h=0;e<f;e++)offset_custom=k.offset,k.size===1?k.array[h]=k.value[e]:(l=k.value[e],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+
|
|
|
|
-2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,b);if(R){n=0;for(p=R.length;n<p;n++)if(k=R[n],k.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function l(a,b,c,e,f){e.program||U.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
|
|
|
|
-new Float32Array(U.maxMorphTargets);for(var h=0,l=U.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==ha&&(o.useProgram(h),ha=h,k=!0);if(e.id!==S)S=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,va);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
|
|
|
|
-e.lights){for(var p,t,v=0,u=0,w=0,x,y,z,Z=Ga,ja=Z.directional.colors,B=Z.directional.positions,A=Z.point.colors,C=Z.point.positions,D=Z.point.distances,J=0,ga=0,c=p=z=0,k=b.length;c<k;c++)if(p=b[c],t=p.color,x=p.position,y=p.intensity,z=p.distance,p instanceof THREE.AmbientLight)U.gammaInput?(v+=t.r*t.r,u+=t.g*t.g,w+=t.b*t.b):(v+=t.r,u+=t.g,w+=t.b);else if(p instanceof THREE.DirectionalLight)z=J*3,U.gammaInput?(ja[z]=t.r*t.r*y*y,ja[z+1]=t.g*t.g*y*y,ja[z+2]=t.b*t.b*y*y):(ja[z]=t.r*y,ja[z+1]=t.g*y,
|
|
|
|
-ja[z+2]=t.b*y),B[z]=x.x,B[z+1]=x.y,B[z+2]=x.z,J+=1;else if(p instanceof THREE.SpotLight)z=J*3,U.gammaInput?(ja[z]=t.r*t.r*y*y,ja[z+1]=t.g*t.g*y*y,ja[z+2]=t.b*t.b*y*y):(ja[z]=t.r*y,ja[z+1]=t.g*y,ja[z+2]=t.b*y),t=1/x.length(),B[z]=x.x*t,B[z+1]=x.y*t,B[z+2]=x.z*t,J+=1;else if(p instanceof THREE.PointLight)p=ga*3,U.gammaInput?(A[p]=t.r*t.r*y*y,A[p+1]=t.g*t.g*y*y,A[p+2]=t.b*t.b*y*y):(A[p]=t.r*y,A[p+1]=t.g*y,A[p+2]=t.b*y),C[p]=x.x,C[p+1]=x.y,C[p+2]=x.z,D[ga]=z,ga+=1;c=J*3;for(k=ja.length;c<k;c++)ja[c]=
|
|
|
|
-0;c=ga*3;for(k=A.length;c<k;c++)A[c]=0;Z.point.length=ga;Z.directional.length=J;Z.ambient[0]=v;Z.ambient[1]=u;Z.ambient[2]=w;b=Ga;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
|
|
|
|
-e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,U.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=
|
|
|
|
-e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=R.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,U.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):
|
|
|
|
-(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)U.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<pa.length;b++)n.shadowMatrix.value[b]=pa[b],n.shadowMap.texture[b]=U.shadowMap[b];
|
|
|
|
-n.shadowDarkness.value=U.shadowMapDarkness;n.shadowBias.value=U.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(u=h.uniforms[b[n][1]])if(v=b[n][0],w=v.type,k=v.value,w==="i")o.uniform1i(u,k);else if(w==="f")o.uniform1f(u,k);else if(w==="v2")o.uniform2f(u,k.x,k.y);else if(w==="v3")o.uniform3f(u,k.x,k.y,k.z);else if(w==="v4")o.uniform4f(u,k.x,k.y,k.z,k.w);else if(w==="c")o.uniform3f(u,k.r,k.g,k.b);else if(w==="fv1")o.uniform1fv(u,k);else if(w==="fv")o.uniform3fv(u,k);else if(w==="v3v"){if(!v._array)v._array=
|
|
|
|
-new Float32Array(3*k.length);w=0;for(x=k.length;w<x;w++)Z=w*3,v._array[Z]=k[w].x,v._array[Z+1]=k[w].y,v._array[Z+2]=k[w].z;o.uniform3fv(u,v._array)}else if(w==="m4"){if(!v._array)v._array=new Float32Array(16);k.flattenToArray(v._array);o.uniformMatrix4fv(u,!1,v._array)}else if(w==="m4v"){if(!v._array)v._array=new Float32Array(16*k.length);w=0;for(x=k.length;w<x;w++)k[w].flattenToArrayOffset(v._array,w*16);o.uniformMatrix4fv(u,!1,v._array)}else if(w==="t"){if(o.uniform1i(u,k),u=v.texture)if(u.image instanceof
|
|
|
|
-Array&&u.image.length===6){if(v=u,v.image.length===6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[k]);Q(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else u instanceof
|
|
|
|
|
|
+k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,v=a.__colorArray,u=a.__sortArray,w=a.__dirtyVertices,x=a.__dirtyColors,U=a.__webglCustomAttributesList;if(c.sortParticles){wa.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=l[e].position,ua.copy(f),wa.multiplyVector3(ua),u[e]=[ua.z,e];u.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)f=l[u[e][1]].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;for(e=0;e<p;e++)h=e*3,color=n[u[e][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U){n=0;for(p=U.length;n<
|
|
|
|
+p;n++)if(k=U[n],k.boundTo===void 0||k.boundTo==="vertices"){h=0;f=k.value.length;for(e=0;e<f;e++)index=u[e][1],k.size===1?k.array[h]=k.value[index]:(l=k.value[index],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}else{if(w)for(e=0;e<k;e++)f=l[e].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;if(x)for(e=
|
|
|
|
+0;e<p;e++)color=n[e],h=e*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U){n=0;for(p=U.length;n<p;n++)if(k=U[n],k.__original.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){f=k.value.length;for(e=h=0;e<f;e++)offset_custom=k.offset,k.size===1?k.array[h]=k.value[e]:(l=k.value[e],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+
|
|
|
|
+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,b);if(U){n=0;for(p=U.length;n<p;n++)if(k=U[n],k.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function l(a,b,c,e,f){e.program||S.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
|
|
|
|
+new Float32Array(S.maxMorphTargets);for(var h=0,l=S.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==ha&&(o.useProgram(h),ha=h,k=!0);if(e.id!==Q)Q=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,Fa);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
|
|
|
|
+e.lights){for(var p,t,v=0,u=0,w=0,x,y,A,ea=Ga,aa=ea.directional.colors,z=ea.directional.positions,B=ea.point.colors,C=ea.point.positions,D=ea.point.distances,W=0,la=0,c=p=A=0,k=b.length;c<k;c++)if(p=b[c],t=p.color,x=p.position,y=p.intensity,A=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(v+=t.r*t.r,u+=t.g*t.g,w+=t.b*t.b):(v+=t.r,u+=t.g,w+=t.b);else if(p instanceof THREE.DirectionalLight)A=W*3,S.gammaInput?(aa[A]=t.r*t.r*y*y,aa[A+1]=t.g*t.g*y*y,aa[A+2]=t.b*t.b*y*y):(aa[A]=t.r*y,aa[A+1]=
|
|
|
|
+t.g*y,aa[A+2]=t.b*y),z[A]=x.x,z[A+1]=x.y,z[A+2]=x.z,W+=1;else if(p instanceof THREE.SpotLight)A=W*3,S.gammaInput?(aa[A]=t.r*t.r*y*y,aa[A+1]=t.g*t.g*y*y,aa[A+2]=t.b*t.b*y*y):(aa[A]=t.r*y,aa[A+1]=t.g*y,aa[A+2]=t.b*y),t=1/x.length(),z[A]=x.x*t,z[A+1]=x.y*t,z[A+2]=x.z*t,W+=1;else if(p instanceof THREE.PointLight)p=la*3,S.gammaInput?(B[p]=t.r*t.r*y*y,B[p+1]=t.g*t.g*y*y,B[p+2]=t.b*t.b*y*y):(B[p]=t.r*y,B[p+1]=t.g*y,B[p+2]=t.b*y),C[p]=x.x,C[p+1]=x.y,C[p+2]=x.z,D[la]=A,la+=1;c=W*3;for(k=aa.length;c<k;c++)aa[c]=
|
|
|
|
+0;c=la*3;for(k=B.length;c<k;c++)B[c]=0;ea.point.length=la;ea.directional.length=W;ea.ambient[0]=v;ea.ambient[1]=u;ea.ambient[2]=w;b=Ga;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
|
|
|
|
+e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=
|
|
|
|
+e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=U.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):
|
|
|
|
+(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)S.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<oa.length;b++)n.shadowMatrix.value[b]=oa[b],n.shadowMap.texture[b]=S.shadowMap[b];
|
|
|
|
+n.shadowDarkness.value=S.shadowMapDarkness;n.shadowBias.value=S.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(u=h.uniforms[b[n][1]])if(v=b[n][0],w=v.type,k=v.value,w==="i")o.uniform1i(u,k);else if(w==="f")o.uniform1f(u,k);else if(w==="v2")o.uniform2f(u,k.x,k.y);else if(w==="v3")o.uniform3f(u,k.x,k.y,k.z);else if(w==="v4")o.uniform4f(u,k.x,k.y,k.z,k.w);else if(w==="c")o.uniform3f(u,k.r,k.g,k.b);else if(w==="fv1")o.uniform1fv(u,k);else if(w==="fv")o.uniform3fv(u,k);else if(w==="v3v"){if(!v._array)v._array=
|
|
|
|
+new Float32Array(3*k.length);w=0;for(x=k.length;w<x;w++)ea=w*3,v._array[ea]=k[w].x,v._array[ea+1]=k[w].y,v._array[ea+2]=k[w].z;o.uniform3fv(u,v._array)}else if(w==="m4"){if(!v._array)v._array=new Float32Array(16);k.flattenToArray(v._array);o.uniformMatrix4fv(u,!1,v._array)}else if(w==="m4v"){if(!v._array)v._array=new Float32Array(16*k.length);w=0;for(x=k.length;w<x;w++)k[w].flattenToArrayOffset(v._array,w*16);o.uniformMatrix4fv(u,!1,v._array)}else if(w==="t"){if(o.uniform1i(u,k),u=v.texture)if(u.image instanceof
|
|
|
|
+Array&&u.image.length===6){if(v=u,v.image.length===6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[k]);P(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else u instanceof
|
|
THREE.WebGLRenderTargetCube?(v=u,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):H(u,k)}else if(w==="tv"){if(!v._array){v._array=[];w=0;for(x=v.texture.length;w<x;w++)v._array[w]=k+w}o.uniform1iv(u,v._array);w=0;for(x=v.texture.length;w<x;w++)(u=v.texture[w])&&H(u,v._array[w])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
|
|
THREE.WebGLRenderTargetCube?(v=u,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):H(u,k)}else if(w==="tv"){if(!v._array){v._array=[];w=0;for(x=v.texture.length;w<x;w++)v._array[w]=k+w}o.uniform1iv(u,v._array);w=0;for(x=v.texture.length;w<x;w++)(u=v.texture[w])&&H(u,v._array[w])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
|
|
-THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,Ea);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,Ea),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,f._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
|
|
|
|
-l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,!1,f._objectMatrixArray);return h}function f(a,b,c,e,f,h){if(e.opacity!==0){var k,n,c=l(a,b,c,e,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==Y&&(Y=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),
|
|
|
|
|
|
+THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,Da);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,Da),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,f._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
|
|
|
|
+l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,!1,f._objectMatrixArray);return h}function f(a,b,c,e,f,h){if(e.opacity!==0){var k,n,c=l(a,b,c,e,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==$&&($=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),
|
|
o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<p.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[k]=n[p[k]],k++}else{var p=[],t=-1,
|
|
o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<p.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[k]=n[p[k]],k++}else{var p=[],t=-1,
|
|
v=0;n=h.morphTargetInfluences;var u,w=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(u=0;u<w;u++)!p[u]&&n[u]>t&&(v=u,t=n[v]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=t;p[v]=1;t=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=
|
|
v=0;n=h.morphTargetInfluences;var u,w=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(u=0;u<w;u++)!p[u]&&n[u]>t&&(v=u,t=n[v]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=t;p[v]=1;t=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=
|
|
0;for(n=f.__webglCustomAttributesList.length;k<n;k++)c=f.__webglCustomAttributesList[k],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
0;for(n=f.__webglCustomAttributesList.length;k<n;k++)c=f.__webglCustomAttributesList[k],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
|
|
f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
|
|
0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?
|
|
0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?
|
|
-(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=f.__webglFaceCount,U.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,
|
|
|
|
-0,f.__webglLineCount),U.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),U.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),U.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
|
|
|
|
|
|
+(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,
|
|
|
|
+0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),S.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
|
|
o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,t,v,u,w=a.count*3;for(u=0;u<w;u+=9)c=a.normalArray,e=c[u],f=c[u+1],h=c[u+2],l=c[u+3],n=c[u+4],t=c[u+5],k=c[u+6],p=c[u+7],v=c[u+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+t+v)/3,c[u]=e,c[u+1]=f,c[u+2]=h,c[u+3]=e,c[u+4]=f,c[u+5]=h,c[u+6]=e,c[u+7]=f,c[u+8]=h}o.bufferData(o.ARRAY_BUFFER,
|
|
o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,t,v,u,w=a.count*3;for(u=0;u<w;u+=9)c=a.normalArray,e=c[u],f=c[u+1],h=c[u+2],l=c[u+3],n=c[u+4],t=c[u+5],k=c[u+6],p=c[u+7],v=c[u+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+t+v)/3,c[u]=e,c[u+1]=f,c[u+2]=h,c[u+3]=e,c[u+4]=f,c[u+5]=h,c[u+6]=e,c[u+7]=f,c[u+8]=h}o.bufferData(o.ARRAY_BUFFER,
|
|
-a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function k(a){if(aa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),aa=a.doubleSided;if(ma!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ma=a.flipSided}function n(a){ea!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ea=a)}function t(a){ka!==a&&(o.depthMask(a),ka=a)}
|
|
|
|
-function u(a,b,c){fa!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=a);if(a&&(ia!==b||ga!==c))o.polygonOffset(b,c),ia=b,ga=c}function p(a){sa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);sa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);sa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);sa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);sa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);sa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
|
|
|
|
-a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=sa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=sa[e].x*b.n14+sa[e].y*b.n24+sa[e].z*b.n34+sa[e].w,a<=c)return!1;return!0}function v(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
|
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function w(a,b){return b.z-a.z}function z(a){var b,c,e,t=0,v,u,w,R,y=a.lights;oa||(oa=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(e=y[b],e instanceof THREE.SpotLight&&e.castShadow){S=
|
|
|
|
--1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[t]||(pa[t]=new THREE.Matrix4);v=U.shadowMap[t];u=pa[t];oa.position.copy(e.position);oa.lookAt(e.target.position);oa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(oa));this.autoUpdateScene&&a.updateMatrixWorld();oa.matrixWorldInverse.getInverse(oa.matrixWorld);u.set(0.5,0,0,0.5,0,0.5,
|
|
|
|
-0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiplySelf(oa.projectionMatrix);u.multiplySelf(oa.matrixWorldInverse);oa.matrixWorldInverse.flattenToArray(Ea);oa.projectionMatrix.flattenToArray(va);Da.multiply(oa.projectionMatrix,oa.matrixWorldInverse);p(Da);L(v);o.clearColor(1,1,1,1);U.clear();o.clearColor(O.r,O.g,O.b,ra);u=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(v=0;v<u;v++)w=a.__webglObjects[v],R=w.object,R.visible&&R.castShadow?!(R instanceof THREE.Mesh)||!R.frustumCulled||x(R)?(R.matrixWorld.flattenToArray(R._objectMatrixArray),
|
|
|
|
-C(R,oa,!1),w.render=!0):w.render=!1:w.render=!1;n(!0);F(THREE.NormalBlending);for(v=0;v<u;v++)if(w=a.__webglObjects[v],w.render)R=w.object,buffer=w.buffer,k(R),w=R.customDepthMaterial?R.customDepthMaterial:R.geometry.morphTargets.length?Fa:za,f(oa,y,null,w,buffer,R);for(v=0;v<e;v++)w=a.__webglObjectsImmediate[v],R=w.object,R.visible&&R.castShadow&&(R.matrixAutoUpdate&&R.matrixWorld.flattenToArray(R._objectMatrixArray),Y=-1,C(R,oa,!1),k(R),program=l(oa,y,null,za,R),R.immediateRenderCallback?R.immediateRenderCallback(program,
|
|
|
|
-o,sa):R.render(function(a){h(a,program,za.shading)}));t++}}function B(a,b){var c,e,f;c=V.attributes;var h=V.uniforms,l=qa/ua,k,n=[],t=ua*0.5,v=qa*0.5,p=!0;o.useProgram(V.program);ha=V.program;Y=ea=na=-1;Ra||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ra=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
|
|
|
|
-8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,va);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(w);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&
|
|
|
|
|
|
+a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function k(a){if(fa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),fa=a.doubleSided;if(sa!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),sa=a.flipSided}function n(a){Z!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),Z=a)}function t(a){ma!==a&&(o.depthMask(a),ma=a)}function u(a,
|
|
|
|
+b,c){da!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),da=a);if(a&&(ja!==b||la!==c))o.polygonOffset(b,c),ja=b,la=c}function p(a){ka[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+
|
|
|
|
+a.n34);for(var b,a=0;a<6;a++)b=ka[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ka[e].x*b.n14+ka[e].y*b.n24+ka[e].z*b.n34+ka[e].w,a<=c)return!1;return!0}function v(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
|
+c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function w(a,b){return b.z-a.z}function A(a){var b,c,e,t=0,v,u,w,U,y=a.lights;ta||(ta=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(e=y[b],e instanceof THREE.SpotLight&&e.castShadow){Q=
|
|
|
|
+-1;S.shadowMap[t]||(S.shadowMap[t]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));oa[t]||(oa[t]=new THREE.Matrix4);v=S.shadowMap[t];u=oa[t];ta.position.copy(e.position);ta.lookAt(e.target.position);ta.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ta));this.autoUpdateScene&&a.updateMatrixWorld();ta.matrixWorldInverse.getInverse(ta.matrixWorld);u.set(0.5,0,0,0.5,0,0.5,
|
|
|
|
+0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiplySelf(ta.projectionMatrix);u.multiplySelf(ta.matrixWorldInverse);ta.matrixWorldInverse.flattenToArray(Da);ta.projectionMatrix.flattenToArray(Fa);wa.multiply(ta.projectionMatrix,ta.matrixWorldInverse);p(wa);J(v);o.clearColor(1,1,1,1);S.clear();o.clearColor(N.r,N.g,N.b,ra);u=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(v=0;v<u;v++)w=a.__webglObjects[v],U=w.object,U.visible&&U.castShadow?!(U instanceof THREE.Mesh)||!U.frustumCulled||x(U)?(U.matrixWorld.flattenToArray(U._objectMatrixArray),
|
|
|
|
+C(U,ta,!1),w.render=!0):w.render=!1:w.render=!1;n(!0);F(THREE.NormalBlending);for(v=0;v<u;v++)if(w=a.__webglObjects[v],w.render)U=w.object,buffer=w.buffer,k(U),w=U.customDepthMaterial?U.customDepthMaterial:U.geometry.morphTargets.length?Ia:ya,f(ta,y,null,w,buffer,U);for(v=0;v<e;v++)w=a.__webglObjectsImmediate[v],U=w.object,U.visible&&U.castShadow&&(U.matrixAutoUpdate&&U.matrixWorld.flattenToArray(U._objectMatrixArray),$=-1,C(U,ta,!1),k(U),program=l(ta,y,null,ya,U),U.immediateRenderCallback?U.immediateRenderCallback(program,
|
|
|
|
+o,ka):U.render(function(a){h(a,program,ya.shading)}));t++}}function z(a,b){var c,e,f;c=V.attributes;var h=V.uniforms,l=qa/va,k,n=[],t=va*0.5,v=qa*0.5,p=!0;o.useProgram(V.program);ha=V.program;$=Z=ia=-1;Ra||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ra=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
|
|
|
|
+8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Fa);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(w);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&
|
|
f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-t)/t,(v-f.position.y)/v,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?qa:1),n[0]=k*l*f.scale.x,n[1]=k*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,
|
|
f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-t)/t,(v-f.position.y)/v,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?qa:1),n[0]=k*l*f.scale.x,n[1]=k*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,
|
|
-f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),F(f.blending),H(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ka)}function C(a,
|
|
|
|
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function D(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function K(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function P(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
|
-function F(a){if(a!==na){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}na=a}}function Q(a,b,c){(c.width&c.width-
|
|
|
|
-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,X(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,X(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,X(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,X(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ca(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ca(b.minFilter)))}function H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
|
-!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,X(a.format),a.image.width,a.image.height,0,X(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);Q(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
|
-a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function L(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
|
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);Q(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,X(a.format),a.width,a.height,0,X(a.format),X(a.type),
|
|
|
|
-null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),Q(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,X(a.format),a.width,a.height,0,X(a.format),X(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
-a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ua,a=qa,e=da,f=ta);b!==M&&(o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
-b),o.viewport(e,f,c,a),M=b)}function G(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function W(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
|
|
|
|
-o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ca(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function X(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
|
|
|
|
|
|
+f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),F(f.blending),H(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ma)}function C(a,
|
|
|
|
+b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function B(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function D(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function K(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function O(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
|
+function F(a){if(a!==ia){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ia=a}}function P(a,b,c){(c.width&c.width-
|
|
|
|
+1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,T(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,T(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,T(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,T(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ca(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ca(b.minFilter)))}function H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
|
+!0,a.__webglTexture=o.createTexture(),S.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);P(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function M(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
|
+a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function J(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
|
+if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);P(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),
|
|
|
|
+null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);M(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),P(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
+a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),M(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=va,a=qa,e=ga,f=pa);b!==L&&(o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
+b),o.viewport(e,f,c,a),L=b)}function G(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function X(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
|
|
|
|
+o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ca(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
|
|
case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
|
|
case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
|
|
-case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var U=this,o,$=[],ha=null,M=null,S=-1,Y=null,la=0,aa=null,ma=null,na=null,ea=null,ka=null,fa=null,ia=null,ga=null,da=0,ta=0,ua=0,qa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,va=new Float32Array(16),
|
|
|
|
-Ea=new Float32Array(16),Ca=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},R=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ja=a.stencil!==void 0?a.stencil:!0,Z=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,J=a.antialias!==void 0?a.antialias:!1,O=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=a.clearAlpha!==void 0?a.clearAlpha:0,xa=a.maxLights!==void 0?
|
|
|
|
-a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=R;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=
|
|
|
|
-50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var oa,pa=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});za._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=R.getContext("experimental-webgl",{antialias:J,stencil:ja,
|
|
|
|
-preserveDrawingBuffer:Z})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,
|
|
|
|
-o.ONE_MINUS_SRC_ALPHA);o.clearColor(O.r,O.g,O.b,ra);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);ja=0;V.vertices[ja++]=-1;V.vertices[ja++]=-1;V.vertices[ja++]=0;V.vertices[ja++]=1;V.vertices[ja++]=1;V.vertices[ja++]=-1;V.vertices[ja++]=1;V.vertices[ja++]=1;V.vertices[ja++]=1;V.vertices[ja++]=1;V.vertices[ja++]=1;V.vertices[ja++]=0;V.vertices[ja++]=-1;V.vertices[ja++]=1;V.vertices[ja++]=0;ja=V.vertices[ja++]=
|
|
|
|
-0;V.faces[ja++]=0;V.faces[ja++]=1;V.faces[ja++]=2;V.faces[ja++]=0;V.faces[ja++]=2;V.faces[ja++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();o.attachShader(V.program,W("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,
|
|
|
|
-W("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,
|
|
|
|
-"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");
|
|
|
|
-V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ra=!1;this.setSize=function(a,b){R.width=a;R.height=b;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(a,b,c,e){da=a;ta=b;ua=c;qa=e;o.viewport(da,ta,ua,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){O.setHex(a);ra=b;o.clearColor(O.r,O.g,O.b,ra)};this.setClearColor=
|
|
|
|
-function(a,b){O.copy(a);ra=b;o.clearColor(O.r,O.g,O.b,ra)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ra};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
|
|
|
|
-a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);
|
|
|
|
-o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);U.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
|
-a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),U.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,l,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?k="lambert":a instanceof THREE.MeshPhongMaterial?
|
|
|
|
-k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var t,v,p;t=p=n=0;for(v=b.length;t<v;t++)l=b[t],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&n++;n+p<=xa?t=p:(t=Math.ceil(xa*p/(n+p)),n=xa-t);l={directional:t,point:n};n=p=0;for(t=
|
|
|
|
-b.length;n<t;n++)v=b[n],v instanceof THREE.SpotLight&&v.castShadow&&p++;var u=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)u=e.bones.length;var w;a:{t=a.fragmentShader;v=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:l.directional,maxPointLights:l.point,maxBones:u,
|
|
|
|
-shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];k?e.push(k):(e.push(t),e.push(v));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=$.length;x<e;x++)if($[x].code===k){w=$[x].program;break a}x=o.createProgram();e=[Ha?"#define VERTEX_TEXTURES":"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":
|
|
|
|
-"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":
|
|
|
|
-"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
-l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
|
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,W("fragment",l+t));o.attachShader(x,
|
|
|
|
-W("vertex",e+v));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var R,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(R in n)e.push(R);R=e;e=0;for(n=R.length;e<n;e++)t=R[e],x.uniforms[t]=o.getUniformLocation(x,
|
|
|
|
-t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(R=0;R<c.maxMorphTargets;R++)e.push("morphTarget"+R);for(w in b)e.push(w);w=e;R=0;for(b=w.length;R<b;R++)c=w[R],x.attributes[c]=o.getAttribLocation(x,c);x.id=$.length;$.push({program:x,code:k});U.info.memory.programs=$.length;w=x}a.program=w;w=a.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);
|
|
|
|
-w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(h in a.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)R="morphTarget"+h,w[R]>=0&&(o.enableVertexAttribArray(w[R]),
|
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){L(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){z(a,b)};this.render=function(a,b,c,e){var R,Z,ja,A,D,J,ga,K=a.lights,ra=a.fog;S=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(va);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);p(Da);L(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ja=a.__webglObjects.length;for(e=0;e<ja;e++)if(D=a.__webglObjects[e],J=D.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||x(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
|
|
|
|
-C(J,b,!0),y(D),D.render=!0,this.sortObjects)J.renderDepth?D.z=J.renderDepth:(Ca.copy(J.position),Da.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(w);A=a.__webglObjectsImmediate.length;for(e=0;e<A;e++)D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),C(J,b,!0),v(D));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(e=0;e<ja;e++)if(D=
|
|
|
|
-a.__webglObjects[e],D.render)J=D.object,ga=D.buffer,k(J),f(b,K,ra,a.overrideMaterial,ga,J);for(e=0;e<A;e++)D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(Y=-1,k(J),R=l(b,K,ra,a.overrideMaterial,J),J.immediateRenderCallback?J.immediateRenderCallback(R,o,sa):J.render(function(b){h(b,R,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(e=ja-1;e>=0;e--)if(D=a.__webglObjects[e],D.render&&(J=D.object,ga=D.buffer,Z=D.opaque))k(J),n(Z.depthTest),t(Z.depthWrite),u(Z.polygonOffset,Z.polygonOffsetFactor,
|
|
|
|
-Z.polygonOffsetUnits),f(b,K,ra,Z,ga,J);for(e=0;e<A;e++)if(D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(Y=-1,Z=D.opaque))k(J),n(Z.depthTest),t(Z.depthWrite),u(Z.polygonOffset,Z.polygonOffsetFactor,Z.polygonOffsetUnits),R=l(b,K,ra,Z,J),J.immediateRenderCallback?J.immediateRenderCallback(R,o,sa):J.render(function(a){h(a,R,Z.shading)});for(e=0;e<ja;e++)if(D=a.__webglObjects[e],D.render&&(J=D.object,ga=D.buffer,Z=D.transparent))k(J),F(Z.blending),n(Z.depthTest),t(Z.depthWrite),u(Z.polygonOffset,
|
|
|
|
-Z.polygonOffsetFactor,Z.polygonOffsetUnits),f(b,K,ra,Z,ga,J);for(e=0;e<A;e++)if(D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(Y=-1,Z=D.transparent))k(J),F(Z.blending),n(Z.depthTest),t(Z.depthWrite),u(Z.polygonOffset,Z.polygonOffsetFactor,Z.polygonOffsetUnits),R=l(b,K,ra,Z,J),J.immediateRenderCallback?J.immediateRenderCallback(R,o,sa):J.render(function(a){h(a,R,Z.shading)})}a.__webglSprites.length&&B(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&G(c)};this.initWebGLObjects=
|
|
|
|
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,k=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){k=f.geometry;if(k.geometryGroups===
|
|
|
|
-void 0){var n=k,t=void 0,p=void 0,v=void 0,u=void 0,w=v=void 0,x=void 0,R={},y=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)v=n.faces[t],u=v.materialIndex,w=u!==void 0?u:-1,R[w]===void 0&&(R[w]={hash:w,counter:0}),x=R[w].hash+"_"+R[w].counter,n.geometryGroups[x]===void 0&&(n.geometryGroups[x]={faces:[],materialIndex:u,vertices:0,numMorphTargets:y}),v=v instanceof THREE.Face3?3:4,n.geometryGroups[x].vertices+v>65535&&(R[w].counter+=1,x=R[w].hash+"_"+R[w].counter,n.geometryGroups[x]===
|
|
|
|
-void 0&&(n.geometryGroups[x]={faces:[],materialIndex:u,vertices:0,numMorphTargets:y})),n.geometryGroups[x].faces.push(t),n.geometryGroups[x].vertices+=v;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=la++,n.geometryGroupsList.push(n.geometryGroups[t])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){t=n;t.__webglVertexBuffer=o.createBuffer();t.__webglNormalBuffer=o.createBuffer();t.__webglTangentBuffer=o.createBuffer();t.__webglColorBuffer=
|
|
|
|
-o.createBuffer();t.__webglUVBuffer=o.createBuffer();t.__webglUV2Buffer=o.createBuffer();t.__webglSkinVertexABuffer=o.createBuffer();t.__webglSkinVertexBBuffer=o.createBuffer();t.__webglSkinIndicesBuffer=o.createBuffer();t.__webglSkinWeightsBuffer=o.createBuffer();t.__webglFaceBuffer=o.createBuffer();t.__webglLineBuffer=o.createBuffer();if(t.numMorphTargets){u=p=void 0;t.__webglMorphTargetsBuffers=[];p=0;for(u=t.numMorphTargets;p<u;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;
|
|
|
|
-for(var u=f,Z=v=R=void 0,w=Z=y=Z=void 0,x=w=t=0,z=v=void 0,ja=void 0,v=p=y=R=void 0,y=u.geometry,z=y.faces,ja=n.faces,R=0,v=ja.length;R<v;R++)Z=ja[R],Z=z[Z],Z instanceof THREE.Face3?(t+=3,w+=1,x+=3):Z instanceof THREE.Face4&&(t+=4,w+=2,x+=4);R=b(u,n);v=R.map||R.lightMap||R instanceof THREE.ShaderMaterial?!0:!1;ja=R instanceof THREE.MeshBasicMaterial&&!R.envMap||R instanceof THREE.MeshDepthMaterial?!1:R&&R.shading!==void 0&&R.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=R.vertexColors?
|
|
|
|
-R.vertexColors:!1;n.__vertexArray=new Float32Array(t*3);if(ja)n.__normalArray=new Float32Array(t*3);if(y.hasTangents)n.__tangentArray=new Float32Array(t*4);if(z)n.__colorArray=new Float32Array(t*3);if(v){if(y.faceUvs.length>0||y.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(y.faceUvs.length>1||y.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*
|
|
|
|
-4),n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];y=0;for(Z=n.numMorphTargets;y<Z;y++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=ja===THREE.SmoothShading;n.__uvType=v;n.__vertexColorType=z;n.__normalType=ja;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(R.attributes){if(n.__webglCustomAttributesList===void 0)n.__webglCustomAttributesList=
|
|
|
|
-[];u=void 0;for(u in R.attributes){v=R.attributes[u];y={};for(p in v)y[p]=v[p];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(t*w),y.buffer=o.createBuffer(),y.buffer.belongsToAttribute=u,v.needsUpdate=!0,y.__original=v;n.__webglCustomAttributesList.push(y)}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=
|
|
|
|
-!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=k,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),
|
|
|
|
-n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*
|
|
|
|
-3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(l in k=f.geometry,k.geometryGroups)n=k.geometryGroups[l],P(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,P(h.__webglObjects,k,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):
|
|
|
|
-f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)K(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;l=f;for(k=h.length-1;k>=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&K(h.__webglObjectsImmediate,f);
|
|
|
|
-f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(n=a.__webglObjects[f].object,l=n.geometry,k=w=u=void 0,n instanceof THREE.Mesh){t=0;for(p=l.geometryGroupsList.length;t<p;t++)if(u=l.geometryGroupsList[t],k=b(n,u),w=k.attributes&&A(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,x=!l.dynamic,u.__inittedArrays){var B=y=R=void 0,J=void 0,C=B=void 0,ga=
|
|
|
|
-void 0,ra=void 0,L=void 0,S=Z=ja=z=v=void 0,H=void 0,F=void 0,da=void 0,M=void 0,O=J=L=J=ra=ga=void 0,G=void 0,I=G=O=ga=void 0,E=void 0,I=G=O=B=B=C=G=O=J=I=G=O=E=I=G=O=E=I=G=O=void 0,N=0,Q=0,ta=0,$=0,ua=0,xa=0,V=0,ea=0,Y=0,T=0,pa=0,W=I=0,W=void 0,X=u.__vertexArray,na=u.__uvArray,ka=u.__uv2Array,ia=u.__normalArray,oa=u.__tangentArray,fa=u.__colorArray,aa=u.__skinVertexAArray,qa=u.__skinVertexBArray,ca=u.__skinIndexArray,ha=u.__skinWeightArray,sa=u.__morphTargetsArrays,ma=u.__webglCustomAttributesList,
|
|
|
|
-E=void 0,za=u.__faceArray,ya=u.__lineArray,Da=u.__needsSmoothNormals,z=u.__vertexColorType,v=u.__uvType,ja=u.__normalType,va=n.geometry,Ca=va.__dirtyVertices,Ba=va.__dirtyElements,Fa=va.__dirtyUvs,Ha=va.__dirtyNormals,Ea=va.__dirtyTangents,Ra=va.__dirtyColors,Ga=va.__dirtyMorphTargets,Na=va.vertices,$a=u.faces,cb=va.faces,ab=va.faceVertexUvs[0],bb=va.faceVertexUvs[1],Oa=va.skinVerticesA,Pa=va.skinVerticesB,Qa=va.skinIndices,Ka=va.skinWeights,Ja=va.morphTargets;if(ma){O=0;for(G=ma.length;O<G;O++)ma[O].offset=
|
|
|
|
-0,ma[O].offsetSrc=0}R=0;for(y=$a.length;R<y;R++)if(B=$a[R],J=cb[B],ab&&(Z=ab[B]),bb&&(S=bb[B]),B=J.vertexNormals,C=J.normal,ga=J.vertexColors,ra=J.color,L=J.vertexTangents,J instanceof THREE.Face3){if(Ca)H=Na[J.a].position,F=Na[J.b].position,da=Na[J.c].position,X[Q]=H.x,X[Q+1]=H.y,X[Q+2]=H.z,X[Q+3]=F.x,X[Q+4]=F.y,X[Q+5]=F.z,X[Q+6]=da.x,X[Q+7]=da.y,X[Q+8]=da.z,Q+=9;if(ma){O=0;for(G=ma.length;O<G;O++)if(E=ma[O],E.__original.needsUpdate)I=E.offset,W=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo===
|
|
|
|
-"vertices"?(E.array[I]=E.value[J.a],E.array[I+1]=E.value[J.b],E.array[I+2]=E.value[J.c]):E.boundTo==="faces"?(W=E.value[W],E.array[I]=W,E.array[I+1]=W,E.array[I+2]=W,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[W],E.array[I+1]=E.value[W+1],E.array[I+2]=E.value[W+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(H=E.value[J.a],F=E.value[J.b],da=E.value[J.c]):E.boundTo==="faces"?(da=F=H=W=E.value[W],E.offsetSrc++):E.boundTo==="faceVertices"&&(H=E.value[W],
|
|
|
|
-F=E.value[W+1],da=E.value[W+2],E.offsetSrc+=3),E.size===2?(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=F.x,E.array[I+3]=F.y,E.array[I+4]=da.x,E.array[I+5]=da.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=H.r,E.array[I+1]=H.g,E.array[I+2]=H.b,E.array[I+3]=F.r,E.array[I+4]=F.g,E.array[I+5]=F.b,E.array[I+6]=da.r,E.array[I+7]=da.g,E.array[I+8]=da.b):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=F.x,E.array[I+4]=F.y,E.array[I+5]=F.z,E.array[I+6]=da.x,E.array[I+7]=da.y,E.array[I+
|
|
|
|
-8]=da.z),E.offset+=9):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=H.w,E.array[I+4]=F.x,E.array[I+5]=F.y,E.array[I+6]=F.z,E.array[I+7]=F.w,E.array[I+8]=da.x,E.array[I+9]=da.y,E.array[I+10]=da.z,E.array[I+11]=da.w,E.offset+=12))}if(Ga){O=0;for(G=Ja.length;O<G;O++)H=Ja[O].vertices[J.a].position,F=Ja[O].vertices[J.b].position,da=Ja[O].vertices[J.c].position,I=sa[O],I[pa]=H.x,I[pa+1]=H.y,I[pa+2]=H.z,I[pa+3]=F.x,I[pa+4]=F.y,I[pa+5]=F.z,I[pa+6]=da.x,I[pa+7]=da.y,I[pa+8]=da.z;pa+=9}if(Ka.length)O=
|
|
|
|
-Ka[J.a],G=Ka[J.b],I=Ka[J.c],ha[T]=O.x,ha[T+1]=O.y,ha[T+2]=O.z,ha[T+3]=O.w,ha[T+4]=G.x,ha[T+5]=G.y,ha[T+6]=G.z,ha[T+7]=G.w,ha[T+8]=I.x,ha[T+9]=I.y,ha[T+10]=I.z,ha[T+11]=I.w,O=Qa[J.a],G=Qa[J.b],I=Qa[J.c],ca[T]=O.x,ca[T+1]=O.y,ca[T+2]=O.z,ca[T+3]=O.w,ca[T+4]=G.x,ca[T+5]=G.y,ca[T+6]=G.z,ca[T+7]=G.w,ca[T+8]=I.x,ca[T+9]=I.y,ca[T+10]=I.z,ca[T+11]=I.w,O=Oa[J.a],G=Oa[J.b],I=Oa[J.c],aa[T]=O.x,aa[T+1]=O.y,aa[T+2]=O.z,aa[T+3]=1,aa[T+4]=G.x,aa[T+5]=G.y,aa[T+6]=G.z,aa[T+7]=1,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,
|
|
|
|
-aa[T+11]=1,O=Pa[J.a],G=Pa[J.b],I=Pa[J.c],qa[T]=O.x,qa[T+1]=O.y,qa[T+2]=O.z,qa[T+3]=1,qa[T+4]=G.x,qa[T+5]=G.y,qa[T+6]=G.z,qa[T+7]=1,qa[T+8]=I.x,qa[T+9]=I.y,qa[T+10]=I.z,qa[T+11]=1,T+=12;if(Ra&&z)ga.length===3&&z===THREE.VertexColors?(J=ga[0],O=ga[1],G=ga[2]):G=O=J=ra,fa[Y]=J.r,fa[Y+1]=J.g,fa[Y+2]=J.b,fa[Y+3]=O.r,fa[Y+4]=O.g,fa[Y+5]=O.b,fa[Y+6]=G.r,fa[Y+7]=G.g,fa[Y+8]=G.b,Y+=9;if(Ea&&va.hasTangents)ga=L[0],ra=L[1],J=L[2],oa[V]=ga.x,oa[V+1]=ga.y,oa[V+2]=ga.z,oa[V+3]=ga.w,oa[V+4]=ra.x,oa[V+5]=ra.y,oa[V+
|
|
|
|
-6]=ra.z,oa[V+7]=ra.w,oa[V+8]=J.x,oa[V+9]=J.y,oa[V+10]=J.z,oa[V+11]=J.w,V+=12;if(Ha&&ja)if(B.length===3&&Da)for(O=0;O<3;O++)C=B[O],ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;else for(O=0;O<3;O++)ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;if(Fa&&Z!==void 0&&v)for(O=0;O<3;O++)B=Z[O],na[ta]=B.u,na[ta+1]=B.v,ta+=2;if(Fa&&S!==void 0&&v)for(O=0;O<3;O++)B=S[O],ka[$]=B.u,ka[$+1]=B.v,$+=2;Ba&&(za[ua]=N,za[ua+1]=N+1,za[ua+2]=N+2,ua+=3,ya[ea]=N,ya[ea+1]=N+1,ya[ea+2]=N,ya[ea+3]=N+2,ya[ea+4]=N+1,ya[ea+5]=N+2,ea+=
|
|
|
|
-6,N+=3)}else if(J instanceof THREE.Face4){if(Ca)H=Na[J.a].position,F=Na[J.b].position,da=Na[J.c].position,M=Na[J.d].position,X[Q]=H.x,X[Q+1]=H.y,X[Q+2]=H.z,X[Q+3]=F.x,X[Q+4]=F.y,X[Q+5]=F.z,X[Q+6]=da.x,X[Q+7]=da.y,X[Q+8]=da.z,X[Q+9]=M.x,X[Q+10]=M.y,X[Q+11]=M.z,Q+=12;if(ma){O=0;for(G=ma.length;O<G;O++)if(E=ma[O],E.__original.needsUpdate)I=E.offset,W=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[J.a],E.array[I+1]=E.value[J.b],E.array[I+2]=E.value[J.c],E.array[I+
|
|
|
|
-3]=E.value[J.d]):E.boundTo==="faces"?(W=E.value[W],E.array[I]=W,E.array[I+1]=W,E.array[I+2]=W,E.array[I+3]=W,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[W],E.array[I+1]=E.value[W+1],E.array[I+2]=E.value[W+2],E.array[I+3]=E.value[W+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(H=E.value[J.a],F=E.value[J.b],da=E.value[J.c],M=E.value[J.d]):E.boundTo==="faces"?(M=da=F=H=W=E.value[W],E.offsetSrc++):E.boundTo==="faceVertices"&&(H=E.value[W],F=E.value[W+
|
|
|
|
-1],da=E.value[W+2],M=E.value[W+3],E.offsetSrc+=4),E.size===2?(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=F.x,E.array[I+3]=F.y,E.array[I+4]=da.x,E.array[I+5]=da.y,E.array[I+6]=M.x,E.array[I+7]=M.y,E.offset+=8):E.size===3?(E.type==="c"?(E.array[I]=H.r,E.array[I+1]=H.g,E.array[I+2]=H.b,E.array[I+3]=F.r,E.array[I+4]=F.g,E.array[I+5]=F.b,E.array[I+6]=da.r,E.array[I+7]=da.g,E.array[I+8]=da.b,E.array[I+9]=M.r,E.array[I+10]=M.g,E.array[I+11]=M.b):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+
|
|
|
|
-3]=F.x,E.array[I+4]=F.y,E.array[I+5]=F.z,E.array[I+6]=da.x,E.array[I+7]=da.y,E.array[I+8]=da.z,E.array[I+9]=M.x,E.array[I+10]=M.y,E.array[I+11]=M.z),E.offset+=12):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=H.w,E.array[I+4]=F.x,E.array[I+5]=F.y,E.array[I+6]=F.z,E.array[I+7]=F.w,E.array[I+8]=da.x,E.array[I+9]=da.y,E.array[I+10]=da.z,E.array[I+11]=da.w,E.array[I+12]=M.x,E.array[I+13]=M.y,E.array[I+14]=M.z,E.array[I+15]=M.w,E.offset+=16))}if(Ga){O=0;for(G=Ja.length;O<G;O++)H=Ja[O].vertices[J.a].position,
|
|
|
|
-F=Ja[O].vertices[J.b].position,da=Ja[O].vertices[J.c].position,M=Ja[O].vertices[J.d].position,I=sa[O],I[pa]=H.x,I[pa+1]=H.y,I[pa+2]=H.z,I[pa+3]=F.x,I[pa+4]=F.y,I[pa+5]=F.z,I[pa+6]=da.x,I[pa+7]=da.y,I[pa+8]=da.z,I[pa+9]=M.x,I[pa+10]=M.y,I[pa+11]=M.z;pa+=12}if(Ka.length)O=Ka[J.a],G=Ka[J.b],I=Ka[J.c],E=Ka[J.d],ha[T]=O.x,ha[T+1]=O.y,ha[T+2]=O.z,ha[T+3]=O.w,ha[T+4]=G.x,ha[T+5]=G.y,ha[T+6]=G.z,ha[T+7]=G.w,ha[T+8]=I.x,ha[T+9]=I.y,ha[T+10]=I.z,ha[T+11]=I.w,ha[T+12]=E.x,ha[T+13]=E.y,ha[T+14]=E.z,ha[T+15]=
|
|
|
|
-E.w,O=Qa[J.a],G=Qa[J.b],I=Qa[J.c],E=Qa[J.d],ca[T]=O.x,ca[T+1]=O.y,ca[T+2]=O.z,ca[T+3]=O.w,ca[T+4]=G.x,ca[T+5]=G.y,ca[T+6]=G.z,ca[T+7]=G.w,ca[T+8]=I.x,ca[T+9]=I.y,ca[T+10]=I.z,ca[T+11]=I.w,ca[T+12]=E.x,ca[T+13]=E.y,ca[T+14]=E.z,ca[T+15]=E.w,O=Oa[J.a],G=Oa[J.b],I=Oa[J.c],E=Oa[J.d],aa[T]=O.x,aa[T+1]=O.y,aa[T+2]=O.z,aa[T+3]=1,aa[T+4]=G.x,aa[T+5]=G.y,aa[T+6]=G.z,aa[T+7]=1,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=1,aa[T+12]=E.x,aa[T+13]=E.y,aa[T+14]=E.z,aa[T+15]=1,O=Pa[J.a],G=Pa[J.b],I=Pa[J.c],J=Pa[J.d],
|
|
|
|
-qa[T]=O.x,qa[T+1]=O.y,qa[T+2]=O.z,qa[T+3]=1,qa[T+4]=G.x,qa[T+5]=G.y,qa[T+6]=G.z,qa[T+7]=1,qa[T+8]=I.x,qa[T+9]=I.y,qa[T+10]=I.z,qa[T+11]=1,qa[T+12]=J.x,qa[T+13]=J.y,qa[T+14]=J.z,qa[T+15]=1,T+=16;if(Ra&&z)ga.length===4&&z===THREE.VertexColors?(J=ga[0],O=ga[1],G=ga[2],ga=ga[3]):ga=G=O=J=ra,fa[Y]=J.r,fa[Y+1]=J.g,fa[Y+2]=J.b,fa[Y+3]=O.r,fa[Y+4]=O.g,fa[Y+5]=O.b,fa[Y+6]=G.r,fa[Y+7]=G.g,fa[Y+8]=G.b,fa[Y+9]=ga.r,fa[Y+10]=ga.g,fa[Y+11]=ga.b,Y+=12;if(Ea&&va.hasTangents)ga=L[0],ra=L[1],J=L[2],L=L[3],oa[V]=ga.x,
|
|
|
|
-oa[V+1]=ga.y,oa[V+2]=ga.z,oa[V+3]=ga.w,oa[V+4]=ra.x,oa[V+5]=ra.y,oa[V+6]=ra.z,oa[V+7]=ra.w,oa[V+8]=J.x,oa[V+9]=J.y,oa[V+10]=J.z,oa[V+11]=J.w,oa[V+12]=L.x,oa[V+13]=L.y,oa[V+14]=L.z,oa[V+15]=L.w,V+=16;if(Ha&&ja)if(B.length===4&&Da)for(O=0;O<4;O++)C=B[O],ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;else for(O=0;O<4;O++)ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;if(Fa&&Z!==void 0&&v)for(O=0;O<4;O++)B=Z[O],na[ta]=B.u,na[ta+1]=B.v,ta+=2;if(Fa&&S!==void 0&&v)for(O=0;O<4;O++)B=S[O],ka[$]=B.u,ka[$+1]=B.v,$+=
|
|
|
|
-2;Ba&&(za[ua]=N,za[ua+1]=N+1,za[ua+2]=N+3,za[ua+3]=N+1,za[ua+4]=N+2,za[ua+5]=N+3,ua+=6,ya[ea]=N,ya[ea+1]=N+1,ya[ea+2]=N,ya[ea+3]=N+3,ya[ea+4]=N+1,ya[ea+5]=N+2,ya[ea+6]=N+2,ya[ea+7]=N+3,ea+=8,N+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,X,w));if(ma){O=0;for(G=ma.length;O<G;O++)E=ma[O],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,w))}if(Ga){O=0;for(G=Ja.length;O<G;O++)o.bindBuffer(o.ARRAY_BUFFER,u.__webglMorphTargetsBuffers[O]),
|
|
|
|
-o.bufferData(o.ARRAY_BUFFER,sa[O],w)}Ra&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,w));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ia,w));Ea&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,oa,w));Fa&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,na,w));Fa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
-ka,w));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,w),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,w));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,w),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,qa,w),o.bindBuffer(o.ARRAY_BUFFER,u.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ca,w),o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-u.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ha,w));x&&(delete u.__inittedArrays,delete u.__colorArray,delete u.__normalArray,delete u.__tangentArray,delete u.__uvArray,delete u.__uv2Array,delete u.__faceArray,delete u.__vertexArray,delete u.__lineArray,delete u.__skinVertexAArray,delete u.__skinVertexBArray,delete u.__skinIndexArray,delete u.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=
|
|
|
|
-!1;k.attributes&&D(k)}else if(n instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;n=o.DYNAMIC_DRAW;t=R=x=x=void 0;y=k.vertices;p=k.colors;v=y.length;u=p.length;z=k.__vertexArray;w=k.__colorArray;ja=k.__dirtyColors;if(k.__dirtyVertices){for(x=0;x<v;x++)R=y[x].position,t=x*3,z[t]=R.x,z[t+1]=R.y,z[t+2]=R.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,n)}if(ja){for(x=0;x<u;x++)color=p[x],t=x*3,w[t]=color.r,w[t+1]=color.g,w[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,n)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(n instanceof THREE.Line){k=b(n,u);w=k.attributes&&A(k);if(l.__dirtyVertices||l.__dirtyColors||w){n=l;t=o.DYNAMIC_DRAW;p=S=y=Z=void 0;y=n.vertices;u=n.colors;v=y.length;w=u.length;z=n.__vertexArray;x=n.__colorArray;ja=n.__dirtyColors;R=n.__webglCustomAttributesList;M=da=F=H=S=Z=void 0;if(n.__dirtyVertices){for(Z=0;Z<v;Z++)S=y[Z].position,p=Z*3,z[p]=S.x,z[p+1]=S.y,z[p+2]=S.z;o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-n.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,t)}if(ja){for(y=0;y<w;y++)color=u[y],p=y*3,x[p]=color.r,x[p+1]=color.g,x[p+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,n.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,x,t)}if(R){Z=0;for(S=R.length;Z<S;Z++)if(M=R[Z],M.__original.needsUpdate&&(M.boundTo===void 0||M.boundTo==="vertices")){p=0;F=M.value.length;for(H=0;H<F;H++)M.size===1?M.array[p]=M.value[H]:(da=M.value[H],M.size===2?(M.array[p]=da.x,M.array[p+1]=da.y):M.size===3?M.type==="c"?(M.array[p]=
|
|
|
|
-da.r,M.array[p+1]=da.g,M.array[p+2]=da.b):(M.array[p]=da.x,M.array[p+1]=da.y,M.array[p+2]=da.z):(M.array[p]=da.x,M.array[p+1]=da.y,M.array[p+2]=da.z,M.array[p+3]=da.w)),p+=M.size;o.bindBuffer(o.ARRAY_BUFFER,M.buffer);o.bufferData(o.ARRAY_BUFFER,M.array,t)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&D(k)}else if(n instanceof THREE.ParticleSystem)k=b(n,u),w=k.attributes&&A(k),(l.__dirtyVertices||l.__dirtyColors||n.sortParticles||w)&&e(l,o.DYNAMIC_DRAW,n),l.__dirtyVertices=!1,l.__dirtyColors=
|
|
|
|
-!1,k.attributes&&D(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ha}};
|
|
|
|
|
|
+case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var S=this,o,Y=[],ha=null,L=null,Q=-1,$=null,na=0,fa=null,sa=null,ia=null,Z=null,ma=null,da=null,ja=null,la=null,ga=0,pa=0,va=0,qa=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],wa=new THREE.Matrix4,Fa=new Float32Array(16),
|
|
|
|
+Da=new Float32Array(16),ua=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},U=a.canvas!==void 0?a.canvas:document.createElement("canvas"),aa=a.stencil!==void 0?a.stencil:!0,ea=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,W=a.antialias!==void 0?a.antialias:!1,N=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=a.clearAlpha!==void 0?a.clearAlpha:0,Aa=a.maxLights!==
|
|
|
|
+void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=U;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
|
|
|
|
+5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ta,oa=[],a=THREE.ShaderLib.depthRGBA,Ba=THREE.UniformsUtils.clone(a.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba}),Ia=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba,morphTargets:!0});ya._shadowPass=!0;Ia._shadowPass=!0;try{if(!(o=U.getContext("experimental-webgl",
|
|
|
|
+{antialias:W,stencil:aa,preserveDrawingBuffer:ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ca){console.error(Ca)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);
|
|
|
|
+o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(N.r,N.g,N.b,ra);this.context=o;var Ea=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);aa=0;V.vertices[aa++]=-1;V.vertices[aa++]=-1;V.vertices[aa++]=0;V.vertices[aa++]=1;V.vertices[aa++]=1;V.vertices[aa++]=-1;V.vertices[aa++]=1;V.vertices[aa++]=1;V.vertices[aa++]=1;V.vertices[aa++]=1;V.vertices[aa++]=1;V.vertices[aa++]=0;V.vertices[aa++]=-1;V.vertices[aa++]=1;V.vertices[aa++]=
|
|
|
|
+0;aa=V.vertices[aa++]=0;V.faces[aa++]=0;V.faces[aa++]=1;V.faces[aa++]=2;V.faces[aa++]=0;V.faces[aa++]=2;V.faces[aa++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();o.attachShader(V.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));
|
|
|
|
+o.attachShader(V.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=
|
|
|
|
+o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,
|
|
|
|
+"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ra=!1;this.setSize=function(a,b){U.width=a;U.height=b;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(a,b,c,e){ga=a;pa=b;va=c;qa=e;o.viewport(ga,pa,va,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){N.setHex(a);ra=b;o.clearColor(N.r,N.g,N.b,ra)};
|
|
|
|
+this.setClearColor=function(a,b){N.copy(a);ra=b;o.clearColor(N.r,N.g,N.b,ra)};this.getClearColor=function(){return N};this.getClearAlpha=function(){return ra};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,
|
|
|
|
+delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);
|
|
|
|
+o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;
|
|
|
|
+else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,l,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?
|
|
|
|
+k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var t,v,p;t=p=n=0;for(v=b.length;t<v;t++)l=b[t],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&n++;n+p<=Aa?t=p:(t=Math.ceil(Aa*p/
|
|
|
|
+(n+p)),n=Aa-t);l={directional:t,point:n};n=p=0;for(t=b.length;n<t;n++)v=b[n],v instanceof THREE.SpotLight&&v.castShadow&&p++;var u=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)u=e.bones.length;var w;a:{t=a.fragmentShader;v=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:l.directional,
|
|
|
|
+maxPointLights:l.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];k?e.push(k):(e.push(t),e.push(v));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=Y.length;x<e;x++)if(Y[x].code===k){w=Y[x].program;break a}x=o.createProgram();e=[Ea?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":
|
|
|
|
+"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":
|
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
+l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
|
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,X("fragment",l+t));o.attachShader(x,
|
|
|
|
+X("vertex",e+v));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var U,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in n)e.push(U);U=e;e=0;for(n=U.length;e<n;e++)t=U[e],x.uniforms[t]=o.getUniformLocation(x,
|
|
|
|
+t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<c.maxMorphTargets;U++)e.push("morphTarget"+U);for(w in b)e.push(w);w=e;U=0;for(b=w.length;U<b;U++)c=w[U],x.attributes[c]=o.getAttribLocation(x,c);x.id=Y.length;Y.push({program:x,code:k});S.info.memory.programs=Y.length;w=x}a.program=w;w=a.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);
|
|
|
|
+w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(h in a.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)U="morphTarget"+h,w[U]>=0&&(o.enableVertexAttribArray(w[U]),
|
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){J(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){A(a,b)};this.render=function(a,b,c,e){var U,ea,aa,B,D,W,la,K=a.lights,ra=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&A(a,b);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Da);b.projectionMatrix.flattenToArray(Fa);wa.multiply(b.projectionMatrix,b.matrixWorldInverse);p(wa);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);aa=a.__webglObjects.length;for(e=0;e<aa;e++)if(D=a.__webglObjects[e],W=D.object,W.visible)if(!(W instanceof THREE.Mesh)||!W.frustumCulled||x(W)){if(W.matrixWorld.flattenToArray(W._objectMatrixArray),
|
|
|
|
+C(W,b,!0),y(D),D.render=!0,this.sortObjects)W.renderDepth?D.z=W.renderDepth:(ua.copy(W.position),wa.multiplyVector3(ua),D.z=ua.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(w);B=a.__webglObjectsImmediate.length;for(e=0;e<B;e++)D=a.__webglObjectsImmediate[e],W=D.object,W.visible&&(W.matrixAutoUpdate&&W.matrixWorld.flattenToArray(W._objectMatrixArray),C(W,b,!0),v(D));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(e=0;e<aa;e++)if(D=
|
|
|
|
+a.__webglObjects[e],D.render)W=D.object,la=D.buffer,k(W),f(b,K,ra,a.overrideMaterial,la,W);for(e=0;e<B;e++)D=a.__webglObjectsImmediate[e],W=D.object,W.visible&&($=-1,k(W),U=l(b,K,ra,a.overrideMaterial,W),W.immediateRenderCallback?W.immediateRenderCallback(U,o,ka):W.render(function(b){h(b,U,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(e=aa-1;e>=0;e--)if(D=a.__webglObjects[e],D.render&&(W=D.object,la=D.buffer,ea=D.opaque))k(W),n(ea.depthTest),t(ea.depthWrite),u(ea.polygonOffset,ea.polygonOffsetFactor,
|
|
|
|
+ea.polygonOffsetUnits),f(b,K,ra,ea,la,W);for(e=0;e<B;e++)if(D=a.__webglObjectsImmediate[e],W=D.object,W.visible&&($=-1,ea=D.opaque))k(W),n(ea.depthTest),t(ea.depthWrite),u(ea.polygonOffset,ea.polygonOffsetFactor,ea.polygonOffsetUnits),U=l(b,K,ra,ea,W),W.immediateRenderCallback?W.immediateRenderCallback(U,o,ka):W.render(function(a){h(a,U,ea.shading)});for(e=0;e<aa;e++)if(D=a.__webglObjects[e],D.render&&(W=D.object,la=D.buffer,ea=D.transparent))k(W),F(ea.blending),n(ea.depthTest),t(ea.depthWrite),u(ea.polygonOffset,
|
|
|
|
+ea.polygonOffsetFactor,ea.polygonOffsetUnits),f(b,K,ra,ea,la,W);for(e=0;e<B;e++)if(D=a.__webglObjectsImmediate[e],W=D.object,W.visible&&($=-1,ea=D.transparent))k(W),F(ea.blending),n(ea.depthTest),t(ea.depthWrite),u(ea.polygonOffset,ea.polygonOffsetFactor,ea.polygonOffsetUnits),U=l(b,K,ra,ea,W),W.immediateRenderCallback?W.immediateRenderCallback(U,o,ka):W.render(function(a){h(a,U,ea.shading)})}a.__webglSprites.length&&z(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&G(c)};
|
|
|
|
+this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,k=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){k=f.geometry;
|
|
|
|
+if(k.geometryGroups===void 0){var n=k,t=void 0,p=void 0,v=void 0,u=void 0,w=void 0,x=void 0,U=void 0,y={},ea=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)v=n.faces[t],u=v.materialIndex,x=u!==void 0?u:-1,y[x]===void 0&&(y[x]={hash:x,counter:0}),U=y[x].hash+"_"+y[x].counter,n.geometryGroups[U]===void 0&&(n.geometryGroups[U]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:ea}),w=v instanceof THREE.Face3?3:4,n.geometryGroups[U].vertices+w>65535&&(y[x].counter+=
|
|
|
|
+1,U=y[x].hash+"_"+y[x].counter,n.geometryGroups[U]===void 0&&(n.geometryGroups[U]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:ea})),v instanceof THREE.Face3?n.geometryGroups[U].faces3.push(t):n.geometryGroups[U].faces4.push(t),n.geometryGroups[U].vertices+=w;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=na++,n.geometryGroupsList.push(n.geometryGroups[t])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){t=n;t.__webglVertexBuffer=
|
|
|
|
+o.createBuffer();t.__webglNormalBuffer=o.createBuffer();t.__webglTangentBuffer=o.createBuffer();t.__webglColorBuffer=o.createBuffer();t.__webglUVBuffer=o.createBuffer();t.__webglUV2Buffer=o.createBuffer();t.__webglSkinVertexABuffer=o.createBuffer();t.__webglSkinVertexBBuffer=o.createBuffer();t.__webglSkinIndicesBuffer=o.createBuffer();t.__webglSkinWeightsBuffer=o.createBuffer();t.__webglFaceBuffer=o.createBuffer();t.__webglLineBuffer=o.createBuffer();if(t.numMorphTargets){v=p=void 0;t.__webglMorphTargetsBuffers=
|
|
|
|
+[];p=0;for(v=t.numMorphTargets;p<v;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}S.info.memory.geometries++;u=f;w=u.geometry;p=n.faces3;x=n.faces4;t=p.length*3+x.length*4;v=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(u,n);U=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;y=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;ea=p.vertexColors?
|
|
|
|
+p.vertexColors:!1;n.__vertexArray=new Float32Array(t*3);if(y)n.__normalArray=new Float32Array(t*3);if(w.hasTangents)n.__tangentArray=new Float32Array(t*4);if(ea)n.__colorArray=new Float32Array(t*3);if(U){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*
|
|
|
|
+4),n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(v*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];u=0;for(w=n.numMorphTargets;u<w;u++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=y===THREE.SmoothShading;n.__uvType=U;n.__vertexColorType=ea;n.__normalType=y;n.__webglFaceCount=v*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===void 0)n.__webglCustomAttributesList=
|
|
|
|
+[];v=void 0;for(v in p.attributes){var u=p.attributes[v],w={},A;for(A in u)w[A]=u[A];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,x=1,w.type==="v2"?x=2:w.type==="v3"?x=3:w.type==="v4"?x=4:w.type==="c"&&(x=3),w.size=x,w.array=new Float32Array(t*x),w.buffer=o.createBuffer(),w.buffer.belongsToAttribute=v,u.needsUpdate=!0,w.__original=u;n.__webglCustomAttributesList.push(w)}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=
|
|
|
|
+!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),S.info.memory.geometries++,n=k,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=
|
|
|
|
+o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),S.info.memory.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),S.info.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),
|
|
|
|
+n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(l in k=f.geometry,k.geometryGroups)n=k.geometryGroups[l],O(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,O(h.__webglObjects,k,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,
|
|
|
|
+opaque:null,transparent:null}):f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)K(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;l=f;for(k=h.length-1;k>=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&
|
|
|
|
+K(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(A=a.__webglObjects[f].object,l=A.geometry,k=v=p=void 0,A instanceof THREE.Mesh){n=0;for(t=l.geometryGroupsList.length;n<t;n++)if(p=l.geometryGroupsList[n],k=b(A,p),v=k.attributes&&B(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||v)if(v=o.DYNAMIC_DRAW,u=!l.dynamic,p.__inittedArrays){var aa=
|
|
|
|
+x=w=void 0,z=void 0,W=aa=void 0,C=void 0,la=void 0,ra=void 0,J=ea=y=U=void 0,Q=void 0,H=void 0,F=void 0,ga=void 0,L=void 0,N=z=ra=z=la=C=void 0,G=void 0,M=void 0,I=G=N=void 0,I=G=N=aa=aa=W=G=N=M=I=G=N=M=I=G=N=M=I=G=N=M=void 0,P=0,pa=0,Y=0,va=0,Aa=0,V=0,Z=0,$=0,oa=0,R=0,X=0,T=I=0,T=void 0,ia=p.__vertexArray,ma=p.__uvArray,ja=p.__uv2Array,ta=p.__normalArray,da=p.__tangentArray,fa=p.__colorArray,qa=p.__skinVertexAArray,ca=p.__skinVertexBArray,ha=p.__skinIndexArray,ka=p.__skinWeightArray,sa=p.__morphTargetsArrays,
|
|
|
|
+ya=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,wa=p.__lineArray,Fa=p.__needsSmoothNormals,y=p.__vertexColorType,U=p.__uvType,ea=p.__normalType,ua=A.geometry,Ca=ua.__dirtyVertices,Ia=ua.__dirtyElements,Ea=ua.__dirtyUvs,Da=ua.__dirtyNormals,Ra=ua.__dirtyTangents,Ga=ua.__dirtyColors,ab=ua.__dirtyMorphTargets,Na=ua.vertices,M=p.faces3,cb=p.faces4,db=ua.faces,Ya=ua.faceVertexUvs[0],Za=ua.faceVertexUvs[1],Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,Ka=ua.skinWeights,Ja=ua.morphTargets;
|
|
|
|
+if(ya){N=0;for(G=ya.length;N<G;N++)ya[N].offset=0,ya[N].offsetSrc=0}w=0;for(x=M.length;w<x;w++){aa=M[w];z=db[aa];Ya&&(J=Ya[aa]);Za&&(Q=Za[aa]);aa=z.vertexNormals;W=z.normal;C=z.vertexColors;la=z.color;ra=z.vertexTangents;if(Ca)H=Na[z.a].position,F=Na[z.b].position,ga=Na[z.c].position,ia[pa]=H.x,ia[pa+1]=H.y,ia[pa+2]=H.z,ia[pa+3]=F.x,ia[pa+4]=F.y,ia[pa+5]=F.z,ia[pa+6]=ga.x,ia[pa+7]=ga.y,ia[pa+8]=ga.z,pa+=9;if(ya){N=0;for(G=ya.length;N<G;N++)if(E=ya[N],E.__original.needsUpdate)I=E.offset,T=E.offsetSrc,
|
|
|
|
+E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[z.a],E.array[I+1]=E.value[z.b],E.array[I+2]=E.value[z.c]):E.boundTo==="faces"?(T=E.value[T],E.array[I]=T,E.array[I+1]=T,E.array[I+2]=T,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[T],E.array[I+1]=E.value[T+1],E.array[I+2]=E.value[T+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(H=E.value[z.a],F=E.value[z.b],ga=E.value[z.c]):E.boundTo==="faces"?(ga=F=H=T=E.value[T],E.offsetSrc++):
|
|
|
|
+E.boundTo==="faceVertices"&&(H=E.value[T],F=E.value[T+1],ga=E.value[T+2],E.offsetSrc+=3),E.size===2?(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=F.x,E.array[I+3]=F.y,E.array[I+4]=ga.x,E.array[I+5]=ga.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=H.r,E.array[I+1]=H.g,E.array[I+2]=H.b,E.array[I+3]=F.r,E.array[I+4]=F.g,E.array[I+5]=F.b,E.array[I+6]=ga.r,E.array[I+7]=ga.g,E.array[I+8]=ga.b):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=F.x,E.array[I+4]=F.y,E.array[I+5]=F.z,E.array[I+
|
|
|
|
+6]=ga.x,E.array[I+7]=ga.y,E.array[I+8]=ga.z),E.offset+=9):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=H.w,E.array[I+4]=F.x,E.array[I+5]=F.y,E.array[I+6]=F.z,E.array[I+7]=F.w,E.array[I+8]=ga.x,E.array[I+9]=ga.y,E.array[I+10]=ga.z,E.array[I+11]=ga.w,E.offset+=12))}if(ab){N=0;for(G=Ja.length;N<G;N++)H=Ja[N].vertices[z.a].position,F=Ja[N].vertices[z.b].position,ga=Ja[N].vertices[z.c].position,I=sa[N],I[X]=H.x,I[X+1]=H.y,I[X+2]=H.z,I[X+3]=F.x,I[X+4]=F.y,I[X+5]=F.z,I[X+6]=ga.x,I[X+7]=
|
|
|
|
+ga.y,I[X+8]=ga.z;X+=9}if(Ka.length)N=Ka[z.a],G=Ka[z.b],I=Ka[z.c],ka[R]=N.x,ka[R+1]=N.y,ka[R+2]=N.z,ka[R+3]=N.w,ka[R+4]=G.x,ka[R+5]=G.y,ka[R+6]=G.z,ka[R+7]=G.w,ka[R+8]=I.x,ka[R+9]=I.y,ka[R+10]=I.z,ka[R+11]=I.w,N=Qa[z.a],G=Qa[z.b],I=Qa[z.c],ha[R]=N.x,ha[R+1]=N.y,ha[R+2]=N.z,ha[R+3]=N.w,ha[R+4]=G.x,ha[R+5]=G.y,ha[R+6]=G.z,ha[R+7]=G.w,ha[R+8]=I.x,ha[R+9]=I.y,ha[R+10]=I.z,ha[R+11]=I.w,N=Oa[z.a],G=Oa[z.b],I=Oa[z.c],qa[R]=N.x,qa[R+1]=N.y,qa[R+2]=N.z,qa[R+3]=1,qa[R+4]=G.x,qa[R+5]=G.y,qa[R+6]=G.z,qa[R+7]=
|
|
|
|
+1,qa[R+8]=I.x,qa[R+9]=I.y,qa[R+10]=I.z,qa[R+11]=1,N=Pa[z.a],G=Pa[z.b],I=Pa[z.c],ca[R]=N.x,ca[R+1]=N.y,ca[R+2]=N.z,ca[R+3]=1,ca[R+4]=G.x,ca[R+5]=G.y,ca[R+6]=G.z,ca[R+7]=1,ca[R+8]=I.x,ca[R+9]=I.y,ca[R+10]=I.z,ca[R+11]=1,R+=12;if(Ga&&y)C.length===3&&y===THREE.VertexColors?(z=C[0],N=C[1],G=C[2]):G=N=z=la,fa[oa]=z.r,fa[oa+1]=z.g,fa[oa+2]=z.b,fa[oa+3]=N.r,fa[oa+4]=N.g,fa[oa+5]=N.b,fa[oa+6]=G.r,fa[oa+7]=G.g,fa[oa+8]=G.b,oa+=9;if(Ra&&ua.hasTangents)C=ra[0],la=ra[1],z=ra[2],da[Z]=C.x,da[Z+1]=C.y,da[Z+2]=C.z,
|
|
|
|
+da[Z+3]=C.w,da[Z+4]=la.x,da[Z+5]=la.y,da[Z+6]=la.z,da[Z+7]=la.w,da[Z+8]=z.x,da[Z+9]=z.y,da[Z+10]=z.z,da[Z+11]=z.w,Z+=12;if(Da&&ea)if(aa.length===3&&Fa)for(N=0;N<3;N++)W=aa[N],ta[V]=W.x,ta[V+1]=W.y,ta[V+2]=W.z,V+=3;else for(N=0;N<3;N++)ta[V]=W.x,ta[V+1]=W.y,ta[V+2]=W.z,V+=3;if(Ea&&J!==void 0&&U)for(N=0;N<3;N++)aa=J[N],ma[Y]=aa.u,ma[Y+1]=aa.v,Y+=2;if(Ea&&Q!==void 0&&U)for(N=0;N<3;N++)aa=Q[N],ja[va]=aa.u,ja[va+1]=aa.v,va+=2;Ia&&(Ba[Aa]=P,Ba[Aa+1]=P+1,Ba[Aa+2]=P+2,Aa+=3,wa[$]=P,wa[$+1]=P+1,wa[$+2]=P,
|
|
|
|
+wa[$+3]=P+2,wa[$+4]=P+1,wa[$+5]=P+2,$+=6,P+=3)}w=0;for(x=cb.length;w<x;w++){aa=cb[w];z=db[aa];Ya&&(J=Ya[aa]);Za&&(Q=Za[aa]);aa=z.vertexNormals;W=z.normal;C=z.vertexColors;la=z.color;ra=z.vertexTangents;if(Ca)H=Na[z.a].position,F=Na[z.b].position,ga=Na[z.c].position,L=Na[z.d].position,ia[pa]=H.x,ia[pa+1]=H.y,ia[pa+2]=H.z,ia[pa+3]=F.x,ia[pa+4]=F.y,ia[pa+5]=F.z,ia[pa+6]=ga.x,ia[pa+7]=ga.y,ia[pa+8]=ga.z,ia[pa+9]=L.x,ia[pa+10]=L.y,ia[pa+11]=L.z,pa+=12;if(ya){N=0;for(G=ya.length;N<G;N++)if(E=ya[N],E.__original.needsUpdate)I=
|
|
|
|
+E.offset,T=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[z.a],E.array[I+1]=E.value[z.b],E.array[I+2]=E.value[z.c],E.array[I+3]=E.value[z.d]):E.boundTo==="faces"?(T=E.value[T],E.array[I]=T,E.array[I+1]=T,E.array[I+2]=T,E.array[I+3]=T,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[T],E.array[I+1]=E.value[T+1],E.array[I+2]=E.value[T+2],E.array[I+3]=E.value[T+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(H=E.value[z.a],
|
|
|
|
+F=E.value[z.b],ga=E.value[z.c],L=E.value[z.d]):E.boundTo==="faces"?(L=ga=F=H=T=E.value[T],E.offsetSrc++):E.boundTo==="faceVertices"&&(H=E.value[T],F=E.value[T+1],ga=E.value[T+2],L=E.value[T+3],E.offsetSrc+=4),E.size===2?(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=F.x,E.array[I+3]=F.y,E.array[I+4]=ga.x,E.array[I+5]=ga.y,E.array[I+6]=L.x,E.array[I+7]=L.y,E.offset+=8):E.size===3?(E.type==="c"?(E.array[I]=H.r,E.array[I+1]=H.g,E.array[I+2]=H.b,E.array[I+3]=F.r,E.array[I+4]=F.g,E.array[I+5]=F.b,E.array[I+
|
|
|
|
+6]=ga.r,E.array[I+7]=ga.g,E.array[I+8]=ga.b,E.array[I+9]=L.r,E.array[I+10]=L.g,E.array[I+11]=L.b):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=F.x,E.array[I+4]=F.y,E.array[I+5]=F.z,E.array[I+6]=ga.x,E.array[I+7]=ga.y,E.array[I+8]=ga.z,E.array[I+9]=L.x,E.array[I+10]=L.y,E.array[I+11]=L.z),E.offset+=12):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=H.w,E.array[I+4]=F.x,E.array[I+5]=F.y,E.array[I+6]=F.z,E.array[I+7]=F.w,E.array[I+8]=ga.x,E.array[I+9]=ga.y,E.array[I+
|
|
|
|
+10]=ga.z,E.array[I+11]=ga.w,E.array[I+12]=L.x,E.array[I+13]=L.y,E.array[I+14]=L.z,E.array[I+15]=L.w,E.offset+=16))}if(ab){N=0;for(G=Ja.length;N<G;N++)H=Ja[N].vertices[z.a].position,F=Ja[N].vertices[z.b].position,ga=Ja[N].vertices[z.c].position,L=Ja[N].vertices[z.d].position,I=sa[N],I[X]=H.x,I[X+1]=H.y,I[X+2]=H.z,I[X+3]=F.x,I[X+4]=F.y,I[X+5]=F.z,I[X+6]=ga.x,I[X+7]=ga.y,I[X+8]=ga.z,I[X+9]=L.x,I[X+10]=L.y,I[X+11]=L.z;X+=12}if(Ka.length)N=Ka[z.a],G=Ka[z.b],I=Ka[z.c],M=Ka[z.d],ka[R]=N.x,ka[R+1]=N.y,ka[R+
|
|
|
|
+2]=N.z,ka[R+3]=N.w,ka[R+4]=G.x,ka[R+5]=G.y,ka[R+6]=G.z,ka[R+7]=G.w,ka[R+8]=I.x,ka[R+9]=I.y,ka[R+10]=I.z,ka[R+11]=I.w,ka[R+12]=M.x,ka[R+13]=M.y,ka[R+14]=M.z,ka[R+15]=M.w,N=Qa[z.a],G=Qa[z.b],I=Qa[z.c],M=Qa[z.d],ha[R]=N.x,ha[R+1]=N.y,ha[R+2]=N.z,ha[R+3]=N.w,ha[R+4]=G.x,ha[R+5]=G.y,ha[R+6]=G.z,ha[R+7]=G.w,ha[R+8]=I.x,ha[R+9]=I.y,ha[R+10]=I.z,ha[R+11]=I.w,ha[R+12]=M.x,ha[R+13]=M.y,ha[R+14]=M.z,ha[R+15]=M.w,N=Oa[z.a],G=Oa[z.b],I=Oa[z.c],M=Oa[z.d],qa[R]=N.x,qa[R+1]=N.y,qa[R+2]=N.z,qa[R+3]=1,qa[R+4]=G.x,
|
|
|
|
+qa[R+5]=G.y,qa[R+6]=G.z,qa[R+7]=1,qa[R+8]=I.x,qa[R+9]=I.y,qa[R+10]=I.z,qa[R+11]=1,qa[R+12]=M.x,qa[R+13]=M.y,qa[R+14]=M.z,qa[R+15]=1,N=Pa[z.a],G=Pa[z.b],I=Pa[z.c],M=Pa[z.d],ca[R]=N.x,ca[R+1]=N.y,ca[R+2]=N.z,ca[R+3]=1,ca[R+4]=G.x,ca[R+5]=G.y,ca[R+6]=G.z,ca[R+7]=1,ca[R+8]=I.x,ca[R+9]=I.y,ca[R+10]=I.z,ca[R+11]=1,ca[R+12]=M.x,ca[R+13]=M.y,ca[R+14]=M.z,ca[R+15]=1,R+=16;if(Ga&&y)C.length===4&&y===THREE.VertexColors?(z=C[0],N=C[1],G=C[2],M=C[3]):M=G=N=z=la,fa[oa]=z.r,fa[oa+1]=z.g,fa[oa+2]=z.b,fa[oa+3]=N.r,
|
|
|
|
+fa[oa+4]=N.g,fa[oa+5]=N.b,fa[oa+6]=G.r,fa[oa+7]=G.g,fa[oa+8]=G.b,fa[oa+9]=M.r,fa[oa+10]=M.g,fa[oa+11]=M.b,oa+=12;if(Ra&&ua.hasTangents)C=ra[0],la=ra[1],z=ra[2],ra=ra[3],da[Z]=C.x,da[Z+1]=C.y,da[Z+2]=C.z,da[Z+3]=C.w,da[Z+4]=la.x,da[Z+5]=la.y,da[Z+6]=la.z,da[Z+7]=la.w,da[Z+8]=z.x,da[Z+9]=z.y,da[Z+10]=z.z,da[Z+11]=z.w,da[Z+12]=ra.x,da[Z+13]=ra.y,da[Z+14]=ra.z,da[Z+15]=ra.w,Z+=16;if(Da&&ea)if(aa.length===4&&Fa)for(N=0;N<4;N++)W=aa[N],ta[V]=W.x,ta[V+1]=W.y,ta[V+2]=W.z,V+=3;else for(N=0;N<4;N++)ta[V]=W.x,
|
|
|
|
+ta[V+1]=W.y,ta[V+2]=W.z,V+=3;if(Ea&&J!==void 0&&U)for(N=0;N<4;N++)aa=J[N],ma[Y]=aa.u,ma[Y+1]=aa.v,Y+=2;if(Ea&&Q!==void 0&&U)for(N=0;N<4;N++)aa=Q[N],ja[va]=aa.u,ja[va+1]=aa.v,va+=2;Ia&&(Ba[Aa]=P,Ba[Aa+1]=P+1,Ba[Aa+2]=P+3,Ba[Aa+3]=P+1,Ba[Aa+4]=P+2,Ba[Aa+5]=P+3,Aa+=6,wa[$]=P,wa[$+1]=P+1,wa[$+2]=P,wa[$+3]=P+3,wa[$+4]=P+1,wa[$+5]=P+2,wa[$+6]=P+2,wa[$+7]=P+3,$+=8,P+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ia,v));if(ya){N=0;for(G=ya.length;N<G;N++)E=ya[N],E.__original.needsUpdate&&
|
|
|
|
+(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,v))}if(ab){N=0;for(G=Ja.length;N<G;N++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[N]),o.bufferData(o.ARRAY_BUFFER,sa[N],v)}Ga&&oa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,v));Da&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ta,v));Ra&&ua.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,da,
|
|
|
|
+v));Ea&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ma,v));Ea&&va>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,v));Ia&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Ba,v),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,wa,v));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,qa,v),o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
+p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ha,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ka,v));u&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,
|
|
|
|
+delete p.__skinIndexArray,delete p.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&D(k)}else if(A instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;A=o.DYNAMIC_DRAW;n=w=u=u=void 0;x=k.vertices;t=k.colors;U=x.length;p=t.length;y=k.__vertexArray;v=k.__colorArray;ea=k.__dirtyColors;if(k.__dirtyVertices){for(u=0;u<U;u++)w=x[u].position,n=u*3,y[n]=w.x,y[n+1]=
|
|
|
|
+w.y,y[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,A)}if(ea){for(u=0;u<p;u++)color=t[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,A)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(A instanceof THREE.Line){k=b(A,p);v=k.attributes&&B(k);if(l.__dirtyVertices||l.__dirtyColors||v){A=l;n=o.DYNAMIC_DRAW;t=Q=x=J=void 0;x=A.vertices;p=A.colors;U=x.length;v=p.length;y=A.__vertexArray;
|
|
|
|
+u=A.__colorArray;ea=A.__dirtyColors;w=A.__webglCustomAttributesList;L=ga=F=H=Q=J=void 0;if(A.__dirtyVertices){for(J=0;J<U;J++)Q=x[J].position,t=J*3,y[t]=Q.x,y[t+1]=Q.y,y[t+2]=Q.z;o.bindBuffer(o.ARRAY_BUFFER,A.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,n)}if(ea){for(x=0;x<v;x++)color=p[x],t=x*3,u[t]=color.r,u[t+1]=color.g,u[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,A.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,u,n)}if(w){J=0;for(Q=w.length;J<Q;J++)if(L=w[J],L.__original.needsUpdate&&(L.boundTo===
|
|
|
|
+void 0||L.boundTo==="vertices")){t=0;F=L.value.length;for(H=0;H<F;H++)L.size===1?L.array[t]=L.value[H]:(ga=L.value[H],L.size===2?(L.array[t]=ga.x,L.array[t+1]=ga.y):L.size===3?L.type==="c"?(L.array[t]=ga.r,L.array[t+1]=ga.g,L.array[t+2]=ga.b):(L.array[t]=ga.x,L.array[t+1]=ga.y,L.array[t+2]=ga.z):(L.array[t]=ga.x,L.array[t+1]=ga.y,L.array[t+2]=ga.z,L.array[t+3]=ga.w)),t+=L.size;o.bindBuffer(o.ARRAY_BUFFER,L.buffer);o.bufferData(o.ARRAY_BUFFER,L.array,n)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&
|
|
|
|
+D(k)}else if(A instanceof THREE.ParticleSystem)k=b(A,p),v=k.attributes&&B(k),(l.__dirtyVertices||l.__dirtyColors||A.sortParticles||v)&&e(l,o.DYNAMIC_DRAW,A),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&D(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ea}};
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
@@ -352,8 +352,8 @@ THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this
|
|
THREE.ColorUtils={adjustHSV:function(a,c,b,e){var l=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,l);l.h=THREE.Math.clamp(l.h+c,0,1);l.s=THREE.Math.clamp(l.s+b,0,1);l.v=THREE.Math.clamp(l.v+e,0,1);a.setHSV(l.h,l.s,l.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,l=a.b,f=Math.max(Math.max(b,e),l),h=Math.min(Math.min(b,e),l);if(h===f)h=b=0;else{var k=f-h,h=k/f,b=b===f?(e-l)/k:e===f?2+(l-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=f;return c}};
|
|
THREE.ColorUtils={adjustHSV:function(a,c,b,e){var l=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,l);l.h=THREE.Math.clamp(l.h+c,0,1);l.s=THREE.Math.clamp(l.s+b,0,1);l.v=THREE.Math.clamp(l.v+e,0,1);a.setHSV(l.h,l.s,l.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,l=a.b,f=Math.max(Math.max(b,e),l),h=Math.min(Math.min(b,e),l);if(h===f)h=b=0;else{var k=f-h,h=k/f,b=b===f?(e-l)/k:e===f?2+(l-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=f;return c}};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,k=f.vertices,n=a.faces,t=f.faces,u=a.faceVertexUvs[0],p=f.faceVertexUvs[0],x={},v=0;v<a.materials.length;v++)x[a.materials[v].id]=v;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var v=0,y=k.length;v<y;v++){var w=new THREE.Vertex(k[v].position.clone());b&&b.multiplyVector3(w.position);h.push(w)}v=
|
|
THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,k=f.vertices,n=a.faces,t=f.faces,u=a.faceVertexUvs[0],p=f.faceVertexUvs[0],x={},v=0;v<a.materials.length;v++)x[a.materials[v].id]=v;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var v=0,y=k.length;v<y;v++){var w=new THREE.Vertex(k[v].position.clone());b&&b.multiplyVector3(w.position);h.push(w)}v=
|
|
-0;for(y=t.length;v<y;v++){var h=t[v],z,B,C=h.vertexNormals,A=h.vertexColors;h instanceof THREE.Face3?z=new THREE.Face3(h.a+l,h.b+l,h.c+l):h instanceof THREE.Face4&&(z=new THREE.Face4(h.a+l,h.b+l,h.c+l,h.d+l));z.normal.copy(h.normal);e&&e.multiplyVector3(z.normal);k=0;for(w=C.length;k<w;k++)B=C[k].clone(),e&&e.multiplyVector3(B),z.vertexNormals.push(B);z.color.copy(h.color);k=0;for(w=A.length;k<w;k++)B=A[k],z.vertexColors.push(B.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
|
|
|
|
-w=x[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);z.materialIndex=w}z.centroid.copy(h.centroid);b&&b.multiplyVector3(z.centroid);n.push(z)}v=0;for(y=p.length;v<y;v++){b=p[v];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));u.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var h=new THREE.Vertex(e[a].position.clone());c.vertices.push(h)}a=0;
|
|
|
|
|
|
+0;for(y=t.length;v<y;v++){var h=t[v],A,z,C=h.vertexNormals,B=h.vertexColors;h instanceof THREE.Face3?A=new THREE.Face3(h.a+l,h.b+l,h.c+l):h instanceof THREE.Face4&&(A=new THREE.Face4(h.a+l,h.b+l,h.c+l,h.d+l));A.normal.copy(h.normal);e&&e.multiplyVector3(A.normal);k=0;for(w=C.length;k<w;k++)z=C[k].clone(),e&&e.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(h.color);k=0;for(w=B.length;k<w;k++)z=B[k],A.vertexColors.push(z.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
|
|
|
|
+w=x[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);A.materialIndex=w}A.centroid.copy(h.centroid);b&&b.multiplyVector3(A.centroid);n.push(A)}v=0;for(y=p.length;v<y;v++){b=p[v];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));u.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var h=new THREE.Vertex(e[a].position.clone());c.vertices.push(h)}a=0;
|
|
for(b=l.length;a<b;a++){var k=l[a],n,t,u=k.vertexNormals,p=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(h=u.length;e<h;e++)t=u[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(h=p.length;e<h;e++)t=p[e],n.vertexColors.push(t.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=f.length;a<b;a++){l=f[a];n=[];e=0;for(h=l.length;e<
|
|
for(b=l.length;a<b;a++){var k=l[a],n,t,u=k.vertexNormals,p=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(h=u.length;e<h;e++)t=u[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(h=p.length;e<h;e++)t=p[e],n.vertexColors.push(t.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=f.length;a<b;a++){l=f[a];n=[];e=0;for(h=l.length;e<
|
|
h;e++)n.push(new THREE.UV(l[e].u,l[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,l,f,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();l=THREE.GeometryUtils.random();e+l>1&&(e=1-e,l=1-l);f=1-e-l;h.copy(a);h.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);h.addSelf(k);k.copy(b);k.multiplyScalar(f);h.addSelf(k);return h},randomPointInFace:function(a,c,b){var e,l,f;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position,
|
|
h;e++)n.push(new THREE.UV(l[e].u,l[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,l,f,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();l=THREE.GeometryUtils.random();e+l>1&&(e=1-e,l=1-l);f=1-e-l;h.copy(a);h.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);h.addSelf(k);k.copy(b);k.multiplyScalar(f);h.addSelf(k);return h},randomPointInFace:function(a,c,b){var e,l,f;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position,
|
|
f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,f);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,h;b?a._area1&&a._area2?(b=a._area1,h=a._area2):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c),a._area1=b,a._area2=h):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c));return THREE.GeometryUtils.random()*(b+
|
|
f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,f);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,h;b?a._area1&&a._area2?(b=a._area1,h=a._area2):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c),a._area1=b,a._area2=h):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c));return THREE.GeometryUtils.random()*(b+
|
|
@@ -361,9 +361,9 @@ h)<b?THREE.GeometryUtils.randomPointInTriangle(e,l,c):THREE.GeometryUtils.random
|
|
THREE.Face4)u=h[e.a].position,p=h[e.b].position,x=h[e.c].position,v=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,p,v),e._area2=THREE.GeometryUtils.triangleArea(p,x,v),e._area=e._area1+e._area2;n+=e._area;t[l]=n}e=[];h={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(f[k],a,!0),h[k]?h[k]+=1:h[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
|
|
THREE.Face4)u=h[e.a].position,p=h[e.b].position,x=h[e.c].position,v=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,p,v),e._area2=THREE.GeometryUtils.triangleArea(p,x,v),e._area=e._area1+e._area2;n+=e._area;t[l]=n}e=[];h={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(f[k],a,!0),h[k]?h[k]+=1:h[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,l=new THREE.Texture(e,c);e.onload=function(){l.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return l},loadTextureCube:function(a,c,b){var e,l=[],f=new THREE.Texture(l,c),c=l.loadCount=0;for(e=a.length;c<e;++c)l[c]=new Image,l[c].onload=function(){l.loadCount+=1;if(l.loadCount===6)f.needsUpdate=!0;b&&b(this)},l[c].crossOrigin="",l[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,l=new THREE.Texture(e,c);e.onload=function(){l.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return l},loadTextureCube:function(a,c,b){var e,l=[],f=new THREE.Texture(l,c),c=l.loadCount=0;for(e=a.length;c<e;++c)l[c]=new Image,l[c].onload=function(){l.loadCount+=1;if(l.loadCount===6)f.needsUpdate=!0;b&&b(this)},l[c].crossOrigin="",l[c].src=a[c];return f},getNormalMap:function(a,c){var b=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]};c|=1;var e=a.width,l=a.height,f=document.createElement("canvas");f.width=e;f.height=l;var h=f.getContext("2d");h.drawImage(a,0,0);for(var k=h.getImageData(0,0,e,l).data,n=h.createImageData(e,l),t=n.data,u=0;u<e;u++)for(var p=1;p<l;p++){var x=p-1<0?l-1:p-1,v=(p+1)%l,y=u-1<0?e-1:u-1,w=(u+1)%e,z=[],B=[0,0,k[(p*e+u)*4]/255*c];z.push([-1,0,k[(p*e+y)*4]/255*c]);z.push([-1,-1,k[(x*e+y)*4]/255*c]);z.push([0,-1,k[(x*e+u)*4]/255*c]);z.push([1,-1,k[(x*e+w)*4]/255*c]);
|
|
|
|
-z.push([1,0,k[(p*e+w)*4]/255*c]);z.push([1,1,k[(v*e+w)*4]/255*c]);z.push([0,1,k[(v*e+u)*4]/255*c]);z.push([-1,1,k[(v*e+y)*4]/255*c]);x=[];y=z.length;for(v=0;v<y;v++){var w=z[v],C=z[(v+1)%y],w=[w[0]-B[0],w[1]-B[1],w[2]-B[2]],C=[C[0]-B[0],C[1]-B[1],C[2]-B[2]];x.push(b([w[1]*C[2]-w[2]*C[1],w[2]*C[0]-w[0]*C[2],w[0]*C[1]-w[1]*C[0]]))}z=[0,0,0];for(v=0;v<x.length;v++)z[0]+=x[v][0],z[1]+=x[v][1],z[2]+=x[v][2];z[0]/=x.length;z[1]/=x.length;z[2]/=x.length;B=(p*e+u)*4;t[B]=(z[0]+1)/2*255|0;t[B+1]=(z[1]+0.5)*
|
|
|
|
-255|0;t[B+2]=z[2]*255|0;t[B+3]=255}h.putImageData(n,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var f=new THREE.Mesh(a,c[b]);l.add(f)}return l}};
|
|
|
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,l=a.height,f=document.createElement("canvas");f.width=e;f.height=l;var h=f.getContext("2d");h.drawImage(a,0,0);for(var k=h.getImageData(0,0,e,l).data,n=h.createImageData(e,l),t=n.data,u=0;u<e;u++)for(var p=1;p<l;p++){var x=p-1<0?l-1:p-1,v=(p+1)%l,y=u-1<0?e-1:u-1,w=(u+1)%e,A=[],z=[0,0,k[(p*e+u)*4]/255*c];A.push([-1,0,k[(p*e+y)*4]/255*c]);A.push([-1,-1,k[(x*e+y)*4]/255*c]);A.push([0,-1,k[(x*e+u)*4]/255*c]);A.push([1,-1,k[(x*e+w)*4]/255*c]);
|
|
|
|
+A.push([1,0,k[(p*e+w)*4]/255*c]);A.push([1,1,k[(v*e+w)*4]/255*c]);A.push([0,1,k[(v*e+u)*4]/255*c]);A.push([-1,1,k[(v*e+y)*4]/255*c]);x=[];y=A.length;for(v=0;v<y;v++){var w=A[v],C=A[(v+1)%y],w=[w[0]-z[0],w[1]-z[1],w[2]-z[2]],C=[C[0]-z[0],C[1]-z[1],C[2]-z[2]];x.push(b([w[1]*C[2]-w[2]*C[1],w[2]*C[0]-w[0]*C[2],w[0]*C[1]-w[1]*C[0]]))}A=[0,0,0];for(v=0;v<x.length;v++)A[0]+=x[v][0],A[1]+=x[v][1],A[2]+=x[v][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;z=(p*e+u)*4;t[z]=(A[0]+1)/2*255|0;t[z+1]=(A[1]+0.5)*
|
|
|
|
+255|0;t[z+2]=A[2]*255|0;t[z+3]=255}h.putImageData(n,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var f=new THREE.Mesh(a,c[b]);l.add(f)}return l}};
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
@@ -404,7 +404,7 @@ THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arg
|
|
THREE.Path.prototype.arc=function(a,c,b,e,l,f){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,l,f));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
THREE.Path.prototype.arc=function(a,c,b,e,l,f){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,l,f));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,f,h,k,n,t,u,p,x,v,y,w;e=0;for(l=this.actions.length;e<l;e++)switch(f=this.actions[e],h=f.action,f=f.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=f[2];n=f[3];p=f[0];x=f[1];b.length>0?(h=b[b.length-1],v=h.x,y=h.y):(h=this.actions[e-1].args,v=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b2(w,v,p,k),w=THREE.Shape.Utils.b2(w,y,x,
|
|
THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,f,h,k,n,t,u,p,x,v,y,w;e=0;for(l=this.actions.length;e<l;e++)switch(f=this.actions[e],h=f.action,f=f.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=f[2];n=f[3];p=f[0];x=f[1];b.length>0?(h=b[b.length-1],v=h.x,y=h.y):(h=this.actions[e-1].args,v=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b2(w,v,p,k),w=THREE.Shape.Utils.b2(w,y,x,
|
|
n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];p=f[0];x=f[1];t=f[2];u=f[3];b.length>0?(h=b[b.length-1],v=h.x,y=h.y):(h=this.actions[e-1].args,v=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b3(w,v,p,t,k),w=THREE.Shape.Utils.b3(w,y,x,u,n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
|
|
n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];p=f[0];x=f[1];t=f[2];u=f[3];b.length>0?(h=b[b.length-1],v=h.x,y=h.y):(h=this.actions[e-1].args,v=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b3(w,v,p,t,k),w=THREE.Shape.Utils.b3(w,y,x,u,n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
|
|
-for(h=1;h<=w;h++)b.push(f.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];p=f[3];w=f[4];x=!!f[5];u=h[h.length-2];v=h[h.length-1];h.length==0&&(u=v=0);y=w-p;var z=a*2;for(h=1;h<=z;h++)w=h/z,x||(w=1-w),w=p+w*y,f=u+k+t*Math.cos(w),w=v+n+t*Math.sin(w),b.push(new THREE.Vector2(f,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
|
|
|
+for(h=1;h<=w;h++)b.push(f.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];p=f[3];w=f[4];x=!!f[5];u=h[h.length-2];v=h[h.length-1];h.length==0&&(u=v=0);y=w-p;var A=a*2;for(h=1;h<=A;h++)w=h/A,x||(w=1-w),w=p+w*y,f=u+k+t*Math.cos(w),w=v+n+t*Math.sin(w),b.push(new THREE.Vector2(f,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,t,u,p;k=0;for(n=h.length;k<n;k++)t=h[k],u=t.x,p=t.y,t.x=a*u+c*p+b,t.y=e*p+l*u+f;return h};
|
|
THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,t,u,p;k=0;for(n=h.length;k<n;k++)t=h[k],u=t.x,p=t.y,t.x=a*u+c*p+b,t.y=e*p+l*u+f;return h};
|
|
THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,l,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],l=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,l);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,l,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],l=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,l);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
this.getPoints();a=0;for(b=e.length;a<b;a++)l=e[a],c.beginPath(),c.arc(l.x,l.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
this.getPoints();a=0;for(b=e.length;a<b;a++)l=e[a],c.beginPath(),c.arc(l.x,l.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
@@ -412,8 +412,8 @@ THREE.Path.prototype.toShapes=function(){var a,c,b,e,l=[],f=new THREE.Path;a=0;f
|
|
e.curves):h.holes.push(e);f.push(h)}else{h=new THREE.Shape;a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h.actions=e.actions,h.curves=e.curves,f.push(h),h=new THREE.Shape):h.holes.push(e)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
e.curves):h.holes.push(e);f.push(h)}else{h=new THREE.Shape;a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h.actions=e.actions,h.curves=e.curves,f.push(h),h=new THREE.Shape):h.holes.push(e)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,f,h,k,n,t,u,p,x,v,y=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);f=Number.POSITIVE_INFINITY;for(l=0;l<t.length;l++){x=t[l];v=[];for(p=0;p<b.length;p++)u=b[p],u=x.distanceToSquared(u),v.push(u),u<f&&(f=u,h=l,k=p)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var w=[t[h],b[k],b[l]];p=THREE.FontUtils.Triangulate.area(w);var z=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(z);v=k;u=h;k+=1;h+=-1;k<
|
|
|
|
-0&&(k+=b.length);k%=b.length;h<0&&(h+=t.length);h%=t.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;w=[t[h],b[k],b[l]];w=THREE.FontUtils.Triangulate.area(w);z=[t[h],t[f],b[k]];z=THREE.FontUtils.Triangulate.area(z);p+x>w+z&&(k=v,h=u,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=t.length),h%=t.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:t.length-1);p=b.slice(0,k);x=b.slice(k);v=t.slice(h);u=t.slice(0,h);f=[t[h],t[f],b[k]];y.push([t[h],b[k],b[l]]);y.push(f);b=p.concat(v).concat(u).concat(x)}return{shape:b,
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,f,h,k,n,t,u,p,x,v,y=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);f=Number.POSITIVE_INFINITY;for(l=0;l<t.length;l++){x=t[l];v=[];for(p=0;p<b.length;p++)u=b[p],u=x.distanceToSquared(u),v.push(u),u<f&&(f=u,h=l,k=p)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var w=[t[h],b[k],b[l]];p=THREE.FontUtils.Triangulate.area(w);var A=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(A);v=k;u=h;k+=1;h+=-1;k<
|
|
|
|
+0&&(k+=b.length);k%=b.length;h<0&&(h+=t.length);h%=t.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;w=[t[h],b[k],b[l]];w=THREE.FontUtils.Triangulate.area(w);A=[t[h],t[f],b[k]];A=THREE.FontUtils.Triangulate.area(A);p+x>w+A&&(k=v,h=u,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=t.length),h%=t.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:t.length-1);p=b.slice(0,k);x=b.slice(k);v=t.slice(h);u=t.slice(0,h);f=[t[h],t[f],b[k]];y.push([t[h],b[k],b[l]]);y.push(f);b=p.concat(v).concat(u).concat(x)}return{shape:b,
|
|
isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,t={};f=0;for(h=e.length;f<h;f++)n=e[f].x+":"+e[f].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=f;f=0;for(h=b.length;f<h;f++){k=b[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}f=0;for(h=l.length;f<h;f++){k=l[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
|
|
isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,t={};f=0;for(h=e.length;f<h;f++)n=e[f].x+":"+e[f].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=f;f=0;for(h=b.length;f<h;f++){k=b[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}f=0;for(h=l.length;f<h;f++){k=l[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,l){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,l){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
this.b3p3(a,l)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",l=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=l;THREE.FontUtils.style=f};
|
|
this.b3p3(a,l)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",l=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=l;THREE.FontUtils.style=f};
|
|
@@ -454,7 +454,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,l=b.getControlPointsArray(),k=b.getLength(),z=l.length,B=0;h=z-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<z-1;h++)B=e*k.chunks[h]/k.total,b.keys[h]={time:B,pos:l[h]};f.hierarchy[0]=
|
|
|
|
|
|
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,l=b.getControlPointsArray(),k=b.getLength(),A=l.length,z=0;h=A-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<A-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:l[h]};f.hierarchy[0]=
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%h;this.phi=a>=0?a:a+h;c=this.verticalAngleMap.srcRange;
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%h;this.phi=a>=0?a:a+h;c=this.verticalAngleMap.srcRange;
|
|
@@ -487,22 +487,22 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=x:p.addSelf(a.
|
|
b.panCamera();b.object.position.add(b.target,h);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=u=b.getMouseOnScreen(a.clientX,a.clientY),p=x=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),f!==e.NONE&&(f===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?u=b.getMouseOnScreen(a.clientX,
|
|
b.panCamera();b.object.position.add(b.target,h);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=u=b.getMouseOnScreen(a.clientX,a.clientY),p=x=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),f!==e.NONE&&(f===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?u=b.getMouseOnScreen(a.clientX,
|
|
a.clientY):f===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===e.NONE))f=a.button,f===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?t=u=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
a.clientY):f===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===e.NONE))f=a.button,f===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?t=u=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
f=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===e.NONE){if(a.keyCode===b.keys[e.ROTATE])f=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)f=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)f=e.PAN;f!==e.NONE&&(l=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==e.NONE)f=e.NONE},!1)};
|
|
f=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===e.NONE){if(a.keyCode===b.keys[e.ROTATE])f=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)f=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)f=e.PAN;f!==e.NONE&&(l=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==e.NONE)f=e.NONE},!1)};
|
|
-THREE.CubeGeometry=function(a,c,b,e,l,f,h,k){function n(a,b,c,h,k,n,p,u){var v,w,x=e||1,y=l||1,z=k/2,o=n/2,B=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=f||1;var A=x+1,C=y+1;k/=x;var S=n/y;for(w=0;w<C;w++)for(n=0;n<A;n++){var Y=new THREE.Vector3;Y[a]=(n*k-z)*c;Y[b]=(w*S-o)*h;Y[v]=p;t.vertices.push(new THREE.Vertex(Y))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
|
|
|
|
-A*w+B,n+A*(w+1)+B,n+1+A*(w+1)+B,n+1+A*w+B,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,u=a/2,p=c/2,x=b/2,v,y,w,z,B,C;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(v=0;v<6;v++)this.materials.push(h)}v=0;z=1;y=2;B=3;w=4;C=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var A in k)this.sides[A]!=
|
|
|
|
-void 0&&(this.sides[A]=k[A]);this.sides.px&&n("z","y",-1,-1,b,c,u,v);this.sides.nx&&n("z","y",1,-1,b,c,-u,z);this.sides.py&&n("x","z",1,1,a,b,p,y);this.sides.ny&&n("x","z",1,-1,a,b,-p,B);this.sides.pz&&n("x","y",1,-1,a,c,x,w);this.sides.nz&&n("x","y",-1,-1,a,c,-x,C);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
|
|
+THREE.CubeGeometry=function(a,c,b,e,l,f,h,k){function n(a,b,c,h,k,n,p,u){var v,w,x=e||1,y=l||1,z=k/2,o=n/2,A=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=f||1;var B=x+1,C=y+1;k/=x;var Q=n/y;for(w=0;w<C;w++)for(n=0;n<B;n++){var $=new THREE.Vector3;$[a]=(n*k-z)*c;$[b]=(w*Q-o)*h;$[v]=p;t.vertices.push(new THREE.Vertex($))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
|
|
|
|
+B*w+A,n+B*(w+1)+A,n+1+B*(w+1)+A,n+1+B*w+A,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,u=a/2,p=c/2,x=b/2,v,y,w,A,z,C;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(v=0;v<6;v++)this.materials.push(h)}v=0;A=1;y=2;z=3;w=4;C=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var B in k)this.sides[B]!=
|
|
|
|
+void 0&&(this.sides[B]=k[B]);this.sides.px&&n("z","y",-1,-1,b,c,u,v);this.sides.nx&&n("z","y",1,-1,b,c,-u,A);this.sides.py&&n("x","z",1,1,a,b,p,y);this.sides.ny&&n("x","z",1,-1,a,b,-p,z);this.sides.pz&&n("x","y",1,-1,a,c,x,w);this.sides.nz&&n("x","y",-1,-1,a,c,-x,C);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
THREE.CylinderGeometry=function(a,c,b,e,l,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,h=b/2,e=e||8,l=l||1,k,n,t=[],u=[];for(n=0;n<=l;n++){var p=[],x=[],v=n/l,y=v*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(w*Math.PI*2),-v*b+h,y*Math.cos(w*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(w,v))}t.push(p);u.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],p=t[n+1][k],x=t[n+1][k+1],v=t[n][k+1],y=
|
|
THREE.CylinderGeometry=function(a,c,b,e,l,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,h=b/2,e=e||8,l=l||1,k,n,t=[],u=[];for(n=0;n<=l;n++){var p=[],x=[],v=n/l,y=v*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(w*Math.PI*2),-v*b+h,y*Math.cos(w*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(w,v))}t.push(p);u.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],p=t[n+1][k],x=t[n+1][k+1],v=t[n][k+1],y=
|
|
-this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[p].position.clone().setY(0).normalize(),z=this.vertices[x].position.clone().setY(0).normalize(),B=this.vertices[v].position.clone().setY(0).normalize(),C=u[n][k].clone(),A=u[n+1][k].clone(),D=u[n+1][k+1].clone(),K=u[n][k+1].clone();this.faces.push(new THREE.Face4(b,p,x,v,[y,w,z,B]));this.faceVertexUvs[0].push([C,A,D,K])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k<e;k++)b=t[0][k],p=t[0][k+
|
|
|
|
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),C=u[0][k].clone(),A=u[0][k+1].clone(),D=new THREE.UV(A.u,0),this.faces.push(new THREE.Face3(b,p,x,[y,w,z])),this.faceVertexUvs[0].push([C,A,D])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;k<e;k++)b=t[n][k+1],p=t[n][k],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),C=u[n][k+1].clone(),A=u[n][k].clone(),
|
|
|
|
-D=new THREE.UV(A.u,1),this.faces.push(new THREE.Face3(b,p,x,[y,w,z])),this.faceVertexUvs[0].push([C,A,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[p].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),z=this.vertices[v].position.clone().setY(0).normalize(),C=u[n][k].clone(),B=u[n+1][k].clone(),D=u[n+1][k+1].clone(),K=u[n][k+1].clone();this.faces.push(new THREE.Face4(b,p,x,v,[y,w,A,z]));this.faceVertexUvs[0].push([C,B,D,K])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k<e;k++)b=t[0][k],p=t[0][k+
|
|
|
|
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),C=u[0][k].clone(),B=u[0][k+1].clone(),D=new THREE.UV(B.u,0),this.faces.push(new THREE.Face3(b,p,x,[y,w,A])),this.faceVertexUvs[0].push([C,B,D])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;k<e;k++)b=t[n][k+1],p=t[n][k],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),C=u[n][k+1].clone(),B=u[n][k].clone(),
|
|
|
|
+D=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(b,p,x,[y,w,A])),this.faceVertexUvs[0].push([C,B,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,l;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)l=a[b],this.addShape(l,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,l;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)l=a[b],this.addShape(l,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
-l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(L=a.length;--L>=0;){la=L;aa=L-1;aa<0&&(aa=a.length-
|
|
|
|
-1);for(var b=0,c=v+u*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=ma+la+e,l=ma+la+f,t=h,e=ma+aa+e,f=ma+aa+f,p=l;t+=N;e+=N;f+=N;p+=N;H.faces.push(new THREE.Face4(t,e,f,p,null,null,D));D&&(t=b/c,e=(b+1)/c,f=k+n*2,h=(H.vertices[h].position.z+n)/f,l=(H.vertices[l].position.z+n)/f,H.faceVertexUvs[0].push([new THREE.UV(h,t),new THREE.UV(l,t),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function f(a,b,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=N;b+=N;c+=N;H.faces.push(new THREE.Face3(a,
|
|
|
|
-b,c,null,null,A));if(A){var e=K.maxY,f=K.maxX,h=H.vertices[b].position.x,b=H.vertices[b].position.y,k=H.vertices[c].position.x,c=H.vertices[c].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,u=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,y=c.bendPath,w=c.extrudePath,z,B=!1,C=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,A=c.material,D=c.extrudeMaterial,K=this.shapebb;if(w)z=w.getPoints(x),v=z.length,B=!0,p=!1;p||(t=n=u=0);var P,F,Q,H=this,N=this.vertices.length;y&&a.addWrapPath(y);x=C?a.extractAllSpacedPoints(x):a.extractAllPoints(x);y=x.shape;x=x.holes;if(w=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();F=0;for(Q=x.length;F<Q;F++)P=x[F],THREE.Shape.Utils.isClockWise(P)&&
|
|
|
|
-(x[F]=P.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(y,x);C=y;F=0;for(Q=x.length;F<Q;F++)P=x[F],y=y.concat(P);var L,G,W,ca,X,U,o=y.length,$=w.length,ha=[];L=0;G=C.length;la=G-1;for(aa=L+1;L<G;L++,la++,aa++)la===G&&(la=0),aa===G&&(aa=0),ha[L]=e(C[L],C[la],C[aa]);var M=[],S,Y=ha.concat();F=0;for(Q=x.length;F<Q;F++){P=x[F];S=[];L=0;G=P.length;la=G-1;for(aa=L+1;L<G;L++,la++,aa++)la===G&&(la=0),aa===G&&(aa=0),S[L]=e(P[L],P[la],P[aa]);M.push(S);Y=Y.concat(S)}for(W=0;W<u;W++){ca=W/u;X=n*(1-ca);ca=
|
|
|
|
-t*Math.sin(ca*Math.PI/2);L=0;for(G=C.length;L<G;L++)U=b(C[L],ha[L],ca),f(U.x,U.y,-X);F=0;for(Q=x.length;F<Q;F++){P=x[F];S=M[F];L=0;for(G=P.length;L<G;L++)U=b(P[L],S[L],ca),f(U.x,U.y,-X)}}ca=t;for(L=0;L<o;L++)U=p?b(y[L],Y[L],ca):y[L],B?f(U.x,U.y+z[0].y,z[0].x):f(U.x,U.y,0);for(W=1;W<=v;W++)for(L=0;L<o;L++)U=p?b(y[L],Y[L],ca):y[L],B?f(U.x,U.y+z[W-1].y,z[W-1].x):f(U.x,U.y,k/v*W);for(W=u-1;W>=0;W--){ca=W/u;X=n*(1-ca);ca=t*Math.sin(ca*Math.PI/2);L=0;for(G=C.length;L<G;L++)U=b(C[L],ha[L],ca),f(U.x,U.y,
|
|
|
|
-k+X);F=0;for(Q=x.length;F<Q;F++){P=x[F];S=M[F];L=0;for(G=P.length;L<G;L++)U=b(P[L],S[L],ca),B?f(U.x,U.y+z[v-1].y,z[v-1].x+X):f(U.x,U.y,k+X)}}if(p){p=o*0;for(L=0;L<$;L++)t=w[L],h(t[2]+p,t[1]+p,t[0]+p);p=o*(v+u*2);for(L=0;L<$;L++)t=w[L],h(t[0]+p,t[1]+p,t[2]+p)}else{for(L=0;L<$;L++)t=w[L],h(t[2],t[1],t[0]);for(L=0;L<$;L++)t=w[L],h(t[0]+o*v,t[1]+o*v,t[2]+o*v)}var la,aa,ma=0;l(C);ma+=C.length;F=0;for(Q=x.length;F<Q;F++)P=x[F],l(P),ma+=P.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
|
|
|
+l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(J=a.length;--J>=0;){na=J;fa=J-1;fa<0&&(fa=a.length-
|
|
|
|
+1);for(var b=0,c=v+u*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=sa+na+e,l=sa+na+f,p=h,e=sa+fa+e,f=sa+fa+f,t=l;p+=M;e+=M;f+=M;t+=M;H.faces.push(new THREE.Face4(p,e,f,t,null,null,D));D&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(H.vertices[h].position.z+n)/f,l=(H.vertices[l].position.z+n)/f,H.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(l,p),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function f(a,b,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=M;b+=M;c+=M;H.faces.push(new THREE.Face3(a,
|
|
|
|
+b,c,null,null,B));if(B){var e=K.maxY,f=K.maxX,h=H.vertices[b].position.x,b=H.vertices[b].position.y,k=H.vertices[c].position.x,c=H.vertices[c].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,u=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,y=c.bendPath,w=c.extrudePath,A,z=!1,C=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,B=c.material,D=c.extrudeMaterial,K=this.shapebb;if(w)A=w.getPoints(x),v=A.length,z=!0,p=!1;p||(t=n=u=0);var O,F,P,H=this,M=this.vertices.length;y&&a.addWrapPath(y);x=C?a.extractAllSpacedPoints(x):a.extractAllPoints(x);y=x.shape;x=x.holes;if(w=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();F=0;for(P=x.length;F<P;F++)O=x[F],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
|
+(x[F]=O.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(y,x);C=y;F=0;for(P=x.length;F<P;F++)O=x[F],y=y.concat(O);var J,G,X,ca,T,S,o=y.length,Y=w.length,ha=[];J=0;G=C.length;na=G-1;for(fa=J+1;J<G;J++,na++,fa++)na===G&&(na=0),fa===G&&(fa=0),ha[J]=e(C[J],C[na],C[fa]);var L=[],Q,$=ha.concat();F=0;for(P=x.length;F<P;F++){O=x[F];Q=[];J=0;G=O.length;na=G-1;for(fa=J+1;J<G;J++,na++,fa++)na===G&&(na=0),fa===G&&(fa=0),Q[J]=e(O[J],O[na],O[fa]);L.push(Q);$=$.concat(Q)}for(X=0;X<u;X++){ca=X/u;T=n*(1-ca);ca=
|
|
|
|
+t*Math.sin(ca*Math.PI/2);J=0;for(G=C.length;J<G;J++)S=b(C[J],ha[J],ca),f(S.x,S.y,-T);F=0;for(P=x.length;F<P;F++){O=x[F];Q=L[F];J=0;for(G=O.length;J<G;J++)S=b(O[J],Q[J],ca),f(S.x,S.y,-T)}}ca=t;for(J=0;J<o;J++)S=p?b(y[J],$[J],ca):y[J],z?f(S.x,S.y+A[0].y,A[0].x):f(S.x,S.y,0);for(X=1;X<=v;X++)for(J=0;J<o;J++)S=p?b(y[J],$[J],ca):y[J],z?f(S.x,S.y+A[X-1].y,A[X-1].x):f(S.x,S.y,k/v*X);for(X=u-1;X>=0;X--){ca=X/u;T=n*(1-ca);ca=t*Math.sin(ca*Math.PI/2);J=0;for(G=C.length;J<G;J++)S=b(C[J],ha[J],ca),f(S.x,S.y,
|
|
|
|
+k+T);F=0;for(P=x.length;F<P;F++){O=x[F];Q=L[F];J=0;for(G=O.length;J<G;J++)S=b(O[J],Q[J],ca),z?f(S.x,S.y+A[v-1].y,A[v-1].x+T):f(S.x,S.y,k+T)}}if(p){p=o*0;for(J=0;J<Y;J++)t=w[J],h(t[2]+p,t[1]+p,t[0]+p);p=o*(v+u*2);for(J=0;J<Y;J++)t=w[J],h(t[0]+p,t[1]+p,t[2]+p)}else{for(J=0;J<Y;J++)t=w[J],h(t[2],t[1],t[0]);for(J=0;J<Y;J++)t=w[J],h(t[0]+o*v,t[1]+o*v,t[2]+o*v)}var na,fa,sa=0;l(C);sa+=C.length;F=0;for(P=x.length;F<P;F++)O=x[F],l(O),sa+=O.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,f=l.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var l=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,f=l.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var l=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var h=0;h<this.subdivisions;h++){var a=new THREE.Geometry,k;for(k in f.faces){var n=e(f.faces[k].a,f.faces[k].b),t=e(f.faces[k].b,f.faces[k].c),u=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,u,a);b(f.faces[k].b,t,
|
|
-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var h=0;h<this.subdivisions;h++){var a=new THREE.Geometry,k;for(k in f.faces){var n=e(f.faces[k].a,f.faces[k].b),t=e(f.faces[k].b,f.faces[k].c),u=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,u,a);b(f.faces[k].b,t,
|
|
@@ -516,17 +516,17 @@ h.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),h.faceVertexUvs[0].push
|
|
THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,f=a/2,h=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var t=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(l*t-h),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,f=a/2,h=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var t=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(l*t-h),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),t=[],u=0;for(e=0;e<f;e++){var p=2*e/f,x=n*Math.sin(p*l),p=n*Math.cos(p*l);(b==0||b==h)&&e>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,x)))-1);t.push(u)}c.push(t)}for(var v,y,w,l=c.length,b=0;b<l;b++)if(f=c[b].length,b>0)for(e=0;e<f;e++){t=e==f-1;h=c[b][t?0:e+1];k=c[b][t?f-1:e];n=c[b-1][t?
|
|
THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),t=[],u=0;for(e=0;e<f;e++){var p=2*e/f,x=n*Math.sin(p*l),p=n*Math.cos(p*l);(b==0||b==h)&&e>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,x)))-1);t.push(u)}c.push(t)}for(var v,y,w,l=c.length,b=0;b<l;b++)if(f=c[b].length,b>0)for(e=0;e<f;e++){t=e==f-1;h=c[b][t?0:e+1];k=c[b][t?f-1:e];n=c[b-1][t?
|
|
-f-1:e];t=c[b-1][t?0:e+1];x=b/(l-1);v=(b-1)/(l-1);y=(e+1)/f;var p=e/f,u=new THREE.UV(1-y,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,v),z=new THREE.UV(1-y,v);b<c.length-1&&(v=this.vertices[h].position.clone(),y=this.vertices[k].position.clone(),w=this.vertices[n].position.clone(),v.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([u,x,p]));b>1&&(v=
|
|
|
|
-this.vertices[h].position.clone(),y=this.vertices[n].position.clone(),w=this.vertices[t].position.clone(),v.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([u,p,z]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+f-1:e];t=c[b-1][t?0:e+1];x=b/(l-1);v=(b-1)/(l-1);y=(e+1)/f;var p=e/f,u=new THREE.UV(1-y,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,v),A=new THREE.UV(1-y,v);b<c.length-1&&(v=this.vertices[h].position.clone(),y=this.vertices[k].position.clone(),w=this.vertices[n].position.clone(),v.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([u,x,p]));b>1&&(v=
|
|
|
|
+this.vertices[h].position.clone(),y=this.vertices[n].position.clone(),w=this.vertices[t].position.clone(),v.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([u,p,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
|
|
-this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),f=l.length,h=[],a=0;a<f;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;h.push(k.path)}return{paths:h,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var f=[],h,k,n,t,u,p,x,v,y,w,z=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,
|
|
|
|
-t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,t));l.lineTo(k,t);break;case "q":k=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;v=c[a++]*b;l.quadraticCurveTo(x,v,k,t);if(h=f[f.length-1]){u=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var B=h/divisions,C=THREE.Shape.Utils.b2(B,u,x,k),B=THREE.Shape.Utils.b2(B,p,v,t);f.push(new THREE.Vector2(C,B))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,v=c[a++]*-b,y=c[a++]*b+e,w=c[a++]*-b,l.bezierCurveTo(k,t,
|
|
|
|
-x,v,y,w),h=f[f.length-1]){u=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)B=h/divisions,C=THREE.Shape.Utils.b3(B,u,x,y,k),B=THREE.Shape.Utils.b3(B,p,v,w,t),f.push(new THREE.Vector2(C,B))}}}return{offset:z.ha*b,points:f,path:l}}}};
|
|
|
|
-(function(a){var c=function(a){for(var c=a.length,l=0,f=c-1,h=0;h<c;f=h++)l+=a[f].x*a[h].y-a[h].x*a[f].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var f=[],h=[],k=[],n,t,u;if(c(a)>0)for(t=0;t<l;t++)h[t]=t;else for(t=0;t<l;t++)h[t]=l-1-t;var p=2*l;for(t=l-1;l>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=t;l<=n&&(n=0);t=n+1;l<=t&&(t=0);u=t+1;l<=u&&(u=0);var x;a:{x=a;var v=n,y=t,w=u,z=l,B=h,C=void 0,A=void 0,D=void 0,
|
|
|
|
-K=void 0,P=void 0,F=void 0,Q=void 0,H=void 0,N=void 0,A=x[B[v]].x,D=x[B[v]].y,K=x[B[y]].x,P=x[B[y]].y,F=x[B[w]].x,Q=x[B[w]].y;if(1.0E-10>(K-A)*(Q-D)-(P-D)*(F-A))x=!1;else{for(C=0;C<z;C++)if(!(C==v||C==y||C==w)){var H=x[B[C]].x,N=x[B[C]].y,L=void 0,G=void 0,W=void 0,ca=void 0,X=void 0,U=void 0,o=void 0,$=void 0,ha=void 0,M=void 0,S=void 0,Y=void 0,L=W=X=void 0,L=F-K,G=Q-P,W=A-F,ca=D-Q,X=K-A,U=P-D,o=H-A,$=N-D,ha=H-K,M=N-P,S=H-F,Y=N-Q,L=L*M-G*ha,X=X*$-U*o,W=W*Y-ca*S;if(L>=0&&W>=0&&X>=0){x=!1;break a}}x=
|
|
|
|
|
|
+this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),f=l.length,h=[],a=0;a<f;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;h.push(k.path)}return{paths:h,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var f=[],h,k,n,t,u,p,x,v,y,w,A=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,
|
|
|
|
+t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,t));l.lineTo(k,t);break;case "q":k=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;v=c[a++]*b;l.quadraticCurveTo(x,v,k,t);if(h=f[f.length-1]){u=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var z=h/divisions,C=THREE.Shape.Utils.b2(z,u,x,k),z=THREE.Shape.Utils.b2(z,p,v,t);f.push(new THREE.Vector2(C,z))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,v=c[a++]*-b,y=c[a++]*b+e,w=c[a++]*-b,l.bezierCurveTo(k,t,
|
|
|
|
+x,v,y,w),h=f[f.length-1]){u=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)z=h/divisions,C=THREE.Shape.Utils.b3(z,u,x,y,k),z=THREE.Shape.Utils.b3(z,p,v,w,t),f.push(new THREE.Vector2(C,z))}}}return{offset:A.ha*b,points:f,path:l}}}};
|
|
|
|
+(function(a){var c=function(a){for(var c=a.length,l=0,f=c-1,h=0;h<c;f=h++)l+=a[f].x*a[h].y-a[h].x*a[f].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var f=[],h=[],k=[],n,t,u;if(c(a)>0)for(t=0;t<l;t++)h[t]=t;else for(t=0;t<l;t++)h[t]=l-1-t;var p=2*l;for(t=l-1;l>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=t;l<=n&&(n=0);t=n+1;l<=t&&(t=0);u=t+1;l<=u&&(u=0);var x;a:{x=a;var v=n,y=t,w=u,A=l,z=h,C=void 0,B=void 0,D=void 0,
|
|
|
|
+K=void 0,O=void 0,F=void 0,P=void 0,H=void 0,M=void 0,B=x[z[v]].x,D=x[z[v]].y,K=x[z[y]].x,O=x[z[y]].y,F=x[z[w]].x,P=x[z[w]].y;if(1.0E-10>(K-B)*(P-D)-(O-D)*(F-B))x=!1;else{for(C=0;C<A;C++)if(!(C==v||C==y||C==w)){var H=x[z[C]].x,M=x[z[C]].y,J=void 0,G=void 0,X=void 0,ca=void 0,T=void 0,S=void 0,o=void 0,Y=void 0,ha=void 0,L=void 0,Q=void 0,$=void 0,J=X=T=void 0,J=F-K,G=P-O,X=B-F,ca=D-P,T=K-B,S=O-D,o=H-B,Y=M-D,ha=H-K,L=M-O,Q=H-F,$=M-P,J=J*L-G*ha,T=T*Y-S*o,X=X*$-ca*Q;if(J>=0&&X>=0&&T>=0){x=!1;break a}}x=
|
|
!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[u]]]);k.push([h[n],h[t],h[u]]);n=t;for(u=t+1;u<l;n++,u++)h[n]=h[u];l--;p=2*l}}if(e)return k;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[u]]]);k.push([h[n],h[t],h[u]]);n=t;for(u=t+1;u<l;n++,u++)h[n]=h[u];l--;p=2*l}}if(e)return k;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
THREE.TorusGeometry=function(a,c,b,e,l){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=l||Math.PI*2;l=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var f=e/this.segmentsT*this.arc,h=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(f);l.y=this.radius*Math.sin(f);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);k.y=(this.radius+this.tube*Math.cos(h))*Math.sin(f);k.z=
|
|
THREE.TorusGeometry=function(a,c,b,e,l){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=l||Math.PI*2;l=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var f=e/this.segmentsT*this.arc,h=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(f);l.y=this.radius*Math.sin(f);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);k.y=(this.radius+this.tube*Math.cos(h))*Math.sin(f);k.z=
|
|
this.tube*Math.sin(h);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(l).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var l=(this.segmentsT+1)*b+e-1,f=(this.segmentsT+1)*(b-1)+e-1,h=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,f,h,k,[c[l],c[f],c[h],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[f]);n.normal.addSelf(c[h]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
|
|
this.tube*Math.sin(h);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(l).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var l=(this.segmentsT+1)*b+e-1,f=(this.segmentsT+1)*(b-1)+e-1,h=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,f,h,k,[c[l],c[f],c[h],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[f]);n.normal.addSelf(c[h]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
|
|
@@ -535,13 +535,13 @@ THREE.TorusKnotGeometry=function(a,c,b,e,l,f,h){function k(a,b,c,e,f,h){b=c/e*a;
|
|
this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,l=k(n,h,this.q,this.p,this.radius,this.heightScale),n=k(n+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=n.x-l.x;b.y=n.y-l.y;b.z=n.z-l.z;e.x=n.x+l.x;e.y=n.y+l.y;e.z=n.z+l.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);l.x+=n*e.x+h*f.x;l.y+=n*e.y+h*f.y;l.z+=n*e.z+h*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l.x,l.y,
|
|
this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,l=k(n,h,this.q,this.p,this.radius,this.heightScale),n=k(n+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=n.x-l.x;b.y=n.y-l.y;b.z=n.z-l.z;e.x=n.x+l.x;e.y=n.y+l.y;e.z=n.z+l.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);l.x+=n*e.x+h*f.x;l.y+=n*e.y+h*f.y;l.z+=n*e.z+h*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l.x,l.y,
|
|
l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),u=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,f));this.faceVertexUvs[0].push([h,n,t,u])}this.computeCentroids();
|
|
l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),u=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,f));this.faceVertexUvs[0].push([h,n,t,u])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var t=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(h.useOldVertexColors){t.vertexColors=[];for(var p,u,v,w=0;w<4;w++){v=n[w];p=new THREE.Color;p.setRGB(0,0,0);for(var y=0;y<v.length;y++)u=k.vertexColors[v[y]-1],p.r+=u.r,p.g+=u.g,p.b+=u.b;p.r/=v.length;p.g/=v.length;p.b/=v.length;t.vertexColors[w]=p}}l.push(t);(!h.supportUVs||x.length!=0)&&f.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
-b)}var e=[],l=[],f=[],h=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],u={},p={},x=[],v,y,w,z,B,C=a.faceVertexUvs[0];v=0;for(y=C.length;v<y;v++){w=0;for(z=C[v].length;w<z;w++)B=e[v]["abcd".charAt(w)],x[B]||(x[B]=C[v][w])}var A;v=0;for(y=e.length;v<y;v++)if(B=e[v],t.push(B.centroid),n.push(new THREE.Vertex(B.centroid)),h.supportUVs&&x.length!=0){A=new THREE.UV;if(B instanceof THREE.Face3)A.u=x[B.a].u+x[B.b].u+x[B.c].u,A.v=x[B.a].v+x[B.b].v+x[B.c].v,A.u/=3,A.v/=3;else if(B instanceof THREE.Face4)A.u=
|
|
|
|
-x[B.a].u+x[B.b].u+x[B.c].u+x[B.d].u,A.v=x[B.a].v+x[B.b].v+x[B.c].v+x[B.d].v,A.u/=4,A.v/=4;x.push(A)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var D=0,C=k.length,K,P,F={},Q={},H=function(a,
|
|
|
|
-b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},N=function(a,b){Q[a]===void 0&&(Q[a]={});Q[a][b]=null};for(v in y){A=y[v];K=v.split("_");P=K[0];K=K[1];H(P,[P,K]);H(K,[P,K]);w=0;for(z=A.length;w<z;w++)B=A[w],N(P,B,v),N(K,B,v);A.length<2&&(p[v]=!0)}for(v in y)if(A=y[v],B=A[0],A=A[1],K=v.split("_"),P=K[0],K=K[1],z=new THREE.Vector3,p[v]?(z.addSelf(k[P].position),z.addSelf(k[K].position),z.multiplyScalar(0.5)):(z.addSelf(t[B]),z.addSelf(t[A]),z.addSelf(k[P].position),z.addSelf(k[K].position),z.multiplyScalar(0.25)),
|
|
|
|
-u[v]=C+e.length+D,n.push(new THREE.Vertex(z)),D++,h.supportUVs&&x.length!=0)A=new THREE.UV,A.u=x[P].u+x[K].u,A.v=x[P].v+x[K].v,A.u/=2,A.v/=2,x.push(A);var L,G;K=["123","12","2","23"];z=["123","23","3","31"];var H=["123","31","1","12"],N=["1234","12","2","23"],W=["1234","23","3","34"],ca=["1234","34","4","41"],X=["1234","41","1","12"];v=0;for(y=t.length;v<y;v++)B=e[v],A=C+v,B instanceof THREE.Face3?(D=b(B.a,B.b),P=b(B.b,B.c),L=b(B.c,B.a),c(A,u[D],B.b,u[P],B,K),c(A,u[P],B.c,u[L],B,z),c(A,u[L],B.a,u[D],
|
|
|
|
-B,H)):B instanceof THREE.Face4?(D=b(B.a,B.b),P=b(B.b,B.c),L=b(B.c,B.d),G=b(B.d,B.a),c(A,u[D],B.b,u[P],B,N),c(A,u[P],B.c,u[L],B,W),c(A,u[L],B.d,u[G],B,ca),c(A,u[G],B.a,u[D],B,X)):console.log("face should be a face!",B);e=n;n=new THREE.Vector3;u=new THREE.Vector3;v=0;for(y=k.length;v<y;v++)if(F[v]!==void 0){n.set(0,0,0);u.set(0,0,0);B=new THREE.Vector3(0,0,0);A=0;for(w in Q[v])n.addSelf(t[w]),A++;D=0;C=F[v].length;for(w=0;w<C;w++)p[b(F[v][w][0],F[v][w][1])]&&D++;if(D!=2){n.divideScalar(A);for(w=0;w<
|
|
|
|
-C;w++)A=F[v][w],A=k[A[0]].position.clone().addSelf(k[A[1]].position).divideScalar(2),u.addSelf(A);u.divideScalar(C);B.addSelf(k[v].position);B.multiplyScalar(C-3);B.addSelf(n);B.addSelf(u.multiplyScalar(2));B.divideScalar(C);e[v].position=B}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(h.useOldVertexColors){p.vertexColors=[];for(var t,v,u,w=0;w<4;w++){u=n[w];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<u.length;y++)v=k.vertexColors[u[y]-1],t.r+=v.r,t.g+=v.g,t.b+=v.b;t.r/=u.length;t.g/=u.length;t.b/=u.length;p.vertexColors[w]=t}}l.push(p);(!h.supportUVs||x.length!=0)&&f.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
+b)}var e=[],l=[],f=[],h=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],u={},p={},x=[],v,y,w,A,z,C=a.faceVertexUvs[0];v=0;for(y=C.length;v<y;v++){w=0;for(A=C[v].length;w<A;w++)z=e[v]["abcd".charAt(w)],x[z]||(x[z]=C[v][w])}var B;v=0;for(y=e.length;v<y;v++)if(z=e[v],t.push(z.centroid),n.push(new THREE.Vertex(z.centroid)),h.supportUVs&&x.length!=0){B=new THREE.UV;if(z instanceof THREE.Face3)B.u=x[z.a].u+x[z.b].u+x[z.c].u,B.v=x[z.a].v+x[z.b].v+x[z.c].v,B.u/=3,B.v/=3;else if(z instanceof THREE.Face4)B.u=
|
|
|
|
+x[z.a].u+x[z.b].u+x[z.c].u+x[z.d].u,B.v=x[z.a].v+x[z.b].v+x[z.c].v+x[z.d].v,B.u/=4,B.v/=4;x.push(B)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var D=0,C=k.length,K,O,F={},P={},H=function(a,
|
|
|
|
+b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},M=function(a,b){P[a]===void 0&&(P[a]={});P[a][b]=null};for(v in y){B=y[v];K=v.split("_");O=K[0];K=K[1];H(O,[O,K]);H(K,[O,K]);w=0;for(A=B.length;w<A;w++)z=B[w],M(O,z,v),M(K,z,v);B.length<2&&(p[v]=!0)}for(v in y)if(B=y[v],z=B[0],B=B[1],K=v.split("_"),O=K[0],K=K[1],A=new THREE.Vector3,p[v]?(A.addSelf(k[O].position),A.addSelf(k[K].position),A.multiplyScalar(0.5)):(A.addSelf(t[z]),A.addSelf(t[B]),A.addSelf(k[O].position),A.addSelf(k[K].position),A.multiplyScalar(0.25)),
|
|
|
|
+u[v]=C+e.length+D,n.push(new THREE.Vertex(A)),D++,h.supportUVs&&x.length!=0)B=new THREE.UV,B.u=x[O].u+x[K].u,B.v=x[O].v+x[K].v,B.u/=2,B.v/=2,x.push(B);var J,G;K=["123","12","2","23"];A=["123","23","3","31"];var H=["123","31","1","12"],M=["1234","12","2","23"],X=["1234","23","3","34"],ca=["1234","34","4","41"],T=["1234","41","1","12"];v=0;for(y=t.length;v<y;v++)z=e[v],B=C+v,z instanceof THREE.Face3?(D=b(z.a,z.b),O=b(z.b,z.c),J=b(z.c,z.a),c(B,u[D],z.b,u[O],z,K),c(B,u[O],z.c,u[J],z,A),c(B,u[J],z.a,u[D],
|
|
|
|
+z,H)):z instanceof THREE.Face4?(D=b(z.a,z.b),O=b(z.b,z.c),J=b(z.c,z.d),G=b(z.d,z.a),c(B,u[D],z.b,u[O],z,M),c(B,u[O],z.c,u[J],z,X),c(B,u[J],z.d,u[G],z,ca),c(B,u[G],z.a,u[D],z,T)):console.log("face should be a face!",z);e=n;n=new THREE.Vector3;u=new THREE.Vector3;v=0;for(y=k.length;v<y;v++)if(F[v]!==void 0){n.set(0,0,0);u.set(0,0,0);z=new THREE.Vector3(0,0,0);B=0;for(w in P[v])n.addSelf(t[w]),B++;D=0;C=F[v].length;for(w=0;w<C;w++)p[b(F[v][w][0],F[v][w][1])]&&D++;if(D!=2){n.divideScalar(B);for(w=0;w<
|
|
|
|
+C;w++)B=F[v][w],B=k[B[0]].position.clone().addSelf(k[B[1]].position).divideScalar(2),u.addSelf(B);u.divideScalar(C);z.addSelf(k[v].position);z.multiplyScalar(C-3);z.addSelf(n);z.addSelf(u.multiplyScalar(2));z.divideScalar(C);e[v].position=z}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -557,112 +557,112 @@ c,e,b,f)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,f){var h=new XMLHttpRequest,k=e+"/"+a,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?f&&(n==0&&(n=h.getResponseHeader("Content-Length")),f({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,f){var h=new XMLHttpRequest,k=e+"/"+a,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?f&&(n==0&&(n=h.getResponseHeader("Content-Length")),f({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)};
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)};
|
|
THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=u(a,b),f=u(a,b+1),h=u(a,b+2),k=u(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=u(a,b),e=u(a,b+1),f=u(a,b+2);return(u(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=u(a,b);return(u(a,b+1)<<8)+c}function t(a,b){var c=u(a,b);return c>127?c-256:c}function u(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=u(a,b),f=u(a,b+1),h=u(a,b+2),k=u(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=u(a,b),e=u(a,b+1),f=u(a,b+2);return(u(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=u(a,b);return(u(a,b+1)<<8)+c}function t(a,b){var c=u(a,b);return c>127?c-256:c}function u(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
-e,f;c=k(a,b);e=k(a,b+P);f=k(a,b+F);b=l(a,b+Q);B.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,t,p;c=k(a,b);e=k(a,b+P);f=k(a,b+F);h=l(a,b+Q);o=k(a,b+H);t=k(a,b+N);p=k(a,b+L);var b=D[t*3],u=D[t*3+1];t=D[t*3+2];var v=D[p*3],w=D[p*3+1];p=D[p*3+2];B.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,u,t),new THREE.Vector3(v,w,p)],null,h))}function v(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+W);h=k(a,b+ca);b=l(a,b+X);B.faces.push(new THREE.Face4(c,
|
|
|
|
-e,f,h,null,null,b))}function y(b){var c,e,f,h,t,p,u,v,w;c=k(a,b);e=k(a,b+G);f=k(a,b+W);h=k(a,b+ca);t=l(a,b+X);p=k(a,b+U);u=k(a,b+o);v=k(a,b+$);w=k(a,b+ha);var b=D[u*3],x=D[u*3+1];u=D[u*3+2];var R=D[v*3],y=D[v*3+1];v=D[v*3+2];var Z=D[w*3],J=D[w*3+1];w=D[w*3+2];B.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(D[p*3],D[p*3+1],D[p*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(R,y,v),new THREE.Vector3(Z,J,w)],null,t))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+S);b=K[c*2];h=K[c*2+
|
|
|
|
-1];c=K[e*2];var l=B.faceVertexUvs[0];e=K[e*2+1];var n=K[f*2];f=K[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function z(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+Y);f=k(a,b+la);h=k(a,b+aa);b=K[c*2];l=K[c*2+1];c=K[e*2];n=K[e*2+1];e=K[f*2];var o=B.faceVertexUvs[0];f=K[f*2+1];var t=K[h*2];h=K[h*2+1];var p=[];p.push(new THREE.UV(b,l));p.push(new THREE.UV(c,n));p.push(new THREE.UV(e,f));p.push(new THREE.UV(t,h));o.push(p)}var B=this,C=0,A,D=[],K=[],
|
|
|
|
-P,F,Q,H,N,L,G,W,ca,X,U,o,$,ha,M,S,Y,la,aa,ma,na,ea,ka,fa,ia;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,b);A={signature:a.substr(C,8),header_bytes:u(a,C+8),vertex_coordinate_bytes:u(a,C+9),normal_coordinate_bytes:u(a,C+10),uv_coordinate_bytes:u(a,C+11),vertex_index_bytes:u(a,C+12),normal_index_bytes:u(a,C+13),uv_index_bytes:u(a,C+14),material_index_bytes:u(a,C+15),nvertices:k(a,C+16),nnormals:k(a,C+16+4),nuvs:k(a,C+16+8),ntri_flat:k(a,C+16+12),ntri_smooth:k(a,C+16+16),ntri_flat_uv:k(a,
|
|
|
|
-C+16+20),ntri_smooth_uv:k(a,C+16+24),nquad_flat:k(a,C+16+28),nquad_smooth:k(a,C+16+32),nquad_flat_uv:k(a,C+16+36),nquad_smooth_uv:k(a,C+16+40)};C+=A.header_bytes;P=A.vertex_index_bytes;F=A.vertex_index_bytes*2;Q=A.vertex_index_bytes*3;H=A.vertex_index_bytes*3+A.material_index_bytes;N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;L=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;G=A.vertex_index_bytes;W=A.vertex_index_bytes*2;ca=A.vertex_index_bytes*3;X=A.vertex_index_bytes*
|
|
|
|
-4;U=A.vertex_index_bytes*4+A.material_index_bytes;o=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;$=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;ha=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;M=A.uv_index_bytes;S=A.uv_index_bytes*2;Y=A.uv_index_bytes;la=A.uv_index_bytes*2;aa=A.uv_index_bytes*3;b=A.vertex_index_bytes*3+A.material_index_bytes;ia=A.vertex_index_bytes*4+A.material_index_bytes;ma=A.ntri_flat*b;na=A.ntri_smooth*(b+A.normal_index_bytes*
|
|
|
|
-3);ea=A.ntri_flat_uv*(b+A.uv_index_bytes*3);ka=A.ntri_smooth_uv*(b+A.normal_index_bytes*3+A.uv_index_bytes*3);fa=A.nquad_flat*ia;b=A.nquad_smooth*(ia+A.normal_index_bytes*4);ia=A.nquad_flat_uv*(ia+A.uv_index_bytes*4);C+=function(b){for(var e,f,k,l=A.vertex_coordinate_bytes*3,n=b+A.nvertices*l;b<n;b+=l)e=c(a,b),f=c(a,b+A.vertex_coordinate_bytes),k=c(a,b+A.vertex_coordinate_bytes*2),B.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,k)));return A.nvertices*l}(C);C+=function(b){for(var c,e,f,h=A.normal_coordinate_bytes*
|
|
|
|
-3,k=b+A.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+A.normal_coordinate_bytes),f=t(a,b+A.normal_coordinate_bytes*2),D.push(c/127,e/127,f/127);return A.nnormals*h}(C);C+=function(b){for(var e,f,k=A.uv_coordinate_bytes*2,l=b+A.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+A.uv_coordinate_bytes),K.push(e,f);return A.nuvs*k}(C);ma=C+ma;na=ma+na;ea=na+ea;ka=ea+ka;fa=ka+fa;b=fa+b;ia=b+ia;(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes,e=c+A.uv_index_bytes*3,f=a+A.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),w(b+
|
|
|
|
-c);return f-a})(na);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=c+A.uv_index_bytes*3,f=a+A.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),w(b+c);return f-a})(ea);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes,e=c+A.uv_index_bytes*4,f=a+A.nquad_flat_uv*e;for(b=a;b<f;b+=e)v(b),z(b+c);return f-a})(b);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=c+A.uv_index_bytes*4,f=a+A.nquad_smooth_uv*e;for(b=
|
|
|
|
-a;b<f;b+=e)y(b),z(b+c);return f-a})(ia);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes,e=a+A.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(C);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=a+A.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(ma);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes,e=a+A.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ka);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes+
|
|
|
|
-A.normal_index_bytes*4,e=a+A.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(fa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
|
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,l){na=a;e=e||fa;l!==void 0&&(a=l.split("/"),a.pop(),va=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",h,"image");qa=c("//dae:library_materials/dae:material",Q,"material");sa=c("//dae:library_effects/dae:effect",W,"effect");ua=c("//dae:library_geometries/dae:geometry",z,"geometry");ta=c("//dae:library_controllers/dae:controller",k,"controller");da=c("//dae:library_animations/dae:animation",X,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
-u,"visual_scene");Ea=[];Ca=[];(a=na.evaluate(".//dae:scene/dae:instance_visual_scene",na,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ka=Da[a]):ka=null;ea=new THREE.Object3D;for(a=0;a<ka.nodes.length;a++)ea.add(f(ka.nodes[a]));b();for(var n in da);n={scene:ea,morphs:Ea,skins:Ca,dae:{images:ga,materials:qa,effects:sa,geometries:ua,controllers:ta,animations:da,visualScenes:Da,scene:ka}};e&&e(n);return n}function c(a,b,c){for(var a=na.evaluate(a,
|
|
|
|
-na,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in da)for(var f=da[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
|
|
|
|
-a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=ta[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ka.getChildById(c.skeleton[0],!0)||ka.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
|
|
|
|
|
|
+e,f;c=k(a,b);e=k(a,b+O);f=k(a,b+F);b=l(a,b+P);z.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+O);f=k(a,b+F);h=l(a,b+P);o=k(a,b+H);p=k(a,b+M);t=k(a,b+J);var b=D[p*3],u=D[p*3+1];p=D[p*3+2];var v=D[t*3],w=D[t*3+1];t=D[t*3+2];z.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function v(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+X);h=k(a,b+ca);b=l(a,b+T);z.faces.push(new THREE.Face4(c,
|
|
|
|
+e,f,h,null,null,b))}function y(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+G);f=k(a,b+X);h=k(a,b+ca);p=l(a,b+T);t=k(a,b+S);u=k(a,b+o);v=k(a,b+Y);w=k(a,b+ha);var b=D[u*3],x=D[u*3+1];u=D[u*3+2];var U=D[v*3],y=D[v*3+1];v=D[v*3+2];var ea=D[w*3],A=D[w*3+1];w=D[w*3+2];z.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(D[t*3],D[t*3+1],D[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(U,y,v),new THREE.Vector3(ea,A,w)],null,p))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+L);f=k(a,b+Q);b=K[c*2];h=K[c*
|
|
|
|
+2+1];c=K[e*2];var l=z.faceVertexUvs[0];e=K[e*2+1];var n=K[f*2];f=K[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function A(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+$);f=k(a,b+na);h=k(a,b+fa);b=K[c*2];l=K[c*2+1];c=K[e*2];n=K[e*2+1];e=K[f*2];var o=z.faceVertexUvs[0];f=K[f*2+1];var p=K[h*2];h=K[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var z=this,C=0,B,D=[],K=
|
|
|
|
+[],O,F,P,H,M,J,G,X,ca,T,S,o,Y,ha,L,Q,$,na,fa,sa,ia,Z,ma,da,ja;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(z,e,b);B={signature:a.substr(C,8),header_bytes:u(a,C+8),vertex_coordinate_bytes:u(a,C+9),normal_coordinate_bytes:u(a,C+10),uv_coordinate_bytes:u(a,C+11),vertex_index_bytes:u(a,C+12),normal_index_bytes:u(a,C+13),uv_index_bytes:u(a,C+14),material_index_bytes:u(a,C+15),nvertices:k(a,C+16),nnormals:k(a,C+16+4),nuvs:k(a,C+16+8),ntri_flat:k(a,C+16+12),ntri_smooth:k(a,C+16+16),ntri_flat_uv:k(a,
|
|
|
|
+C+16+20),ntri_smooth_uv:k(a,C+16+24),nquad_flat:k(a,C+16+28),nquad_smooth:k(a,C+16+32),nquad_flat_uv:k(a,C+16+36),nquad_smooth_uv:k(a,C+16+40)};C+=B.header_bytes;O=B.vertex_index_bytes;F=B.vertex_index_bytes*2;P=B.vertex_index_bytes*3;H=B.vertex_index_bytes*3+B.material_index_bytes;M=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;J=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;G=B.vertex_index_bytes;X=B.vertex_index_bytes*2;ca=B.vertex_index_bytes*3;T=B.vertex_index_bytes*
|
|
|
|
+4;S=B.vertex_index_bytes*4+B.material_index_bytes;o=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;Y=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;ha=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;L=B.uv_index_bytes;Q=B.uv_index_bytes*2;$=B.uv_index_bytes;na=B.uv_index_bytes*2;fa=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;ja=B.vertex_index_bytes*4+B.material_index_bytes;sa=B.ntri_flat*b;ia=B.ntri_smooth*(b+B.normal_index_bytes*
|
|
|
|
+3);Z=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ma=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);da=B.nquad_flat*ja;b=B.nquad_smooth*(ja+B.normal_index_bytes*4);ja=B.nquad_flat_uv*(ja+B.uv_index_bytes*4);C+=function(b){for(var e,f,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),f=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,k)));return B.nvertices*l}(C);C+=function(b){for(var c,e,f,h=B.normal_coordinate_bytes*
|
|
|
|
+3,k=b+B.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+B.normal_coordinate_bytes),f=t(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,f/127);return B.nnormals*h}(C);C+=function(b){for(var e,f,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+B.uv_coordinate_bytes),K.push(e,f);return B.nuvs*k}(C);sa=C+sa;ia=sa+ia;Z=ia+Z;ma=Z+ma;da=ma+da;b=da+b;ja=b+ja;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,f=a+B.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),w(b+c);
|
|
|
|
+return f-a})(ia);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,f=a+B.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),w(b+c);return f-a})(Z);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,f=a+B.nquad_flat_uv*e;for(b=a;b<f;b+=e)v(b),A(b+c);return f-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+B.uv_index_bytes*4,f=a+B.nquad_smooth_uv*e;for(b=a;b<
|
|
|
|
+f;b+=e)y(b),A(b+c);return f-a})(ja);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(C);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(sa);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ma);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
|
+4,e=a+B.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(da);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
|
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,l){ia=a;e=e||da;l!==void 0&&(a=l.split("/"),a.pop(),Fa=a.length<1?"":a.join("/")+"/");la=c("//dae:library_images/dae:image",h,"image");qa=c("//dae:library_materials/dae:material",P,"material");ka=c("//dae:library_effects/dae:effect",X,"effect");va=c("//dae:library_geometries/dae:geometry",A,"geometry");pa=c("//dae:library_controllers/dae:controller",k,"controller");ga=c("//dae:library_animations/dae:animation",T,"animation");wa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
+u,"visual_scene");Da=[];ua=[];(a=ia.evaluate(".//dae:scene/dae:instance_visual_scene",ia,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ma=wa[a]):ma=null;Z=new THREE.Object3D;for(a=0;a<ma.nodes.length;a++)Z.add(f(ma.nodes[a]));b();for(var n in ga);n={scene:Z,morphs:Da,skins:ua,dae:{images:la,materials:qa,effects:ka,geometries:va,controllers:pa,animations:ga,visualScenes:wa,scene:ma}};e&&e(n);return n}function c(a,b,c){for(var a=ia.evaluate(a,
|
|
|
|
+ia,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ga)for(var f=ga[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
|
|
|
|
+a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=pa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ma.getChildById(c.skeleton[0],!0)||ma.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
|
|
u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
|
|
u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
|
|
0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function f(a){var b=
|
|
0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function f(a){var b=
|
|
-new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var k=ta[a.controllers[h].url];switch(k.type){case "skin":if(ua[k.skin.source]){var n=new w;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ta[k.skin.source]&&(e=k=ta[k.skin.source],k.morph&&ua[k.morph.source]))n=new w,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(ua[k.morph.source])n=new w,
|
|
|
|
-n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n),e=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],n=k.instance_material,k=ua[k.url],o={},p=0,t;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=sa[qa[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
|
|
|
|
-u.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=ta[c.url],n.skinInstanceController=c,n.name="skin_"+Ca.length,Ca.push(n);else if(e!==void 0){o=k;p=e instanceof v?ta[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
|
-else{p=p.morph;for(u=0;u<p.targets.length;u++){var x=ua[p.targets[u]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+Ea.length;Ea.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
|
|
|
+new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var k=pa[a.controllers[h].url];switch(k.type){case "skin":if(va[k.skin.source]){var n=new w;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(pa[k.skin.source]&&(e=k=pa[k.skin.source],k.morph&&va[k.morph.source]))n=new w,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(va[k.morph.source])n=new w,
|
|
|
|
+n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n),e=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],n=k.instance_material,k=va[k.url],o={},p=0,t;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=ka[qa[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
|
|
|
|
+u.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=pa[c.url],n.skinInstanceController=c,n.name="skin_"+ua.length,ua.push(n);else if(e!==void 0){o=k;p=e instanceof v?pa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
|
+else{p=p.morph;for(u=0;u<p.targets.length;u++){var x=va[p.targets[u]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+Da.length;Da.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
b.scale);for(h=0;h<a.nodes.length;h++)b.add(f(a.nodes[h],a));return b}function h(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
b.scale);for(h=0;h<a.nodes.length;h++)b.add(f(a.nodes[h],a));return b}function h(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function B(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function A(){this.material="";this.count=
|
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function P(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function Q(){this.name=this.id="";this.instance_effect=null}function H(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
|
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function W(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ca(){this.url=""}function X(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
|
-this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function $(a){var b=a.getAttribute("id");if(ia[b]!=void 0)return ia[b];ia[b]=(new F(b)).parse(a);return ia[b]}function ha(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function M(a){for(var a=Y(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function S(a){for(var a=Y(a),b=[],c=
|
|
|
|
-0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function Y(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ma(a,b){var c="";c+=aa(a.x,b)+",";c+=aa(a.y,b)+",";c+=aa(a.z,b);return c}var na=null,ea=null,ka,
|
|
|
|
-fa=null,ia={},ga={},da={},ta={},ua={},qa={},sa={},Da,va,Ea,Ca,Ga=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);
|
|
|
|
|
|
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function B(){this.material="";this.count=
|
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function O(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function P(){this.name=this.id="";this.instance_effect=null}function H(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function M(a,
|
|
|
|
+b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function X(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ca(){this.url=""}function T(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function S(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
|
+this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Y(a){var b=a.getAttribute("id");if(ja[b]!=void 0)return ja[b];ja[b]=(new F(b)).parse(a);return ja[b]}function ha(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=$(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function Q(a){for(var a=$(a),b=[],c=
|
|
|
|
+0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function $(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function na(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function fa(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function sa(a,b){var c="";c+=fa(a.x,b)+",";c+=fa(a.y,b)+",";c+=fa(a.z,b);return c}var ia=null,Z=null,ma,
|
|
|
|
+da=null,ja={},la={},ga={},pa={},va={},qa={},ka={},wa,Fa,Da,ua,Ga=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);
|
|
this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new F).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],
|
|
this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new F).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],
|
|
-a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new P).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];
|
|
|
|
-if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=M(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new F).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=
|
|
|
|
-a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new P).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};t.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var k=a.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "input":f.push((new P).parse(k));break;case "v":c=S(k.textContent);break;case "vcount":e=S(k.textContent)}}for(h=k=0;h<e.length;h++){for(var l=
|
|
|
|
|
|
+a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new O).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];
|
|
|
|
+if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=L(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new F).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=
|
|
|
|
+a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new O).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};t.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var k=a.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "input":f.push((new O).parse(k));break;case "v":c=Q(k.textContent);break;case "vcount":e=Q(k.textContent)}}for(h=k=0;h<e.length;h++){for(var l=
|
|
e[h],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=f[t],v=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);k+=f.length}for(o=0;o<n.length;o++)n[o].index=h;this.weights.push(n)}};u.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};u.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
|
|
e[h],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=f[t],v=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);k+=f.length}for(o=0;o<n.length;o++)n[o].index=h;this.weights.push(n)}};u.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};u.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
|
|
b);if(e)return e}return null};u.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),
|
|
b);if(e)return e}return null};u.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),
|
|
f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:k,arrIndices:l},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
|
|
f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:k,arrIndices:l},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
|
|
b);if(e)return e}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=
|
|
b);if(e)return e}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=
|
|
-0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=na.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",na,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
-null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in da)for(var f=da[e],h=0;h<f.channel.length;h++){var k=f.channel[h],l=f.sampler[h];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=
|
|
|
|
|
|
+0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ia.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ia,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
+null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in ga)for(var f=ga[e],h=0;h<f.channel.length;h++){var k=f.channel[h],l=f.sampler[h];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=
|
|
c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=h=void 0,h=0;h<this.channels.length;h++)n=this.channels[h],f[n.sid]=n;k=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(l=this.transforms[h],n=f[l.sid],n!==void 0){for(var o=n.sampler,t,n=0;n<o.input.length-1;n++)if(o.input[n+
|
|
c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=h=void 0,h=0;h<this.channels.length;h++)n=this.channels[h],f[n.sid]=n;k=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(l=this.transforms[h],n=f[l.sid],n!==void 0){for(var o=n.sampler,t,n=0;n<o.input.length-1;n++)if(o.input[n+
|
|
1]>b){t=o.output[n];break}k=t!==void 0?t instanceof THREE.Matrix4?k.multiply(k,t):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};x.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=
|
|
1]>b){t=o.output[n];break}k=t!==void 0?t instanceof THREE.Matrix4?k.multiply(k,t):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};x.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=
|
|
-a.nodeName;this.data=M(a.textContent);this.updateMatrix();return this};x.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=
|
|
|
|
|
|
+a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};x.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=
|
|
this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));
|
|
this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));
|
|
-break;case "bind_material":if(c=na.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=c.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
|
-a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=na.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new y).parse(b)),b=a.iterateNext();break}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new B(this)).parse(c)}}return this};B.prototype.parse=function(a){function b(a,
|
|
|
|
-c){var e=ma(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":$(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new A).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ia[this.vertices.input.POSITION.source].data;
|
|
|
|
-for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};B.prototype.handlePrimitive=function(a,b,c){var e=
|
|
|
|
-0,f,h,k=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=ia[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=ma(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+
|
|
|
|
-2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==3?B=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(B=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));B.daeMaterial=a.material;b.faces.push(B);for(h=0;h<v.length;h++)f=y[v[h]],b.faceVertexUvs[h].push([f[0],
|
|
|
|
-f[1],f[2]]);e+=l.length*u}};C.prototype=new A;C.prototype.constructor=C;A.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};A.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new P).parse(a.childNodes[b]));break;case "vcount":this.vcount=
|
|
|
|
-S(c.textContent);break;case "p":this.p=S(c.textContent)}}return this};D.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
|
|
|
|
-"input"&&(input=(new P).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};P.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
|
|
|
|
-Y(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=S(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Y(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[e]);break}}}return this};
|
|
|
|
-F.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};Q.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new ca).parse(a.childNodes[b]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=M(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
|
|
|
|
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=na.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
-null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof H)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=
|
|
|
|
-THREE.ImageUtils.loadTexture(va+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ga;return this.material=new THREE.MeshLambertMaterial(a)};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
|
|
+break;case "bind_material":if(c=ia.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=c.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
|
+a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ia.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new y).parse(b)),b=a.iterateNext();break}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new z(this)).parse(c)}}return this};z.prototype.parse=function(a){function b(a,
|
|
|
|
+c){var e=sa(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Y(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new B).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ja[this.vertices.input.POSITION.source].data;
|
|
|
|
+for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(a,b,c){var e=
|
|
|
|
+0,f,h,k=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=ja[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=sa(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+
|
|
|
|
+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var A;u==3?A=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(A=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));A.daeMaterial=a.material;b.faces.push(A);for(h=0;h<v.length;h++)f=y[v[h]],b.faceVertexUvs[h].push([f[0],
|
|
|
|
+f[1],f[2]]);e+=l.length*u}};C.prototype=new B;C.prototype.constructor=C;B.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};B.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=na(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new O).parse(a.childNodes[b]));break;case "vcount":this.vcount=
|
|
|
|
+Q(c.textContent);break;case "p":this.p=Q(c.textContent)}}return this};D.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=na(a,"count",0);this.stride=na(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
|
|
|
|
+"input"&&(input=(new O).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};O.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=na(a,"set",-1);this.offset=na(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
|
|
|
|
+$(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=Q(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=$(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[e]);break}}}return this};
|
|
|
|
+F.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};P.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new ca).parse(a.childNodes[b]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=L(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
|
|
|
|
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=ia.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
+null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};M.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof H)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=la[this.effect.surface.init_from]))a.map=
|
|
|
|
+THREE.ImageUtils.loadTexture(Fa+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ga;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
|
|
if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
|
|
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};W.prototype.create=function(){if(this.shader==null)return null};W.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
|
-W.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new L(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};W.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
|
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};W.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new N(c.nodeName,this)).parse(c)}}};ca.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};X.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new U(this)).parse(c))}}return this};U.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
|
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new P).parse(c))}}return this};
|
|
|
|
|
|
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};X.prototype.create=function(){if(this.shader==null)return null};X.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
|
+X.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new J(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};X.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
|
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};X.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new M(c.nodeName,this)).parse(c)}}};ca.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};T.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new S(this)).parse(c))}}return this};S.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
|
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new O).parse(c))}}return this};
|
|
o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
-200))fa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ga=a},applySkin:l,geometries:ua}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
|
|
+200))da=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ga=a},applySkin:l,geometries:va}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.JSONLoader.prototype.load=function(a,c,b){var e,l=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){l.createModel(a.data,c,b);l.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
THREE.JSONLoader.prototype.load=function(a,c,b){var e,l=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){l.createModel(a.data,c,b);l.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,t,u,p,x,v,y,w,z,B,C,A,D=a.faces;p=a.vertices;var K=a.normals,P=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(u=p.length;t<u;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
|
|
|
|
-p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(u=D.length;t<u;){b=D[t++];p=b&1;l=b&2;c=b&4;k=b&8;v=b&16;x=b&32;w=b&64;b&=128;p?(z=new THREE.Face4,z.a=D[t++],z.b=D[t++],z.c=D[t++],z.d=D[t++],p=4):(z=new THREE.Face3,z.a=D[t++],z.b=D[t++],z.c=D[t++],p=3);if(l)l=D[t++],z.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<F;c++)B=a.uvs[c],y=D[t++],A=B[y*2],y=B[y*2+1],e.faceUvs[c][l]=new THREE.UV(A,y);if(k)for(c=0;c<F;c++){B=a.uvs[c];C=[];for(k=0;k<p;k++)y=D[t++],A=B[y*2],y=B[y*2+1],C[k]=new THREE.UV(A,
|
|
|
|
-y);e.faceVertexUvs[c][l]=C}if(v)v=D[t++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],z.normal=k;if(x)for(c=0;c<p;c++)v=D[t++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],z.vertexNormals.push(k);if(w)x=D[t++],x=new THREE.Color(P[x]),z.color=x;if(b)for(c=0;c<p;c++)x=D[t++],x=new THREE.Color(P[x]),z.vertexColors.push(x);e.faces.push(z)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,t,u,p,x,v,y,w,A,z,C,B,D=a.faces;p=a.vertices;var K=a.normals,O=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(u=p.length;t<u;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
|
|
|
|
+p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(u=D.length;t<u;){b=D[t++];p=b&1;l=b&2;c=b&4;k=b&8;v=b&16;x=b&32;w=b&64;b&=128;p?(A=new THREE.Face4,A.a=D[t++],A.b=D[t++],A.c=D[t++],A.d=D[t++],p=4):(A=new THREE.Face3,A.a=D[t++],A.b=D[t++],A.c=D[t++],p=3);if(l)l=D[t++],A.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<F;c++)z=a.uvs[c],y=D[t++],B=z[y*2],y=z[y*2+1],e.faceUvs[c][l]=new THREE.UV(B,y);if(k)for(c=0;c<F;c++){z=a.uvs[c];C=[];for(k=0;k<p;k++)y=D[t++],B=z[y*2],y=z[y*2+1],C[k]=new THREE.UV(B,
|
|
|
|
+y);e.faceVertexUvs[c][l]=C}if(v)v=D[t++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],A.normal=k;if(x)for(c=0;c<p;c++)v=D[t++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],A.vertexNormals.push(k);if(w)x=D[t++],x=new THREE.Color(O[x]),A.color=x;if(b)for(c=0;c<p;c++)x=D[t++],x=new THREE.Color(O[x]),A.vertexColors.push(x);e.faces.push(A)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,t,u,p,x,v,y;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];v=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(t=y.length;l<t;l+=3)u=y[l]*b,p=y[l+1]*
|
|
l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,t,u,p,x,v,y;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];v=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(t=y.length;l<t;l+=3)u=y[l]*b,p=y[l+1]*
|
|
b,x=y[l+2]*b,v.push(new THREE.Vertex(new THREE.Vector3(u,p,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;u=a.morphColors[c].colors;b=0;for(l=u.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(u[b],u[b+1],u[b+2]),t.push(p)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
b,x=y[l+2]*b,v.push(new THREE.Vertex(new THREE.Vector3(u,p,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;u=a.morphColors[c].colors;b=0;for(l=u.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(u[b],u[b+1],u[b+2]),t.push(p)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(v in G.objects)if(!$.objects[v])if(C=G.objects[v],C.geometry!==void 0){if(P=$.geometries[C.geometry]){var a=!1;for(M=0;M<C.materials.length;M++)N=$.materials[C.materials[M]],a=N instanceof THREE.ShaderMaterial;a&&P.computeTangents();A=C.position;r=C.rotation;q=C.quaternion;
|
|
|
|
-s=C.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(P,N);object.name=v;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;$.scene.add(object);$.objects[v]=object;C.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),$.scene.collisions.colliders.push(a));if(C.castsShadow)a=
|
|
|
|
-new THREE.ShadowVolume(P),$.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},$.triggers[object.name]=a)}}else A=C.position,r=C.rotation,q=C.quaternion,s=C.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
|
-C.visible!==void 0?C.visible:!1,$.scene.add(object),$.objects[v]=object,$.empties[v]=object,C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},$.triggers[object.name]=a)}function n(a){return function(c){$.geometries[a]=c;k();ca-=1;b.onLoadComplete();u()}}function t(a){return function(b){$.geometries[a]=b}}function u(){b.callbackProgress({totalModels:U,totalTextures:o,loadedModels:U-ca,loadedTextures:o-X},$);b.onLoadProgress();ca==0&&X==0&&c($)}var p,x,v,y,w,z,B,C,A,D,K,P,F,Q,
|
|
|
|
-H,N,L,G,W,ca,X,U,o,$;G=a.data;H=new THREE.BinaryLoader;W=new THREE.JSONLoader;X=ca=0;$={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in G.objects)if(C=G.objects[v],C.meshCollider){a=!0;break}if(a)$.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;D=G.transform.rotation;var ha=G.transform.scale;a&&$.scene.position.set(a[0],a[1],a[2]);D&&$.scene.rotation.set(D[0],D[1],D[2]);ha&&
|
|
|
|
-$.scene.scale.set(ha[0],ha[1],ha[2]);(a||D||ha)&&$.scene.updateMatrix()}a=function(){X-=1;u();b.onLoadComplete()};for(w in G.cameras)D=G.cameras[w],D.type=="perspective"?F=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(F=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),A=D.position,D=D.target,F.position.set(A[0],A[1],A[2]),F.target=new THREE.Vector3(D[0],D[1],D[2]),$.cameras[w]=F;for(y in G.lights)w=G.lights[y],F=w.color!==void 0?w.color:16777215,
|
|
|
|
-D=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(A=w.direction,L=new THREE.DirectionalLight(F,D),L.position.set(A[0],A[1],A[2]),L.position.normalize()):w.type=="point"?(A=w.position,d=w.distance,L=new THREE.PointLight(F,D,d),L.position.set(A[0],A[1],A[2])):w.type=="ambient"&&(L=new THREE.AmbientLight(F)),$.scene.add(L),$.lights[y]=L;for(z in G.fogs)y=G.fogs[z],y.type=="linear"?Q=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(Q=new THREE.FogExp2(0,y.density)),D=y.color,Q.color.setRGB(D[0],
|
|
|
|
-D[1],D[2]),$.fogs[z]=Q;if($.cameras&&G.defaults.camera)$.currentCamera=$.cameras[G.defaults.camera];if($.fogs&&G.defaults.fog)$.scene.fog=$.fogs[G.defaults.fog];D=G.defaults.bgcolor;$.bgColor=new THREE.Color;$.bgColor.setRGB(D[0],D[1],D[2]);$.bgColorAlpha=G.defaults.bgalpha;for(p in G.geometries)if(z=G.geometries[p],z.type=="bin_mesh"||z.type=="ascii_mesh")ca+=1,b.onLoadStart();U=ca;for(p in G.geometries)z=G.geometries[p],z.type=="cube"?(P=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,
|
|
|
|
-z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),$.geometries[p]=P):z.type=="plane"?(P=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),$.geometries[p]=P):z.type=="sphere"?(P=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),$.geometries[p]=P):z.type=="cylinder"?(P=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),$.geometries[p]=P):z.type=="torus"?(P=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),$.geometries[p]=
|
|
|
|
-P):z.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(z.subdivisions),$.geometries[p]=P):z.type=="bin_mesh"?H.load(e(z.url,G.urlBaseType),n(p)):z.type=="ascii_mesh"?W.load(e(z.url,G.urlBaseType),n(p)):z.type=="embedded_mesh"&&(z=G.embeds[z.id])&&W.createModel(z,t(p),"");for(B in G.textures)if(p=G.textures[B],p.url instanceof Array){X+=p.url.length;for(H=0;H<p.url.length;H++)b.onLoadStart()}else X+=1,b.onLoadStart();o=X;for(B in G.textures){p=G.textures[B];if(p.mapping!=void 0&&THREE[p.mapping]!=
|
|
|
|
-void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){H=[];for(var M=0;M<p.url.length;M++)H[M]=e(p.url[M],G.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,p.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(p.url,G.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)H.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)H.magFilter=THREE[p.magFilter];if(p.repeat){H.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}p.offset&&
|
|
|
|
-H.offset.set(p.offset[0],p.offset[1]);if(p.wrap){W={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(W[p.wrap[0]]!==void 0)H.wrapS=W[p.wrap[0]];if(W[p.wrap[1]]!==void 0)H.wrapT=W[p.wrap[1]]}}$.textures[B]=H}for(x in G.materials){B=G.materials[x];for(K in B.parameters)if(K=="envMap"||K=="map"||K=="lightMap")B.parameters[K]=$.textures[B.parameters[K]];else if(K=="shading")B.parameters[K]=B.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")B.parameters[K]=
|
|
|
|
-THREE[B.parameters[K]]?THREE[B.parameters[K]]:THREE.NormalBlending;else if(K=="combine")B.parameters[K]=B.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(B.parameters[K]=="face")B.parameters[K]=THREE.FaceColors;else if(B.parameters[K])B.parameters[K]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=!0;if(B.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
|
|
-H=B.parameters.color;W=B.parameters.specular;z=B.parameters.ambient;Q=B.parameters.shininess;a.tNormal.texture=$.textures[B.parameters.normalMap];if(B.parameters.normalMapFactor)a.uNormalScale.value=B.parameters.normalMapFactor;if(B.parameters.map)a.tDiffuse.texture=B.parameters.map,a.enableDiffuse.value=!0;if(B.parameters.lightMap)a.tAO.texture=B.parameters.lightMap,a.enableAO.value=!0;if(B.parameters.specularMap)a.tSpecular.texture=$.textures[B.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
|
-a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(W);a.uAmbientColor.value.setHex(z);a.uShininess.value=Q;if(B.parameters.opacity)a.uOpacity.value=B.parameters.opacity;B=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else B=new THREE[B.type](B.parameters);$.materials[x]=B}k();b.callbackSync($);u()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(v in G.objects)if(!Y.objects[v])if(C=G.objects[v],C.geometry!==void 0){if(O=Y.geometries[C.geometry]){var a=!1;for(L=0;L<C.materials.length;L++)M=Y.materials[C.materials[L]],a=M instanceof THREE.ShaderMaterial;a&&O.computeTangents();B=C.position;r=C.rotation;q=C.quaternion;
|
|
|
|
+s=C.scale;q=0;M.length==0&&(M=new THREE.MeshFaceMaterial);M.length>1&&(M=new THREE.MeshFaceMaterial);object=new THREE.Mesh(O,M);object.name=v;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;Y.scene.add(object);Y.objects[v]=object;C.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Y.scene.collisions.colliders.push(a));if(C.castsShadow)a=
|
|
|
|
+new THREE.ShadowVolume(O),Y.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},Y.triggers[object.name]=a)}}else B=C.position,r=C.rotation,q=C.quaternion,s=C.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
|
+C.visible!==void 0?C.visible:!1,Y.scene.add(object),Y.objects[v]=object,Y.empties[v]=object,C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},Y.triggers[object.name]=a)}function n(a){return function(c){Y.geometries[a]=c;k();ca-=1;b.onLoadComplete();u()}}function t(a){return function(b){Y.geometries[a]=b}}function u(){b.callbackProgress({totalModels:S,totalTextures:o,loadedModels:S-ca,loadedTextures:o-T},Y);b.onLoadProgress();ca==0&&T==0&&c(Y)}var p,x,v,y,w,A,z,C,B,D,K,O,F,P,
|
|
|
|
+H,M,J,G,X,ca,T,S,o,Y;G=a.data;H=new THREE.BinaryLoader;X=new THREE.JSONLoader;T=ca=0;Y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in G.objects)if(C=G.objects[v],C.meshCollider){a=!0;break}if(a)Y.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;D=G.transform.rotation;var ha=G.transform.scale;a&&Y.scene.position.set(a[0],a[1],a[2]);D&&Y.scene.rotation.set(D[0],D[1],D[2]);ha&&
|
|
|
|
+Y.scene.scale.set(ha[0],ha[1],ha[2]);(a||D||ha)&&Y.scene.updateMatrix()}a=function(){T-=1;u();b.onLoadComplete()};for(w in G.cameras)D=G.cameras[w],D.type=="perspective"?F=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(F=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),B=D.position,D=D.target,F.position.set(B[0],B[1],B[2]),F.target=new THREE.Vector3(D[0],D[1],D[2]),Y.cameras[w]=F;for(y in G.lights)w=G.lights[y],F=w.color!==void 0?w.color:16777215,
|
|
|
|
+D=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(B=w.direction,J=new THREE.DirectionalLight(F,D),J.position.set(B[0],B[1],B[2]),J.position.normalize()):w.type=="point"?(B=w.position,d=w.distance,J=new THREE.PointLight(F,D,d),J.position.set(B[0],B[1],B[2])):w.type=="ambient"&&(J=new THREE.AmbientLight(F)),Y.scene.add(J),Y.lights[y]=J;for(A in G.fogs)y=G.fogs[A],y.type=="linear"?P=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(P=new THREE.FogExp2(0,y.density)),D=y.color,P.color.setRGB(D[0],
|
|
|
|
+D[1],D[2]),Y.fogs[A]=P;if(Y.cameras&&G.defaults.camera)Y.currentCamera=Y.cameras[G.defaults.camera];if(Y.fogs&&G.defaults.fog)Y.scene.fog=Y.fogs[G.defaults.fog];D=G.defaults.bgcolor;Y.bgColor=new THREE.Color;Y.bgColor.setRGB(D[0],D[1],D[2]);Y.bgColorAlpha=G.defaults.bgalpha;for(p in G.geometries)if(A=G.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")ca+=1,b.onLoadStart();S=ca;for(p in G.geometries)A=G.geometries[p],A.type=="cube"?(O=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,
|
|
|
|
+A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),Y.geometries[p]=O):A.type=="plane"?(O=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),Y.geometries[p]=O):A.type=="sphere"?(O=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),Y.geometries[p]=O):A.type=="cylinder"?(O=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),Y.geometries[p]=O):A.type=="torus"?(O=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),Y.geometries[p]=
|
|
|
|
+O):A.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(A.subdivisions),Y.geometries[p]=O):A.type=="bin_mesh"?H.load(e(A.url,G.urlBaseType),n(p)):A.type=="ascii_mesh"?X.load(e(A.url,G.urlBaseType),n(p)):A.type=="embedded_mesh"&&(A=G.embeds[A.id])&&X.createModel(A,t(p),"");for(z in G.textures)if(p=G.textures[z],p.url instanceof Array){T+=p.url.length;for(H=0;H<p.url.length;H++)b.onLoadStart()}else T+=1,b.onLoadStart();o=T;for(z in G.textures){p=G.textures[z];if(p.mapping!=void 0&&THREE[p.mapping]!=
|
|
|
|
+void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){H=[];for(var L=0;L<p.url.length;L++)H[L]=e(p.url[L],G.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,p.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(p.url,G.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)H.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)H.magFilter=THREE[p.magFilter];if(p.repeat){H.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}p.offset&&
|
|
|
|
+H.offset.set(p.offset[0],p.offset[1]);if(p.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[p.wrap[0]]!==void 0)H.wrapS=X[p.wrap[0]];if(X[p.wrap[1]]!==void 0)H.wrapT=X[p.wrap[1]]}}Y.textures[z]=H}for(x in G.materials){z=G.materials[x];for(K in z.parameters)if(K=="envMap"||K=="map"||K=="lightMap")z.parameters[K]=Y.textures[z.parameters[K]];else if(K=="shading")z.parameters[K]=z.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")z.parameters[K]=
|
|
|
|
+THREE[z.parameters[K]]?THREE[z.parameters[K]]:THREE.NormalBlending;else if(K=="combine")z.parameters[K]=z.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(z.parameters[K]=="face")z.parameters[K]=THREE.FaceColors;else if(z.parameters[K])z.parameters[K]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;if(z.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
|
|
+H=z.parameters.color;X=z.parameters.specular;A=z.parameters.ambient;P=z.parameters.shininess;a.tNormal.texture=Y.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=Y.textures[z.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
|
+a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(X);a.uAmbientColor.value.setHex(A);a.uShininess.value=P;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);Y.materials[x]=z}k();b.callbackSync(Y);u()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,l=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,l=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
c,l,f,h,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var f=0,h=0;h<c;++h){var k=a.charCodeAt(h+e);f+=k>>1^-(k&1);b[8*h+l]=f}e+=c}c=a.length-e;f=new Uint16Array(c);for(l=h=0;l<c;l++)k=a.charCodeAt(l+e),f[l]=h-k,k==0&&h++;return[b,f]};
|
|
c,l,f,h,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var f=0,h=0;h<c;++h){var k=a.charCodeAt(h+e);f+=k>>1^-(k&1);b[8*h+l]=f}e+=c}c=a.length-e;f=new Uint16Array(c);for(l=h=0;l<c;l++)k=a.charCodeAt(l+e),f[l]=h-k,k==0&&h++;return[b,f]};
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,f){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],u=[];(function(a,h,n){for(var t,u,z,B=a.length;n<B;n+=h)t=a[n],u=a[n+1],z=a[n+2],t=t/16383*b,u=u/16383*b,z=z/16383*b,t+=e,u+=l,z+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,z)))})(h[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,u.push(e,1-f)})(h[0],8,3);(function(a,
|
|
|
|
-b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(h[0],8,5);(function(a){var b,e,f,h,l,n,C,A,D,K=a.length;for(b=0;b<K;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;A=e;D=f;n=h;C=e;var P=f,F=h,Q=l.materials[0],H=t[P*3],N=t[P*3+1],P=t[P*3+2],L=t[F*3],G=t[F*3+1],F=t[F*3+2];C=new THREE.Vector3(t[C*3],t[C*3+1],t[C*3+2]);P=new THREE.Vector3(H,N,P);F=new THREE.Vector3(L,G,F);l.faces.push(new THREE.Face3(A,D,n,[C,P,F],null,Q));l=u[e*2];e=u[e*2+
|
|
|
|
-1];n=u[f*2];C=u[f*2+1];A=u[h*2];D=u[h*2+1];h=c.faceVertexUvs[0];f=n;n=C;C=[];C.push(new THREE.UV(l,e));C.push(new THREE.UV(f,n));C.push(new THREE.UV(A,D));h.push(C)}})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)};
|
|
|
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,f){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],u=[];(function(a,h,n){for(var t,u,A,z=a.length;n<z;n+=h)t=a[n],u=a[n+1],A=a[n+2],t=t/16383*b,u=u/16383*b,A=A/16383*b,t+=e,u+=l,A+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,A)))})(h[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,u.push(e,1-f)})(h[0],8,3);(function(a,
|
|
|
|
+b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(h[0],8,5);(function(a){var b,e,f,h,l,n,C,B,D,K=a.length;for(b=0;b<K;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;B=e;D=f;n=h;C=e;var O=f,F=h,P=l.materials[0],H=t[O*3],M=t[O*3+1],O=t[O*3+2],J=t[F*3],G=t[F*3+1],F=t[F*3+2];C=new THREE.Vector3(t[C*3],t[C*3+1],t[C*3+2]);O=new THREE.Vector3(H,M,O);F=new THREE.Vector3(J,G,F);l.faces.push(new THREE.Face3(B,D,n,[C,O,F],null,P));l=u[e*2];e=u[e*2+
|
|
|
|
+1];n=u[f*2];C=u[f*2+1];B=u[h*2];D=u[h*2+1];h=c.faceVertexUvs[0];f=n;n=C;C=[];C.push(new THREE.UV(l,e));C.push(new THREE.UV(f,n));C.push(new THREE.UV(B,D));h.push(C)}})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)};
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=t;l[f]=this.lerp(u[a],u[a+3],h);l[f+1]=this.lerp(u[a+1],u[a+4],h);l[f+2]=this.lerp(u[a+2],u[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k;c[f+1]=n+h*this.delta;c[f+
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=t;l[f]=this.lerp(u[a],u[a+3],h);l[f+1]=this.lerp(u[a+1],u[a+4],h);l[f+2]=this.lerp(u[a+2],u[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k;c[f+1]=n+h*this.delta;c[f+
|
|
2]=t;c=a+this.yd*3;l[f]=this.lerp(u[a],u[c],h);l[f+1]=this.lerp(u[a+1],u[c+1],h);l[f+2]=this.lerp(u[a+2],u[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k;c[f+1]=n;c[f+2]=t+h*this.delta;c=a+this.zd*3;l[f]=this.lerp(u[a],u[c],h);l[f+1]=this.lerp(u[a+1],u[c+1],h);l[f+2]=this.lerp(u[a+2],u[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
2]=t;c=a+this.yd*3;l[f]=this.lerp(u[a],u[c],h);l[f+1]=this.lerp(u[a+1],u[c+1],h);l[f+2]=this.lerp(u[a+2],u[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k;c[f+1]=n;c[f+2]=t+h*this.delta;c=a+this.zd*3;l[f]=this.lerp(u[a],u[c],h);l[f+1]=this.lerp(u[a+1],u[c+1],h);l[f+2]=this.lerp(u[a+2],u[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,f,h,k){var n=f+1,t=f+this.yd,u=f+this.zd,p=n+this.yd,x=n+this.zd,v=f+this.yd+this.zd,y=n+this.yd+this.zd,w=0,z=this.field[f],B=this.field[n],C=this.field[t],A=this.field[p],D=this.field[u],K=this.field[x],P=this.field[v],F=this.field[y];z<h&&(w|=1);B<h&&(w|=2);C<h&&(w|=8);A<h&&(w|=4);D<h&&(w|=16);K<h&&(w|=32);P<h&&(w|=128);F<h&&(w|=64);var Q=THREE.edgeTable[w];if(Q===0)return 0;
|
|
|
|
-var H=this.delta,N=a+H,L=c+H,H=l+H;Q&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,z,B));Q&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,N,c,l,B,A));Q&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,L,l,C,A));Q&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,z,C));Q&16&&(this.compNorm(u),this.compNorm(x),this.VIntX(u*3,this.vlist,this.nlist,12,h,a,c,H,D,K));
|
|
|
|
-Q&32&&(this.compNorm(x),this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,h,N,c,H,K,F));Q&64&&(this.compNorm(v),this.compNorm(y),this.VIntX(v*3,this.vlist,this.nlist,18,h,a,L,H,P,F));Q&128&&(this.compNorm(u),this.compNorm(v),this.VIntY(u*3,this.vlist,this.nlist,21,h,a,c,H,D,P));Q&256&&(this.compNorm(f),this.compNorm(u),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,z,D));Q&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,N,c,l,B,K));Q&1024&&(this.compNorm(p),
|
|
|
|
-this.compNorm(y),this.VIntZ(p*3,this.vlist,this.nlist,30,h,N,L,l,A,F));Q&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,L,l,C,P));w<<=4;for(h=f=0;THREE.triTable[w+h]!=-1;)a=w+h,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),h+=3,f++;return f};this.posnormtriv=function(a,c,l,f,h,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
|
|
|
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,f,h,k){var n=f+1,t=f+this.yd,u=f+this.zd,p=n+this.yd,x=n+this.zd,v=f+this.yd+this.zd,y=n+this.yd+this.zd,w=0,A=this.field[f],z=this.field[n],C=this.field[t],B=this.field[p],D=this.field[u],K=this.field[x],O=this.field[v],F=this.field[y];A<h&&(w|=1);z<h&&(w|=2);C<h&&(w|=8);B<h&&(w|=4);D<h&&(w|=16);K<h&&(w|=32);O<h&&(w|=128);F<h&&(w|=64);var P=THREE.edgeTable[w];if(P===0)return 0;
|
|
|
|
+var H=this.delta,M=a+H,J=c+H,H=l+H;P&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,A,z));P&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,M,c,l,z,B));P&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,J,l,C,B));P&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,A,C));P&16&&(this.compNorm(u),this.compNorm(x),this.VIntX(u*3,this.vlist,this.nlist,12,h,a,c,H,D,K));
|
|
|
|
+P&32&&(this.compNorm(x),this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,h,M,c,H,K,F));P&64&&(this.compNorm(v),this.compNorm(y),this.VIntX(v*3,this.vlist,this.nlist,18,h,a,J,H,O,F));P&128&&(this.compNorm(u),this.compNorm(v),this.VIntY(u*3,this.vlist,this.nlist,21,h,a,c,H,D,O));P&256&&(this.compNorm(f),this.compNorm(u),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,A,D));P&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,M,c,l,z,K));P&1024&&(this.compNorm(p),
|
|
|
|
+this.compNorm(y),this.VIntZ(p*3,this.vlist,this.nlist,30,h,M,J,l,B,F));P&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,J,l,C,O));w<<=4;for(h=f=0;THREE.triTable[w+h]!=-1;)a=w+h,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),h+=3,f++;return f};this.posnormtriv=function(a,c,l,f,h,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
|
|
3]=a[f];this.positionArray[n+4]=a[f+1];this.positionArray[n+5]=a[f+2];this.positionArray[n+6]=a[h];this.positionArray[n+7]=a[h+1];this.positionArray[n+8]=a[h+2];this.normalArray[n]=c[l];this.normalArray[n+1]=c[l+1];this.normalArray[n+2]=c[l+2];this.normalArray[n+3]=c[f];this.normalArray[n+4]=c[f+1];this.normalArray[n+5]=c[f+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
3]=a[f];this.positionArray[n+4]=a[f+1];this.positionArray[n+5]=a[f+2];this.positionArray[n+6]=a[h];this.positionArray[n+7]=a[h+1];this.positionArray[n+8]=a[h+2];this.normalArray[n]=c[l];this.normalArray[n+1]=c[l+1];this.normalArray[n+2]=c[l+2];this.normalArray[n+3]=c[f];this.normalArray[n+4]=c[f+1];this.normalArray[n+5]=c[f+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,f,h){var k=this.size*Math.sqrt(f/h),n=l*this.size,t=c*this.size,u=a*this.size,p=Math.floor(n-k);p<1&&(p=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-k);x<1&&(x=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var v=Math.floor(u-k);v<1&&(v=1);k=Math.floor(u+k);
|
|
function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,f,h){var k=this.size*Math.sqrt(f/h),n=l*this.size,t=c*this.size,u=a*this.size,p=Math.floor(n-k);p<1&&(p=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-k);x<1&&(x=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var v=Math.floor(u-k);v<1&&(v=1);k=Math.floor(u+k);
|
|
-k>this.size-1&&(k=this.size-1);for(var y,w,z,B,C,A;p<n;p++){u=this.size2*p;w=p/this.size-l;C=w*w;for(w=x;w<t;w++){z=u+this.size*w;y=w/this.size-c;A=y*y;for(y=v;y<k;y++)B=y/this.size-a,B=f/(1.0E-6+B*B+A+C)-h,B>0&&(this.field[z+y]+=B)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,u=this.yd,p=this.zd,x=this.field,v=t*Math.sqrt(a/c);v>t&&(v=t);for(l=0;l<v;l++)if(f=l/t,f*=f,k=a/(1.0E-4+f)-c,k>0)for(f=0;f<t;f++){n=l+f*u;for(h=0;h<t;h++)x[p*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
|
|
|
|
|
|
+k>this.size-1&&(k=this.size-1);for(var y,w,A,z,C,B;p<n;p++){u=this.size2*p;w=p/this.size-l;C=w*w;for(w=x;w<t;w++){A=u+this.size*w;y=w/this.size-c;B=y*y;for(y=v;y<k;y++)z=y/this.size-a,z=f/(1.0E-6+z*z+B+C)-h,z>0&&(this.field[A+y]+=z)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,u=this.yd,p=this.zd,x=this.field,v=t*Math.sqrt(a/c);v>t&&(v=t);for(l=0;l<v;l++)if(f=l/t,f*=f,k=a/(1.0E-4+f)-c,k>0)for(f=0;f<t;f++){n=l+f*u;for(h=0;h<t;h++)x[p*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
|
|
n,t,u=this.size,p=this.yd,x=this.zd,v=this.field,y=u*Math.sqrt(a/c);y>u&&(y=u);for(f=0;f<y;f++)if(l=f/u,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*p;for(l=0;l<u;l++){t=n+l;for(h=0;h<u;h++)v[x*h+t]+=k}}};this.addPlaneZ=function(a,c){var l,f,h,k,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(l=h/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*h;for(f=0;f<size;f++){t=n+f*yd;for(l=0;l<size;l++)field[t+l]+=k}}};this.reset=function(){var a;for(a=
|
|
n,t,u=this.size,p=this.yd,x=this.zd,v=this.field,y=u*Math.sqrt(a/c);y>u&&(y=u);for(f=0;f<y;f++)if(l=f/u,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*p;for(l=0;l<u;l++){t=n+l;for(h=0;h<u;h++)v[x*h+t]+=k}}};this.addPlaneZ=function(a,c){var l,f,h,k,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(l=h/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*h;for(f=0;f<size;f++){t=n+f*yd;for(l=0;l<size;l++)field[t+l]+=k}}};this.reset=function(){var a;for(a=
|
|
0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,f,h,k,n,t,u,p,x=this.size-2;for(h=1;h<x;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){u=p+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=u+l,this.polygonize(k,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(f){var h,k,n,t,u,p,x,v;for(h=0;h<f.count;h++)x=
|
|
0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,f,h,k,n,t,u,p,x=this.size-2;for(h=1;h<x;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){u=p+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=u+l,this.polygonize(k,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(f){var h,k,n,t,u,p,x,v;for(h=0;h<f.count;h++)x=
|
|
h*3,u=x+1,v=x+2,k=f.positionArray[x],n=f.positionArray[u],t=f.positionArray[v],p=new THREE.Vector3(k,n,t),k=f.normalArray[x],n=f.normalArray[u],t=f.normalArray[v],x=new THREE.Vector3(k,n,t),x.normalize(),u=new THREE.Vertex(p),c.vertices.push(u),l.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,u=x+1,v=x+2,p=l[x],k=l[u],n=l[v],x=new THREE.Face3(x,u,v,[p,k,n]),c.faces.push(x);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
h*3,u=x+1,v=x+2,k=f.positionArray[x],n=f.positionArray[u],t=f.positionArray[v],p=new THREE.Vector3(k,n,t),k=f.normalArray[x],n=f.normalArray[u],t=f.normalArray[v],x=new THREE.Vector3(k,n,t),x.normalize(),u=new THREE.Vertex(p),c.vertices.push(u),l.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,u=x+1,v=x+2,p=l[x],k=l[u],n=l[v],x=new THREE.Face3(x,u,v,[p,k,n]),c.faces.push(x);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
@@ -708,7 +708,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,t,u,p;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),y=new THREE.PerspectiveCamera(53,
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,t,u,p;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),y=new THREE.PerspectiveCamera(53,
|
|
1,1,1E4);y.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
1,1,1E4);y.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
-var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;v.width=a;v.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||u!==b.far||p!==b.fov){n=b.aspect;t=b.near;u=b.far;p=b.fov;var C=b.projectionMatrix.clone(),A=125/30*0.5,D=A*t/125,K=t*Math.tan(p*Math.PI/360),P;h.n14=A;k.n14=-A;A=-K*n+D;P=K*n+D;C.n11=2*t/(P-A);C.n13=(P+A)/(P-A);l.projectionMatrix.copy(C);A=-K*n-D;
|
|
|
|
-P=K*n-D;C.n11=2*t/(P-A);C.n13=(P+A)/(P-A);f.projectionMatrix.copy(C)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,v,!0);w.updateMatrixWorld();e.call(c,w,y)}};
|
|
|
|
|
|
+var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;v.width=a;v.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||u!==b.far||p!==b.fov){n=b.aspect;t=b.near;u=b.far;p=b.fov;var C=b.projectionMatrix.clone(),B=125/30*0.5,D=B*t/125,K=t*Math.tan(p*Math.PI/360),O;h.n14=B;k.n14=-B;B=-K*n+D;O=K*n+D;C.n11=2*t/(O-B);C.n13=(O+B)/(O-B);l.projectionMatrix.copy(C);B=-K*n-D;
|
|
|
|
+O=K*n-D;C.n11=2*t/(O-B);C.n13=(O+B)/(O-B);f.projectionMatrix.copy(C)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,v,!0);w.updateMatrixWorld();e.call(c,w,y)}};
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,f,h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;f=e};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far=
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,f,h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;f=e};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far=
|
|
b.far;h.updateProjectionMatrix();h.position.copy(b.position);h.target.copy(b.target);h.translateX(c.separation);h.lookAt(h.target);k.projectionMatrix=h.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,f);e.call(c,a,h);this.setViewport(l,0,l,f);e.call(c,a,k,!1)}};
|
|
b.far;h.updateProjectionMatrix();h.position.copy(b.position);h.target.copy(b.target);h.translateX(c.separation);h.lookAt(h.target);k.projectionMatrix=h.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,f);e.call(c,a,h);this.setViewport(l,0,l,f);e.call(c,a,k,!1)}};
|