|
@@ -11,33 +11,33 @@ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-th
|
|
this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
|
|
this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
|
|
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(I,v,J,t){t=t.clone().subSelf(v);J=J.clone().subSelf(v);var K=I.clone().subSelf(v);I=t.dot(t);v=t.dot(J);t=t.dot(K);var R=J.dot(J);J=J.dot(K);K=1/(I*R-v*v);R=(R*t-v*J)*K;I=(I*J-v*t)*K;return R>0&&I>0&&R+I<1}var c,d,f,g,h,k,j,m,n,w,
|
|
|
|
-o,p=a.geometry,x=p.vertices,A=[];c=0;for(d=p.faces.length;c<d;c++){f=p.faces[c];w=this.origin.clone();o=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(f.normal.clone());n=o.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(g,w))/n;w=w.addSelf(o.multiplyScalar(m));
|
|
|
|
-if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
|
|
|
|
-THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,n,w){k=!1;b=j;c=m;d=n;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
|
|
|
|
-this.add3Points=function(j,m,n,w,o,p){if(k){k=!1;b=j<n?j<o?j:o:n<o?n:o;c=m<w?m<p?m:p:w<p?w:p;d=j>n?j>o?j:o:n>o?n:o;f=m>w?m>p?m:p:w>p?w:p}else{b=j<n?j<o?j<b?j:b:o<b?o:b:n<o?n<b?n:b:o<b?o:b;c=m<w?m<p?m<c?m:c:p<c?p:c:w<p?w<c?w:c:p<c?p:c;d=j>n?j>o?j>d?j:d:o>d?o:d:n>o?n>d?n:d:o>d?o:d;f=m>w?m>p?m>f?m:f:p>f?p:f:w>p?w>f?w:f:p>f?p:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
|
|
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(E,w,F,u){u=u.clone().subSelf(w);F=F.clone().subSelf(w);var H=E.clone().subSelf(w);E=u.dot(u);w=u.dot(F);u=u.dot(H);var P=F.dot(F);F=F.dot(H);H=1/(E*P-w*w);P=(P*u-w*F)*H;E=(E*F-w*u)*H;return P>0&&E>0&&P+E<1}var c,d,f,g,h,k,j,m,o,y,
|
|
|
|
+p,q=a.geometry,A=q.vertices,C=[];c=0;for(d=q.faces.length;c<d;c++){f=q.faces[c];y=this.origin.clone();p=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(A[f.a].position.clone());h=j.multiplyVector3(A[f.b].position.clone());k=j.multiplyVector3(A[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(A[f.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(f.normal.clone());o=p.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,y))/o;y=y.addSelf(p.multiplyScalar(m));
|
|
|
|
+if(f instanceof THREE.Face3){if(b(y,g,h,k)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};C.push(f)}}else if(f instanceof THREE.Face4&&(b(y,g,h,j)||b(y,h,k,j))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};C.push(f)}}}return C}};
|
|
|
|
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,y){k=!1;b=j;c=m;d=o;f=y;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
|
|
|
|
+this.add3Points=function(j,m,o,y,p,q){if(k){k=!1;b=j<o?j<p?j:p:o<p?o:p;c=m<y?m<q?m:q:y<q?y:q;d=j>o?j>p?j:p:o>p?o:p;f=m>y?m>q?m:q:y>q?y:q}else{b=j<o?j<p?j<b?j:b:p<b?p:b:o<p?o<b?o:b:p<b?p:b;c=m<y?m<q?m<c?m:c:q<c?q:c:y<q?y<c?y:c:q<c?q:c;d=j>o?j>p?j>d?j:d:p>d?p:d:o>p?o>d?o:d:p>d?p:d;f=m>y?m>q?m>f?m:f:q>f?q:f:y>q?y>f?y:f:q>f?q:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
|
|
d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k}};
|
|
d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k}};
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
-THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,n,w,o,p,x,A){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,k||0,j||0,m||0,n||1,w||0,o||0,p||0,x||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,k,j,m,n,w,o,p,x,A){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=n;this.n34=w;this.n41=o;this.n42=p;this.n43=x;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,
|
|
|
|
|
|
+THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,o,y,p,q,A,C){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,k||0,j||0,m||0,o||1,y||0,p||0,q||0,A||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,k,j,m,o,y,p,q,A,C){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=o;this.n34=y;this.n41=p;this.n42=q;this.n43=A;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,
|
|
f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n14=a.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n24=a.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*
|
|
f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n14=a.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n24=a.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*
|
|
b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;
|
|
b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;
|
|
-b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,o=a.n33,p=a.n34,x=a.n41,A=a.n42,I=a.n43,v=a.n44,J=b.n11,t=b.n12,K=b.n13,R=b.n14,e=b.n21,O=b.n22,Q=b.n23,W=b.n24,U=b.n31,aa=b.n32,ea=b.n33,M=b.n34;this.n11=
|
|
|
|
-c*J+d*e+f*U;this.n12=c*t+d*O+f*aa;this.n13=c*K+d*Q+f*ea;this.n14=c*R+d*W+f*M+g;this.n21=h*J+k*e+j*U;this.n22=h*t+k*O+j*aa;this.n23=h*K+k*Q+j*ea;this.n24=h*R+k*W+j*M+m;this.n31=n*J+w*e+o*U;this.n32=n*t+w*O+o*aa;this.n33=n*K+w*Q+o*ea;this.n34=n*R+w*W+o*M+p;this.n41=x*J+A*e+I*U;this.n42=x*t+A*O+I*aa;this.n43=x*K+A*Q+I*ea;this.n44=x*R+A*W+I*M+v;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,n=a.n24,w=a.n31,o=a.n32,p=a.n33,x=a.n34,A=a.n41,I=a.n42,
|
|
|
|
-v=a.n43;a=a.n44;var J=b.n11,t=b.n12,K=b.n13,R=b.n14,e=b.n21,O=b.n22,Q=b.n23,W=b.n24,U=b.n31,aa=b.n32,ea=b.n33,M=b.n34,X=b.n41,pa=b.n42,ba=b.n43;b=b.n44;this.n11=d*J+f*e+g*U+h*X;this.n12=d*t+f*O+g*aa+h*pa;this.n13=d*K+f*Q+g*ea+h*ba;this.n14=d*R+f*W+g*M+h*b;this.n21=k*J+j*e+m*U+n*X;this.n22=k*t+j*O+m*aa+n*pa;this.n23=k*K+j*Q+m*ea+n*ba;this.n24=k*R+j*W+m*M+n*b;this.n31=w*J+o*e+p*U+x*X;this.n32=w*t+o*O+p*aa+x*pa;this.n33=w*K+o*Q+p*ea+x*ba;this.n34=w*R+o*W+p*M+x*b;this.n41=A*J+I*e+v*U+a*X;this.n42=A*t+
|
|
|
|
-I*O+v*aa+a*pa;this.n43=A*K+I*Q+v*ea+a*ba;this.n44=A*R+I*W+v*M+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,n=this.n32,w=this.n33,o=this.n34,p=this.n41,x=this.n42,A=this.n43,
|
|
|
|
-I=this.n44,v=a.n11,J=a.n21,t=a.n31,K=a.n12,R=a.n22,e=a.n32,O=a.n13,Q=a.n23,W=a.n33,U=a.n14,aa=a.n24;a=a.n34;this.n11=b*v+c*J+d*t;this.n12=b*K+c*R+d*e;this.n13=b*O+c*Q+d*W;this.n14=b*U+c*aa+d*a+f;this.n21=g*v+h*J+k*t;this.n22=g*K+h*R+k*e;this.n23=g*O+h*Q+k*W;this.n24=g*U+h*aa+k*a+j;this.n31=m*v+n*J+w*t;this.n32=m*K+n*R+w*e;this.n33=m*O+n*Q+w*W;this.n34=m*U+n*aa+w*a+o;this.n41=p*v+x*J+A*t;this.n42=p*K+x*R+A*e;this.n43=p*O+x*Q+A*W;this.n44=p*U+x*aa+A*a+I;return this},multiplyScalar:function(a){this.n11*=
|
|
|
|
-a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,n=this.n33,w=this.n34,o=this.n41,p=this.n42,x=this.n43,A=this.n44;return d*h*m*o-c*k*m*o-d*g*n*o+b*k*n*o+c*g*w*o-b*h*w*o-d*h*j*p+c*k*j*p+d*f*n*p-a*k*n*p-c*f*w*p+a*h*w*p+
|
|
|
|
-d*g*j*x-b*k*j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*A+b*h*j*A+c*f*m*A-a*h*m*A-b*f*n*A+a*g*n*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;
|
|
|
|
|
|
+b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,y=a.n32,p=a.n33,q=a.n34,A=a.n41,C=a.n42,E=a.n43,w=a.n44,F=b.n11,u=b.n12,H=b.n13,P=b.n14,e=b.n21,M=b.n22,N=b.n23,W=b.n24,S=b.n31,aa=b.n32,ca=b.n33,K=b.n34;this.n11=
|
|
|
|
+c*F+d*e+f*S;this.n12=c*u+d*M+f*aa;this.n13=c*H+d*N+f*ca;this.n14=c*P+d*W+f*K+g;this.n21=h*F+k*e+j*S;this.n22=h*u+k*M+j*aa;this.n23=h*H+k*N+j*ca;this.n24=h*P+k*W+j*K+m;this.n31=o*F+y*e+p*S;this.n32=o*u+y*M+p*aa;this.n33=o*H+y*N+p*ca;this.n34=o*P+y*W+p*K+q;this.n41=A*F+C*e+E*S;this.n42=A*u+C*M+E*aa;this.n43=A*H+C*N+E*ca;this.n44=A*P+C*W+E*K+w;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,y=a.n31,p=a.n32,q=a.n33,A=a.n34,C=a.n41,E=a.n42,
|
|
|
|
+w=a.n43;a=a.n44;var F=b.n11,u=b.n12,H=b.n13,P=b.n14,e=b.n21,M=b.n22,N=b.n23,W=b.n24,S=b.n31,aa=b.n32,ca=b.n33,K=b.n34,Y=b.n41,oa=b.n42,ba=b.n43;b=b.n44;this.n11=d*F+f*e+g*S+h*Y;this.n12=d*u+f*M+g*aa+h*oa;this.n13=d*H+f*N+g*ca+h*ba;this.n14=d*P+f*W+g*K+h*b;this.n21=k*F+j*e+m*S+o*Y;this.n22=k*u+j*M+m*aa+o*oa;this.n23=k*H+j*N+m*ca+o*ba;this.n24=k*P+j*W+m*K+o*b;this.n31=y*F+p*e+q*S+A*Y;this.n32=y*u+p*M+q*aa+A*oa;this.n33=y*H+p*N+q*ca+A*ba;this.n34=y*P+p*W+q*K+A*b;this.n41=C*F+E*e+w*S+a*Y;this.n42=C*u+
|
|
|
|
+E*M+w*aa+a*oa;this.n43=C*H+E*N+w*ca+a*ba;this.n44=C*P+E*W+w*K+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,y=this.n33,p=this.n34,q=this.n41,A=this.n42,C=this.n43,
|
|
|
|
+E=this.n44,w=a.n11,F=a.n21,u=a.n31,H=a.n12,P=a.n22,e=a.n32,M=a.n13,N=a.n23,W=a.n33,S=a.n14,aa=a.n24;a=a.n34;this.n11=b*w+c*F+d*u;this.n12=b*H+c*P+d*e;this.n13=b*M+c*N+d*W;this.n14=b*S+c*aa+d*a+f;this.n21=g*w+h*F+k*u;this.n22=g*H+h*P+k*e;this.n23=g*M+h*N+k*W;this.n24=g*S+h*aa+k*a+j;this.n31=m*w+o*F+y*u;this.n32=m*H+o*P+y*e;this.n33=m*M+o*N+y*W;this.n34=m*S+o*aa+y*a+p;this.n41=q*w+A*F+C*u;this.n42=q*H+A*P+C*e;this.n43=q*M+A*N+C*W;this.n44=q*S+A*aa+C*a+E;return this},multiplyScalar:function(a){this.n11*=
|
|
|
|
+a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,y=this.n34,p=this.n41,q=this.n42,A=this.n43,C=this.n44;return d*h*m*p-c*k*m*p-d*g*o*p+b*k*o*p+c*g*y*p-b*h*y*p-d*h*j*q+c*k*j*q+d*f*o*q-a*k*o*q-c*f*y*q+a*h*y*q+
|
|
|
|
+d*g*j*A-b*k*j*A-d*f*m*A+a*k*m*A+b*f*y*A-a*g*y*A-c*g*j*C+b*h*j*C+c*f*m*C-a*h*m*C-b*f*o*C+a*g*o*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;
|
|
a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,
|
|
a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,
|
|
b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
|
|
b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=
|
|
a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,k=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=
|
|
a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,k=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=
|
|
b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};
|
|
b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};
|
|
THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
|
|
THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
|
|
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,o=a.n33,p=a.n34,x=a.n41,A=a.n42,I=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*p*A-m*o*A+m*w*I-k*p*I-j*w*v+k*o*v;b.n12=g*o*A-f*p*A-g*w*I+d*p*I+f*w*v-d*o*v;b.n13=f*m*A-g*j*A+g*k*I-d*m*I-f*k*v+d*j*v;b.n14=g*j*w-f*m*w-g*k*o+d*m*o+f*k*p-d*j*p;b.n21=m*o*x-j*p*x-m*n*I+h*p*I+j*n*v-h*o*v;b.n22=f*p*x-g*o*x+g*n*I-c*p*I-f*n*v+c*o*v;b.n23=g*j*x-f*m*x-g*h*I+c*m*I+f*h*v-c*j*v;
|
|
|
|
-b.n24=f*m*n-g*j*n+g*h*o-c*m*o-f*h*p+c*j*p;b.n31=k*p*x-m*w*x+m*n*A-h*p*A-k*n*v+h*w*v;b.n32=g*w*x-d*p*x-g*n*A+c*p*A+d*n*v-c*w*v;b.n33=f*m*x-g*k*x+g*h*A-c*m*A-d*h*v+c*k*v;b.n34=g*k*n-d*m*n-g*h*w+c*m*w+d*h*p-c*k*p;b.n41=j*w*x-k*o*x-j*n*A+h*o*A+k*n*I-h*w*I;b.n42=d*o*x-f*w*x+f*n*A-c*o*A-d*n*I+c*w*I;b.n43=f*k*x-d*j*x-f*h*A+c*j*A+d*h*I-c*k*I;b.n44=d*j*n-f*k*n+f*h*w-c*j*w-d*h*o+c*k*o;b.multiplyScalar(1/a.determinant());return b};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*w;return b};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,y=a.n32,p=a.n33,q=a.n34,A=a.n41,C=a.n42,E=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*q*C-m*p*C+m*y*E-k*q*E-j*y*w+k*p*w;b.n12=g*p*C-f*q*C-g*y*E+d*q*E+f*y*w-d*p*w;b.n13=f*m*C-g*j*C+g*k*E-d*m*E-f*k*w+d*j*w;b.n14=g*j*y-f*m*y-g*k*p+d*m*p+f*k*q-d*j*q;b.n21=m*p*A-j*q*A-m*o*E+h*q*E+j*o*w-h*p*w;b.n22=f*q*A-g*p*A+g*o*E-c*q*E-f*o*w+c*p*w;b.n23=g*j*A-f*m*A-g*h*E+c*m*E+f*h*w-c*j*w;
|
|
|
|
+b.n24=f*m*o-g*j*o+g*h*p-c*m*p-f*h*q+c*j*q;b.n31=k*q*A-m*y*A+m*o*C-h*q*C-k*o*w+h*y*w;b.n32=g*y*A-d*q*A-g*o*C+c*q*C+d*o*w-c*y*w;b.n33=f*m*A-g*k*A+g*h*C-c*m*C-d*h*w+c*k*w;b.n34=g*k*o-d*m*o-g*h*y+c*m*y+d*h*q-c*k*q;b.n41=j*y*A-k*p*A-j*o*C+h*p*C+k*o*E-h*y*E;b.n42=d*p*A-f*y*A+f*o*C-c*p*C-d*o*E+c*y*E;b.n43=f*k*A-d*j*A-f*h*C+c*j*C+d*h*E-c*k*E;b.n44=d*j*o-f*k*o+f*h*y-c*j*y-d*h*p+c*k*p;b.multiplyScalar(1/a.determinant());return b};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*o;c[8]=a*y;return b};
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
|
|
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
|
|
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
|
|
@@ -48,7 +48,7 @@ this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.
|
|
THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
|
|
THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
|
|
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},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*=
|
|
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this},
|
|
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this},
|
|
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,n=j*d+k*c-g*f,w=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+n*-k-w*-h;b.y=n*j+c*-h+w*-g-m*-k;b.z=w*j+c*-k+m*-h-n*-g;return b}};
|
|
|
|
|
|
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,o=j*d+k*c-g*f,y=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+o*-k-y*-h;b.y=o*j+c*-h+y*-g-m*-k;b.z=y*j+c*-k+m*-h-o*-g;return b}};
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
|
|
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
|
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
|
THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
|
|
THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
|
|
@@ -57,21 +57,21 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
|
|
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
|
|
c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
|
|
c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
|
|
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(M,X,pa,ba,la,ia,ga){g=M.vertices[X].position;h=M.vertices[pa].position;k=M.vertices[ba].position;j=f[la];m=f[ia];n=f[ga];w=h.x-g.x;o=k.x-g.x;p=h.y-g.y;
|
|
|
|
-x=k.y-g.y;A=h.z-g.z;I=k.z-g.z;v=m.u-j.u;J=n.u-j.u;t=m.v-j.v;K=n.v-j.v;R=1/(v*K-J*t);Q.set((K*w-t*o)*R,(K*p-t*x)*R,(K*A-t*I)*R);W.set((v*o-J*w)*R,(v*x-J*p)*R,(v*I-J*A)*R);e[X].addSelf(Q);e[pa].addSelf(Q);e[ba].addSelf(Q);O[X].addSelf(W);O[pa].addSelf(W);O[ba].addSelf(W)}var b,c,d,f,g,h,k,j,m,n,w,o,p,x,A,I,v,J,t,K,R,e=[],O=[],Q=new THREE.Vector3,W=new THREE.Vector3,U=new THREE.Vector3,aa=new THREE.Vector3,ea=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){e[b]=new THREE.Vector3;O[b]=new THREE.Vector3}b=
|
|
|
|
|
|
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(K,Y,oa,ba,la,ia,ga){g=K.vertices[Y].position;h=K.vertices[oa].position;k=K.vertices[ba].position;j=f[la];m=f[ia];o=f[ga];y=h.x-g.x;p=k.x-g.x;q=h.y-g.y;
|
|
|
|
+A=k.y-g.y;C=h.z-g.z;E=k.z-g.z;w=m.u-j.u;F=o.u-j.u;u=m.v-j.v;H=o.v-j.v;P=1/(w*H-F*u);N.set((H*y-u*p)*P,(H*q-u*A)*P,(H*C-u*E)*P);W.set((w*p-F*y)*P,(w*A-F*q)*P,(w*E-F*C)*P);e[Y].addSelf(N);e[oa].addSelf(N);e[ba].addSelf(N);M[Y].addSelf(W);M[oa].addSelf(W);M[ba].addSelf(W)}var b,c,d,f,g,h,k,j,m,o,y,p,q,A,C,E,w,F,u,H,P,e=[],M=[],N=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3,aa=new THREE.Vector3,ca=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){e[b]=new THREE.Vector3;M[b]=new THREE.Vector3}b=
|
|
0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
|
|
0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
|
|
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ea.copy(this.vertices[b].normal);d=e[b];U.copy(d);U.subSelf(ea.multiplyScalar(ea.dot(d))).normalize();aa.cross(this.vertices[b].normal,d);d=aa.dot(O[b]);d=d<0?-1:1;this.vertices[b].tangent.set(U.x,U.y,U.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
|
|
|
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ca.copy(this.vertices[b].normal);d=e[b];S.copy(d);S.subSelf(ca.multiplyScalar(ca.dot(d))).normalize();aa.cross(this.vertices[b].normal,d);d=aa.dot(M[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
-THREE.Spline=function(){function a(o,p,x,A,I,v,J){o=(x-o)*0.5;A=(A-p)*0.5;return(2*(p-x)+o+A)*J+(-3*(p-x)-2*o-A)*v+o*I+p}var b=[],c={x:0,y:0,z:0},d,f,g,h,k,j,m,n,w;this.get2DPoint=function(o,p){d=(o.length-1)*p;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>o.length-2?f:f+1;b[3]=f>o.length-3?f:f+2;j=o[b[0]];m=o[b[1]];n=o[b[2]];w=o[b[3]];h=g*g;k=g*h;c.x=a(j.x,m.x,n.x,w.x,g,h,k);c.y=a(j.y,m.y,n.y,w.y,g,h,k);c.z=a(j.z,m.z,n.z,w.z,g,h,k);return c}};
|
|
|
|
|
|
+THREE.Spline=function(){function a(p,q,A,C,E,w,F){p=(A-p)*0.5;C=(C-q)*0.5;return(2*(q-A)+p+C)*F+(-3*(q-A)-2*p-C)*w+p*E+q}var b=[],c={x:0,y:0,z:0},d,f,g,h,k,j,m,o,y;this.get2DPoint=function(p,q){d=(p.length-1)*q;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>p.length-2?f:f+1;b[3]=f>p.length-3?f:f+2;j=p[b[0]];m=p[b[1]];o=p[b[2]];y=p[b[3]];h=g*g;k=g*h;c.x=a(j.x,m.x,o.x,y.x,g,h,k);c.y=a(j.y,m.y,o.y,y.y,g,h,k);c.z=a(j.z,m.z,o.z,y.z,g,h,k);return c}};
|
|
THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
|
|
THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
|
|
THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
|
|
THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
|
|
THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
|
|
THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
|
|
THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.001;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.001;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
-THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.001-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.001-j;j=(new Date).getTime()*0.001-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var n=0,w=this.hierarchy.length;n<w;n++){g=this.hierarchy[n];if(k[n][h]!==undefined){g.skinMatrix=
|
|
|
|
-k[n][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,n*16)}else for(var o=0;o<3;o++){c=a[o];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[n].keys[0];f=this.getNextKeyWith(c,n,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,n,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=f[c];if(c==="rot"){if(b<
|
|
|
|
-0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)k[n][h]=this.hierarchy[n].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.001-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.001-j;j=(new Date).getTime()*0.001-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,y=this.hierarchy.length;o<y;o++){g=this.hierarchy[o];if(k[o][h]!==undefined){g.skinMatrix=
|
|
|
|
+k[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var p=0;p<3;p++){c=a[p];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=f[c];if(c==="rot"){if(b<
|
|
|
|
+0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
|
|
THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
|
|
this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
@@ -133,128 +133,127 @@ THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();
|
|
THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
|
|
THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
|
|
THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(a>=this.LODs[d].visibleAtDistance){this.LODs[d-1].object3D.visible=!1;this.LODs[d].object3D.visible=
|
|
THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(a>=this.LODs[d].visibleAtDistance){this.LODs[d-1].object3D.visible=!1;this.LODs[d].object3D.visible=
|
|
-!0}else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
-THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
|
|
|
|
-THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
|
|
|
|
+!0}else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
|
|
|
|
+THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
-THREE.Projector=function(){function a(O,Q){return Q.z-O.z}function b(O,Q){var W=0,U=1,aa=O.z+O.w,ea=Q.z+Q.w,M=-O.z+O.w,X=-Q.z+Q.w;if(aa>=0&&ea>=0&&M>=0&&X>=0)return!0;else if(aa<0&&ea<0||M<0&&X<0)return!1;else{if(aa<0)W=Math.max(W,aa/(aa-ea));else ea<0&&(U=Math.min(U,aa/(aa-ea)));if(M<0)W=Math.max(W,M/(M-X));else X<0&&(U=Math.min(U,M/(M-X)));if(U<W)return!1;else{O.lerpSelf(Q,W);Q.lerpSelf(O,1-U);return!0}}}var c,d,f=[],g,h,k,j=[],m,n,w=[],o,p,x=[],A=new THREE.Vector4,I=new THREE.Vector4,v=new THREE.Matrix4,
|
|
|
|
-J=new THREE.Matrix4,t=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,R=new THREE.Vector4,e;this.projectObjects=function(O,Q,W){Q=[];var U,aa,ea;d=0;aa=O.objects;O=0;for(U=aa.length;O<U;O++){ea=aa[O];var M;if(!(M=!ea.visible))if(M=ea instanceof THREE.Mesh){a:{M=void 0;for(var X=ea.matrixWorld,pa=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),ba=0;ba<6;ba++){M=t[ba].x*X.n14+t[ba].y*
|
|
|
|
-X.n24+t[ba].z*X.n34+t[ba].w;if(M<=pa){M=!1;break a}}M=!0}M=!M}if(!M){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(ea.position);v.multiplyVector3(A);c.object=ea;c.z=A.z;Q.push(c);d++}}W&&Q.sort(a);return Q};this.projectScene=function(O,Q,W){var U=[],aa=Q.near,ea=Q.far,M,X,pa,ba,la,ia,ga,ua,xa,l,z,B,u,q,E,C;k=n=p=0;Q.matrixAutoUpdate&&Q.update();v.multiply(Q.projectionMatrix,Q.matrixWorldInverse);t[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);t[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,
|
|
|
|
-v.n44+v.n14);t[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);t[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);t[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);t[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(M=0;M<6;M++){ia=t[M];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}O.update(undefined,!1,Q);ia=this.projectObjects(O,Q,!0);O=0;for(M=ia.length;O<M;O++){ga=ia[O].object;if(ga.visible){ua=ga.matrixWorld;z=ga.matrixRotationWorld;xa=ga.materials;
|
|
|
|
-l=ga.overdraw;if(ga instanceof THREE.Mesh){B=ga.geometry;u=B.vertices;X=0;for(pa=u.length;X<pa;X++){q=u[X];q.positionWorld.copy(q.position);ua.multiplyVector3(q.positionWorld);ba=q.positionScreen;ba.copy(q.positionWorld);v.multiplyVector4(ba);ba.x/=ba.w;ba.y/=ba.w;q.__visible=ba.z>aa&&ba.z<ea}B=B.faces;X=0;for(pa=B.length;X<pa;X++){q=B[X];if(q instanceof THREE.Face3){ba=u[q.a];la=u[q.b];E=u[q.c];if(ba.__visible&&la.__visible&&E.__visible&&(ga.doubleSided||ga.flipSided!=(E.positionScreen.x-ba.positionScreen.x)*
|
|
|
|
-(la.positionScreen.y-ba.positionScreen.y)-(E.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(q.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(q.centroid);
|
|
|
|
-ua.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);E=q.vertexNormals;e=g.vertexNormalsWorld;ba=0;for(la=E.length;ba<la;ba++){C=e[ba]=e[ba]||new THREE.Vector3;C.copy(E[ba]);z.multiplyVector3(C)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=q.materials;g.overdraw=l;if(ga.geometry.uvs[X]){g.uvs[0]=ga.geometry.uvs[X][0];g.uvs[1]=ga.geometry.uvs[X][1];g.uvs[2]=ga.geometry.uvs[X][2]}U.push(g);k++}}else if(q instanceof THREE.Face4){ba=
|
|
|
|
-u[q.a];la=u[q.b];E=u[q.c];C=u[q.d];if(ba.__visible&&la.__visible&&E.__visible&&C.__visible&&(ga.doubleSided||ga.flipSided!=((C.positionScreen.x-ba.positionScreen.x)*(la.positionScreen.y-ba.positionScreen.y)-(C.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0||(la.positionScreen.x-E.positionScreen.x)*(C.positionScreen.y-E.positionScreen.y)-(la.positionScreen.y-E.positionScreen.y)*(C.positionScreen.x-E.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);
|
|
|
|
-g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(C.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(C.positionScreen);g.normalWorld.copy(q.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(q.centroid);ua.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=q.materials;g.overdraw=
|
|
|
|
-l;if(ga.geometry.uvs[X]){g.uvs[0]=ga.geometry.uvs[X][0];g.uvs[1]=ga.geometry.uvs[X][1];g.uvs[2]=ga.geometry.uvs[X][3]}U.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(la.positionWorld);h.v2.positionWorld.copy(E.positionWorld);h.v3.positionWorld.copy(C.positionWorld);h.v1.positionScreen.copy(la.positionScreen);h.v2.positionScreen.copy(E.positionScreen);h.v3.positionScreen.copy(C.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
|
|
|
|
-h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=q.materials;h.overdraw=l;if(ga.geometry.uvs[X]){h.uvs[0]=ga.geometry.uvs[X][1];h.uvs[1]=ga.geometry.uvs[X][2];h.uvs[2]=ga.geometry.uvs[X][3]}U.push(h);k++}}}}else if(ga instanceof THREE.Line){J.multiply(v,ua);u=ga.geometry.vertices;q=u[0];q.positionScreen.copy(q.position);J.multiplyVector4(q.positionScreen);X=1;for(pa=u.length;X<pa;X++){ba=u[X];ba.positionScreen.copy(ba.position);J.multiplyVector4(ba.positionScreen);la=u[X-1];K.copy(ba.positionScreen);
|
|
|
|
-R.copy(la.positionScreen);if(b(K,R)){K.multiplyScalar(1/K.w);R.multiplyScalar(1/R.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(K);m.v2.positionScreen.copy(R);m.z=Math.max(K.z,R.z);m.materials=ga.materials;U.push(m);n++}}}else if(ga instanceof THREE.Particle){I.set(ga.position.x,ga.position.y,ga.position.z,1);v.multiplyVector4(I);I.z/=I.w;if(I.z>0&&I.z<1){o=x[p]=x[p]||new THREE.RenderableParticle;o.x=I.x/I.w;o.y=I.y/I.w;o.z=I.z;o.rotation=ga.rotation.z;o.scale.x=ga.scale.x*Math.abs(o.x-
|
|
|
|
-(I.x+Q.projectionMatrix.n11)/(I.w+Q.projectionMatrix.n14));o.scale.y=ga.scale.y*Math.abs(o.y-(I.y+Q.projectionMatrix.n22)/(I.w+Q.projectionMatrix.n24));o.materials=ga.materials;U.push(o);p++}}}}W&&U.sort(a);return U};this.unprojectVector=function(O,Q){var W=Q.matrixWorld.clone();W.multiplySelf(THREE.Matrix4.makeInvert(Q.projectionMatrix));W.multiplyVector3(O);return O}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,o,p,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){o=a[j];if(o instanceof THREE.RenderableParticle){x=o.x*f+f;A=o.y*g+g;n=0;for(w=o.material.length;n<w;n++){p=o.material[n];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=x+"px";p.style.top=A+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){function a(ha){if(o!=ha)m.globalAlpha=o=ha}function b(ha){if(p!=ha){switch(ha){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}p=ha}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),n=new THREE.Color(0),w=0,o=1,p=0,x=null,A=null,I=1,v,J,t,K,R,e,O,Q,W,U=new THREE.Color,
|
|
|
|
-aa=new THREE.Color,ea=new THREE.Color,M=new THREE.Color,X=new THREE.Color,pa,ba,la,ia,ga,ua,xa,l,z,B=new THREE.Rectangle,u=new THREE.Rectangle,q=new THREE.Rectangle,E=!1,C=new THREE.Color,G=new THREE.Color,H=new THREE.Color,y=new THREE.Color,D=Math.PI*2,F=new THREE.Vector3,T,P,fa,ka,ra,na,ma=16;T=document.createElement("canvas");T.width=T.height=2;P=T.getContext("2d");P.fillStyle="rgba(0,0,0,1)";P.fillRect(0,0,2,2);fa=P.getImageData(0,0,2,2);ka=fa.data;ra=document.createElement("canvas");ra.width=
|
|
|
|
-ra.height=ma;na=ra.getContext("2d");na.translate(-ma/2,-ma/2);na.scale(ma,ma);ma--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ha,Ca){g=ha;h=Ca;k=g/2;j=h/2;f.width=g;f.height=h;B.set(-k,-j,k,j);o=1;p=0;A=x=null;I=1};this.setClearColor=function(ha,Ca){n=ha;w=Ca;u.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(ha,Ca){n.setHex(ha);w=Ca;u.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=
|
|
|
|
-function(){m.setTransform(1,0,0,-1,k,j);if(!u.isEmpty()){u.inflate(1);u.minSelf(B);if(n.hex==0&&w==0)m.clearRect(u.getX(),u.getY(),u.getWidth(),u.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+w+")";m.fillRect(u.getX(),u.getY(),u.getWidth(),u.getHeight())}u.empty()}};this.render=function(ha,Ca){function S(L){var ja,ca,V,Y=L.lights;G.setRGB(0,0,0);H.setRGB(0,0,0);y.setRGB(0,0,0);L=0;for(ja=Y.length;L<ja;L++){ca=
|
|
|
|
-Y[L];V=ca.color;if(ca instanceof THREE.AmbientLight){G.r+=V.r;G.g+=V.g;G.b+=V.b}else if(ca instanceof THREE.DirectionalLight){H.r+=V.r;H.g+=V.g;H.b+=V.b}else if(ca instanceof THREE.PointLight){y.r+=V.r;y.g+=V.g;y.b+=V.b}}}function Ga(L,ja,ca,V){var Y,qa,Da,Ea,Ia=L.lights;L=0;for(Y=Ia.length;L<Y;L++){qa=Ia[L];Da=qa.color;Ea=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=ca.dot(qa.position)*Ea;if(qa>0){V.r+=Da.r*qa;V.g+=Da.g*qa;V.b+=Da.b*qa}}else if(qa instanceof THREE.PointLight){F.sub(qa.position,
|
|
|
|
-ja);F.normalize();qa=ca.dot(F)*Ea;if(qa>0){V.r+=Da.r*qa;V.g+=Da.g*qa;V.b+=Da.b*qa}}}}function Ha(L,ja,ca){if(ca.opacity!=0){a(ca.opacity);b(ca.blending);var V,Y,qa,Da,Ea,Ia;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map){Da=ca.map.image;Ea=Da.width>>1;Ia=Da.height>>1;Y=ja.scale.x*k;qa=ja.scale.y*j;ca=Y*Ea;V=qa*Ia;q.set(L.x-ca,L.y-V,L.x+ca,L.y+V);if(B.instersects(q)){m.save();m.translate(L.x,L.y);m.rotate(-ja.rotation);m.scale(Y,-qa);m.translate(-Ea,-Ia);m.drawImage(Da,0,0);m.restore()}}}else if(ca instanceof
|
|
|
|
-THREE.ParticleCircleMaterial){if(E){C.r=G.r+H.r+y.r;C.g=G.g+H.g+y.g;C.b=G.b+H.b+y.b;U.r=ca.color.r*C.r;U.g=ca.color.g*C.g;U.b=ca.color.b*C.b;U.updateStyleString()}else U.__styleString=ca.color.__styleString;ca=ja.scale.x*k;V=ja.scale.y*j;q.set(L.x-ca,L.y-V,L.x+ca,L.y+V);if(B.instersects(q)){Y=U.__styleString;if(A!=Y)m.fillStyle=A=Y;m.save();m.translate(L.x,L.y);m.rotate(-ja.rotation);m.scale(ca,V);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function La(L,ja,ca,V){if(V.opacity!=
|
|
|
|
-0){a(V.opacity);b(V.blending);m.beginPath();m.moveTo(L.positionScreen.x,L.positionScreen.y);m.lineTo(ja.positionScreen.x,ja.positionScreen.y);m.closePath();if(V instanceof THREE.LineBasicMaterial){U.__styleString=V.color.__styleString;L=V.linewidth;if(I!=L)m.lineWidth=I=L;L=U.__styleString;if(x!=L)m.strokeStyle=x=L;m.stroke();q.inflate(V.linewidth*2)}}}function da(L,ja,ca,V,Y,qa){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);K=L.positionScreen.x;R=L.positionScreen.y;e=ja.positionScreen.x;O=ja.positionScreen.y;
|
|
|
|
-Q=ca.positionScreen.x;W=ca.positionScreen.y;m.beginPath();m.moveTo(K,R);m.lineTo(e,O);m.lineTo(Q,W);m.lineTo(K,R);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.mapping instanceof THREE.UVMapping&&sa(K,R,e,O,Q,W,Y.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);else if(Y.envMap){if(Y.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=Ca.matrixWorldInverse;F.copy(V.vertexNormalsWorld[0]);ia=(F.x*L.n11+F.y*L.n12+F.z*L.n13)*0.5+0.5;ga=-(F.x*
|
|
|
|
-L.n21+F.y*L.n22+F.z*L.n23)*0.5+0.5;F.copy(V.vertexNormalsWorld[1]);ua=(F.x*L.n11+F.y*L.n12+F.z*L.n13)*0.5+0.5;xa=-(F.x*L.n21+F.y*L.n22+F.z*L.n23)*0.5+0.5;F.copy(V.vertexNormalsWorld[2]);l=(F.x*L.n11+F.y*L.n12+F.z*L.n13)*0.5+0.5;z=-(F.x*L.n21+F.y*L.n22+F.z*L.n23)*0.5+0.5;sa(K,R,e,O,Q,W,Y.envMap.image,ia,ga,ua,xa,l,z)}}else Y.wireframe?Z(Y.color.__styleString,Y.wireframeLinewidth):$(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof
|
|
|
|
-THREE.UVMapping&&sa(K,R,e,O,Q,W,Y.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3){aa.r=ea.r=M.r=G.r;aa.g=ea.g=M.g=G.g;aa.b=ea.b=M.b=G.b;Ga(qa,V.v1.positionWorld,V.vertexNormalsWorld[0],aa);Ga(qa,V.v2.positionWorld,V.vertexNormalsWorld[1],ea);Ga(qa,V.v3.positionWorld,V.vertexNormalsWorld[2],M);X.r=(ea.r+M.r)*0.5;X.g=(ea.g+M.g)*0.5;X.b=(ea.b+M.b)*0.5;la=Ja(aa,
|
|
|
|
-ea,M,X);sa(K,R,e,O,Q,W,la,0,0,1,0,0,1)}else{C.r=G.r;C.g=G.g;C.b=G.b;Ga(qa,V.centroidWorld,V.normalWorld,C);U.r=Y.color.r*C.r;U.g=Y.color.g*C.g;U.b=Y.color.b*C.b;U.updateStyleString();Y.wireframe?Z(U.__styleString,Y.wireframeLinewidth):$(U.__styleString)}else Y.wireframe?Z(Y.color.__styleString,Y.wireframeLinewidth):$(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){pa=Ca.near;ba=Ca.far;aa.r=aa.g=aa.b=1-Aa(L.positionScreen.z,pa,ba);ea.r=ea.g=ea.b=1-Aa(ja.positionScreen.z,pa,ba);
|
|
|
|
-M.r=M.g=M.b=1-Aa(ca.positionScreen.z,pa,ba);X.r=(ea.r+M.r)*0.5;X.g=(ea.g+M.g)*0.5;X.b=(ea.b+M.b)*0.5;la=Ja(aa,ea,M,X);sa(K,R,e,O,Q,W,la,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){U.r=N(V.normalWorld.x);U.g=N(V.normalWorld.y);U.b=N(V.normalWorld.z);U.updateStyleString();Y.wireframe?Z(U.__styleString,Y.wireframeLinewidth):$(U.__styleString)}}}function Z(L,ja){if(x!=L)m.strokeStyle=x=L;if(I!=ja)m.lineWidth=I=ja;m.stroke();q.inflate(ja*2)}function $(L){if(A!=L)m.fillStyle=A=L;m.fill()}
|
|
|
|
-function sa(L,ja,ca,V,Y,qa,Da,Ea,Ia,Ma,Ka,Fa,Sa){var Na,Oa;Na=Da.width-1;Oa=Da.height-1;Ea*=Na;Ia*=Oa;Ma*=Na;Ka*=Oa;Fa*=Na;Sa*=Oa;ca-=L;V-=ja;Y-=L;qa-=ja;Ma-=Ea;Ka-=Ia;Fa-=Ea;Sa-=Ia;Na=Ma*Sa-Fa*Ka;if(Na!=0){Oa=1/Na;Na=(Sa*ca-Ka*Y)*Oa;Ka=(Sa*V-Ka*qa)*Oa;ca=(Ma*Y-Fa*ca)*Oa;V=(Ma*qa-Fa*V)*Oa;L=L-Na*Ea-ca*Ia;ja=ja-Ka*Ea-V*Ia;m.save();m.transform(Na,Ka,ca,V,L,ja);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ja(L,ja,ca,V){var Y=~~(L.r*255),qa=~~(L.g*255);L=~~(L.b*255);var Da=~~(ja.r*255),Ea=~~(ja.g*
|
|
|
|
-255);ja=~~(ja.b*255);var Ia=~~(ca.r*255),Ma=~~(ca.g*255);ca=~~(ca.b*255);var Ka=~~(V.r*255),Fa=~~(V.g*255);V=~~(V.b*255);ka[0]=Y<0?0:Y>255?255:Y;ka[1]=qa<0?0:qa>255?255:qa;ka[2]=L<0?0:L>255?255:L;ka[4]=Da<0?0:Da>255?255:Da;ka[5]=Ea<0?0:Ea>255?255:Ea;ka[6]=ja<0?0:ja>255?255:ja;ka[8]=Ia<0?0:Ia>255?255:Ia;ka[9]=Ma<0?0:Ma>255?255:Ma;ka[10]=ca<0?0:ca>255?255:ca;ka[12]=Ka<0?0:Ka>255?255:Ka;ka[13]=Fa<0?0:Fa>255?255:Fa;ka[14]=V<0?0:V>255?255:V;P.putImageData(fa,0,0);na.drawImage(T,0,0);return ra}function Aa(L,
|
|
|
|
-ja,ca){L=(L-ja)/(ca-ja);return L*L*(3-2*L)}function N(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Ba(L,ja){var ca=ja.x-L.x,V=ja.y-L.y,Y=1/Math.sqrt(ca*ca+V*V);ca*=Y;V*=Y;ja.x+=ca;ja.y+=V;L.x-=ca;L.y-=V}var Pa,Ta,ta,oa,za,wa,ya,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ha,Ca,this.sortElements);(E=ha.lights.length>0)&&S(ha);Pa=0;for(Ta=c.length;Pa<Ta;Pa++){ta=c[Pa];q.empty();if(ta instanceof THREE.RenderableParticle){v=ta;v.x*=k;v.y*=j;oa=0;for(za=ta.materials.length;oa<
|
|
|
|
-za;oa++)Ha(v,ta,ta.materials[oa],ha)}else if(ta instanceof THREE.RenderableLine){v=ta.v1;J=ta.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;J.positionScreen.x*=k;J.positionScreen.y*=j;q.addPoint(v.positionScreen.x,v.positionScreen.y);q.addPoint(J.positionScreen.x,J.positionScreen.y);if(B.instersects(q)){oa=0;for(za=ta.materials.length;oa<za;)La(v,J,ta,ta.materials[oa++],ha)}}else if(ta instanceof THREE.RenderableFace3){v=ta.v1;J=ta.v2;t=ta.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;J.positionScreen.x*=
|
|
|
|
-k;J.positionScreen.y*=j;t.positionScreen.x*=k;t.positionScreen.y*=j;if(ta.overdraw){Ba(v.positionScreen,J.positionScreen);Ba(J.positionScreen,t.positionScreen);Ba(t.positionScreen,v.positionScreen)}q.add3Points(v.positionScreen.x,v.positionScreen.y,J.positionScreen.x,J.positionScreen.y,t.positionScreen.x,t.positionScreen.y);if(B.instersects(q)){oa=0;for(za=ta.meshMaterials.length;oa<za;){va=ta.meshMaterials[oa++];if(va instanceof THREE.MeshFaceMaterial){wa=0;for(ya=ta.faceMaterials.length;wa<ya;)(va=
|
|
|
|
-ta.faceMaterials[wa++])&&da(v,J,t,ta,va,ha)}else da(v,J,t,ta,va,ha)}}}u.addRectangle(q)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(ia,ga,ua){var xa,l,z,B;xa=0;for(l=ia.lights.length;xa<l;xa++){z=ia.lights[xa];if(z instanceof THREE.DirectionalLight){B=ga.normalWorld.dot(z.position)*z.intensity;if(B>0){ua.r+=z.color.r*B;ua.g+=z.color.g*B;ua.b+=z.color.b*B}}else if(z instanceof THREE.PointLight){W.sub(z.position,ga.centroidWorld);W.normalize();B=ga.normalWorld.dot(W)*z.intensity;if(B>0){ua.r+=z.color.r*B;ua.g+=z.color.g*B;ua.b+=z.color.b*B}}}}function b(ia,ga,ua,xa,l,z){M=d(X++);M.setAttribute("d",
|
|
|
|
-"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)t.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(J){K.r=R.r;K.g=R.g;K.b=R.b;a(z,xa,K);t.r=l.color.r*K.r;t.g=l.color.g*K.g;t.b=l.color.b*K.b;t.updateStyleString()}else t.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){Q=1-l.__2near/(l.__farPlusNear-
|
|
|
|
-xa.z*l.__farMinusNear);t.setRGB(Q,Q,Q)}else l instanceof THREE.MeshNormalMaterial&&t.setRGB(f(xa.normalWorld.x),f(xa.normalWorld.y),f(xa.normalWorld.z));l.wireframe?M.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):M.setAttribute("style","fill: "+t.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(M)}function c(ia,ga,ua,xa,l,
|
|
|
|
-z,B){M=d(X++);M.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)t.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(J){K.r=R.r;K.g=R.g;K.b=R.b;a(B,l,K);t.r=z.color.r*K.r;t.g=z.color.g*K.g;t.b=z.color.b*K.b;t.updateStyleString()}else t.__styleString=z.color.__styleString;
|
|
|
|
-else if(z instanceof THREE.MeshDepthMaterial){Q=1-z.__2near/(z.__farPlusNear-l.z*z.__farMinusNear);t.setRGB(Q,Q,Q)}else z instanceof THREE.MeshNormalMaterial&&t.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));z.wireframe?M.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):M.setAttribute("style","fill: "+t.__styleString+
|
|
|
|
-"; fill-opacity: "+z.opacity);k.appendChild(M)}function d(ia){if(U[ia]==null){U[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");la==0&&U[ia].setAttribute("shape-rendering","crispEdges")}return U[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,o,p,x,A,I=new THREE.Rectangle,v=new THREE.Rectangle,J=!1,t=new THREE.Color(16777215),K=new THREE.Color(16777215),
|
|
|
|
-R=new THREE.Color(0),e=new THREE.Color(0),O=new THREE.Color(0),Q,W=new THREE.Vector3,U=[],aa=[],ea=[],M,X,pa,ba,la=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":la=1;break;case "low":la=0}};this.setSize=function(ia,ga){j=ia;m=ga;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);I.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
|
|
|
|
-this.render=function(ia,ga){var ua,xa,l,z,B,u,q,E;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ba=pa=X=0;if(J=ia.lights.length>0){q=ia.lights;R.setRGB(0,0,0);e.setRGB(0,0,0);O.setRGB(0,0,0);ua=0;for(xa=q.length;ua<xa;ua++){l=q[ua];z=l.color;if(l instanceof THREE.AmbientLight){R.r+=z.r;R.g+=z.g;R.b+=z.b}else if(l instanceof THREE.DirectionalLight){e.r+=z.r;e.g+=z.g;e.b+=z.b}else if(l instanceof THREE.PointLight){O.r+=z.r;O.g+=z.g;O.b+=z.b}}}ua=0;for(xa=g.length;ua<xa;ua++){q=
|
|
|
|
-g[ua];v.empty();if(q instanceof THREE.RenderableParticle){o=q;o.x*=n;o.y*=-w;l=0;for(z=q.materials.length;l<z;l++)if(E=q.materials[l]){B=o;u=q;var C=pa++;if(aa[C]==null){aa[C]=document.createElementNS("http://www.w3.org/2000/svg","circle");la==0&&aa[C].setAttribute("shape-rendering","crispEdges")}M=aa[C];M.setAttribute("cx",B.x);M.setAttribute("cy",B.y);M.setAttribute("r",u.scale.x*n);if(E instanceof THREE.ParticleCircleMaterial){if(J){K.r=R.r+e.r+O.r;K.g=R.g+e.g+O.g;K.b=R.b+e.b+O.b;t.r=E.color.r*
|
|
|
|
-K.r;t.g=E.color.g*K.g;t.b=E.color.b*K.b;t.updateStyleString()}else t=E.color;M.setAttribute("style","fill: "+t.__styleString)}k.appendChild(M)}}else if(q instanceof THREE.RenderableLine){o=q.v1;p=q.v2;o.positionScreen.x*=n;o.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;v.addPoint(o.positionScreen.x,o.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);if(I.instersects(v)){l=0;for(z=q.materials.length;l<z;)if(E=q.materials[l++]){B=o;u=p;C=ba++;if(ea[C]==null){ea[C]=
|
|
|
|
-document.createElementNS("http://www.w3.org/2000/svg","line");la==0&&ea[C].setAttribute("shape-rendering","crispEdges")}M=ea[C];M.setAttribute("x1",B.positionScreen.x);M.setAttribute("y1",B.positionScreen.y);M.setAttribute("x2",u.positionScreen.x);M.setAttribute("y2",u.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){t.__styleString=E.color.__styleString;M.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+
|
|
|
|
-E.linecap+"; stroke-linejoin: "+E.linejoin);k.appendChild(M)}}}}else if(q instanceof THREE.RenderableFace3){o=q.v1;p=q.v2;x=q.v3;o.positionScreen.x*=n;o.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;v.addPoint(o.positionScreen.x,o.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(I.instersects(v)){l=0;for(z=q.meshMaterials.length;l<z;){E=q.meshMaterials[l++];if(E instanceof
|
|
|
|
-THREE.MeshFaceMaterial){B=0;for(u=q.faceMaterials.length;B<u;)(E=q.faceMaterials[B++])&&b(o,p,x,q,E,ia)}else E&&b(o,p,x,q,E,ia)}}}else if(q instanceof THREE.RenderableFace4){o=q.v1;p=q.v2;x=q.v3;A=q.v4;o.positionScreen.x*=n;o.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;A.positionScreen.x*=n;A.positionScreen.y*=-w;v.addPoint(o.positionScreen.x,o.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,
|
|
|
|
-x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(I.instersects(v)){l=0;for(z=q.meshMaterials.length;l<z;){E=q.meshMaterials[l++];if(E instanceof THREE.MeshFaceMaterial){B=0;for(u=q.faceMaterials.length;B<u;)(E=q.faceMaterials[B++])&&c(o,p,x,A,q,E,ia)}else E&&c(o,p,x,A,q,E,ia)}}}}}};
|
|
|
|
-THREE.WebGLRenderer=function(a){function b(l,z,B){var u,q,E,C=l.vertices,G=C.length,H=l.colors,y=H.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,P=l.__dirtyVertices,fa=l.__dirtyColors;if(B.sortParticles){pa.multiplySelf(B.matrixWorld);for(u=0;u<G;u++){q=C[u].position;ia.copy(q);pa.multiplyVector3(ia);T[u]=[ia.z,u]}T.sort(function(ka,ra){return ra[0]-ka[0]});for(u=0;u<G;u++){q=C[T[u][1]].position;E=u*3;D[E]=q.x;D[E+1]=q.y;D[E+2]=q.z}for(u=0;u<y;u++){E=u*3;color=H[T[u][1]];F[E]=color.r;
|
|
|
|
-F[E+1]=color.g;F[E+2]=color.b}}else{if(P)for(u=0;u<G;u++){q=C[u].position;E=u*3;D[E]=q.x;D[E+1]=q.y;D[E+2]=q.z}if(fa)for(u=0;u<y;u++){color=H[u];E=u*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(P||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,z)}if(fa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,z)}}function c(l,z){l.fragmentShader=z.fragmentShader;l.vertexShader=z.vertexShader;l.uniforms=
|
|
|
|
-Uniforms.clone(z.uniforms)}function d(l,z,B,u,q){u.program||W.initMaterial(u,z,B);var E=u.program,C=E.uniforms,G=u.uniforms;if(E!=O){e.useProgram(E);O=E;e.uniformMatrix4fv(C.projectionMatrix,!1,ba)}if(B&&(u instanceof THREE.MeshBasicMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshPhongMaterial||u instanceof THREE.LineBasicMaterial||u instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){G.fogNear.value=B.near;G.fogFar.value=
|
|
|
|
-B.far}else if(B instanceof THREE.FogExp2)G.fogDensity.value=B.density}if(u instanceof THREE.MeshPhongMaterial||u instanceof THREE.MeshLambertMaterial){var H,y,D=0,F=0,T=0,P,fa,ka,ra=W.lights,na=ra.directional.colors,ma=ra.directional.positions,ha=ra.point.colors,Ca=ra.point.positions,S=0,Ga=0;B=y=y=0;for(H=z.length;B<H;B++){y=z[B];P=y.color;fa=y.position;ka=y.intensity;if(y instanceof THREE.AmbientLight){D+=P.r;F+=P.g;T+=P.b}else if(y instanceof THREE.DirectionalLight){y=S*3;na[y]=P.r*ka;na[y+1]=
|
|
|
|
-P.g*ka;na[y+2]=P.b*ka;ma[y]=fa.x;ma[y+1]=fa.y;ma[y+2]=fa.z;S+=1}else if(y instanceof THREE.PointLight){y=Ga*3;ha[y]=P.r*ka;ha[y+1]=P.g*ka;ha[y+2]=P.b*ka;Ca[y]=fa.x;Ca[y+1]=fa.y;Ca[y+2]=fa.z;Ga+=1}}for(B=S*3;B<na.length;B++)na[B]=0;for(B=Ga*3;B<ha.length;B++)ha[B]=0;ra.point.length=Ga;ra.directional.length=S;ra.ambient[0]=D;ra.ambient[1]=F;ra.ambient[2]=T;z=W.lights;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=z.directional.colors;
|
|
|
|
-G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;G.pointLightPosition.value=z.point.positions}if(u instanceof THREE.MeshBasicMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(u.color.r*u.opacity,u.color.g*u.opacity,u.color.b*u.opacity);G.opacity.value=u.opacity;G.map.texture=u.map;G.lightMap.texture=u.lightMap;G.envMap.texture=u.envMap;G.reflectivity.value=u.reflectivity;G.refractionRatio.value=
|
|
|
|
-u.refractionRatio;G.combine.value=u.combine;G.useRefract.value=u.envMap&&u.envMap.mapping instanceof THREE.CubeRefractionMapping}if(u instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(u.color.r*u.opacity,u.color.g*u.opacity,u.color.b*u.opacity);G.opacity.value=u.opacity}else if(u instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(u.color.r*u.opacity,u.color.g*u.opacity,u.color.b*u.opacity);G.opacity.value=u.opacity;G.size.value=u.size;G.map.texture=u.map}else if(u instanceof THREE.MeshPhongMaterial){G.ambient.value.setRGB(u.ambient.r,
|
|
|
|
-u.ambient.g,u.ambient.b);G.specular.value.setRGB(u.specular.r,u.specular.g,u.specular.b);G.shininess.value=u.shininess}else if(u instanceof THREE.MeshDepthMaterial){G.mNear.value=l.near;G.mFar.value=l.far;G.opacity.value=u.opacity}else if(u instanceof THREE.MeshNormalMaterial)G.opacity.value=u.opacity;for(var Ha in G)if(D=E.uniforms[Ha]){B=G[Ha];H=B.type;z=B.value;if(H=="i")e.uniform1i(D,z);else if(H=="f")e.uniform1f(D,z);else if(H=="fv1")e.uniform1fv(D,z);else if(H=="fv")e.uniform3fv(D,z);else if(H==
|
|
|
|
-"v2")e.uniform2f(D,z.x,z.y);else if(H=="v3")e.uniform3f(D,z.x,z.y,z.z);else if(H=="c")e.uniform3f(D,z.r,z.g,z.b);else if(H=="t"){e.uniform1i(D,z);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){if(B.image.length==6){if(B.needsUpdate){if(!B.image.__webGLTextureCube)B.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,
|
|
|
|
-e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(H=0;H<6;++H)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image[H]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube)}}else{if(B.needsUpdate){if(B.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
|
|
|
|
-B.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,K(B.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,K(B.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,K(B.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,K(B.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{B.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
|
|
|
|
-0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,K(B.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,K(B.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,K(B.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,K(B.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);B.__wasSetOnce=!0}B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_2D,B.__webGLTexture)}}}e.uniformMatrix4fv(C.modelViewMatrix,
|
|
|
|
-!1,q._modelViewMatrixArray);e.uniformMatrix3fv(C.normalMatrix,!1,q._normalMatrixArray);(u instanceof THREE.MeshShaderMaterial||u instanceof THREE.MeshPhongMaterial||u.envMap)&&e.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(u instanceof THREE.MeshShaderMaterial||u.envMap||u.skinning)&&e.uniformMatrix4fv(C.objectMatrix,!1,q._objectMatrixArray);(u instanceof THREE.MeshPhongMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshShaderMaterial||u.skinning)&&e.uniformMatrix4fv(C.viewMatrix,
|
|
|
|
-!1,la);if(u.skinning){e.uniformMatrix4fv(C.cameraInverseMatrix,!1,la);e.uniformMatrix4fv(C.boneGlobalMatrices,!1,q.boneMatrices)}return E}function f(l,z,B,u,q,E){l=d(l,z,B,u,E).attributes;e.bindBuffer(e.ARRAY_BUFFER,q.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,q.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,q.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,
|
|
|
|
-3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,q.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(q.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,q.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(q.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,q.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
|
|
|
|
-if(u.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
|
|
|
|
-4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(u.wireframe){e.lineWidth(u.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);e.drawElements(e.LINES,q.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,q.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(u.linewidth);e.drawArrays(E,0,q.__webGLLineCount)}else if(E instanceof
|
|
|
|
-THREE.ParticleSystem)e.drawArrays(e.POINTS,0,q.__webGLParticleCount);else E instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,q.__webGLVertexCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,
|
|
|
|
-3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(U!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);U=l.doubleSided}if(aa!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);aa=l.flipSided}}function k(l){if(M!=
|
|
|
|
-l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);M=l}}function j(l){X[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);X[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);X[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);X[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);X[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);X[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=X[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}
|
|
|
|
-function m(l){for(var z=l.matrixWorld,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),u=0;u<6;u++){l=X[u].x*z.n14+X[u].y*z.n24+X[u].z*z.n34+X[u].w;if(l<=B)return!1}return!0}function n(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,B,u=l.object,q=l.opaque,E=l.transparent;E.count=0;l=q.count=0;for(z=u.materials.length;l<z;l++){B=u.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?n(E,B):n(q,B)}}function o(l){var z,B,u,q,E=l.object,C=l.buffer,
|
|
|
|
-G=l.opaque,H=l.transparent;H.count=0;l=G.count=0;for(u=E.materials.length;l<u;l++){z=E.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(B=C.materials.length;z<B;z++)(q=C.materials[z])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?n(H,q):n(G,q))}else{q=z;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?n(H,q):n(G,q)}}}function p(l,z){return z.z-l.z}function x(l){function z(F){var T=[];B=0;for(u=F.length;B<u;B++)F[B]==undefined?T.push("undefined"):T.push(F[B].id);return T.join("_")}
|
|
|
|
-var B,u,q,E,C,G,H,y,D={};l.geometryGroups={};q=0;for(E=l.faces.length;q<E;q++){C=l.faces[q];G=C.materials;H=z(G);D[H]==undefined&&(D[H]={hash:H,counter:0});y=D[H].hash+"_"+D[H].counter;l.geometryGroups[y]==undefined&&(l.geometryGroups[y]={faces:[],materials:G,vertices:0});C=C instanceof THREE.Face3?3:4;if(l.geometryGroups[y].vertices+C>65535){D[H].counter+=1;y=D[H].hash+"_"+D[H].counter;l.geometryGroups[y]==undefined&&(l.geometryGroups[y]={faces:[],materials:G,vertices:0})}l.geometryGroups[y].faces.push(q);
|
|
|
|
-l.geometryGroups[y].vertices+=C}}function A(l,z,B,u,q){if(z[B]==undefined){l.push({buffer:u,object:q,opaque:{list:[],count:0},transparent:{list:[],count:0}});z[B]=1}}function I(l,z){l._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function v(l){if(l!=ea){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,
|
|
|
|
-e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ea=l}}function J(l,z){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,
|
|
|
|
-l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,K(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,K(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,K(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,K(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,K(l.format),l.width,l.height,0,K(l.format),K(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
|
-l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,u,q;if(l){B=l.__webGLFramebuffer;u=l.width;q=l.height}else{B=null;u=R.width;q=R.height}if(B!=Q){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,u,q);z&&e.clear(e.COLOR_BUFFER_BIT|
|
|
|
|
-e.DEPTH_BUFFER_BIT);Q=B}}function t(l,z){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,z);e.compileShader(B);if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function K(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;
|
|
|
|
-case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;
|
|
|
|
-case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var R=document.createElement("canvas"),e,O=null,Q=null,W=this,U=null,aa=null,ea=null,M=null,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
|
|
|
|
-pa=new THREE.Matrix4,ba=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4,ga=!0,ua=new THREE.Color(0),xa=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=R;this.autoClear=!0;this.sortObjects=!1;(function(l,z,B){try{e=R.getContext("experimental-webgl",{antialias:l})}catch(u){console.log(u)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);
|
|
|
|
-e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(z.r,z.g,z.b,B);_cullEnabled=!0})(ga,ua,xa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,z){R.width=l;R.height=z;e.viewport(0,0,R.width,R.height)};this.setClearColorHex=function(l,z){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,z)};this.setClearColor=
|
|
|
|
-function(l,z){e.clearColor(l.r,l.g,l.b,z)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,B){var u,q;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);
|
|
|
|
-else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,C,G,H;q=G=H=0;for(E=z.length;q<E;q++){C=z[q];C instanceof THREE.DirectionalLight&&G++;C instanceof THREE.PointLight&&H++}if(H+G<=4)z=G;else{z=Math.ceil(4*G/(H+G));H=4-z}q={directional:z,point:H};H=l.fragmentShader;z=l.vertexShader;E={fog:B,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:q.directional,
|
|
|
|
-maxPointLights:q.point};B=e.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.envMap?"#define USE_ENVMAP":"",E.lightMap?"#define USE_LIGHTMAP":"",E.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
-0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.map?"#define USE_MAP":"",E.envMap?"#define USE_ENVMAP":"",E.lightMap?"#define USE_LIGHTMAP":"",E.vertexColors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
|
-e.attachShader(B,t("fragment",q+H));e.attachShader(B,t("vertex",E+z));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(u in l.uniforms)B.push(u);u=l.program;H=0;for(z=B.length;H<
|
|
|
|
-z;H++){q=B[H];u.uniforms[q]=e.getUniformLocation(u,q)}u=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];H=0;for(z=B.length;H<z;H++){q=B[H];u.attributes[q]=e.getAttribLocation(u,q)}u=l.program.attributes;e.enableVertexAttribArray(u.position);u.color>=0&&e.enableVertexAttribArray(u.color);u.normal>=0&&e.enableVertexAttribArray(u.normal);u.tangent>=0&&e.enableVertexAttribArray(u.tangent);if(l.skinning&&u.skinVertexA>=0&&u.skinVertexB>=
|
|
|
|
-0&&u.skinIndex>=0&&u.skinWeight>=0){e.enableVertexAttribArray(u.skinVertexA);e.enableVertexAttribArray(u.skinVertexB);e.enableVertexAttribArray(u.skinIndex);e.enableVertexAttribArray(u.skinWeight)}};this.render=function(l,z,B,u){var q,E,C,G,H,y,D,F,T=l.lights,P=l.fog;z.matrixAutoUpdate&&z.update();z.matrixWorldInverse.flattenToArray(la);z.projectionMatrix.flattenToArray(ba);pa.multiply(z.projectionMatrix,z.matrixWorldInverse);j(pa);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,
|
|
|
|
-!1,z);this.initWebGLObjects(l,z);J(B,u!==undefined?u:!0);this.autoClear&&this.clear();H=l.__webGLObjects.length;for(u=0;u<H;u++){q=l.__webGLObjects[u];D=q.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.matrixWorld.flattenToArray(D._objectMatrixArray);I(D,z);o(q);q.render=!0;if(this.sortObjects){ia.copy(D.position);pa.multiplyVector3(ia);q.z=ia.z}}else q.render=!1;else q.render=!1}this.sortObjects&&l.__webGLObjects.sort(p);y=l.__webGLObjectsImmediate.length;for(u=0;u<y;u++){q=l.__webGLObjectsImmediate[u];
|
|
|
|
-D=q.object;if(D.visible){D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray);I(D,z);w(q)}}v(THREE.NormalBlending);for(u=0;u<H;u++){q=l.__webGLObjects[u];if(q.render){D=q.object;F=q.buffer;C=q.opaque;h(D);for(q=0;q<C.count;q++){G=C.list[q];k(G.depthTest);f(z,T,P,G,F,D)}}}for(u=0;u<y;u++){q=l.__webGLObjectsImmediate[u];D=q.object;if(D.visible){C=q.opaque;h(D);for(q=0;q<C.count;q++){G=C.list[q];k(G.depthTest);E=d(z,T,P,G,D);D.render(function(fa){g(fa,E)})}}}for(u=0;u<H;u++){q=l.__webGLObjects[u];
|
|
|
|
-if(q.render){D=q.object;F=q.buffer;C=q.transparent;h(D);for(q=0;q<C.count;q++){G=C.list[q];v(G.blending);k(G.depthTest);f(z,T,P,G,F,D)}}}for(u=0;u<y;u++){q=l.__webGLObjectsImmediate[u];D=q.object;if(D.visible){C=q.transparent;h(D);for(q=0;q<C.count;q++){G=C.list[q];v(G.blending);k(G.depthTest);E=d(z,T,P,G,D);D.render(function(fa){g(fa,E)})}}}if(B&&B.minFilter!==THREE.NearestFilter&&B.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
|
|
|
|
-null)}};this.initWebGLObjects=function(l,z){if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}for(var B=0,u=l.objects.length;B<u;B++){var q=l.objects[B],E=l,C=z,G=void 0,H=void 0,y=void 0,D=void 0;if(E.__webGLObjectsMap[q.id]==undefined){E.__webGLObjectsMap[q.id]={};q._modelViewMatrix=new THREE.Matrix4;q._normalMatrixArray=new Float32Array(9);q._modelViewMatrixArray=new Float32Array(16);q._objectMatrixArray=new Float32Array(16);q.matrixWorld.flattenToArray(q._objectMatrixArray)}D=
|
|
|
|
-E.__webGLObjectsMap[q.id];objlist=E.__webGLObjects;if(q instanceof THREE.Mesh){H=q.geometry;H.geometryGroups==undefined&&x(H);for(G in H.geometryGroups){y=H.geometryGroups[G];if(!y.__webGLVertexBuffer){C=y;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=e.createBuffer();C.__webGLSkinVertexBBuffer=
|
|
|
|
-e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=y;var F=q,T=void 0,P=void 0,fa=0,ka=E=0,ra=F.geometry.faces,na=C.faces;T=0;for(P=na.length;T<P;T++){fi=na[T];face=ra[fi];if(face instanceof THREE.Face3){fa+=3;E+=1;ka+=3}else if(face instanceof THREE.Face4){fa+=4;E+=2;ka+=4}}C.__vertexArray=new Float32Array(fa*3);C.__normalArray=new Float32Array(fa*3);C.__tangentArray=
|
|
|
|
-new Float32Array(fa*4);C.__colorArray=new Float32Array(fa*3);C.__uvArray=new Float32Array(fa*2);C.__uv2Array=new Float32Array(fa*2);C.__skinVertexAArray=new Float32Array(fa*4);C.__skinVertexBArray=new Float32Array(fa*4);C.__skinIndexArray=new Float32Array(fa*4);C.__skinWeightArray=new Float32Array(fa*4);C.__faceArray=new Uint16Array(E*3);C.__lineArray=new Uint16Array(ka*2);P=T=C;fa=void 0;ra=void 0;var ma=void 0,ha=void 0;ma=void 0;na=!1;fa=0;for(ra=F.materials.length;fa<ra;fa++){ma=F.materials[fa];
|
|
|
|
-if(ma instanceof THREE.MeshFaceMaterial){ma=0;for(ha=P.materials.length;ma<ha;ma++)if(P.materials[ma]&&P.materials[ma].shading!=undefined&&P.materials[ma].shading==THREE.SmoothShading){na=!0;break}}else if(ma&&ma.shading!=undefined&&ma.shading==THREE.SmoothShading){na=!0;break}if(na)break}T.__needsSmoothNormals=na;C.__webGLFaceCount=E*3;C.__webGLLineCount=ka*2;H.__dirtyVertices=!0;H.__dirtyElements=!0;H.__dirtyUvs=!0;H.__dirtyNormals=!0;H.__dirtyTangents=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||
|
|
|
|
-H.__dirtyElements||H.__dirtyUvs||H.__dirtyNormals||H.__dirtyColors||H.__dirtyTangents){C=y;E=e.DYNAMIC_DRAW;ka=void 0;T=void 0;var Ca=void 0,S=void 0,Ga=void 0,Ha=void 0,La=void 0;Ca=void 0;var da=void 0,Z=void 0,$=void 0,sa=void 0;da=void 0;Z=void 0;$=void 0;S=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;da=void 0;Z=void 0;$=void 0;sa=void 0;S=void 0;Ha=void 0;Ga=void 0;La=void 0;var Ja=
|
|
|
|
-ha=ma=na=ra=fa=F=P=0,Aa=0,N=0,Ba=C.__vertexArray,Pa=C.__uvArray,Ta=C.__uv2Array,ta=C.__normalArray,oa=C.__tangentArray,za=C.__colorArray,wa=C.__skinVertexAArray,ya=C.__skinVertexBArray,va=C.__skinIndexArray,L=C.__skinWeightArray,ja=C.__faceArray,ca=C.__lineArray,V=C.__needsSmoothNormals,Y=q.geometry,qa=Y.__dirtyVertices,Da=Y.__dirtyElements,Ea=Y.__dirtyUvs,Ia=Y.__dirtyNormals,Ma=Y.__dirtyTangents,Ka=Y.__dirtyColors,Fa=Y.vertices,Sa=C.faces,Na=Y.faces,Oa=Y.uvs,Xa=Y.uvs2,Qa=Y.colors,Ua=Y.skinVerticesA,
|
|
|
|
-Va=Y.skinVerticesB,Wa=Y.skinIndices,Ra=Y.skinWeights;ka=0;for(T=Sa.length;ka<T;ka++){Ca=Sa[ka];S=Na[Ca];La=Oa[Ca];Ca=Xa[Ca];Ga=S.vertexNormals;Ha=S.normal;if(S instanceof THREE.Face3){if(qa){da=Fa[S.a].position;Z=Fa[S.b].position;$=Fa[S.c].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;F+=9}if(Ra.length){da=Ra[S.a];Z=Ra[S.b];$=Ra[S.c];L[N]=da.x;L[N+1]=da.y;L[N+2]=da.z;L[N+3]=da.w;L[N+4]=Z.x;L[N+5]=Z.y;L[N+6]=Z.z;L[N+7]=Z.w;L[N+
|
|
|
|
-8]=$.x;L[N+9]=$.y;L[N+10]=$.z;L[N+11]=$.w;da=Wa[S.a];Z=Wa[S.b];$=Wa[S.c];va[N]=da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;da=Ua[S.a];Z=Ua[S.b];$=Ua[S.c];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;da=Va[S.a];Z=Va[S.b];$=Va[S.c];ya[N]=da.x;ya[N+1]=da.y;ya[N+2]=da.z;ya[N+3]=1;ya[N+4]=Z.x;ya[N+5]=Z.y;ya[N+6]=
|
|
|
|
-Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;N+=12}if(Ka&&Qa.length){da=Qa[S.a];Z=Qa[S.b];$=Qa[S.c];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;Aa+=9}if(Ma&&Y.hasTangents){da=Fa[S.a].tangent;Z=Fa[S.b].tangent;$=Fa[S.c].tangent;oa[ha]=da.x;oa[ha+1]=da.y;oa[ha+2]=da.z;oa[ha+3]=da.w;oa[ha+4]=Z.x;oa[ha+5]=Z.y;oa[ha+6]=Z.z;oa[ha+7]=Z.w;oa[ha+8]=$.x;oa[ha+9]=$.y;oa[ha+10]=$.z;oa[ha+11]=$.w;ha+=12}if(Ia)if(Ga.length==
|
|
|
|
-3&&V)for(S=0;S<3;S++){Ha=Ga[S];ta[ma]=Ha.x;ta[ma+1]=Ha.y;ta[ma+2]=Ha.z;ma+=3}else for(S=0;S<3;S++){ta[ma]=Ha.x;ta[ma+1]=Ha.y;ta[ma+2]=Ha.z;ma+=3}if(Ea&&La)for(S=0;S<3;S++){Ga=La[S];Pa[fa]=Ga.u;Pa[fa+1]=Ga.v;fa+=2}if(Ea&&Ca)for(S=0;S<3;S++){La=Ca[S];Ta[ra]=La.u;Ta[ra+1]=La.v;ra+=2}if(Da){ja[na]=P;ja[na+1]=P+1;ja[na+2]=P+2;na+=3;ca[Ja]=P;ca[Ja+1]=P+1;ca[Ja+2]=P;ca[Ja+3]=P+2;ca[Ja+4]=P+1;ca[Ja+5]=P+2;Ja+=6;P+=3}}else if(S instanceof THREE.Face4){if(qa){da=Fa[S.a].position;Z=Fa[S.b].position;$=Fa[S.c].position;
|
|
|
|
-sa=Fa[S.d].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;Ba[F+9]=sa.x;Ba[F+10]=sa.y;Ba[F+11]=sa.z;F+=12}if(Ra.length){da=Ra[S.a];Z=Ra[S.b];$=Ra[S.c];sa=Ra[S.d];L[N]=da.x;L[N+1]=da.y;L[N+2]=da.z;L[N+3]=da.w;L[N+4]=Z.x;L[N+5]=Z.y;L[N+6]=Z.z;L[N+7]=Z.w;L[N+8]=$.x;L[N+9]=$.y;L[N+10]=$.z;L[N+11]=$.w;L[N+12]=sa.x;L[N+13]=sa.y;L[N+14]=sa.z;L[N+15]=sa.w;da=Wa[S.a];Z=Wa[S.b];$=Wa[S.c];sa=Wa[S.d];va[N]=da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+
|
|
|
|
-3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;va[N+12]=sa.x;va[N+13]=sa.y;va[N+14]=sa.z;va[N+15]=sa.w;da=Ua[S.a];Z=Ua[S.b];$=Ua[S.c];sa=Ua[S.d];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;wa[N+12]=sa.x;wa[N+13]=sa.y;wa[N+14]=sa.z;wa[N+15]=1;da=Va[S.a];Z=Va[S.b];$=Va[S.c];sa=Va[S.d];ya[N]=da.x;ya[N+1]=da.y;ya[N+2]=da.z;ya[N+3]=1;ya[N+4]=Z.x;ya[N+
|
|
|
|
-5]=Z.y;ya[N+6]=Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;ya[N+12]=sa.x;ya[N+13]=sa.y;ya[N+14]=sa.z;ya[N+15]=1;N+=16}if(Ka&&Qa.length){da=Qa[S.a];Z=Qa[S.b];$=Qa[S.c];sa=Qa[S.d];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;za[Aa+9]=sa.r;za[Aa+10]=sa.g;za[Aa+11]=sa.b;Aa+=12}if(Ma&&Y.hasTangents){da=Fa[S.a].tangent;Z=Fa[S.b].tangent;$=Fa[S.c].tangent;S=Fa[S.d].tangent;oa[ha]=da.x;oa[ha+1]=da.y;oa[ha+2]=da.z;oa[ha+
|
|
|
|
-3]=da.w;oa[ha+4]=Z.x;oa[ha+5]=Z.y;oa[ha+6]=Z.z;oa[ha+7]=Z.w;oa[ha+8]=$.x;oa[ha+9]=$.y;oa[ha+10]=$.z;oa[ha+11]=$.w;oa[ha+12]=S.x;oa[ha+13]=S.y;oa[ha+14]=S.z;oa[ha+15]=S.w;ha+=16}if(Ia)if(Ga.length==4&&V)for(S=0;S<4;S++){Ha=Ga[S];ta[ma]=Ha.x;ta[ma+1]=Ha.y;ta[ma+2]=Ha.z;ma+=3}else for(S=0;S<4;S++){ta[ma]=Ha.x;ta[ma+1]=Ha.y;ta[ma+2]=Ha.z;ma+=3}if(Ea&&La)for(S=0;S<4;S++){Ga=La[S];Pa[fa]=Ga.u;Pa[fa+1]=Ga.v;fa+=2}if(Ea&&Ca)for(S=0;S<4;S++){La=Ca[S];Ta[ra]=La.u;Ta[ra+1]=La.v;ra+=2}if(Da){ja[na]=P;ja[na+1]=
|
|
|
|
-P+1;ja[na+2]=P+2;ja[na+3]=P;ja[na+4]=P+2;ja[na+5]=P+3;na+=6;ca[Ja]=P;ca[Ja+1]=P+1;ca[Ja+2]=P;ca[Ja+3]=P+3;ca[Ja+4]=P+1;ca[Ja+5]=P+2;ca[Ja+6]=P+2;ca[Ja+7]=P+3;Ja+=8;P+=4}}}if(qa){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,E)}if(Ka&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,za,E)}if(Ia){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,E)}if(Ma&&Y.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
-C.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,oa,E)}if(Ea&&fa>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,E)}if(Ea&&ra>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ta,E)}if(Da){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja,E);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ca,E)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);
|
|
|
|
-e.bufferData(e.ARRAY_BUFFER,wa,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,va,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,L,E)}}A(objlist,D,G,y,q)}H.__dirtyVertices=!1;H.__dirtyElements=!1;H.__dirtyUvs=!1;H.__dirtyNormals=!1;H.__dirtyTangents=!1;H.__dirtyColors=!1}else if(q instanceof THREE.Ribbon){H=q.geometry;if(!H.__webGLVertexBuffer){G=
|
|
|
|
-H;G.__webGLVertexBuffer=e.createBuffer();G.__webGLColorBuffer=e.createBuffer();G=H;y=G.vertices.length;G.__vertexArray=new Float32Array(y*3);G.__colorArray=new Float32Array(y*3);G.__webGLVertexCount=y;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){G=H;y=e.DYNAMIC_DRAW;P=void 0;P=void 0;F=void 0;C=void 0;fa=G.vertices;E=G.colors;ra=fa.length;ka=E.length;na=G.__vertexArray;T=G.__colorArray;ma=G.__dirtyColors;if(G.__dirtyVertices){for(P=0;P<ra;P++){F=fa[P].position;C=
|
|
|
|
-P*3;na[C]=F.x;na[C+1]=F.y;na[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,G.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,na,y)}if(ma){for(P=0;P<ka;P++){color=E[P];C=P*3;T[C]=color.r;T[C+1]=color.g;T[C+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,G.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,y)}}A(objlist,D,0,H,q);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(q instanceof THREE.Line){H=q.geometry;if(!H.__webGLVertexBuffer){G=H;G.__webGLVertexBuffer=e.createBuffer();G.__webGLColorBuffer=e.createBuffer();
|
|
|
|
-G=H;y=G.vertices.length;G.__vertexArray=new Float32Array(y*3);G.__colorArray=new Float32Array(y*3);G.__webGLLineCount=y;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){G=H;y=e.DYNAMIC_DRAW;P=void 0;P=void 0;F=void 0;C=void 0;fa=G.vertices;E=G.colors;ra=fa.length;ka=E.length;na=G.__vertexArray;T=G.__colorArray;ma=G.__dirtyColors;if(G.__dirtyVertices){for(P=0;P<ra;P++){F=fa[P].position;C=P*3;na[C]=F.x;na[C+1]=F.y;na[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,G.__webGLVertexBuffer);
|
|
|
|
-e.bufferData(e.ARRAY_BUFFER,na,y)}if(ma){for(P=0;P<ka;P++){color=E[P];C=P*3;T[C]=color.r;T[C+1]=color.g;T[C+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,G.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,y)}}A(objlist,D,0,H,q);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(q instanceof THREE.ParticleSystem){H=q.geometry;if(!H.__webGLVertexBuffer){G=H;G.__webGLVertexBuffer=e.createBuffer();G.__webGLColorBuffer=e.createBuffer();G=H;y=G.vertices.length;G.__vertexArray=new Float32Array(y*3);G.__colorArray=
|
|
|
|
-new Float32Array(y*3);G.__sortArray=[];G.__webGLParticleCount=y;H.__dirtyVertices=!0;H.__dirtyColors=!0}(H.__dirtyVertices||H.__dirtyColors||q.sortParticles)&&b(H,e.DYNAMIC_DRAW,q,C);A(objlist,D,0,H,q);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&q instanceof THREE.MarchingCubes){H=D;if(H[0]==undefined){E.__webGLObjectsImmediate.push({object:q,opaque:{list:[],count:0},transparent:{list:[],count:0}});H[0]=1}}}};this.removeObject=function(l,z){var B,u;for(B=l.__webGLObjects.length-
|
|
|
|
-1;B>=0;B--){u=l.__webGLObjects[B].object;z==u&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
|
-THREE.Snippets={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 int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\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",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
|
|
-map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
|
|
|
-lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
|
|
|
+THREE.Projector=function(){function a(M,N){return N.z-M.z}function b(M,N){var W=0,S=1,aa=M.z+M.w,ca=N.z+N.w,K=-M.z+M.w,Y=-N.z+N.w;if(aa>=0&&ca>=0&&K>=0&&Y>=0)return!0;else if(aa<0&&ca<0||K<0&&Y<0)return!1;else{if(aa<0)W=Math.max(W,aa/(aa-ca));else ca<0&&(S=Math.min(S,aa/(aa-ca)));if(K<0)W=Math.max(W,K/(K-Y));else Y<0&&(S=Math.min(S,K/(K-Y)));if(S<W)return!1;else{M.lerpSelf(N,W);N.lerpSelf(M,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,y=[],p,q,A=[],C=new THREE.Vector4,E=new THREE.Vector4,w=new THREE.Matrix4,
|
|
|
|
+F=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4,e;this.projectObjects=function(M,N,W){N=[];var S,aa,ca;d=0;aa=M.objects;M=0;for(S=aa.length;M<S;M++){ca=aa[M];var K;if(!(K=!ca.visible))if(K=ca instanceof THREE.Mesh){a:{K=void 0;for(var Y=ca.matrixWorld,oa=-ca.geometry.boundingSphere.radius*Math.max(ca.scale.x,Math.max(ca.scale.y,ca.scale.z)),ba=0;ba<6;ba++){K=u[ba].x*Y.n14+u[ba].y*
|
|
|
|
+Y.n24+u[ba].z*Y.n34+u[ba].w;if(K<=oa){K=!1;break a}}K=!0}K=!K}if(!K){c=f[d]=f[d]||new THREE.RenderableObject;C.copy(ca.position);w.multiplyVector3(C);c.object=ca;c.z=C.z;N.push(c);d++}}W&&N.sort(a);return N};this.projectScene=function(M,N,W){var S=[],aa=N.near,ca=N.far,K,Y,oa,ba,la,ia,ga,qa,ua,l,x,v,n,t,B,J;k=o=q=0;N.matrixAutoUpdate&&N.update();w.multiply(N.projectionMatrix,N.matrixWorldInverse);u[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);u[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,
|
|
|
|
+w.n44+w.n14);u[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);u[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);u[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);u[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(K=0;K<6;K++){ia=u[K];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}M.update(undefined,!1,N);ia=this.projectObjects(M,N,!0);M=0;for(K=ia.length;M<K;M++){ga=ia[M].object;if(ga.visible){qa=ga.matrixWorld;x=ga.matrixRotationWorld;ua=ga.materials;
|
|
|
|
+l=ga.overdraw;if(ga instanceof THREE.Mesh){v=ga.geometry;n=v.vertices;Y=0;for(oa=n.length;Y<oa;Y++){t=n[Y];t.positionWorld.copy(t.position);qa.multiplyVector3(t.positionWorld);ba=t.positionScreen;ba.copy(t.positionWorld);w.multiplyVector4(ba);ba.x/=ba.w;ba.y/=ba.w;t.__visible=ba.z>aa&&ba.z<ca}v=v.faces;Y=0;for(oa=v.length;Y<oa;Y++){t=v[Y];if(t instanceof THREE.Face3){ba=n[t.a];la=n[t.b];B=n[t.c];if(ba.__visible&&la.__visible&&B.__visible&&(ga.doubleSided||ga.flipSided!=(B.positionScreen.x-ba.positionScreen.x)*
|
|
|
|
+(la.positionScreen.y-ba.positionScreen.y)-(B.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(B.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(B.positionScreen);g.normalWorld.copy(t.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);
|
|
|
|
+qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);B=t.vertexNormals;e=g.vertexNormalsWorld;ba=0;for(la=B.length;ba<la;ba++){J=e[ba]=e[ba]||new THREE.Vector3;J.copy(B[ba]);x.multiplyVector3(J)}g.z=g.centroidScreen.z;g.meshMaterials=ua;g.faceMaterials=t.materials;g.overdraw=l;if(ga.geometry.uvs[Y]){g.uvs[0]=ga.geometry.uvs[Y][0];g.uvs[1]=ga.geometry.uvs[Y][1];g.uvs[2]=ga.geometry.uvs[Y][2]}S.push(g);k++}}else if(t instanceof THREE.Face4){ba=
|
|
|
|
+n[t.a];la=n[t.b];B=n[t.c];J=n[t.d];if(ba.__visible&&la.__visible&&B.__visible&&J.__visible&&(ga.doubleSided||ga.flipSided!=((J.positionScreen.x-ba.positionScreen.x)*(la.positionScreen.y-ba.positionScreen.y)-(J.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0||(la.positionScreen.x-B.positionScreen.x)*(J.positionScreen.y-B.positionScreen.y)-(la.positionScreen.y-B.positionScreen.y)*(J.positionScreen.x-B.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);
|
|
|
|
+g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(J.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(J.positionScreen);g.normalWorld.copy(t.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ua;g.faceMaterials=t.materials;g.overdraw=
|
|
|
|
+l;if(ga.geometry.uvs[Y]){g.uvs[0]=ga.geometry.uvs[Y][0];g.uvs[1]=ga.geometry.uvs[Y][1];g.uvs[2]=ga.geometry.uvs[Y][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(la.positionWorld);h.v2.positionWorld.copy(B.positionWorld);h.v3.positionWorld.copy(J.positionWorld);h.v1.positionScreen.copy(la.positionScreen);h.v2.positionScreen.copy(B.positionScreen);h.v3.positionScreen.copy(J.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
|
|
|
|
+h.z=h.centroidScreen.z;h.meshMaterials=ua;h.faceMaterials=t.materials;h.overdraw=l;if(ga.geometry.uvs[Y]){h.uvs[0]=ga.geometry.uvs[Y][1];h.uvs[1]=ga.geometry.uvs[Y][2];h.uvs[2]=ga.geometry.uvs[Y][3]}S.push(h);k++}}}}else if(ga instanceof THREE.Line){F.multiply(w,qa);n=ga.geometry.vertices;t=n[0];t.positionScreen.copy(t.position);F.multiplyVector4(t.positionScreen);Y=1;for(oa=n.length;Y<oa;Y++){ba=n[Y];ba.positionScreen.copy(ba.position);F.multiplyVector4(ba.positionScreen);la=n[Y-1];H.copy(ba.positionScreen);
|
|
|
|
+P.copy(la.positionScreen);if(b(H,P)){H.multiplyScalar(1/H.w);P.multiplyScalar(1/P.w);m=y[o]=y[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(H);m.v2.positionScreen.copy(P);m.z=Math.max(H.z,P.z);m.materials=ga.materials;S.push(m);o++}}}else if(ga instanceof THREE.Particle){E.set(ga.position.x,ga.position.y,ga.position.z,1);w.multiplyVector4(E);E.z/=E.w;if(E.z>0&&E.z<1){p=A[q]=A[q]||new THREE.RenderableParticle;p.x=E.x/E.w;p.y=E.y/E.w;p.z=E.z;p.rotation=ga.rotation.z;p.scale.x=ga.scale.x*Math.abs(p.x-
|
|
|
|
+(E.x+N.projectionMatrix.n11)/(E.w+N.projectionMatrix.n14));p.scale.y=ga.scale.y*Math.abs(p.y-(E.y+N.projectionMatrix.n22)/(E.w+N.projectionMatrix.n24));p.materials=ga.materials;S.push(p);q++}}}}W&&S.sort(a);return S};this.unprojectVector=function(M,N){var W=N.matrixWorld.clone();W.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));W.multiplyVector3(M);return M}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,y,p,q,A,C;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){p=a[j];if(p instanceof THREE.RenderableParticle){A=p.x*f+f;C=p.y*g+g;o=0;for(y=p.material.length;o<y;o++){q=p.material[o];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=A+"px";q.style.top=C+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){function a(ma){if(p!=ma)m.globalAlpha=p=ma}function b(ma){if(q!=ma){switch(ma){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=ma}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),y=0,p=1,q=0,A=null,C=null,E=1,w,F,u,H,P,e,M,N,W,S=new THREE.Color,
|
|
|
|
+aa=new THREE.Color,ca=new THREE.Color,K=new THREE.Color,Y=new THREE.Color,oa,ba,la,ia,ga,qa,ua,l,x,v=new THREE.Rectangle,n=new THREE.Rectangle,t=new THREE.Rectangle,B=!1,J=new THREE.Color,Q=new THREE.Color,G=new THREE.Color,z=new THREE.Color,D=Math.PI*2,I=new THREE.Vector3,T,U,ea,da,xa,R,Da=16;T=document.createElement("canvas");T.width=T.height=2;U=T.getContext("2d");U.fillStyle="rgba(0,0,0,1)";U.fillRect(0,0,2,2);ea=U.getImageData(0,0,2,2);da=ea.data;xa=document.createElement("canvas");xa.width=
|
|
|
|
+xa.height=Da;R=xa.getContext("2d");R.translate(-Da/2,-Da/2);R.scale(Da,Da);Da--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ma,Aa){g=ma;h=Aa;k=g/2;j=h/2;f.width=g;f.height=h;v.set(-k,-j,k,j);p=1;q=0;C=A=null;E=1};this.setClearColor=function(ma,Aa){o=ma;y=Aa};this.setClearColorHex=function(ma,Aa){o.setHex(ma);y=Aa};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!n.isEmpty()){n.inflate(1);n.minSelf(v);if(o.hex==0&&y==0)m.clearRect(n.getX(),
|
|
|
|
+n.getY(),n.getWidth(),n.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+y+")";m.fillRect(n.getX(),n.getY(),n.getWidth(),n.getHeight())}n.empty()}};this.render=function(ma,Aa){function Z(O){var ka,ha,V,fa=O.lights;Q.setRGB(0,0,0);G.setRGB(0,0,0);z.setRGB(0,0,0);O=0;for(ka=fa.length;O<ka;O++){ha=fa[O];V=ha.color;if(ha instanceof THREE.AmbientLight){Q.r+=V.r;Q.g+=V.g;Q.b+=V.b}else if(ha instanceof THREE.DirectionalLight){G.r+=
|
|
|
|
+V.r;G.g+=V.g;G.b+=V.b}else if(ha instanceof THREE.PointLight){z.r+=V.r;z.g+=V.g;z.b+=V.b}}}function X(O,ka,ha,V){var fa,pa,Ca,va,Ea=O.lights;O=0;for(fa=Ea.length;O<fa;O++){pa=Ea[O];Ca=pa.color;va=pa.intensity;if(pa instanceof THREE.DirectionalLight){pa=ha.dot(pa.position)*va;if(pa>0){V.r+=Ca.r*pa;V.g+=Ca.g*pa;V.b+=Ca.b*pa}}else if(pa instanceof THREE.PointLight){I.sub(pa.position,ka);I.normalize();pa=ha.dot(I)*va;if(pa>0){V.r+=Ca.r*pa;V.g+=Ca.g*pa;V.b+=Ca.b*pa}}}}function $(O,ka,ha){if(ha.opacity!=
|
|
|
|
+0){a(ha.opacity);b(ha.blending);var V,fa,pa,Ca,va,Ea;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){Ca=ha.map.image;va=Ca.width>>1;Ea=Ca.height>>1;fa=ka.scale.x*k;pa=ka.scale.y*j;ha=fa*va;V=pa*Ea;t.set(O.x-ha,O.y-V,O.x+ha,O.y+V);if(v.instersects(t)){m.save();m.translate(O.x,O.y);m.rotate(-ka.rotation);m.scale(fa,-pa);m.translate(-va,-Ea);m.drawImage(Ca,0,0);m.restore()}}}else if(ha instanceof THREE.ParticleCircleMaterial){if(B){J.r=Q.r+G.r+z.r;J.g=Q.g+G.g+z.g;J.b=Q.b+G.b+z.b;S.r=ha.color.r*
|
|
|
|
+J.r;S.g=ha.color.g*J.g;S.b=ha.color.b*J.b;S.updateStyleString()}else S.__styleString=ha.color.__styleString;ha=ka.scale.x*k;V=ka.scale.y*j;t.set(O.x-ha,O.y-V,O.x+ha,O.y+V);if(v.instersects(t)){fa=S.__styleString;if(C!=fa)m.fillStyle=C=fa;m.save();m.translate(O.x,O.y);m.rotate(-ka.rotation);m.scale(ha,V);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function sa(O,ka,ha,V){if(V.opacity!=0){a(V.opacity);b(V.blending);m.beginPath();m.moveTo(O.positionScreen.x,O.positionScreen.y);
|
|
|
|
+m.lineTo(ka.positionScreen.x,ka.positionScreen.y);m.closePath();if(V instanceof THREE.LineBasicMaterial){S.__styleString=V.color.__styleString;O=V.linewidth;if(E!=O)m.lineWidth=E=O;O=S.__styleString;if(A!=O)m.strokeStyle=A=O;m.stroke();t.inflate(V.linewidth*2)}}}function Fa(O,ka,ha,V,fa,pa){if(fa.opacity!=0){a(fa.opacity);b(fa.blending);H=O.positionScreen.x;P=O.positionScreen.y;e=ka.positionScreen.x;M=ka.positionScreen.y;N=ha.positionScreen.x;W=ha.positionScreen.y;m.beginPath();m.moveTo(H,P);m.lineTo(e,
|
|
|
|
+M);m.lineTo(N,W);m.lineTo(H,P);m.closePath();if(fa instanceof THREE.MeshBasicMaterial)if(fa.map)fa.map.mapping instanceof THREE.UVMapping&&ya(H,P,e,M,N,W,fa.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);else if(fa.envMap){if(fa.envMap.mapping instanceof THREE.SphericalReflectionMapping){O=Aa.matrixWorldInverse;I.copy(V.vertexNormalsWorld[0]);ia=(I.x*O.n11+I.y*O.n12+I.z*O.n13)*0.5+0.5;ga=-(I.x*O.n21+I.y*O.n22+I.z*O.n23)*0.5+0.5;I.copy(V.vertexNormalsWorld[1]);qa=(I.x*
|
|
|
|
+O.n11+I.y*O.n12+I.z*O.n13)*0.5+0.5;ua=-(I.x*O.n21+I.y*O.n22+I.z*O.n23)*0.5+0.5;I.copy(V.vertexNormalsWorld[2]);l=(I.x*O.n11+I.y*O.n12+I.z*O.n13)*0.5+0.5;x=-(I.x*O.n21+I.y*O.n22+I.z*O.n23)*0.5+0.5;ya(H,P,e,M,N,W,fa.envMap.image,ia,ga,qa,ua,l,x)}}else fa.wireframe?za(fa.color.__styleString,fa.wireframeLinewidth):L(fa.color.__styleString);else if(fa instanceof THREE.MeshLambertMaterial){if(fa.map&&!fa.wireframe){fa.map.mapping instanceof THREE.UVMapping&&ya(H,P,e,M,N,W,fa.map.image,V.uvs[0].u,V.uvs[0].v,
|
|
|
|
+V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);b(THREE.SubtractiveBlending)}if(B)if(!fa.wireframe&&fa.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3){aa.r=ca.r=K.r=Q.r;aa.g=ca.g=K.g=Q.g;aa.b=ca.b=K.b=Q.b;X(pa,V.v1.positionWorld,V.vertexNormalsWorld[0],aa);X(pa,V.v2.positionWorld,V.vertexNormalsWorld[1],ca);X(pa,V.v3.positionWorld,V.vertexNormalsWorld[2],K);Y.r=(ca.r+K.r)*0.5;Y.g=(ca.g+K.g)*0.5;Y.b=(ca.b+K.b)*0.5;la=Ra(aa,ca,K,Y);ya(H,P,e,M,N,W,la,0,0,1,0,0,1)}else{J.r=Q.r;J.g=Q.g;J.b=
|
|
|
|
+Q.b;X(pa,V.centroidWorld,V.normalWorld,J);S.r=fa.color.r*J.r;S.g=fa.color.g*J.g;S.b=fa.color.b*J.b;S.updateStyleString();fa.wireframe?za(S.__styleString,fa.wireframeLinewidth):L(S.__styleString)}else fa.wireframe?za(fa.color.__styleString,fa.wireframeLinewidth):L(fa.color.__styleString)}else if(fa instanceof THREE.MeshDepthMaterial){oa=Aa.near;ba=Aa.far;aa.r=aa.g=aa.b=1-Pa(O.positionScreen.z,oa,ba);ca.r=ca.g=ca.b=1-Pa(ka.positionScreen.z,oa,ba);K.r=K.g=K.b=1-Pa(ha.positionScreen.z,oa,ba);Y.r=(ca.r+
|
|
|
|
+K.r)*0.5;Y.g=(ca.g+K.g)*0.5;Y.b=(ca.b+K.b)*0.5;la=Ra(aa,ca,K,Y);ya(H,P,e,M,N,W,la,0,0,1,0,0,1)}else if(fa instanceof THREE.MeshNormalMaterial){S.r=Ia(V.normalWorld.x);S.g=Ia(V.normalWorld.y);S.b=Ia(V.normalWorld.z);S.updateStyleString();fa.wireframe?za(S.__styleString,fa.wireframeLinewidth):L(S.__styleString)}}}function za(O,ka){if(A!=O)m.strokeStyle=A=O;if(E!=ka)m.lineWidth=E=ka;m.stroke();t.inflate(ka*2)}function L(O){if(C!=O)m.fillStyle=C=O;m.fill()}function ya(O,ka,ha,V,fa,pa,Ca,va,Ea,Na,La,Oa,
|
|
|
|
+Ka){var Ga,Ja;Ga=Ca.width-1;Ja=Ca.height-1;va*=Ga;Ea*=Ja;Na*=Ga;La*=Ja;Oa*=Ga;Ka*=Ja;ha-=O;V-=ka;fa-=O;pa-=ka;Na-=va;La-=Ea;Oa-=va;Ka-=Ea;Ga=Na*Ka-Oa*La;if(Ga!=0){Ja=1/Ga;Ga=(Ka*ha-La*fa)*Ja;La=(Ka*V-La*pa)*Ja;ha=(Na*fa-Oa*ha)*Ja;V=(Na*pa-Oa*V)*Ja;O=O-Ga*va-ha*Ea;ka=ka-La*va-V*Ea;m.save();m.transform(Ga,La,ha,V,O,ka);m.clip();m.drawImage(Ca,0,0);m.restore()}}function Ra(O,ka,ha,V){var fa=~~(O.r*255),pa=~~(O.g*255);O=~~(O.b*255);var Ca=~~(ka.r*255),va=~~(ka.g*255);ka=~~(ka.b*255);var Ea=~~(ha.r*255),
|
|
|
|
+Na=~~(ha.g*255);ha=~~(ha.b*255);var La=~~(V.r*255),Oa=~~(V.g*255);V=~~(V.b*255);da[0]=fa<0?0:fa>255?255:fa;da[1]=pa<0?0:pa>255?255:pa;da[2]=O<0?0:O>255?255:O;da[4]=Ca<0?0:Ca>255?255:Ca;da[5]=va<0?0:va>255?255:va;da[6]=ka<0?0:ka>255?255:ka;da[8]=Ea<0?0:Ea>255?255:Ea;da[9]=Na<0?0:Na>255?255:Na;da[10]=ha<0?0:ha>255?255:ha;da[12]=La<0?0:La>255?255:La;da[13]=Oa<0?0:Oa>255?255:Oa;da[14]=V<0?0:V>255?255:V;U.putImageData(ea,0,0);R.drawImage(T,0,0);return xa}function Pa(O,ka,ha){O=(O-ka)/(ha-ka);return O*
|
|
|
|
+O*(3-2*O)}function Ia(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function ta(O,ka){var ha=ka.x-O.x,V=ka.y-O.y,fa=1/Math.sqrt(ha*ha+V*V);ha*=fa;V*=fa;ka.x+=ha;ka.y+=V;O.x-=ha;O.y-=V}var Ba,wa,ja,na,ra,Ma,Ha,Sa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ma,Aa,this.sortElements);(B=ma.lights.length>0)&&Z(ma);Ba=0;for(wa=c.length;Ba<wa;Ba++){ja=c[Ba];t.empty();if(ja instanceof THREE.RenderableParticle){w=ja;w.x*=k;w.y*=j;na=0;for(ra=ja.materials.length;na<ra;na++)$(w,ja,ja.materials[na],
|
|
|
|
+ma)}else if(ja instanceof THREE.RenderableLine){w=ja.v1;F=ja.v2;w.positionScreen.x*=k;w.positionScreen.y*=j;F.positionScreen.x*=k;F.positionScreen.y*=j;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(F.positionScreen.x,F.positionScreen.y);if(v.instersects(t)){na=0;for(ra=ja.materials.length;na<ra;)sa(w,F,ja,ja.materials[na++],ma)}}else if(ja instanceof THREE.RenderableFace3){w=ja.v1;F=ja.v2;u=ja.v3;w.positionScreen.x*=k;w.positionScreen.y*=j;F.positionScreen.x*=k;F.positionScreen.y*=
|
|
|
|
+j;u.positionScreen.x*=k;u.positionScreen.y*=j;if(ja.overdraw){ta(w.positionScreen,F.positionScreen);ta(F.positionScreen,u.positionScreen);ta(u.positionScreen,w.positionScreen)}t.add3Points(w.positionScreen.x,w.positionScreen.y,F.positionScreen.x,F.positionScreen.y,u.positionScreen.x,u.positionScreen.y);if(v.instersects(t)){na=0;for(ra=ja.meshMaterials.length;na<ra;){Sa=ja.meshMaterials[na++];if(Sa instanceof THREE.MeshFaceMaterial){Ma=0;for(Ha=ja.faceMaterials.length;Ma<Ha;)(Sa=ja.faceMaterials[Ma++])&&
|
|
|
|
+Fa(w,F,u,ja,Sa,ma)}else Fa(w,F,u,ja,Sa,ma)}}}n.addRectangle(t)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(ia,ga,qa){var ua,l,x,v;ua=0;for(l=ia.lights.length;ua<l;ua++){x=ia.lights[ua];if(x instanceof THREE.DirectionalLight){v=ga.normalWorld.dot(x.position)*x.intensity;if(v>0){qa.r+=x.color.r*v;qa.g+=x.color.g*v;qa.b+=x.color.b*v}}else if(x instanceof THREE.PointLight){W.sub(x.position,ga.centroidWorld);W.normalize();v=ga.normalWorld.dot(W)*x.intensity;if(v>0){qa.r+=x.color.r*v;qa.g+=x.color.g*v;qa.b+=x.color.b*v}}}}function b(ia,ga,qa,ua,l,x){K=d(Y++);K.setAttribute("d",
|
|
|
|
+"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(F){H.r=P.r;H.g=P.g;H.b=P.b;a(x,ua,H);u.r=l.color.r*H.r;u.g=l.color.g*H.g;u.b=l.color.b*H.b;u.updateStyleString()}else u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){N=1-l.__2near/(l.__farPlusNear-
|
|
|
|
+ua.z*l.__farMinusNear);u.setRGB(N,N,N)}else l instanceof THREE.MeshNormalMaterial&&u.setRGB(f(ua.normalWorld.x),f(ua.normalWorld.y),f(ua.normalWorld.z));l.wireframe?K.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):K.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(K)}function c(ia,ga,qa,ua,l,
|
|
|
|
+x,v){K=d(Y++);K.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)u.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(F){H.r=P.r;H.g=P.g;H.b=P.b;a(v,l,H);u.r=x.color.r*H.r;u.g=x.color.g*H.g;u.b=x.color.b*H.b;u.updateStyleString()}else u.__styleString=x.color.__styleString;
|
|
|
|
+else if(x instanceof THREE.MeshDepthMaterial){N=1-x.__2near/(x.__farPlusNear-l.z*x.__farMinusNear);u.setRGB(N,N,N)}else x instanceof THREE.MeshNormalMaterial&&u.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));x.wireframe?K.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):K.setAttribute("style","fill: "+u.__styleString+
|
|
|
|
+"; fill-opacity: "+x.opacity);k.appendChild(K)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");la==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,y,p,q,A,C,E=new THREE.Rectangle,w=new THREE.Rectangle,F=!1,u=new THREE.Color(16777215),H=new THREE.Color(16777215),
|
|
|
|
+P=new THREE.Color(0),e=new THREE.Color(0),M=new THREE.Color(0),N,W=new THREE.Vector3,S=[],aa=[],ca=[],K,Y,oa,ba,la=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":la=1;break;case "low":la=0}};this.setSize=function(ia,ga){j=ia;m=ga;o=j/2;y=m/2;k.setAttribute("viewBox",-o+" "+-y+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);E.set(-o,-y,o,y)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
|
|
|
|
+this.render=function(ia,ga){var qa,ua,l,x,v,n,t,B;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ba=oa=Y=0;if(F=ia.lights.length>0){t=ia.lights;P.setRGB(0,0,0);e.setRGB(0,0,0);M.setRGB(0,0,0);qa=0;for(ua=t.length;qa<ua;qa++){l=t[qa];x=l.color;if(l instanceof THREE.AmbientLight){P.r+=x.r;P.g+=x.g;P.b+=x.b}else if(l instanceof THREE.DirectionalLight){e.r+=x.r;e.g+=x.g;e.b+=x.b}else if(l instanceof THREE.PointLight){M.r+=x.r;M.g+=x.g;M.b+=x.b}}}qa=0;for(ua=g.length;qa<ua;qa++){t=
|
|
|
|
+g[qa];w.empty();if(t instanceof THREE.RenderableParticle){p=t;p.x*=o;p.y*=-y;l=0;for(x=t.materials.length;l<x;l++)if(B=t.materials[l]){v=p;n=t;var J=oa++;if(aa[J]==null){aa[J]=document.createElementNS("http://www.w3.org/2000/svg","circle");la==0&&aa[J].setAttribute("shape-rendering","crispEdges")}K=aa[J];K.setAttribute("cx",v.x);K.setAttribute("cy",v.y);K.setAttribute("r",n.scale.x*o);if(B instanceof THREE.ParticleCircleMaterial){if(F){H.r=P.r+e.r+M.r;H.g=P.g+e.g+M.g;H.b=P.b+e.b+M.b;u.r=B.color.r*
|
|
|
|
+H.r;u.g=B.color.g*H.g;u.b=B.color.b*H.b;u.updateStyleString()}else u=B.color;K.setAttribute("style","fill: "+u.__styleString)}k.appendChild(K)}}else if(t instanceof THREE.RenderableLine){p=t.v1;q=t.v2;p.positionScreen.x*=o;p.positionScreen.y*=-y;q.positionScreen.x*=o;q.positionScreen.y*=-y;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(q.positionScreen.x,q.positionScreen.y);if(E.instersects(w)){l=0;for(x=t.materials.length;l<x;)if(B=t.materials[l++]){v=p;n=q;J=ba++;if(ca[J]==null){ca[J]=
|
|
|
|
+document.createElementNS("http://www.w3.org/2000/svg","line");la==0&&ca[J].setAttribute("shape-rendering","crispEdges")}K=ca[J];K.setAttribute("x1",v.positionScreen.x);K.setAttribute("y1",v.positionScreen.y);K.setAttribute("x2",n.positionScreen.x);K.setAttribute("y2",n.positionScreen.y);if(B instanceof THREE.LineBasicMaterial){u.__styleString=B.color.__styleString;K.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+
|
|
|
|
+B.linecap+"; stroke-linejoin: "+B.linejoin);k.appendChild(K)}}}}else if(t instanceof THREE.RenderableFace3){p=t.v1;q=t.v2;A=t.v3;p.positionScreen.x*=o;p.positionScreen.y*=-y;q.positionScreen.x*=o;q.positionScreen.y*=-y;A.positionScreen.x*=o;A.positionScreen.y*=-y;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(w)){l=0;for(x=t.meshMaterials.length;l<x;){B=t.meshMaterials[l++];if(B instanceof
|
|
|
|
+THREE.MeshFaceMaterial){v=0;for(n=t.faceMaterials.length;v<n;)(B=t.faceMaterials[v++])&&b(p,q,A,t,B,ia)}else B&&b(p,q,A,t,B,ia)}}}else if(t instanceof THREE.RenderableFace4){p=t.v1;q=t.v2;A=t.v3;C=t.v4;p.positionScreen.x*=o;p.positionScreen.y*=-y;q.positionScreen.x*=o;q.positionScreen.y*=-y;A.positionScreen.x*=o;A.positionScreen.y*=-y;C.positionScreen.x*=o;C.positionScreen.y*=-y;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(A.positionScreen.x,
|
|
|
|
+A.positionScreen.y);w.addPoint(C.positionScreen.x,C.positionScreen.y);if(E.instersects(w)){l=0;for(x=t.meshMaterials.length;l<x;){B=t.meshMaterials[l++];if(B instanceof THREE.MeshFaceMaterial){v=0;for(n=t.faceMaterials.length;v<n;)(B=t.faceMaterials[v++])&&c(p,q,A,C,t,B,ia)}else B&&c(p,q,A,C,t,B,ia)}}}}}};
|
|
|
|
+THREE.WebGLRenderer=function(a){function b(l,x,v){var n,t,B,J=l.vertices,Q=J.length,G=l.colors,z=G.length,D=l.__vertexArray,I=l.__colorArray,T=l.__sortArray,U=l.__dirtyVertices,ea=l.__dirtyColors;if(v.sortParticles){oa.multiplySelf(v.matrixWorld);for(n=0;n<Q;n++){t=J[n].position;ia.copy(t);oa.multiplyVector3(ia);T[n]=[ia.z,n]}T.sort(function(da,xa){return xa[0]-da[0]});for(n=0;n<Q;n++){t=J[T[n][1]].position;B=n*3;D[B]=t.x;D[B+1]=t.y;D[B+2]=t.z}for(n=0;n<z;n++){B=n*3;color=G[T[n][1]];I[B]=color.r;
|
|
|
|
+I[B+1]=color.g;I[B+2]=color.b}}else{if(U)for(n=0;n<Q;n++){t=J[n].position;B=n*3;D[B]=t.x;D[B+1]=t.y;D[B+2]=t.z}if(ea)for(n=0;n<z;n++){color=G[n];B=n*3;I[B]=color.r;I[B+1]=color.g;I[B+2]=color.b}}if(U||v.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,x)}if(ea||v.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,x)}}function c(l,x){l.fragmentShader=x.fragmentShader;l.vertexShader=x.vertexShader;l.uniforms=
|
|
|
|
+Uniforms.clone(x.uniforms)}function d(l,x,v,n,t){n.program||W.initMaterial(n,x,v);var B=n.program,J=B.uniforms,Q=n.uniforms;if(B!=M){e.useProgram(B);M=B;e.uniformMatrix4fv(J.projectionMatrix,!1,ba)}if(v&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){Q.fogColor.value.setHex(v.color.hex);if(v instanceof THREE.Fog){Q.fogNear.value=v.near;Q.fogFar.value=
|
|
|
|
+v.far}else if(v instanceof THREE.FogExp2)Q.fogDensity.value=v.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){var G,z,D=0,I=0,T=0,U,ea,da,xa=W.lights,R=xa.directional.colors,Da=xa.directional.positions,ma=xa.point.colors,Aa=xa.point.positions,Z=0,X=0;v=z=z=0;for(G=x.length;v<G;v++){z=x[v];U=z.color;ea=z.position;da=z.intensity;if(z instanceof THREE.AmbientLight){D+=U.r;I+=U.g;T+=U.b}else if(z instanceof THREE.DirectionalLight){z=Z*3;R[z]=U.r*da;R[z+1]=U.g*
|
|
|
|
+da;R[z+2]=U.b*da;Da[z]=ea.x;Da[z+1]=ea.y;Da[z+2]=ea.z;Z+=1}else if(z instanceof THREE.PointLight){z=X*3;ma[z]=U.r*da;ma[z+1]=U.g*da;ma[z+2]=U.b*da;Aa[z]=ea.x;Aa[z+1]=ea.y;Aa[z+2]=ea.z;X+=1}}for(v=Z*3;v<R.length;v++)R[v]=0;for(v=X*3;v<ma.length;v++)ma[v]=0;xa.point.length=X;xa.directional.length=Z;xa.ambient[0]=D;xa.ambient[1]=I;xa.ambient[2]=T;x=W.lights;Q.enableLighting.value=x.directional.length+x.point.length;Q.ambientLightColor.value=x.ambient;Q.directionalLightColor.value=x.directional.colors;
|
|
|
|
+Q.directionalLightDirection.value=x.directional.positions;Q.pointLightColor.value=x.point.colors;Q.pointLightPosition.value=x.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){Q.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);Q.opacity.value=n.opacity;Q.map.texture=n.map;Q.lightMap.texture=n.lightMap;Q.envMap.texture=n.envMap;Q.reflectivity.value=n.reflectivity;Q.refractionRatio.value=
|
|
|
|
+n.refractionRatio;Q.combine.value=n.combine;Q.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){Q.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);Q.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){Q.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);Q.opacity.value=n.opacity;Q.size.value=n.size;Q.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){Q.ambient.value.setRGB(n.ambient.r,
|
|
|
|
+n.ambient.g,n.ambient.b);Q.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);Q.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){Q.mNear.value=l.near;Q.mFar.value=l.far;Q.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)Q.opacity.value=n.opacity;for(var $ in Q)if(D=B.uniforms[$]){v=Q[$];G=v.type;x=v.value;if(G=="i")e.uniform1i(D,x);else if(G=="f")e.uniform1f(D,x);else if(G=="fv1")e.uniform1fv(D,x);else if(G=="fv")e.uniform3fv(D,x);else if(G==
|
|
|
|
+"v2")e.uniform2f(D,x.x,x.y);else if(G=="v3")e.uniform3f(D,x.x,x.y,x.z);else if(G=="c")e.uniform3f(D,x.r,x.g,x.b);else if(G=="t"){e.uniform1i(D,x);if(v=v.texture)if(v.image instanceof Array&&v.image.length==6){if(v.image.length==6){if(v.needsUpdate){if(!v.image.__webGLTextureCube)v.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,v.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,
|
|
|
|
+e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(G=0;G<6;++G)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,v.image[G]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);v.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,v.image.__webGLTextureCube)}}else{if(v.needsUpdate){if(v.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
|
|
|
|
+v.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,v.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,H(v.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,H(v.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,H(v.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,H(v.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{v.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,v.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
|
|
|
|
+0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,v.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,H(v.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,H(v.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,H(v.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,H(v.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);v.__wasSetOnce=!0}v.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_2D,v.__webGLTexture)}}}e.uniformMatrix4fv(J.modelViewMatrix,
|
|
|
|
+!1,t._modelViewMatrixArray);e.uniformMatrix3fv(J.normalMatrix,!1,t._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&e.uniform3f(J.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&e.uniformMatrix4fv(J.objectMatrix,!1,t._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&e.uniformMatrix4fv(J.viewMatrix,
|
|
|
|
+!1,la);if(n.skinning){e.uniformMatrix4fv(J.cameraInverseMatrix,!1,la);e.uniformMatrix4fv(J.boneGlobalMatrices,!1,t.boneMatrices)}return B}function f(l,x,v,n,t,B){l=d(l,x,v,n,B).attributes;e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,
|
|
|
|
+3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(t.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(t.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
|
|
|
|
+if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
|
|
|
|
+4,e.FLOAT,!1,0,0)}if(B instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);e.drawElements(e.LINES,t.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,t.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(B,0,t.__webGLLineCount)}else if(B instanceof
|
|
|
|
+THREE.ParticleSystem)e.drawArrays(e.POINTS,0,t.__webGLParticleCount);else B instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,t.__webGLVertexCount)}function g(l,x){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.position);e.vertexAttribPointer(x.attributes.position,
|
|
|
|
+3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.normal);e.vertexAttribPointer(x.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(S!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);S=l.doubleSided}if(aa!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);aa=l.flipSided}}function k(l){if(K!=
|
|
|
|
+l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);K=l}}function j(l){Y[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);Y[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);Y[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);Y[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);Y[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);Y[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var x;for(l=0;l<6;l++){x=Y[l];x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z))}}
|
|
|
|
+function m(l){for(var x=l.matrixWorld,v=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=Y[n].x*x.n14+Y[n].y*x.n24+Y[n].z*x.n34+Y[n].w;if(l<=v)return!1}return!0}function o(l,x){l.list[l.count]=x;l.count+=1}function y(l){var x,v,n=l.object,t=l.opaque,B=l.transparent;B.count=0;l=t.count=0;for(x=n.materials.length;l<x;l++){v=n.materials[l];v.opacity&&v.opacity<1||v.blending!=THREE.NormalBlending?o(B,v):o(t,v)}}function p(l){var x,v,n,t,B=l.object,J=l.buffer,
|
|
|
|
+Q=l.opaque,G=l.transparent;G.count=0;l=Q.count=0;for(n=B.materials.length;l<n;l++){x=B.materials[l];if(x instanceof THREE.MeshFaceMaterial){x=0;for(v=J.materials.length;x<v;x++)(t=J.materials[x])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?o(G,t):o(Q,t))}else{t=x;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?o(G,t):o(Q,t)}}}function q(l,x){return x.z-l.z}function A(l,x){l._modelViewMatrix.multiplyToArray(x.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
|
|
|
|
+function C(l){function x(I){var T=[];v=0;for(n=I.length;v<n;v++)I[v]==undefined?T.push("undefined"):T.push(I[v].id);return T.join("_")}var v,n,t,B,J,Q,G,z,D={};l.geometryGroups={};t=0;for(B=l.faces.length;t<B;t++){J=l.faces[t];Q=J.materials;G=x(Q);D[G]==undefined&&(D[G]={hash:G,counter:0});z=D[G].hash+"_"+D[G].counter;l.geometryGroups[z]==undefined&&(l.geometryGroups[z]={faces:[],materials:Q,vertices:0});J=J instanceof THREE.Face3?3:4;if(l.geometryGroups[z].vertices+J>65535){D[G].counter+=1;z=D[G].hash+
|
|
|
|
+"_"+D[G].counter;l.geometryGroups[z]==undefined&&(l.geometryGroups[z]={faces:[],materials:Q,vertices:0})}l.geometryGroups[z].faces.push(t);l.geometryGroups[z].vertices+=J}}function E(l,x,v){l.push({buffer:x,object:v,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);
|
|
|
|
+e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function F(l,x){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,
|
|
|
|
+e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,H(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,H(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,H(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,H(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,H(l.format),l.width,l.height,0,H(l.format),H(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,
|
|
|
|
+e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var v,n,t;if(l){v=l.__webGLFramebuffer;n=l.width;t=l.height}else{v=null;n=P.width;t=P.height}if(v!=N){e.bindFramebuffer(e.FRAMEBUFFER,v);e.viewport(0,0,n,t);x&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);N=v}}function u(l,x){var v;if(l==
|
|
|
|
+"fragment")v=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(v=e.createShader(e.VERTEX_SHADER));e.shaderSource(v,x);e.compileShader(v);if(!e.getShaderParameter(v,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(v));return null}return v}function H(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;
|
|
|
|
+case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;
|
|
|
|
+case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var P=document.createElement("canvas"),e,M=null,N=null,W=this,S=null,aa=null,ca=null,K=null,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ba=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4,
|
|
|
|
+ga=!0,qa=new THREE.Color(0),ua=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)ua=a.clearAlpha}this.domElement=P;this.autoClear=!0;this.sortObjects=!1;(function(l,x,v){try{e=P.getContext("experimental-webgl",{antialias:l})}catch(n){console.log(n)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
|
|
|
|
+e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(x.r,x.g,x.b,v);_cullEnabled=!0})(ga,qa,ua);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,x){P.width=l;P.height=x;e.viewport(0,0,P.width,P.height)};this.setClearColorHex=function(l,x){var v=new THREE.Color(l);e.clearColor(v.r,v.g,v.b,x)};this.setClearColor=function(l,x){e.clearColor(l.r,l.g,l.b,x)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
|
|
|
|
+e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,x,v){var n,t;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
|
|
|
|
+THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var B,J,Q,G;t=Q=G=0;for(B=x.length;t<B;t++){J=x[t];J instanceof THREE.DirectionalLight&&Q++;J instanceof THREE.PointLight&&G++}if(G+Q<=4)x=Q;else{x=Math.ceil(4*Q/(G+Q));G=4-x}t={directional:x,point:G};G=l.fragmentShader;x=l.vertexShader;B={fog:v,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:t.directional,maxPointLights:t.point};v=e.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif",
|
|
|
|
+"#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");B=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
|
|
|
+B.maxPointLights,B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
|
+e.attachShader(v,u("fragment",t+G));e.attachShader(v,u("vertex",B+x));e.linkProgram(v);e.getProgramParameter(v,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};l.program=v;v=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(n in l.uniforms)v.push(n);n=l.program;G=0;for(x=v.length;G<
|
|
|
|
+x;G++){t=v[G];n.uniforms[t]=e.getUniformLocation(n,t)}n=l.program;v=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];G=0;for(x=v.length;G<x;G++){t=v[G];n.attributes[t]=e.getAttribLocation(n,t)}n=l.program.attributes;e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);if(l.skinning&&n.skinVertexA>=0&&n.skinVertexB>=
|
|
|
|
+0&&n.skinIndex>=0&&n.skinWeight>=0){e.enableVertexAttribArray(n.skinVertexA);e.enableVertexAttribArray(n.skinVertexB);e.enableVertexAttribArray(n.skinIndex);e.enableVertexAttribArray(n.skinWeight)}};this.render=function(l,x,v,n){var t,B,J,Q,G,z,D,I,T=l.lights,U=l.fog;x.matrixAutoUpdate&&x.update();x.matrixWorldInverse.flattenToArray(la);x.projectionMatrix.flattenToArray(ba);oa.multiply(x.projectionMatrix,x.matrixWorldInverse);j(oa);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,
|
|
|
|
+!1,x);this.initWebGLObjects(l,x);F(v,n!==undefined?n:!0);this.autoClear&&this.clear();G=l.__webglObjects.length;for(n=0;n<G;n++){t=l.__webglObjects[n];D=t.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,x);p(t);t.render=!0;if(this.sortObjects){ia.copy(D.position);oa.multiplyVector3(ia);t.z=ia.z}}else t.render=!1;else t.render=!1}this.sortObjects&&l.__webglObjects.sort(q);z=l.__webglObjectsImmediate.length;for(n=0;n<z;n++){t=l.__webglObjectsImmediate[n];
|
|
|
|
+D=t.object;if(D.visible){D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,x);y(t)}}w(THREE.NormalBlending);for(n=0;n<G;n++){t=l.__webglObjects[n];if(t.render){D=t.object;I=t.buffer;J=t.opaque;h(D);for(t=0;t<J.count;t++){Q=J.list[t];k(Q.depthTest);f(x,T,U,Q,I,D)}}}for(n=0;n<z;n++){t=l.__webglObjectsImmediate[n];D=t.object;if(D.visible){J=t.opaque;h(D);for(t=0;t<J.count;t++){Q=J.list[t];k(Q.depthTest);B=d(x,T,U,Q,D);D.render(function(ea){g(ea,B)})}}}for(n=0;n<G;n++){t=l.__webglObjects[n];
|
|
|
|
+if(t.render){D=t.object;I=t.buffer;J=t.transparent;h(D);for(t=0;t<J.count;t++){Q=J.list[t];w(Q.blending);k(Q.depthTest);f(x,T,U,Q,I,D)}}}for(n=0;n<z;n++){t=l.__webglObjectsImmediate[n];D=t.object;if(D.visible){J=t.transparent;h(D);for(t=0;t<J.count;t++){Q=J.list[t];w(Q.blending);k(Q.depthTest);B=d(x,T,U,Q,D);D.render(function(ea){g(ea,B)})}}}if(v&&v.minFilter!==THREE.NearestFilter&&v.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,v.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
|
|
|
|
+null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsRemoved.length;){var x=l.__objectsRemoved[0],v=l,n=void 0,t=void 0;for(n=v.__webglObjects.length-1;n>=0;n--){t=v.__webglObjects[n].object;x==t&&v.__webglObjects.splice(n,1)}l.__objectsRemoved.splice(0,1)}for(;l.__objectsAdded.length;){x=l.__objectsAdded[0];var B=l;n=void 0;v=void 0;t=void 0;if(x._modelViewMatrix==undefined){x._modelViewMatrix=new THREE.Matrix4;x._normalMatrixArray=
|
|
|
|
+new Float32Array(9);x._modelViewMatrixArray=new Float32Array(16);x._objectMatrixArray=new Float32Array(16);x.matrixWorld.flattenToArray(x._objectMatrixArray)}objlist=B.__webglObjects;if(x instanceof THREE.Mesh){v=x.geometry;v.geometryGroups==undefined&&C(v);for(n in v.geometryGroups){t=v.geometryGroups[n];if(!t.__webGLVertexBuffer){B=t;B.__webGLVertexBuffer=e.createBuffer();B.__webGLNormalBuffer=e.createBuffer();B.__webGLTangentBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B.__webGLUVBuffer=
|
|
|
|
+e.createBuffer();B.__webGLUV2Buffer=e.createBuffer();B.__webGLSkinVertexABuffer=e.createBuffer();B.__webGLSkinVertexBBuffer=e.createBuffer();B.__webGLSkinIndicesBuffer=e.createBuffer();B.__webGLSkinWeightsBuffer=e.createBuffer();B.__webGLFaceBuffer=e.createBuffer();B.__webGLLineBuffer=e.createBuffer();B=t;var J=x,Q=void 0,G=void 0,z=0,D=0,I=0,T=J.geometry.faces,U=B.faces;Q=0;for(G=U.length;Q<G;Q++){fi=U[Q];face=T[fi];if(face instanceof THREE.Face3){z+=3;D+=1;I+=3}else if(face instanceof THREE.Face4){z+=
|
|
|
|
+4;D+=2;I+=4}}B.__vertexArray=new Float32Array(z*3);B.__normalArray=new Float32Array(z*3);B.__tangentArray=new Float32Array(z*4);B.__colorArray=new Float32Array(z*3);B.__uvArray=new Float32Array(z*2);B.__uv2Array=new Float32Array(z*2);B.__skinVertexAArray=new Float32Array(z*4);B.__skinVertexBArray=new Float32Array(z*4);B.__skinIndexArray=new Float32Array(z*4);B.__skinWeightArray=new Float32Array(z*4);B.__faceArray=new Uint16Array(D*3);B.__lineArray=new Uint16Array(I*2);G=Q=B;z=void 0;T=void 0;var ea=
|
|
|
|
+void 0,da=void 0;ea=void 0;U=!1;z=0;for(T=J.materials.length;z<T;z++){ea=J.materials[z];if(ea instanceof THREE.MeshFaceMaterial){ea=0;for(da=G.materials.length;ea<da;ea++)if(G.materials[ea]&&G.materials[ea].shading!=undefined&&G.materials[ea].shading==THREE.SmoothShading){U=!0;break}}else if(ea&&ea.shading!=undefined&&ea.shading==THREE.SmoothShading){U=!0;break}if(U)break}Q.__needsSmoothNormals=U;B.__webGLFaceCount=D*3;B.__webGLLineCount=I*2;v.__dirtyVertices=!0;v.__dirtyElements=!0;v.__dirtyUvs=
|
|
|
|
+!0;v.__dirtyNormals=!0;v.__dirtyTangents=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyElements||v.__dirtyUvs||v.__dirtyNormals||v.__dirtyColors||v.__dirtyTangents){B=t;D=e.DYNAMIC_DRAW;I=void 0;Q=void 0;var xa=void 0,R=void 0,Da=void 0,ma=void 0,Aa=void 0;xa=void 0;var Z=void 0,X=void 0,$=void 0,sa=void 0;Z=void 0;X=void 0;$=void 0;R=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=
|
|
|
|
+void 0;X=void 0;$=void 0;sa=void 0;R=void 0;ma=void 0;Da=void 0;Aa=void 0;var Fa=da=ea=U=T=z=J=G=0,za=0,L=0,ya=B.__vertexArray,Ra=B.__uvArray,Pa=B.__uv2Array,Ia=B.__normalArray,ta=B.__tangentArray,Ba=B.__colorArray,wa=B.__skinVertexAArray,ja=B.__skinVertexBArray,na=B.__skinIndexArray,ra=B.__skinWeightArray,Ma=B.__faceArray,Ha=B.__lineArray,Sa=B.__needsSmoothNormals,O=x.geometry,ka=O.__dirtyVertices,ha=O.__dirtyElements,V=O.__dirtyUvs,fa=O.__dirtyNormals,pa=O.__dirtyTangents,Ca=O.__dirtyColors,va=
|
|
|
|
+O.vertices,Ea=B.faces,Na=O.faces,La=O.uvs,Oa=O.uvs2,Ka=O.colors,Ga=O.skinVerticesA,Ja=O.skinVerticesB,Ta=O.skinIndices,Qa=O.skinWeights;I=0;for(Q=Ea.length;I<Q;I++){xa=Ea[I];R=Na[xa];Aa=La[xa];xa=Oa[xa];Da=R.vertexNormals;ma=R.normal;if(R instanceof THREE.Face3){if(ka){Z=va[R.a].position;X=va[R.b].position;$=va[R.c].position;ya[J]=Z.x;ya[J+1]=Z.y;ya[J+2]=Z.z;ya[J+3]=X.x;ya[J+4]=X.y;ya[J+5]=X.z;ya[J+6]=$.x;ya[J+7]=$.y;ya[J+8]=$.z;J+=9}if(Qa.length){Z=Qa[R.a];X=Qa[R.b];$=Qa[R.c];ra[L]=Z.x;ra[L+1]=Z.y;
|
|
|
|
+ra[L+2]=Z.z;ra[L+3]=Z.w;ra[L+4]=X.x;ra[L+5]=X.y;ra[L+6]=X.z;ra[L+7]=X.w;ra[L+8]=$.x;ra[L+9]=$.y;ra[L+10]=$.z;ra[L+11]=$.w;Z=Ta[R.a];X=Ta[R.b];$=Ta[R.c];na[L]=Z.x;na[L+1]=Z.y;na[L+2]=Z.z;na[L+3]=Z.w;na[L+4]=X.x;na[L+5]=X.y;na[L+6]=X.z;na[L+7]=X.w;na[L+8]=$.x;na[L+9]=$.y;na[L+10]=$.z;na[L+11]=$.w;Z=Ga[R.a];X=Ga[R.b];$=Ga[R.c];wa[L]=Z.x;wa[L+1]=Z.y;wa[L+2]=Z.z;wa[L+3]=1;wa[L+4]=X.x;wa[L+5]=X.y;wa[L+6]=X.z;wa[L+7]=1;wa[L+8]=$.x;wa[L+9]=$.y;wa[L+10]=$.z;wa[L+11]=1;Z=Ja[R.a];X=Ja[R.b];$=Ja[R.c];ja[L]=Z.x;
|
|
|
|
+ja[L+1]=Z.y;ja[L+2]=Z.z;ja[L+3]=1;ja[L+4]=X.x;ja[L+5]=X.y;ja[L+6]=X.z;ja[L+7]=1;ja[L+8]=$.x;ja[L+9]=$.y;ja[L+10]=$.z;ja[L+11]=1;L+=12}if(Ca&&Ka.length){Z=Ka[R.a];X=Ka[R.b];$=Ka[R.c];Ba[za]=Z.r;Ba[za+1]=Z.g;Ba[za+2]=Z.b;Ba[za+3]=X.r;Ba[za+4]=X.g;Ba[za+5]=X.b;Ba[za+6]=$.r;Ba[za+7]=$.g;Ba[za+8]=$.b;za+=9}if(pa&&O.hasTangents){Z=va[R.a].tangent;X=va[R.b].tangent;$=va[R.c].tangent;ta[da]=Z.x;ta[da+1]=Z.y;ta[da+2]=Z.z;ta[da+3]=Z.w;ta[da+4]=X.x;ta[da+5]=X.y;ta[da+6]=X.z;ta[da+7]=X.w;ta[da+8]=$.x;ta[da+9]=
|
|
|
|
+$.y;ta[da+10]=$.z;ta[da+11]=$.w;da+=12}if(fa)if(Da.length==3&&Sa)for(R=0;R<3;R++){ma=Da[R];Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}else for(R=0;R<3;R++){Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}if(V&&Aa)for(R=0;R<3;R++){Da=Aa[R];Ra[z]=Da.u;Ra[z+1]=Da.v;z+=2}if(V&&xa)for(R=0;R<3;R++){Aa=xa[R];Pa[T]=Aa.u;Pa[T+1]=Aa.v;T+=2}if(ha){Ma[U]=G;Ma[U+1]=G+1;Ma[U+2]=G+2;U+=3;Ha[Fa]=G;Ha[Fa+1]=G+1;Ha[Fa+2]=G;Ha[Fa+3]=G+2;Ha[Fa+4]=G+1;Ha[Fa+5]=G+2;Fa+=6;G+=3}}else if(R instanceof THREE.Face4){if(ka){Z=
|
|
|
|
+va[R.a].position;X=va[R.b].position;$=va[R.c].position;sa=va[R.d].position;ya[J]=Z.x;ya[J+1]=Z.y;ya[J+2]=Z.z;ya[J+3]=X.x;ya[J+4]=X.y;ya[J+5]=X.z;ya[J+6]=$.x;ya[J+7]=$.y;ya[J+8]=$.z;ya[J+9]=sa.x;ya[J+10]=sa.y;ya[J+11]=sa.z;J+=12}if(Qa.length){Z=Qa[R.a];X=Qa[R.b];$=Qa[R.c];sa=Qa[R.d];ra[L]=Z.x;ra[L+1]=Z.y;ra[L+2]=Z.z;ra[L+3]=Z.w;ra[L+4]=X.x;ra[L+5]=X.y;ra[L+6]=X.z;ra[L+7]=X.w;ra[L+8]=$.x;ra[L+9]=$.y;ra[L+10]=$.z;ra[L+11]=$.w;ra[L+12]=sa.x;ra[L+13]=sa.y;ra[L+14]=sa.z;ra[L+15]=sa.w;Z=Ta[R.a];X=Ta[R.b];
|
|
|
|
+$=Ta[R.c];sa=Ta[R.d];na[L]=Z.x;na[L+1]=Z.y;na[L+2]=Z.z;na[L+3]=Z.w;na[L+4]=X.x;na[L+5]=X.y;na[L+6]=X.z;na[L+7]=X.w;na[L+8]=$.x;na[L+9]=$.y;na[L+10]=$.z;na[L+11]=$.w;na[L+12]=sa.x;na[L+13]=sa.y;na[L+14]=sa.z;na[L+15]=sa.w;Z=Ga[R.a];X=Ga[R.b];$=Ga[R.c];sa=Ga[R.d];wa[L]=Z.x;wa[L+1]=Z.y;wa[L+2]=Z.z;wa[L+3]=1;wa[L+4]=X.x;wa[L+5]=X.y;wa[L+6]=X.z;wa[L+7]=1;wa[L+8]=$.x;wa[L+9]=$.y;wa[L+10]=$.z;wa[L+11]=1;wa[L+12]=sa.x;wa[L+13]=sa.y;wa[L+14]=sa.z;wa[L+15]=1;Z=Ja[R.a];X=Ja[R.b];$=Ja[R.c];sa=Ja[R.d];ja[L]=Z.x;
|
|
|
|
+ja[L+1]=Z.y;ja[L+2]=Z.z;ja[L+3]=1;ja[L+4]=X.x;ja[L+5]=X.y;ja[L+6]=X.z;ja[L+7]=1;ja[L+8]=$.x;ja[L+9]=$.y;ja[L+10]=$.z;ja[L+11]=1;ja[L+12]=sa.x;ja[L+13]=sa.y;ja[L+14]=sa.z;ja[L+15]=1;L+=16}if(Ca&&Ka.length){Z=Ka[R.a];X=Ka[R.b];$=Ka[R.c];sa=Ka[R.d];Ba[za]=Z.r;Ba[za+1]=Z.g;Ba[za+2]=Z.b;Ba[za+3]=X.r;Ba[za+4]=X.g;Ba[za+5]=X.b;Ba[za+6]=$.r;Ba[za+7]=$.g;Ba[za+8]=$.b;Ba[za+9]=sa.r;Ba[za+10]=sa.g;Ba[za+11]=sa.b;za+=12}if(pa&&O.hasTangents){Z=va[R.a].tangent;X=va[R.b].tangent;$=va[R.c].tangent;R=va[R.d].tangent;
|
|
|
|
+ta[da]=Z.x;ta[da+1]=Z.y;ta[da+2]=Z.z;ta[da+3]=Z.w;ta[da+4]=X.x;ta[da+5]=X.y;ta[da+6]=X.z;ta[da+7]=X.w;ta[da+8]=$.x;ta[da+9]=$.y;ta[da+10]=$.z;ta[da+11]=$.w;ta[da+12]=R.x;ta[da+13]=R.y;ta[da+14]=R.z;ta[da+15]=R.w;da+=16}if(fa)if(Da.length==4&&Sa)for(R=0;R<4;R++){ma=Da[R];Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}else for(R=0;R<4;R++){Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}if(V&&Aa)for(R=0;R<4;R++){Da=Aa[R];Ra[z]=Da.u;Ra[z+1]=Da.v;z+=2}if(V&&xa)for(R=0;R<4;R++){Aa=xa[R];Pa[T]=Aa.u;Pa[T+1]=
|
|
|
|
+Aa.v;T+=2}if(ha){Ma[U]=G;Ma[U+1]=G+1;Ma[U+2]=G+2;Ma[U+3]=G;Ma[U+4]=G+2;Ma[U+5]=G+3;U+=6;Ha[Fa]=G;Ha[Fa+1]=G+1;Ha[Fa+2]=G;Ha[Fa+3]=G+3;Ha[Fa+4]=G+1;Ha[Fa+5]=G+2;Ha[Fa+6]=G+2;Ha[Fa+7]=G+3;Fa+=8;G+=4}}}if(ka){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya,D)}if(Ca&&Ka.length){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,D)}if(fa){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,D)}if(pa&&O.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
+B.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ta,D)}if(V&&z>0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,D)}if(V&&T>0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,D)}if(ha){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ma,D);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ha,D)}if(L>0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);
|
|
|
|
+e.bufferData(e.ARRAY_BUFFER,wa,D);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ja,D);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,na,D);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ra,D)}}E(objlist,t,x)}v.__dirtyVertices=!1;v.__dirtyElements=!1;v.__dirtyUvs=!1;v.__dirtyNormals=!1;v.__dirtyTangents=!1;v.__dirtyColors=!1}else if(x instanceof THREE.Ribbon){v=x.geometry;if(!v.__webGLVertexBuffer){n=
|
|
|
|
+v;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=v;t=n.vertices.length;n.__vertexArray=new Float32Array(t*3);n.__colorArray=new Float32Array(t*3);n.__webGLVertexCount=t;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){n=v;t=e.DYNAMIC_DRAW;G=void 0;G=void 0;J=void 0;B=void 0;z=n.vertices;D=n.colors;T=z.length;I=D.length;U=n.__vertexArray;Q=n.__colorArray;ea=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<T;G++){J=z[G].position;B=G*3;U[B]=
|
|
|
|
+J.x;U[B+1]=J.y;U[B+2]=J.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,U,t)}if(ea){for(G=0;G<I;G++){color=D[G];B=G*3;Q[B]=color.r;Q[B+1]=color.g;Q[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,t)}}E(objlist,v,x);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(x instanceof THREE.Line){v=x.geometry;if(!v.__webGLVertexBuffer){n=v;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=v;t=n.vertices.length;
|
|
|
|
+n.__vertexArray=new Float32Array(t*3);n.__colorArray=new Float32Array(t*3);n.__webGLLineCount=t;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){n=v;t=e.DYNAMIC_DRAW;G=void 0;G=void 0;J=void 0;B=void 0;z=n.vertices;D=n.colors;T=z.length;I=D.length;U=n.__vertexArray;Q=n.__colorArray;ea=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<T;G++){J=z[G].position;B=G*3;U[B]=J.x;U[B+1]=J.y;U[B+2]=J.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
|
+U,t)}if(ea){for(G=0;G<I;G++){color=D[G];B=G*3;Q[B]=color.r;Q[B+1]=color.g;Q[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,t)}}E(objlist,v,x);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(x instanceof THREE.ParticleSystem){v=x.geometry;if(!v.__webGLVertexBuffer){n=v;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=v;t=n.vertices.length;n.__vertexArray=new Float32Array(t*3);n.__colorArray=new Float32Array(t*3);n.__sortArray=
|
|
|
|
+[];n.__webGLParticleCount=t;v.__dirtyVertices=!0;v.__dirtyColors=!0}(v.__dirtyVertices||v.__dirtyColors||x.sortParticles)&&b(v,e.DYNAMIC_DRAW,x);E(objlist,v,x);v.__dirtyVertices=!1;v.__dirtyColors=!1}else THREE.MarchingCubes!==undefined&&x instanceof THREE.MarchingCubes&&B.__webglObjectsImmediate.push({object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,1)}};this.setFaceCulling=function(l,x){if(l){!x||x=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);
|
|
|
|
+else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
|
+THREE.Snippets={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 int combine;\n#endif",
|
|
|
|
+envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\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",
|
|
|
|
+map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
|
|
+lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
@@ -274,17 +273,17 @@ THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"ve
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var n=0,w=h.length;n<w;n++){var o=new THREE.Vertex(h[n].position.clone());c&&b.matrix.multiplyVector3(o.position);g.push(o)}n=0;for(w=j.length;n<w;n++){h=j[n];var p,x=h.vertexNormals;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+
|
|
|
|
-d,h.b+d,h.c+d,h.d+d));p.centroid.copy(h.centroid);p.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){o=x[c];p.vertexNormals.push(o.clone())}p.materials=h.materials.slice();k.push(p)}n=0;for(w=f.length;n<w;n++){d=f[n];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
|
|
|
|
-b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(n in O.objects)if(!M.objects[n]){A=O.objects[n];if(t=M.geometries[A.geometry]){e=[];for(i=0;i<A.materials.length;i++)e[i]=M.materials[A.materials[i]];I=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(t,e);object.position.set(I[0],
|
|
|
|
-I[1],I[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;M.scene.addObject(object);M.objects[n]=object}}}function h(X){return function(pa){M.geometries[X]=pa;g();W-=1;k()}}function k(){d({total_models:aa,total_textures:ea,loaded_models:aa-W,loaded_textures:ea-U},M);W==0&&U==0&&c(M)}var j,m,n,w,o,p,x,A,I,v,J,t,K,R,e,O,Q,W,U,aa,ea,M;O=f.data;Q=new THREE.Loader;U=W=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
|
-lights:{},fogs:{}};f=function(){U-=1;k()};for(o in O.cameras){v=O.cameras[o];if(v.type=="perspective")K=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}I=v.position;v=v.target;K.position.set(I[0],I[1],I[2]);K.target.position.set(v[0],v[1],v[2]);M.cameras[o]=K}for(w in O.lights){o=O.lights[w];if(o.type=="directional"){I=o.direction;light=new THREE.DirectionalLight;light.position.set(I[0],
|
|
|
|
-I[1],I[2]);light.position.normalize()}else if(o.type=="point"){I=o.position;light=new THREE.PointLight;light.position.set(I[0],I[1],I[2])}v=o.color;i=o.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);M.scene.addLight(light);M.lights[w]=light}for(p in O.fogs){w=O.fogs[p];if(w.type=="linear")R=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(R=new THREE.FogExp2(0,w.density));v=w.color;R.color.setRGB(v[0],v[1],v[2]);M.fogs[p]=R}if(M.cameras&&O.defaults.camera)M.currentCamera=M.cameras[O.defaults.camera];
|
|
|
|
-if(M.fogs&&O.defaults.fog)M.scene.fog=M.fogs[O.defaults.fog];v=O.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(v[0],v[1],v[2]);M.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){p=O.geometries[j];if(p.type=="bin_mesh"||p.type=="ascii_mesh")W+=1}aa=W;for(j in O.geometries){p=O.geometries[j];if(p.type=="cube"){t=new Cube(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,null,p.flipped,p.sides);M.geometries[j]=t}else if(p.type=="plane"){t=new Plane(p.width,p.height,p.segmentsWidth,
|
|
|
|
-p.segmentsHeight);M.geometries[j]=t}else if(p.type=="sphere"){t=new Sphere(p.radius,p.segmentsWidth,p.segmentsHeight);M.geometries[j]=t}else if(p.type=="cylinder"){t=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);M.geometries[j]=t}else if(p.type=="torus"){t=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);M.geometries[j]=t}else if(p.type=="icosahedron"){t=new Icosahedron(p.subdivisions);M.geometries[j]=t}else if(p.type=="bin_mesh")Q.loadBinary({model:p.url,callback:h(j)});
|
|
|
|
-else p.type=="ascii_mesh"&&Q.loadAscii({model:p.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];U+=j.url instanceof Array?j.url.length:1}ea=U;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)p=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{p=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)p.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)p.magFilter=
|
|
|
|
-THREE[j.magFilter]}M.textures[x]=p}for(m in O.materials){x=O.materials[m];for(J in x.parameters)if(J=="envMap"||J=="map"||J=="lightMap")x.parameters[J]=M.textures[x.parameters[J]];else if(J=="shading")x.parameters[J]=x.parameters[J]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")x.parameters[J]=THREE[x.parameters[J]]?THREE[x.parameters[J]]:THREE.NormalBlending;else J=="combine"&&(x.parameters[J]=x.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);
|
|
|
|
-M.materials[m]=x}g();b(M)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);
|
|
|
|
|
|
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,y=h.length;o<y;o++){var p=new THREE.Vertex(h[o].position.clone());c&&b.matrix.multiplyVector3(p.position);g.push(p)}o=0;for(y=j.length;o<y;o++){h=j[o];var q,A=h.vertexNormals;if(h instanceof THREE.Face3)q=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(q=new THREE.Face4(h.a+
|
|
|
|
+d,h.b+d,h.c+d,h.d+d));q.centroid.copy(h.centroid);q.normal.copy(h.normal);c=0;for(g=A.length;c<g;c++){p=A[c];q.vertexNormals.push(p.clone())}q.materials=h.materials.slice();k.push(q)}o=0;for(y=f.length;o<y;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
|
|
|
|
+b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in M.objects)if(!K.objects[o]){C=M.objects[o];if(u=K.geometries[C.geometry]){e=[];for(i=0;i<C.materials.length;i++)e[i]=K.materials[C.materials[i]];E=C.position;r=C.rotation;s=C.scale;object=new THREE.Mesh(u,e);object.position.set(E[0],
|
|
|
|
+E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;K.scene.addObject(object);K.objects[o]=object}}}function h(Y){return function(oa){K.geometries[Y]=oa;g();W-=1;k()}}function k(){d({total_models:aa,total_textures:ca,loaded_models:aa-W,loaded_textures:ca-S},K);W==0&&S==0&&c(K)}var j,m,o,y,p,q,A,C,E,w,F,u,H,P,e,M,N,W,S,aa,ca,K;M=f.data;N=new THREE.Loader;S=W=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
|
+lights:{},fogs:{}};f=function(){S-=1;k()};for(p in M.cameras){w=M.cameras[p];if(w.type=="perspective")H=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){H=new THREE.Camera;H.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}E=w.position;w=w.target;H.position.set(E[0],E[1],E[2]);H.target.position.set(w[0],w[1],w[2]);K.cameras[p]=H}for(y in M.lights){p=M.lights[y];if(p.type=="directional"){E=p.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
|
|
|
|
+E[1],E[2]);light.position.normalize()}else if(p.type=="point"){E=p.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}w=p.color;i=p.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);K.scene.addLight(light);K.lights[y]=light}for(q in M.fogs){y=M.fogs[q];if(y.type=="linear")P=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(P=new THREE.FogExp2(0,y.density));w=y.color;P.color.setRGB(w[0],w[1],w[2]);K.fogs[q]=P}if(K.cameras&&M.defaults.camera)K.currentCamera=K.cameras[M.defaults.camera];
|
|
|
|
+if(K.fogs&&M.defaults.fog)K.scene.fog=K.fogs[M.defaults.fog];w=M.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(w[0],w[1],w[2]);K.bgColorAlpha=M.defaults.bgalpha;for(j in M.geometries){q=M.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")W+=1}aa=W;for(j in M.geometries){q=M.geometries[j];if(q.type=="cube"){u=new Cube(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,null,q.flipped,q.sides);K.geometries[j]=u}else if(q.type=="plane"){u=new Plane(q.width,q.height,q.segmentsWidth,
|
|
|
|
+q.segmentsHeight);K.geometries[j]=u}else if(q.type=="sphere"){u=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);K.geometries[j]=u}else if(q.type=="cylinder"){u=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);K.geometries[j]=u}else if(q.type=="torus"){u=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);K.geometries[j]=u}else if(q.type=="icosahedron"){u=new Icosahedron(q.subdivisions);K.geometries[j]=u}else if(q.type=="bin_mesh")N.loadBinary({model:q.url,callback:h(j)});
|
|
|
|
+else q.type=="ascii_mesh"&&N.loadAscii({model:q.url,callback:h(j)})}for(A in M.textures){j=M.textures[A];S+=j.url instanceof Array?j.url.length:1}ca=S;for(A in M.textures){j=M.textures[A];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)q=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{q=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)q.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)q.magFilter=
|
|
|
|
+THREE[j.magFilter]}K.textures[A]=q}for(m in M.materials){A=M.materials[m];for(F in A.parameters)if(F=="envMap"||F=="map"||F=="lightMap")A.parameters[F]=K.textures[A.parameters[F]];else if(F=="shading")A.parameters[F]=A.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")A.parameters[F]=THREE[A.parameters[F]]?THREE[A.parameters[F]]:THREE.NormalBlending;else F=="combine"&&(A.parameters[F]=A.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);
|
|
|
|
+K.materials[m]=A}g();b(K)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);
|
|
return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
|
|
return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
|
|
a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
|
|
a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
|
|
SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},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}",
|
|
SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},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}",
|
|
@@ -296,39 +295,39 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,I,v,J,t,K,R,e){var O,Q,W=d||1,U=f||1,aa=W+1,ea=U+1,M=t/2,X=K/2;t/=W;var pa=K/U,ba=m.vertices.length;if(A=="x"&&I=="y"||A=="y"&&I=="x")O="z";else if(A=="x"&&I=="z"||A=="z"&&I=="x")O="y";
|
|
|
|
-else if(A=="z"&&I=="y"||A=="y"&&I=="z")O="x";for(Q=0;Q<ea;Q++)for(K=0;K<aa;K++){var la=new THREE.Vector3;la[A]=(K*t-M)*v;la[I]=(Q*pa-X)*J;la[O]=R;m.vertices.push(new THREE.Vertex(la))}for(Q=0;Q<U;Q++)for(K=0;K<W;K++){m.faces.push(new THREE.Face4(K+aa*Q+ba,K+aa*(Q+1)+ba,K+1+aa*(Q+1)+ba,K+1+aa*Q+ba,null,e));m.uvs.push([new THREE.UV(K/W,Q/U),new THREE.UV(K/W,(Q+1)/U),new THREE.UV((K+1)/W,(Q+1)/U),new THREE.UV((K+1)/W,Q/U)])}}THREE.Geometry.call(this);var m=this,n=a/2,w=b/2,o=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
|
|
|
|
-Array)this.materials=g;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-n,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,n,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
|
|
|
|
-a,b,o,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-o,this.materials[5]);(function(){for(var A=[],I=[],v=0,J=m.vertices.length;v<J;v++){for(var t=m.vertices[v],K=!1,R=0,e=A.length;R<e;R++){var O=A[R];if(t.position.x==O.position.x&&t.position.y==O.position.y&&t.position.z==O.position.z){I[v]=R;K=!0;break}}if(!K){I[v]=A.length;A.push(new THREE.Vertex(t.position.clone()))}}v=0;for(J=m.faces.length;v<J;v++){t=m.faces[v];t.a=I[t.a];t.b=I[t.b];t.c=I[t.c];t.d=I[t.d]}m.vertices=A})();this.computeCentroids();
|
|
|
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(C,E,w,F,u,H,P,e){var M,N,W=d||1,S=f||1,aa=W+1,ca=S+1,K=u/2,Y=H/2;u/=W;var oa=H/S,ba=m.vertices.length;if(C=="x"&&E=="y"||C=="y"&&E=="x")M="z";else if(C=="x"&&E=="z"||C=="z"&&E=="x")M="y";
|
|
|
|
+else if(C=="z"&&E=="y"||C=="y"&&E=="z")M="x";for(N=0;N<ca;N++)for(H=0;H<aa;H++){var la=new THREE.Vector3;la[C]=(H*u-K)*w;la[E]=(N*oa-Y)*F;la[M]=P;m.vertices.push(new THREE.Vertex(la))}for(N=0;N<S;N++)for(H=0;H<W;H++){m.faces.push(new THREE.Face4(H+aa*N+ba,H+aa*(N+1)+ba,H+1+aa*(N+1)+ba,H+1+aa*N+ba,null,e));m.uvs.push([new THREE.UV(H/W,N/S),new THREE.UV(H/W,(N+1)/S),new THREE.UV((H+1)/W,(N+1)/S),new THREE.UV((H+1)/W,N/S)])}}THREE.Geometry.call(this);var m=this,o=a/2,y=b/2,p=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
|
|
|
|
+Array)this.materials=g;else{this.materials=[];for(var q=0;q<6;q++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&j("z","y",1*h,-1,c,b,-o,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,o,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,y,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-y,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
|
|
|
|
+a,b,p,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-p,this.materials[5]);(function(){for(var C=[],E=[],w=0,F=m.vertices.length;w<F;w++){for(var u=m.vertices[w],H=!1,P=0,e=C.length;P<e;P++){var M=C[P];if(u.position.x==M.position.x&&u.position.y==M.position.y&&u.position.z==M.position.z){E[w]=P;H=!0;break}}if(!H){E[w]=C.length;C.push(new THREE.Vertex(u.position.clone()))}}w=0;for(F=m.faces.length;w<F;w++){u=m.faces[w];u.a=E[u.a];u.b=E[u.b];u.c=E[u.c];u.d=E[u.d]}m.vertices=C})();this.computeCentroids();
|
|
this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
-var Cylinder=function(a,b,c,d,f){function g(m,n,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
|
|
|
|
|
|
+var Cylinder=function(a,b,c,d,f){function g(m,o,y){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,y)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
|
|
2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
-var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],n=0;for(d=0;d<g;d++){var w=2*d/g,o=j*Math.sin(w*f);w=j*Math.cos(w*f);(c==0||c==h)&&d>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,o)))-1);m.push(n)}b.push(m)}var p,x,A;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
|
|
|
|
-0:d+1];o=c/(f-1);p=(c-1)/(f-1);x=(d+1)/g;w=d/g;n=new THREE.UV(1-x,o);o=new THREE.UV(1-w,o);w=new THREE.UV(1-w,p);var I=new THREE.UV(1-x,p);if(c<b.length-1){p=this.vertices[h].position.clone();x=this.vertices[k].position.clone();A=this.vertices[j].position.clone();p.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([n,o,w])}if(c>1){p=this.vertices[h].position.clone();
|
|
|
|
-x=this.vertices[j].position.clone();A=this.vertices[m].position.clone();p.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([n,w,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
|
|
|
+var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],o=0;for(d=0;d<g;d++){var y=2*d/g,p=j*Math.sin(y*f);y=j*Math.cos(y*f);(c==0||c==h)&&d>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,k,p)))-1);m.push(o)}b.push(m)}var q,A,C;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
|
|
|
|
+0:d+1];p=c/(f-1);q=(c-1)/(f-1);A=(d+1)/g;y=d/g;o=new THREE.UV(1-A,p);p=new THREE.UV(1-y,p);y=new THREE.UV(1-y,q);var E=new THREE.UV(1-A,q);if(c<b.length-1){q=this.vertices[h].position.clone();A=this.vertices[k].position.clone();C=this.vertices[j].position.clone();q.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,p,y])}if(c>1){q=this.vertices[h].position.clone();
|
|
|
|
+A=this.vertices[j].position.clone();C=this.vertices[m].position.clone();q.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,y,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
|
|
var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
|
|
1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
-var Icosahedron=function(a){function b(w,o,p){var x=Math.sqrt(w*w+o*o+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,o/x,p/x)))-1}function c(w,o,p,x){x.faces.push(new THREE.Face3(w,o,p))}function d(w,o){var p=f.vertices[w].position,x=f.vertices[o].position;return b((p.x+x.x)/2,(p.y+x.y)/2,(p.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
|
|
|
-1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),n=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,n,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
|
|
|
|
-n,m,h);c(j,m,n,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
|
|
|
+var Icosahedron=function(a){function b(y,p,q){var A=Math.sqrt(y*y+p*p+q*q);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(y/A,p/A,q/A)))-1}function c(y,p,q,A){A.faces.push(new THREE.Face3(y,p,q))}function d(y,p){var q=f.vertices[y].position,A=f.vertices[p].position;return b((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
|
|
|
+1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),o=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,o,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
|
|
|
|
+o,m,h);c(j,m,o,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));
|
|
function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));
|
|
g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
|
g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
|
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;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,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(n[c],n[c+3],h);f[g+1]=this.lerp(n[c+1],n[c+4],h);f[g+2]=this.lerp(n[c+2],n[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
|
|
|
|
-2]=m;d=c+this.yd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
|
|
|
|
-this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,n=g+this.zd,w=j+this.yd,o=j+this.zd,p=g+this.yd+this.zd,x=j+this.yd+this.zd,A=0,I=this.field[g],v=this.field[j],J=this.field[m],t=this.field[w],K=this.field[n],R=this.field[o],e=this.field[p],O=this.field[x];I<h&&(A|=1);v<h&&(A|=2);J<h&&(A|=8);t<h&&(A|=4);K<h&&(A|=16);R<h&&(A|=32);e<h&&(A|=128);O<h&&(A|=64);var Q=THREE.edgeTable[A];if(Q==0)return 0;
|
|
|
|
-var W=this.delta,U=c+W,aa=d+W;W=f+W;if(Q&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,I,v)}if(Q&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,U,d,f,v,t)}if(Q&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,aa,f,J,t)}if(Q&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,I,J)}if(Q&16){this.compNorm(n);this.compNorm(o);this.VIntX(n*3,this.vlist,this.nlist,12,h,c,d,
|
|
|
|
-W,K,R)}if(Q&32){this.compNorm(o);this.compNorm(x);this.VIntY(o*3,this.vlist,this.nlist,15,h,U,d,W,R,O)}if(Q&64){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,18,h,c,aa,W,e,O)}if(Q&128){this.compNorm(n);this.compNorm(p);this.VIntY(n*3,this.vlist,this.nlist,21,h,c,d,W,K,e)}if(Q&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,I,K)}if(Q&512){this.compNorm(j);this.compNorm(o);this.VIntZ(j*3,this.vlist,this.nlist,27,h,U,d,f,v,R)}if(Q&1024){this.compNorm(w);
|
|
|
|
-this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,U,aa,f,t,O)}if(Q&2048){this.compNorm(m);this.compNorm(p);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,aa,f,J,e)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){c=A+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
|
|
|
|
|
|
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,o,y){h=(h-o)/(y-o);o=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,o,y){h=(h-o)/(y-o);o=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
|
|
|
|
+2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,o,y){h=(h-o)/(y-o);o=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
|
|
|
|
+this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,o=g+this.zd,y=j+this.yd,p=j+this.zd,q=g+this.yd+this.zd,A=j+this.yd+this.zd,C=0,E=this.field[g],w=this.field[j],F=this.field[m],u=this.field[y],H=this.field[o],P=this.field[p],e=this.field[q],M=this.field[A];E<h&&(C|=1);w<h&&(C|=2);F<h&&(C|=8);u<h&&(C|=4);H<h&&(C|=16);P<h&&(C|=32);e<h&&(C|=128);M<h&&(C|=64);var N=THREE.edgeTable[C];if(N==0)return 0;
|
|
|
|
+var W=this.delta,S=c+W,aa=d+W;W=f+W;if(N&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,E,w)}if(N&2){this.compNorm(j);this.compNorm(y);this.VIntY(j*3,this.vlist,this.nlist,3,h,S,d,f,w,u)}if(N&4){this.compNorm(m);this.compNorm(y);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,aa,f,F,u)}if(N&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,E,F)}if(N&16){this.compNorm(o);this.compNorm(p);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,
|
|
|
|
+W,H,P)}if(N&32){this.compNorm(p);this.compNorm(A);this.VIntY(p*3,this.vlist,this.nlist,15,h,S,d,W,P,M)}if(N&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,h,c,aa,W,e,M)}if(N&128){this.compNorm(o);this.compNorm(q);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,W,H,e)}if(N&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,E,H)}if(N&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,h,S,d,f,w,P)}if(N&1024){this.compNorm(y);
|
|
|
|
+this.compNorm(A);this.VIntZ(y*3,this.vlist,this.nlist,30,h,S,aa,f,u,M)}if(N&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,aa,f,F,e)}C<<=4;for(h=g=0;THREE.triTable[C+h]!=-1;){c=C+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
|
|
3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,n=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var o=Math.floor(m-k);o<1&&(o=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);
|
|
|
|
-k>this.size-1&&(k=this.size-1);for(var x,A,I,v,J,t;w<j;w++){n=this.size2*w;A=w/this.size-f;J=A*A;for(A=o;A<m;A++){I=n+this.size*A;x=A/this.size-d;t=x*x;for(x=p;x<k;x++){v=x/this.size-c;v=g/(1.0E-6+v*v+t+J)-h;v>0&&(this.field[I+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,n=this.yd,w=this.zd,o=this.field,p=m*Math.sqrt(c/d);p>m&&(p=m);for(f=0;f<p;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*n;for(h=0;h<m;h++)o[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
|
|
|
|
-h,k,j,m,n=this.size,w=this.yd,o=this.zd,p=this.field,x=n*Math.sqrt(c/d);x>n&&(x=n);for(g=0;g<x;g++){f=g/n;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<n;f++){m=j+f;for(h=0;h<n;h++)p[o*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
|
|
|
|
-for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,n,w,o=this.size-2;for(h=1;h<o;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<o;g++){n=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<o;f++){k=(f-this.halfsize)/this.halfsize;d=n+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,n,w,o;for(g=
|
|
|
|
-0;g<f.count;g++){m=g*3;w=m+1;o=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[o];n=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[o];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(n,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;o=m+2;n=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[o].normal;m=new THREE.Face3(m,w,o,[n,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});return d};this.init(a)};
|
|
|
|
|
|
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,o=c*this.size,y=Math.floor(j-k);y<1&&(y=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(o-k);q<1&&(q=1);k=Math.floor(o+k);
|
|
|
|
+k>this.size-1&&(k=this.size-1);for(var A,C,E,w,F,u;y<j;y++){o=this.size2*y;C=y/this.size-f;F=C*C;for(C=p;C<m;C++){E=o+this.size*C;A=C/this.size-d;u=A*A;for(A=q;A<k;A++){w=A/this.size-c;w=g/(1.0E-6+w*w+u+F)-h;w>0&&(this.field[E+A]+=w)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,y=this.zd,p=this.field,q=m*Math.sqrt(c/d);q>m&&(q=m);for(f=0;f<q;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*o;for(h=0;h<m;h++)p[y*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
|
|
|
|
+h,k,j,m,o=this.size,y=this.yd,p=this.zd,q=this.field,A=o*Math.sqrt(c/d);A>o&&(A=o);for(g=0;g<A;g++){f=g/o;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*y;for(f=0;f<o;f++){m=j+f;for(h=0;h<o;h++)q[p*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
|
|
|
|
+for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,o,y,p=this.size-2;for(h=1;h<p;h++){y=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<p;g++){o=y+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,o,y,p;for(g=
|
|
|
|
+0;g<f.count;g++){m=g*3;y=m+1;p=m+2;h=f.positionArray[m];k=f.positionArray[y];j=f.positionArray[p];o=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[y];j=f.normalArray[p];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;y=m+1;p=m+2;o=d.vertices[m].normal;h=d.vertices[y].normal;k=d.vertices[p].normal;m=new THREE.Face3(m,y,p,[o,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});return d};this.init(a)};
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
@@ -358,24 +357,24 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
|
|
b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
|
|
b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
|
|
THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
|
|
THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
|
|
-createBinModel:function(a,b,c,d){var f=function(g){function h(y,D){var F=n(y,D),T=n(y,D+1),P=n(y,D+2),fa=n(y,D+3),ka=(fa<<1&255|P>>7)-127;F|=(P&127)<<16|T<<8;if(F==0&&ka==-127)return 0;return(1-2*(fa>>7))*(1+F*Math.pow(2,-23))*Math.pow(2,ka)}function k(y,D){var F=n(y,D),T=n(y,D+1),P=n(y,D+2);return(n(y,D+3)<<24)+(P<<16)+(T<<8)+F}function j(y,D){var F=n(y,D);return(n(y,D+1)<<8)+F}function m(y,D){var F=n(y,D);return F>127?F-256:F}function n(y,D){return y.charCodeAt(D)&255}function w(y){var D,F,T;D=
|
|
|
|
-k(a,y);F=k(a,y+e);T=k(a,y+O);y=j(a,y+Q);THREE.Loader.prototype.f3(v,D,F,T,y)}function o(y){var D,F,T,P,fa,ka;D=k(a,y);F=k(a,y+e);T=k(a,y+O);P=j(a,y+Q);fa=k(a,y+W);ka=k(a,y+U);y=k(a,y+aa);THREE.Loader.prototype.f3n(v,K,D,F,T,P,fa,ka,y)}function p(y){var D,F,T,P;D=k(a,y);F=k(a,y+ea);T=k(a,y+M);P=k(a,y+X);y=j(a,y+pa);THREE.Loader.prototype.f4(v,D,F,T,P,y)}function x(y){var D,F,T,P,fa,ka,ra,na;D=k(a,y);F=k(a,y+ea);T=k(a,y+M);P=k(a,y+X);fa=j(a,y+pa);ka=k(a,y+ba);ra=k(a,y+la);na=k(a,y+ia);y=k(a,y+ga);THREE.Loader.prototype.f4n(v,
|
|
|
|
-K,D,F,T,P,fa,ka,ra,na,y)}function A(y){var D,F;D=k(a,y);F=k(a,y+ua);y=k(a,y+xa);THREE.Loader.prototype.uv3(v.uvs,R[D*2],R[D*2+1],R[F*2],R[F*2+1],R[y*2],R[y*2+1])}function I(y){var D,F,T;D=k(a,y);F=k(a,y+l);T=k(a,y+z);y=k(a,y+B);THREE.Loader.prototype.uv4(v.uvs,R[D*2],R[D*2+1],R[F*2],R[F*2+1],R[T*2],R[T*2+1],R[y*2],R[y*2+1])}var v=this,J=0,t,K=[],R=[],e,O,Q,W,U,aa,ea,M,X,pa,ba,la,ia,ga,ua,xa,l,z,B,u,q,E,C,G,H;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);t={signature:a.substr(J,
|
|
|
|
-8),header_bytes:n(a,J+8),vertex_coordinate_bytes:n(a,J+9),normal_coordinate_bytes:n(a,J+10),uv_coordinate_bytes:n(a,J+11),vertex_index_bytes:n(a,J+12),normal_index_bytes:n(a,J+13),uv_index_bytes:n(a,J+14),material_index_bytes:n(a,J+15),nvertices:k(a,J+16),nnormals:k(a,J+16+4),nuvs:k(a,J+16+8),ntri_flat:k(a,J+16+12),ntri_smooth:k(a,J+16+16),ntri_flat_uv:k(a,J+16+20),ntri_smooth_uv:k(a,J+16+24),nquad_flat:k(a,J+16+28),nquad_smooth:k(a,J+16+32),nquad_flat_uv:k(a,J+16+36),nquad_smooth_uv:k(a,J+16+40)};
|
|
|
|
-J+=t.header_bytes;e=t.vertex_index_bytes;O=t.vertex_index_bytes*2;Q=t.vertex_index_bytes*3;W=t.vertex_index_bytes*3+t.material_index_bytes;U=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;aa=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;ea=t.vertex_index_bytes;M=t.vertex_index_bytes*2;X=t.vertex_index_bytes*3;pa=t.vertex_index_bytes*4;ba=t.vertex_index_bytes*4+t.material_index_bytes;la=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;ia=
|
|
|
|
-t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;ga=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;ua=t.uv_index_bytes;xa=t.uv_index_bytes*2;l=t.uv_index_bytes;z=t.uv_index_bytes*2;B=t.uv_index_bytes*3;g=t.vertex_index_bytes*3+t.material_index_bytes;H=t.vertex_index_bytes*4+t.material_index_bytes;u=t.ntri_flat*g;q=t.ntri_smooth*(g+t.normal_index_bytes*3);E=t.ntri_flat_uv*(g+t.uv_index_bytes*3);C=t.ntri_smooth_uv*(g+t.normal_index_bytes*3+t.uv_index_bytes*
|
|
|
|
-3);G=t.nquad_flat*H;g=t.nquad_smooth*(H+t.normal_index_bytes*4);H=t.nquad_flat_uv*(H+t.uv_index_bytes*4);J+=function(y){for(var D,F,T,P=t.vertex_coordinate_bytes*3,fa=y+t.nvertices*P;y<fa;y+=P){D=h(a,y);F=h(a,y+t.vertex_coordinate_bytes);T=h(a,y+t.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,D,F,T)}return t.nvertices*P}(J);J+=function(y){for(var D,F,T,P=t.normal_coordinate_bytes*3,fa=y+t.nnormals*P;y<fa;y+=P){D=m(a,y);F=m(a,y+t.normal_coordinate_bytes);T=m(a,y+t.normal_coordinate_bytes*2);
|
|
|
|
-K.push(D/127,F/127,T/127)}return t.nnormals*P}(J);J+=function(y){for(var D,F,T=t.uv_coordinate_bytes*2,P=y+t.nuvs*T;y<P;y+=T){D=h(a,y);F=h(a,y+t.uv_coordinate_bytes);R.push(D,F)}return t.nuvs*T}(J);u=J+u;q=u+q;E=q+E;C=E+C;G=C+G;g=G+g;H=g+H;(function(y){var D,F=t.vertex_index_bytes*3+t.material_index_bytes,T=F+t.uv_index_bytes*3,P=y+t.ntri_flat_uv*T;for(D=y;D<P;D+=T){w(D);A(D+F)}return P-y})(q);(function(y){var D,F=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,T=F+t.uv_index_bytes*
|
|
|
|
-3,P=y+t.ntri_smooth_uv*T;for(D=y;D<P;D+=T){o(D);A(D+F)}return P-y})(E);(function(y){var D,F=t.vertex_index_bytes*4+t.material_index_bytes,T=F+t.uv_index_bytes*4,P=y+t.nquad_flat_uv*T;for(D=y;D<P;D+=T){p(D);I(D+F)}return P-y})(g);(function(y){var D,F=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,T=F+t.uv_index_bytes*4,P=y+t.nquad_smooth_uv*T;for(D=y;D<P;D+=T){x(D);I(D+F)}return P-y})(H);(function(y){var D,F=t.vertex_index_bytes*3+t.material_index_bytes,T=y+t.ntri_flat*F;for(D=
|
|
|
|
-y;D<T;D+=F)w(D);return T-y})(J);(function(y){var D,F=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,T=y+t.ntri_smooth*F;for(D=y;D<T;D+=F)o(D);return T-y})(u);(function(y){var D,F=t.vertex_index_bytes*4+t.material_index_bytes,T=y+t.nquad_flat*F;for(D=y;D<T;D+=F)p(D);return T-y})(C);(function(y){var D,F=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,T=y+t.nquad_smooth*F;for(D=y;D<T;D+=F)x(D);return T-y})(G);this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
-f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,n;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];n=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,n)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];n=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,n)}}})();(function(){function h(x,
|
|
|
|
-A){THREE.Loader.prototype.f3(g,x[A],x[A+1],x[A+2],x[A+3])}function k(x,A){THREE.Loader.prototype.f3n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6])}function j(x,A){THREE.Loader.prototype.f4(g,x[A],x[A+1],x[A+2],x[A+3],x[A+4])}function m(x,A){THREE.Loader.prototype.f4n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6],x[A+7],x[A+8])}function n(x,A){var I,v,J,t,K,R,e,O,Q;I=x[A];v=x[A+1];J=x[A+2];t=a.uvs[I*2];e=a.uvs[I*2+1];K=a.uvs[v*2];O=a.uvs[v*2+1];R=a.uvs[J*2];Q=a.uvs[J*2+1];
|
|
|
|
-THREE.Loader.prototype.uv3(g.uvs,t,e,K,O,R,Q);if(a.uvs2&&a.uvs2.length){t=a.uvs2[I*2];e=a.uvs2[I*2+1];K=a.uvs2[v*2];O=a.uvs2[v*2+1];R=a.uvs2[J*2];Q=a.uvs2[J*2+1];THREE.Loader.prototype.uv3(g.uvs2,t,1-e,K,1-O,R,1-Q)}}function w(x,A){var I,v,J,t,K,R,e,O,Q,W,U,aa;I=x[A];v=x[A+1];J=x[A+2];t=x[A+3];K=a.uvs[I*2];Q=a.uvs[I*2+1];R=a.uvs[v*2];W=a.uvs[v*2+1];e=a.uvs[J*2];U=a.uvs[J*2+1];O=a.uvs[t*2];aa=a.uvs[t*2+1];THREE.Loader.prototype.uv4(g.uvs,K,Q,R,W,e,U,O,aa);if(a.uvs2){K=a.uvs2[I*2];Q=a.uvs2[I*2+1];R=
|
|
|
|
-a.uvs2[v*2];W=a.uvs2[v*2+1];e=a.uvs2[J*2];U=a.uvs2[J*2+1];O=a.uvs2[t*2];aa=a.uvs2[t*2+1];THREE.Loader.prototype.uv4(g.uvs2,K,1-Q,R,1-W,e,1-U,O,1-aa)}}var o,p;o=0;for(p=a.trianglesUvs.length;o<p;o+=7){h(a.trianglesUvs,o);n(a.trianglesUvs,o+4)}o=0;for(p=a.trianglesNormalsUvs.length;o<p;o+=10){k(a.trianglesNormalsUvs,o);n(a.trianglesNormalsUvs,o+7)}o=0;for(p=a.quadsUvs.length;o<p;o+=9){j(a.quadsUvs,o);w(a.quadsUvs,o+5)}o=0;for(p=a.quadsNormalsUvs.length;o<p;o+=13){m(a.quadsNormalsUvs,o);w(a.quadsNormalsUvs,
|
|
|
|
-o+9)}o=0;for(p=a.triangles.length;o<p;o+=4)h(a.triangles,o);o=0;for(p=a.trianglesNormals.length;o<p;o+=7)k(a.trianglesNormals,o);o=0;for(p=a.quads.length;o<p;o+=5)j(a.quads,o);o=0;for(p=a.quadsNormals.length;o<p;o+=9)m(a.quadsNormals,o)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];
|
|
|
|
|
|
+createBinModel:function(a,b,c,d){var f=function(g){function h(z,D){var I=o(z,D),T=o(z,D+1),U=o(z,D+2),ea=o(z,D+3),da=(ea<<1&255|U>>7)-127;I|=(U&127)<<16|T<<8;if(I==0&&da==-127)return 0;return(1-2*(ea>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,da)}function k(z,D){var I=o(z,D),T=o(z,D+1),U=o(z,D+2);return(o(z,D+3)<<24)+(U<<16)+(T<<8)+I}function j(z,D){var I=o(z,D);return(o(z,D+1)<<8)+I}function m(z,D){var I=o(z,D);return I>127?I-256:I}function o(z,D){return z.charCodeAt(D)&255}function y(z){var D,I,T;D=
|
|
|
|
+k(a,z);I=k(a,z+e);T=k(a,z+M);z=j(a,z+N);THREE.Loader.prototype.f3(w,D,I,T,z)}function p(z){var D,I,T,U,ea,da;D=k(a,z);I=k(a,z+e);T=k(a,z+M);U=j(a,z+N);ea=k(a,z+W);da=k(a,z+S);z=k(a,z+aa);THREE.Loader.prototype.f3n(w,H,D,I,T,U,ea,da,z)}function q(z){var D,I,T,U;D=k(a,z);I=k(a,z+ca);T=k(a,z+K);U=k(a,z+Y);z=j(a,z+oa);THREE.Loader.prototype.f4(w,D,I,T,U,z)}function A(z){var D,I,T,U,ea,da,xa,R;D=k(a,z);I=k(a,z+ca);T=k(a,z+K);U=k(a,z+Y);ea=j(a,z+oa);da=k(a,z+ba);xa=k(a,z+la);R=k(a,z+ia);z=k(a,z+ga);THREE.Loader.prototype.f4n(w,
|
|
|
|
+H,D,I,T,U,ea,da,xa,R,z)}function C(z){var D,I;D=k(a,z);I=k(a,z+qa);z=k(a,z+ua);THREE.Loader.prototype.uv3(w.uvs,P[D*2],P[D*2+1],P[I*2],P[I*2+1],P[z*2],P[z*2+1])}function E(z){var D,I,T;D=k(a,z);I=k(a,z+l);T=k(a,z+x);z=k(a,z+v);THREE.Loader.prototype.uv4(w.uvs,P[D*2],P[D*2+1],P[I*2],P[I*2+1],P[T*2],P[T*2+1],P[z*2],P[z*2+1])}var w=this,F=0,u,H=[],P=[],e,M,N,W,S,aa,ca,K,Y,oa,ba,la,ia,ga,qa,ua,l,x,v,n,t,B,J,Q,G;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);u={signature:a.substr(F,
|
|
|
|
+8),header_bytes:o(a,F+8),vertex_coordinate_bytes:o(a,F+9),normal_coordinate_bytes:o(a,F+10),uv_coordinate_bytes:o(a,F+11),vertex_index_bytes:o(a,F+12),normal_index_bytes:o(a,F+13),uv_index_bytes:o(a,F+14),material_index_bytes:o(a,F+15),nvertices:k(a,F+16),nnormals:k(a,F+16+4),nuvs:k(a,F+16+8),ntri_flat:k(a,F+16+12),ntri_smooth:k(a,F+16+16),ntri_flat_uv:k(a,F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+16+32),nquad_flat_uv:k(a,F+16+36),nquad_smooth_uv:k(a,F+16+40)};
|
|
|
|
+F+=u.header_bytes;e=u.vertex_index_bytes;M=u.vertex_index_bytes*2;N=u.vertex_index_bytes*3;W=u.vertex_index_bytes*3+u.material_index_bytes;S=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;aa=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;ca=u.vertex_index_bytes;K=u.vertex_index_bytes*2;Y=u.vertex_index_bytes*3;oa=u.vertex_index_bytes*4;ba=u.vertex_index_bytes*4+u.material_index_bytes;la=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;ia=
|
|
|
|
+u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;ga=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;qa=u.uv_index_bytes;ua=u.uv_index_bytes*2;l=u.uv_index_bytes;x=u.uv_index_bytes*2;v=u.uv_index_bytes*3;g=u.vertex_index_bytes*3+u.material_index_bytes;G=u.vertex_index_bytes*4+u.material_index_bytes;n=u.ntri_flat*g;t=u.ntri_smooth*(g+u.normal_index_bytes*3);B=u.ntri_flat_uv*(g+u.uv_index_bytes*3);J=u.ntri_smooth_uv*(g+u.normal_index_bytes*3+u.uv_index_bytes*
|
|
|
|
+3);Q=u.nquad_flat*G;g=u.nquad_smooth*(G+u.normal_index_bytes*4);G=u.nquad_flat_uv*(G+u.uv_index_bytes*4);F+=function(z){for(var D,I,T,U=u.vertex_coordinate_bytes*3,ea=z+u.nvertices*U;z<ea;z+=U){D=h(a,z);I=h(a,z+u.vertex_coordinate_bytes);T=h(a,z+u.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,D,I,T)}return u.nvertices*U}(F);F+=function(z){for(var D,I,T,U=u.normal_coordinate_bytes*3,ea=z+u.nnormals*U;z<ea;z+=U){D=m(a,z);I=m(a,z+u.normal_coordinate_bytes);T=m(a,z+u.normal_coordinate_bytes*2);
|
|
|
|
+H.push(D/127,I/127,T/127)}return u.nnormals*U}(F);F+=function(z){for(var D,I,T=u.uv_coordinate_bytes*2,U=z+u.nuvs*T;z<U;z+=T){D=h(a,z);I=h(a,z+u.uv_coordinate_bytes);P.push(D,I)}return u.nuvs*T}(F);n=F+n;t=n+t;B=t+B;J=B+J;Q=J+Q;g=Q+g;G=g+G;(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes,T=I+u.uv_index_bytes*3,U=z+u.ntri_flat_uv*T;for(D=z;D<U;D+=T){y(D);C(D+I)}return U-z})(t);(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,T=I+u.uv_index_bytes*
|
|
|
|
+3,U=z+u.ntri_smooth_uv*T;for(D=z;D<U;D+=T){p(D);C(D+I)}return U-z})(B);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes,T=I+u.uv_index_bytes*4,U=z+u.nquad_flat_uv*T;for(D=z;D<U;D+=T){q(D);E(D+I)}return U-z})(g);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,T=I+u.uv_index_bytes*4,U=z+u.nquad_smooth_uv*T;for(D=z;D<U;D+=T){A(D);E(D+I)}return U-z})(G);(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes,T=z+u.ntri_flat*I;for(D=
|
|
|
|
+z;D<T;D+=I)y(D);return T-z})(F);(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,T=z+u.ntri_smooth*I;for(D=z;D<T;D+=I)p(D);return T-z})(n);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes,T=z+u.nquad_flat*I;for(D=z;D<T;D+=I)q(D);return T-z})(J);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,T=z+u.nquad_smooth*I;for(D=z;D<T;D+=I)A(D);return T-z})(Q);this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
+f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,o;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,o)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,o)}}})();(function(){function h(A,
|
|
|
|
+C){THREE.Loader.prototype.f3(g,A[C],A[C+1],A[C+2],A[C+3])}function k(A,C){THREE.Loader.prototype.f3n(g,a.normals,A[C],A[C+1],A[C+2],A[C+3],A[C+4],A[C+5],A[C+6])}function j(A,C){THREE.Loader.prototype.f4(g,A[C],A[C+1],A[C+2],A[C+3],A[C+4])}function m(A,C){THREE.Loader.prototype.f4n(g,a.normals,A[C],A[C+1],A[C+2],A[C+3],A[C+4],A[C+5],A[C+6],A[C+7],A[C+8])}function o(A,C){var E,w,F,u,H,P,e,M,N;E=A[C];w=A[C+1];F=A[C+2];u=a.uvs[E*2];e=a.uvs[E*2+1];H=a.uvs[w*2];M=a.uvs[w*2+1];P=a.uvs[F*2];N=a.uvs[F*2+1];
|
|
|
|
+THREE.Loader.prototype.uv3(g.uvs,u,e,H,M,P,N);if(a.uvs2&&a.uvs2.length){u=a.uvs2[E*2];e=a.uvs2[E*2+1];H=a.uvs2[w*2];M=a.uvs2[w*2+1];P=a.uvs2[F*2];N=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(g.uvs2,u,1-e,H,1-M,P,1-N)}}function y(A,C){var E,w,F,u,H,P,e,M,N,W,S,aa;E=A[C];w=A[C+1];F=A[C+2];u=A[C+3];H=a.uvs[E*2];N=a.uvs[E*2+1];P=a.uvs[w*2];W=a.uvs[w*2+1];e=a.uvs[F*2];S=a.uvs[F*2+1];M=a.uvs[u*2];aa=a.uvs[u*2+1];THREE.Loader.prototype.uv4(g.uvs,H,N,P,W,e,S,M,aa);if(a.uvs2){H=a.uvs2[E*2];N=a.uvs2[E*2+1];P=
|
|
|
|
+a.uvs2[w*2];W=a.uvs2[w*2+1];e=a.uvs2[F*2];S=a.uvs2[F*2+1];M=a.uvs2[u*2];aa=a.uvs2[u*2+1];THREE.Loader.prototype.uv4(g.uvs2,H,1-N,P,1-W,e,1-S,M,1-aa)}}var p,q;p=0;for(q=a.trianglesUvs.length;p<q;p+=7){h(a.trianglesUvs,p);o(a.trianglesUvs,p+4)}p=0;for(q=a.trianglesNormalsUvs.length;p<q;p+=10){k(a.trianglesNormalsUvs,p);o(a.trianglesNormalsUvs,p+7)}p=0;for(q=a.quadsUvs.length;p<q;p+=9){j(a.quadsUvs,p);y(a.quadsUvs,p+5)}p=0;for(q=a.quadsNormalsUvs.length;p<q;p+=13){m(a.quadsNormalsUvs,p);y(a.quadsNormalsUvs,
|
|
|
|
+p+9)}p=0;for(q=a.triangles.length;p<q;p+=4)h(a.triangles,p);p=0;for(q=a.trianglesNormals.length;p<q;p+=7)k(a.trianglesNormals,p);p=0;for(q=a.quads.length;p<q;p+=5)j(a.quads,p);p=0;for(q=a.quadsNormals.length;p<q;p+=9)m(a.quadsNormals,p)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];
|
|
THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
|
|
THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
|
|
-c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],n=b[k*3+1];k=b[k*3+2];var w=b[j*3],o=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,n,k),new THREE.Vector3(w,
|
|
|
|
-o,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,n){h=a.materials[h];var w=b[j*3],o=b[j*3+1];j=b[j*3+2];var p=b[m*3],x=b[m*3+1];m=b[m*3+2];var A=b[n*3],I=b[n*3+1];n=b[n*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,o,j),new THREE.Vector3(p,x,m),new THREE.Vector3(A,I,n)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
|
|
|
|
-c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var n=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/
|
|
|
|
-Math.LN2));k.image.width=n;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,n,w)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*
|
|
|
|
|
|
+c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],o=b[k*3+1];k=b[k*3+2];var y=b[j*3],p=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,k),new THREE.Vector3(y,
|
|
|
|
+p,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,o){h=a.materials[h];var y=b[j*3],p=b[j*3+1];j=b[j*3+2];var q=b[m*3],A=b[m*3+1];m=b[m*3+2];var C=b[o*3],E=b[o*3+1];o=b[o*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(y,p,j),new THREE.Vector3(q,A,m),new THREE.Vector3(C,E,o)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
|
|
|
|
+c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),y=Math.pow(2,Math.round(Math.log(this.height)/
|
|
|
|
+Math.LN2));k.image.width=o;k.image.height=y;k.image.getContext("2d").drawImage(this,0,0,o,y)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*
|
|
255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|
|
255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|