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