|
@@ -16,80 +16,80 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
|
|
|
normalize:function(){return this.divideScalar(this.length())},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={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c<d;c++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
|
|
|
d=d.clone().subSelf(c),i=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(i),h=d.dot(d),d=d.dot(i),i=1/(b*h-c*c),h=(h*f-c*d)*i,b=(b*d-c*f)*i;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||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.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
-Math.max(b.scale.y,b.scale.z)))return[];var i,h,j,k,p,n,q,m,t,v,B=b.geometry,x=B.vertices,D=[],f=0;for(i=B.faces.length;f<i;f++)if(h=B.faces[f],t=this.origin.clone(),v=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(h.centroid.clone()).subSelf(t),m=j.dot(v),!(m<=0)&&(j=n.multiplyVector3(x[h.a].position.clone()),k=n.multiplyVector3(x[h.b].position.clone()),p=n.multiplyVector3(x[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(x[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
|
|
|
-m=v.dot(q),b.doubleSided||(b.flipSided?m>0:m<0)))if(m=q.dot((new THREE.Vector3).sub(j,t))/m,t=t.addSelf(v.multiplyScalar(m)),h instanceof THREE.Face3)d(t,j,k,p)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},D.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,n)||d(t,k,p,n)))h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},D.push(h);D.sort(function(b,c){return b.distance-c.distance});return D}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){h=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,q,m){k=!1;c=h;d=j;f=q;i=m;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
|
|
|
-function(h,j,q,m,t,v){k?(k=!1,c=h<q?h<t?h:t:q<t?q:t,d=j<m?j<v?j:v:m<v?m:v,f=h>q?h>t?h:t:q>t?q:t,i=j>m?j>v?j:v:m>v?m:v):(c=h<q?h<t?h<c?h:c:t<c?t:c:q<t?q<c?q:c:t<c?t:c,d=j<m?j<v?j<d?j:d:v<d?v:d:m<v?m<d?m:d:v<d?v:d,f=h>q?h>t?h>f?h:f:t>f?t:f:q>t?q>f?q:f:t>f?t:f,i=j>m?j>v?j>i?j:i:v>i?v:i:m>v?m>i?m:i:v>i?v:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
|
|
|
+Math.max(b.scale.y,b.scale.z)))return[];var i,h,j,k,m,n,q,p,t,v,B=b.geometry,x=B.vertices,E=[],f=0;for(i=B.faces.length;f<i;f++)if(h=B.faces[f],t=this.origin.clone(),v=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(h.centroid.clone()).subSelf(t),p=j.dot(v),!(p<=0)&&(j=n.multiplyVector3(x[h.a].position.clone()),k=n.multiplyVector3(x[h.b].position.clone()),m=n.multiplyVector3(x[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(x[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
|
|
|
+p=v.dot(q),b.doubleSided||(b.flipSided?p>0:p<0)))if(p=q.dot((new THREE.Vector3).sub(j,t))/p,t=t.addSelf(v.multiplyScalar(p)),h instanceof THREE.Face3)d(t,j,k,m)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,n)||d(t,k,m,n)))h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){h=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,q,p){k=!1;c=h;d=j;f=q;i=p;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
|
|
|
+function(h,j,q,p,t,v){k?(k=!1,c=h<q?h<t?h:t:q<t?q:t,d=j<p?j<v?j:v:p<v?p:v,f=h>q?h>t?h:t:q>t?q:t,i=j>p?j>v?j:v:p>v?p:v):(c=h<q?h<t?h<c?h:c:t<c?t:c:q<t?q<c?q:c:t<c?t:c,d=j<p?j<v?j<d?j:d:v<d?v:d:p<v?p<d?p:d:v<d?v:d,f=h>q?h>t?h>f?h:f:t>f?t:f:q>t?q>f?q:f:t>f?t:f,i=j>p?j>v?j>i?j:i:v>i?v:i:p>v?p>i?p:i:v>i?v:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
|
|
|
h.getBottom()?i:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;i+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();i=i<h.getBottom()?i:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(i,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;i=f=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
|
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
|
|
|
-THREE.Matrix4=function(b,c,d,f,i,h,j,k,p,n,q,m,t,v,B,x){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,p||0,n||0,q!==void 0?q:1,m||0,t||0,v||0,B||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,p,n,q,m,t,v,B,x){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=p;this.n32=n;this.n33=q;this.n34=m;this.n41=t;this.n42=v;this.n43=B;this.n44=x;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,
|
|
|
+THREE.Matrix4=function(b,c,d,f,i,h,j,k,m,n,q,p,t,v,B,x){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,m||0,n||0,q!==void 0?q:1,p||0,t||0,v||0,B||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,m,n,q,p,t,v,B,x){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=n;this.n33=q;this.n34=p;this.n41=t;this.n42=v;this.n43=B;this.n44=x;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,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());i.cross(h,f).normalize();this.n11=f.x;this.n12=i.x;this.n13=h.x;this.n21=f.y;this.n22=i.y;this.n23=h.y;this.n31=f.z;this.n32=i.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,i=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*i;
|
|
|
b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*i;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*i;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,i=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*i;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*i;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*i;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*i;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
|
|
|
-d*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 d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,n=b.n24,q=b.n31,m=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,D=b.n43,F=b.n44,va=c.n11,wa=
|
|
|
-c.n12,qa=c.n13,ra=c.n14,ia=c.n21,G=c.n22,u=c.n23,T=c.n24,L=c.n31,U=c.n32,Z=c.n33,ja=c.n34,W=c.n41,M=c.n42,e=c.n43,za=c.n44;this.n11=d*va+f*ia+i*L+h*W;this.n12=d*wa+f*G+i*U+h*M;this.n13=d*qa+f*u+i*Z+h*e;this.n14=d*ra+f*T+i*ja+h*za;this.n21=j*va+k*ia+p*L+n*W;this.n22=j*wa+k*G+p*U+n*M;this.n23=j*qa+k*u+p*Z+n*e;this.n24=j*ra+k*T+p*ja+n*za;this.n31=q*va+m*ia+t*L+v*W;this.n32=q*wa+m*G+t*U+v*M;this.n33=q*qa+m*u+t*Z+v*e;this.n34=q*ra+m*T+t*ja+v*za;this.n41=B*va+x*ia+D*L+F*W;this.n42=B*wa+x*G+D*U+F*M;this.n43=
|
|
|
-B*qa+x*u+D*Z+F*e;this.n44=B*ra+x*T+D*ja+F*za;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[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,d=this.n13,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,p=this.n31,n=this.n32,q=this.n33,m=this.n34,t=this.n41,v=this.n42,B=this.n43,x=this.n44;return f*j*n*t-d*k*n*t-f*h*q*t+c*k*q*t+d*h*m*t-c*j*m*t-f*j*p*v+d*k*p*v+f*i*q*v-b*k*q*v-d*i*m*v+b*j*m*v+f*h*p*B-c*k*p*B-f*i*n*B+b*k*n*B+c*i*m*B-b*h*m*B-d*h*p*x+c*j*
|
|
|
-p*x+d*i*n*x-b*j*n*x-c*i*q*x+b*h*q*x},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;
|
|
|
+d*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 d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,q=b.n31,p=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,E=b.n43,F=b.n44,wa=c.n11,xa=
|
|
|
+c.n12,qa=c.n13,ra=c.n14,ja=c.n21,G=c.n22,u=c.n23,S=c.n24,L=c.n31,T=c.n32,Z=c.n33,ya=c.n34,V=c.n41,M=c.n42,e=c.n43,ua=c.n44;this.n11=d*wa+f*ja+i*L+h*V;this.n12=d*xa+f*G+i*T+h*M;this.n13=d*qa+f*u+i*Z+h*e;this.n14=d*ra+f*S+i*ya+h*ua;this.n21=j*wa+k*ja+m*L+n*V;this.n22=j*xa+k*G+m*T+n*M;this.n23=j*qa+k*u+m*Z+n*e;this.n24=j*ra+k*S+m*ya+n*ua;this.n31=q*wa+p*ja+t*L+v*V;this.n32=q*xa+p*G+t*T+v*M;this.n33=q*qa+p*u+t*Z+v*e;this.n34=q*ra+p*S+t*ya+v*ua;this.n41=B*wa+x*ja+E*L+F*V;this.n42=B*xa+x*G+E*T+F*M;this.n43=
|
|
|
+B*qa+x*u+E*Z+F*e;this.n44=B*ra+x*S+E*ya+F*ua;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[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,d=this.n13,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,n=this.n32,q=this.n33,p=this.n34,t=this.n41,v=this.n42,B=this.n43,x=this.n44;return f*j*n*t-d*k*n*t-f*h*q*t+c*k*q*t+d*h*p*t-c*j*p*t-f*j*m*v+d*k*m*v+f*i*q*v-b*k*q*v-d*i*p*v+b*j*p*v+f*h*m*B-c*k*m*B-f*i*n*B+b*k*n*B+c*i*p*B-b*h*p*B-d*h*m*x+c*j*
|
|
|
+m*x+d*i*n*x-b*j*n*x-c*i*q*x+b*h*q*x},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.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
|
|
|
this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
|
|
|
this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
|
|
|
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,p=i*h,n=i*j;this.set(p*h+d,p*j-f*k,p*k+f*j,0,p*j+f*k,n*j+d,n*k-f*h,0,p*k-f*j,n*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var p=
|
|
|
-j*k,n=j*i,q=f*k,m=f*i;this.n11=p+m*d;this.n12=q*d-n;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=n*d-q;this.n32=m+p*d;this.n33=h*j;break;case "ZXY":p=j*k;n=j*i;q=f*k;m=f*i;this.n11=p-m*d;this.n12=-h*i;this.n13=q+n*d;this.n21=n+q*d;this.n22=h*k;this.n23=m-p*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":p=h*k;n=h*i;q=d*k;m=d*i;this.n11=j*k;this.n12=q*f-n;this.n13=p*f+m;this.n21=j*i;this.n22=m*f+p;this.n23=n*f-q;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":p=h*j;n=
|
|
|
-h*f;q=d*j;m=d*f;this.n11=j*k;this.n12=m-p*i;this.n13=q*i+n;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=n*i+q;this.n33=p-m*i;break;case "XZY":p=h*j;n=h*f;q=d*j;m=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=p*i+m;this.n22=h*k;this.n23=n*i-q;this.n31=q*i-n;this.n32=d*k;this.n33=m*i+p;break;default:p=h*k,n=h*i,q=d*k,m=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=n+q*f,this.n22=p-m*f,this.n23=-d*j,this.n31=m-p*f,this.n32=q+n*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
-b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,p=c*j;c*=k;var n=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(n+f);this.n12=p-i;this.n13=c+j;this.n21=p+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;
|
|
|
+0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,m=i*h,n=i*j;this.set(m*h+d,m*j-f*k,m*k+f*j,0,m*j+f*k,n*j+d,n*k-f*h,0,m*k-f*j,n*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var m=
|
|
|
+j*k,n=j*i,q=f*k,p=f*i;this.n11=m+p*d;this.n12=q*d-n;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=n*d-q;this.n32=p+m*d;this.n33=h*j;break;case "ZXY":m=j*k;n=j*i;q=f*k;p=f*i;this.n11=m-p*d;this.n12=-h*i;this.n13=q+n*d;this.n21=n+q*d;this.n22=h*k;this.n23=p-m*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":m=h*k;n=h*i;q=d*k;p=d*i;this.n11=j*k;this.n12=q*f-n;this.n13=m*f+p;this.n21=j*i;this.n22=p*f+m;this.n23=n*f-q;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":m=h*j;n=
|
|
|
+h*f;q=d*j;p=d*f;this.n11=j*k;this.n12=p-m*i;this.n13=q*i+n;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=n*i+q;this.n33=m-p*i;break;case "XZY":m=h*j;n=h*f;q=d*j;p=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=m*i+p;this.n22=h*k;this.n23=n*i-q;this.n31=q*i-n;this.n32=d*k;this.n33=p*i+m;break;default:m=h*k,n=h*i,q=d*k,p=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=n+q*f,this.n22=m-p*f,this.n23=-d*j,this.n31=p-m*f,this.n32=q+n*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
+b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,m=c*j;c*=k;var n=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(n+f);this.n12=m-i;this.n13=c+j;this.n21=m+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;
|
|
|
f.identity();f.setRotationFromQuaternion(c);i.setScale(d.x,d.y,d.z);this.multiply(f,i);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);i.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();
|
|
|
d.y=i.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,i=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*i;this.n23=
|
|
|
b.n23*i;this.n33=b.n33*i}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,n=b.n24,q=b.n31,m=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,D=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*x-n*t*x+n*m*D-k*v*D-p*m*F+k*t*F;c.n12=h*t*x-i*v*x-h*m*D+f*v*D+i*m*F-f*t*F;c.n13=i*n*x-h*p*x+h*k*D-f*n*D-i*k*F+f*p*F;c.n14=h*p*m-i*n*m-h*k*t+f*n*t+i*k*v-f*p*v;c.n21=n*t*B-p*v*B-n*q*D+j*v*D+p*q*F-j*t*F;c.n22=i*v*B-h*t*B+h*q*D-d*v*D-i*q*F+d*t*F;c.n23=h*p*B-i*n*B-h*j*D+d*n*D+i*j*F-d*p*F;c.n24=
|
|
|
-i*n*q-h*p*q+h*j*t-d*n*t-i*j*v+d*p*v;c.n31=k*v*B-n*m*B+n*q*x-j*v*x-k*q*F+j*m*F;c.n32=h*m*B-f*v*B-h*q*x+d*v*x+f*q*F-d*m*F;c.n33=i*n*B-h*k*B+h*j*x-d*n*x-f*j*F+d*k*F;c.n34=h*k*q-f*n*q-h*j*m+d*n*m+f*j*v-d*k*v;c.n41=p*m*B-k*t*B-p*q*x+j*t*x+k*q*D-j*m*D;c.n42=f*t*B-i*m*B+i*q*x-d*t*x-f*q*D+d*m*D;c.n43=i*k*B-f*p*B-i*j*x+d*p*x+f*j*D-d*k*D;c.n44=f*p*q-i*k*q+i*j*m-d*p*m-f*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,m=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*p;d[6]=b*n;d[7]=b*q;d[8]=b*m;return c};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,q=b.n31,p=b.n32,t=b.n33,v=b.n34,B=b.n41,x=b.n42,E=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*v*x-n*t*x+n*p*E-k*v*E-m*p*F+k*t*F;c.n12=h*t*x-i*v*x-h*p*E+f*v*E+i*p*F-f*t*F;c.n13=i*n*x-h*m*x+h*k*E-f*n*E-i*k*F+f*m*F;c.n14=h*m*p-i*n*p-h*k*t+f*n*t+i*k*v-f*m*v;c.n21=n*t*B-m*v*B-n*q*E+j*v*E+m*q*F-j*t*F;c.n22=i*v*B-h*t*B+h*q*E-d*v*E-i*q*F+d*t*F;c.n23=h*m*B-i*n*B-h*j*E+d*n*E+i*j*F-d*m*F;c.n24=
|
|
|
+i*n*q-h*m*q+h*j*t-d*n*t-i*j*v+d*m*v;c.n31=k*v*B-n*p*B+n*q*x-j*v*x-k*q*F+j*p*F;c.n32=h*p*B-f*v*B-h*q*x+d*v*x+f*q*F-d*p*F;c.n33=i*n*B-h*k*B+h*j*x-d*n*x-f*j*F+d*k*F;c.n34=h*k*q-f*n*q-h*j*p+d*n*p+f*j*v-d*k*v;c.n41=m*p*B-k*t*B-m*q*x+j*t*x+k*q*E-j*p*E;c.n42=f*t*B-i*p*B+i*q*x-d*t*x-f*q*E+d*p*E;c.n43=i*k*B-f*m*B-i*j*x+d*m*x+f*j*E-d*k*E;c.n44=f*m*q-i*k*q+i*j*p-d*m*p-f*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*n;d[7]=b*q;d[8]=b*p;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(b,c,d,f,i,h){var j;j=new THREE.Matrix4;j.n11=2*i/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*i/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+i)/(h-i);j.n34=-2*h*i/(h-i);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var i,b=d*Math.tan(b*Math.PI/360);i=-b;return THREE.Matrix4.makeFrustum(i*c,b*c,i,b,d,f)};
|
|
|
-THREE.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,p,n;j=new THREE.Matrix4;k=c-b;p=d-f;n=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+f)/p);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+i)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,m,n;j=new THREE.Matrix4;k=c-b;m=d-f;n=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+f)/m);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+i)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
+THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
-THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
|
|
|
--1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var d,f,i;d=0;for(f=this.children.length;d<f;d++){i=this.children[d];if(i.name===
|
|
|
-b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
|
|
|
-this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
|
|
|
-this.remove(b)}};THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function b(){var b=p[k]=p[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(e=Math.min(e,h/(h-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,p=[],n,q,m=[],t,v=[],B,x,D=[],F,va,wa=[],qa=[],ra=[],ia=new THREE.Vector4,
|
|
|
-G=new THREE.Vector4,u=new THREE.Matrix4,T=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],U=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
|
|
|
-k;i=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var n;if(!(n=!k.visible))if(n=k instanceof THREE.Mesh)if(n=k.frustumCulled){a:{n=void 0;for(var p=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),m=0;m<6;m++)if(n=L[m].x*p.n14+L[m].y*p.n24+L[m].z*p.n34+L[m].w,n<=q){n=!1;break a}n=!0}n=!n}if(!n)n=h[i]=h[i]||new THREE.RenderableObject,i++,f=n,ia.copy(k.position),u.multiplyVector3(ia),f.object=k,f.z=ia.z,qa.push(f)}j&&qa.sort(c);return qa};
|
|
|
-this.projectScene=function(f,i,h){var e=i.near,qa=i.far,ia,xa,V,na,J,$,N,ka,sa,R,ua,La,Ra,Ia,Aa,Ea,ya;va=x=t=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);u.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);L[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);L[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);L[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);L[4].set(u.n41-u.n31,u.n42-u.n32,
|
|
|
-u.n43-u.n33,u.n44-u.n34);L[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ia=0;ia<6;ia++)sa=L[ia],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(f,i,!0);f=0;for(ia=sa.length;f<ia;f++)if(R=sa[f].object,R.visible)if(ua=R.matrixWorld,La=R.matrixRotationWorld,Ra=R.materials,Ia=R.overdraw,k=0,R instanceof THREE.Mesh){Aa=R.geometry;na=Aa.vertices;Ea=Aa.faces;Aa=Aa.faceVertexUvs;xa=0;for(V=na.length;xa<V;xa++)j=b(),j.positionWorld.copy(na[xa].position),ua.multiplyVector3(j.positionWorld),
|
|
|
-j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;na=0;for(xa=Ea.length;na<xa;na++){V=Ea[na];if(V instanceof THREE.Face3)if(J=p[V.a],$=p[V.b],N=p[V.c],J.visible&&$.visible&&N.visible&&(R.doubleSided||R.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-
|
|
|
-J.positionScreen.x)<0))ka=m[q]=m[q]||new THREE.RenderableFace3,q++,n=ka,n.v1.copy(J),n.v2.copy($),n.v3.copy(N);else continue;else if(V instanceof THREE.Face4)if(J=p[V.a],$=p[V.b],N=p[V.c],ka=p[V.d],J.visible&&$.visible&&N.visible&&ka.visible&&(R.doubleSided||R.flipSided!=((ka.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(ka.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-
|
|
|
-($.positionScreen.y-N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0)))ya=v[t]=v[t]||new THREE.RenderableFace4,t++,n=ya,n.v1.copy(J),n.v2.copy($),n.v3.copy(N),n.v4.copy(ka);else continue;n.normalWorld.copy(V.normal);La.multiplyVector3(n.normalWorld);n.centroidWorld.copy(V.centroid);ua.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);u.multiplyVector3(n.centroidScreen);N=V.vertexNormals;J=0;for($=N.length;J<$;J++)ka=n.vertexNormalsWorld[J],ka.copy(N[J]),La.multiplyVector3(ka);
|
|
|
-J=0;for($=Aa.length;J<$;J++)if(ya=Aa[J][na]){N=0;for(ka=ya.length;N<ka;N++)n.uvs[J][N]=ya[N]}n.meshMaterials=Ra;n.faceMaterials=V.materials;n.overdraw=Ia;n.z=n.centroidScreen.z;ra.push(n)}}else if(R instanceof THREE.Line){T.multiply(u,ua);na=R.geometry.vertices;J=b();J.positionScreen.copy(na[0].position);T.multiplyVector4(J.positionScreen);xa=1;for(V=na.length;xa<V;xa++)if(J=b(),J.positionScreen.copy(na[xa].position),T.multiplyVector4(J.positionScreen),$=p[k-2],U.copy(J.positionScreen),Z.copy($.positionScreen),
|
|
|
-d(U,Z))U.multiplyScalar(1/U.w),Z.multiplyScalar(1/Z.w),ua=D[x]=D[x]||new THREE.RenderableLine,x++,B=ua,B.v1.positionScreen.copy(U),B.v2.positionScreen.copy(Z),B.z=Math.max(U.z,Z.z),B.materials=R.materials,ra.push(B)}else if(R instanceof THREE.Particle&&(G.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),u.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))ua=wa[va]=wa[va]||new THREE.RenderableParticle,va++,F=ua,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=R.rotation.z,F.scale.x=R.scale.x*Math.abs(F.x-
|
|
|
-(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=R.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=R.materials,ra.push(F);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
|
|
|
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,i=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-i),i=Math.sin(-i),h=Math.cos(d),d=Math.sin(d),j=b*c,k=f*i;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*i*d;this.z=b*i*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
|
|
|
+THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this instanceof THREE.Camera?this.matrix.lookAt(this.position,b,this.up):this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&
|
|
|
+this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,d=this.children.indexOf(b);if(d!==-1){b.parent=void 0;for(this.children.splice(d,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,
|
|
|
+c){var d,f,i;d=0;for(f=this.children.length;d<f;d++){i=this.children[d];if(i.name===b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
|
|
|
+this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");
|
|
|
+this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");this.remove(b)}};THREE.Object3DCount=0;
|
|
|
+THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,i=c.z+c.w,h=-b.z+b.w,j=-c.z+c.w;return f>=0&&i>=0&&h>=0&&j>=0?!0:f<0&&i<0||h<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-i)):i<0&&(e=Math.min(e,f/(f-i))),h<0?d=Math.max(d,h/(h-j)):j<0&&(e=Math.min(e,h/(h-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,m=[],n,q,p=[],t,v=[],B,x,E=[],F,wa,xa=[],qa=[],ra=[],ja=new THREE.Vector4,
|
|
|
+G=new THREE.Vector4,u=new THREE.Matrix4,S=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
|
|
|
+k;i=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var n;if(!(n=!k.visible))if(n=k instanceof THREE.Mesh)if(n=k.frustumCulled){a:{n=void 0;for(var m=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++)if(n=L[p].x*m.n14+L[p].y*m.n24+L[p].z*m.n34+L[p].w,n<=q){n=!1;break a}n=!0}n=!n}if(!n)n=h[i]=h[i]||new THREE.RenderableObject,i++,f=n,ja.copy(k.position),u.multiplyVector3(ja),f.object=k,f.z=ja.z,qa.push(f)}j&&qa.sort(c);return qa};
|
|
|
+this.projectScene=function(f,i,h){var e=i.near,qa=i.far,ja,va,U,W,J,$,N,ka,sa,Q,Aa,Ja,Ta,Ka,Ba,Ea,za;wa=x=t=q=ra.length=0;i.matrixAutoUpdate&&i.update(void 0,!0);f.update(void 0,!1,i);u.multiply(i.projectionMatrix,i.matrixWorldInverse);L[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);L[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);L[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);L[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);L[4].set(u.n41-u.n31,u.n42-u.n32,
|
|
|
+u.n43-u.n33,u.n44-u.n34);L[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ja=0;ja<6;ja++)sa=L[ja],sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z));sa=this.projectObjects(f,i,!0);f=0;for(ja=sa.length;f<ja;f++)if(Q=sa[f].object,Q.visible)if(Aa=Q.matrixWorld,Ja=Q.matrixRotationWorld,Ta=Q.materials,Ka=Q.overdraw,k=0,Q instanceof THREE.Mesh){Ba=Q.geometry;W=Ba.vertices;Ea=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(U=W.length;va<U;va++)j=b(),j.positionWorld.copy(W[va].position),Aa.multiplyVector3(j.positionWorld),
|
|
|
+j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;W=0;for(va=Ea.length;W<va;W++){U=Ea[W];if(U instanceof THREE.Face3)if(J=m[U.a],$=m[U.b],N=m[U.c],J.visible&&$.visible&&N.visible&&(Q.doubleSided||Q.flipSided!=(N.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(N.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-
|
|
|
+J.positionScreen.x)<0))ka=p[q]=p[q]||new THREE.RenderableFace3,q++,n=ka,n.v1.copy(J),n.v2.copy($),n.v3.copy(N);else continue;else if(U instanceof THREE.Face4)if(J=m[U.a],$=m[U.b],N=m[U.c],ka=m[U.d],J.visible&&$.visible&&N.visible&&ka.visible&&(Q.doubleSided||Q.flipSided!=((ka.positionScreen.x-J.positionScreen.x)*($.positionScreen.y-J.positionScreen.y)-(ka.positionScreen.y-J.positionScreen.y)*($.positionScreen.x-J.positionScreen.x)<0||($.positionScreen.x-N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-
|
|
|
+($.positionScreen.y-N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0)))za=v[t]=v[t]||new THREE.RenderableFace4,t++,n=za,n.v1.copy(J),n.v2.copy($),n.v3.copy(N),n.v4.copy(ka);else continue;n.normalWorld.copy(U.normal);Ja.multiplyVector3(n.normalWorld);n.centroidWorld.copy(U.centroid);Aa.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);u.multiplyVector3(n.centroidScreen);N=U.vertexNormals;J=0;for($=N.length;J<$;J++)ka=n.vertexNormalsWorld[J],ka.copy(N[J]),Ja.multiplyVector3(ka);
|
|
|
+J=0;for($=Ba.length;J<$;J++)if(za=Ba[J][W]){N=0;for(ka=za.length;N<ka;N++)n.uvs[J][N]=za[N]}n.meshMaterials=Ta;n.faceMaterials=U.materials;n.overdraw=Ka;n.z=n.centroidScreen.z;ra.push(n)}}else if(Q instanceof THREE.Line){S.multiply(u,Aa);W=Q.geometry.vertices;J=b();J.positionScreen.copy(W[0].position);S.multiplyVector4(J.positionScreen);va=1;for(U=W.length;va<U;va++)if(J=b(),J.positionScreen.copy(W[va].position),S.multiplyVector4(J.positionScreen),$=m[k-2],T.copy(J.positionScreen),Z.copy($.positionScreen),
|
|
|
+d(T,Z))T.multiplyScalar(1/T.w),Z.multiplyScalar(1/Z.w),Aa=E[x]=E[x]||new THREE.RenderableLine,x++,B=Aa,B.v1.positionScreen.copy(T),B.v2.positionScreen.copy(Z),B.z=Math.max(T.z,Z.z),B.materials=Q.materials,ra.push(B)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),u.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))Aa=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,F=Aa,F.x=G.x/G.w,F.y=G.y/G.w,F.z=G.z,F.rotation=Q.rotation.z,F.scale.x=Q.scale.x*Math.abs(F.x-
|
|
|
+(G.x+i.projectionMatrix.n11)/(G.w+i.projectionMatrix.n14)),F.scale.y=Q.scale.y*Math.abs(F.y-(G.y+i.projectionMatrix.n22)/(G.w+i.projectionMatrix.n24)),F.materials=Q.materials,ra.push(F);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
|
|
|
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,d=b.x*c,f=b.y*c,i=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-i),i=Math.sin(-i),h=Math.cos(d),d=Math.sin(d),j=b*c,k=f*i;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*i*d;this.z=b*i*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
|
|
|
this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
|
|
|
-this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,p=this.w,n=p*d+j*i-k*f,q=p*f+k*d-h*i,m=p*i+h*f-j*d,d=-h*
|
|
|
-d-j*f-k*i;c.x=n*p+d*-h+q*-k-m*-j;c.y=q*p+d*-j+m*-h-n*-k;c.z=m*p+d*-k+n*-j-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
|
|
|
+this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,m=this.w,n=m*d+j*i-k*f,q=m*f+k*d-h*i,p=m*i+h*f-j*d,d=-h*
|
|
|
+d-j*f-k*i;c.x=n*m+d*-h+q*-k-p*-j;c.y=q*m+d*-j+p*-h-n*-k;c.z=p*m+d*-k+n*-j-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
|
|
|
THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,i,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,c,d,f,i,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
|
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,f=this.vertices.length;d<f;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(f=this.faces.length;d<f;d++){var i=this.faces[d];c.multiplyVector3(i.normal);for(var h=0,j=i.vertexNormals.length;h<j;h++)c.multiplyVector3(i.vertexNormals[h]);b.multiplyVector3(i.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
|
|
|
c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
|
|
|
-d,f,i,h,j,k=new THREE.Vector3,p=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),p.sub(c.position,d.position),k.crossSelf(p);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
|
|
|
+d,f,i,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),m.sub(c.position,d.position),k.crossSelf(m);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,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(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.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++)d=this.faces[b],d instanceof
|
|
|
THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
|
|
|
-d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,i,h){k=b.vertices[e].position;p=b.vertices[c].position;n=b.vertices[d].position;q=j[f];m=j[i];t=j[h];v=p.x-k.x;B=n.x-k.x;x=p.y-k.y;D=n.y-k.y;F=p.z-k.z;va=n.z-k.z;wa=m.u-q.u;qa=t.u-q.u;ra=m.v-q.v;ia=t.v-q.v;G=1/(wa*ia-qa*ra);U.set((ia*v-ra*B)*G,(ia*x-ra*D)*G,(ia*F-ra*va)*G);Z.set((wa*B-qa*v)*G,(wa*D-qa*x)*G,(wa*va-qa*F)*G);T[e].addSelf(U);T[c].addSelf(U);
|
|
|
-T[d].addSelf(U);L[e].addSelf(Z);L[c].addSelf(Z);L[d].addSelf(Z)}var c,d,f,i,h,j,k,p,n,q,m,t,v,B,x,D,F,va,wa,qa,ra,ia,G,u,T=[],L=[],U=new THREE.Vector3,Z=new THREE.Vector3,ja=new THREE.Vector3,W=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)T[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,
|
|
|
-h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=T[i],ja.copy(u),ja.subSelf(M.multiplyScalar(M.dot(u))).normalize(),W.cross(h.vertexNormals[f],u),i=W.dot(L[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,i)}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],
|
|
|
+d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,i,h){k=b.vertices[e].position;m=b.vertices[c].position;n=b.vertices[d].position;q=j[f];p=j[i];t=j[h];v=m.x-k.x;B=n.x-k.x;x=m.y-k.y;E=n.y-k.y;F=m.z-k.z;wa=n.z-k.z;xa=p.u-q.u;qa=t.u-q.u;ra=p.v-q.v;ja=t.v-q.v;G=1/(xa*ja-qa*ra);T.set((ja*v-ra*B)*G,(ja*x-ra*E)*G,(ja*F-ra*wa)*G);Z.set((xa*B-qa*v)*G,(xa*E-qa*x)*G,(xa*wa-qa*F)*G);S[e].addSelf(T);S[c].addSelf(T);
|
|
|
+S[d].addSelf(T);L[e].addSelf(Z);L[c].addSelf(Z);L[d].addSelf(Z)}var c,d,f,i,h,j,k,m,n,q,p,t,v,B,x,E,F,wa,xa,qa,ra,ja,G,u,S=[],L=[],T=new THREE.Vector3,Z=new THREE.Vector3,ya=new THREE.Vector3,V=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)S[c]=new THREE.Vector3,L[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,
|
|
|
+h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=S[i],ya.copy(u),ya.subSelf(M.multiplyScalar(M.dot(u))).normalize(),V.cross(h.vertexNormals[f],u),i=V.dot(L[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ya.x,ya.y,ya.z,i)}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,d=this.vertices.length;c<d;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,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=
|
|
|
1,b[c].array.push(d))}var d,f,i,h,j,k={};d=0;for(f=this.faces.length;d<f;d++)j=this.faces[d],j instanceof THREE.Face3?(i=b(j.a,j.b),c(k,i,d),i=b(j.b,j.c),c(k,i,d),i=b(j.a,j.c),c(k,i,d)):j instanceof THREE.Face4&&(i=b(j.b,j.d),c(k,i,d),i=b(j.a,j.b),c(k,i,d),i=b(j.a,j.d),c(k,i,d),i=b(j.b,j.c),c(k,i,d),i=b(j.c,j.d),c(k,i,d));d=0;for(f=this.edges.length;d<f;d++){j=this.edges[d];i=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(i,h)].array;for(i=0;i<j.faceIndices.length;i++)h=j.faceIndices[i],
|
|
|
j.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
|
|
|
-THREE.Spline=function(b){function c(b,c,d,f,i,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*i+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,p,n,q,m,t;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){i=(this.points.length-1)*b;h=Math.floor(i);j=i-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];q=this.points[d[1]];
|
|
|
-m=this.points[d[2]];t=this.points[d[3]];k=j*j;p=j*k;f.x=c(n.x,q.x,m.x,t.x,j,k,p);f.y=c(n.y,q.y,m.y,t.y,j,k,p);f.z=c(n.z,q.z,m.z,t.z,j,k,p);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
|
|
|
-k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,i,h,j,k=[],n=new THREE.Vector3,p=this.getLength();k.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=p.chunks[c]-p.chunks[c-1];j=Math.ceil(b*d/p.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)f=i+d*(1/j)*(h-i),position=this.getPoint(f),k.push(n.copy(position).clone());
|
|
|
-k.push(n.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,i){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=i||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
+THREE.Spline=function(b){function c(b,c,d,f,i,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*i+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,m,n,q,p,t;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){i=(this.points.length-1)*b;h=Math.floor(i);j=i-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];q=this.points[d[1]];
|
|
|
+p=this.points[d[2]];t=this.points[d[3]];k=j*j;m=j*k;f.x=c(n.x,q.x,p.x,t.x,j,k,m);f.y=c(n.y,q.y,p.y,t.y,j,k,m);f.z=c(n.z,q.z,p.z,t.z,j,k,m);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
|
|
|
+k+=h.distanceTo(i),i.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,i,h,j,k=[],n=new THREE.Vector3,m=this.getLength();k.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=m.chunks[c]-m.chunks[c-1];j=Math.ceil(b*d/m.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)f=i+d*(1/j)*(h-i),position=this.getPoint(f),k.push(n.copy(position).clone());
|
|
|
+k.push(n.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,i){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=i||new THREE.Object3D;this.useTarget=!1;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,f=b*d,b=Math.abs(b*c-f),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
THREE.Camera.prototype.setViewOffset=function(b,c,d,f,i,h){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=f;this.width=i;this.height=h;this.updateProjectionMatrix()};
|
|
@@ -98,7 +98,7 @@ THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget)this.matrix.look
|
|
|
THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};
|
|
|
THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
|
|
|
-THREE.Material=function(b){this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
|
|
|
+THREE.Material=function(b){this.name="";this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
|
|
|
b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
|
|
|
THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
|
|
|
THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:
|
|
@@ -119,7 +119,7 @@ void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.ve
|
|
|
THREE.Texture=function(b,c,d,f,i,h){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=i!==void 0?i:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
|
|
|
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,p){THREE.Texture.call(this,null,i,h,j,k,p);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,m){THREE.Texture.call(this,null,i,h,j,k,m);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
|
|
|
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
|
|
THREE.Line.prototype.constructor=THREE.Line;
|
|
@@ -178,120 +178,120 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
|
|
|
THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_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;",
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
|
|
|
"}"].join("\n")},depthRGBA:{uniforms:{},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"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
-THREE.WebGLRenderer=function(b){function c(b,c,d){var f,i,h,j=b.vertices,k=j.length,z=b.colors,n=z.length,E=b.__vertexArray,p=b.__colorArray,m=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,t=b.__webglCustomAttributes,s,u;if(t)for(s in t)t[s].offset=0;if(d.sortParticles){Fa.multiplySelf(d.matrixWorld);for(f=0;f<k;f++)i=j[f].position,Ja.copy(i),Fa.multiplyVector3(Ja),m[f]=[Ja.z,f];m.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)i=j[m[f][1]].position,h=f*3,E[h]=i.x,E[h+1]=i.y,E[h+2]=i.z;
|
|
|
-for(f=0;f<n;f++)h=f*3,color=z[m[f][1]],p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(t)for(s in t){f=t[s];z=f.value.length;for(h=0;h<z;h++){index=m[h][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")u=f.value[index];f.size===2?(f.array[n]=u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=
|
|
|
-u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}else{if(C)for(f=0;f<k;f++)i=j[f].position,h=f*3,E[h]=i.x,E[h+1]=i.y,E[h+2]=i.z;if(q)for(f=0;f<n;f++)color=z[f],h=f*3,p[h]=color.r,p[h+1]=color.g,p[h+2]=color.b;if(t)for(s in t)if(f=t[s],f.__original.needsUpdate){z=f.value.length;for(h=0;h<z;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")u=f.value[h];f.size===2?(f.array[n]=
|
|
|
-u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}if(C||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,E,c);if(q||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,p,c);if(t)for(s in t)if(f=t[s],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,i){f.program||M.initMaterial(f,c,d,i);if(f.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=f.program,j=h.uniforms,z=f.uniforms;h!=Wa&&(e.useProgram(h),Wa=h,k=!0);if(f.id!=V)V=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Ta);if(d&&f.fog)if(z.fogColor.value=d.color,d instanceof
|
|
|
-THREE.Fog)z.fogNear.value=d.near,z.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)z.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var n,E,p=0,m=0,C=0,q,t,s,v=Ya,H=v.directional.colors,B=v.directional.positions,y=v.point.colors,x=v.point.positions,F=v.point.distances,D=0,K=0,d=n=s=0,k=c.length;d<k;d++)if(n=c[d],E=n.color,q=n.position,t=n.intensity,s=n.distance,n instanceof THREE.AmbientLight)p+=E.r,m+=E.g,C+=E.b;else if(n instanceof
|
|
|
-THREE.DirectionalLight)s=D*3,H[s]=E.r*t,H[s+1]=E.g*t,H[s+2]=E.b*t,B[s]=q.x,B[s+1]=q.y,B[s+2]=q.z,D+=1;else if(n instanceof THREE.SpotLight)s=D*3,H[s]=E.r*t,H[s+1]=E.g*t,H[s+2]=E.b*t,E=1/q.length(),B[s]=q.x*E,B[s+1]=q.y*E,B[s+2]=q.z*E,D+=1;else if(n instanceof THREE.PointLight)n=K*3,y[n]=E.r*t,y[n+1]=E.g*t,y[n+2]=E.b*t,x[n]=q.x,x[n+1]=q.y,x[n+2]=q.z,F[K]=s,K+=1;d=D*3;for(k=H.length;d<k;d++)H[d]=0;d=K*3;for(k=y.length;d<k;d++)y[d]=0;v.point.length=K;v.directional.length=D;v.ambient[0]=p;v.ambient[1]=
|
|
|
-m;v.ambient[2]=C;c=Ya;z.enableLighting.value=c.directional.length+c.point.length;z.ambientLightColor.value=c.ambient;z.directionalLightColor.value=c.directional.colors;z.directionalLightDirection.value=c.directional.positions;z.pointLightColor.value=c.point.colors;z.pointLightPosition.value=c.point.positions;z.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)z.diffuse.value=f.color,z.opacity.value=
|
|
|
-f.opacity,(z.map.texture=f.map)&&z.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),z.lightMap.texture=f.lightMap,z.envMap.texture=f.envMap,z.reflectivity.value=f.reflectivity,z.refractionRatio.value=f.refractionRatio,z.combine.value=f.combine,z.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)z.psColor.value=
|
|
|
-f.color,z.opacity.value=f.opacity,z.size.value=f.size,z.scale.value=Ba.height/2,z.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)z.ambient.value=f.ambient,z.specular.value=f.specular,z.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)z.mNear.value=b.near,z.mFar.value=b.far,z.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)z.opacity.value=f.opacity;if(i.receiveShadow&&!f._shadowPass&&z.shadowMatrix){for(c=0;c<Sa.length;c++)z.shadowMatrix.value[c]=
|
|
|
-Sa[c],z.shadowMap.texture[c]=M.shadowMap[c];z.shadowDarkness.value=M.shadowMapDarkness;z.shadowBias.value=M.shadowMapBias}c=f.uniformsList;z=0;for(d=c.length;z<d;z++)if(m=h.uniforms[c[z][1]])if(p=c[z][0],C=p.type,k=p.value,C=="i")e.uniform1i(m,k);else if(C=="f")e.uniform1f(m,k);else if(C=="v2")e.uniform2f(m,k.x,k.y);else if(C=="v3")e.uniform3f(m,k.x,k.y,k.z);else if(C=="v4")e.uniform4f(m,k.x,k.y,k.z,k.w);else if(C=="c")e.uniform3f(m,k.r,k.g,k.b);else if(C=="fv1")e.uniform1fv(m,k);else if(C=="fv")e.uniform3fv(m,
|
|
|
-k);else if(C=="v3v"){if(!p._array)p._array=new Float32Array(3*k.length);C=0;for(q=k.length;C<q;C++)v=C*3,p._array[v]=k[C].x,p._array[v+1]=k[C].y,p._array[v+2]=k[C].z;e.uniform3fv(m,p._array)}else if(C=="m4"){if(!p._array)p._array=new Float32Array(16);k.flattenToArray(p._array);e.uniformMatrix4fv(m,!1,p._array)}else if(C=="m4v"){if(!p._array)p._array=new Float32Array(16*k.length);C=0;for(q=k.length;C<q;C++)k[C].flattenToArrayOffset(p._array,C*16);e.uniformMatrix4fv(m,!1,p._array)}else if(C=="t"){if(e.uniform1i(m,
|
|
|
-k),m=p.texture)if(m.image instanceof Array&&m.image.length==6){if(p=m,p.image.length==6)if(p.needsUpdate){if(!p.image.__webglTextureCube)p.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p.image[k]);u(e.TEXTURE_CUBE_MAP,p,p.image[0]);p.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}else m instanceof
|
|
|
-THREE.WebGLRenderTargetCube?(p=m,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,p.__webglTexture)):T(m,k)}else if(C=="tv"){if(!p._array){p._array=[];C=0;for(q=p.texture.length;C<q;C++)p._array[C]=k+C}e.uniform1iv(m,p._array);C=0;for(q=p.texture.length;C<q;C++)(m=p.texture[C])&&T(m,p._array[C])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
|
|
|
-THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Ua);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ua),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||i.receiveShadow)&&
|
|
|
-j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=na&&(na=f,c=!0);if(!i.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
|
|
|
-e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,z=j.morphTargetForcedOrder,p=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<z.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[z[n]]),e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=p[z[n]],n++;else{var z=[],m=-1,
|
|
|
-q=0,p=j.morphTargetInfluences,t,C=p.length,n=0;for(j.morphTargetBase!==-1&&(z[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!z[t]&&p[t]>m&&(q=t,m=p[q]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=m;z[q]=1;m=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,i,h,j=b.vertices,k=j.length,y=b.colors,n=y.length,D=b.__vertexArray,m=b.__colorArray,p=b.__sortArray,C=b.__dirtyVertices,q=b.__dirtyColors,t=b.__webglCustomAttributes,r,u;if(t)for(r in t)t[r].offset=0;if(d.sortParticles){Ga.multiplySelf(d.matrixWorld);for(f=0;f<k;f++)i=j[f].position,Sa.copy(i),Ga.multiplyVector3(Sa),p[f]=[Sa.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)i=j[p[f][1]].position,h=f*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;
|
|
|
+for(f=0;f<n;f++)h=f*3,color=y[p[f][1]],m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;if(t)for(r in t){f=t[r];y=f.value.length;for(h=0;h<y;h++){index=p[h][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")u=f.value[index];f.size===2?(f.array[n]=u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=
|
|
|
+u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}else{if(C)for(f=0;f<k;f++)i=j[f].position,h=f*3,D[h]=i.x,D[h+1]=i.y,D[h+2]=i.z;if(q)for(f=0;f<n;f++)color=y[f],h=f*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;if(t)for(r in t)if(f=t[r],f.__original.needsUpdate){y=f.value.length;for(h=0;h<y;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")u=f.value[h];f.size===2?(f.array[n]=
|
|
|
+u.x,f.array[n+1]=u.y):f.size===3?f.type==="c"?(f.array[n]=u.r,f.array[n+1]=u.g,f.array[n+2]=u.b):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z):(f.array[n]=u.x,f.array[n+1]=u.y,f.array[n+2]=u.z,f.array[n+3]=u.w)}f.offset+=f.size}}}if(C||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,D,c);if(q||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,m,c);if(t)for(r in t)if(f=t[r],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,i){f.program||M.initMaterial(f,c,d,i);if(f.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,j=M.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var k=!1,h=f.program,j=h.uniforms,y=f.uniforms;h!=Xa&&(e.useProgram(h),Xa=h,k=!0);if(f.id!=U)U=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Va);if(d&&f.fog)if(y.fogColor.value=d.color,d instanceof
|
|
|
+THREE.Fog)y.fogNear.value=d.near,y.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)y.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var n,D,m=0,p=0,C=0,q,t,r,v=Za,H=v.directional.colors,B=v.directional.positions,z=v.point.colors,x=v.point.positions,F=v.point.distances,E=0,K=0,d=n=r=0,k=c.length;d<k;d++)if(n=c[d],D=n.color,q=n.position,t=n.intensity,r=n.distance,n instanceof THREE.AmbientLight)m+=D.r,p+=D.g,C+=D.b;else if(n instanceof
|
|
|
+THREE.DirectionalLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,B[r]=q.x,B[r+1]=q.y,B[r+2]=q.z,E+=1;else if(n instanceof THREE.SpotLight)r=E*3,H[r]=D.r*t,H[r+1]=D.g*t,H[r+2]=D.b*t,D=1/q.length(),B[r]=q.x*D,B[r+1]=q.y*D,B[r+2]=q.z*D,E+=1;else if(n instanceof THREE.PointLight)n=K*3,z[n]=D.r*t,z[n+1]=D.g*t,z[n+2]=D.b*t,x[n]=q.x,x[n+1]=q.y,x[n+2]=q.z,F[K]=r,K+=1;d=E*3;for(k=H.length;d<k;d++)H[d]=0;d=K*3;for(k=z.length;d<k;d++)z[d]=0;v.point.length=K;v.directional.length=E;v.ambient[0]=m;v.ambient[1]=
|
|
|
+p;v.ambient[2]=C;c=Za;y.enableLighting.value=c.directional.length+c.point.length;y.ambientLightColor.value=c.ambient;y.directionalLightColor.value=c.directional.colors;y.directionalLightDirection.value=c.directional.positions;y.pointLightColor.value=c.point.colors;y.pointLightPosition.value=c.point.positions;y.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)y.diffuse.value=f.color,y.opacity.value=
|
|
|
+f.opacity,(y.map.texture=f.map)&&y.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),y.lightMap.texture=f.lightMap,y.envMap.texture=f.envMap,y.reflectivity.value=f.reflectivity,y.refractionRatio.value=f.refractionRatio,y.combine.value=f.combine,y.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)y.diffuse.value=f.color,y.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)y.psColor.value=
|
|
|
+f.color,y.opacity.value=f.opacity,y.size.value=f.size,y.scale.value=Ca.height/2,y.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)y.ambient.value=f.ambient,y.specular.value=f.specular,y.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)y.mNear.value=b.near,y.mFar.value=b.far,y.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)y.opacity.value=f.opacity;if(i.receiveShadow&&!f._shadowPass&&y.shadowMatrix){for(c=0;c<Ua.length;c++)y.shadowMatrix.value[c]=
|
|
|
+Ua[c],y.shadowMap.texture[c]=M.shadowMap[c];y.shadowDarkness.value=M.shadowMapDarkness;y.shadowBias.value=M.shadowMapBias}c=f.uniformsList;y=0;for(d=c.length;y<d;y++)if(p=h.uniforms[c[y][1]])if(m=c[y][0],C=m.type,k=m.value,C=="i")e.uniform1i(p,k);else if(C=="f")e.uniform1f(p,k);else if(C=="v2")e.uniform2f(p,k.x,k.y);else if(C=="v3")e.uniform3f(p,k.x,k.y,k.z);else if(C=="v4")e.uniform4f(p,k.x,k.y,k.z,k.w);else if(C=="c")e.uniform3f(p,k.r,k.g,k.b);else if(C=="fv1")e.uniform1fv(p,k);else if(C=="fv")e.uniform3fv(p,
|
|
|
+k);else if(C=="v3v"){if(!m._array)m._array=new Float32Array(3*k.length);C=0;for(q=k.length;C<q;C++)v=C*3,m._array[v]=k[C].x,m._array[v+1]=k[C].y,m._array[v+2]=k[C].z;e.uniform3fv(p,m._array)}else if(C=="m4"){if(!m._array)m._array=new Float32Array(16);k.flattenToArray(m._array);e.uniformMatrix4fv(p,!1,m._array)}else if(C=="m4v"){if(!m._array)m._array=new Float32Array(16*k.length);C=0;for(q=k.length;C<q;C++)k[C].flattenToArrayOffset(m._array,C*16);e.uniformMatrix4fv(p,!1,m._array)}else if(C=="t"){if(e.uniform1i(p,
|
|
|
+k),p=m.texture)if(p.image instanceof Array&&p.image.length==6){if(m=p,m.image.length==6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image[k]);u(e.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else p instanceof
|
|
|
+THREE.WebGLRenderTargetCube?(m=p,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.__webglTexture)):S(p,k)}else if(C=="tv"){if(!m._array){m._array=[];C=0;for(q=m.texture.length;C<q;C++)m._array[C]=k+C}e.uniform1iv(p,m._array);C=0;for(q=m.texture.length;C<q;C++)(p=m.texture[C])&&S(p,m._array[C])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
|
|
|
+THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Wa);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Wa),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||i.receiveShadow)&&
|
|
|
+j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function f(b,c,f,i,h,j){if(i.opacity!=0){var k,f=d(b,c,f,i,j),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=W&&(W=f,c=!0);if(!i.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=i.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
|
|
|
+e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,y=j.morphTargetForcedOrder,m=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<y.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[y[n]]),e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=m[y[n]],n++;else{var y=[],p=-1,
|
|
|
+q=0,m=j.morphTargetInfluences,t,C=m.length,n=0;for(j.morphTargetBase!==-1&&(y[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!y[t]&&m[t]>p&&(q=t,p=m[q]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);e.vertexAttribPointer(f["morphTarget"+n],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=p;y[q]=1;p=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
|
|
|
0&&(f=h.__webglCustomAttributes[k],e.bindBuffer(e.ARRAY_BUFFER,f.buffer),e.vertexAttribPointer(b[k],f.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));i.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,
|
|
|
e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}j instanceof THREE.Mesh?(i.wireframe?(e.lineWidth(i.wireframeLinewidth),c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,
|
|
|
e.UNSIGNED_SHORT,0)):(c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,h.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(i.linewidth),e.drawArrays(j,0,h.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.info.render.calls++):
|
|
|
j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.info.render.calls++)}}function i(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,z,n,p,m,q,C=b.count*3;for(q=0;q<C;q+=9)d=b.normalArray,f=d[q],h=d[q+1],i=d[q+2],j=d[q+3],z=d[q+4],p=d[q+5],k=d[q+6],n=d[q+7],m=d[q+8],f=(f+j+k)/3,h=(h+z+n)/3,i=(i+p+m)/3,d[q]=f,d[q+1]=h,d[q+2]=i,d[q+3]=f,d[q+4]=h,d[q+5]=i,d[q+6]=f,d[q+7]=h,d[q+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
|
|
|
-0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),$=b.doubleSided;if(N!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),N=b.flipSided}function j(b){sa!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),sa=b)}function k(b){R!=b&&(e.depthMask(b),R=b)}function p(b,c,d){ua!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),ua=b);if(b&&(La!=c||Ra!=d))e.polygonOffset(c,d),La=c,Ra=d}function n(b){Ca[0].set(b.n41-
|
|
|
-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=Ca[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
-Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=Ca[d].x*c.n14+Ca[d].y*c.n24+Ca[d].z*c.n34+Ca[d].w,b<=e)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?m(h,e):m(f,e)}function v(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
|
|
|
-0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?m(k,f):m(j,f))}else(f=c)&&(f.transparent?m(k,f):m(j,f))}function B(b,c){return c.z-b.z}function x(b){var c,k,p,I=0,m,t,O,z,s=b.lights;X||(X=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=s.length;c<k;c++)if(p=s[c],p instanceof THREE.SpotLight&&p.castShadow){V=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Sa[I]||(Sa[I]=new THREE.Matrix4);m=M.shadowMap[I];t=Sa[I];X.position.copy(p.position);X.target.position.copy(p.target.position);X.update(void 0,!0);b.update(void 0,!1,X);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(X.projectionMatrix);t.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(Ua);X.projectionMatrix.flattenToArray(Ta);Fa.multiply(X.projectionMatrix,X.matrixWorldInverse);n(Fa);M.initWebGLObjects(b);
|
|
|
-L(m);e.clearColor(1,1,1,1);M.clear();e.clearColor(aa.r,aa.g,aa.b,Ga);t=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(m=0;m<t;m++)O=b.__webglObjects[m],z=O.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||q(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,X,!1),O.render=!0):O.render=!1:O.render=!1;j(!0);G(THREE.NormalBlending);for(m=0;m<t;m++)if(O=b.__webglObjects[m],O.render)z=O.object,buffer=O.buffer,h(z),O=z.customDepthMaterial?z.customDepthMaterial:
|
|
|
-z.geometry.morphTargets.length?Za:Va,f(X,s,null,O,buffer,z);for(m=0;m<p;m++)O=b.__webglObjectsImmediate[m],z=O.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,X,!1),h(z),program=d(X,s,null,Va,z),z.render(function(b){i(b,program,Va.shading)}));I++}}function D(b,c){var d,f,h;d=s.attributes;var i=s.uniforms,j=ya/Ea,k,n=[],p=Ea*0.5,m=ya*0.5,q=!0;e.useProgram(s.program);Wa=s.program;na=sa=ka=-1;$a||(e.enableVertexAttribArray(s.attributes.position),
|
|
|
-e.enableVertexAttribArray(s.attributes.uv),$a=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,s.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Ta);e.activeTexture(e.TEXTURE0);e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?
|
|
|
-h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,(h.position.x-p)/p,(m-h.position.y)/m,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,
|
|
|
-0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?ya:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),
|
|
|
-h.mergeWith3D&&!q?(e.enable(e.DEPTH_TEST),q=!0):!h.mergeWith3D&&q&&(e.disable(e.DEPTH_TEST),q=!1),G(h.blending),T(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(R)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function va(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<
|
|
|
-e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function wa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ra(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,h,i,j,k,n,p={},m=b.morphTargets!==
|
|
|
-void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),p[k]==void 0&&(p[k]={hash:k,counter:0}),n=p[k].hash+"_"+p[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:m}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(p[k].counter+=1,n=p[k].hash+"_"+p[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:m})),
|
|
|
-b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ia(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,
|
|
|
-e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ka=b}}function u(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,W(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,W(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,W(c.magFilter)),e.texParameteri(b,
|
|
|
-e.TEXTURE_MIN_FILTER,W(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ja(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,ja(c.minFilter)))}function T(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?
|
|
|
-e.texImage2D(e.TEXTURE_2D,0,W(b.format),b.image.width,b.image.height,0,W(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);u(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=
|
|
|
-e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,W(b.format),b.width,b.height,0,W(b.format),W(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,W(b.format),b.width,b.height,
|
|
|
-0,W(b.format),W(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,
|
|
|
-b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);
|
|
|
-e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=ya,f=Ia,h=Aa);c!=xa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),xa=c)}function U(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,
|
|
|
-null))}function Z(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function ja(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function W(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
|
|
|
+b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,y,n,m,p,q,C=b.count*3;for(q=0;q<C;q+=9)d=b.normalArray,f=d[q],h=d[q+1],i=d[q+2],j=d[q+3],y=d[q+4],m=d[q+5],k=d[q+6],n=d[q+7],p=d[q+8],f=(f+j+k)/3,h=(h+y+n)/3,i=(i+m+p)/3,d[q]=f,d[q+1]=h,d[q+2]=i,d[q+3]=f,d[q+4]=h,d[q+5]=i,d[q+6]=f,d[q+7]=h,d[q+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
|
|
|
+0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),$=b.doubleSided;if(N!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),N=b.flipSided}function j(b){sa!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),sa=b)}function k(b){Q!=b&&(e.depthMask(b),Q=b)}function m(b,c,d){Aa!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Aa=b);if(b&&(Ja!=c||Ta!=d))e.polygonOffset(c,d),Ja=c,Ta=d}function n(b){aa[0].set(b.n41-
|
|
|
+b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);aa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);aa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);aa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);aa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);aa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=aa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
+Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=aa[d].x*c.n14+aa[d].y*c.n24+aa[d].z*c.n34+aa[d].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?p(h,e):p(f,e)}function v(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
|
|
|
+0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?p(k,f):p(j,f))}else(f=c)&&(f.transparent?p(k,f):p(j,f))}function B(b,c){return c.z-b.z}function x(b){var c,k,m,I=0,p,t,r,y,u=b.lights;if(!ma)ma=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar),ma.useTarget=!0;c=0;for(k=u.length;c<k;c++)if(m=u[c],m instanceof THREE.SpotLight&&m.castShadow){U=-1;M.shadowMap[I]||(M.shadowMap[I]=new THREE.WebGLRenderTarget(M.shadowMapWidth,
|
|
|
+M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ua[I]||(Ua[I]=new THREE.Matrix4);p=M.shadowMap[I];t=Ua[I];ma.position.copy(m.position);ma.target.position.copy(m.target.position);ma.update(void 0,!0);b.update(void 0,!1,ma);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(ma.projectionMatrix);t.multiplySelf(ma.matrixWorldInverse);ma.matrixWorldInverse.flattenToArray(Wa);ma.projectionMatrix.flattenToArray(Va);Ga.multiply(ma.projectionMatrix,
|
|
|
+ma.matrixWorldInverse);n(Ga);M.initWebGLObjects(b);L(p);e.clearColor(1,1,1,1);M.clear();e.clearColor(ha.r,ha.g,ha.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(p=0;p<t;p++)r=b.__webglObjects[p],y=r.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||q(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,ma,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);G(THREE.NormalBlending);for(p=0;p<t;p++)if(r=b.__webglObjects[p],r.render)y=r.object,buffer=
|
|
|
+r.buffer,h(y),r=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?$a:La,f(ma,u,null,r,buffer,y);for(p=0;p<m;p++)r=b.__webglObjectsImmediate[p],y=r.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),F(y,ma,!1),h(y),program=d(ma,u,null,La,y),y.immediateRenderCallback?y.immediateRenderCallback(program,e,aa):y.render(function(b){i(b,program,La.shading)}));I++}}function E(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=za/Ea,
|
|
|
+k,n=[],m=Ea*0.5,p=za*0.5,q=!0;e.useProgram(r.program);Xa=r.program;W=sa=ka=-1;ab||(e.enableVertexAttribArray(r.attributes.position),e.enableVertexAttribArray(r.attributes.uv),ab=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Va);e.activeTexture(e.TEXTURE0);
|
|
|
+e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,
|
|
|
+(h.position.x-m)/m,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),n[0]=k*j*h.scale.x,n[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),
|
|
|
+e.uniform3f(i.color,h.color.r,h.color.g,h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,n),h.mergeWith3D&&!q?(e.enable(e.DEPTH_TEST),q=!0):!h.mergeWith3D&&q&&(e.disable(e.DEPTH_TEST),q=!1),G(h.blending),S(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Q)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
+function wa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ra(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);
|
|
|
+return f.join("_")}var e,d,f,h,i,j,k,n,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+i>65535&&(m[k].counter+=1,n=m[k].hash+"_"+m[k].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]=
|
|
|
+{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(f),b.geometryGroups[n].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=J++,b.geometryGroupsList.push(b.geometryGroups[q])}function ja(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
|
|
|
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ka=b}}function u(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,V(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,V(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,V(c.magFilter)),
|
|
|
+e.texParameteri(b,e.TEXTURE_MIN_FILTER,V(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ya(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,ya(c.minFilter)))}function S(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
+THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);u(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;
|
|
|
+b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,V(b.format),
|
|
|
+b.width,b.height,0,V(b.format),V(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
|
|
|
+e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
|
|
|
+null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=za,f=Ka,h=Ba);c!=va&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),va=c)}function T(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
|
|
|
+e.bindTexture(e.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function ya(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
|
|
|
case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
|
|
|
-case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,za=[],Wa=
|
|
|
-null,xa=null,V=-1,na=null,J=0,$=null,N=null,ka=null,sa=null,R=null,ua=null,La=null,Ra=null,Ia=0,Aa=0,Ea=0,ya=0,Ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Fa=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ja=new THREE.Vector4,Ya={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"),
|
|
|
-S=b.stencil!==void 0?b.stencil:!0,cb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,db=b.antialias!==void 0?b.antialias:!1,aa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ga=b.clearAlpha!==void 0?b.clearAlpha:0,Xa=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces: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 X,Sa=[],b=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(b.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ab}),Za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ab,morphTargets:!0});Va._shadowPass=
|
|
|
-!0;Za._shadowPass=!0;try{if(!(e=Ba.getContext("experimental-webgl",{antialias:db,stencil:S,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);
|
|
|
-e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(aa.r,aa.g,aa.b,Ga);this.context=e;var bb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,s={};s.vertices=new Float32Array(16);s.faces=new Uint16Array(6);S=0;s.vertices[S++]=-1;s.vertices[S++]=-1;s.vertices[S++]=0;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=-1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=1;s.vertices[S++]=
|
|
|
-0;s.vertices[S++]=-1;s.vertices[S++]=1;s.vertices[S++]=0;S=s.vertices[S++]=0;s.faces[S++]=0;s.faces[S++]=1;s.faces[S++]=2;s.faces[S++]=0;s.faces[S++]=2;s.faces[S++]=3;s.vertexBuffer=e.createBuffer();s.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,s.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,s.faces,e.STATIC_DRAW);s.program=e.createProgram();e.attachShader(s.program,Z("fragment",
|
|
|
-THREE.ShaderLib.sprite.fragmentShader));e.attachShader(s.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(s.program);s.attributes={};s.uniforms={};s.attributes.position=e.getAttribLocation(s.program,"position");s.attributes.uv=e.getAttribLocation(s.program,"uv");s.uniforms.uvOffset=e.getUniformLocation(s.program,"uvOffset");s.uniforms.uvScale=e.getUniformLocation(s.program,"uvScale");s.uniforms.rotation=e.getUniformLocation(s.program,"rotation");s.uniforms.scale=e.getUniformLocation(s.program,
|
|
|
-"scale");s.uniforms.alignment=e.getUniformLocation(s.program,"alignment");s.uniforms.color=e.getUniformLocation(s.program,"color");s.uniforms.map=e.getUniformLocation(s.program,"map");s.uniforms.opacity=e.getUniformLocation(s.program,"opacity");s.uniforms.useScreenCoordinates=e.getUniformLocation(s.program,"useScreenCoordinates");s.uniforms.affectedByDistance=e.getUniformLocation(s.program,"affectedByDistance");s.uniforms.screenPosition=e.getUniformLocation(s.program,"screenPosition");s.uniforms.modelViewMatrix=
|
|
|
-e.getUniformLocation(s.program,"modelViewMatrix");s.uniforms.projectionMatrix=e.getUniformLocation(s.program,"projectionMatrix");var $a=!1;this.setSize=function(b,c){Ba.width=b;Ba.height=c;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,c,d,f){Ia=b;Aa=c;Ea=d;ya=f;e.viewport(Ia,Aa,Ea,ya)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){aa.setHex(b);
|
|
|
-Ga=c;e.clearColor(aa.r,aa.g,aa.b,Ga)};this.setClearColor=function(b,c){aa.copy(b);Ga=c;e.clearColor(aa.r,aa.g,aa.b,Ga)};this.getClearColor=function(){return aa};this.getClearAlpha=function(){return Ga};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,
|
|
|
-b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);
|
|
|
-e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=
|
|
|
-b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?
|
|
|
-k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var p,m,q;p=q=n=0;for(m=c.length;p<m;p++)j=c[p],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&n++;n+q<=Xa?p=q:(p=Math.ceil(Xa*q/(n+q)),n=Xa-p);j={directional:p,point:n};n=q=0;for(p=
|
|
|
-c.length;n<p;n++)m=c[n],m instanceof THREE.SpotLight&&m.castShadow&&q++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var C;a:{p=b.fragmentShader;m=b.vertexShader;var n=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,
|
|
|
-shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},s,f=[];k?f.push(k):(f.push(p),f.push(m));for(s in d)f.push(s),f.push(d[s]);k=f.join();s=0;for(f=za.length;s<f;s++)if(za[s].code==k){C=za[s].program;break a}s=e.createProgram();f=[bb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+
|
|
|
-d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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");
|
|
|
+case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,ua=[],Xa=
|
|
|
+null,va=null,U=-1,W=null,J=0,$=null,N=null,ka=null,sa=null,Q=null,Aa=null,Ja=null,Ta=null,Ka=0,Ba=0,Ea=0,za=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Va=new Float32Array(16),Wa=new Float32Array(16),Sa=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+R=b.stencil!==void 0?b.stencil:!0,db=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,eb=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0,Ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
|
|
|
+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 ma,Ua=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),La=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
|
|
|
+uniforms:bb,morphTargets:!0});La._shadowPass=!0;$a._shadowPass=!0;try{if(!(e=Ca.getContext("experimental-webgl",{antialias:eb,stencil:R,preserveDrawingBuffer:db})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(fb){console.error(fb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
|
|
|
+e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ha.r,ha.g,ha.b,Ha);this.context=e;var cb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);R=0;r.vertices[R++]=-1;r.vertices[R++]=-1;r.vertices[R++]=0;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=-1;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=1;r.vertices[R++]=
|
|
|
+1;r.vertices[R++]=1;r.vertices[R++]=0;r.vertices[R++]=-1;r.vertices[R++]=1;r.vertices[R++]=0;R=r.vertices[R++]=0;r.faces[R++]=0;r.faces[R++]=1;r.faces[R++]=2;r.faces[R++]=0;r.faces[R++]=2;r.faces[R++]=3;r.vertexBuffer=e.createBuffer();r.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,r.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,r.faces,e.STATIC_DRAW);r.program=e.createProgram();
|
|
|
+e.attachShader(r.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(r.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=e.getAttribLocation(r.program,"position");r.attributes.uv=e.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=e.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=e.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=e.getUniformLocation(r.program,"rotation");
|
|
|
+r.uniforms.scale=e.getUniformLocation(r.program,"scale");r.uniforms.alignment=e.getUniformLocation(r.program,"alignment");r.uniforms.color=e.getUniformLocation(r.program,"color");r.uniforms.map=e.getUniformLocation(r.program,"map");r.uniforms.opacity=e.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=e.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=e.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=e.getUniformLocation(r.program,
|
|
|
+"screenPosition");r.uniforms.modelViewMatrix=e.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=e.getUniformLocation(r.program,"projectionMatrix");var ab=!1;this.setSize=function(b,c){Ca.width=b;Ca.height=c;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(b,c,d,f){Ka=b;Ba=c;Ea=d;za=f;e.viewport(Ka,Ba,Ea,za)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
+function(b,c){ha.setHex(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.setClearColor=function(b,c){ha.copy(b);Ha=c;e.clearColor(ha.r,ha.g,ha.b,Ha)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return Ha};this.clear=function(b,c,d){var f=0;if(b==void 0||b)f|=e.COLOR_BUFFER_BIT;if(c==void 0||c)f|=e.DEPTH_BUFFER_BIT;if(d==void 0||d)f|=e.STENCIL_BUFFER_BIT;e.clear(f)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
|
|
|
+delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);
|
|
|
+e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),
|
|
|
+M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":
|
|
|
+b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var m,p,q;m=q=n=0;for(p=c.length;m<p;m++)j=c[m],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&
|
|
|
+n++;n+q<=Ya?m=q:(m=Math.ceil(Ya*q/(n+q)),n=Ya-m);j={directional:m,point:n};n=q=0;for(m=c.length;n<m;n++)p=c[n],p instanceof THREE.SpotLight&&p.castShadow&&q++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var C;a:{m=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
+maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},r,f=[];k?f.push(k):(f.push(m),f.push(p));for(r in d)f.push(r),f.push(d[r]);k=f.join();r=0;for(f=ua.length;r<f;r++)if(ua[r].code==k){C=ua[r].program;break a}r=e.createProgram();f=[cb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,
|
|
|
+"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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");
|
|
|
j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
|
|
|
-d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(s,Z("fragment",j+p));e.attachShader(s,Z("vertex",f+m));e.linkProgram(s);e.getProgramParameter(s,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(s,e.VALIDATE_STATUS)+", gl error ["+
|
|
|
-e.getError()+"]");s.uniforms={};s.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)f.push(u);u=f;f=0;for(n=u.length;f<n;f++)p=u[f],s.uniforms[p]=e.getUniformLocation(s,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(C in c)f.push(C);
|
|
|
-C=f;u=0;for(c=C.length;u<c;u++)d=C[u],s.attributes[d]=e.getAttribLocation(s,d);s.id=za.length;za.push({program:s,code:k});M.info.memory.programs=za.length;C=s}b.program=C;C=b.program.attributes;C.position>=0&&e.enableVertexAttribArray(C.position);C.color>=0&&e.enableVertexAttribArray(C.color);C.normal>=0&&e.enableVertexAttribArray(C.normal);C.tangent>=0&&e.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(e.enableVertexAttribArray(C.skinVertexA),
|
|
|
-e.enableVertexAttribArray(C.skinVertexB),e.enableVertexAttribArray(C.skinIndex),e.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&e.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(e.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){L(b);
|
|
|
-b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);e.clear(b)};this.render=function(b,c,e,m){var I,s,u,O,z,J,E,Pa,Qa=b.lights,C=b.fog;V=-1;this.shadowMapEnabled&&x(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ua);c.projectionMatrix.flattenToArray(Ta);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);n(Fa);this.initWebGLObjects(b);L(e);
|
|
|
-(this.autoClear||m)&&this.clear();z=b.__webglObjects.length;for(m=0;m<z;m++)if(I=b.__webglObjects[m],E=I.object,E.visible)if(!(E instanceof THREE.Mesh)||!E.frustumCulled||q(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),v(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Ja.copy(E.position),Fa.multiplyVector3(Ja),I.z=Ja.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);J=b.__webglObjectsImmediate.length;for(m=0;m<J;m++)I=
|
|
|
-b.__webglObjectsImmediate[m],E=I.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),t(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(m=0;m<z;m++)if(I=b.__webglObjects[m],I.render)E=I.object,Pa=I.buffer,h(E),f(c,Qa,C,b.overrideMaterial,Pa,E);for(m=0;m<J;m++)I=b.__webglObjectsImmediate[m],E=I.object,E.visible&&(h(E),s=d(c,Qa,C,b.overrideMaterial,E),E.render(function(c){i(c,s,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);
|
|
|
-for(m=z-1;m>=0;m--)if(I=b.__webglObjects[m],I.render){E=I.object;Pa=I.buffer;u=I.opaque;h(E);for(I=0;I<u.count;I++)O=u.list[I],j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),f(c,Qa,C,O,Pa,E)}for(m=0;m<J;m++)if(I=b.__webglObjectsImmediate[m],E=I.object,E.visible){u=I.opaque;h(E);for(I=0;I<u.count;I++)O=u.list[I],j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),s=d(c,Qa,C,O,E),E.render(function(b){i(b,s,O.shading)})}for(m=
|
|
|
-0;m<z;m++)if(I=b.__webglObjects[m],I.render){E=I.object;Pa=I.buffer;u=I.transparent;h(E);for(I=0;I<u.count;I++)O=u.list[I],G(O.blending),j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),f(c,Qa,C,O,Pa,E)}for(m=0;m<J;m++)if(I=b.__webglObjectsImmediate[m],E=I.object,E.visible){u=I.transparent;h(E);for(I=0;I<u.count;I++)O=u.list[I],G(O.blending),j(O.depthTest),k(O.depthWrite),p(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),s=d(c,Qa,C,O,E),E.render(function(b){i(b,
|
|
|
-s,O.shading)})}}b.__webglSprites.length&&D(b,c);e&&e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&U(e)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=
|
|
|
-new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=
|
|
|
-e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,s=void 0,u=s=void 0,t=void 0,v=void 0,B=v=n=0,x=s=q=void 0,s=m=x=q=p=void 0,u=k.geometry,t=u.faces,x=
|
|
|
-j.faces,p=0,q=x.length;p<q;p++)s=x[p],s=t[s],s instanceof THREE.Face3?(n+=3,v+=1,B+=3):s instanceof THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,q=k,F=x=t=void 0,H=void 0,F=void 0,s=[],t=0,x=q.materials.length;t<x;t++)if(F=q.materials[t],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<l;F++)(H=p.materials[F])&&s.push(H)}else(H=F)&&s.push(H);p=s;j.__materials=p;a:{t=q=void 0;x=p.length;for(q=0;q<x;q++)if(t=p[q],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{x=
|
|
|
-t=void 0;s=p.length;for(t=0;t<s;t++)if(x=p[t],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{s=t=void 0;F=p.length;for(t=0;t<F;t++)if(s=p[t],s.vertexColors){s=s.vertexColors;break a}s=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(s)j.__colorArray=new Float32Array(n*
|
|
|
-3);if(q){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(k.geometry.skinWeights.length&&k.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(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=
|
|
|
-new Uint16Array(B*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=s;j.__normalType=x;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=B*2;u=0;for(t=p.length;u<t;u++)if(q=p[u],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];
|
|
|
-x={};for(m in s)x[m]=s[m];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=e.createBuffer(),x.buffer.belongsToAttribute=a,s.needsUpdate=!0,x.__original=s;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof
|
|
|
-THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,
|
|
|
-j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=
|
|
|
-k.materials;B=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(B=k.materials[m],B.attributes){if(j.__webglCustomAttributes===void 0)j.__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(n*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ia(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||
|
|
|
-d instanceof THREE.ParticleSystem?(i=d.geometry,ia(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(f.__webglObjects,
|
|
|
-d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else d instanceof THREE.MarchingCubes&&qa(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=va(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||
|
|
|
-h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=e.DYNAMIC_DRAW,B=!h.dynamic,m.__inittedArrays){var D=p=u=void 0,y=void 0,J=D=void 0,G=void 0,R=void 0,K=void 0,P=H=F=s=x=t=q=void 0,Q=void 0,L=void 0,r=y=K=y=R=G=void 0,o=void 0,A=o=r=G=void 0,S=void 0,V=A=o=r=D=D=J=K=y=A=o=r=S=A=o=r=S=A=o=r=void 0,ha=0,N=0,Z=0,$=0,W=0,T=0,Y=0,U=0,la=0,w=0,ma=0,A=r=0,A=void 0,oa=m.__vertexArray,ka=m.__uvArray,na=m.__uv2Array,X=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,
|
|
|
-ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ja=m.__faceArray,Da=m.__lineArray,xa=m.__needsSmoothNormals,t=m.__vertexColorType,q=m.__uvType,x=m.__normalType,ta=i.geometry,ya=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ca=ta.__dirtyTangents,Ea=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ba=ta.vertices,Ga=m.faces,La=ta.faces,Ia=ta.faceVertexUvs[0],Ja=ta.faceVertexUvs[1],Ma=ta.skinVerticesA,
|
|
|
-Na=ta.skinVerticesB,Oa=ta.skinIndices,Ka=ta.skinWeights,Ha=ta.morphTargets;if(aa)for(V in aa)aa[V].offset=0,aa[V].offsetSrc=0;u=0;for(p=Ga.length;u<p;u++)if(D=Ga[u],y=La[D],Ia&&(s=Ia[D]),Ja&&(F=Ja[D]),D=y.vertexNormals,J=y.normal,G=y.vertexColors,R=y.color,K=y.vertexTangents,y instanceof THREE.Face3){if(ya)H=Ba[y.a].position,P=Ba[y.b].position,Q=Ba[y.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=P.x,oa[N+4]=P.y,oa[N+5]=P.z,oa[N+6]=Q.x,oa[N+7]=Q.y,oa[N+8]=Q.z,N+=9;if(aa)for(V in aa)if(o=aa[V],
|
|
|
-o.__original.needsUpdate)r=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[r]=o.value[y.a],o.array[r+1]=o.value[y.b],o.array[r+2]=o.value[y.c]):o.boundTo==="faces"?(A=o.value[A],o.array[r]=A,o.array[r+1]=A,o.array[r+2]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[r]=o.value[A],o.array[r+1]=o.value[A+1],o.array[r+2]=o.value[A+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[y.a],P=o.value[y.b],Q=o.value[y.c]):o.boundTo===
|
|
|
-"faces"?(Q=P=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],P=o.value[A+1],Q=o.value[A+2],o.offsetSrc+=3),o.size===2?(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=P.x,o.array[r+3]=P.y,o.array[r+4]=Q.x,o.array[r+5]=Q.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[r]=H.r,o.array[r+1]=H.g,o.array[r+2]=H.b,o.array[r+3]=P.r,o.array[r+4]=P.g,o.array[r+5]=P.b,o.array[r+6]=Q.r,o.array[r+7]=Q.g,o.array[r+8]=Q.b):(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=H.z,o.array[r+3]=P.x,
|
|
|
-o.array[r+4]=P.y,o.array[r+5]=P.z,o.array[r+6]=Q.x,o.array[r+7]=Q.y,o.array[r+8]=Q.z),o.offset+=9):(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=H.z,o.array[r+3]=H.w,o.array[r+4]=P.x,o.array[r+5]=P.y,o.array[r+6]=P.z,o.array[r+7]=P.w,o.array[r+8]=Q.x,o.array[r+9]=Q.y,o.array[r+10]=Q.z,o.array[r+11]=Q.w,o.offset+=12));if(Fa){r=0;for(o=Ha.length;r<o;r++)H=Ha[r].vertices[y.a].position,P=Ha[r].vertices[y.b].position,Q=Ha[r].vertices[y.c].position,A=sa[r],A[ma]=H.x,A[ma+1]=H.y,A[ma+2]=H.z,A[ma+3]=P.x,
|
|
|
-A[ma+4]=P.y,A[ma+5]=P.z,A[ma+6]=Q.x,A[ma+7]=Q.y,A[ma+8]=Q.z;ma+=9}if(Ka.length)r=Ka[y.a],o=Ka[y.b],A=Ka[y.c],ga[w]=r.x,ga[w+1]=r.y,ga[w+2]=r.z,ga[w+3]=r.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,r=Oa[y.a],o=Oa[y.b],A=Oa[y.c],fa[w]=r.x,fa[w+1]=r.y,fa[w+2]=r.z,fa[w+3]=r.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,r=Ma[y.a],o=Ma[y.b],A=Ma[y.c],da[w]=r.x,da[w+1]=r.y,da[w+2]=r.z,da[w+3]=1,
|
|
|
-da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,r=Na[y.a],o=Na[y.b],A=Na[y.c],ea[w]=r.x,ea[w+1]=r.y,ea[w+2]=r.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(y=G[0],r=G[1],o=G[2]):o=r=y=R,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=r.r,pa[la+4]=r.g,pa[la+5]=r.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,la+=9;if(Ca&&ta.hasTangents)G=K[0],R=K[1],y=
|
|
|
-K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=R.x,ca[Y+5]=R.y,ca[Y+6]=R.z,ca[Y+7]=R.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,Y+=12;if(Aa&&x)if(D.length==3&&xa)for(K=0;K<3;K++)J=D[K],X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;else for(K=0;K<3;K++)X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;if(ua&&s!==void 0&&q)for(K=0;K<3;K++)D=s[K],ka[Z]=D.u,ka[Z+1]=D.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<3;K++)D=F[K],na[$]=D.u,na[$+1]=D.v,$+=2;za&&(ja[W]=ha,ja[W+1]=ha+1,ja[W+2]=ha+2,W+=3,Da[U]=ha,Da[U+1]=
|
|
|
-ha+1,Da[U+2]=ha,Da[U+3]=ha+2,Da[U+4]=ha+1,Da[U+5]=ha+2,U+=6,ha+=3)}else if(y instanceof THREE.Face4){if(ya)H=Ba[y.a].position,P=Ba[y.b].position,Q=Ba[y.c].position,L=Ba[y.d].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=P.x,oa[N+4]=P.y,oa[N+5]=P.z,oa[N+6]=Q.x,oa[N+7]=Q.y,oa[N+8]=Q.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(V in aa)if(o=aa[V],o.__original.needsUpdate)r=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[r]=o.value[y.a],o.array[r+
|
|
|
-1]=o.value[y.b],o.array[r+2]=o.value[y.c],o.array[r+3]=o.value[y.d]):o.boundTo==="faces"?(A=o.value[A],o.array[r]=A,o.array[r+1]=A,o.array[r+2]=A,o.array[r+3]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[r]=o.value[A],o.array[r+1]=o.value[A+1],o.array[r+2]=o.value[A+2],o.array[r+3]=o.value[A+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[y.a],P=o.value[y.b],Q=o.value[y.c],L=o.value[y.d]):o.boundTo==="faces"?(L=Q=P=H=A=o.value[A],o.offsetSrc++):o.boundTo===
|
|
|
-"faceVertices"&&(H=o.value[A],P=o.value[A+1],Q=o.value[A+2],L=o.value[A+3],o.offsetSrc+=4),o.size===2?(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=P.x,o.array[r+3]=P.y,o.array[r+4]=Q.x,o.array[r+5]=Q.y,o.array[r+6]=L.x,o.array[r+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[r]=H.r,o.array[r+1]=H.g,o.array[r+2]=H.b,o.array[r+3]=P.r,o.array[r+4]=P.g,o.array[r+5]=P.b,o.array[r+6]=Q.r,o.array[r+7]=Q.g,o.array[r+8]=Q.b,o.array[r+9]=L.r,o.array[r+10]=L.g,o.array[r+11]=L.b):(o.array[r]=H.x,o.array[r+
|
|
|
-1]=H.y,o.array[r+2]=H.z,o.array[r+3]=P.x,o.array[r+4]=P.y,o.array[r+5]=P.z,o.array[r+6]=Q.x,o.array[r+7]=Q.y,o.array[r+8]=Q.z,o.array[r+9]=L.x,o.array[r+10]=L.y,o.array[r+11]=L.z),o.offset+=12):(o.array[r]=H.x,o.array[r+1]=H.y,o.array[r+2]=H.z,o.array[r+3]=H.w,o.array[r+4]=P.x,o.array[r+5]=P.y,o.array[r+6]=P.z,o.array[r+7]=P.w,o.array[r+8]=Q.x,o.array[r+9]=Q.y,o.array[r+10]=Q.z,o.array[r+11]=Q.w,o.array[r+12]=L.x,o.array[r+13]=L.y,o.array[r+14]=L.z,o.array[r+15]=L.w,o.offset+=16));if(Fa){r=0;for(o=
|
|
|
-Ha.length;r<o;r++)H=Ha[r].vertices[y.a].position,P=Ha[r].vertices[y.b].position,Q=Ha[r].vertices[y.c].position,L=Ha[r].vertices[y.d].position,A=sa[r],A[ma]=H.x,A[ma+1]=H.y,A[ma+2]=H.z,A[ma+3]=P.x,A[ma+4]=P.y,A[ma+5]=P.z,A[ma+6]=Q.x,A[ma+7]=Q.y,A[ma+8]=Q.z,A[ma+9]=L.x,A[ma+10]=L.y,A[ma+11]=L.z;ma+=12}if(Ka.length)r=Ka[y.a],o=Ka[y.b],A=Ka[y.c],S=Ka[y.d],ga[w]=r.x,ga[w+1]=r.y,ga[w+2]=r.z,ga[w+3]=r.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+
|
|
|
-12]=S.x,ga[w+13]=S.y,ga[w+14]=S.z,ga[w+15]=S.w,r=Oa[y.a],o=Oa[y.b],A=Oa[y.c],S=Oa[y.d],fa[w]=r.x,fa[w+1]=r.y,fa[w+2]=r.z,fa[w+3]=r.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,fa[w+12]=S.x,fa[w+13]=S.y,fa[w+14]=S.z,fa[w+15]=S.w,r=Ma[y.a],o=Ma[y.b],A=Ma[y.c],S=Ma[y.d],da[w]=r.x,da[w+1]=r.y,da[w+2]=r.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,da[w+12]=S.x,da[w+13]=S.y,da[w+14]=S.z,da[w+
|
|
|
-15]=1,r=Na[y.a],o=Na[y.b],A=Na[y.c],y=Na[y.d],ea[w]=r.x,ea[w+1]=r.y,ea[w+2]=r.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,ea[w+12]=y.x,ea[w+13]=y.y,ea[w+14]=y.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(y=G[0],r=G[1],o=G[2],G=G[3]):G=o=r=y=R,pa[la]=y.r,pa[la+1]=y.g,pa[la+2]=y.b,pa[la+3]=r.r,pa[la+4]=r.g,pa[la+5]=r.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,pa[la+9]=G.r,pa[la+10]=G.g,pa[la+11]=G.b,la+=12;if(Ca&&ta.hasTangents)G=
|
|
|
-K[0],R=K[1],y=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=R.x,ca[Y+5]=R.y,ca[Y+6]=R.z,ca[Y+7]=R.w,ca[Y+8]=y.x,ca[Y+9]=y.y,ca[Y+10]=y.z,ca[Y+11]=y.w,ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&x)if(D.length==4&&xa)for(K=0;K<4;K++)J=D[K],X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;else for(K=0;K<4;K++)X[T]=J.x,X[T+1]=J.y,X[T+2]=J.z,T+=3;if(ua&&s!==void 0&&q)for(K=0;K<4;K++)D=s[K],ka[Z]=D.u,ka[Z+1]=D.v,Z+=2;if(ua&&F!==void 0&&q)for(K=0;K<4;K++)D=F[K],na[$]=D.u,na[$+
|
|
|
-1]=D.v,$+=2;za&&(ja[W]=ha,ja[W+1]=ha+1,ja[W+2]=ha+3,ja[W+3]=ha+1,ja[W+4]=ha+2,ja[W+5]=ha+3,W+=6,Da[U]=ha,Da[U+1]=ha+1,Da[U+2]=ha,Da[U+3]=ha+3,Da[U+4]=ha+1,Da[U+5]=ha+2,Da[U+6]=ha+2,Da[U+7]=ha+3,U+=8,ha+=4)}ya&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,v));if(aa)for(V in aa)o=aa[V],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,v));if(Fa){r=0;for(o=Ha.length;r<o;r++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[r]),
|
|
|
-e.bufferData(e.ARRAY_BUFFER,sa[r],v)}Ea&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,v));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,X,v));Ca&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,v));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,
|
|
|
-na,v));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,v),e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,v));B&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=
|
|
|
-!1;wa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<q;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=i.colors;q=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<q;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=
|
|
|
-0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=va(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,wa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b==
|
|
|
-"front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
|
|
|
+d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(r,Z("fragment",j+m));e.attachShader(r,Z("vertex",f+p));e.linkProgram(r);e.getProgramParameter(r,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(r,e.VALIDATE_STATUS)+", gl error ["+
|
|
|
+e.getError()+"]");r.uniforms={};r.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in n)f.push(u);u=f;f=0;for(n=u.length;f<n;f++)m=u[f],r.uniforms[m]=e.getUniformLocation(r,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(C in c)f.push(C);
|
|
|
+C=f;u=0;for(c=C.length;u<c;u++)d=C[u],r.attributes[d]=e.getAttribLocation(r,d);r.id=ua.length;ua.push({program:r,code:k});M.info.memory.programs=ua.length;C=r}b.program=C;C=b.program.attributes;C.position>=0&&e.enableVertexAttribArray(C.position);C.color>=0&&e.enableVertexAttribArray(C.color);C.normal>=0&&e.enableVertexAttribArray(C.normal);C.tangent>=0&&e.enableVertexAttribArray(C.tangent);b.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0&&(e.enableVertexAttribArray(C.skinVertexA),
|
|
|
+e.enableVertexAttribArray(C.skinVertexB),e.enableVertexAttribArray(C.skinIndex),e.enableVertexAttribArray(C.skinWeight));if(b.attributes)for(i in b.attributes)C[i]!==void 0&&C[i]>=0&&e.enableVertexAttribArray(C[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,C[u]>=0&&(e.enableVertexAttribArray(C[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){L(b);
|
|
|
+this.clear(c,d,e)};this.render=function(b,c,p,r){var I,u,Fa,X,y,J,D,Qa,Ra=b.lights,C=b.fog;U=-1;this.shadowMapEnabled&&x(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ga.multiply(c.projectionMatrix,c.matrixWorldInverse);n(Ga);this.initWebGLObjects(b);L(p);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+y=b.__webglObjects.length;for(r=0;r<y;r++)if(I=b.__webglObjects[r],D=I.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||q(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),v(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Sa.copy(D.position),Ga.multiplyVector3(Sa),I.z=Sa.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);J=b.__webglObjectsImmediate.length;for(r=0;r<J;r++)I=b.__webglObjectsImmediate[r],D=
|
|
|
+I.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),F(D,c,!0),t(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render)D=I.object,Qa=I.buffer,h(D),f(c,Ra,C,b.overrideMaterial,Qa,D);for(r=0;r<J;r++)I=b.__webglObjectsImmediate[r],D=I.object,D.visible&&(h(D),u=d(c,Ra,C,b.overrideMaterial,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,
|
|
|
+La.shading)}))}else{G(THREE.NormalBlending);for(r=y-1;r>=0;r--)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),f(c,Ra,C,X,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.opaque;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),
|
|
|
+u=d(c,Ra,C,X,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}for(r=0;r<y;r++)if(I=b.__webglObjects[r],I.render){D=I.object;Qa=I.buffer;Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],G(X.blending),j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),f(c,Ra,C,X,Qa,D)}for(r=0;r<J;r++)if(I=b.__webglObjectsImmediate[r],D=I.object,D.visible){Fa=I.transparent;h(D);for(I=0;I<Fa.count;I++)X=Fa.list[I],
|
|
|
+G(X.blending),j(X.depthTest),k(X.depthWrite),m(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),u=d(c,Ra,C,X,D),D.immediateRenderCallback?D.immediateRenderCallback(u,e,aa):D.render(function(b){i(b,u,La.shading)})}}b.__webglSprites.length&&E(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&T(p)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
|
|
|
+f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&ra(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();
|
|
|
+k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<
|
|
|
+m;n++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,r=void 0,q=void 0,u=q=void 0,t=void 0,v=void 0,B=v=n=0,x=q=r=void 0,q=m=x=r=p=void 0,u=k.geometry,t=u.faces,x=j.faces,p=0,r=x.length;p<r;p++)q=x[p],q=t[q],q instanceof THREE.Face3?(n+=3,v+=1,B+=3):q instanceof THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,r=k,F=x=t=void 0,H=void 0,F=void 0,q=[],t=0,x=r.materials.length;t<x;t++)if(F=r.materials[t],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<
|
|
|
+l;F++)(H=p.materials[F])&&q.push(H)}else(H=F)&&q.push(H);p=q;j.__materials=p;a:{t=r=void 0;x=p.length;for(r=0;r<x;r++)if(t=p[r],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){r=!0;break a}r=!1}a:{x=t=void 0;q=p.length;for(t=0;t<q;t++)if(x=p[t],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{q=t=void 0;F=p.length;for(t=0;t<F;t++)if(q=p[t],q.vertexColors){q=
|
|
|
+q.vertexColors;break a}q=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(q)j.__colorArray=new Float32Array(n*3);if(r){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(k.geometry.skinWeights.length&&k.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(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(B*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(t=j.numMorphTargets;u<t;u++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=r;j.__vertexColorType=q;j.__normalType=x;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?
|
|
|
+k.geometry.edgeFaces.length*6:0);j.__webglLineCount=B*2;u=0;for(t=p.length;u<t;u++)if(r=p[u],r.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in r.attributes){q=r.attributes[a];x={};for(m in q)x[m]=q[m];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=e.createBuffer(),x.buffer.belongsToAttribute=a,q.needsUpdate=!0,
|
|
|
+x.__original=q;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=
|
|
|
+k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();
|
|
|
+j.__webglColorBuffer=e.createBuffer();M.info.geometries++;j=i;k=d;n=j.vertices.length;j.__vertexArray=new Float32Array(n*3);j.__colorArray=new Float32Array(n*3);j.__sortArray=[];j.__webglParticleCount=n;j.__materials=k.materials;B=v=m=void 0;m=0;for(v=k.materials.length;m<v;m++)if(B=k.materials[m],B.attributes){if(j.__webglCustomAttributes===void 0)j.__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(n*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=
|
|
|
+!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ja(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ja(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
|
|
|
+f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,d);d.__webglActive=
|
|
|
+!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,v=e.DYNAMIC_DRAW,B=!h.dynamic,m.__inittedArrays){var E=p=u=void 0,z=void 0,J=E=void 0,G=void 0,Q=void 0,K=void 0,O=H=F=q=
|
|
|
+x=t=r=void 0,P=void 0,L=void 0,s=z=K=z=Q=G=void 0,o=void 0,A=o=s=G=void 0,R=void 0,U=A=o=s=E=E=J=K=z=A=o=s=R=A=o=s=R=A=o=s=void 0,ia=0,N=0,Z=0,$=0,V=0,S=0,Y=0,T=0,la=0,w=0,na=0,A=s=0,A=void 0,oa=m.__vertexArray,ka=m.__uvArray,ma=m.__uv2Array,W=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,sa=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,o=void 0,ha=m.__faceArray,Da=m.__lineArray,ya=m.__needsSmoothNormals,
|
|
|
+t=m.__vertexColorType,r=m.__uvType,x=m.__normalType,ta=i.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Ea=ta.__dirtyColors,Ga=ta.__dirtyMorphTargets,Ca=ta.vertices,Ha=m.faces,La=ta.faces,Ja=ta.faceVertexUvs[0],Ka=ta.faceVertexUvs[1],Na=ta.skinVerticesA,Oa=ta.skinVerticesB,Pa=ta.skinIndices,Ma=ta.skinWeights,Ia=ta.morphTargets;if(aa)for(U in aa)aa[U].offset=0,aa[U].offsetSrc=0;u=0;for(p=Ha.length;u<p;u++)if(E=Ha[u],z=La[E],Ja&&(q=Ja[E]),
|
|
|
+Ka&&(F=Ka[E]),E=z.vertexNormals,J=z.normal,G=z.vertexColors,Q=z.color,K=z.vertexTangents,z instanceof THREE.Face3){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(aa)for(U in aa)if(o=aa[U],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c]):
|
|
|
+o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c]):o.boundTo==="faces"?(P=O=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],O=o.value[A+1],P=o.value[A+2],o.offsetSrc+=3),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,
|
|
|
+o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=P.x,o.array[s+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z),o.offset+=9):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+
|
|
|
+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.offset+=12));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,A=sa[s],A[na]=H.x,A[na+1]=H.y,A[na+2]=H.z,A[na+3]=O.x,A[na+4]=O.y,A[na+5]=O.z,A[na+6]=P.x,A[na+7]=P.y,A[na+8]=P.z;na+=9}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,
|
|
|
+ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,s=Na[z.a],o=Na[z.b],A=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,
|
|
|
+ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+11]=1,w+=12;if(Ea&&t)G.length==3&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2]):o=s=z=Q,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=s.r,pa[la+4]=s.g,pa[la+5]=s.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,la+=9;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,Y+=12;if(Aa&&x)if(E.length==3&&
|
|
|
+ya)for(K=0;K<3;K++)J=E[K],W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;else for(K=0;K<3;K++)W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<3;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<3;K++)E=F[K],ma[$]=E.u,ma[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+2,V+=3,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+2,Da[T+4]=ia+1,Da[T+5]=ia+2,T+=6,ia+=3)}else if(z instanceof THREE.Face4){if(va)H=Ca[z.a].position,O=Ca[z.b].position,P=Ca[z.c].position,L=Ca[z.d].position,
|
|
|
+oa[N]=H.x,oa[N+1]=H.y,oa[N+2]=H.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=L.x,oa[N+10]=L.y,oa[N+11]=L.z,N+=12;if(aa)for(U in aa)if(o=aa[U],o.__original.needsUpdate)s=o.offset,A=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[s]=o.value[z.a],o.array[s+1]=o.value[z.b],o.array[s+2]=o.value[z.c],o.array[s+3]=o.value[z.d]):o.boundTo==="faces"?(A=o.value[A],o.array[s]=A,o.array[s+1]=A,o.array[s+2]=A,o.array[s+3]=A,o.offsetSrc++):o.boundTo===
|
|
|
+"faceVertices"&&(o.array[s]=o.value[A],o.array[s+1]=o.value[A+1],o.array[s+2]=o.value[A+2],o.array[s+3]=o.value[A+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(H=o.value[z.a],O=o.value[z.b],P=o.value[z.c],L=o.value[z.d]):o.boundTo==="faces"?(L=P=O=H=A=o.value[A],o.offsetSrc++):o.boundTo==="faceVertices"&&(H=o.value[A],O=o.value[A+1],P=o.value[A+2],L=o.value[A+3],o.offsetSrc+=4),o.size===2?(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=O.x,o.array[s+3]=O.y,o.array[s+4]=
|
|
|
+P.x,o.array[s+5]=P.y,o.array[s+6]=L.x,o.array[s+7]=L.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[s]=H.r,o.array[s+1]=H.g,o.array[s+2]=H.b,o.array[s+3]=O.r,o.array[s+4]=O.g,o.array[s+5]=O.b,o.array[s+6]=P.r,o.array[s+7]=P.g,o.array[s+8]=P.b,o.array[s+9]=L.r,o.array[s+10]=L.g,o.array[s+11]=L.b):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=O.x,o.array[s+4]=O.y,o.array[s+5]=O.z,o.array[s+6]=P.x,o.array[s+7]=P.y,o.array[s+8]=P.z,o.array[s+9]=L.x,o.array[s+10]=L.y,o.array[s+11]=L.z),
|
|
|
+o.offset+=12):(o.array[s]=H.x,o.array[s+1]=H.y,o.array[s+2]=H.z,o.array[s+3]=H.w,o.array[s+4]=O.x,o.array[s+5]=O.y,o.array[s+6]=O.z,o.array[s+7]=O.w,o.array[s+8]=P.x,o.array[s+9]=P.y,o.array[s+10]=P.z,o.array[s+11]=P.w,o.array[s+12]=L.x,o.array[s+13]=L.y,o.array[s+14]=L.z,o.array[s+15]=L.w,o.offset+=16));if(Ga){s=0;for(o=Ia.length;s<o;s++)H=Ia[s].vertices[z.a].position,O=Ia[s].vertices[z.b].position,P=Ia[s].vertices[z.c].position,L=Ia[s].vertices[z.d].position,A=sa[s],A[na]=H.x,A[na+1]=H.y,A[na+2]=
|
|
|
+H.z,A[na+3]=O.x,A[na+4]=O.y,A[na+5]=O.z,A[na+6]=P.x,A[na+7]=P.y,A[na+8]=P.z,A[na+9]=L.x,A[na+10]=L.y,A[na+11]=L.z;na+=12}if(Ma.length)s=Ma[z.a],o=Ma[z.b],A=Ma[z.c],R=Ma[z.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=o.x,ga[w+5]=o.y,ga[w+6]=o.z,ga[w+7]=o.w,ga[w+8]=A.x,ga[w+9]=A.y,ga[w+10]=A.z,ga[w+11]=A.w,ga[w+12]=R.x,ga[w+13]=R.y,ga[w+14]=R.z,ga[w+15]=R.w,s=Pa[z.a],o=Pa[z.b],A=Pa[z.c],R=Pa[z.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=s.w,fa[w+4]=o.x,fa[w+5]=o.y,fa[w+6]=o.z,fa[w+7]=o.w,
|
|
|
+fa[w+8]=A.x,fa[w+9]=A.y,fa[w+10]=A.z,fa[w+11]=A.w,fa[w+12]=R.x,fa[w+13]=R.y,fa[w+14]=R.z,fa[w+15]=R.w,s=Na[z.a],o=Na[z.b],A=Na[z.c],R=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=1,da[w+4]=o.x,da[w+5]=o.y,da[w+6]=o.z,da[w+7]=1,da[w+8]=A.x,da[w+9]=A.y,da[w+10]=A.z,da[w+11]=1,da[w+12]=R.x,da[w+13]=R.y,da[w+14]=R.z,da[w+15]=1,s=Oa[z.a],o=Oa[z.b],A=Oa[z.c],z=Oa[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=o.x,ea[w+5]=o.y,ea[w+6]=o.z,ea[w+7]=1,ea[w+8]=A.x,ea[w+9]=A.y,ea[w+10]=A.z,ea[w+
|
|
|
+11]=1,ea[w+12]=z.x,ea[w+13]=z.y,ea[w+14]=z.z,ea[w+15]=1,w+=16;if(Ea&&t)G.length==4&&t==THREE.VertexColors?(z=G[0],s=G[1],o=G[2],G=G[3]):G=o=s=z=Q,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=s.r,pa[la+4]=s.g,pa[la+5]=s.b,pa[la+6]=o.r,pa[la+7]=o.g,pa[la+8]=o.b,pa[la+9]=G.r,pa[la+10]=G.g,pa[la+11]=G.b,la+=12;if(Ba&&ta.hasTangents)G=K[0],Q=K[1],z=K[2],K=K[3],ca[Y]=G.x,ca[Y+1]=G.y,ca[Y+2]=G.z,ca[Y+3]=G.w,ca[Y+4]=Q.x,ca[Y+5]=Q.y,ca[Y+6]=Q.z,ca[Y+7]=Q.w,ca[Y+8]=z.x,ca[Y+9]=z.y,ca[Y+10]=z.z,ca[Y+11]=z.w,
|
|
|
+ca[Y+12]=K.x,ca[Y+13]=K.y,ca[Y+14]=K.z,ca[Y+15]=K.w,Y+=16;if(Aa&&x)if(E.length==4&&ya)for(K=0;K<4;K++)J=E[K],W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;else for(K=0;K<4;K++)W[S]=J.x,W[S+1]=J.y,W[S+2]=J.z,S+=3;if(ua&&q!==void 0&&r)for(K=0;K<4;K++)E=q[K],ka[Z]=E.u,ka[Z+1]=E.v,Z+=2;if(ua&&F!==void 0&&r)for(K=0;K<4;K++)E=F[K],ma[$]=E.u,ma[$+1]=E.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+3,ha[V+3]=ia+1,ha[V+4]=ia+2,ha[V+5]=ia+3,V+=6,Da[T]=ia,Da[T+1]=ia+1,Da[T+2]=ia,Da[T+3]=ia+3,Da[T+4]=ia+1,Da[T+5]=ia+2,Da[T+
|
|
|
+6]=ia+2,Da[T+7]=ia+3,T+=8,ia+=4)}va&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,v));if(aa)for(U in aa)o=aa[U],o.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,v));if(Ga){s=0;for(o=Ia.length;s<o;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,sa[s],v)}Ea&&la>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,v));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
+m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,v));Ba&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,v));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,v));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,v));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,v),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
|
|
|
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Da,v));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,v),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,v));B&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
|
|
|
+delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=
|
|
|
+i.colors;r=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<r;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
|
|
|
+if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=u=B=B=void 0;p=i.vertices;n=i.colors;r=p.length;m=n.length;t=i.__vertexArray;v=i.__colorArray;x=i.__dirtyColors;if(i.__dirtyVertices){for(B=0;B<r;B++)u=p[B].position,k=B*3,t[k]=u.x,t[k+1]=u.y,t[k+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(x){for(B=0;B<m;B++)color=n[B],k=B*3,v[k]=color.r,v[k+1]=color.g,v[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
+v,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=wa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,xa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return cb}};
|
|
|
THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
|