|
@@ -15,8 +15,8 @@ b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
|
|
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
|
|
g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,m,p,t,o,n,v,u,y=b.geometry,
|
|
g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,m,p,t,o,n,v,u,y=b.geometry,
|
|
-w=y.vertices,C=[],f=0;for(g=y.faces.length;f<g;f++)if(j=y.faces[f],v=this.origin.clone(),u=this.direction.clone(),t=b.matrixWorld,h=t.multiplyVector3(w[j.a].position.clone()),m=t.multiplyVector3(w[j.b].position.clone()),p=t.multiplyVector3(w[j.c].position.clone()),t=j instanceof THREE.Face4?t.multiplyVector3(w[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),n=u.dot(o),b.doubleSided||(b.flipSided?n>0:n<0))if(o=o.dot((new THREE.Vector3).sub(h,v))/n,v=v.addSelf(u.multiplyScalar(o)),
|
|
|
|
-j instanceof THREE.Face3)e(v,h,m,p)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},C.push(j));else if(j instanceof THREE.Face4&&(e(v,h,m,t)||e(v,m,p,t)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},C.push(j);return C}else return[]}};
|
|
|
|
|
|
+w=y.vertices,B=[],f=0;for(g=y.faces.length;f<g;f++)if(j=y.faces[f],v=this.origin.clone(),u=this.direction.clone(),t=b.matrixWorld,h=t.multiplyVector3(w[j.a].position.clone()),m=t.multiplyVector3(w[j.b].position.clone()),p=t.multiplyVector3(w[j.c].position.clone()),t=j instanceof THREE.Face4?t.multiplyVector3(w[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),n=u.dot(o),b.doubleSided||(b.flipSided?n>0:n<0))if(o=o.dot((new THREE.Vector3).sub(h,v))/n,v=v.addSelf(u.multiplyScalar(o)),
|
|
|
|
+j instanceof THREE.Face3)e(v,h,m,p)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},B.push(j));else if(j instanceof THREE.Face4&&(e(v,h,m,t)||e(v,m,p,t)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},B.push(j);return B}else return[]}};
|
|
THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,n){m=!1;c=h;e=j;f=o;g=n;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
|
|
THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,n){m=!1;c=h;e=j;f=o;g=n;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
|
|
function(h,j,o,n,v,u){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<n?j<u?j:u:n<u?n:u,f=h>o?h>v?h:v:o>v?o:v,g=j>n?j>u?j:u:n>u?n:u):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<n?j<u?j<e?j:e:u<e?u:e:n<u?n<e?n:e:u<e?u:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>n?j>u?j>g?j:g:u>g?u:g:n>u?n>g?n:g:u>g?u:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
function(h,j,o,n,v,u){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<n?j<u?j:u:n<u?n:u,f=h>o?h>v?h:v:o>v?o:v,g=j>n?j>u?j:u:n>u?n:u):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<n?j<u?j<e?j:e:u<e?u:e:n<u?n<e?n:e:u<e?u:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>n?j>u?j>g?j:g:u>g?u:g:n>u?n>g?n:g:u>g?u:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
|
|
@@ -24,8 +24,8 @@ THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[
|
|
THREE.Matrix4.prototype={set:function(b,c,e,f,g,j,h,m,p,t,o,n,v,u,y,w){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=m;this.n31=p;this.n32=t;this.n33=o;this.n34=n;this.n41=v;this.n42=u;this.n43=y;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
|
|
THREE.Matrix4.prototype={set:function(b,c,e,f,g,j,h,m,p,t,o,n,v,u,y,w){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=m;this.n31=p;this.n32=t;this.n33=o;this.n34=n;this.n41=v;this.n42=u;this.n43=y;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
|
|
g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
|
|
g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
|
|
f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,p=b.n23,t=b.n24,o=b.n31,n=b.n32,v=b.n33,u=b.n34,y=b.n41,w=b.n42,C=b.n43,x=b.n44,I=c.n11,B=c.n12,J=c.n13,F=c.n14,A=c.n21,X=c.n22,
|
|
|
|
-G=c.n23,H=c.n24,L=c.n31,O=c.n32,P=c.n33,N=c.n34,Q=c.n41,S=c.n42,$=c.n43,k=c.n44;this.n11=e*I+f*A+g*L+j*Q;this.n12=e*B+f*X+g*O+j*S;this.n13=e*J+f*G+g*P+j*$;this.n14=e*F+f*H+g*N+j*k;this.n21=h*I+m*A+p*L+t*Q;this.n22=h*B+m*X+p*O+t*S;this.n23=h*J+m*G+p*P+t*$;this.n24=h*F+m*H+p*N+t*k;this.n31=o*I+n*A+v*L+u*Q;this.n32=o*B+n*X+v*O+u*S;this.n33=o*J+n*G+v*P+u*$;this.n34=o*F+n*H+v*N+u*k;this.n41=y*I+w*A+C*L+x*Q;this.n42=y*B+w*X+C*O+x*S;this.n43=y*J+w*G+C*P+x*$;this.n44=y*F+w*H+C*N+x*k;return this},multiplyToArray:function(b,
|
|
|
|
|
|
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,p=b.n23,t=b.n24,o=b.n31,n=b.n32,v=b.n33,u=b.n34,y=b.n41,w=b.n42,B=b.n43,x=b.n44,I=c.n11,A=c.n12,J=c.n13,F=c.n14,E=c.n21,X=c.n22,
|
|
|
|
+G=c.n23,H=c.n24,M=c.n31,P=c.n32,Q=c.n33,O=c.n34,R=c.n41,T=c.n42,$=c.n43,k=c.n44;this.n11=e*I+f*E+g*M+j*R;this.n12=e*A+f*X+g*P+j*T;this.n13=e*J+f*G+g*Q+j*$;this.n14=e*F+f*H+g*O+j*k;this.n21=h*I+m*E+p*M+t*R;this.n22=h*A+m*X+p*P+t*T;this.n23=h*J+m*G+p*Q+t*$;this.n24=h*F+m*H+p*O+t*k;this.n31=o*I+n*E+v*M+u*R;this.n32=o*A+n*X+v*P+u*T;this.n33=o*J+n*G+v*Q+u*$;this.n34=o*F+n*H+v*O+u*k;this.n41=y*I+w*E+B*M+x*R;this.n42=y*A+w*X+B*P+x*T;this.n43=y*J+w*G+B*Q+x*$;this.n44=y*F+w*H+B*O+x*k;return this},multiplyToArray:function(b,
|
|
c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
|
|
c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
|
|
b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,m=this.n24,p=this.n31,t=this.n32,o=this.n33,n=this.n34,v=this.n41,u=this.n42,y=this.n43,w=this.n44;return f*h*t*v-e*m*t*v-f*j*o*v+c*m*o*v+e*j*n*v-c*h*n*v-f*h*p*u+e*m*p*u+f*g*o*u-b*m*o*u-e*g*n*u+b*h*n*u+f*j*p*y-c*m*p*y-f*g*t*y+b*m*t*y+c*g*n*y-b*j*n*y-e*j*p*w+c*h*p*w+e*g*t*w-b*h*t*w-c*g*o*w+b*j*o*w},transpose:function(){var b;b=this.n21;this.n21=
|
|
b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,m=this.n24,p=this.n31,t=this.n32,o=this.n33,n=this.n34,v=this.n41,u=this.n42,y=this.n43,w=this.n44;return f*h*t*v-e*m*t*v-f*j*o*v+c*m*o*v+e*j*n*v-c*h*n*v-f*h*p*u+e*m*p*u+f*g*o*u-b*m*o*u-e*g*n*u+b*h*n*u+f*j*p*y-c*m*p*y-f*g*t*y+b*m*t*y+c*g*n*y-b*j*n*y-e*j*p*w+c*h*p*w+e*g*t*w-b*h*t*w-c*g*o*w+b*j*o*w},transpose:function(){var b;b=this.n21;this.n21=
|
|
this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
|
|
this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
|
|
@@ -38,8 +38,8 @@ o*e-t;this.n13=j*f;this.n21=j*g;this.n22=j*m;this.n23=-e;this.n31=t*e-o;this.n32
|
|
o*g+t;this.n21=g;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=t*g+o;this.n33=p-n*g;break;case "XZY":p=j*h;t=j*f;o=e*h;n=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=p*g+n;this.n22=j*m;this.n23=t*g-o;this.n31=o*g-t;this.n32=e*m;this.n33=n*g+p;break;default:p=j*m,t=j*g,o=e*m,n=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=t+o*f,this.n22=p-n*f,this.n23=-e*h,this.n31=n-p*f,this.n32=o+t*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,j=c+c,
|
|
o*g+t;this.n21=g;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=t*g+o;this.n33=p-n*g;break;case "XZY":p=j*h;t=j*f;o=e*h;n=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=p*g+n;this.n22=j*m;this.n23=t*g-o;this.n31=o*g-t;this.n32=e*m;this.n33=n*g+p;break;default:p=j*m,t=j*g,o=e*m,n=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=t+o*f,this.n22=p-n*f,this.n23=-e*h,this.n31=n-p*f,this.n32=o+t*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,j=c+c,
|
|
h=e+e,m=f+f,b=c*j,p=c*h;c*=m;var t=e*h;e*=m;f*=m;j*=g;h*=g;g*=m;this.n11=1-(t+f);this.n12=p-g;this.n13=c+h;this.n21=p+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+t);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
|
|
h=e+e,m=f+f,b=c*j,p=c*h;c*=m;var t=e*h;e*=m;f*=m;j*=g;h*=g;g*=m;this.n11=1-(t+f);this.n12=p-g;this.n13=c+h;this.n21=p+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+t);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
|
|
c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,p=b.n23,t=b.n24,o=b.n31,n=b.n32,v=b.n33,u=b.n34,y=b.n41,w=b.n42,C=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*u*w-t*v*w+t*n*C-m*u*C-p*n*x+m*v*x;c.n12=j*v*w-g*u*w-j*n*C+f*u*C+g*n*x-f*v*x;c.n13=g*t*w-j*p*w+j*m*C-f*t*C-g*m*x+f*p*x;c.n14=j*p*n-g*t*n-j*m*v+f*t*v+g*m*u-f*p*u;c.n21=t*v*y-p*u*y-t*o*C+h*u*C+p*o*x-h*v*x;c.n22=g*u*y-j*v*y+j*o*C-e*u*C-g*o*x+e*v*x;c.n23=j*p*y-g*t*y-j*h*C+e*t*C+g*h*x-e*p*x;c.n24=
|
|
|
|
-g*t*o-j*p*o+j*h*v-e*t*v-g*h*u+e*p*u;c.n31=m*u*y-t*n*y+t*o*w-h*u*w-m*o*x+h*n*x;c.n32=j*n*y-f*u*y-j*o*w+e*u*w+f*o*x-e*n*x;c.n33=g*t*y-j*m*y+j*h*w-e*t*w-f*h*x+e*m*x;c.n34=j*m*o-f*t*o-j*h*n+e*t*n+f*h*u-e*m*u;c.n41=p*n*y-m*v*y-p*o*w+h*v*w+m*o*C-h*n*C;c.n42=f*v*y-g*n*y+g*o*w-e*v*w-f*o*C+e*n*C;c.n43=g*m*y-f*p*y-g*h*w+e*p*w+f*h*C-e*m*C;c.n44=f*p*o-g*m*o+g*h*n-e*p*n-f*h*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,p=b.n23,t=b.n24,o=b.n31,n=b.n32,v=b.n33,u=b.n34,y=b.n41,w=b.n42,B=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*u*w-t*v*w+t*n*B-m*u*B-p*n*x+m*v*x;c.n12=j*v*w-g*u*w-j*n*B+f*u*B+g*n*x-f*v*x;c.n13=g*t*w-j*p*w+j*m*B-f*t*B-g*m*x+f*p*x;c.n14=j*p*n-g*t*n-j*m*v+f*t*v+g*m*u-f*p*u;c.n21=t*v*y-p*u*y-t*o*B+h*u*B+p*o*x-h*v*x;c.n22=g*u*y-j*v*y+j*o*B-e*u*B-g*o*x+e*v*x;c.n23=j*p*y-g*t*y-j*h*B+e*t*B+g*h*x-e*p*x;c.n24=
|
|
|
|
+g*t*o-j*p*o+j*h*v-e*t*v-g*h*u+e*p*u;c.n31=m*u*y-t*n*y+t*o*w-h*u*w-m*o*x+h*n*x;c.n32=j*n*y-f*u*y-j*o*w+e*u*w+f*o*x-e*n*x;c.n33=g*t*y-j*m*y+j*h*w-e*t*w-f*h*x+e*m*x;c.n34=j*m*o-f*t*o-j*h*n+e*t*n+f*h*u-e*m*u;c.n41=p*n*y-m*v*y-p*o*w+h*v*w+m*o*B-h*n*B;c.n42=f*v*y-g*n*y+g*o*w-e*v*w-f*o*B+e*n*B;c.n43=g*m*y-f*p*y-g*h*w+e*p*w+f*h*B-e*m*B;c.n44=f*p*o-g*m*o+g*h*n-e*p*n-f*h*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
|
|
THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*m;e[5]=b*p;e[6]=b*t;e[7]=b*o;e[8]=b*n;return c};
|
|
THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*m;e[5]=b*p;e[6]=b*t;e[7]=b*o;e[8]=b*n;return c};
|
|
THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(j+g)/(j-g);h.n34=-2*j*g/(j-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
|
|
THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(j+g)/(j-g);h.n34=-2*j*g/(j-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
|
|
THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,m,p,t;h=new THREE.Matrix4;m=c-b;p=e-f;t=j-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/p;h.n23=0;h.n24=-((e+f)/p);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((j+g)/t);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,m,p,t;h=new THREE.Matrix4;m=c-b;p=e-f;t=j-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/p;h.n23=0;h.n24=-((e+f)/p);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((j+g)/t);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
@@ -61,9 +61,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.f
|
|
e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],m.sub(h.position,e.position),p.sub(c.position,e.position),m.crossSelf(p);m.isZero()||
|
|
e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],m.sub(h.position,e.position),p.sub(c.position,e.position),m.crossSelf(p);m.isZero()||
|
|
m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,j,G){m=b.vertices[e].position;p=b.vertices[c].position;t=b.vertices[f].position;o=h[g];n=h[j];v=h[G];u=p.x-m.x;y=t.x-m.x;w=p.y-m.y;C=t.y-m.y;x=p.z-m.z;I=t.z-m.z;B=n.u-o.u;J=v.u-o.u;F=n.v-o.v;A=v.v-o.v;X=1/(B*A-J*F);O.set((A*u-F*y)*
|
|
|
|
-X,(A*w-F*C)*X,(A*x-F*I)*X);P.set((B*y-J*u)*X,(B*C-J*w)*X,(B*I-J*x)*X);H[e].addSelf(O);H[c].addSelf(O);H[f].addSelf(O);L[e].addSelf(P);L[c].addSelf(P);L[f].addSelf(P)}var c,e,f,g,j,h,m,p,t,o,n,v,u,y,w,C,x,I,B,J,F,A,X,G,H=[],L=[],O=new THREE.Vector3,P=new THREE.Vector3,N=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)H[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
|
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var $=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),g=j[$[f]],G=H[g],N.copy(G),N.subSelf(S.multiplyScalar(S.dot(G))).normalize(),Q.cross(j.vertexNormals[f],G),g=Q.dot(L[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(N.x,N.y,N.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,j,G){m=b.vertices[e].position;p=b.vertices[c].position;t=b.vertices[f].position;o=h[g];n=h[j];v=h[G];u=p.x-m.x;y=t.x-m.x;w=p.y-m.y;B=t.y-m.y;x=p.z-m.z;I=t.z-m.z;A=n.u-o.u;J=v.u-o.u;F=n.v-o.v;E=v.v-o.v;X=1/(A*E-J*F);P.set((E*u-F*y)*
|
|
|
|
+X,(E*w-F*B)*X,(E*x-F*I)*X);Q.set((A*y-J*u)*X,(A*B-J*w)*X,(A*I-J*x)*X);H[e].addSelf(P);H[c].addSelf(P);H[f].addSelf(P);M[e].addSelf(Q);M[c].addSelf(Q);M[f].addSelf(Q)}var c,e,f,g,j,h,m,p,t,o,n,v,u,y,w,B,x,I,A,J,F,E,X,G,H=[],M=[],P=new THREE.Vector3,Q=new THREE.Vector3,O=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)H[c]=new THREE.Vector3,M[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
|
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var $=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)T.copy(j.vertexNormals[f]),g=j[$[f]],G=H[g],O.copy(G),O.subSelf(T.multiplyScalar(T.dot(G))).normalize(),R.cross(j.vertexNormals[f],G),g=R.dot(M[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(O.x,O.y,O.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
|
|
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
|
|
void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,j,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
|
|
void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,j,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
|
|
@@ -124,12 +124,12 @@ THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THR
|
|
THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,j,h,m,p,t,o,n,v,u,y=new THREE.Geometry;y.vertices=this.geometry.vertices;f=y.faces=this.geometry.faces;var w=y.egdes=this.geometry.edges,C=y.edgeFaces=[];g=0;var x=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],x.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,j,h,m,p,t,o,n,v,u,y=new THREE.Geometry;y.vertices=this.geometry.vertices;f=y.faces=this.geometry.faces;var w=y.egdes=this.geometry.edges,B=y.edgeFaces=[];g=0;var x=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],x.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
e.normal;b=0;for(c=w.length;b<c;b++)m=w[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],j=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(p="a",o=x[g]+0):e.b===h?(p="b",o=x[g]+1):e.c===h?(p="c",o=x[g]+2):e.d===h&&(p="d",o=x[g]+3),e.a===m?(p+="a",n=x[g]+0):e.b===m?(p+="b",n=x[g]+1):e.c===m?(p+="c",n=x[g]+2):e.d===m&&(p+="d",n=x[g]+3),f.a===h?(t="a",v=x[j]+0):f.b===h?(t="b",v=x[j]+1):f.c===h?(t="c",v=x[j]+2):f.d===h&&(t="d",v=x[j]+3),f.a===m?(t+="a",u=x[j]+0):f.b===m?(t+="b",u=x[j]+
|
|
e.normal;b=0;for(c=w.length;b<c;b++)m=w[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],j=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(p="a",o=x[g]+0):e.b===h?(p="b",o=x[g]+1):e.c===h?(p="c",o=x[g]+2):e.d===h&&(p="d",o=x[g]+3),e.a===m?(p+="a",n=x[g]+0):e.b===m?(p+="b",n=x[g]+1):e.c===m?(p+="c",n=x[g]+2):e.d===m&&(p+="d",n=x[g]+3),f.a===h?(t="a",v=x[j]+0):f.b===h?(t="b",v=x[j]+1):f.c===h?(t="c",v=x[j]+2):f.d===h&&(t="d",v=x[j]+3),f.a===m?(t+="a",u=x[j]+0):f.b===m?(t+="b",u=x[j]+
|
|
-1):f.c===m?(t+="c",u=x[j]+2):f.d===m&&(t+="d",u=x[j]+3),p==="ac"||p==="ad"||p==="ca"||p==="da"?o>n&&(e=o,o=n,n=e):o<n&&(e=o,o=n,n=e),t==="ac"||t==="ad"||t==="ca"||t==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(o,n,v,u),e.normal.set(1,0,0),C.push(e);this.geometry=y}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
|
|
|
+1):f.c===m?(t+="c",u=x[j]+2):f.d===m&&(t+="d",u=x[j]+3),p==="ac"||p==="ad"||p==="ca"||p==="da"?o>n&&(e=o,o=n,n=e):o<n&&(e=o,o=n,n=e),t==="ac"||t==="ad"||t==="ca"||t==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(o,n,v,u),e.normal.set(1,0,0),B.push(e);this.geometry=y}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,j=g.length,h,m,p,t,o,n=["a","b","c","d"];for(p=0;p<j;p++){m=c.length;h=g[p];h instanceof THREE.Face4?(t=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(t=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
|
|
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,j=g.length,h,m,p,t,o,n=["a","b","c","d"];for(p=0;p<j;p++){m=c.length;h=g[p];h instanceof THREE.Face4?(t=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(t=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
|
|
for(m=0;m<t;m++)o=b[h[n[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(j=0;j<g.length-1;j++){b=e[j];for(h=j+1;h<g.length;h++)m=e[h],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
|
|
for(m=0;m<t;m++)o=b[h[n[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(j=0;j<g.length-1;j++){b=e[j];for(h=j+1;h<g.length;h++)m=e[h],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,j,h,m,p,t,o,n,v,u,y,w,C=0,x=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){j=c[x[y]];m=b[j];for(w=0;w<g;w++)if(h=e[x[w]],p=b[h],Math.abs(m.position.x-p.position.x)<1.0E-4&&Math.abs(m.position.y-p.position.y)<1.0E-4&&Math.abs(m.position.z-p.position.z)<1.0E-4&&(C++,C===1&&(t=m,o=p,n=j,v=h,u=x[y]),C===2))return u+=x[y],u==="ad"||u==="ac"?{faces:[c,e],vertices:[t,o,p,m],indices:[n,v,
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,j,h,m,p,t,o,n,v,u,y,w,B=0,x=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){j=c[x[y]];m=b[j];for(w=0;w<g;w++)if(h=e[x[w]],p=b[h],Math.abs(m.position.x-p.position.x)<1.0E-4&&Math.abs(m.position.y-p.position.y)<1.0E-4&&Math.abs(m.position.z-p.position.z)<1.0E-4&&(B++,B===1&&(t=m,o=p,n=j,v=h,u=x[y]),B===2))return u+=x[y],u==="ad"||u==="ac"?{faces:[c,e],vertices:[t,o,p,m],indices:[n,v,
|
|
h,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[t,m,p,o],indices:[n,j,h,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
h,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[t,m,p,o],indices:[n,j,h,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
|
|
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
|
|
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
|
|
@@ -139,57 +139,57 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
|
|
THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};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(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
-THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,j=-e.z+e.w;return h>=0&&g>=0&&k>=0&&j>=0?!0:h<0&&g<0||k<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-j)):j<0&&(f=Math.min(f,k/(k-j))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],h,m,p=[],t,o,n=[],v,u=[],y,w,C=[],x,I,B=[],J=new THREE.Vector4,F=new THREE.Vector4,
|
|
|
|
-A=new THREE.Matrix4,X=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(b,e){A.multiply(e.projectionMatrix,e.matrixWorldInverse);A.multiplyVector3(b);return b};this.unprojectVector=function(b,e){A.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));A.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,p,t;g=0;p=
|
|
|
|
-b.objects;b=0;for(m=p.length;b<m;b++){t=p[b];var k;if(!(k=!t.visible))if(k=t instanceof THREE.Mesh){a:{k=void 0;for(var o=t.matrixWorld,n=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),u=0;u<6;u++)if(k=G[u].x*o.n14+G[u].y*o.n24+G[u].z*o.n34+G[u].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=j[g]=j[g]||new THREE.RenderableObject,g++,f=k,J.copy(t.position),A.multiplyVector3(J),f.object=t,f.z=J.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var J=[],
|
|
|
|
-S=g.near,$=g.far,k,K,da,Z,aa,ha,la,fa,pa,D,ea,ca,ja,na,V,U,ga;I=w=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);A.multiply(g.projectionMatrix,g.matrixWorldInverse);G[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);G[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);G[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);G[3].set(A.n41-A.n21,A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);G[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);G[5].set(A.n41+A.n31,A.n42+
|
|
|
|
-A.n32,A.n43+A.n33,A.n44+A.n34);for(k=0;k<6;k++)pa=G[k],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,g,!0);f=0;for(k=pa.length;f<k;f++)if(D=pa[f].object,D.visible)if(ea=D.matrixWorld,ca=D.matrixRotationWorld,ja=D.materials,na=D.overdraw,m=0,D instanceof THREE.Mesh){V=D.geometry;Z=V.vertices;U=V.faces;V=V.faceVertexUvs;K=0;for(da=Z.length;K<da;K++)h=b(),h.positionWorld.copy(Z[K].position),ea.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
|
-A.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<$;Z=0;for(K=U.length;Z<K;Z++){da=U[Z];if(da instanceof THREE.Face3)if(aa=p[da.a],ha=p[da.b],la=p[da.c],aa.visible&&ha.visible&&la.visible&&(D.doubleSided||D.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<
|
|
|
|
-0))fa=n[o]=n[o]||new THREE.RenderableFace3,o++,t=fa,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la);else continue;else if(da instanceof THREE.Face4)if(aa=p[da.a],ha=p[da.b],la=p[da.c],fa=p[da.d],aa.visible&&ha.visible&&la.visible&&fa.visible&&(D.doubleSided||D.flipSided!=((fa.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<0||(ha.positionScreen.x-la.positionScreen.x)*(fa.positionScreen.y-
|
|
|
|
-la.positionScreen.y)-(ha.positionScreen.y-la.positionScreen.y)*(fa.positionScreen.x-la.positionScreen.x)<0)))ga=u[v]=u[v]||new THREE.RenderableFace4,v++,t=ga,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la),t.v4.copy(fa);else continue;t.normalWorld.copy(da.normal);ca.multiplyVector3(t.normalWorld);t.centroidWorld.copy(da.centroid);ea.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);A.multiplyVector3(t.centroidScreen);la=da.vertexNormals;aa=0;for(ha=la.length;aa<ha;aa++)fa=t.vertexNormalsWorld[aa],
|
|
|
|
-fa.copy(la[aa]),ca.multiplyVector3(fa);aa=0;for(ha=V.length;aa<ha;aa++)if(ga=V[aa][Z]){la=0;for(fa=ga.length;la<fa;la++)t.uvs[aa][la]=ga[la]}t.meshMaterials=ja;t.faceMaterials=da.materials;t.overdraw=na;t.z=t.centroidScreen.z;J.push(t)}}else if(D instanceof THREE.Line){X.multiply(A,ea);Z=D.geometry.vertices;aa=b();aa.positionScreen.copy(Z[0].position);X.multiplyVector4(aa.positionScreen);K=1;for(da=Z.length;K<da;K++)if(aa=b(),aa.positionScreen.copy(Z[K].position),X.multiplyVector4(aa.positionScreen),
|
|
|
|
-ha=p[m-2],H.copy(aa.positionScreen),L.copy(ha.positionScreen),e(H,L))H.multiplyScalar(1/H.w),L.multiplyScalar(1/L.w),ea=C[w]=C[w]||new THREE.RenderableLine,w++,y=ea,y.v1.positionScreen.copy(H),y.v2.positionScreen.copy(L),y.z=Math.max(H.z,L.z),y.materials=D.materials,J.push(y)}else if(D instanceof THREE.Particle&&(F.set(D.matrixWorld.n14,D.matrixWorld.n24,D.matrixWorld.n34,1),A.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ea=B[I]=B[I]||new THREE.RenderableParticle,I++,x=ea,x.x=F.x/F.w,x.y=F.y/F.w,x.z=
|
|
|
|
-F.z,x.rotation=D.rotation.z,x.scale.x=D.scale.x*Math.abs(x.x-(F.x+g.projectionMatrix.n11)/(F.w+g.projectionMatrix.n14)),x.scale.y=D.scale.y*Math.abs(x.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),x.materials=D.materials,J.push(x);j&&J.sort(c);return J}};
|
|
|
|
|
|
+THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,j=-e.z+e.w;return h>=0&&g>=0&&k>=0&&j>=0?!0:h<0&&g<0||k<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-j)):j<0&&(f=Math.min(f,k/(k-j))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],h,m,p=[],t,o,n=[],v,u=[],y,w,B=[],x,I,A=[],J=new THREE.Vector4,F=new THREE.Vector4,
|
|
|
|
+E=new THREE.Matrix4,X=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(b,e){E.multiply(e.projectionMatrix,e.matrixWorldInverse);E.multiplyVector3(b);return b};this.unprojectVector=function(b,e){E.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));E.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,p,t;g=0;p=
|
|
|
|
+b.objects;b=0;for(m=p.length;b<m;b++){t=p[b];var k;if(!(k=!t.visible))if(k=t instanceof THREE.Mesh){a:{k=void 0;for(var o=t.matrixWorld,n=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),u=0;u<6;u++)if(k=G[u].x*o.n14+G[u].y*o.n24+G[u].z*o.n34+G[u].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=j[g]=j[g]||new THREE.RenderableObject,g++,f=k,J.copy(t.position),E.multiplyVector3(J),f.object=t,f.z=J.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var J=[],
|
|
|
|
+T=g.near,$=g.far,k,K,da,Z,aa,ha,la,ea,fa,C,ia,na,ca,oa,L,V,ga;I=w=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);E.multiply(g.projectionMatrix,g.matrixWorldInverse);G[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);G[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);G[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);G[3].set(E.n41-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);G[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);G[5].set(E.n41+E.n31,E.n42+
|
|
|
|
+E.n32,E.n43+E.n33,E.n44+E.n34);for(k=0;k<6;k++)fa=G[k],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,g,!0);f=0;for(k=fa.length;f<k;f++)if(C=fa[f].object,C.visible)if(ia=C.matrixWorld,na=C.matrixRotationWorld,ca=C.materials,oa=C.overdraw,m=0,C instanceof THREE.Mesh){L=C.geometry;Z=L.vertices;V=L.faces;L=L.faceVertexUvs;K=0;for(da=Z.length;K<da;K++)h=b(),h.positionWorld.copy(Z[K].position),ia.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
|
+E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>T&&h.positionScreen.z<$;Z=0;for(K=V.length;Z<K;Z++){da=V[Z];if(da instanceof THREE.Face3)if(aa=p[da.a],ha=p[da.b],la=p[da.c],aa.visible&&ha.visible&&la.visible&&(C.doubleSided||C.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<
|
|
|
|
+0))ea=n[o]=n[o]||new THREE.RenderableFace3,o++,t=ea,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la);else continue;else if(da instanceof THREE.Face4)if(aa=p[da.a],ha=p[da.b],la=p[da.c],ea=p[da.d],aa.visible&&ha.visible&&la.visible&&ea.visible&&(C.doubleSided||C.flipSided!=((ea.positionScreen.x-aa.positionScreen.x)*(ha.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ha.positionScreen.x-aa.positionScreen.x)<0||(ha.positionScreen.x-la.positionScreen.x)*(ea.positionScreen.y-
|
|
|
|
+la.positionScreen.y)-(ha.positionScreen.y-la.positionScreen.y)*(ea.positionScreen.x-la.positionScreen.x)<0)))ga=u[v]=u[v]||new THREE.RenderableFace4,v++,t=ga,t.v1.copy(aa),t.v2.copy(ha),t.v3.copy(la),t.v4.copy(ea);else continue;t.normalWorld.copy(da.normal);na.multiplyVector3(t.normalWorld);t.centroidWorld.copy(da.centroid);ia.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);E.multiplyVector3(t.centroidScreen);la=da.vertexNormals;aa=0;for(ha=la.length;aa<ha;aa++)ea=t.vertexNormalsWorld[aa],
|
|
|
|
+ea.copy(la[aa]),na.multiplyVector3(ea);aa=0;for(ha=L.length;aa<ha;aa++)if(ga=L[aa][Z]){la=0;for(ea=ga.length;la<ea;la++)t.uvs[aa][la]=ga[la]}t.meshMaterials=ca;t.faceMaterials=da.materials;t.overdraw=oa;t.z=t.centroidScreen.z;J.push(t)}}else if(C instanceof THREE.Line){X.multiply(E,ia);Z=C.geometry.vertices;aa=b();aa.positionScreen.copy(Z[0].position);X.multiplyVector4(aa.positionScreen);K=1;for(da=Z.length;K<da;K++)if(aa=b(),aa.positionScreen.copy(Z[K].position),X.multiplyVector4(aa.positionScreen),
|
|
|
|
+ha=p[m-2],H.copy(aa.positionScreen),M.copy(ha.positionScreen),e(H,M))H.multiplyScalar(1/H.w),M.multiplyScalar(1/M.w),ia=B[w]=B[w]||new THREE.RenderableLine,w++,y=ia,y.v1.positionScreen.copy(H),y.v2.positionScreen.copy(M),y.z=Math.max(H.z,M.z),y.materials=C.materials,J.push(y)}else if(C instanceof THREE.Particle&&(F.set(C.matrixWorld.n14,C.matrixWorld.n24,C.matrixWorld.n34,1),E.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ia=A[I]=A[I]||new THREE.RenderableParticle,I++,x=ia,x.x=F.x/F.w,x.y=F.y/F.w,x.z=
|
|
|
|
+F.z,x.rotation=C.rotation.z,x.scale.x=C.scale.x*Math.abs(x.x-(F.x+g.projectionMatrix.n11)/(F.w+g.projectionMatrix.n14)),x.scale.y=C.scale.y*Math.abs(x.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),x.materials=C.materials,J.push(x);j&&J.sort(c);return J}};
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var p,t,o,n,v,u,y,w;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(v=b[p],v instanceof THREE.RenderableParticle){y=v.x*g+g;w=v.y*j+j;o=0;for(n=v.material.length;o<n;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=w+"px"}}};
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var p,t,o,n,v,u,y,w;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(v=b[p],v instanceof THREE.RenderableParticle){y=v.x*g+g;w=v.y*j+j;o=0;for(n=v.material.length;o<n;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=w+"px"}}};
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(x!=b)y.globalAlpha=x=b}function e(b){if(I!=b){switch(b){case THREE.NormalBlending:y.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:y.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:y.globalCompositeOperation="darker"}I=b}}function f(b){if(B!=b.hex)B=b.hex,y.strokeStyle="#"+j(B.toString(16))}function g(b){if(J!=b.hex)J=b.hex,y.fillStyle="#"+j(J.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
|
-var h=this,m=null,p=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,n,v,u,y=t.getContext("2d"),w=new THREE.Color(0),C=0,x=1,I=0,B=null,J=null,F=null,A=null,X=null,G,H,L,O,P=new THREE.RenderableVertex,N=new THREE.RenderableVertex,Q,S,$,k,K,da,Z,aa,ha,la,fa,pa,D=new THREE.Color(0),ea=new THREE.Color(0),ca=new THREE.Color(0),ja=new THREE.Color(0),na=new THREE.Color(0),V,U,ga,ka,sa,xa,Aa,Ia,Ba,Pa,W=new THREE.Rectangle,ia=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
|
-ta=!1,ua=new THREE.Color,wa=new THREE.Color,Da=new THREE.Color,ya=new THREE.Color,ra=new THREE.Vector3,Ea,Y,R,va,T,za,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Y=Ea.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);R=Y.getImageData(0,0,2,2);va=R.data;T=document.createElement("canvas");T.width=T.height=b;za=T.getContext("2d");za.translate(-b/2,-b/2);za.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};
|
|
|
|
-this.setSize=function(b,e){o=b;n=e;v=o/2;u=n/2;t.width=o;t.height=n;W.set(-v,-u,v,u);ia.set(-v,-u,v,u);x=1;I=0;X=A=F=J=B=null};this.setClearColor=function(b,e){w=b;C=e;ia.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){w.setHex(b);C=e;ia.set(-v,-u,v,u)};this.clear=function(){y.setTransform(1,0,0,-1,v,u);if(!ia.isEmpty())ia.inflate(1),ia.minSelf(W),C==0?y.clearRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight()):(e(THREE.NormalBlending),c(1),J="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+
|
|
|
|
-","+Math.floor(w.b*255)+","+C+")",y.fillStyle=J,y.fillRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight())),ia.empty()};this.render=function(b,j){function t(b){var e,c,f,h=b.lights;wa.setRGB(0,0,0);Da.setRGB(0,0,0);ya.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):c instanceof THREE.PointLight&&(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b)}function o(b,e,c,f){var h,g,
|
|
|
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(x!=b)y.globalAlpha=x=b}function e(b){if(I!=b){switch(b){case THREE.NormalBlending:y.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:y.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:y.globalCompositeOperation="darker"}I=b}}function f(b){if(A!=b.hex)A=b.hex,y.strokeStyle="#"+j(A.toString(16))}function g(b){if(J!=b.hex)J=b.hex,y.fillStyle="#"+j(J.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
|
|
|
|
+var h=this,m=null,p=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,n,v,u,y=t.getContext("2d"),w=new THREE.Color(0),B=0,x=1,I=0,A=null,J=null,F=null,E=null,X=null,G,H,M,P,Q=new THREE.RenderableVertex,O=new THREE.RenderableVertex,R,T,$,k,K,da,Z,aa,ha,la,ea,fa,C=new THREE.Color(0),ia=new THREE.Color(0),na=new THREE.Color(0),ca=new THREE.Color(0),oa=new THREE.Color(0),L,V,ga,ka,sa,xa,Aa,Ia,Ba,Pa,W=new THREE.Rectangle,ja=new THREE.Rectangle,qa=new THREE.Rectangle,
|
|
|
|
+ta=!1,ua=new THREE.Color,wa=new THREE.Color,Da=new THREE.Color,ya=new THREE.Color,ra=new THREE.Vector3,Ea,Y,S,va,U,za,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Y=Ea.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);S=Y.getImageData(0,0,2,2);va=S.data;U=document.createElement("canvas");U.width=U.height=b;za=U.getContext("2d");za.translate(-b/2,-b/2);za.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};
|
|
|
|
+this.setSize=function(b,e){o=b;n=e;v=o/2;u=n/2;t.width=o;t.height=n;W.set(-v,-u,v,u);ja.set(-v,-u,v,u);x=1;I=0;X=E=F=J=A=null};this.setClearColor=function(b,e){w=b;B=e;ja.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){w.setHex(b);B=e;ja.set(-v,-u,v,u)};this.clear=function(){y.setTransform(1,0,0,-1,v,u);if(!ja.isEmpty())ja.inflate(1),ja.minSelf(W),B==0?y.clearRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight()):(e(THREE.NormalBlending),c(1),J="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+
|
|
|
|
+","+Math.floor(w.b*255)+","+B+")",y.fillStyle=J,y.fillRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight())),ja.empty()};this.render=function(b,j){function t(b){var e,c,f,h=b.lights;wa.setRGB(0,0,0);Da.setRGB(0,0,0);ya.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):c instanceof THREE.PointLight&&(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b)}function o(b,e,c,f){var h,g,
|
|
j,k,m=b.lights,b=0;for(h=m.length;b<h;b++)g=m[b],j=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=c.dot(ra.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function n(b,h,k){c(k.opacity);e(k.blending);var j,m,p,t,ma,o;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)t=k.map.image,
|
|
j,k,m=b.lights,b=0;for(h=m.length;b<h;b++)g=m[b],j=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=c.dot(ra.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function n(b,h,k){c(k.opacity);e(k.blending);var j,m,p,t,ma,o;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)t=k.map.image,
|
|
ma=t.width>>1,o=t.height>>1,k=h.scale.x*v,p=h.scale.y*u,j=k*ma,m=p*o,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),W.instersects(qa)&&(y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(k,-p),y.translate(-ma,-o),y.drawImage(t,0,0),y.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*v,m=h.scale.y*u,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),W.instersects(qa)&&(f(k.color),g(k.color),y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(j,m),k.program(y),y.restore()))}function x(b,h,k,g){c(g.opacity);
|
|
ma=t.width>>1,o=t.height>>1,k=h.scale.x*v,p=h.scale.y*u,j=k*ma,m=p*o,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),W.instersects(qa)&&(y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(k,-p),y.translate(-ma,-o),y.drawImage(t,0,0),y.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*v,m=h.scale.y*u,qa.set(b.x-j,b.y-m,b.x+j,b.y+m),W.instersects(qa)&&(f(k.color),g(k.color),y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(j,m),k.program(y),y.restore()))}function x(b,h,k,g){c(g.opacity);
|
|
-e(g.blending);y.beginPath();y.moveTo(b.positionScreen.x,b.positionScreen.y);y.lineTo(h.positionScreen.x,h.positionScreen.y);y.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)y.lineWidth=F=b;b=g.linecap;if(A!=b)y.lineCap=A=b;b=g.linejoin;if(X!=b)y.lineJoin=X=b;f(g.color);y.stroke();qa.inflate(g.linewidth*2)}}function C(b,f,g,m,p,t,ma,n,u){h.data.vertices+=3;h.data.faces++;c(n.opacity);e(n.blending);Q=b.positionScreen.x;S=b.positionScreen.y;$=f.positionScreen.x;k=f.positionScreen.y;
|
|
|
|
-K=g.positionScreen.x;da=g.positionScreen.y;B(Q,S,$,k,K,da);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ka=ma.uvs[0],Ga(Q,S,$,k,K,da,n.map.image,ka[m].u,ka[m].v,ka[p].u,ka[p].v,ka[t].u,ka[t].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,ra.copy(ma.vertexNormalsWorld[0]),sa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,xa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[1]),
|
|
|
|
-Aa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Ia=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[2]),Ba=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Pa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,Ga(Q,S,$,k,K,da,n.envMap.image,sa,xa,Aa,Ia,Ba,Pa)}else n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ka=ma.uvs[0],Ga(Q,S,
|
|
|
|
-$,k,K,da,n.map.image,ka[m].u,ka[m].v,ka[p].u,ka[p].v,ka[t].u,ka[t].v)),e(THREE.SubtractiveBlending)),ta?!n.wireframe&&n.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3?(ea.r=ca.r=ja.r=wa.r,ea.g=ca.g=ja.g=wa.g,ea.b=ca.b=ja.b=wa.b,o(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ea),o(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],ca),o(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],ja),na.r=(ca.r+ja.r)*0.5,na.g=(ca.g+ja.g)*0.5,na.b=(ca.b+ja.b)*0.5,ga=Sa(ea,ca,ja,na),Ga(Q,S,$,k,K,da,ga,
|
|
|
|
-0,0,1,0,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),D.r=Math.max(0,Math.min(n.color.r*ua.r,1)),D.g=Math.max(0,Math.min(n.color.g*ua.g,1)),D.b=Math.max(0,Math.min(n.color.b*ua.b,1)),D.updateHex(),n.wireframe?Ja(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(D)):n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color);else if(n instanceof THREE.MeshDepthMaterial)V=j.near,U=j.far,ea.r=ea.g=ea.b=1-Na(b.positionScreen.z,
|
|
|
|
-V,U),ca.r=ca.g=ca.b=1-Na(f.positionScreen.z,V,U),ja.r=ja.g=ja.b=1-Na(g.positionScreen.z,V,U),na.r=(ca.r+ja.r)*0.5,na.g=(ca.g+ja.g)*0.5,na.b=(ca.b+ja.b)*0.5,ga=Sa(ea,ca,ja,na),Ga(Q,S,$,k,K,da,ga,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)D.r=Qa(ma.normalWorld.x),D.g=Qa(ma.normalWorld.y),D.b=Qa(ma.normalWorld.z),D.updateHex(),n.wireframe?Ja(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(D)}function w(b,f,g,m,p,t,ma,n,u){h.data.vertices+=4;h.data.faces++;c(n.opacity);
|
|
|
|
-e(n.blending);if(n.map||n.envMap)C(b,f,m,0,1,3,ma,n,u),C(p,g,t,1,2,3,ma,n,u);else if(Q=b.positionScreen.x,S=b.positionScreen.y,$=f.positionScreen.x,k=f.positionScreen.y,K=g.positionScreen.x,da=g.positionScreen.y,Z=m.positionScreen.x,aa=m.positionScreen.y,ha=p.positionScreen.x,la=p.positionScreen.y,fa=t.positionScreen.x,pa=t.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(Q,S,$,k,K,da,Z,aa),n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color);else if(n instanceof
|
|
|
|
-THREE.MeshLambertMaterial)ta?!n.wireframe&&n.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==4?(ea.r=ca.r=ja.r=na.r=wa.r,ea.g=ca.g=ja.g=na.g=wa.g,ea.b=ca.b=ja.b=na.b=wa.b,o(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ea),o(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],ca),o(u,ma.v4.positionWorld,ma.vertexNormalsWorld[3],ja),o(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],na),ga=Sa(ea,ca,ja,na),B(Q,S,$,k,Z,aa),Ga(Q,S,$,k,Z,aa,ga,0,0,1,0,0,1),B(ha,la,K,da,fa,pa),Ga(ha,la,K,da,fa,pa,
|
|
|
|
-ga,1,0,1,1,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),D.r=Math.max(0,Math.min(n.color.r*ua.r,1)),D.g=Math.max(0,Math.min(n.color.g*ua.g,1)),D.b=Math.max(0,Math.min(n.color.b*ua.b,1)),D.updateHex(),I(Q,S,$,k,K,da,Z,aa),n.wireframe?Ja(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(D)):(I(Q,S,$,k,K,da,Z,aa),n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color));else if(n instanceof THREE.MeshNormalMaterial)D.r=
|
|
|
|
-Qa(ma.normalWorld.x),D.g=Qa(ma.normalWorld.y),D.b=Qa(ma.normalWorld.z),D.updateHex(),I(Q,S,$,k,K,da,Z,aa),n.wireframe?Ja(D,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(D);else if(n instanceof THREE.MeshDepthMaterial)V=j.near,U=j.far,ea.r=ea.g=ea.b=1-Na(b.positionScreen.z,V,U),ca.r=ca.g=ca.b=1-Na(f.positionScreen.z,V,U),ja.r=ja.g=ja.b=1-Na(m.positionScreen.z,V,U),na.r=na.g=na.b=1-Na(g.positionScreen.z,V,U),ga=Sa(ea,ca,ja,na),B(Q,S,$,k,Z,aa),Ga(Q,S,$,k,Z,aa,ga,0,0,1,0,0,1),B(ha,la,
|
|
|
|
-K,da,fa,pa),Ga(ha,la,K,da,fa,pa,ga,1,0,1,1,0,1)}function B(b,e,c,f,h,g){y.beginPath();y.moveTo(b,e);y.lineTo(c,f);y.lineTo(h,g);y.lineTo(b,e);y.closePath()}function I(b,e,c,f,h,g,k,j){y.beginPath();y.moveTo(b,e);y.lineTo(c,f);y.lineTo(h,g);y.lineTo(k,j);y.lineTo(b,e);y.closePath()}function Ja(b,e,c,h){if(F!=e)y.lineWidth=F=e;if(A!=c)y.lineCap=A=c;if(X!=h)y.lineJoin=X=h;f(b);y.stroke();qa.inflate(e*2)}function J(b){g(b);y.fill()}function Ga(b,e,c,f,h,g,k,j,m,p,n,t,ma){var o,u;o=k.width-1;u=k.height-
|
|
|
|
|
|
+e(g.blending);y.beginPath();y.moveTo(b.positionScreen.x,b.positionScreen.y);y.lineTo(h.positionScreen.x,h.positionScreen.y);y.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)y.lineWidth=F=b;b=g.linecap;if(E!=b)y.lineCap=E=b;b=g.linejoin;if(X!=b)y.lineJoin=X=b;f(g.color);y.stroke();qa.inflate(g.linewidth*2)}}function B(b,f,g,m,p,t,ma,n,u){h.data.vertices+=3;h.data.faces++;c(n.opacity);e(n.blending);R=b.positionScreen.x;T=b.positionScreen.y;$=f.positionScreen.x;k=f.positionScreen.y;
|
|
|
|
+K=g.positionScreen.x;da=g.positionScreen.y;A(R,T,$,k,K,da);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ka=ma.uvs[0],Ga(R,T,$,k,K,da,n.map.image,ka[m].u,ka[m].v,ka[p].u,ka[p].v,ka[t].u,ka[t].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,ra.copy(ma.vertexNormalsWorld[0]),sa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,xa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[1]),
|
|
|
|
+Aa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Ia=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[2]),Ba=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Pa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,Ga(R,T,$,k,K,da,n.envMap.image,sa,xa,Aa,Ia,Ba,Pa)}else n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ka=ma.uvs[0],Ga(R,T,
|
|
|
|
+$,k,K,da,n.map.image,ka[m].u,ka[m].v,ka[p].u,ka[p].v,ka[t].u,ka[t].v)),e(THREE.SubtractiveBlending)),ta?!n.wireframe&&n.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3?(ia.r=na.r=ca.r=wa.r,ia.g=na.g=ca.g=wa.g,ia.b=na.b=ca.b=wa.b,o(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ia),o(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],na),o(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],ca),oa.r=(na.r+ca.r)*0.5,oa.g=(na.g+ca.g)*0.5,oa.b=(na.b+ca.b)*0.5,ga=Sa(ia,na,ca,oa),Ga(R,T,$,k,K,da,ga,
|
|
|
|
+0,0,1,0,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),C.r=Math.max(0,Math.min(n.color.r*ua.r,1)),C.g=Math.max(0,Math.min(n.color.g*ua.g,1)),C.b=Math.max(0,Math.min(n.color.b*ua.b,1)),C.updateHex(),n.wireframe?Ja(C,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(C)):n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color);else if(n instanceof THREE.MeshDepthMaterial)L=j.near,V=j.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,
|
|
|
|
+L,V),na.r=na.g=na.b=1-Na(f.positionScreen.z,L,V),ca.r=ca.g=ca.b=1-Na(g.positionScreen.z,L,V),oa.r=(na.r+ca.r)*0.5,oa.g=(na.g+ca.g)*0.5,oa.b=(na.b+ca.b)*0.5,ga=Sa(ia,na,ca,oa),Ga(R,T,$,k,K,da,ga,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)C.r=Qa(ma.normalWorld.x),C.g=Qa(ma.normalWorld.y),C.b=Qa(ma.normalWorld.z),C.updateHex(),n.wireframe?Ja(C,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(C)}function w(b,f,g,m,p,t,ma,n,u){h.data.vertices+=4;h.data.faces++;c(n.opacity);
|
|
|
|
+e(n.blending);if(n.map||n.envMap)B(b,f,m,0,1,3,ma,n,u),B(p,g,t,1,2,3,ma,n,u);else if(R=b.positionScreen.x,T=b.positionScreen.y,$=f.positionScreen.x,k=f.positionScreen.y,K=g.positionScreen.x,da=g.positionScreen.y,Z=m.positionScreen.x,aa=m.positionScreen.y,ha=p.positionScreen.x,la=p.positionScreen.y,ea=t.positionScreen.x,fa=t.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(R,T,$,k,K,da,Z,aa),n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color);else if(n instanceof
|
|
|
|
+THREE.MeshLambertMaterial)ta?!n.wireframe&&n.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==4?(ia.r=na.r=ca.r=oa.r=wa.r,ia.g=na.g=ca.g=oa.g=wa.g,ia.b=na.b=ca.b=oa.b=wa.b,o(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ia),o(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],na),o(u,ma.v4.positionWorld,ma.vertexNormalsWorld[3],ca),o(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],oa),ga=Sa(ia,na,ca,oa),A(R,T,$,k,Z,aa),Ga(R,T,$,k,Z,aa,ga,0,0,1,0,0,1),A(ha,la,K,da,ea,fa),Ga(ha,la,K,da,ea,fa,
|
|
|
|
+ga,1,0,1,1,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,o(u,ma.centroidWorld,ma.normalWorld,ua),C.r=Math.max(0,Math.min(n.color.r*ua.r,1)),C.g=Math.max(0,Math.min(n.color.g*ua.g,1)),C.b=Math.max(0,Math.min(n.color.b*ua.b,1)),C.updateHex(),I(R,T,$,k,K,da,Z,aa),n.wireframe?Ja(C,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(C)):(I(R,T,$,k,K,da,Z,aa),n.wireframe?Ja(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(n.color));else if(n instanceof THREE.MeshNormalMaterial)C.r=
|
|
|
|
+Qa(ma.normalWorld.x),C.g=Qa(ma.normalWorld.y),C.b=Qa(ma.normalWorld.z),C.updateHex(),I(R,T,$,k,K,da,Z,aa),n.wireframe?Ja(C,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):J(C);else if(n instanceof THREE.MeshDepthMaterial)L=j.near,V=j.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,L,V),na.r=na.g=na.b=1-Na(f.positionScreen.z,L,V),ca.r=ca.g=ca.b=1-Na(m.positionScreen.z,L,V),oa.r=oa.g=oa.b=1-Na(g.positionScreen.z,L,V),ga=Sa(ia,na,ca,oa),A(R,T,$,k,Z,aa),Ga(R,T,$,k,Z,aa,ga,0,0,1,0,0,1),A(ha,la,
|
|
|
|
+K,da,ea,fa),Ga(ha,la,K,da,ea,fa,ga,1,0,1,1,0,1)}function A(b,e,c,f,h,g){y.beginPath();y.moveTo(b,e);y.lineTo(c,f);y.lineTo(h,g);y.lineTo(b,e);y.closePath()}function I(b,e,c,f,h,g,k,j){y.beginPath();y.moveTo(b,e);y.lineTo(c,f);y.lineTo(h,g);y.lineTo(k,j);y.lineTo(b,e);y.closePath()}function Ja(b,e,c,h){if(F!=e)y.lineWidth=F=e;if(E!=c)y.lineCap=E=c;if(X!=h)y.lineJoin=X=h;f(b);y.stroke();qa.inflate(e*2)}function J(b){g(b);y.fill()}function Ga(b,e,c,f,h,g,k,j,m,p,n,t,ma){var o,u;o=k.width-1;u=k.height-
|
|
1;j*=o;m*=u;p*=o;n*=u;t*=o;ma*=u;c-=b;f-=e;h-=b;g-=e;p-=j;n-=m;t-=j;ma-=m;o=p*ma-t*n;if(!((o<0?-o:o)<1))u=1/o,o=(ma*c-n*h)*u,n=(ma*f-n*g)*u,c=(p*h-t*c)*u,f=(p*g-t*f)*u,b=b-o*j-c*m,e=e-n*j-f*m,y.save(),y.transform(o,n,c,f,b,e),y.clip(),y.drawImage(k,0,0),y.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);va[0]=h<0?0:h>255?255:h;va[1]=g<0?0:g>255?
|
|
1;j*=o;m*=u;p*=o;n*=u;t*=o;ma*=u;c-=b;f-=e;h-=b;g-=e;p-=j;n-=m;t-=j;ma-=m;o=p*ma-t*n;if(!((o<0?-o:o)<1))u=1/o,o=(ma*c-n*h)*u,n=(ma*f-n*g)*u,c=(p*h-t*c)*u,f=(p*g-t*f)*u,b=b-o*j-c*m,e=e-n*j-f*m,y.save(),y.transform(o,n,c,f,b,e),y.clip(),y.drawImage(k,0,0),y.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);va[0]=h<0?0:h>255?255:h;va[1]=g<0?0:g>255?
|
|
-255:g;va[2]=b<0?0:b>255?255:b;va[4]=k<0?0:k>255?255:k;va[5]=j<0?0:j>255?255:j;va[6]=e<0?0:e>255?255:e;va[8]=m<0?0:m>255?255:m;va[9]=p<0?0:p>255?255:p;va[10]=c<0?0:c>255?255:c;va[12]=n<0?0:n>255?255:n;va[13]=t<0?0:t>255?255:t;va[14]=f<0?0:f>255?255:f;Y.putImageData(R,0,0);za.drawImage(Ea,0,0);return T}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+=f,
|
|
|
|
-b.x-=c,b.y-=f)}var Ta,Va,oa,Ca,La,Ra,Ua,E;this.autoClear?this.clear():y.setTransform(1,0,0,-1,v,u);h.data.vertices=0;h.data.faces=0;m=p.projectScene(b,j,this.sortElements);(ta=b.lights.length>0)&&t(b);Ta=0;for(Va=m.length;Ta<Va;Ta++){oa=m[Ta];qa.empty();if(oa instanceof THREE.RenderableParticle){G=oa;G.x*=v;G.y*=u;Ca=0;for(La=oa.materials.length;Ca<La;)E=oa.materials[Ca++],E.opacity!=0&&n(G,oa,E,b)}else if(oa instanceof THREE.RenderableLine){if(G=oa.v1,H=oa.v2,G.positionScreen.x*=v,G.positionScreen.y*=
|
|
|
|
-u,H.positionScreen.x*=v,H.positionScreen.y*=u,qa.addPoint(G.positionScreen.x,G.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),W.instersects(qa)){Ca=0;for(La=oa.materials.length;Ca<La;)E=oa.materials[Ca++],E.opacity!=0&&x(G,H,oa,E,b)}}else if(oa instanceof THREE.RenderableFace3){if(G=oa.v1,H=oa.v2,L=oa.v3,G.positionScreen.x*=v,G.positionScreen.y*=u,H.positionScreen.x*=v,H.positionScreen.y*=u,L.positionScreen.x*=v,L.positionScreen.y*=u,oa.overdraw&&(Ka(G.positionScreen,H.positionScreen),
|
|
|
|
-Ka(H.positionScreen,L.positionScreen),Ka(L.positionScreen,G.positionScreen)),qa.add3Points(G.positionScreen.x,G.positionScreen.y,H.positionScreen.x,H.positionScreen.y,L.positionScreen.x,L.positionScreen.y),W.instersects(qa)){Ca=0;for(La=oa.meshMaterials.length;Ca<La;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=oa.faceMaterials.length;Ra<Ua;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&C(G,H,L,0,1,2,oa,E,b)}else E.opacity!=0&&C(G,H,L,0,1,2,oa,E,b)}}else if(oa instanceof
|
|
|
|
-THREE.RenderableFace4&&(G=oa.v1,H=oa.v2,L=oa.v3,O=oa.v4,G.positionScreen.x*=v,G.positionScreen.y*=u,H.positionScreen.x*=v,H.positionScreen.y*=u,L.positionScreen.x*=v,L.positionScreen.y*=u,O.positionScreen.x*=v,O.positionScreen.y*=u,P.positionScreen.copy(H.positionScreen),N.positionScreen.copy(O.positionScreen),oa.overdraw&&(Ka(G.positionScreen,H.positionScreen),Ka(H.positionScreen,O.positionScreen),Ka(O.positionScreen,G.positionScreen),Ka(L.positionScreen,P.positionScreen),Ka(L.positionScreen,N.positionScreen)),
|
|
|
|
-qa.addPoint(G.positionScreen.x,G.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),qa.addPoint(L.positionScreen.x,L.positionScreen.y),qa.addPoint(O.positionScreen.x,O.positionScreen.y),W.instersects(qa))){Ca=0;for(La=oa.meshMaterials.length;Ca<La;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=oa.faceMaterials.length;Ra<Ua;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&w(G,H,L,O,P,N,oa,E,b)}else E.opacity!=0&&w(G,H,L,O,P,N,oa,E,b)}ia.addRectangle(qa)}y.setTransform(1,
|
|
|
|
|
|
+255:g;va[2]=b<0?0:b>255?255:b;va[4]=k<0?0:k>255?255:k;va[5]=j<0?0:j>255?255:j;va[6]=e<0?0:e>255?255:e;va[8]=m<0?0:m>255?255:m;va[9]=p<0?0:p>255?255:p;va[10]=c<0?0:c>255?255:c;va[12]=n<0?0:n>255?255:n;va[13]=t<0?0:t>255?255:t;va[14]=f<0?0:f>255?255:f;Y.putImageData(S,0,0);za.drawImage(Ea,0,0);return U}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+=f,
|
|
|
|
+b.x-=c,b.y-=f)}var Ta,Va,pa,Ca,La,Ra,Ua,D;this.autoClear?this.clear():y.setTransform(1,0,0,-1,v,u);h.data.vertices=0;h.data.faces=0;m=p.projectScene(b,j,this.sortElements);(ta=b.lights.length>0)&&t(b);Ta=0;for(Va=m.length;Ta<Va;Ta++){pa=m[Ta];qa.empty();if(pa instanceof THREE.RenderableParticle){G=pa;G.x*=v;G.y*=u;Ca=0;for(La=pa.materials.length;Ca<La;)D=pa.materials[Ca++],D.opacity!=0&&n(G,pa,D,b)}else if(pa instanceof THREE.RenderableLine){if(G=pa.v1,H=pa.v2,G.positionScreen.x*=v,G.positionScreen.y*=
|
|
|
|
+u,H.positionScreen.x*=v,H.positionScreen.y*=u,qa.addPoint(G.positionScreen.x,G.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),W.instersects(qa)){Ca=0;for(La=pa.materials.length;Ca<La;)D=pa.materials[Ca++],D.opacity!=0&&x(G,H,pa,D,b)}}else if(pa instanceof THREE.RenderableFace3){if(G=pa.v1,H=pa.v2,M=pa.v3,G.positionScreen.x*=v,G.positionScreen.y*=u,H.positionScreen.x*=v,H.positionScreen.y*=u,M.positionScreen.x*=v,M.positionScreen.y*=u,pa.overdraw&&(Ka(G.positionScreen,H.positionScreen),
|
|
|
|
+Ka(H.positionScreen,M.positionScreen),Ka(M.positionScreen,G.positionScreen)),qa.add3Points(G.positionScreen.x,G.positionScreen.y,H.positionScreen.x,H.positionScreen.y,M.positionScreen.x,M.positionScreen.y),W.instersects(qa)){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(D=pa.meshMaterials[Ca++],D instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(D=pa.faceMaterials[Ra++])&&D.opacity!=0&&B(G,H,M,0,1,2,pa,D,b)}else D.opacity!=0&&B(G,H,M,0,1,2,pa,D,b)}}else if(pa instanceof
|
|
|
|
+THREE.RenderableFace4&&(G=pa.v1,H=pa.v2,M=pa.v3,P=pa.v4,G.positionScreen.x*=v,G.positionScreen.y*=u,H.positionScreen.x*=v,H.positionScreen.y*=u,M.positionScreen.x*=v,M.positionScreen.y*=u,P.positionScreen.x*=v,P.positionScreen.y*=u,Q.positionScreen.copy(H.positionScreen),O.positionScreen.copy(P.positionScreen),pa.overdraw&&(Ka(G.positionScreen,H.positionScreen),Ka(H.positionScreen,P.positionScreen),Ka(P.positionScreen,G.positionScreen),Ka(M.positionScreen,Q.positionScreen),Ka(M.positionScreen,O.positionScreen)),
|
|
|
|
+qa.addPoint(G.positionScreen.x,G.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),qa.addPoint(M.positionScreen.x,M.positionScreen.y),qa.addPoint(P.positionScreen.x,P.positionScreen.y),W.instersects(qa))){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(D=pa.meshMaterials[Ca++],D instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(D=pa.faceMaterials[Ra++])&&D.opacity!=0&&w(G,H,M,P,Q,O,pa,D,b)}else D.opacity!=0&&w(G,H,M,P,Q,O,pa,D,b)}ja.addRectangle(qa)}y.setTransform(1,
|
|
0,0,1,0,0)}};
|
|
0,0,1,0,0)}};
|
|
-THREE.SVGRenderer=function(){function b(b,e,c){var f,h,g,k;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(g.position)*g.intensity,k>0&&(c.r+=g.color.r*k,c.g+=g.color.g*k,c.b+=g.color.b*k)):g instanceof THREE.PointLight&&(O.sub(g.position,e.centroidWorld),O.normalize(),k=e.normalWorld.dot(O)*g.intensity,k>0&&(c.r+=g.color.r*k,c.g+=g.color.g*k,c.b+=g.color.b*k))}function c(e,c,k,m,p,n){h.data.vertices+=3;h.data.faces++;Q=f(S++);Q.setAttribute("d",
|
|
|
|
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?J?(A.r=X.r,A.g=X.g,A.b=X.b,b(n,m,A),F.r=Math.max(0,Math.min(p.color.r*A.r,1)),F.g=Math.max(0,Math.min(p.color.g*A.g,1)),F.b=Math.max(0,Math.min(p.color.b*A.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(L=1-p.__2near/(p.__farPlusNear-
|
|
|
|
-m.z*p.__farMinusNear),F.setRGB(L,L,L)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style","fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(Q)}function e(e,c,k,m,
|
|
|
|
-p,n,o){h.data.vertices+=4;h.data.faces++;Q=f(S++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?J?(A.r=X.r,A.g=X.g,A.b=X.b,b(o,p,A),F.r=Math.max(0,Math.min(n.color.r*A.r,1)),F.g=Math.max(0,Math.min(n.color.g*A.g,1)),F.b=Math.max(0,Math.min(n.color.b*
|
|
|
|
-A.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(L=1-n.__2near/(n.__farPlusNear-p.z*n.__farMinusNear),F.setRGB(L,L,L)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(p.normalWorld.x),g(p.normalWorld.y),g(p.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style",
|
|
|
|
-"fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+n.opacity);t.appendChild(Q)}function f(b){P[b]==null&&(P[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),k==0&&P[b].setAttribute("shape-rendering","crispEdges"));return P[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,p=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,n,v,u,y,w,C,x,I=new THREE.Rectangle,B=new THREE.Rectangle,J=
|
|
|
|
-!1,F=new THREE.Color(16777215),A=new THREE.Color(16777215),X=new THREE.Color(0),G=new THREE.Color(0),H=new THREE.Color(0),L,O=new THREE.Vector3,P=[],N=[],Q,S,$,k=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":k=1;break;case "low":k=0}};this.setSize=function(b,e){o=b;n=e;v=o/2;u=n/2;t.setAttribute("viewBox",-v+" "+-u+" "+o+" "+n);t.setAttribute("width",o);t.setAttribute("height",n);I.set(-v,-u,
|
|
|
|
-v,u)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var g,n,o,F,A,L,D,O;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=p.projectScene(b,f,this.sortElements);$=S=0;if(J=b.lights.length>0){D=b.lights;X.setRGB(0,0,0);G.setRGB(0,0,0);H.setRGB(0,0,0);g=0;for(n=D.length;g<n;g++)o=D[g],F=o.color,o instanceof THREE.AmbientLight?(X.r+=F.r,X.g+=F.g,X.b+=F.b):o instanceof THREE.DirectionalLight?(G.r+=F.r,G.g+=F.g,G.b+=F.b):o instanceof
|
|
|
|
-THREE.PointLight&&(H.r+=F.r,H.g+=F.g,H.b+=F.b)}g=0;for(n=m.length;g<n;g++)if(D=m[g],B.empty(),D instanceof THREE.RenderableParticle){y=D;y.x*=v;y.y*=-u;o=0;for(F=D.materials.length;o<F;)o++}else if(D instanceof THREE.RenderableLine){if(y=D.v1,w=D.v2,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,B.addPoint(y.positionScreen.x,y.positionScreen.y),B.addPoint(w.positionScreen.x,w.positionScreen.y),I.instersects(B)){o=0;for(F=D.materials.length;o<F;)if((O=D.materials[o++])&&
|
|
|
|
-O.opacity!=0){A=y;L=w;var P=$++;N[P]==null&&(N[P]=document.createElementNS("http://www.w3.org/2000/svg","line"),k==0&&N[P].setAttribute("shape-rendering","crispEdges"));Q=N[P];Q.setAttribute("x1",A.positionScreen.x);Q.setAttribute("y1",A.positionScreen.y);Q.setAttribute("x2",L.positionScreen.x);Q.setAttribute("y2",L.positionScreen.y);O instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+j(O.color.hex.toString(16))+"; stroke-width: "+O.linewidth+"; stroke-opacity: "+
|
|
|
|
-O.opacity+"; stroke-linecap: "+O.linecap+"; stroke-linejoin: "+O.linejoin),t.appendChild(Q))}}}else if(D instanceof THREE.RenderableFace3){if(y=D.v1,w=D.v2,C=D.v3,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,C.positionScreen.x*=v,C.positionScreen.y*=-u,B.addPoint(y.positionScreen.x,y.positionScreen.y),B.addPoint(w.positionScreen.x,w.positionScreen.y),B.addPoint(C.positionScreen.x,C.positionScreen.y),I.instersects(B)){o=0;for(F=D.meshMaterials.length;o<
|
|
|
|
-F;)if(O=D.meshMaterials[o++],O instanceof THREE.MeshFaceMaterial){A=0;for(L=D.faceMaterials.length;A<L;)(O=D.faceMaterials[A++])&&O.opacity!=0&&c(y,w,C,D,O,b)}else O&&O.opacity!=0&&c(y,w,C,D,O,b)}}else if(D instanceof THREE.RenderableFace4&&(y=D.v1,w=D.v2,C=D.v3,x=D.v4,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,C.positionScreen.x*=v,C.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,B.addPoint(y.positionScreen.x,y.positionScreen.y),B.addPoint(w.positionScreen.x,
|
|
|
|
-w.positionScreen.y),B.addPoint(C.positionScreen.x,C.positionScreen.y),B.addPoint(x.positionScreen.x,x.positionScreen.y),I.instersects(B))){o=0;for(F=D.meshMaterials.length;o<F;)if(O=D.meshMaterials[o++],O instanceof THREE.MeshFaceMaterial){A=0;for(L=D.faceMaterials.length;A<L;)(O=D.faceMaterials[A++])&&O.opacity!=0&&e(y,w,C,x,D,O,b)}else O&&O.opacity!=0&&e(y,w,C,x,D,O,b)}}};
|
|
|
|
|
|
+THREE.SVGRenderer=function(){function b(b,e,c){var f,h,g,k;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(g.position)*g.intensity,k>0&&(c.r+=g.color.r*k,c.g+=g.color.g*k,c.b+=g.color.b*k)):g instanceof THREE.PointLight&&(P.sub(g.position,e.centroidWorld),P.normalize(),k=e.normalWorld.dot(P)*g.intensity,k>0&&(c.r+=g.color.r*k,c.g+=g.color.g*k,c.b+=g.color.b*k))}function c(e,c,k,m,p,n){h.data.vertices+=3;h.data.faces++;R=f(T++);R.setAttribute("d",
|
|
|
|
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?J?(E.r=X.r,E.g=X.g,E.b=X.b,b(n,m,E),F.r=Math.max(0,Math.min(p.color.r*E.r,1)),F.g=Math.max(0,Math.min(p.color.g*E.g,1)),F.b=Math.max(0,Math.min(p.color.b*E.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(M=1-p.__2near/(p.__farPlusNear-
|
|
|
|
+m.z*p.__farMinusNear),F.setRGB(M,M,M)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style","fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(R)}function e(e,c,k,m,
|
|
|
|
+p,n,o){h.data.vertices+=4;h.data.faces++;R=f(T++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?J?(E.r=X.r,E.g=X.g,E.b=X.b,b(o,p,E),F.r=Math.max(0,Math.min(n.color.r*E.r,1)),F.g=Math.max(0,Math.min(n.color.g*E.g,1)),F.b=Math.max(0,Math.min(n.color.b*
|
|
|
|
+E.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(M=1-n.__2near/(n.__farPlusNear-p.z*n.__farMinusNear),F.setRGB(M,M,M)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(p.normalWorld.x),g(p.normalWorld.y),g(p.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: #"+j(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style",
|
|
|
|
+"fill: #"+j(F.hex.toString(16))+"; fill-opacity: "+n.opacity);t.appendChild(R)}function f(b){Q[b]==null&&(Q[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),k==0&&Q[b].setAttribute("shape-rendering","crispEdges"));return Q[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,p=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,n,v,u,y,w,B,x,I=new THREE.Rectangle,A=new THREE.Rectangle,J=
|
|
|
|
+!1,F=new THREE.Color(16777215),E=new THREE.Color(16777215),X=new THREE.Color(0),G=new THREE.Color(0),H=new THREE.Color(0),M,P=new THREE.Vector3,Q=[],O=[],R,T,$,k=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":k=1;break;case "low":k=0}};this.setSize=function(b,e){o=b;n=e;v=o/2;u=n/2;t.setAttribute("viewBox",-v+" "+-u+" "+o+" "+n);t.setAttribute("width",o);t.setAttribute("height",n);I.set(-v,-u,
|
|
|
|
+v,u)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var g,n,o,F,E,M,C,P;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=p.projectScene(b,f,this.sortElements);$=T=0;if(J=b.lights.length>0){C=b.lights;X.setRGB(0,0,0);G.setRGB(0,0,0);H.setRGB(0,0,0);g=0;for(n=C.length;g<n;g++)o=C[g],F=o.color,o instanceof THREE.AmbientLight?(X.r+=F.r,X.g+=F.g,X.b+=F.b):o instanceof THREE.DirectionalLight?(G.r+=F.r,G.g+=F.g,G.b+=F.b):o instanceof
|
|
|
|
+THREE.PointLight&&(H.r+=F.r,H.g+=F.g,H.b+=F.b)}g=0;for(n=m.length;g<n;g++)if(C=m[g],A.empty(),C instanceof THREE.RenderableParticle){y=C;y.x*=v;y.y*=-u;o=0;for(F=C.materials.length;o<F;)o++}else if(C instanceof THREE.RenderableLine){if(y=C.v1,w=C.v2,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,A.addPoint(y.positionScreen.x,y.positionScreen.y),A.addPoint(w.positionScreen.x,w.positionScreen.y),I.instersects(A)){o=0;for(F=C.materials.length;o<F;)if((P=C.materials[o++])&&
|
|
|
|
+P.opacity!=0){E=y;M=w;var Q=$++;O[Q]==null&&(O[Q]=document.createElementNS("http://www.w3.org/2000/svg","line"),k==0&&O[Q].setAttribute("shape-rendering","crispEdges"));R=O[Q];R.setAttribute("x1",E.positionScreen.x);R.setAttribute("y1",E.positionScreen.y);R.setAttribute("x2",M.positionScreen.x);R.setAttribute("y2",M.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: ##"+j(P.color.hex.toString(16))+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+
|
|
|
|
+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),t.appendChild(R))}}}else if(C instanceof THREE.RenderableFace3){if(y=C.v1,w=C.v2,B=C.v3,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,B.positionScreen.x*=v,B.positionScreen.y*=-u,A.addPoint(y.positionScreen.x,y.positionScreen.y),A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),I.instersects(A)){o=0;for(F=C.meshMaterials.length;o<
|
|
|
|
+F;)if(P=C.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){E=0;for(M=C.faceMaterials.length;E<M;)(P=C.faceMaterials[E++])&&P.opacity!=0&&c(y,w,B,C,P,b)}else P&&P.opacity!=0&&c(y,w,B,C,P,b)}}else if(C instanceof THREE.RenderableFace4&&(y=C.v1,w=C.v2,B=C.v3,x=C.v4,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,B.positionScreen.x*=v,B.positionScreen.y*=-u,x.positionScreen.x*=v,x.positionScreen.y*=-u,A.addPoint(y.positionScreen.x,y.positionScreen.y),A.addPoint(w.positionScreen.x,
|
|
|
|
+w.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),I.instersects(A))){o=0;for(F=C.meshMaterials.length;o<F;)if(P=C.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){E=0;for(M=C.faceMaterials.length;E<M;)(P=C.faceMaterials[E++])&&P.opacity!=0&&e(y,w,B,x,C,P,b)}else P&&P.opacity!=0&&e(y,w,B,x,C,P,b)}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform 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_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",
|
|
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",
|
|
@@ -225,20 +225,20 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
|
|
THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",
|
|
vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
|
|
vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
|
|
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,h,g,j=b.vertices,m=j.length,p=b.colors,n=p.length,t=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,y=b.__dirtyColors,x=b.__webglCustomAttributes,C,w;if(x)for(C in x)x[C].offset=0;if(c.sortParticles){ka.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=j[f].position,Aa.copy(h),ka.multiplyVector3(Aa),u[f]=[Aa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=j[u[f][1]].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;
|
|
|
|
-for(f=0;f<n;f++)g=f*3,color=p[u[f][1]],o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(x)for(C in x){f=x[C];p=f.value.length;for(g=0;g<p;g++){index=u[g][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[index];f.size===2?(f.array[n]=w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=
|
|
|
|
-w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)h=j[f].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;if(y)for(f=0;f<n;f++)color=p[f],g=f*3,o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(x)for(C in x)if(f=x[C],f.__original.needsUpdate){p=f.value.length;for(g=0;g<p;g++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[g];f.size===2?(f.array[n]=
|
|
|
|
-w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(y||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(x)for(C in x)if(f=x[C],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,h,g,j=b.vertices,m=j.length,p=b.colors,n=p.length,t=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,y=b.__dirtyColors,x=b.__webglCustomAttributes,B,w;if(x)for(B in x)x[B].offset=0;if(c.sortParticles){ka.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=j[f].position,Aa.copy(h),ka.multiplyVector3(Aa),u[f]=[Aa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=j[u[f][1]].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;
|
|
|
|
+for(f=0;f<n;f++)g=f*3,color=p[u[f][1]],o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(x)for(B in x){f=x[B];p=f.value.length;for(g=0;g<p;g++){index=u[g][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[index];f.size===2?(f.array[n]=w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=
|
|
|
|
+w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)h=j[f].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;if(y)for(f=0;f<n;f++)color=p[f],g=f*3,o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b;if(x)for(B in x)if(f=x[B],f.__original.needsUpdate){p=f.value.length;for(g=0;g<p;g++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[g];f.size===2?(f.array[n]=
|
|
|
|
+w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(y||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(x)for(B in x)if(f=x[B],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||$.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array($.maxMorphTargets);for(var h=0,j=this.maxMorphTargets;h<j;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,m=f.uniforms;h!=da&&(k.useProgram(h),da=h);k.uniformMatrix4fv(j.projectionMatrix,!1,sa);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||$.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array($.maxMorphTargets);for(var h=0,j=this.maxMorphTargets;h<j;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,m=f.uniforms;h!=da&&(k.useProgram(h),da=h);k.uniformMatrix4fv(j.projectionMatrix,!1,sa);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,p,t,o=0,u=0,v=0,y,x,w,C=Ia,B=C.directional.colors,F=C.directional.positions,G=C.point.colors,I=C.point.positions,A=C.point.distances,
|
|
|
|
-V=0,E=0,c=p=w=0;for(n=e.length;c<n;c++)if(p=e[c],t=p.color,y=p.position,x=p.intensity,w=p.distance,p instanceof THREE.AmbientLight)o+=t.r,u+=t.g,v+=t.b;else if(p instanceof THREE.DirectionalLight)w=V*3,B[w]=t.r*x,B[w+1]=t.g*x,B[w+2]=t.b*x,F[w]=y.x,F[w+1]=y.y,F[w+2]=y.z,V+=1;else if(p instanceof THREE.SpotLight)w=V*3,B[w]=t.r*x,B[w+1]=t.g*x,B[w+2]=t.b*x,t=1/y.length(),F[w]=y.x*t,F[w+1]=y.y*t,F[w+2]=y.z*t,V+=1;else if(p instanceof THREE.PointLight)p=E*3,G[p]=t.r*x,G[p+1]=t.g*x,G[p+2]=t.b*x,I[p]=y.x,
|
|
|
|
-I[p+1]=y.y,I[p+2]=y.z,A[E]=w,E+=1;for(c=V*3;c<B.length;c++)B[c]=0;for(c=E*3;c<G.length;c++)G[c]=0;C.point.length=E;C.directional.length=V;C.ambient[0]=o;C.ambient[1]=u;C.ambient[2]=v;c=Ia;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
|
|
|
|
|
|
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,p,t,o=0,u=0,v=0,y,x,w,B=Ia,A=B.directional.colors,F=B.directional.positions,G=B.point.colors,I=B.point.positions,E=B.point.distances,
|
|
|
|
+L=0,D=0,c=p=w=0;for(n=e.length;c<n;c++)if(p=e[c],t=p.color,y=p.position,x=p.intensity,w=p.distance,p instanceof THREE.AmbientLight)o+=t.r,u+=t.g,v+=t.b;else if(p instanceof THREE.DirectionalLight)w=L*3,A[w]=t.r*x,A[w+1]=t.g*x,A[w+2]=t.b*x,F[w]=y.x,F[w+1]=y.y,F[w+2]=y.z,L+=1;else if(p instanceof THREE.SpotLight)w=L*3,A[w]=t.r*x,A[w+1]=t.g*x,A[w+2]=t.b*x,t=1/y.length(),F[w]=y.x*t,F[w+1]=y.y*t,F[w+2]=y.z*t,L+=1;else if(p instanceof THREE.PointLight)p=D*3,G[p]=t.r*x,G[p+1]=t.g*x,G[p+2]=t.b*x,I[p]=y.x,
|
|
|
|
+I[p+1]=y.y,I[p+2]=y.z,E[D]=w,D+=1;for(c=L*3;c<A.length;c++)A[c]=0;for(c=D*3;c<G.length;c++)G[c]=0;B.point.length=D;B.directional.length=L;B.ambient[0]=o;B.ambient[1]=u;B.ambient[2]=v;c=Ia;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=Ba.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=Ba.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=
|
|
f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ua.length;c++)m.shadowMatrix.value[c]=ua[c],m.shadowMap.texture[c]=$.shadowMap[c];m.shadowDarkness.value=$.shadowMapDarkness;m.shadowBias.value=$.shadowMapBias}for(var J in m)if(o=h.uniforms[J])if(n=m[J],u=n.type,c=n.value,u=="i")k.uniform1i(o,c);else if(u=="f")k.uniform1f(o,c);else if(u=="fv1")k.uniform1fv(o,c);else if(u=="fv")k.uniform3fv(o,c);else if(u==
|
|
f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ua.length;c++)m.shadowMatrix.value[c]=ua[c],m.shadowMap.texture[c]=$.shadowMap[c];m.shadowDarkness.value=$.shadowMapDarkness;m.shadowBias.value=$.shadowMapBias}for(var J in m)if(o=h.uniforms[J])if(n=m[J],u=n.type,c=n.value,u=="i")k.uniform1i(o,c);else if(u=="f")k.uniform1f(o,c);else if(u=="fv1")k.uniform1fv(o,c);else if(u=="fv")k.uniform3fv(o,c);else if(u==
|
|
"v2")k.uniform2f(o,c.x,c.y);else if(u=="v3")k.uniform3f(o,c.x,c.y,c.z);else if(u=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!n._array)n._array=new Float32Array(16);c.flattenToArray(n._array);k.uniformMatrix4fv(o,!1,n._array)}else if(u=="m4v"){if(!n._array)n._array=new Float32Array(16*c.length);u=0;for(v=c.length;u<v;u++)c[u].flattenToArrayOffset(n._array,u*16);k.uniformMatrix4fv(o,!1,n._array)}else if(u=="c")k.uniform3f(o,c.r,c.g,c.b);else if(u=="t"){if(k.uniform1i(o,c),o=n.texture)if(o.image instanceof
|
|
"v2")k.uniform2f(o,c.x,c.y);else if(u=="v3")k.uniform3f(o,c.x,c.y,c.z);else if(u=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!n._array)n._array=new Float32Array(16);c.flattenToArray(n._array);k.uniformMatrix4fv(o,!1,n._array)}else if(u=="m4v"){if(!n._array)n._array=new Float32Array(16*c.length);u=0;for(v=c.length;u<v;u++)c[u].flattenToArrayOffset(n._array,u*16);k.uniformMatrix4fv(o,!1,n._array)}else if(u=="c")k.uniform3f(o,c.r,c.g,c.b);else if(u=="t"){if(k.uniform1i(o,c),o=n.texture)if(o.image instanceof
|
|
-Array&&o.image.length==6){if(n=o,n.image.length==6){if(n.needsUpdate){if(n.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,k.RGBA,k.UNSIGNED_BYTE,n.image[o])}else{n.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[o]);n.__webglInit=!0}L(k.TEXTURE_CUBE_MAP,
|
|
|
|
-n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else O(o,c)}else if(u=="tv"){if(!n._array){n._array=[];u=0;for(v=n.texture.length;u<v;u++)n._array[u]=c+u}k.uniform1iv(o,n._array);u=0;for(v=n.texture.length;u<v;u++)(o=n.texture[u])&&O(o,n._array[u])}k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
|
|
|
|
+Array&&o.image.length==6){if(n=o,n.image.length==6){if(n.needsUpdate){if(n.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,k.RGBA,k.UNSIGNED_BYTE,n.image[o])}else{n.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[o]);n.__webglInit=!0}M(k.TEXTURE_CUBE_MAP,
|
|
|
|
+n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else P(o,c)}else if(u=="tv"){if(!n._array){n._array=[];u=0;for(v=n.texture.length;u<v;u++)n._array[u]=c+u}k.uniform1iv(o,n._array);u=0;for(v=n.texture.length;u<v;u++)(o=n.texture[u])&&P(o,n._array[u])}k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,xa);if(f instanceof
|
|
f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,xa);if(f instanceof
|
|
THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,xa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,xa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&
|
|
THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,xa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,xa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&
|
|
b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,n=j.morphTargetForcedOrder,
|
|
b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,n=j.morphTargetForcedOrder,
|
|
@@ -250,106 +250,106 @@ k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):
|
|
3,$.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),$.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),$.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),$.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
|
|
3,$.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),$.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),$.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),$.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
|
|
k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,n,p,t,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],j=c[u+3],n=c[u+4],t=c[u+5],m=c[u+6],p=c[u+7],o=c[u+8],f=(f+j+m)/
|
|
k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,n,p,t,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],j=c[u+3],n=c[u+4],t=c[u+5],m=c[u+6],p=c[u+7],o=c[u+8],f=(f+j+m)/
|
|
3,h=(h+n+p)/3,g=(g+t+o)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(ha!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ha=b.doubleSided;if(la!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),la=b.flipSided}
|
|
3,h=(h+n+p)/3,g=(g+t+o)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(ha!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ha=b.doubleSided;if(la!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),la=b.flipSided}
|
|
-function h(b){pa!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),pa=b)}function m(b,e,c){D!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),D=b);if(b&&(ea!=e||ca!=c))k.polygonOffset(e,c),ea=e,ca=c}function p(b){ga[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ga[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ga[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ga[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ga[4].set(b.n41-b.n31,b.n42-
|
|
|
|
|
|
+function h(b){fa!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),fa=b)}function m(b,e,c){C!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),C=b);if(b&&(ia!=e||na!=c))k.polygonOffset(e,c),ia=e,na=c}function p(b){ga[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ga[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ga[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ga[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ga[4].set(b.n41-b.n31,b.n42-
|
|
b.n32,b.n43-b.n33,b.n44-b.n34);ga[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ga[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function t(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ga[f].x*e.n14+ga[f].y*e.n24+ga[f].z*e.n34+ga[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function n(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=
|
|
b.n32,b.n43-b.n33,b.n44-b.n34);ga[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ga[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function t(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ga[f].x*e.n14+ga[f].y*e.n24+ga[f].z*e.n34+ga[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function n(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=
|
|
-h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function u(b,e){return e.z-b.z}function y(b,c){var m,n,o,u=0,v,y,x,w,C=b.lights;ta||(ta=new THREE.Camera($.shadowCameraFov,
|
|
|
|
-c.aspect,$.shadowCameraNear,$.shadowCameraFar));m=0;for(n=C.length;m<n;m++)if(o=C[m],o instanceof THREE.SpotLight&&o.castShadow){$.shadowMap[u]||($.shadowMap[u]=new THREE.WebGLRenderTarget($.shadowMapWidth,$.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ua[u]||(ua[u]=new THREE.Matrix4);v=$.shadowMap[u];y=ua[u];ta.position.copy(o.position);ta.target.position.copy(o.target.position);ta.update(void 0,!0);b.update(void 0,!1,ta);y.set(0.5,0,0,0.5,
|
|
|
|
-0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ta.projectionMatrix);y.multiplySelf(ta.matrixWorldInverse);ta.matrixWorldInverse.flattenToArray(xa);ta.projectionMatrix.flattenToArray(sa);ka.multiply(ta.projectionMatrix,ta.matrixWorldInverse);p(ka);$.initWebGLObjects(b);P(v);k.clearColor(1,1,1,1);$.clear();k.clearColor(ia.r,ia.g,ia.b,qa);y=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<y;v++)x=b.__webglObjects[v],w=x.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||
|
|
|
|
-t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),I(w,ta,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);H(THREE.NormalBlending);for(v=0;v<y;v++)if(x=b.__webglObjects[v],x.render)w=x.object,buffer=x.buffer,j(w),x=w.geometry.morphTargets.length?ya:Da,f(ta,C,null,x,buffer,w);for(v=0;v<o;v++)x=b.__webglObjectsImmediate[v],w=x.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),I(w,ta,!1),j(w),program=e(ta,C,null,Da,w),w.render(function(b){g(b,
|
|
|
|
|
|
+h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function u(b,e){return e.z-b.z}function y(b,c){var m,n,o,u=0,v,y,x,w,B=b.lights;ta||(ta=new THREE.Camera($.shadowCameraFov,
|
|
|
|
+c.aspect,$.shadowCameraNear,$.shadowCameraFar));m=0;for(n=B.length;m<n;m++)if(o=B[m],o instanceof THREE.SpotLight&&o.castShadow){$.shadowMap[u]||($.shadowMap[u]=new THREE.WebGLRenderTarget($.shadowMapWidth,$.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ua[u]||(ua[u]=new THREE.Matrix4);v=$.shadowMap[u];y=ua[u];ta.position.copy(o.position);ta.target.position.copy(o.target.position);ta.update(void 0,!0);b.update(void 0,!1,ta);y.set(0.5,0,0,0.5,
|
|
|
|
+0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ta.projectionMatrix);y.multiplySelf(ta.matrixWorldInverse);ta.matrixWorldInverse.flattenToArray(xa);ta.projectionMatrix.flattenToArray(sa);ka.multiply(ta.projectionMatrix,ta.matrixWorldInverse);p(ka);$.initWebGLObjects(b);Q(v);k.clearColor(1,1,1,1);$.clear();k.clearColor(ja.r,ja.g,ja.b,qa);y=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<y;v++)x=b.__webglObjects[v],w=x.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||
|
|
|
|
+t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),I(w,ta,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);H(THREE.NormalBlending);for(v=0;v<y;v++)if(x=b.__webglObjects[v],x.render)w=x.object,buffer=x.buffer,j(w),x=w.geometry.morphTargets.length?ya:Da,f(ta,B,null,x,buffer,w);for(v=0;v<o;v++)x=b.__webglObjectsImmediate[v],w=x.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),I(w,ta,!1),j(w),program=e(ta,B,null,Da,w),w.render(function(b){g(b,
|
|
program,Da.shading)}));u++}}function w(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,n,p,t,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;
|
|
program,Da.shading)}));u++}}function w(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,n,p,t,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;
|
|
g[1]=-f.position.y;g[2]=-f.position.z;for(t=0;t<o;t++)f=b.__webglShadowVolumes[t].object,j=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||$.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,da!==m&&(k.useProgram(m),da=m,k.uniformMatrix4fv(n.projectionMatrix,!1,sa),k.uniformMatrix4fv(n.viewMatrix,!1,xa),k.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,
|
|
g[1]=-f.position.y;g[2]=-f.position.z;for(t=0;t<o;t++)f=b.__webglShadowVolumes[t].object,j=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||$.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,da!==m&&(k.useProgram(m),da=m,k.uniformMatrix4fv(n.projectionMatrix,!1,sa),k.uniformMatrix4fv(n.viewMatrix,!1,xa),k.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,
|
|
j.__webglVertexBuffer),k.vertexAttribPointer(p.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(p.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,
|
|
j.__webglVertexBuffer),k.vertexAttribPointer(p.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(p.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,
|
|
-k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);pa=fa=-1;da=Y.program;k.useProgram(Y.program);k.uniformMatrix4fv(Y.projectionLocation,!1,sa);k.uniform1f(Y.darknessLocation,Y.darkness);k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.vertexAttribPointer(Y.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(Y.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);
|
|
|
|
-k.enable(k.DEPTH_TEST);k.depthMask(aa)}function C(b,e){var c,f,h;c=T.attributes;var g=T.uniforms,j=U/V,m,n=[],p=V*0.5,t=U*0.5,o=!0;k.useProgram(T.program);da=T.program;pa=fa=-1;za||(k.enableVertexAttribArray(T.attributes.position),k.enableVertexAttribArray(T.attributes.uv),za=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,T.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-T.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,sa);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?
|
|
|
|
-(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-p)/p,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?U:1),n[0]=m*j*h.scale.x,n[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,
|
|
|
|
-h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,n),h.mergeWith3D&&!o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),H(h.blending),O(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(aa)}function x(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,n=new THREE.Vector3,p=U/V,t=V*0.5,o=U*0.5,u=16/U,v=[u*p,u],y=[1,1,0],x=[1,1],w=R.uniforms;
|
|
|
|
-c=R.attributes;k.useProgram(R.program);da=R.program;pa=fa=-1;va||(k.enableVertexAttribArray(R.attributes.vertex),k.enableVertexAttribArray(R.attributes.uv),va=!0);k.uniform1i(w.occlusionMap,0);k.uniform1i(w.map,1);k.bindBuffer(k.ARRAY_BUFFER,R.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,R.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,
|
|
|
|
-R.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),y[0]=n.x,y[1]=n.y,y[2]=n.z,x[0]=y[0]*t+t,x[1]=y[1]*o+o,R.hasVertexTexture||x[0]>0&&x[0]<V&&x[1]>0&&x[1]<U){k.bindTexture(k.TEXTURE_2D,R.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,x[0]-8,x[1]-8,16,16,0);k.uniform1i(w.renderType,0);k.uniform2fv(w.scale,v);k.uniform3fv(w.screenPosition,
|
|
|
|
-y);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,R.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,x[0]-8,x[1]-8,16,16,0);k.uniform1i(w.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,R.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=y[0];c.positionScreen.y=y[1];c.positionScreen.z=y[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(w.renderType,
|
|
|
|
-2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)y[0]=m.x,y[1]=m.y,y[2]=m.z,u=m.size*m.scale/U,v[0]=u*p,v[1]=u,k.uniform3fv(w.screenPosition,y),k.uniform2fv(w.scale,v),k.uniform1f(w.rotation,m.rotation),k.uniform1f(w.opacity,m.opacity),H(m.blending),O(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(aa)}function I(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
|
|
|
|
-b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function J(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function F(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;
|
|
|
|
-for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=B(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,p=void 0,t=void 0,o=void 0,u=t=void 0,v=void 0,y=void 0,x=void 0,w=void 0,C=void 0,F=void 0,G=void 0,I=void 0,A=void 0,V=void 0,H=void 0,U=void 0,E=o=x=o=y=v=void 0,D=void 0,z=D=E=v=void 0,L=void 0,O=z=D=E=t=t=u=x=o=z=D=E=L=z=D=E=L=z=D=E=void 0,K=
|
|
|
|
-0,ga=0,aa=0,X=0,P=0,R=0,N=0,T=0,ka=0,M=0,Q=0,D=E=0,S=g.__vertexArray,$=g.__uvArray,da=g.__uv2Array,la=g.__normalArray,W=g.__tangentArray,Z=g.__colorArray,Y=g.__skinVertexAArray,fa=g.__skinVertexBArray,ea=g.__skinIndexArray,ca=g.__skinWeightArray,pa=g.__morphTargetsArrays,ja=g.__webglCustomAttributes,z=void 0,ha=g.__faceArray,sa=g.__lineArray,na=g.__needsSmoothNormals,C=g.__vertexColorType,w=g.__uvType,F=g.__normalType,ia=j.geometry,qa=ia.__dirtyVertices,ra=ia.__dirtyElements,xa=ia.__dirtyUvs,ta=ia.__dirtyNormals,
|
|
|
|
-ua=ia.__dirtyTangents,wa=ia.__dirtyColors,Aa=ia.__dirtyMorphTargets,va=ia.vertices,Ba=g.faces,Da=ia.faces,Ia=ia.faceVertexUvs[0],Ea=ia.faceVertexUvs[1],ya=ia.skinVerticesA,za=ia.skinVerticesB,Oa=ia.skinIndices,Ha=ia.skinWeights,Ma=j instanceof THREE.ShadowVolume?ia.edgeFaces:void 0,Fa=ia.morphTargets;if(ja)for(O in ja)ja[O].offset=0,ja[O].offsetSrc=0;n=0;for(p=Ba.length;n<p;n++)if(t=Ba[n],o=Da[t],Ia&&(G=Ia[t]),Ea&&(I=Ea[t]),t=o.vertexNormals,u=o.normal,v=o.vertexColors,y=o.color,x=o.vertexTangents,
|
|
|
|
-o instanceof THREE.Face3){if(qa)A=va[o.a].position,V=va[o.b].position,H=va[o.c].position,S[ga]=A.x,S[ga+1]=A.y,S[ga+2]=A.z,S[ga+3]=V.x,S[ga+4]=V.y,S[ga+5]=V.z,S[ga+6]=H.x,S[ga+7]=H.y,S[ga+8]=H.z,ga+=9;if(ja)for(O in ja)if(z=ja[O],z.__original.needsUpdate)E=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[E+0]=z.value[o.a],z.array[E+1]=z.value[o.b],z.array[E+2]=z.value[o.c]):z.boundTo==="faces"?(z.array[E+0]=z.value[D],z.array[E+1]=z.value[D],z.array[E+2]=z.value[D],
|
|
|
|
-z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[E+0]=z.value[D+0],z.array[E+1]=z.value[D+1],z.array[E+2]=z.value[D+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(A=z.value[o.a],V=z.value[o.b],H=z.value[o.c]):z.boundTo==="faces"?(A=z.value[D],V=z.value[D],H=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(A=z.value[D+0],V=z.value[D+1],H=z.value[D+2],z.offsetSrc+=3),z.size===2?(z.array[E+0]=A.x,z.array[E+1]=A.y,z.array[E+2]=V.x,z.array[E+3]=V.y,z.array[E+4]=H.x,
|
|
|
|
-z.array[E+5]=H.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[E+0]=A.r,z.array[E+1]=A.g,z.array[E+2]=A.b,z.array[E+3]=V.r,z.array[E+4]=V.g,z.array[E+5]=V.b,z.array[E+6]=H.r,z.array[E+7]=H.g,z.array[E+8]=H.b):(z.array[E+0]=A.x,z.array[E+1]=A.y,z.array[E+2]=A.z,z.array[E+3]=V.x,z.array[E+4]=V.y,z.array[E+5]=V.z,z.array[E+6]=H.x,z.array[E+7]=H.y,z.array[E+8]=H.z),z.offset+=9):(z.array[E+0]=A.x,z.array[E+1]=A.y,z.array[E+2]=A.z,z.array[E+3]=A.w,z.array[E+4]=V.x,z.array[E+5]=V.y,z.array[E+6]=V.z,z.array[E+
|
|
|
|
-7]=V.w,z.array[E+8]=H.x,z.array[E+9]=H.y,z.array[E+10]=H.z,z.array[E+11]=H.w,z.offset+=12));if(Aa){E=0;for(D=Fa.length;E<D;E++)A=Fa[E].vertices[o.a].position,V=Fa[E].vertices[o.b].position,H=Fa[E].vertices[o.c].position,z=pa[E],z[Q+0]=A.x,z[Q+1]=A.y,z[Q+2]=A.z,z[Q+3]=V.x,z[Q+4]=V.y,z[Q+5]=V.z,z[Q+6]=H.x,z[Q+7]=H.y,z[Q+8]=H.z;Q+=9}if(Ha.length)E=Ha[o.a],D=Ha[o.b],z=Ha[o.c],ca[M]=E.x,ca[M+1]=E.y,ca[M+2]=E.z,ca[M+3]=E.w,ca[M+4]=D.x,ca[M+5]=D.y,ca[M+6]=D.z,ca[M+7]=D.w,ca[M+8]=z.x,ca[M+9]=z.y,ca[M+10]=
|
|
|
|
-z.z,ca[M+11]=z.w,E=Oa[o.a],D=Oa[o.b],z=Oa[o.c],ea[M]=E.x,ea[M+1]=E.y,ea[M+2]=E.z,ea[M+3]=E.w,ea[M+4]=D.x,ea[M+5]=D.y,ea[M+6]=D.z,ea[M+7]=D.w,ea[M+8]=z.x,ea[M+9]=z.y,ea[M+10]=z.z,ea[M+11]=z.w,E=ya[o.a],D=ya[o.b],z=ya[o.c],Y[M]=E.x,Y[M+1]=E.y,Y[M+2]=E.z,Y[M+3]=1,Y[M+4]=D.x,Y[M+5]=D.y,Y[M+6]=D.z,Y[M+7]=1,Y[M+8]=z.x,Y[M+9]=z.y,Y[M+10]=z.z,Y[M+11]=1,E=za[o.a],D=za[o.b],z=za[o.c],fa[M]=E.x,fa[M+1]=E.y,fa[M+2]=E.z,fa[M+3]=1,fa[M+4]=D.x,fa[M+5]=D.y,fa[M+6]=D.z,fa[M+7]=1,fa[M+8]=z.x,fa[M+9]=z.y,fa[M+10]=z.z,
|
|
|
|
-fa[M+11]=1,M+=12;if(wa&&C)v.length==3&&C==THREE.VertexColors?(o=v[0],E=v[1],D=v[2]):D=E=o=y,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=E.r,Z[ka+4]=E.g,Z[ka+5]=E.b,Z[ka+6]=D.r,Z[ka+7]=D.g,Z[ka+8]=D.b,ka+=9;if(ua&&ia.hasTangents)v=x[0],y=x[1],o=x[2],W[N]=v.x,W[N+1]=v.y,W[N+2]=v.z,W[N+3]=v.w,W[N+4]=y.x,W[N+5]=y.y,W[N+6]=y.z,W[N+7]=y.w,W[N+8]=o.x,W[N+9]=o.y,W[N+10]=o.z,W[N+11]=o.w,N+=12;if(ta&&F)if(t.length==3&&na)for(x=0;x<3;x++)u=t[x],la[R]=u.x,la[R+1]=u.y,la[R+2]=u.z,R+=3;else for(x=0;x<3;x++)la[R]=
|
|
|
|
-u.x,la[R+1]=u.y,la[R+2]=u.z,R+=3;if(xa&&G!==void 0&&w)for(x=0;x<3;x++)t=G[x],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&I!==void 0&&w)for(x=0;x<3;x++)t=I[x],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ha[P]=K,ha[P+1]=K+1,ha[P+2]=K+2,P+=3,sa[T]=K,sa[T+1]=K+1,sa[T+2]=K,sa[T+3]=K+2,sa[T+4]=K+1,sa[T+5]=K+2,T+=6,K+=3)}else if(o instanceof THREE.Face4){if(qa)A=va[o.a].position,V=va[o.b].position,H=va[o.c].position,U=va[o.d].position,S[ga]=A.x,S[ga+1]=A.y,S[ga+2]=A.z,S[ga+3]=V.x,S[ga+4]=V.y,S[ga+5]=V.z,S[ga+6]=H.x,S[ga+7]=
|
|
|
|
-H.y,S[ga+8]=H.z,S[ga+9]=U.x,S[ga+10]=U.y,S[ga+11]=U.z,ga+=12;if(ja)for(O in ja)if(z=ja[O],z.__original.needsUpdate)E=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[E+0]=z.value[o.a],z.array[E+1]=z.value[o.b],z.array[E+2]=z.value[o.c],z.array[E+3]=z.value[o.d]):z.boundTo==="faces"?(z.array[E+0]=z.value[D],z.array[E+1]=z.value[D],z.array[E+2]=z.value[D],z.array[E+3]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[E+0]=z.value[D+0],z.array[E+1]=
|
|
|
|
-z.value[D+1],z.array[E+2]=z.value[D+2],z.array[E+3]=z.value[D+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(A=z.value[o.a],V=z.value[o.b],H=z.value[o.c],U=z.value[o.d]):z.boundTo==="faces"?(A=z.value[D],V=z.value[D],H=z.value[D],U=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(A=z.value[D+0],V=z.value[D+1],H=z.value[D+2],U=z.value[D+3],z.offsetSrc+=4),z.size===2?(z.array[E+0]=A.x,z.array[E+1]=A.y,z.array[E+2]=V.x,z.array[E+3]=V.y,z.array[E+4]=H.x,z.array[E+5]=
|
|
|
|
-H.y,z.array[E+6]=U.x,z.array[E+7]=U.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[E+0]=A.r,z.array[E+1]=A.g,z.array[E+2]=A.b,z.array[E+3]=V.r,z.array[E+4]=V.g,z.array[E+5]=V.b,z.array[E+6]=H.r,z.array[E+7]=H.g,z.array[E+8]=H.b,z.array[E+9]=U.r,z.array[E+10]=U.g,z.array[E+11]=U.b):(z.array[E+0]=A.x,z.array[E+1]=A.y,z.array[E+2]=A.z,z.array[E+3]=V.x,z.array[E+4]=V.y,z.array[E+5]=V.z,z.array[E+6]=H.x,z.array[E+7]=H.y,z.array[E+8]=H.z,z.array[E+9]=U.x,z.array[E+10]=U.y,z.array[E+11]=U.z),z.offset+=
|
|
|
|
-12):(z.array[E+0]=A.x,z.array[E+1]=A.y,z.array[E+2]=A.z,z.array[E+3]=A.w,z.array[E+4]=V.x,z.array[E+5]=V.y,z.array[E+6]=V.z,z.array[E+7]=V.w,z.array[E+8]=H.x,z.array[E+9]=H.y,z.array[E+10]=H.z,z.array[E+11]=H.w,z.array[E+12]=U.x,z.array[E+13]=U.y,z.array[E+14]=U.z,z.array[E+15]=U.w,z.offset+=16));if(Aa){E=0;for(D=Fa.length;E<D;E++)A=Fa[E].vertices[o.a].position,V=Fa[E].vertices[o.b].position,H=Fa[E].vertices[o.c].position,U=Fa[E].vertices[o.d].position,z=pa[E],z[Q+0]=A.x,z[Q+1]=A.y,z[Q+2]=A.z,z[Q+
|
|
|
|
-3]=V.x,z[Q+4]=V.y,z[Q+5]=V.z,z[Q+6]=H.x,z[Q+7]=H.y,z[Q+8]=H.z,z[Q+9]=U.x,z[Q+10]=U.y,z[Q+11]=U.z;Q+=12}if(Ha.length)E=Ha[o.a],D=Ha[o.b],z=Ha[o.c],L=Ha[o.d],ca[M]=E.x,ca[M+1]=E.y,ca[M+2]=E.z,ca[M+3]=E.w,ca[M+4]=D.x,ca[M+5]=D.y,ca[M+6]=D.z,ca[M+7]=D.w,ca[M+8]=z.x,ca[M+9]=z.y,ca[M+10]=z.z,ca[M+11]=z.w,ca[M+12]=L.x,ca[M+13]=L.y,ca[M+14]=L.z,ca[M+15]=L.w,E=Oa[o.a],D=Oa[o.b],z=Oa[o.c],L=Oa[o.d],ea[M]=E.x,ea[M+1]=E.y,ea[M+2]=E.z,ea[M+3]=E.w,ea[M+4]=D.x,ea[M+5]=D.y,ea[M+6]=D.z,ea[M+7]=D.w,ea[M+8]=z.x,ea[M+
|
|
|
|
-9]=z.y,ea[M+10]=z.z,ea[M+11]=z.w,ea[M+12]=L.x,ea[M+13]=L.y,ea[M+14]=L.z,ea[M+15]=L.w,E=ya[o.a],D=ya[o.b],z=ya[o.c],L=ya[o.d],Y[M]=E.x,Y[M+1]=E.y,Y[M+2]=E.z,Y[M+3]=1,Y[M+4]=D.x,Y[M+5]=D.y,Y[M+6]=D.z,Y[M+7]=1,Y[M+8]=z.x,Y[M+9]=z.y,Y[M+10]=z.z,Y[M+11]=1,Y[M+12]=L.x,Y[M+13]=L.y,Y[M+14]=L.z,Y[M+15]=1,E=za[o.a],D=za[o.b],z=za[o.c],o=za[o.d],fa[M]=E.x,fa[M+1]=E.y,fa[M+2]=E.z,fa[M+3]=1,fa[M+4]=D.x,fa[M+5]=D.y,fa[M+6]=D.z,fa[M+7]=1,fa[M+8]=z.x,fa[M+9]=z.y,fa[M+10]=z.z,fa[M+11]=1,fa[M+12]=o.x,fa[M+13]=o.y,
|
|
|
|
-fa[M+14]=o.z,fa[M+15]=1,M+=16;if(wa&&C)v.length==4&&C==THREE.VertexColors?(o=v[0],E=v[1],D=v[2],v=v[3]):v=D=E=o=y,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=E.r,Z[ka+4]=E.g,Z[ka+5]=E.b,Z[ka+6]=D.r,Z[ka+7]=D.g,Z[ka+8]=D.b,Z[ka+9]=v.r,Z[ka+10]=v.g,Z[ka+11]=v.b,ka+=12;if(ua&&ia.hasTangents)v=x[0],y=x[1],o=x[2],x=x[3],W[N]=v.x,W[N+1]=v.y,W[N+2]=v.z,W[N+3]=v.w,W[N+4]=y.x,W[N+5]=y.y,W[N+6]=y.z,W[N+7]=y.w,W[N+8]=o.x,W[N+9]=o.y,W[N+10]=o.z,W[N+11]=o.w,W[N+12]=x.x,W[N+13]=x.y,W[N+14]=x.z,W[N+15]=x.w,N+=16;
|
|
|
|
-if(ta&&F)if(t.length==4&&na)for(x=0;x<4;x++)u=t[x],la[R]=u.x,la[R+1]=u.y,la[R+2]=u.z,R+=3;else for(x=0;x<4;x++)la[R]=u.x,la[R+1]=u.y,la[R+2]=u.z,R+=3;if(xa&&G!==void 0&&w)for(x=0;x<4;x++)t=G[x],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&I!==void 0&&w)for(x=0;x<4;x++)t=I[x],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ha[P]=K,ha[P+1]=K+1,ha[P+2]=K+3,ha[P+3]=K+1,ha[P+4]=K+2,ha[P+5]=K+3,P+=6,sa[T]=K,sa[T+1]=K+1,sa[T+2]=K,sa[T+3]=K+3,sa[T+4]=K+1,sa[T+5]=K+2,sa[T+6]=K+2,sa[T+7]=K+3,T+=8,K+=4)}if(Ma){n=0;for(p=Ma.length;n<
|
|
|
|
-p;n++)ha[P]=Ma[n].a,ha[P+1]=Ma[n].b,ha[P+2]=Ma[n].c,ha[P+3]=Ma[n].a,ha[P+4]=Ma[n].c,ha[P+5]=Ma[n].d,P+=6}qa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,S,m));if(ja)for(O in ja)z=ja[O],z.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,z.buffer),k.bufferData(k.ARRAY_BUFFER,z.array,m));if(Aa){E=0;for(D=Fa.length;E<D;E++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[E]),k.bufferData(k.ARRAY_BUFFER,pa[E],m)}wa&&ka>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),
|
|
|
|
-k.bufferData(k.ARRAY_BUFFER,Z,m));ta&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,la,m));ua&&ia.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));xa&&aa>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));xa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-ha,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,sa,m));M>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m));j.dynamic||(delete g.__inittedArrays,
|
|
|
|
|
|
+k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);fa=ea=-1;da=Y.program;k.useProgram(Y.program);k.uniformMatrix4fv(Y.projectionLocation,!1,sa);k.uniform1f(Y.darknessLocation,Y.darkness);k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.vertexAttribPointer(Y.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(Y.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);
|
|
|
|
+k.enable(k.DEPTH_TEST);k.depthMask(aa)}function B(b,e){var c,f,h;c=U.attributes;var g=U.uniforms,j=V/L,m,n=[],p=L*0.5,t=V*0.5,o=!0;k.useProgram(U.program);da=U.program;fa=ea=-1;za||(k.enableVertexAttribArray(U.attributes.position),k.enableVertexAttribArray(U.attributes.uv),za=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,U.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+U.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,sa);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?
|
|
|
|
+(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-p)/p,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?V:1),n[0]=m*j*h.scale.x,n[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,
|
|
|
|
+h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,n),h.mergeWith3D&&!o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),H(h.blending),P(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(aa)}function x(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,n=new THREE.Vector3,p=V/L,t=L*0.5,o=V*0.5,u=16/V,v=[u*p,u],y=[1,1,0],x=[1,1],w=S.uniforms;
|
|
|
|
+c=S.attributes;k.useProgram(S.program);da=S.program;fa=ea=-1;va||(k.enableVertexAttribArray(S.attributes.vertex),k.enableVertexAttribArray(S.attributes.uv),va=!0);k.uniform1i(w.occlusionMap,0);k.uniform1i(w.map,1);k.bindBuffer(k.ARRAY_BUFFER,S.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,S.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,
|
|
|
|
+S.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),y[0]=n.x,y[1]=n.y,y[2]=n.z,x[0]=y[0]*t+t,x[1]=y[1]*o+o,S.hasVertexTexture||x[0]>0&&x[0]<L&&x[1]>0&&x[1]<V){k.bindTexture(k.TEXTURE_2D,S.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,x[0]-8,x[1]-8,16,16,0);k.uniform1i(w.renderType,0);k.uniform2fv(w.scale,v);k.uniform3fv(w.screenPosition,
|
|
|
|
+y);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,S.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,x[0]-8,x[1]-8,16,16,0);k.uniform1i(w.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,S.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=y[0];c.positionScreen.y=y[1];c.positionScreen.z=y[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(w.renderType,
|
|
|
|
+2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)y[0]=m.x,y[1]=m.y,y[2]=m.z,u=m.size*m.scale/V,v[0]=u*p,v[1]=u,k.uniform3fv(w.screenPosition,y),k.uniform2fv(w.scale,v),k.uniform1f(w.rotation,m.rotation),k.uniform1f(w.opacity,m.opacity),H(m.blending),P(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(aa)}function I(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
|
|
|
|
+b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function J(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function F(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;
|
|
|
|
+for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=A(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,p=void 0,t=void 0,o=void 0,u=t=void 0,v=void 0,y=void 0,x=void 0,w=void 0,B=void 0,F=void 0,G=void 0,I=void 0,L=void 0,E=void 0,H=void 0,V=void 0,D=o=x=o=y=v=void 0,C=void 0,z=C=D=v=void 0,M=void 0,P=z=C=D=t=t=u=x=o=z=C=D=M=z=C=D=M=z=C=D=void 0,K=
|
|
|
|
+0,ga=0,aa=0,X=0,Q=0,S=0,O=0,U=0,ka=0,N=0,R=0,C=D=0,T=g.__vertexArray,$=g.__uvArray,da=g.__uv2Array,la=g.__normalArray,W=g.__tangentArray,Z=g.__colorArray,Y=g.__skinVertexAArray,ea=g.__skinVertexBArray,ca=g.__skinIndexArray,fa=g.__skinWeightArray,na=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,z=void 0,ia=g.__faceArray,sa=g.__lineArray,oa=g.__needsSmoothNormals,B=g.__vertexColorType,w=g.__uvType,F=g.__normalType,ja=j.geometry,qa=ja.__dirtyVertices,ra=ja.__dirtyElements,xa=ja.__dirtyUvs,ta=ja.__dirtyNormals,
|
|
|
|
+ua=ja.__dirtyTangents,wa=ja.__dirtyColors,Aa=ja.__dirtyMorphTargets,va=ja.vertices,Ba=g.faces,Da=ja.faces,Ia=ja.faceVertexUvs[0],Ea=ja.faceVertexUvs[1],ya=ja.skinVerticesA,za=ja.skinVerticesB,Oa=ja.skinIndices,Ha=ja.skinWeights,Ma=j instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,Fa=ja.morphTargets;if(ha)for(P in ha)ha[P].offset=0,ha[P].offsetSrc=0;n=0;for(p=Ba.length;n<p;n++)if(t=Ba[n],o=Da[t],Ia&&(G=Ia[t]),Ea&&(I=Ea[t]),t=o.vertexNormals,u=o.normal,v=o.vertexColors,y=o.color,x=o.vertexTangents,
|
|
|
|
+o instanceof THREE.Face3){if(qa)L=va[o.a].position,E=va[o.b].position,H=va[o.c].position,T[ga]=L.x,T[ga+1]=L.y,T[ga+2]=L.z,T[ga+3]=E.x,T[ga+4]=E.y,T[ga+5]=E.z,T[ga+6]=H.x,T[ga+7]=H.y,T[ga+8]=H.z,ga+=9;if(ha)for(P in ha)if(z=ha[P],z.__original.needsUpdate)D=z.offset,C=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[D+0]=z.value[o.a],z.array[D+1]=z.value[o.b],z.array[D+2]=z.value[o.c]):z.boundTo==="faces"?(z.array[D+0]=z.value[C],z.array[D+1]=z.value[C],z.array[D+2]=z.value[C],
|
|
|
|
+z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[D+0]=z.value[C+0],z.array[D+1]=z.value[C+1],z.array[D+2]=z.value[C+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(L=z.value[o.a],E=z.value[o.b],H=z.value[o.c]):z.boundTo==="faces"?(L=z.value[C],E=z.value[C],H=z.value[C],z.offsetSrc++):z.boundTo==="faceVertices"&&(L=z.value[C+0],E=z.value[C+1],H=z.value[C+2],z.offsetSrc+=3),z.size===2?(z.array[D+0]=L.x,z.array[D+1]=L.y,z.array[D+2]=E.x,z.array[D+3]=E.y,z.array[D+4]=H.x,
|
|
|
|
+z.array[D+5]=H.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[D+0]=L.r,z.array[D+1]=L.g,z.array[D+2]=L.b,z.array[D+3]=E.r,z.array[D+4]=E.g,z.array[D+5]=E.b,z.array[D+6]=H.r,z.array[D+7]=H.g,z.array[D+8]=H.b):(z.array[D+0]=L.x,z.array[D+1]=L.y,z.array[D+2]=L.z,z.array[D+3]=E.x,z.array[D+4]=E.y,z.array[D+5]=E.z,z.array[D+6]=H.x,z.array[D+7]=H.y,z.array[D+8]=H.z),z.offset+=9):(z.array[D+0]=L.x,z.array[D+1]=L.y,z.array[D+2]=L.z,z.array[D+3]=L.w,z.array[D+4]=E.x,z.array[D+5]=E.y,z.array[D+6]=E.z,z.array[D+
|
|
|
|
+7]=E.w,z.array[D+8]=H.x,z.array[D+9]=H.y,z.array[D+10]=H.z,z.array[D+11]=H.w,z.offset+=12));if(Aa){D=0;for(C=Fa.length;D<C;D++)L=Fa[D].vertices[o.a].position,E=Fa[D].vertices[o.b].position,H=Fa[D].vertices[o.c].position,z=na[D],z[R+0]=L.x,z[R+1]=L.y,z[R+2]=L.z,z[R+3]=E.x,z[R+4]=E.y,z[R+5]=E.z,z[R+6]=H.x,z[R+7]=H.y,z[R+8]=H.z;R+=9}if(Ha.length)D=Ha[o.a],C=Ha[o.b],z=Ha[o.c],fa[N]=D.x,fa[N+1]=D.y,fa[N+2]=D.z,fa[N+3]=D.w,fa[N+4]=C.x,fa[N+5]=C.y,fa[N+6]=C.z,fa[N+7]=C.w,fa[N+8]=z.x,fa[N+9]=z.y,fa[N+10]=
|
|
|
|
+z.z,fa[N+11]=z.w,D=Oa[o.a],C=Oa[o.b],z=Oa[o.c],ca[N]=D.x,ca[N+1]=D.y,ca[N+2]=D.z,ca[N+3]=D.w,ca[N+4]=C.x,ca[N+5]=C.y,ca[N+6]=C.z,ca[N+7]=C.w,ca[N+8]=z.x,ca[N+9]=z.y,ca[N+10]=z.z,ca[N+11]=z.w,D=ya[o.a],C=ya[o.b],z=ya[o.c],Y[N]=D.x,Y[N+1]=D.y,Y[N+2]=D.z,Y[N+3]=1,Y[N+4]=C.x,Y[N+5]=C.y,Y[N+6]=C.z,Y[N+7]=1,Y[N+8]=z.x,Y[N+9]=z.y,Y[N+10]=z.z,Y[N+11]=1,D=za[o.a],C=za[o.b],z=za[o.c],ea[N]=D.x,ea[N+1]=D.y,ea[N+2]=D.z,ea[N+3]=1,ea[N+4]=C.x,ea[N+5]=C.y,ea[N+6]=C.z,ea[N+7]=1,ea[N+8]=z.x,ea[N+9]=z.y,ea[N+10]=z.z,
|
|
|
|
+ea[N+11]=1,N+=12;if(wa&&B)v.length==3&&B==THREE.VertexColors?(o=v[0],D=v[1],C=v[2]):C=D=o=y,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=D.r,Z[ka+4]=D.g,Z[ka+5]=D.b,Z[ka+6]=C.r,Z[ka+7]=C.g,Z[ka+8]=C.b,ka+=9;if(ua&&ja.hasTangents)v=x[0],y=x[1],o=x[2],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,O+=12;if(ta&&F)if(t.length==3&&oa)for(x=0;x<3;x++)u=t[x],la[S]=u.x,la[S+1]=u.y,la[S+2]=u.z,S+=3;else for(x=0;x<3;x++)la[S]=
|
|
|
|
+u.x,la[S+1]=u.y,la[S+2]=u.z,S+=3;if(xa&&G!==void 0&&w)for(x=0;x<3;x++)t=G[x],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&I!==void 0&&w)for(x=0;x<3;x++)t=I[x],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ia[Q]=K,ia[Q+1]=K+1,ia[Q+2]=K+2,Q+=3,sa[U]=K,sa[U+1]=K+1,sa[U+2]=K,sa[U+3]=K+2,sa[U+4]=K+1,sa[U+5]=K+2,U+=6,K+=3)}else if(o instanceof THREE.Face4){if(qa)L=va[o.a].position,E=va[o.b].position,H=va[o.c].position,V=va[o.d].position,T[ga]=L.x,T[ga+1]=L.y,T[ga+2]=L.z,T[ga+3]=E.x,T[ga+4]=E.y,T[ga+5]=E.z,T[ga+6]=H.x,T[ga+7]=
|
|
|
|
+H.y,T[ga+8]=H.z,T[ga+9]=V.x,T[ga+10]=V.y,T[ga+11]=V.z,ga+=12;if(ha)for(P in ha)if(z=ha[P],z.__original.needsUpdate)D=z.offset,C=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[D+0]=z.value[o.a],z.array[D+1]=z.value[o.b],z.array[D+2]=z.value[o.c],z.array[D+3]=z.value[o.d]):z.boundTo==="faces"?(z.array[D+0]=z.value[C],z.array[D+1]=z.value[C],z.array[D+2]=z.value[C],z.array[D+3]=z.value[C],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[D+0]=z.value[C+0],z.array[D+1]=
|
|
|
|
+z.value[C+1],z.array[D+2]=z.value[C+2],z.array[D+3]=z.value[C+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(L=z.value[o.a],E=z.value[o.b],H=z.value[o.c],V=z.value[o.d]):z.boundTo==="faces"?(L=z.value[C],E=z.value[C],H=z.value[C],V=z.value[C],z.offsetSrc++):z.boundTo==="faceVertices"&&(L=z.value[C+0],E=z.value[C+1],H=z.value[C+2],V=z.value[C+3],z.offsetSrc+=4),z.size===2?(z.array[D+0]=L.x,z.array[D+1]=L.y,z.array[D+2]=E.x,z.array[D+3]=E.y,z.array[D+4]=H.x,z.array[D+5]=
|
|
|
|
+H.y,z.array[D+6]=V.x,z.array[D+7]=V.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[D+0]=L.r,z.array[D+1]=L.g,z.array[D+2]=L.b,z.array[D+3]=E.r,z.array[D+4]=E.g,z.array[D+5]=E.b,z.array[D+6]=H.r,z.array[D+7]=H.g,z.array[D+8]=H.b,z.array[D+9]=V.r,z.array[D+10]=V.g,z.array[D+11]=V.b):(z.array[D+0]=L.x,z.array[D+1]=L.y,z.array[D+2]=L.z,z.array[D+3]=E.x,z.array[D+4]=E.y,z.array[D+5]=E.z,z.array[D+6]=H.x,z.array[D+7]=H.y,z.array[D+8]=H.z,z.array[D+9]=V.x,z.array[D+10]=V.y,z.array[D+11]=V.z),z.offset+=
|
|
|
|
+12):(z.array[D+0]=L.x,z.array[D+1]=L.y,z.array[D+2]=L.z,z.array[D+3]=L.w,z.array[D+4]=E.x,z.array[D+5]=E.y,z.array[D+6]=E.z,z.array[D+7]=E.w,z.array[D+8]=H.x,z.array[D+9]=H.y,z.array[D+10]=H.z,z.array[D+11]=H.w,z.array[D+12]=V.x,z.array[D+13]=V.y,z.array[D+14]=V.z,z.array[D+15]=V.w,z.offset+=16));if(Aa){D=0;for(C=Fa.length;D<C;D++)L=Fa[D].vertices[o.a].position,E=Fa[D].vertices[o.b].position,H=Fa[D].vertices[o.c].position,V=Fa[D].vertices[o.d].position,z=na[D],z[R+0]=L.x,z[R+1]=L.y,z[R+2]=L.z,z[R+
|
|
|
|
+3]=E.x,z[R+4]=E.y,z[R+5]=E.z,z[R+6]=H.x,z[R+7]=H.y,z[R+8]=H.z,z[R+9]=V.x,z[R+10]=V.y,z[R+11]=V.z;R+=12}if(Ha.length)D=Ha[o.a],C=Ha[o.b],z=Ha[o.c],M=Ha[o.d],fa[N]=D.x,fa[N+1]=D.y,fa[N+2]=D.z,fa[N+3]=D.w,fa[N+4]=C.x,fa[N+5]=C.y,fa[N+6]=C.z,fa[N+7]=C.w,fa[N+8]=z.x,fa[N+9]=z.y,fa[N+10]=z.z,fa[N+11]=z.w,fa[N+12]=M.x,fa[N+13]=M.y,fa[N+14]=M.z,fa[N+15]=M.w,D=Oa[o.a],C=Oa[o.b],z=Oa[o.c],M=Oa[o.d],ca[N]=D.x,ca[N+1]=D.y,ca[N+2]=D.z,ca[N+3]=D.w,ca[N+4]=C.x,ca[N+5]=C.y,ca[N+6]=C.z,ca[N+7]=C.w,ca[N+8]=z.x,ca[N+
|
|
|
|
+9]=z.y,ca[N+10]=z.z,ca[N+11]=z.w,ca[N+12]=M.x,ca[N+13]=M.y,ca[N+14]=M.z,ca[N+15]=M.w,D=ya[o.a],C=ya[o.b],z=ya[o.c],M=ya[o.d],Y[N]=D.x,Y[N+1]=D.y,Y[N+2]=D.z,Y[N+3]=1,Y[N+4]=C.x,Y[N+5]=C.y,Y[N+6]=C.z,Y[N+7]=1,Y[N+8]=z.x,Y[N+9]=z.y,Y[N+10]=z.z,Y[N+11]=1,Y[N+12]=M.x,Y[N+13]=M.y,Y[N+14]=M.z,Y[N+15]=1,D=za[o.a],C=za[o.b],z=za[o.c],o=za[o.d],ea[N]=D.x,ea[N+1]=D.y,ea[N+2]=D.z,ea[N+3]=1,ea[N+4]=C.x,ea[N+5]=C.y,ea[N+6]=C.z,ea[N+7]=1,ea[N+8]=z.x,ea[N+9]=z.y,ea[N+10]=z.z,ea[N+11]=1,ea[N+12]=o.x,ea[N+13]=o.y,
|
|
|
|
+ea[N+14]=o.z,ea[N+15]=1,N+=16;if(wa&&B)v.length==4&&B==THREE.VertexColors?(o=v[0],D=v[1],C=v[2],v=v[3]):v=C=D=o=y,Z[ka]=o.r,Z[ka+1]=o.g,Z[ka+2]=o.b,Z[ka+3]=D.r,Z[ka+4]=D.g,Z[ka+5]=D.b,Z[ka+6]=C.r,Z[ka+7]=C.g,Z[ka+8]=C.b,Z[ka+9]=v.r,Z[ka+10]=v.g,Z[ka+11]=v.b,ka+=12;if(ua&&ja.hasTangents)v=x[0],y=x[1],o=x[2],x=x[3],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,W[O+12]=x.x,W[O+13]=x.y,W[O+14]=x.z,W[O+15]=x.w,O+=16;
|
|
|
|
+if(ta&&F)if(t.length==4&&oa)for(x=0;x<4;x++)u=t[x],la[S]=u.x,la[S+1]=u.y,la[S+2]=u.z,S+=3;else for(x=0;x<4;x++)la[S]=u.x,la[S+1]=u.y,la[S+2]=u.z,S+=3;if(xa&&G!==void 0&&w)for(x=0;x<4;x++)t=G[x],$[aa]=t.u,$[aa+1]=t.v,aa+=2;if(xa&&I!==void 0&&w)for(x=0;x<4;x++)t=I[x],da[X]=t.u,da[X+1]=t.v,X+=2;ra&&(ia[Q]=K,ia[Q+1]=K+1,ia[Q+2]=K+3,ia[Q+3]=K+1,ia[Q+4]=K+2,ia[Q+5]=K+3,Q+=6,sa[U]=K,sa[U+1]=K+1,sa[U+2]=K,sa[U+3]=K+3,sa[U+4]=K+1,sa[U+5]=K+2,sa[U+6]=K+2,sa[U+7]=K+3,U+=8,K+=4)}if(Ma){n=0;for(p=Ma.length;n<
|
|
|
|
+p;n++)ia[Q]=Ma[n].a,ia[Q+1]=Ma[n].b,ia[Q+2]=Ma[n].c,ia[Q+3]=Ma[n].a,ia[Q+4]=Ma[n].c,ia[Q+5]=Ma[n].d,Q+=6}qa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,T,m));if(ha)for(P in ha)z=ha[P],z.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,z.buffer),k.bufferData(k.ARRAY_BUFFER,z.array,m));if(Aa){D=0;for(C=Fa.length;D<C;D++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[D]),k.bufferData(k.ARRAY_BUFFER,na[D],m)}wa&&ka>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),
|
|
|
|
+k.bufferData(k.ARRAY_BUFFER,Z,m));ta&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,la,m));ua&&ja.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));xa&&aa>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));xa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+ia,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,sa,m));N>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));j.dynamic||(delete g.__inittedArrays,
|
|
delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;J(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||
|
|
delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;J(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||
|
|
-f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;w=b.vertices;g=b.colors;C=w.length;j=g.length;F=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<C;n++)p=w[n].position,h=n*3,F[h]=p.x,F[h+1]=p.y,F[h+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,F,e)}if(G){for(n=0;n<j;n++)color=g[n],h=n*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=
|
|
|
|
-!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;w=b.vertices;g=b.colors;C=w.length;j=g.length;F=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<C;n++)p=w[n].position,h=n*3,F[h]=p.x,F[h+1]=p.y,F[h+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,F,e)}if(G){for(n=0;n<j;n++)color=g[n],h=n*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);
|
|
|
|
-k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=B(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,J(f)}function A(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function X(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,n,o={},p=b.morphTargets!==
|
|
|
|
|
|
+f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;w=b.vertices;g=b.colors;B=w.length;j=g.length;F=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<B;n++)p=w[n].position,h=n*3,F[h]=p.x,F[h+1]=p.y,F[h+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,F,e)}if(G){for(n=0;n<j;n++)color=g[n],h=n*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=
|
|
|
|
+!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;w=b.vertices;g=b.colors;B=w.length;j=g.length;F=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<B;n++)p=w[n].position,h=n*3,F[h]=p.x,F[h+1]=p.y,F[h+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,F,e)}if(G){for(n=0;n<j;n++)color=g[n],h=n*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);
|
|
|
|
+k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=A(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,J(f)}function E(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function X(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,n,o={},p=b.morphTargets!==
|
|
void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),
|
|
void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),
|
|
-b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function G(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
|
|
|
|
-k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}fa=b}}function L(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,
|
|
|
|
-k.TEXTURE_MAG_FILTER,Q(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function O(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),L(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+
|
|
|
|
-e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function P(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,
|
|
|
|
-S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,
|
|
|
|
|
|
+b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function G(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(b){if(b!=ea){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
|
|
|
|
+k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ea=b}}function M(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,T(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,T(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,T(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,T(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,
|
|
|
|
+k.TEXTURE_MAG_FILTER,R(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,R(e.minFilter)))}function P(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),M(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+
|
|
|
|
+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function Q(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,T(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,T(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,
|
|
|
|
+T(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,T(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,
|
|
k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
|
|
k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
|
|
-c=V,b=U);e!=Z&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ja,na,c,b),Z=e)}function N(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}
|
|
|
|
-function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
|
|
|
|
+c=L,b=V);e!=Z&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,oa,c,b),Z=e)}function O(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}
|
|
|
|
+function T(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
|
|
case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
|
|
-var $=this,k,K=[],da=null,Z=null,aa=!0,ha=null,la=null,fa=null,pa=null,D=null,ea=null,ca=null,ja=0,na=0,V=0,U=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,sa=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
|
-Pa=b.stencil!==void 0?b.stencil:!0,W=b.antialias!==void 0?b.antialias:!1,ia=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),qa=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=
|
|
|
|
|
|
+var $=this,k,K=[],da=null,Z=null,aa=!0,ha=null,la=null,ea=null,fa=null,C=null,ia=null,na=null,ca=0,oa=0,L=0,V=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,sa=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
|
+Pa=b.stencil!==void 0?b.stencil:!0,W=b.antialias!==void 0?b.antialias:!1,ja=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),qa=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=
|
|
!1;this.shadowMapSoft=!0;var ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:W,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
|
|
!1;this.shadowMapSoft=!0;var ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:W,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
|
|
-" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(ra){console.error(ra)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ia.r,ia.g,ia.b,qa);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
|
|
+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(ra){console.error(ra)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ja.r,ja.g,ja.b,qa);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
0;if(Pa){var Y={};Y.vertices=new Float32Array(12);Y.faces=new Uint16Array(6);Y.darkness=0.5;Y.vertices[0]=-20;Y.vertices[1]=-20;Y.vertices[2]=-1;Y.vertices[3]=20;Y.vertices[4]=-20;Y.vertices[5]=-1;Y.vertices[6]=20;Y.vertices[7]=20;Y.vertices[8]=-1;Y.vertices[9]=-20;Y.vertices[10]=20;Y.vertices[11]=-1;Y.faces[0]=0;Y.faces[1]=1;Y.faces[2]=2;Y.faces[3]=0;Y.faces[4]=2;Y.faces[5]=3;Y.vertexBuffer=k.createBuffer();Y.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
0;if(Pa){var Y={};Y.vertices=new Float32Array(12);Y.faces=new Uint16Array(6);Y.darkness=0.5;Y.vertices[0]=-20;Y.vertices[1]=-20;Y.vertices[2]=-1;Y.vertices[3]=20;Y.vertices[4]=-20;Y.vertices[5]=-1;Y.vertices[6]=20;Y.vertices[7]=20;Y.vertices[8]=-1;Y.vertices[9]=-20;Y.vertices[10]=20;Y.vertices[11]=-1;Y.faces[0]=0;Y.faces[1]=1;Y.faces[2]=2;Y.faces[3]=0;Y.faces[4]=2;Y.faces[5]=3;Y.vertexBuffer=k.createBuffer();Y.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
-Y.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Y.faces,k.STATIC_DRAW);Y.program=k.createProgram();k.attachShader(Y.program,N("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Y.program,N("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Y.program);Y.vertexLocation=k.getAttribLocation(Y.program,"position");Y.projectionLocation=k.getUniformLocation(Y.program,"projectionMatrix");Y.darknessLocation=
|
|
|
|
-k.getUniformLocation(Y.program,"darkness")}var R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);W=0;R.vertices[W++]=-1;R.vertices[W++]=-1;R.vertices[W++]=0;R.vertices[W++]=0;R.vertices[W++]=1;R.vertices[W++]=-1;R.vertices[W++]=1;R.vertices[W++]=0;R.vertices[W++]=1;R.vertices[W++]=1;R.vertices[W++]=1;R.vertices[W++]=1;R.vertices[W++]=-1;R.vertices[W++]=1;R.vertices[W++]=0;R.vertices[W++]=1;W=0;R.faces[W++]=0;R.faces[W++]=1;R.faces[W++]=2;R.faces[W++]=0;R.faces[W++]=2;R.faces[W++]=3;
|
|
|
|
-R.vertexBuffer=k.createBuffer();R.elementBuffer=k.createBuffer();R.tempTexture=k.createTexture();R.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,R.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,R.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,R.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,R.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,R.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
|
|
|
|
-k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,R.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);
|
|
|
|
-k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(R.hasVertexTexture=!1,R.program=k.createProgram(),k.attachShader(R.program,N("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(R.program,N("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(R.hasVertexTexture=!0,R.program=k.createProgram(),k.attachShader(R.program,N("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(R.program,N("vertex",
|
|
|
|
-THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.vertex=k.getAttribLocation(R.program,"position");R.attributes.uv=k.getAttribLocation(R.program,"UV");R.uniforms.renderType=k.getUniformLocation(R.program,"renderType");R.uniforms.map=k.getUniformLocation(R.program,"map");R.uniforms.occlusionMap=k.getUniformLocation(R.program,"occlusionMap");R.uniforms.opacity=k.getUniformLocation(R.program,"opacity");R.uniforms.scale=k.getUniformLocation(R.program,
|
|
|
|
-"scale");R.uniforms.rotation=k.getUniformLocation(R.program,"rotation");R.uniforms.screenPosition=k.getUniformLocation(R.program,"screenPosition");var va=!1,T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);W=0;T.vertices[W++]=-1;T.vertices[W++]=-1;T.vertices[W++]=0;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=-1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=1;T.vertices[W++]=0;T.vertices[W++]=-1;T.vertices[W++]=1;T.vertices[W++]=0;W=
|
|
|
|
-T.vertices[W++]=0;T.faces[W++]=0;T.faces[W++]=1;T.faces[W++]=2;T.faces[W++]=0;T.faces[W++]=2;T.faces[W++]=3;T.vertexBuffer=k.createBuffer();T.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,T.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,T.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,T.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,T.faces,k.STATIC_DRAW);T.program=k.createProgram();k.attachShader(T.program,N("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(T.program,
|
|
|
|
-N("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=k.getAttribLocation(T.program,"position");T.attributes.uv=k.getAttribLocation(T.program,"uv");T.uniforms.uvOffset=k.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=k.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=k.getUniformLocation(T.program,"rotation");T.uniforms.scale=k.getUniformLocation(T.program,"scale");T.uniforms.alignment=k.getUniformLocation(T.program,
|
|
|
|
-"alignment");T.uniforms.map=k.getUniformLocation(T.program,"map");T.uniforms.opacity=k.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates=k.getUniformLocation(T.program,"useScreenCoordinates");T.uniforms.affectedByDistance=k.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=k.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=k.getUniformLocation(T.program,"modelViewMatrix");T.uniforms.projectionMatrix=k.getUniformLocation(T.program,
|
|
|
|
-"projectionMatrix");var za=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ja=b;na=e;V=c;U=f;k.viewport(ja,na,V,U)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ia.setHex(b);qa=e;k.clearColor(ia.r,ia.g,ia.b,qa)};this.setClearColor=
|
|
|
|
-function(b,e){ia.copy(b);qa=e;k.clearColor(ia.r,ia.g,ia.b,qa)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Y.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":
|
|
|
|
|
|
+Y.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Y.faces,k.STATIC_DRAW);Y.program=k.createProgram();k.attachShader(Y.program,O("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Y.program,O("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Y.program);Y.vertexLocation=k.getAttribLocation(Y.program,"position");Y.projectionLocation=k.getUniformLocation(Y.program,"projectionMatrix");Y.darknessLocation=
|
|
|
|
+k.getUniformLocation(Y.program,"darkness")}var S={};S.vertices=new Float32Array(16);S.faces=new Uint16Array(6);W=0;S.vertices[W++]=-1;S.vertices[W++]=-1;S.vertices[W++]=0;S.vertices[W++]=0;S.vertices[W++]=1;S.vertices[W++]=-1;S.vertices[W++]=1;S.vertices[W++]=0;S.vertices[W++]=1;S.vertices[W++]=1;S.vertices[W++]=1;S.vertices[W++]=1;S.vertices[W++]=-1;S.vertices[W++]=1;S.vertices[W++]=0;S.vertices[W++]=1;W=0;S.faces[W++]=0;S.faces[W++]=1;S.faces[W++]=2;S.faces[W++]=0;S.faces[W++]=2;S.faces[W++]=3;
|
|
|
|
+S.vertexBuffer=k.createBuffer();S.elementBuffer=k.createBuffer();S.tempTexture=k.createTexture();S.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,S.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,S.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,S.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,S.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,S.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,
|
|
|
|
+k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,S.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);
|
|
|
|
+k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(S.hasVertexTexture=!1,S.program=k.createProgram(),k.attachShader(S.program,O("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(S.program,O("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(S.hasVertexTexture=!0,S.program=k.createProgram(),k.attachShader(S.program,O("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(S.program,O("vertex",
|
|
|
|
+THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(S.program);S.attributes={};S.uniforms={};S.attributes.vertex=k.getAttribLocation(S.program,"position");S.attributes.uv=k.getAttribLocation(S.program,"UV");S.uniforms.renderType=k.getUniformLocation(S.program,"renderType");S.uniforms.map=k.getUniformLocation(S.program,"map");S.uniforms.occlusionMap=k.getUniformLocation(S.program,"occlusionMap");S.uniforms.opacity=k.getUniformLocation(S.program,"opacity");S.uniforms.scale=k.getUniformLocation(S.program,
|
|
|
|
+"scale");S.uniforms.rotation=k.getUniformLocation(S.program,"rotation");S.uniforms.screenPosition=k.getUniformLocation(S.program,"screenPosition");var va=!1,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);W=0;U.vertices[W++]=-1;U.vertices[W++]=-1;U.vertices[W++]=0;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=-1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=1;U.vertices[W++]=0;U.vertices[W++]=-1;U.vertices[W++]=1;U.vertices[W++]=0;W=
|
|
|
|
+U.vertices[W++]=0;U.faces[W++]=0;U.faces[W++]=1;U.faces[W++]=2;U.faces[W++]=0;U.faces[W++]=2;U.faces[W++]=3;U.vertexBuffer=k.createBuffer();U.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,U.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,U.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,U.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,U.faces,k.STATIC_DRAW);U.program=k.createProgram();k.attachShader(U.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(U.program,
|
|
|
|
+O("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=k.getAttribLocation(U.program,"position");U.attributes.uv=k.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=k.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale=k.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=k.getUniformLocation(U.program,"rotation");U.uniforms.scale=k.getUniformLocation(U.program,"scale");U.uniforms.alignment=k.getUniformLocation(U.program,
|
|
|
|
+"alignment");U.uniforms.map=k.getUniformLocation(U.program,"map");U.uniforms.opacity=k.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=k.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance=k.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=k.getUniformLocation(U.program,"screenPosition");U.uniforms.modelViewMatrix=k.getUniformLocation(U.program,"modelViewMatrix");U.uniforms.projectionMatrix=k.getUniformLocation(U.program,
|
|
|
|
+"projectionMatrix");var za=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ca=b;oa=e;L=c;V=f;k.viewport(ca,oa,L,V)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ja.setHex(b);qa=e;k.clearColor(ja.r,ja.g,ja.b,qa)};this.setClearColor=
|
|
|
|
+function(b,e){ja.copy(b);qa=e;k.clearColor(ja.r,ja.g,ja.b,qa)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Y.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":
|
|
b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,p;n=p=m=0;for(o=e.length;n<o;n++)g=e[n],g instanceof THREE.SpotLight&&p++,g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&
|
|
b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,p;n=p=m=0;for(o=e.length;n<o;n++)g=e[n],g instanceof THREE.SpotLight&&p++,g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&
|
|
m++;m+p<=4?n=p:(n=Math.ceil(4*p/(m+p)),m=4-n);g={directional:n,point:m};m=p=0;for(n=e.length;m<n;m++)o=e[m],o instanceof THREE.SpotLight&&o.castShadow&&p++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
m++;m+p<=4?n=p:(n=Math.ceil(4*p/(m+p)),m=4-n);g={directional:n,point:m};m=p=0;for(n=e.length;m<n;m++)o=e[m],o instanceof THREE.SpotLight&&o.castShadow&&p++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
maxDirLights:g.directional,maxPointLights:g.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p},v,f=[];j?f.push(j):(f.push(n),f.push(o));for(v in c)f.push(v),f.push(c[v]);j=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==j){u=K[v].program;break a}v=k.createProgram();f=[Ea?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
|
maxDirLights:g.directional,maxPointLights:g.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p},v,f=[];j?f.push(j):(f.push(n),f.push(o));for(v in c)f.push(v),f.push(c[v]);j=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==j){u=K[v].program;break a}v=k.createProgram();f=[Ea?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
|
c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+
|
|
g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+
|
|
-c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,N("fragment",g+n));k.attachShader(v,N("vertex",f+o));k.linkProgram(v);k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms={};v.attributes={};var x,f=["viewMatrix","modelViewMatrix",
|
|
|
|
|
|
+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,O("fragment",g+n));k.attachShader(v,O("vertex",f+o));k.linkProgram(v);k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms={};v.attributes={};var x,f=["viewMatrix","modelViewMatrix",
|
|
"projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m)f.push(x);x=f;f=0;for(m=x.length;f<m;f++)n=x[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)f.push("morphTarget"+x);for(u in e)f.push(u);u=f;x=0;for(e=u.length;x<e;x++)c=u[x],v.attributes[c]=k.getAttribLocation(v,c);K.push({program:v,
|
|
"projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m)f.push(x);x=f;f=0;for(m=x.length;f<m;f++)n=x[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)f.push("morphTarget"+x);for(u in e)f.push(u);u=f;x=0;for(e=u.length;x<e;x++)c=u[x],v.attributes[c]=k.getAttribLocation(v,c);K.push({program:v,
|
|
code:j});u=v}b.program=u;u=b.program.attributes;u.position>=0&&k.enableVertexAttribArray(u.position);u.color>=0&&k.enableVertexAttribArray(u.color);u.normal>=0&&k.enableVertexAttribArray(u.normal);u.tangent>=0&&k.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(k.enableVertexAttribArray(u.skinVertexA),k.enableVertexAttribArray(u.skinVertexB),k.enableVertexAttribArray(u.skinIndex),k.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(h in b.attributes)u[h]!==
|
|
code:j});u=v}b.program=u;u=b.program.attributes;u.position>=0&&k.enableVertexAttribArray(u.position);u.color>=0&&k.enableVertexAttribArray(u.color);u.normal>=0&&k.enableVertexAttribArray(u.normal);u.tangent>=0&&k.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(k.enableVertexAttribArray(u.skinVertexA),k.enableVertexAttribArray(u.skinVertexB),k.enableVertexAttribArray(u.skinIndex),k.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(h in b.attributes)u[h]!==
|
|
void 0&&u[h]>=0&&k.enableVertexAttribArray(u[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,u.morphTarget0>=0&&(k.enableVertexAttribArray(u.morphTarget0),b.numSupportedMorphTargets++),u.morphTarget1>=0&&(k.enableVertexAttribArray(u.morphTarget1),b.numSupportedMorphTargets++),u.morphTarget2>=0&&(k.enableVertexAttribArray(u.morphTarget2),b.numSupportedMorphTargets++),u.morphTarget3>=0&&(k.enableVertexAttribArray(u.morphTarget3),b.numSupportedMorphTargets++),u.morphTarget4>=0&&(k.enableVertexAttribArray(u.morphTarget4),
|
|
void 0&&u[h]>=0&&k.enableVertexAttribArray(u[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,u.morphTarget0>=0&&(k.enableVertexAttribArray(u.morphTarget0),b.numSupportedMorphTargets++),u.morphTarget1>=0&&(k.enableVertexAttribArray(u.morphTarget1),b.numSupportedMorphTargets++),u.morphTarget2>=0&&(k.enableVertexAttribArray(u.morphTarget2),b.numSupportedMorphTargets++),u.morphTarget3>=0&&(k.enableVertexAttribArray(u.morphTarget3),b.numSupportedMorphTargets++),u.morphTarget4>=0&&(k.enableVertexAttribArray(u.morphTarget4),
|
|
-b.numSupportedMorphTargets++),u.morphTarget5>=0&&(k.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>=0&&(k.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(k.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,o,B){var A,V,F,D,G,J,U,K,L=b.lights,ga=b.fog;this.shadowMapEnabled&&y(b,c);$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
|
-!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(sa);ka.multiply(c.projectionMatrix,c.matrixWorldInverse);p(ka);this.initWebGLObjects(b);P(o);(this.autoClear||B)&&this.clear();G=b.__webglObjects.length;for(B=0;B<G;B++)if(A=b.__webglObjects[B],U=A.object,U.visible)if(!(U instanceof THREE.Mesh)||t(U)){if(U.matrixWorld.flattenToArray(U._objectMatrixArray),I(U,c,!0),v(A),A.render=!0,this.sortObjects)A.object.renderDepth?A.z=A.object.renderDepth:(Aa.copy(U.position),ka.multiplyVector3(Aa),
|
|
|
|
-A.z=Aa.z)}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(u);J=b.__webglObjectsImmediate.length;for(B=0;B<J;B++)A=b.__webglObjectsImmediate[B],U=A.object,U.visible&&(U.matrixAutoUpdate&&U.matrixWorld.flattenToArray(U._objectMatrixArray),I(U,c,!0),n(A));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);H(b.overrideMaterial.blending);for(B=0;B<G;B++)if(A=b.__webglObjects[B],A.render)U=A.object,K=A.buffer,j(U),f(c,L,ga,b.overrideMaterial,K,U);for(B=0;B<J;B++)A=b.__webglObjectsImmediate[B],
|
|
|
|
-U=A.object,U.visible&&(j(U),V=e(c,L,ga,b.overrideMaterial,U),U.render(function(c){g(c,V,b.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(B=0;B<G;B++)if(A=b.__webglObjects[B],A.render){U=A.object;K=A.buffer;F=A.opaque;j(U);for(A=0;A<F.count;A++)D=F.list[A],h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,L,ga,D,K,U)}for(B=0;B<J;B++)if(A=b.__webglObjectsImmediate[B],U=A.object,U.visible){F=A.opaque;j(U);for(A=0;A<F.count;A++)D=F.list[A],h(D.depthTest),
|
|
|
|
-m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),V=e(c,L,ga,D,U),U.render(function(b){g(b,V,D.shading)})}for(B=0;B<G;B++)if(A=b.__webglObjects[B],A.render){U=A.object;K=A.buffer;F=A.transparent;j(U);for(A=0;A<F.count;A++)D=F.list[A],H(D.blending),h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,L,ga,D,K,U)}for(B=0;B<J;B++)if(A=b.__webglObjectsImmediate[B],U=A.object,U.visible){F=A.transparent;j(U);for(A=0;A<F.count;A++)D=F.list[A],H(D.blending),h(D.depthTest),
|
|
|
|
-m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),V=e(c,L,ga,D,U),U.render(function(b){g(b,V,D.shading)})}}b.__webglSprites.length&&C(b,c);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],
|
|
|
|
|
|
+b.numSupportedMorphTargets++),u.morphTarget5>=0&&(k.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>=0&&(k.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(k.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,o,L){var A,E,F,C,G,J,V,K,M=b.lights,ga=b.fog;this.shadowMapEnabled&&y(b,c);$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
|
+!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(sa);ka.multiply(c.projectionMatrix,c.matrixWorldInverse);p(ka);this.initWebGLObjects(b);Q(o);(this.autoClear||L)&&this.clear();G=b.__webglObjects.length;for(L=0;L<G;L++)if(A=b.__webglObjects[L],V=A.object,V.visible)if(!(V instanceof THREE.Mesh)||t(V)){if(V.matrixWorld.flattenToArray(V._objectMatrixArray),I(V,c,!0),v(A),A.render=!0,this.sortObjects)A.object.renderDepth?A.z=A.object.renderDepth:(Aa.copy(V.position),ka.multiplyVector3(Aa),
|
|
|
|
+A.z=Aa.z)}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(u);J=b.__webglObjectsImmediate.length;for(L=0;L<J;L++)A=b.__webglObjectsImmediate[L],V=A.object,V.visible&&(V.matrixAutoUpdate&&V.matrixWorld.flattenToArray(V._objectMatrixArray),I(V,c,!0),n(A));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);H(b.overrideMaterial.blending);for(L=0;L<G;L++)if(A=b.__webglObjects[L],A.render)V=A.object,K=A.buffer,j(V),f(c,M,ga,b.overrideMaterial,K,V);for(L=0;L<J;L++)A=b.__webglObjectsImmediate[L],
|
|
|
|
+V=A.object,V.visible&&(j(V),E=e(c,M,ga,b.overrideMaterial,V),V.render(function(c){g(c,E,b.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(L=0;L<G;L++)if(A=b.__webglObjects[L],A.render){V=A.object;K=A.buffer;F=A.opaque;j(V);for(A=0;A<F.count;A++)C=F.list[A],h(C.depthTest),m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,M,ga,C,K,V)}for(L=0;L<J;L++)if(A=b.__webglObjectsImmediate[L],V=A.object,V.visible){F=A.opaque;j(V);for(A=0;A<F.count;A++)C=F.list[A],h(C.depthTest),
|
|
|
|
+m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(c,M,ga,C,V),V.render(function(b){g(b,E,C.shading)})}for(L=0;L<G;L++)if(A=b.__webglObjects[L],A.render){V=A.object;K=A.buffer;F=A.transparent;j(V);for(A=0;A<F.count;A++)C=F.list[A],H(C.blending),h(C.depthTest),m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,M,ga,C,K,V)}for(L=0;L<J;L++)if(A=b.__webglObjectsImmediate[L],V=A.object,V.visible){F=A.transparent;j(V);for(A=0;A<F.count;A++)C=F.list[A],H(C.blending),h(C.depthTest),
|
|
|
|
+m(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),E=e(c,M,ga,C,V),V.render(function(b){g(b,E,C.shading)})}}b.__webglSprites.length&&B(b,c);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],
|
|
b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],e=b,f=void 0,h=void 0,g=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(f in h=c.geometry,h.geometryGroups==void 0&&
|
|
b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],e=b,f=void 0,h=void 0,g=void 0;if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(f in h=c.geometry,h.geometryGroups==void 0&&
|
|
X(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=
|
|
X(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=
|
|
-k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,n=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(n=j.numMorphTargets;m<n;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=g,m=c,o=void 0,p=void 0,t=void 0,u=t=void 0,v=void 0,x=void 0,y=x=n=0,w=t=p=void 0,C=w=p=o=void 0,t=void 0,u=m.geometry,v=u.faces,w=j.faces,o=0,p=w.length;o<p;o++)t=w[o],t=v[t],t instanceof THREE.Face3?(n+=3,x+=1,y+=3):t instanceof THREE.Face4&&(n+=4,x+=2,y+=4);for(var o=j,
|
|
|
|
-p=m,B=w=v=void 0,D=void 0,B=void 0,t=[],v=0,w=p.materials.length;v<w;v++)if(B=p.materials[v],B instanceof THREE.MeshFaceMaterial){B=0;for(l=o.materials.length;B<l;B++)(D=o.materials[B])&&t.push(D)}else(D=B)&&t.push(D);o=t;j.__materials=o;a:{v=p=void 0;w=o.length;for(p=0;p<w;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{w=v=void 0;t=o.length;for(v=0;v<t;v++)if(w=o[v],!(w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial)){w=
|
|
|
|
-w&&w.shading!=void 0&&w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}w=!1}a:{t=v=void 0;B=o.length;for(v=0;v<B;v++)if(t=o[v],t.vertexColors){t=t.vertexColors;break a}t=!1}j.__vertexArray=new Float32Array(n*3);if(w)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(t)j.__colorArray=new Float32Array(n*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
|
|
|
|
|
|
+k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,n=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(n=j.numMorphTargets;m<n;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=g,m=c,o=void 0,p=void 0,t=void 0,u=t=void 0,v=void 0,x=void 0,y=x=n=0,w=t=p=void 0,B=w=p=o=void 0,t=void 0,u=m.geometry,v=u.faces,w=j.faces,o=0,p=w.length;o<p;o++)t=w[o],t=v[t],t instanceof THREE.Face3?(n+=3,x+=1,y+=3):t instanceof THREE.Face4&&(n+=4,x+=2,y+=4);for(var o=j,
|
|
|
|
+p=m,A=w=v=void 0,L=void 0,A=void 0,t=[],v=0,w=p.materials.length;v<w;v++)if(A=p.materials[v],A instanceof THREE.MeshFaceMaterial){A=0;for(l=o.materials.length;A<l;A++)(L=o.materials[A])&&t.push(L)}else(L=A)&&t.push(L);o=t;j.__materials=o;a:{v=p=void 0;w=o.length;for(p=0;p<w;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{w=v=void 0;t=o.length;for(v=0;v<t;v++)if(w=o[v],!(w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial)){w=
|
|
|
|
+w&&w.shading!=void 0&&w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}w=!1}a:{t=v=void 0;A=o.length;for(v=0;v<A;v++)if(t=o[v],t.vertexColors){t=t.vertexColors;break a}t=!1}j.__vertexArray=new Float32Array(n*3);if(w)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(t)j.__colorArray=new Float32Array(n*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
|
|
1)j.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(y*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(v=j.numMorphTargets;u<v;u++)j.__morphTargetsArrays.push(new Float32Array(n*
|
|
1)j.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(y*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(v=j.numMorphTargets;u<v;u++)j.__morphTargetsArrays.push(new Float32Array(n*
|
|
-3))}j.__needsSmoothNormals=w==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=t;j.__normalType=w;j.__webglFaceCount=x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];w={};for(C in t)w[C]=t[C];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,x=1,w.type==="v2"?x=2:w.type==="v3"?x=3:w.type===
|
|
|
|
|
|
+3))}j.__needsSmoothNormals=w==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=t;j.__normalType=w;j.__webglFaceCount=x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];w={};for(B in t)w[B]=t[B];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,x=1,w.type==="v2"?x=2:w.type==="v3"?x=3:w.type===
|
|
"v4"?x=4:w.type==="c"&&(x=3),w.size=x,w.array=new Float32Array(n*x),w.buffer=k.createBuffer(),w.buffer.belongsToAttribute=a,t.needsUpdate=!0,w.__original=t;j.__webglCustomAttributes[a]=w}}j.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}c instanceof THREE.ShadowVolume?G(e.__webglShadowVolumes,g,c):G(e.__webglObjects,g,c)}else if(c instanceof THREE.LensFlare)G(e.__webglLensFlares,void 0,
|
|
"v4"?x=4:w.type==="c"&&(x=3),w.size=x,w.array=new Float32Array(n*x),w.buffer=k.createBuffer(),w.buffer.belongsToAttribute=a,t.needsUpdate=!0,w.__original=t;j.__webglCustomAttributes[a]=w}}j.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}c instanceof THREE.ShadowVolume?G(e.__webglShadowVolumes,g,c):G(e.__webglObjects,g,c)}else if(c instanceof THREE.LensFlare)G(e.__webglLensFlares,void 0,
|
|
c);else if(c instanceof THREE.Ribbon){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglVertexCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(e.__webglObjects,h,c)}else if(c instanceof THREE.Line){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,
|
|
c);else if(c instanceof THREE.Ribbon){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglVertexCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(e.__webglObjects,h,c)}else if(c instanceof THREE.Line){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,
|
|
g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglLineCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(e.__webglObjects,h,c)}else if(c instanceof THREE.ParticleSystem){h=c.geometry;if(!h.__webglVertexBuffer){f=h;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=h;g=c;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=
|
|
g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglLineCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(e.__webglObjects,h,c)}else if(c instanceof THREE.ParticleSystem){h=c.geometry;if(!h.__webglVertexBuffer){f=h;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=h;g=c;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=
|
|
-g.materials;C=n=m=void 0;m=0;for(n=g.materials.length;m<n;m++)if(C=g.materials[m],C.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in C.attributes){originalAttribute=C.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
|
|
|
|
|
|
+g.materials;B=n=m=void 0;m=0;for(n=g.materials.length;m<n;m++)if(B=g.materials[m],B.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in B.attributes){originalAttribute=B.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
|
|
4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}G(e.__webglObjects,h,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
|
|
4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}G(e.__webglObjects,h,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
|
|
-c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];c=b;if(e instanceof THREE.ShadowVolume)A(c.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)A(c.__webglObjects,e);else if(e instanceof THREE.Sprite){c=c.__webglSprites;h=void 0;for(h=c.length-1;h>=0;h--)c[h]==e&&c.splice(h,1)}else e instanceof THREE.LensFlare?A(c.__webglLensFlares,
|
|
|
|
-e):e instanceof THREE.MarchingCubes&&A(c.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)F(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)F(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)F(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),
|
|
|
|
|
|
+c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];c=b;if(e instanceof THREE.ShadowVolume)E(c.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)E(c.__webglObjects,e);else if(e instanceof THREE.Sprite){c=c.__webglSprites;h=void 0;for(h=c.length-1;h>=0;h--)c[h]==e&&c.splice(h,1)}else e instanceof THREE.LensFlare?E(c.__webglLensFlares,
|
|
|
|
+e):e instanceof THREE.MarchingCubes&&E(c.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)F(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)F(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)F(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),
|
|
k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Ea}};
|
|
k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Ea}};
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
@@ -425,12 +425,12 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,p=!1,t=1,o=0,n=0,v=0,u=0,y=0,w=window.innerWidth/2,C=window.innerHeight/2;this.update=
|
|
|
|
|
|
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,p=!1,t=1,o=0,n=0,v=0,u=0,y=0,w=window.innerWidth/2,B=window.innerHeight/2;this.update=
|
|
function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*n);this.translateY(b*v);p&&(this.roll+=this.rollSpeed*this.delta*t);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*n);this.translateY(b*v);p&&(this.roll+=this.rollSpeed*this.delta*t);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);j.set(0,1,0);g.cross(j,h).normalize();j.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=j.z;this.matrix.n33=h.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
|
|
else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);j.set(0,1,0);g.cross(j,h).normalize();j.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=j.z;this.matrix.n33=h.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
|
|
this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
-function(b){u=(b.clientX-w)/window.innerWidth;y=(b.clientY-C)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:n=-1;break;
|
|
|
|
|
|
+function(b){u=(b.clientX-w)/window.innerWidth;y=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:n=-1;break;
|
|
case 40:case 83:o=-1;break;case 39:case 68:n=1;break;case 81:p=!0;t=1;break;case 69:p=!0;t=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:n=0;break;case 40:case 83:o=0;break;case 39:case 68:n=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
case 40:case 83:o=-1;break;case 39:case 68:n=1;break;case 81:p=!0;t=1;break;case 69:p=!0;t=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:n=0;break;case 40:case 83:o=0;break;case 39:case 68:n=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
|
|
THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
|
|
@@ -461,7 +461,7 @@ THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arg
|
|
THREE.Path.prototype.arc=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,j));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f<b;f++)e.push(this.getPoint(f/b));c&&e.push(e[0]);return e};
|
|
THREE.Path.prototype.arc=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,j));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f<b;f++)e.push(this.getPoint(f/b));c&&e.push(e[0]);return e};
|
|
THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,g,j,h,m,p,t,o,n,v,u,y,w;f=0;for(g=this.actions.length;f<g;f++)switch(j=this.actions[f],h=j.action,j=j.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];p=j[3];n=j[0];v=j[1];e.length>0?(h=e[e.length-1],u=h.x,y=h.y):(h=this.actions[f-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.Shape.Utils.b2(w,u,n,m),w=THREE.Shape.Utils.b2(w,y,v,
|
|
THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,g,j,h,m,p,t,o,n,v,u,y,w;f=0;for(g=this.actions.length;f<g;f++)switch(j=this.actions[f],h=j.action,j=j.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];p=j[3];n=j[0];v=j[1];e.length>0?(h=e[e.length-1],u=h.x,y=h.y):(h=this.actions[f-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.Shape.Utils.b2(w,u,n,m),w=THREE.Shape.Utils.b2(w,y,v,
|
|
p),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];p=j[5];n=j[0];v=j[1];t=j[2];o=j[3];e.length>0?(h=e[e.length-1],u=h.x,y=h.y):(h=this.actions[f-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.Shape.Utils.b3(w,u,n,t,m),w=THREE.Shape.Utils.b3(w,y,v,o,p),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h);
|
|
p),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];p=j[5];n=j[0];v=j[1];t=j[2];o=j[3];e.length>0?(h=e[e.length-1],u=h.x,y=h.y):(h=this.actions[f-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.Shape.Utils.b3(w,u,n,t,m),w=THREE.Shape.Utils.b3(w,y,v,o,p),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h);
|
|
-for(h=1;h<=w;h++)e.push(j.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=j[0];p=j[1];t=j[2];n=j[3];w=j[4];v=!!j[5];o=h[h.length-2];u=h[h.length-1];h.length==0&&(o=u=0);y=w-n;var C=b*2;for(h=1;h<=C;h++)w=h/C,v||(w=1-w),w=n+w*y,j=o+m+t*Math.cos(w),w=u+p+t*Math.sin(w),e.push(new THREE.Vector2(j,w))}c&&e.push(e[0]);return e};
|
|
|
|
|
|
+for(h=1;h<=w;h++)e.push(j.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=j[0];p=j[1];t=j[2];n=j[3];w=j[4];v=!!j[5];o=h[h.length-2];u=h[h.length-1];h.length==0&&(o=u=0);y=w-n;var B=b*2;for(h=1;h<=B;h++)w=h/B,v||(w=1-w),w=n+w*y,j=o+m+t*Math.cos(w),w=u+p+t*Math.sin(w),e.push(new THREE.Vector2(j,w))}c&&e.push(e[0]);return e};
|
|
THREE.Path.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,m,p;p=new THREE.Vector2;h=0;for(m=b.length;h<m;h++){j=b[h];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)g=j.y;p.addSelf(j.x,j.y)}return{minX:f,minY:g,maxX:c,maxY:e,centroid:p.divideScalar(m)}};
|
|
THREE.Path.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,m,p;p=new THREE.Vector2;h=0;for(m=b.length;h<m;h++){j=b[h];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)g=j.y;p.addSelf(j.x,j.y)}return{minX:f,minY:g,maxX:c,maxY:e,centroid:p.divideScalar(m)}};
|
|
THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};THREE.Path.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
|
|
THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};THREE.Path.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
|
|
THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
|
|
THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
|
|
@@ -472,27 +472,28 @@ this.getPoints();b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1
|
|
THREE.Path.prototype.toShapes=function(){var b,c,e,f,g=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(g.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&g.push(j);if(g.length==0)return[];var h,j=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h&&j.push(h),h=new THREE.Shape,h.actions=f.actions,h.curves=
|
|
THREE.Path.prototype.toShapes=function(){var b,c,e,f,g=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(g.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&g.push(j);if(g.length==0)return[];var h,j=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h&&j.push(h),h=new THREE.Shape,h.actions=f.actions,h.curves=
|
|
f.curves):h.holes.push(f);j.push(h)}else{h=new THREE.Shape;b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h.actions=f.actions,h.curves=f.curves,j.push(h),h=new THREE.Shape):h.holes.push(f)}return j};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
f.curves):h.holes.push(f);j.push(h)}else{h=new THREE.Shape;b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h.actions=f.actions,h.curves=f.curves,j.push(h),h=new THREE.Shape):h.holes.push(f)}return j};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,j,h,m,p,t,o,n,v,u,y=[];for(p=0;p<c.length;p++){t=c[p];f=f.concat(t);j=Number.POSITIVE_INFINITY;for(g=0;g<t.length;g++){v=t[g];u=[];for(n=0;n<e.length;n++)o=e[n],o=v.distanceToSquared(o),u.push(o),o<j&&(j=o,h=g,m=n)}g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:t.length-1;var w=[t[h],e[m],e[g]];n=THREE.FontUtils.Triangulate.area(w);var C=[t[h],t[j],e[m]];v=THREE.FontUtils.Triangulate.area(C);u=m;o=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=
|
|
|
|
-e.length;h<0&&(h+=t.length);h%=t.length;g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:t.length-1;w=[t[h],e[m],e[g]];w=THREE.FontUtils.Triangulate.area(w);C=[t[h],t[j],e[m]];C=THREE.FontUtils.Triangulate.area(C);n+v>w+C&&(m=u,h=o,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=t.length),h%=t.length,g=m-1>=0?m-1:e.length-1,j=h-1>=0?h-1:t.length-1);n=e.slice(0,m);v=e.slice(m);u=t.slice(h);o=t.slice(0,h);j=[t[h],t[j],e[m]];y.push([t[h],e[m],e[g]]);y.push(j);e=n.concat(u).concat(o).concat(v)}return{shape:e,isolatedPts:y,
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,j,h,m,p,t,o,n,v,u,y=[];for(p=0;p<c.length;p++){t=c[p];f=f.concat(t);j=Number.POSITIVE_INFINITY;for(g=0;g<t.length;g++){v=t[g];u=[];for(n=0;n<e.length;n++)o=e[n],o=v.distanceToSquared(o),u.push(o),o<j&&(j=o,h=g,m=n)}g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:t.length-1;var w=[t[h],e[m],e[g]];n=THREE.FontUtils.Triangulate.area(w);var B=[t[h],t[j],e[m]];v=THREE.FontUtils.Triangulate.area(B);u=m;o=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=
|
|
|
|
+e.length;h<0&&(h+=t.length);h%=t.length;g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:t.length-1;w=[t[h],e[m],e[g]];w=THREE.FontUtils.Triangulate.area(w);B=[t[h],t[j],e[m]];B=THREE.FontUtils.Triangulate.area(B);n+v>w+B&&(m=u,h=o,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=t.length),h%=t.length,g=m-1>=0?m-1:e.length-1,j=h-1>=0?h-1:t.length-1);n=e.slice(0,m);v=e.slice(m);u=t.slice(h);o=t.slice(0,h);j=[t[h],t[j],e[m]];y.push([t[h],e[m],e[g]]);y.push(j);e=n.concat(u).concat(o).concat(v)}return{shape:e,isolatedPts:y,
|
|
allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,m,p;for(j=0;j<e.length;j++){p=e[j];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(p[h])&&(p[h]=m)}for(j=0;j<g.length;j++){p=g[j];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(p[h])&&(p[h]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,
|
|
allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,m,p;for(j=0;j<e.length;j++){p=e[j];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(p[h])&&(p[h]=m)}for(j=0;j<g.length;j++){p=g[j];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(p[h])&&(p[h]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,
|
|
c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)}};THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};
|
|
c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)}};THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};
|
|
THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=j};
|
|
THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=j};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
|
|
-THREE.CubeGeometry=function(b,c,e,f,g,j,h,m,p){function t(b,c,e,h,m,n,p,t){var u,v,w=f||1,y=g||1,P=m/2,N=n/2,Q=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",y=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var S=w+1,$=y+1;m/=w;var k=n/y;for(v=0;v<$;v++)for(n=0;n<S;n++){var K=new THREE.Vector3;K[b]=(n*m-P)*e;K[c]=(v*k-N)*h;K[u]=p;o.vertices.push(new THREE.Vertex(K))}for(v=0;v<y;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+S*v+
|
|
|
|
-Q,n+S*(v+1)+Q,n+1+S*(v+1)+Q,n+1+S*v+Q,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/y),new THREE.UV(n/w,(v+1)/y),new THREE.UV((n+1)/w,(v+1)/y),new THREE.UV((n+1)/w,v/y)])}THREE.Geometry.call(this);var o=this,n=b/2,v=c/2,u=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var w in p)this.sides[w]!=void 0&&(this.sides[w]=
|
|
|
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,g,j,h,m,p){function t(b,c,e,h,m,n,p,t){var u,v,w=f||1,y=g||1,Q=m/2,O=n/2,R=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",y=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var T=w+1,$=y+1;m/=w;var k=n/y;for(v=0;v<$;v++)for(n=0;n<T;n++){var K=new THREE.Vector3;K[b]=(n*m-Q)*e;K[c]=(v*k-O)*h;K[u]=p;o.vertices.push(new THREE.Vertex(K))}for(v=0;v<y;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+T*v+
|
|
|
|
+R,n+T*(v+1)+R,n+1+T*(v+1)+R,n+1+T*v+R,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/y),new THREE.UV(n/w,(v+1)/y),new THREE.UV((n+1)/w,(v+1)/y),new THREE.UV((n+1)/w,v/y)])}THREE.Geometry.call(this);var o=this,n=b/2,v=c/2,u=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var w in p)this.sides[w]!=void 0&&(this.sides[w]=
|
|
p[w]);this.sides.px&&t("z","y",1*m,-1,e,c,-n,this.materials[0]);this.sides.nx&&t("z","y",-1*m,-1,e,c,n,this.materials[1]);this.sides.py&&t("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&t("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&t("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&t("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var h=o.vertices[e],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
|
|
p[w]);this.sides.px&&t("z","y",1*m,-1,e,c,-n,this.materials[0]);this.sides.nx&&t("z","y",-1*m,-1,e,c,n,this.materials[1]);this.sides.py&&t("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&t("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&t("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&t("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var h=o.vertices[e],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
|
|
h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=j;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)h=o.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=j;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)h=o.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,p,t=Math.PI*2,o=f/2;for(p=0;p<b;p++)h(Math.sin(t*p/b)*c,Math.cos(t*p/b)*c,-o);for(p=0;p<b;p++)h(Math.sin(t*p/b)*e,Math.cos(t*p/b)*e,o);for(p=0;p<b;p++)m.faces.push(new THREE.Face4(p,p+b,b+(p+1)%b,(p+1)%b));if(e>0){h(0,0,-o-(j||0));for(p=b;p<b+b/2;p++)m.faces.push(new THREE.Face4(2*b,(2*p-2*b)%b,(2*p-2*b+1)%b,(2*p-2*b+2)%b))}if(c>0){h(0,0,o+
|
|
THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,p,t=Math.PI*2,o=f/2;for(p=0;p<b;p++)h(Math.sin(t*p/b)*c,Math.cos(t*p/b)*c,-o);for(p=0;p<b;p++)h(Math.sin(t*p/b)*e,Math.cos(t*p/b)*e,o);for(p=0;p<b;p++)m.faces.push(new THREE.Face4(p,p+b,b+(p+1)%b,(p+1)%b));if(e>0){h(0,0,-o-(j||0));for(p=b;p<b+b/2;p++)m.faces.push(new THREE.Face4(2*b,(2*p-2*b)%b,(2*p-2*b+1)%b,(2*p-2*b+2)%b))}if(c>0){h(0,0,o+
|
|
(g||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b))}p=0;for(b=this.faces.length;p<b;p++){var c=[],e=this.faces[p],g=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],n=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/t,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/t,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/t,0.5+o.position.z/
|
|
(g||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b))}p=0;for(b=this.faces.length;p<b;p++){var c=[],e=this.faces[p],g=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],n=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/t,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/t,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/t,0.5+o.position.z/
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/t,0.5+n.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/t,0.5+n.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f,h,g,j,k;f=new THREE.Vector2(b.x-c.x,b.y-c.y);h=new THREE.Vector2(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g=new THREE.Vector2(-f.y,f.x);j=new THREE.Vector2(h.y,-h.x);h=b.clone().addSelf(g);k=b.clone().addSelf(j);if(h.equals(k))return j;h=c.clone().addSelf(g);k=e.clone().addSelf(j);g=f.dot(j);j=k.clone().subSelf(h).dot(j);g==0&&
|
|
|
|
-(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g=j/g;if(g<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.clone().multiplyScalar(g).addSelf(h).subSelf(b)}function g(b){for(G=b.length;--G>=0;){Z=G;aa=G-1;aa<0&&(aa=b.length-1);for(var c=0,c=0;c<v+o*2;c++){var e=Q*c,f=Q*(c+1),h=ha+Z+e,e=ha+aa+e,g=ha+
|
|
|
|
-aa+f,f=ha+Z+f;h+=J;e+=J;g+=J;f+=J;B.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=J;c+=J;e+=J;B.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,n=c.bevelEnabled!==void 0?c.bevelEnabled:!0,v=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,y,w=!1;
|
|
|
|
-if(u)y=u.getPoints(),v=y.length,w=!0,n=!1;n||(t=p=o=0);var C,x,I,B=this,J=this.vertices.length,u=b.extractAllPoints(),F=u.shape,u=u.holes,A=!THREE.Shape.Utils.isClockWise(F);if(A){F=F.reverse();x=0;for(I=u.length;x<I;x++)C=u[x],THREE.Shape.Utils.isClockWise(C)&&(u[x]=C.reverse());A=!1}var A=THREE.Shape.Utils.triangulateShape(F,u),X=F;x=0;for(I=u.length;x<I;x++)C=u[x],F=F.concat(C);var G,H,L,O,P,N,Q=F.length,S=A.length,$=[];G=0;H=X.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),
|
|
|
|
-$[G]=f(X[G],X[Z],X[aa]);var k=[],K,da=$.concat();x=0;for(I=u.length;x<I;x++){C=u[x];K=[];G=0;H=C.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),K[G]=f(C[G],C[Z],C[aa]);k.push(K);da=da.concat(K)}for(L=0;L<o;L++){O=L/o;P=p*(1-O);O=t*Math.sin(O*Math.PI/2);G=0;for(H=X.length;G<H;G++)N=e(X[G],$[G],O),j(N.x,N.y,-P);x=0;for(I=u.length;x<I;x++){C=u[x];K=k[x];G=0;for(H=C.length;G<H;G++)N=e(C[G],K[G],O),j(N.x,N.y,-P)}}O=t;for(G=0;G<Q;G++)N=n?e(F[G],da[G],O):F[G],w?j(N.x,N.y+y[0].y,y[0].x):
|
|
|
|
-j(N.x,N.y,0);for(L=1;L<=v;L++)for(G=0;G<Q;G++)N=n?e(F[G],da[G],O):F[G],w?j(N.x,N.y+y[L-1].y,y[L-1].x):j(N.x,N.y,m/v*L);for(L=o-1;L>=0;L--){O=L/o;P=p*(1-O);O=t*Math.sin(O*Math.PI/2);G=0;for(H=X.length;G<H;G++)N=e(X[G],$[G],O),j(N.x,N.y,m+P);x=0;for(I=u.length;x<I;x++){C=u[x];K=k[x];G=0;for(H=C.length;G<H;G++)N=e(C[G],K[G],O),w?j(N.x,N.y+y[v-1].y,y[v-1].x+P):j(N.x,N.y,m+P)}}if(n){p=Q*0;for(G=0;G<S;G++)m=A[G],h(m[2]+p,m[1]+p,m[0]+p);p=Q*(v+o*2);for(G=0;G<S;G++)m=A[G],h(m[0]+p,m[1]+p,m[2]+p)}else{for(G=
|
|
|
|
-0;G<S;G++)m=A[G],h(m[2],m[1],m[0]);for(G=0;G<S;G++)m=A[G],h(m[0]+Q*v,m[1]+Q*v,m[2]+Q*v)}var Z,aa,ha=0;g(X);ha+=X.length;x=0;for(I=u.length;x<I;x++)C=u[x],g(C),ha+=C.length;this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);k.copy(b).addSelf(g);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
|
|
|
|
+k.copy(c).addSelf(g);m.copy(e).addSelf(j);g=f.dot(j);j=m.subSelf(k).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(G=b.length;--G>=0;){Z=G;aa=G-1;aa<0&&(aa=b.length-
|
|
|
|
+1);for(var c=0,c=0;c<v+o*2;c++){var e=R*c,f=R*(c+1),h=ha+Z+e,e=ha+aa+e,g=ha+aa+f,f=ha+Z+f;h+=J;e+=J;g+=J;f+=J;A.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){A.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=J;c+=J;e+=J;A.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,n=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
+!0,v=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,y,w=!1;if(u)y=u.getPoints(),v=y.length,w=!0,n=!1;n||(t=p=o=0);var B,x,I,A=this,J=this.vertices.length,u=b.extractAllPoints(),F=u.shape,u=u.holes,E=!THREE.Shape.Utils.isClockWise(F);if(E){F=F.reverse();x=0;for(I=u.length;x<I;x++)B=u[x],THREE.Shape.Utils.isClockWise(B)&&(u[x]=B.reverse());E=!1}var E=THREE.Shape.Utils.triangulateShape(F,u),X=F;x=0;for(I=u.length;x<I;x++)B=u[x],F=F.concat(B);var G,H,M,P,Q,O,R=F.length,T=E.length,$=[];G=0;H=
|
|
|
|
+X.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),$[G]=f(X[G],X[Z],X[aa]);var k=[],K,da=$.concat();x=0;for(I=u.length;x<I;x++){B=u[x];K=[];G=0;H=B.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),K[G]=f(B[G],B[Z],B[aa]);k.push(K);da=da.concat(K)}for(M=0;M<o;M++){P=M/o;Q=p*(1-P);P=t*Math.sin(P*Math.PI/2);G=0;for(H=X.length;G<H;G++)O=e(X[G],$[G],P),j(O.x,O.y,-Q);x=0;for(I=u.length;x<I;x++){B=u[x];K=k[x];G=0;for(H=B.length;G<H;G++)O=e(B[G],K[G],P),j(O.x,O.y,-Q)}}P=
|
|
|
|
+t;for(G=0;G<R;G++)O=n?e(F[G],da[G],P):F[G],w?j(O.x,O.y+y[0].y,y[0].x):j(O.x,O.y,0);for(M=1;M<=v;M++)for(G=0;G<R;G++)O=n?e(F[G],da[G],P):F[G],w?j(O.x,O.y+y[M-1].y,y[M-1].x):j(O.x,O.y,m/v*M);for(M=o-1;M>=0;M--){P=M/o;Q=p*(1-P);P=t*Math.sin(P*Math.PI/2);G=0;for(H=X.length;G<H;G++)O=e(X[G],$[G],P),j(O.x,O.y,m+Q);x=0;for(I=u.length;x<I;x++){B=u[x];K=k[x];G=0;for(H=B.length;G<H;G++)O=e(B[G],K[G],P),w?j(O.x,O.y+y[v-1].y,y[v-1].x+Q):j(O.x,O.y,m+Q)}}if(n){p=R*0;for(G=0;G<T;G++)m=E[G],h(m[2]+p,m[1]+p,m[0]+
|
|
|
|
+p);p=R*(v+o*2);for(G=0;G<T;G++)m=E[G],h(m[0]+p,m[1]+p,m[2]+p)}else{for(G=0;G<T;G++)m=E[G],h(m[2],m[1],m[0]);for(G=0;G<T;G++)m=E[G],h(m[0]+R*v,m[1]+R*v,m[2]+R*v)}var Z,aa,ha=0;g(X);ha+=X.length;x=0;for(I=u.length;x<I;x++)B=u[x],g(B),ha+=B.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
|
+THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,j=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,j=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in j.faces){var p=f(j.faces[m].a,j.faces[m].b),t=f(j.faces[m].b,j.faces[m].c),o=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,p,o,h);e(j.faces[m].b,t,p,h);
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in j.faces){var p=f(j.faces[m].a,j.faces[m].b),t=f(j.faces[m].b,j.faces[m].c),o=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,p,o,h);e(j.faces[m].b,t,p,h);
|
|
e(j.faces[m].c,o,t,h);e(p,t,o,h)}j.faces=h.faces}g.faces=j.faces;delete j;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
e(j.faces[m].c,o,t,h);e(p,t,o,h)}j.faces=h.faces}g.faces=j.faces;delete j;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
@@ -501,15 +502,15 @@ for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m]
|
|
THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,m=e+1,p=f+1;b/=e;var t=c/f;for(g=0;g<p;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*t-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,m=e+1,p=f+1;b/=e;var t=c/f;for(g=0;g<p;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*t-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,j=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),p=b*Math.sin(f*g),t=[],o=0;for(f=0;f<j;f++){var n=2*f/j,v=p*Math.sin(n*g),n=p*Math.cos(n*g);(e==0||e==h)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,m,v)))-1);t.push(o)}c.push(t)}for(var u,y,w,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){t=f==j-1;h=c[e][t?0:f+1];m=c[e][t?j-1:f];p=c[e-1][t?
|
|
THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,j=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),p=b*Math.sin(f*g),t=[],o=0;for(f=0;f<j;f++){var n=2*f/j,v=p*Math.sin(n*g),n=p*Math.cos(n*g);(e==0||e==h)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,m,v)))-1);t.push(o)}c.push(t)}for(var u,y,w,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){t=f==j-1;h=c[e][t?0:f+1];m=c[e][t?j-1:f];p=c[e-1][t?
|
|
-j-1:f];t=c[e-1][t?0:f+1];v=e/(g-1);u=(e-1)/(g-1);y=(f+1)/j;var n=f/j,o=new THREE.UV(1-y,v),v=new THREE.UV(1-n,v),n=new THREE.UV(1-n,u),C=new THREE.UV(1-y,u);e<c.length-1&&(u=this.vertices[h].position.clone(),y=this.vertices[m].position.clone(),w=this.vertices[p].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([o,v,n]));e>1&&(u=
|
|
|
|
-this.vertices[h].position.clone(),y=this.vertices[p].position.clone(),w=this.vertices[t].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,p,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([o,n,C]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+j-1:f];t=c[e-1][t?0:f+1];v=e/(g-1);u=(e-1)/(g-1);y=(f+1)/j;var n=f/j,o=new THREE.UV(1-y,v),v=new THREE.UV(1-n,v),n=new THREE.UV(1-n,u),B=new THREE.UV(1-y,u);e<c.length-1&&(u=this.vertices[h].position.clone(),y=this.vertices[m].position.clone(),w=this.vertices[p].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([o,v,n]));e>1&&(u=
|
|
|
|
+this.vertices[h].position.clone(),y=this.vertices[p].position.clone(),w=this.vertices[t].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,p,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([o,n,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
|
|
-this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(g[b],c,e,f,m);f+=m.offset;h.push(m.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,m,p,t,o,n,v,u,y,w,C=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(C){if(C.o){c=C._cachedOutline||(C._cachedOutline=C.o.split(" "));p=c.length;for(b=0;b<p;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(m,
|
|
|
|
|
|
+this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(g[b],c,e,f,m);f+=m.offset;h.push(m.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,m,p,t,o,n,v,u,y,w,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));p=c.length;for(b=0;b<p;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(m,
|
|
t));g.moveTo(m,t);break;case "l":m=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(m,t));g.lineTo(m,t);break;case "q":m=c[b++]*e+f;t=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;g.quadraticCurveTo(v,u,m,t);if(h=j[j.length-1]){o=h.x;n=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var x=h/divisions,I=THREE.Shape.Utils.b2(x,o,v,m),x=THREE.Shape.Utils.b2(x,n,u,t);j.push(new THREE.Vector2(I,x))}}break;case "b":if(m=c[b++]*e+f,t=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,y=c[b++]*e+f,w=c[b++]*-e,g.bezierCurveTo(m,t,
|
|
t));g.moveTo(m,t);break;case "l":m=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(m,t));g.lineTo(m,t);break;case "q":m=c[b++]*e+f;t=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;g.quadraticCurveTo(v,u,m,t);if(h=j[j.length-1]){o=h.x;n=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var x=h/divisions,I=THREE.Shape.Utils.b2(x,o,v,m),x=THREE.Shape.Utils.b2(x,n,u,t);j.push(new THREE.Vector2(I,x))}}break;case "b":if(m=c[b++]*e+f,t=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,y=c[b++]*e+f,w=c[b++]*-e,g.bezierCurveTo(m,t,
|
|
-v,u,y,w),h=j[j.length-1]){o=h.x;n=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)x=h/divisions,I=THREE.Shape.Utils.b3(x,o,v,y,m),x=THREE.Shape.Utils.b3(x,n,u,w,t),j.push(new THREE.Vector2(I,x))}}}return{offset:C.ha*e,points:j,path:g}}}};
|
|
|
|
-(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],m=[],p,t,o;if(c(b)>0)for(t=0;t<g;t++)h[t]=t;else for(t=0;t<g;t++)h[t]=g-1-t;var n=2*g;for(t=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}p=t;g<=p&&(p=0);t=p+1;g<=t&&(t=0);o=t+1;g<=o&&(o=0);var v;a:{v=b;var u=p,y=t,w=o,C=g,x=h,I=void 0,B=void 0,J=void 0,
|
|
|
|
-F=void 0,A=void 0,X=void 0,G=void 0,H=void 0,L=void 0,B=v[x[u]].x,J=v[x[u]].y,F=v[x[y]].x,A=v[x[y]].y,X=v[x[w]].x,G=v[x[w]].y;if(1.0E-10>(F-B)*(G-J)-(A-J)*(X-B))v=!1;else{for(I=0;I<C;I++)if(!(I==u||I==y||I==w)){var H=v[x[I]].x,L=v[x[I]].y,O=void 0,P=void 0,N=void 0,Q=void 0,S=void 0,$=void 0,k=void 0,K=void 0,da=void 0,Z=void 0,aa=void 0,ha=void 0,O=N=S=void 0,O=X-F,P=G-A,N=B-X,Q=J-G,S=F-B,$=A-J,k=H-B,K=L-J,da=H-F,Z=L-A,aa=H-X,ha=L-G,O=O*Z-P*da,S=S*K-$*k,N=N*ha-Q*aa;if(O>=0&&N>=0&&S>=0){v=!1;break a}}v=
|
|
|
|
|
|
+v,u,y,w),h=j[j.length-1]){o=h.x;n=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)x=h/divisions,I=THREE.Shape.Utils.b3(x,o,v,y,m),x=THREE.Shape.Utils.b3(x,n,u,w,t),j.push(new THREE.Vector2(I,x))}}}return{offset:B.ha*e,points:j,path:g}}}};
|
|
|
|
+(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],m=[],p,t,o;if(c(b)>0)for(t=0;t<g;t++)h[t]=t;else for(t=0;t<g;t++)h[t]=g-1-t;var n=2*g;for(t=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}p=t;g<=p&&(p=0);t=p+1;g<=t&&(t=0);o=t+1;g<=o&&(o=0);var v;a:{v=b;var u=p,y=t,w=o,B=g,x=h,I=void 0,A=void 0,J=void 0,
|
|
|
|
+F=void 0,E=void 0,X=void 0,G=void 0,H=void 0,M=void 0,A=v[x[u]].x,J=v[x[u]].y,F=v[x[y]].x,E=v[x[y]].y,X=v[x[w]].x,G=v[x[w]].y;if(1.0E-10>(F-A)*(G-J)-(E-J)*(X-A))v=!1;else{for(I=0;I<B;I++)if(!(I==u||I==y||I==w)){var H=v[x[I]].x,M=v[x[I]].y,P=void 0,Q=void 0,O=void 0,R=void 0,T=void 0,$=void 0,k=void 0,K=void 0,da=void 0,Z=void 0,aa=void 0,ha=void 0,P=O=T=void 0,P=X-F,Q=G-E,O=A-X,R=J-G,T=F-A,$=E-J,k=H-A,K=M-J,da=H-F,Z=M-E,aa=H-X,ha=M-G,P=P*Z-Q*da,T=T*K-$*k,O=O*ha-R*aa;if(P>=0&&O>=0&&T>=0){v=!1;break a}}v=
|
|
!0}}if(v){j.push([b[h[p]],b[h[t]],b[h[o]]]);m.push([h[p],h[t],h[o]]);p=t;for(o=t+1;o<g;p++,o++)h[p]=h[o];g--;n=2*g}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
!0}}if(v){j.push([b[h[p]],b[h[t]],b[h[o]]]);m.push([h[p],h[t],h[o]]);p=t;for(o=t+1;o<g;p++,o++)h[p]=h[o];g--;n=2*g}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
@@ -527,53 +528,53 @@ else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpe
|
|
b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var t=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(t.uniforms),n=h.color;m=h.specular;p=h.ambient;var v=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
|
|
b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var t=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(t.uniforms),n=h.color;m=h.specular;p=h.ambient;var v=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
|
|
h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(n);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(p);o.uShininess.value=v;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(n);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(p);o.uShininess.value=v;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,p,t,o,n,v,u,y,w,C,x,I,B,J=b.faces;n=b.vertices;var F=b.normals,A=b.colors,X=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&X++;for(e=0;e<X;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(o=n.length;t<o;)v=new THREE.Vertex,v.position.x=n[t++]*c,v.position.y=
|
|
|
|
-n[t++]*c,v.position.z=n[t++]*c,f.vertices.push(v);t=0;for(o=J.length;t<o;){c=J[t++];n=c&1;p=c&2;e=c&4;g=c&8;u=c&16;v=c&32;w=c&64;c&=128;n?(C=new THREE.Face4,C.a=J[t++],C.b=J[t++],C.c=J[t++],C.d=J[t++],n=4):(C=new THREE.Face3,C.a=J[t++],C.b=J[t++],C.c=J[t++],n=3);if(p)p=J[t++],C.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<X;e++)x=b.uvs[e],y=J[t++],B=x[y*2],y=x[y*2+1],f.faceUvs[e][p]=new THREE.UV(B,y);if(g)for(e=0;e<X;e++){x=b.uvs[e];I=[];for(g=0;g<n;g++)y=J[t++],B=x[y*2],y=x[y*2+1],I[g]=
|
|
|
|
-new THREE.UV(B,y);f.faceVertexUvs[e][p]=I}if(u)u=J[t++]*3,g=new THREE.Vector3,g.x=F[u++],g.y=F[u++],g.z=F[u],C.normal=g;if(v)for(e=0;e<n;e++)u=J[t++]*3,g=new THREE.Vector3,g.x=F[u++],g.y=F[u++],g.z=F[u],C.vertexNormals.push(g);if(w)v=J[t++],v=new THREE.Color(A[v]),C.color=v;if(c)for(e=0;e<n;e++)v=J[t++],v=new THREE.Color(A[v]),C.vertexColors.push(v);f.faces.push(C)}}})(g);(function(){var c,e,g,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,p,t,o,n,v,u,y,w,B,x,I,A,J=b.faces;n=b.vertices;var F=b.normals,E=b.colors,X=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&X++;for(e=0;e<X;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(o=n.length;t<o;)v=new THREE.Vertex,v.position.x=n[t++]*c,v.position.y=
|
|
|
|
+n[t++]*c,v.position.z=n[t++]*c,f.vertices.push(v);t=0;for(o=J.length;t<o;){c=J[t++];n=c&1;p=c&2;e=c&4;g=c&8;u=c&16;v=c&32;w=c&64;c&=128;n?(B=new THREE.Face4,B.a=J[t++],B.b=J[t++],B.c=J[t++],B.d=J[t++],n=4):(B=new THREE.Face3,B.a=J[t++],B.b=J[t++],B.c=J[t++],n=3);if(p)p=J[t++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<X;e++)x=b.uvs[e],y=J[t++],A=x[y*2],y=x[y*2+1],f.faceUvs[e][p]=new THREE.UV(A,y);if(g)for(e=0;e<X;e++){x=b.uvs[e];I=[];for(g=0;g<n;g++)y=J[t++],A=x[y*2],y=x[y*2+1],I[g]=
|
|
|
|
+new THREE.UV(A,y);f.faceVertexUvs[e][p]=I}if(u)u=J[t++]*3,g=new THREE.Vector3,g.x=F[u++],g.y=F[u++],g.z=F[u],B.normal=g;if(v)for(e=0;e<n;e++)u=J[t++]*3,g=new THREE.Vector3,g.x=F[u++],g.y=F[u++],g.z=F[u],B.vertexNormals.push(g);if(w)v=J[t++],v=new THREE.Color(E[v]),B.color=v;if(c)for(e=0;e<n;e++)v=J[t++],v=new THREE.Color(E[v]),B.vertexColors.push(v);f.faces.push(B)}}})(g);(function(){var c,e,g,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,p,t,o,n,v,u,y;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;p=0;for(t=y.length;p<t;p+=3)o=y[p]*c,n=y[p+1]*
|
|
p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,p,t,o,n,v,u,y;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;p=0;for(t=y.length;p<t;p+=3)o=y[p]*c,n=y[p+1]*
|
|
c,v=y[p+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,n,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];t=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(p=o.length;c<p;c+=3)n=new THREE.Color(16755200),n.setRGB(o[c],o[c+1],o[c+2]),t.push(n)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
c,v=y[p+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,n,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];t=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(p=o.length;c<p;c+=3)n=new THREE.Color(16755200),n.setRGB(o[c],o[c+1],o[c+2]),t.push(n)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,m=f+"/"+b,p=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?j&&(p==0&&(p=h.getResponseHeader("Content-Length")),j({total:p,loaded:h.responseText.length})):h.readyState==2&&(p=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,m=f+"/"+b,p=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?j&&(p==0&&(p=h.getResponseHeader("Content-Length")),j({total:p,loaded:h.responseText.length})):h.readyState==2&&(p=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function t(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
|
|
h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function t(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
|
|
-c){return b.charCodeAt(c)&255}function n(c){var e,f,h;e=g(b,c);f=g(b,c+A);h=g(b,c+X);c=p(b,c+G);THREE.BinaryLoader.prototype.f3(x,e,f,h,c)}function v(c){var e,f,h,j,k,n;e=g(b,c);f=g(b,c+A);h=g(b,c+X);j=p(b,c+G);k=g(b,c+H);n=g(b,c+L);c=g(b,c+O);THREE.BinaryLoader.prototype.f3n(x,J,e,f,h,j,k,n,c)}function u(c){var e,f,h,j;e=g(b,c);f=g(b,c+P);h=g(b,c+N);j=g(b,c+Q);c=p(b,c+S);THREE.BinaryLoader.prototype.f4(x,e,f,h,j,c)}function y(c){var e,f,h,j,n,o,t,u;e=g(b,c);f=g(b,c+P);h=g(b,c+N);j=g(b,c+Q);n=p(b,
|
|
|
|
-c+S);o=g(b,c+$);t=g(b,c+k);u=g(b,c+K);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(x,J,e,f,h,j,n,o,t,u,c)}function w(c){var e,f;e=g(b,c);f=g(b,c+Z);c=g(b,c+aa);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[c*2],F[c*2+1])}function C(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+la);c=g(b,c+fa);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[h*2],F[h*2+1],F[c*2],F[c*2+1])}var x=this,I=0,B,J=[],F=[],A,X,G,H,L,O,P,N,Q,S,$,k,K,da,
|
|
|
|
-Z,aa,ha,la,fa,pa,D,ea,ca,ja,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,f,c);B={signature:b.substr(I,8),header_bytes:o(b,I+8),vertex_coordinate_bytes:o(b,I+9),normal_coordinate_bytes:o(b,I+10),uv_coordinate_bytes:o(b,I+11),vertex_index_bytes:o(b,I+12),normal_index_bytes:o(b,I+13),uv_index_bytes:o(b,I+14),material_index_bytes:o(b,I+15),nvertices:g(b,I+16),nnormals:g(b,I+16+4),nuvs:g(b,I+16+8),ntri_flat:g(b,I+16+12),ntri_smooth:g(b,I+16+16),ntri_flat_uv:g(b,I+16+20),ntri_smooth_uv:g(b,
|
|
|
|
-I+16+24),nquad_flat:g(b,I+16+28),nquad_smooth:g(b,I+16+32),nquad_flat_uv:g(b,I+16+36),nquad_smooth_uv:g(b,I+16+40)};I+=B.header_bytes;A=B.vertex_index_bytes;X=B.vertex_index_bytes*2;G=B.vertex_index_bytes*3;H=B.vertex_index_bytes*3+B.material_index_bytes;L=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;O=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;P=B.vertex_index_bytes;N=B.vertex_index_bytes*2;Q=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;$=B.vertex_index_bytes*
|
|
|
|
-4+B.material_index_bytes;k=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;K=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;da=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;Z=B.uv_index_bytes;aa=B.uv_index_bytes*2;ha=B.uv_index_bytes;la=B.uv_index_bytes*2;fa=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;na=B.vertex_index_bytes*4+B.material_index_bytes;pa=B.ntri_flat*c;D=B.ntri_smooth*(c+B.normal_index_bytes*3);ea=
|
|
|
|
-B.ntri_flat_uv*(c+B.uv_index_bytes*3);ca=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);ja=B.nquad_flat*na;c=B.nquad_smooth*(na+B.normal_index_bytes*4);na=B.nquad_flat_uv*(na+B.uv_index_bytes*4);I+=function(c){for(var f,g,j,k=B.vertex_coordinate_bytes*3,m=c+B.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+B.vertex_coordinate_bytes),j=e(b,c+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,f,g,j);return B.nvertices*k}(I);I+=function(c){for(var e,f,g,h=B.normal_coordinate_bytes*3,
|
|
|
|
-j=c+B.nnormals*h;c<j;c+=h)e=t(b,c),f=t(b,c+B.normal_coordinate_bytes),g=t(b,c+B.normal_coordinate_bytes*2),J.push(e/127,f/127,g/127);return B.nnormals*h}(I);I+=function(c){for(var f,g,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+B.uv_coordinate_bytes),F.push(f,g);return B.nuvs*j}(I);pa=I+pa;D=pa+D;ea=D+ea;ca=ea+ca;ja=ca+ja;c=ja+c;na=c+na;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)n(c),w(c+e);return g-
|
|
|
|
-b})(D);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),w(c+e);return g-b})(ea);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),C(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)y(c),
|
|
|
|
-C(c+e);return g-b})(na);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)n(c);return f-b})(I);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(pa);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ca);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
|
|
|
|
-4,f=b+B.nquad_smooth*e;for(c=b;c<f;c+=e)y(c);return f-b})(ja);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},
|
|
|
|
-f3n:function(b,c,e,f,g,j,h,m,p){var j=b.materials[j],t=c[m*3],o=c[m*3+1],m=c[m*3+2],n=c[p*3],v=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(t,o,m),new THREE.Vector3(n,v,p)],null,j))},f4n:function(b,c,e,f,g,j,h,m,p,t,o){var h=b.materials[h],n=c[p*3],v=c[p*3+1],p=c[p*3+2],u=c[t*3],y=c[t*3+1],t=c[t*3+2],w=c[o*3],C=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(n,
|
|
|
|
-v,p),new THREE.Vector3(u,y,t),new THREE.Vector3(w,C,o)],null,h))},uv3:function(b,c,e,f,g,j,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));b.push(m)},uv4:function(b,c,e,f,g,j,h,m,p){var t=[];t.push(new THREE.UV(c,e));t.push(new THREE.UV(f,g));t.push(new THREE.UV(j,h));t.push(new THREE.UV(m,p));b.push(t)}};
|
|
|
|
|
|
+c){return b.charCodeAt(c)&255}function n(c){var e,f,h;e=g(b,c);f=g(b,c+E);h=g(b,c+X);c=p(b,c+G);THREE.BinaryLoader.prototype.f3(x,e,f,h,c)}function v(c){var e,f,h,j,k,n;e=g(b,c);f=g(b,c+E);h=g(b,c+X);j=p(b,c+G);k=g(b,c+H);n=g(b,c+M);c=g(b,c+P);THREE.BinaryLoader.prototype.f3n(x,J,e,f,h,j,k,n,c)}function u(c){var e,f,h,j;e=g(b,c);f=g(b,c+Q);h=g(b,c+O);j=g(b,c+R);c=p(b,c+T);THREE.BinaryLoader.prototype.f4(x,e,f,h,j,c)}function y(c){var e,f,h,j,n,o,t,u;e=g(b,c);f=g(b,c+Q);h=g(b,c+O);j=g(b,c+R);n=p(b,
|
|
|
|
+c+T);o=g(b,c+$);t=g(b,c+k);u=g(b,c+K);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(x,J,e,f,h,j,n,o,t,u,c)}function w(c){var e,f;e=g(b,c);f=g(b,c+Z);c=g(b,c+aa);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[c*2],F[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+la);c=g(b,c+ea);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[h*2],F[h*2+1],F[c*2],F[c*2+1])}var x=this,I=0,A,J=[],F=[],E,X,G,H,M,P,Q,O,R,T,$,k,K,da,
|
|
|
|
+Z,aa,ha,la,ea,fa,C,ia,na,ca,oa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,f,c);A={signature:b.substr(I,8),header_bytes:o(b,I+8),vertex_coordinate_bytes:o(b,I+9),normal_coordinate_bytes:o(b,I+10),uv_coordinate_bytes:o(b,I+11),vertex_index_bytes:o(b,I+12),normal_index_bytes:o(b,I+13),uv_index_bytes:o(b,I+14),material_index_bytes:o(b,I+15),nvertices:g(b,I+16),nnormals:g(b,I+16+4),nuvs:g(b,I+16+8),ntri_flat:g(b,I+16+12),ntri_smooth:g(b,I+16+16),ntri_flat_uv:g(b,I+16+20),ntri_smooth_uv:g(b,
|
|
|
|
+I+16+24),nquad_flat:g(b,I+16+28),nquad_smooth:g(b,I+16+32),nquad_flat_uv:g(b,I+16+36),nquad_smooth_uv:g(b,I+16+40)};I+=A.header_bytes;E=A.vertex_index_bytes;X=A.vertex_index_bytes*2;G=A.vertex_index_bytes*3;H=A.vertex_index_bytes*3+A.material_index_bytes;M=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;P=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;Q=A.vertex_index_bytes;O=A.vertex_index_bytes*2;R=A.vertex_index_bytes*3;T=A.vertex_index_bytes*4;$=A.vertex_index_bytes*
|
|
|
|
+4+A.material_index_bytes;k=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;K=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;da=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;Z=A.uv_index_bytes;aa=A.uv_index_bytes*2;ha=A.uv_index_bytes;la=A.uv_index_bytes*2;ea=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;oa=A.vertex_index_bytes*4+A.material_index_bytes;fa=A.ntri_flat*c;C=A.ntri_smooth*(c+A.normal_index_bytes*3);ia=
|
|
|
|
+A.ntri_flat_uv*(c+A.uv_index_bytes*3);na=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ca=A.nquad_flat*oa;c=A.nquad_smooth*(oa+A.normal_index_bytes*4);oa=A.nquad_flat_uv*(oa+A.uv_index_bytes*4);I+=function(c){for(var f,g,j,k=A.vertex_coordinate_bytes*3,m=c+A.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+A.vertex_coordinate_bytes),j=e(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,f,g,j);return A.nvertices*k}(I);I+=function(c){for(var e,f,g,h=A.normal_coordinate_bytes*3,
|
|
|
|
+j=c+A.nnormals*h;c<j;c+=h)e=t(b,c),f=t(b,c+A.normal_coordinate_bytes),g=t(b,c+A.normal_coordinate_bytes*2),J.push(e/127,f/127,g/127);return A.nnormals*h}(I);I+=function(c){for(var f,g,j=A.uv_coordinate_bytes*2,k=c+A.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+A.uv_coordinate_bytes),F.push(f,g);return A.nuvs*j}(I);fa=I+fa;C=fa+C;ia=C+ia;na=ia+na;ca=na+ca;c=ca+c;oa=c+oa;(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=e+A.uv_index_bytes*3,g=b+A.ntri_flat_uv*f;for(c=b;c<g;c+=f)n(c),w(c+e);return g-
|
|
|
|
+b})(C);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=e+A.uv_index_bytes*3,g=b+A.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),w(c+e);return g-b})(ia);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=e+A.uv_index_bytes*4,g=b+A.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),B(c+e);return g-b})(c);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=e+A.uv_index_bytes*4,g=b+A.nquad_smooth_uv*f;for(c=b;c<g;c+=f)y(c),
|
|
|
|
+B(c+e);return g-b})(oa);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=b+A.ntri_flat*e;for(c=b;c<f;c+=e)n(c);return f-b})(I);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=b+A.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(fa);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=b+A.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(na);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*
|
|
|
|
+4,f=b+A.nquad_smooth*e;for(c=b;c<f;c+=e)y(c);return f-b})(ca);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},
|
|
|
|
+f3n:function(b,c,e,f,g,j,h,m,p){var j=b.materials[j],t=c[m*3],o=c[m*3+1],m=c[m*3+2],n=c[p*3],v=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(t,o,m),new THREE.Vector3(n,v,p)],null,j))},f4n:function(b,c,e,f,g,j,h,m,p,t,o){var h=b.materials[h],n=c[p*3],v=c[p*3+1],p=c[p*3+2],u=c[t*3],y=c[t*3+1],t=c[t*3+2],w=c[o*3],B=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(n,
|
|
|
|
+v,p),new THREE.Vector3(u,y,t),new THREE.Vector3(w,B,o)],null,h))},uv3:function(b,c,e,f,g,j,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));b.push(m)},uv4:function(b,c,e,f,g,j,h,m,p){var t=[];t.push(new THREE.UV(c,e));t.push(new THREE.UV(f,g));t.push(new THREE.UV(j,h));t.push(new THREE.UV(m,p));b.push(t)}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(u in P.objects)if(!K.objects[u])if(I=P.objects[u],I.geometry!==void 0){if(A=K.geometries[I.geometry]){var b=!1;L=[];for(Z=0;Z<I.materials.length;Z++)L[Z]=K.materials[I.materials[Z]],b=L[Z]instanceof THREE.MeshShaderMaterial;b&&A.computeTangents();B=I.position;r=I.rotation;
|
|
|
|
-q=I.quaternion;s=I.scale;q=0;L.length==0&&(L[0]=new THREE.MeshFaceMaterial);L.length>1&&(L=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(A,L);object.name=u;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=I.visible;K.scene.addObject(object);K.objects[u]=object;I.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
|
|
|
|
-if(I.castsShadow)b=new THREE.ShadowVolume(A),K.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},K.triggers[object.name]=b)}}else B=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
|
-s[1],s[2]),object.visible=I.visible!==void 0?I.visible:!1,K.scene.addObject(object),K.objects[u]=object,K.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},K.triggers[object.name]=b)}function p(b){return function(c){K.geometries[b]=c;m();Q-=1;e.onLoadComplete();o()}}function t(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:$,totalTextures:k,loadedModels:$-Q,loadedTextures:k-S},K);e.onLoadProgress();Q==0&&S==0&&c(K)}var n,
|
|
|
|
-v,u,y,w,C,x,I,B,J,F,A,X,G,H,L,O,P,N,Q,S,$,k,K;P=b.data;H=new THREE.BinaryLoader;N=new THREE.JSONLoader;S=Q=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in P.objects)if(I=P.objects[u],I.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;J=P.transform.rotation;var da=P.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);J&&K.scene.rotation.set(J[0],
|
|
|
|
-J[1],J[2]);da&&K.scene.scale.set(da[0],da[1],da[2]);(b||J||da)&&K.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(w in P.cameras){J=P.cameras[w];if(J.type=="perspective")X=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")X=new THREE.Camera,X.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);B=J.position;J=J.target;X.position.set(B[0],B[1],B[2]);X.target.position.set(J[0],J[1],J[2]);K.cameras[w]=X}for(y in P.lights)w=P.lights[y],
|
|
|
|
-X=w.color!==void 0?w.color:16777215,J=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(B=w.direction,O=new THREE.DirectionalLight(X,J),O.position.set(B[0],B[1],B[2]),O.position.normalize()):w.type=="point"?(B=w.position,d=w.distance,O=new THREE.PointLight(X,J,d),O.position.set(B[0],B[1],B[2])):w.type=="ambient"&&(O=new THREE.AmbientLight(X)),K.scene.addLight(O),K.lights[y]=O;for(C in P.fogs)y=P.fogs[C],y.type=="linear"?G=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(G=new THREE.FogExp2(0,
|
|
|
|
-y.density)),J=y.color,G.color.setRGB(J[0],J[1],J[2]),K.fogs[C]=G;if(K.cameras&&P.defaults.camera)K.currentCamera=K.cameras[P.defaults.camera];if(K.fogs&&P.defaults.fog)K.scene.fog=K.fogs[P.defaults.fog];J=P.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(J[0],J[1],J[2]);K.bgColorAlpha=P.defaults.bgalpha;for(n in P.geometries)if(C=P.geometries[n],C.type=="bin_mesh"||C.type=="ascii_mesh")Q+=1,e.onLoadStart();$=Q;for(n in P.geometries)C=P.geometries[n],C.type=="cube"?(A=new THREE.CubeGeometry(C.width,
|
|
|
|
-C.height,C.depth,C.segmentsWidth,C.segmentsHeight,C.segmentsDepth,null,C.flipped,C.sides),K.geometries[n]=A):C.type=="plane"?(A=new THREE.PlaneGeometry(C.width,C.height,C.segmentsWidth,C.segmentsHeight),K.geometries[n]=A):C.type=="sphere"?(A=new THREE.SphereGeometry(C.radius,C.segmentsWidth,C.segmentsHeight),K.geometries[n]=A):C.type=="cylinder"?(A=new THREE.CylinderGeometry(C.numSegs,C.topRad,C.botRad,C.height,C.topOffset,C.botOffset),K.geometries[n]=A):C.type=="torus"?(A=new THREE.TorusGeometry(C.radius,
|
|
|
|
-C.tube,C.segmentsR,C.segmentsT),K.geometries[n]=A):C.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(C.subdivisions),K.geometries[n]=A):C.type=="bin_mesh"?H.load({model:f(C.url,P.urlBaseType),callback:p(n)}):C.type=="ascii_mesh"?N.load({model:f(C.url,P.urlBaseType),callback:p(n)}):C.type=="embedded_mesh"&&(C=P.embeds[C.id])&&N.createModel(C,t(n),"");for(x in P.textures)if(n=P.textures[x],n.url instanceof Array){S+=n.url.length;for(H=0;H<n.url.length;H++)e.onLoadStart()}else S+=1,e.onLoadStart();
|
|
|
|
-k=S;for(x in P.textures){n=P.textures[x];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){H=[];for(var Z=0;Z<n.url.length;Z++)H[Z]=f(n.url[Z],P.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,n.mapping,b)}else{H=THREE.ImageUtils.loadTexture(f(n.url,P.urlBaseType),n.mapping,b);if(THREE[n.minFilter]!=void 0)H.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)H.magFilter=THREE[n.magFilter];if(n.repeat){H.repeat.set(n.repeat[0],n.repeat[1]);
|
|
|
|
-if(n.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}n.offset&&H.offset.set(n.offset[0],n.offset[1]);if(n.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[n.wrap[0]]!==void 0)H.wrapS=N[n.wrap[0]];if(N[n.wrap[1]]!==void 0)H.wrapT=N[n.wrap[1]]}}K.textures[x]=H}for(v in P.materials){x=P.materials[v];for(F in x.parameters)if(F=="envMap"||F=="map"||F=="lightMap")x.parameters[F]=K.textures[x.parameters[F]];else if(F=="shading")x.parameters[F]=
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(u in Q.objects)if(!K.objects[u])if(I=Q.objects[u],I.geometry!==void 0){if(E=K.geometries[I.geometry]){var b=!1;M=[];for(Z=0;Z<I.materials.length;Z++)M[Z]=K.materials[I.materials[Z]],b=M[Z]instanceof THREE.MeshShaderMaterial;b&&E.computeTangents();A=I.position;r=I.rotation;
|
|
|
|
+q=I.quaternion;s=I.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,M);object.name=u;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=I.visible;K.scene.addObject(object);K.objects[u]=object;I.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
|
|
|
|
+if(I.castsShadow)b=new THREE.ShadowVolume(E),K.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},K.triggers[object.name]=b)}}else A=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
|
+s[1],s[2]),object.visible=I.visible!==void 0?I.visible:!1,K.scene.addObject(object),K.objects[u]=object,K.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},K.triggers[object.name]=b)}function p(b){return function(c){K.geometries[b]=c;m();R-=1;e.onLoadComplete();o()}}function t(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:$,totalTextures:k,loadedModels:$-R,loadedTextures:k-T},K);e.onLoadProgress();R==0&&T==0&&c(K)}var n,
|
|
|
|
+v,u,y,w,B,x,I,A,J,F,E,X,G,H,M,P,Q,O,R,T,$,k,K;Q=b.data;H=new THREE.BinaryLoader;O=new THREE.JSONLoader;T=R=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in Q.objects)if(I=Q.objects[u],I.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;J=Q.transform.rotation;var da=Q.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);J&&K.scene.rotation.set(J[0],
|
|
|
|
+J[1],J[2]);da&&K.scene.scale.set(da[0],da[1],da[2]);(b||J||da)&&K.scene.updateMatrix()}b=function(){T-=1;o();e.onLoadComplete()};for(w in Q.cameras){J=Q.cameras[w];if(J.type=="perspective")X=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")X=new THREE.Camera,X.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);A=J.position;J=J.target;X.position.set(A[0],A[1],A[2]);X.target.position.set(J[0],J[1],J[2]);K.cameras[w]=X}for(y in Q.lights)w=Q.lights[y],
|
|
|
|
+X=w.color!==void 0?w.color:16777215,J=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(A=w.direction,P=new THREE.DirectionalLight(X,J),P.position.set(A[0],A[1],A[2]),P.position.normalize()):w.type=="point"?(A=w.position,d=w.distance,P=new THREE.PointLight(X,J,d),P.position.set(A[0],A[1],A[2])):w.type=="ambient"&&(P=new THREE.AmbientLight(X)),K.scene.addLight(P),K.lights[y]=P;for(B in Q.fogs)y=Q.fogs[B],y.type=="linear"?G=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(G=new THREE.FogExp2(0,
|
|
|
|
+y.density)),J=y.color,G.color.setRGB(J[0],J[1],J[2]),K.fogs[B]=G;if(K.cameras&&Q.defaults.camera)K.currentCamera=K.cameras[Q.defaults.camera];if(K.fogs&&Q.defaults.fog)K.scene.fog=K.fogs[Q.defaults.fog];J=Q.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(J[0],J[1],J[2]);K.bgColorAlpha=Q.defaults.bgalpha;for(n in Q.geometries)if(B=Q.geometries[n],B.type=="bin_mesh"||B.type=="ascii_mesh")R+=1,e.onLoadStart();$=R;for(n in Q.geometries)B=Q.geometries[n],B.type=="cube"?(E=new THREE.CubeGeometry(B.width,
|
|
|
|
+B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),K.geometries[n]=E):B.type=="plane"?(E=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),K.geometries[n]=E):B.type=="sphere"?(E=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),K.geometries[n]=E):B.type=="cylinder"?(E=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),K.geometries[n]=E):B.type=="torus"?(E=new THREE.TorusGeometry(B.radius,
|
|
|
|
+B.tube,B.segmentsR,B.segmentsT),K.geometries[n]=E):B.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(B.subdivisions),K.geometries[n]=E):B.type=="bin_mesh"?H.load({model:f(B.url,Q.urlBaseType),callback:p(n)}):B.type=="ascii_mesh"?O.load({model:f(B.url,Q.urlBaseType),callback:p(n)}):B.type=="embedded_mesh"&&(B=Q.embeds[B.id])&&O.createModel(B,t(n),"");for(x in Q.textures)if(n=Q.textures[x],n.url instanceof Array){T+=n.url.length;for(H=0;H<n.url.length;H++)e.onLoadStart()}else T+=1,e.onLoadStart();
|
|
|
|
+k=T;for(x in Q.textures){n=Q.textures[x];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){H=[];for(var Z=0;Z<n.url.length;Z++)H[Z]=f(n.url[Z],Q.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,n.mapping,b)}else{H=THREE.ImageUtils.loadTexture(f(n.url,Q.urlBaseType),n.mapping,b);if(THREE[n.minFilter]!=void 0)H.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)H.magFilter=THREE[n.magFilter];if(n.repeat){H.repeat.set(n.repeat[0],n.repeat[1]);
|
|
|
|
+if(n.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}n.offset&&H.offset.set(n.offset[0],n.offset[1]);if(n.wrap){O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(O[n.wrap[0]]!==void 0)H.wrapS=O[n.wrap[0]];if(O[n.wrap[1]]!==void 0)H.wrapT=O[n.wrap[1]]}}K.textures[x]=H}for(v in Q.materials){x=Q.materials[v];for(F in x.parameters)if(F=="envMap"||F=="map"||F=="lightMap")x.parameters[F]=K.textures[x.parameters[F]];else if(F=="shading")x.parameters[F]=
|
|
x.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")x.parameters[F]=THREE[x.parameters[F]]?THREE[x.parameters[F]]:THREE.NormalBlending;else if(F=="combine")x.parameters[F]=x.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(x.parameters[F]=="face")x.parameters[F]=THREE.FaceColors;else if(x.parameters[F])x.parameters[F]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
|
|
x.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")x.parameters[F]=THREE[x.parameters[F]]?THREE[x.parameters[F]]:THREE.NormalBlending;else if(F=="combine")x.parameters[F]=x.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(x.parameters[F]=="face")x.parameters[F]=THREE.FaceColors;else if(x.parameters[F])x.parameters[F]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
|
|
-!0;if(x.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(n.uniforms);H=x.parameters.color;N=x.parameters.specular;C=x.parameters.ambient;G=x.parameters.shininess;b.tNormal.texture=K.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)b.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)b.tDiffuse.texture=x.parameters.map,b.enableDiffuse.value=!0;if(x.parameters.lightMap)b.tAO.texture=x.parameters.lightMap,b.enableAO.value=!0;if(x.parameters.specularMap)b.tSpecular.texture=
|
|
|
|
-K.textures[x.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(H);b.uSpecularColor.value.setHex(N);b.uAmbientColor.value.setHex(C);b.uShininess.value=G;if(x.parameters.opacity)b.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:b,lights:!0,fog:!0})}else x=new THREE[x.type](x.parameters);K.materials[v]=x}m();e.callbackSync(K)}}};
|
|
|
|
|
|
+!0;if(x.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(n.uniforms);H=x.parameters.color;O=x.parameters.specular;B=x.parameters.ambient;G=x.parameters.shininess;b.tNormal.texture=K.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)b.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)b.tDiffuse.texture=x.parameters.map,b.enableDiffuse.value=!0;if(x.parameters.lightMap)b.tAO.texture=x.parameters.lightMap,b.enableAO.value=!0;if(x.parameters.specularMap)b.tSpecular.texture=
|
|
|
|
+K.textures[x.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(H);b.uSpecularColor.value.setHex(O);b.uAmbientColor.value.setHex(B);b.uShininess.value=G;if(x.parameters.opacity)b.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:b,lights:!0,fog:!0})}else x=new THREE[x.type](x.parameters);K.materials[v]=x}m();e.callbackSync(K)}}};
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;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(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,m,p,t,o,n){h=(h-o)/(n-o);o=this.normal_cache;c[j]=m+h*this.delta;c[j+1]=p;c[j+2]=t;g[j]=this.lerp(o[b],o[b+3],h);g[j+1]=this.lerp(o[b+1],o[b+4],h);g[j+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,j,h,m,p,t,o,n){h=(h-o)/(n-o);o=this.normal_cache;c[j]=m;c[j+1]=p+h*this.delta;c[j+
|
|
0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,m,p,t,o,n){h=(h-o)/(n-o);o=this.normal_cache;c[j]=m+h*this.delta;c[j+1]=p;c[j+2]=t;g[j]=this.lerp(o[b],o[b+3],h);g[j+1]=this.lerp(o[b+1],o[b+4],h);g[j+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,j,h,m,p,t,o,n){h=(h-o)/(n-o);o=this.normal_cache;c[j]=m;c[j+1]=p+h*this.delta;c[j+
|
|
2]=t;c=b+this.yd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,j,h,m,p,t,o,n){h=(h-o)/(n-o);o=this.normal_cache;c[j]=m;c[j+1]=p;c[j+2]=t+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
2]=t;c=b+this.yd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,j,h,m,p,t,o,n){h=(h-o)/(n-o);o=this.normal_cache;c[j]=m;c[j+1]=p;c[j+2]=t+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,m){var p=j+1,t=j+this.yd,o=j+this.zd,n=p+this.yd,v=p+this.zd,u=j+this.yd+this.zd,y=p+this.yd+this.zd,w=0,C=this.field[j],x=this.field[p],I=this.field[t],B=this.field[n],J=this.field[o],F=this.field[v],A=this.field[u],X=this.field[y];C<h&&(w|=1);x<h&&(w|=2);I<h&&(w|=8);B<h&&(w|=4);J<h&&(w|=16);F<h&&(w|=32);A<h&&(w|=128);X<h&&(w|=64);var G=THREE.edgeTable[w];if(G==0)return 0;var H=this.delta,
|
|
|
|
-L=b+H,O=c+H,H=g+H;G&1&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,C,x));G&2&&(this.compNorm(p),this.compNorm(n),this.VIntY(p*3,this.vlist,this.nlist,3,h,L,c,g,x,B));G&4&&(this.compNorm(t),this.compNorm(n),this.VIntX(t*3,this.vlist,this.nlist,6,h,b,O,g,I,B));G&8&&(this.compNorm(j),this.compNorm(t),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,C,I));G&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,H,J,F));G&32&&(this.compNorm(v),
|
|
|
|
-this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,h,L,c,H,F,X));G&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,h,b,O,H,A,X));G&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,H,J,A));G&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,C,J));G&512&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,27,h,L,c,g,x,F));G&1024&&(this.compNorm(n),this.compNorm(y),this.VIntZ(n*
|
|
|
|
-3,this.vlist,this.nlist,30,h,L,O,g,B,X));G&2048&&(this.compNorm(t),this.compNorm(u),this.VIntZ(t*3,this.vlist,this.nlist,33,h,b,O,g,I,A));w<<=4;for(h=j=0;THREE.triTable[w+h]!=-1;)b=w+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,m){var p=this.count*3;this.positionArray[p]=b[g];this.positionArray[p+1]=b[g+1];this.positionArray[p+2]=b[g+2];this.positionArray[p+3]=b[j];this.positionArray[p+
|
|
|
|
|
|
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,m){var p=j+1,t=j+this.yd,o=j+this.zd,n=p+this.yd,v=p+this.zd,u=j+this.yd+this.zd,y=p+this.yd+this.zd,w=0,B=this.field[j],x=this.field[p],I=this.field[t],A=this.field[n],J=this.field[o],F=this.field[v],E=this.field[u],X=this.field[y];B<h&&(w|=1);x<h&&(w|=2);I<h&&(w|=8);A<h&&(w|=4);J<h&&(w|=16);F<h&&(w|=32);E<h&&(w|=128);X<h&&(w|=64);var G=THREE.edgeTable[w];if(G==0)return 0;var H=this.delta,
|
|
|
|
+M=b+H,P=c+H,H=g+H;G&1&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,B,x));G&2&&(this.compNorm(p),this.compNorm(n),this.VIntY(p*3,this.vlist,this.nlist,3,h,M,c,g,x,A));G&4&&(this.compNorm(t),this.compNorm(n),this.VIntX(t*3,this.vlist,this.nlist,6,h,b,P,g,I,A));G&8&&(this.compNorm(j),this.compNorm(t),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,B,I));G&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,H,J,F));G&32&&(this.compNorm(v),
|
|
|
|
+this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,h,M,c,H,F,X));G&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,h,b,P,H,E,X));G&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,H,J,E));G&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,B,J));G&512&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,27,h,M,c,g,x,F));G&1024&&(this.compNorm(n),this.compNorm(y),this.VIntZ(n*
|
|
|
|
+3,this.vlist,this.nlist,30,h,M,P,g,A,X));G&2048&&(this.compNorm(t),this.compNorm(u),this.VIntZ(t*3,this.vlist,this.nlist,33,h,b,P,g,I,E));w<<=4;for(h=j=0;THREE.triTable[w+h]!=-1;)b=w+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,m){var p=this.count*3;this.positionArray[p]=b[g];this.positionArray[p+1]=b[g+1];this.positionArray[p+2]=b[g+2];this.positionArray[p+3]=b[j];this.positionArray[p+
|
|
4]=b[j+1];this.positionArray[p+5]=b[j+2];this.positionArray[p+6]=b[h];this.positionArray[p+7]=b[h+1];this.positionArray[p+8]=b[h+2];this.normalArray[p]=c[g];this.normalArray[p+1]=c[g+1];this.normalArray[p+2]=c[g+2];this.normalArray[p+3]=c[j];this.normalArray[p+4]=c[j+1];this.normalArray[p+5]=c[j+2];this.normalArray[p+6]=c[h];this.normalArray[p+7]=c[h+1];this.normalArray[p+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
|
|
4]=b[j+1];this.positionArray[p+5]=b[j+2];this.positionArray[p+6]=b[h];this.positionArray[p+7]=b[h+1];this.positionArray[p+8]=b[h+2];this.normalArray[p]=c[g];this.normalArray[p+1]=c[g+1];this.normalArray[p+2]=c[g+2];this.normalArray[p+3]=c[j];this.normalArray[p+4]=c[j+1];this.normalArray[p+5]=c[j+2];this.normalArray[p+6]=c[h];this.normalArray[p+7]=c[h+1];this.normalArray[p+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
|
|
this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var m=this.size*Math.sqrt(j/h),p=g*this.size,t=c*this.size,o=b*this.size,n=Math.floor(p-m);n<1&&(n=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-m);v<1&&(v=1);t=Math.floor(t+m);t>this.size-1&&(t=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
|
|
this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var m=this.size*Math.sqrt(j/h),p=g*this.size,t=c*this.size,o=b*this.size,n=Math.floor(p-m);n<1&&(n=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-m);v<1&&(v=1);t=Math.floor(t+m);t>this.size-1&&(t=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
|
|
-1);for(var y,w,C,x,I,B;n<p;n++){o=this.size2*n;w=n/this.size-g;I=w*w;for(w=v;w<t;w++){C=o+this.size*w;y=w/this.size-c;B=y*y;for(y=u;y<m;y++)x=y/this.size-b,x=j/(1.0E-6+x*x+B+I)-h,x>0&&(this.field[C+y]+=x)}}};this.addPlaneX=function(b,c){var g,j,h,m,p,t=this.size,o=this.yd,n=this.zd,v=this.field,u=t*Math.sqrt(b/c);u>t&&(u=t);for(g=0;g<u;g++)if(j=g/t,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<t;j++){p=g+j*o;for(h=0;h<t;h++)v[n*h+p]+=m}};this.addPlaneY=function(b,c){var g,j,h,m,p,t,o=this.size,n=this.yd,v=
|
|
|
|
|
|
+1);for(var y,w,B,x,I,A;n<p;n++){o=this.size2*n;w=n/this.size-g;I=w*w;for(w=v;w<t;w++){B=o+this.size*w;y=w/this.size-c;A=y*y;for(y=u;y<m;y++)x=y/this.size-b,x=j/(1.0E-6+x*x+A+I)-h,x>0&&(this.field[B+y]+=x)}}};this.addPlaneX=function(b,c){var g,j,h,m,p,t=this.size,o=this.yd,n=this.zd,v=this.field,u=t*Math.sqrt(b/c);u>t&&(u=t);for(g=0;g<u;g++)if(j=g/t,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<t;j++){p=g+j*o;for(h=0;h<t;h++)v[n*h+p]+=m}};this.addPlaneY=function(b,c){var g,j,h,m,p,t,o=this.size,n=this.yd,v=
|
|
this.zd,u=this.field,y=o*Math.sqrt(b/c);y>o&&(y=o);for(j=0;j<y;j++)if(g=j/o,g*=g,m=b/(1.0E-4+g)-c,m>0){p=j*n;for(g=0;g<o;g++){t=p+g;for(h=0;h<o;h++)u[v*h+t]+=m}}};this.addPlaneZ=function(b,c){var g,j,h,m,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){p=zd*h;for(j=0;j<size;j++){t=p+j*yd;for(g=0;g<size;g++)field[t+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
this.zd,u=this.field,y=o*Math.sqrt(b/c);y>o&&(y=o);for(j=0;j<y;j++)if(g=j/o,g*=g,m=b/(1.0E-4+g)-c,m>0){p=j*n;for(g=0;g<o;g++){t=p+g;for(h=0;h<o;h++)u[v*h+t]+=m}}};this.addPlaneZ=function(b,c){var g,j,h,m,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){p=zd*h;for(j=0;j<size;j++){t=p+j*yd;for(g=0;g<size;g++)field[t+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,m,p,t,o,n,v=this.size-2;for(h=1;h<v;h++){n=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){o=n+this.size*j;p=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,m,p,t,o,n,v,u;for(h=0;h<j.count;h++)v=h*3,o=v+1,u=v+2,m=j.positionArray[v],
|
|
3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,m,p,t,o,n,v=this.size-2;for(h=1;h<v;h++){n=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){o=n+this.size*j;p=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,m,p,t,o,n,v,u;for(h=0;h<j.count;h++)v=h*3,o=v+1,u=v+2,m=j.positionArray[v],
|
|
p=j.positionArray[o],t=j.positionArray[u],n=new THREE.Vector3(m,p,t),m=j.normalArray[v],p=j.normalArray[o],t=j.normalArray[u],v=new THREE.Vector3(m,p,t),v.normalize(),o=new THREE.Vertex(n),c.vertices.push(o),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,o=v+1,u=v+2,n=g[v],m=g[o],p=g[u],v=new THREE.Face3(v,o,u,[n,m,p]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
p=j.positionArray[o],t=j.positionArray[u],n=new THREE.Vector3(m,p,t),m=j.normalArray[v],p=j.normalArray[o],t=j.normalArray[u],v=new THREE.Vector3(m,p,t),v.normalize(),o=new THREE.Vertex(n),c.vertices.push(o),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,o=v+1,u=v+2,n=g[v],m=g[o],p=g[u],v=new THREE.Face3(v,o,u,[n,m,p]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
@@ -621,7 +622,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,p,t,o;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,p,t,o;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
-var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);n.width=b;n.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||o!==e.fov){p=e.aspect;t=e.near;o=e.fov;var x=e.projectionMatrix.clone(),I=125/30*0.5,B=I*t/125,J=t*Math.tan(o*Math.PI/360),F;h.n14=I;m.n14=-I;I=-J*p+B;F=J*p+B;x.n11=2*t/(F-I);x.n13=(F+I)/(F-I);g.projectionMatrix=x.clone();I=-J*p-B;F=J*p-B;x.n11=2*t/(F-I);
|
|
|
|
|
|
+var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);n.width=b;n.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||o!==e.fov){p=e.aspect;t=e.near;o=e.fov;var x=e.projectionMatrix.clone(),I=125/30*0.5,A=I*t/125,J=t*Math.tan(o*Math.PI/360),F;h.n14=I;m.n14=-I;I=-J*p+A;F=J*p+A;x.n11=2*t/(F-I);x.n13=(F+I)/(F-I);g.projectionMatrix=x.clone();I=-J*p-A;F=J*p-A;x.n11=2*t/(F-I);
|
|
x.n13=(F+I)/(F-I);j.projectionMatrix=x.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,n,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=t;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,y,u)}};
|
|
x.n13=(F+I)/(F-I);j.projectionMatrix=x.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,n,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=t;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,y,u)}};
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
|
|
h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}};
|
|
h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}};
|