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