|
@@ -37,8 +37,9 @@ b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0
|
|
new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var t=
|
|
new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var t=
|
|
h*k,o=h*g,p=f*k,u=f*g;this.n11=t+u*e;this.n12=p*e-o;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=o*e-p;this.n32=u+t*e;this.n33=j*h;break;case "ZXY":t=h*k;o=h*g;p=f*k;u=f*g;this.n11=t-u*e;this.n12=-j*g;this.n13=p+o*e;this.n21=o+p*e;this.n22=j*k;this.n23=u-t*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":t=j*k;o=j*g;p=e*k;u=e*g;this.n11=h*k;this.n12=p*f-o;this.n13=t*f+u;this.n21=h*g;this.n22=u*f+t;this.n23=o*f-p;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":t=j*h;o=
|
|
h*k,o=h*g,p=f*k,u=f*g;this.n11=t+u*e;this.n12=p*e-o;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=o*e-p;this.n32=u+t*e;this.n33=j*h;break;case "ZXY":t=h*k;o=h*g;p=f*k;u=f*g;this.n11=t-u*e;this.n12=-j*g;this.n13=p+o*e;this.n21=o+p*e;this.n22=j*k;this.n23=u-t*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":t=j*k;o=j*g;p=e*k;u=e*g;this.n11=h*k;this.n12=p*f-o;this.n13=t*f+u;this.n21=h*g;this.n22=u*f+t;this.n23=o*f-p;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":t=j*h;o=
|
|
j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=u-t*g;this.n13=p*g+o;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=o*g+p;this.n33=t-u*g;break;case "XZY":t=j*h;o=j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=t*g+u;this.n22=j*k;this.n23=o*g-p;this.n31=p*g-o;this.n32=e*k;this.n33=u*g+t;break;default:t=j*k,o=j*g,p=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=o+p*f,this.n22=t-u*f,this.n23=-e*h,this.n31=u-t*f,this.n32=p+o*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
|
|
j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=u-t*g;this.n13=p*g+o;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=o*g+p;this.n33=t-u*g;break;case "XZY":t=j*h;o=j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=t*g+u;this.n22=j*k;this.n23=o*g-p;this.n31=p*g-o;this.n32=e*k;this.n33=u*g+t;break;default:t=j*k,o=j*g,p=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=o+p*f,this.n22=t-u*f,this.n23=-e*h,this.n31=u-t*f,this.n32=p+o*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
|
|
-b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,t=c*h;c*=k;var o=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(o+f);this.n12=t-g;this.n13=c+h;this.n21=t+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
|
-extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
|
|
|
+b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,t=c*h;c*=k;var o=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(o+f);this.n12=t-g;this.n13=c+h;this.n21=t+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=new THREE.Matrix4,g=new THREE.Matrix4;f.setRotationFromQuaternion(c);
|
|
|
|
+g.setScale(e.x,e.y,e.z);this.multiply(f,g);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=new THREE.Vector3(this.n11,this.n21,this.n31),g=new THREE.Vector3(this.n12,this.n22,this.n32),j=new THREE.Vector3(this.n13,this.n23,this.n33),b=b instanceof THREE.Vector3?b:new THREE.Vector3,c=c instanceof THREE.Quaternion?c:new THREE.Quaternion,e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();e.y=g.length();e.z=j.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;
|
|
|
|
+f=this.clone();f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,t=b.n23,o=b.n24,p=b.n31,u=b.n32,v=b.n33,n=b.n34,x=b.n41,w=b.n42,B=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*n*w-o*v*w+o*u*B-k*n*B-t*u*y+k*v*y;c.n12=j*v*w-g*n*w-j*u*B+f*n*B+g*u*y-f*v*y;c.n13=g*o*w-j*t*w+j*k*B-f*o*B-g*k*y+f*t*y;c.n14=j*t*u-g*o*u-j*k*v+f*o*v+g*k*n-f*t*n;c.n21=o*v*x-t*n*x-o*p*B+h*n*B+t*p*y-h*v*y;c.n22=g*n*x-j*v*x+j*p*B-e*n*B-g*p*y+e*v*y;c.n23=j*t*x-g*o*x-j*h*B+e*o*B+g*h*y-e*t*y;c.n24=
|
|
THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,t=b.n23,o=b.n24,p=b.n31,u=b.n32,v=b.n33,n=b.n34,x=b.n41,w=b.n42,B=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*n*w-o*v*w+o*u*B-k*n*B-t*u*y+k*v*y;c.n12=j*v*w-g*n*w-j*u*B+f*n*B+g*u*y-f*v*y;c.n13=g*o*w-j*t*w+j*k*B-f*o*B-g*k*y+f*t*y;c.n14=j*t*u-g*o*u-j*k*v+f*o*v+g*k*n-f*t*n;c.n21=o*v*x-t*n*x-o*p*B+h*n*B+t*p*y-h*v*y;c.n22=g*n*x-j*v*x+j*p*B-e*n*B-g*p*y+e*v*y;c.n23=j*t*x-g*o*x-j*h*B+e*o*B+g*h*y-e*t*y;c.n24=
|
|
g*o*p-j*t*p+j*h*v-e*o*v-g*h*n+e*t*n;c.n31=k*n*x-o*u*x+o*p*w-h*n*w-k*p*y+h*u*y;c.n32=j*u*x-f*n*x-j*p*w+e*n*w+f*p*y-e*u*y;c.n33=g*o*x-j*k*x+j*h*w-e*o*w-f*h*y+e*k*y;c.n34=j*k*p-f*o*p-j*h*u+e*o*u+f*h*n-e*k*n;c.n41=t*u*x-k*v*x-t*p*w+h*v*w+k*p*B-h*u*B;c.n42=f*v*x-g*u*x+g*p*w-e*v*w-f*p*B+e*u*B;c.n43=g*k*x-f*t*x-g*h*w+e*t*w+f*h*B-e*k*B;c.n44=f*t*p-g*k*p+g*h*u-e*t*u-f*h*v+e*k*v;c.multiplyScalar(1/b.determinant());return c};
|
|
g*o*p-j*t*p+j*h*v-e*o*v-g*h*n+e*t*n;c.n31=k*n*x-o*u*x+o*p*w-h*n*w-k*p*y+h*u*y;c.n32=j*u*x-f*n*x-j*p*w+e*n*w+f*p*y-e*u*y;c.n33=g*o*x-j*k*x+j*h*w-e*o*w-f*h*y+e*k*y;c.n34=j*k*p-f*o*p-j*h*u+e*o*u+f*h*n-e*k*n;c.n41=t*u*x-k*v*x-t*p*w+h*v*w+k*p*B-h*u*B;c.n42=f*v*x-g*u*x+g*p*w-e*v*w-f*p*B+e*u*B;c.n43=g*k*x-f*t*x-g*h*w+e*t*w+f*h*B-e*k*B;c.n44=f*t*p-g*k*p+g*h*u-e*t*u-f*h*v+e*k*v;c.multiplyScalar(1/b.determinant());return c};
|
|
THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,t=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*k;e[5]=b*t;e[6]=b*o;e[7]=b*p;e[8]=b*u;return c};
|
|
THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,t=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*k;e[5]=b*t;e[6]=b*o;e[7]=b*p;e[8]=b*u;return c};
|
|
@@ -51,11 +52,11 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
|
|
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,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
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,e){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,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
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,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;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,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),h=b*c,k=f*g;this.w=h*j-k*e;this.x=h*e+k*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;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,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),h=b*c,k=f*g;this.w=h*j-k*e;this.x=h*e+k*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
|
|
-this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
|
|
|
|
-b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,k=b.z,b=b.w;this.x=c*b+g*j+e*k-f*h;this.y=e*b+g*h+f*j-c*k;this.z=f*b+g*k+c*h-e*j;this.w=g*b-c*j-e*h-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,k=this.z,
|
|
|
|
-t=this.w,o=t*e+h*g-k*f,p=t*f+k*e-j*g,u=t*g+j*f-h*e,e=-j*e-h*f-k*g;c.x=o*t+e*-j+p*-k-u*-h;c.y=p*t+e*-h+u*-j-o*-k;c.z=u*t+e*-k+o*-h-p*-j;return c}};
|
|
|
|
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
|
-THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
|
|
|
|
+this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
|
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
|
|
|
|
+this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,k=b.z,b=b.w;this.x=c*b+g*j+e*k-f*h;this.y=e*b+g*h+f*j-c*k;this.z=f*b+g*k+c*h-e*j;this.w=g*b-c*j-e*h-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,k=this.z,t=this.w,o=t*e+h*g-k*f,p=t*f+k*e-j*g,u=t*g+j*f-h*e,e=-j*
|
|
|
|
+e-h*f-k*g;c.x=o*t+e*-j+p*-k-u*-h;c.y=p*t+e*-h+u*-j-o*-k;c.z=u*t+e*-k+o*-h-p*-j;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};
|
|
|
|
+THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
|
|
@@ -218,39 +219,39 @@ THREE.WebGLRenderer=function(b){function c(b,c,e){var f,h,g,j=b.vertices,k=j.len
|
|
for(f=0;f<n;f++)g=f*3,color=o[p[f][1]],u[g]=color.r,u[g+1]=color.g,u[g+2]=color.b;if(B)for(w in B){f=B[w];o=f.value.length;for(g=0;g<o;g++){index=p[g][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[n]=y.x,f.array[n+1]=y.y):f.size===3?f.type==="c"?(f.array[n]=y.r,f.array[n+1]=y.g,f.array[n+2]=y.b):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z):(f.array[n]=
|
|
for(f=0;f<n;f++)g=f*3,color=o[p[f][1]],u[g]=color.r,u[g+1]=color.g,u[g+2]=color.b;if(B)for(w in B){f=B[w];o=f.value.length;for(g=0;g<o;g++){index=p[g][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[n]=y.x,f.array[n+1]=y.y):f.size===3?f.type==="c"?(f.array[n]=y.r,f.array[n+1]=y.g,f.array[n+2]=y.b):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z):(f.array[n]=
|
|
y.x,f.array[n+1]=y.y,f.array[n+2]=y.z,f.array[n+3]=y.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;if(x)for(f=0;f<n;f++)color=o[f],g=f*3,u[g]=color.r,u[g+1]=color.g,u[g+2]=color.b;if(B)for(w in B)if(f=B[w],f.__original.needsUpdate){o=f.value.length;for(g=0;g<o;g++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[g];f.size===2?(f.array[n]=
|
|
y.x,f.array[n+1]=y.y,f.array[n+2]=y.z,f.array[n+3]=y.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;if(x)for(f=0;f<n;f++)color=o[f],g=f*3,u[g]=color.r,u[g+1]=color.g,u[g+2]=color.b;if(B)for(w in B)if(f=B[w],f.__original.needsUpdate){o=f.value.length;for(g=0;g<o;g++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[g];f.size===2?(f.array[n]=
|
|
y.x,f.array[n+1]=y.y):f.size===3?f.type==="c"?(f.array[n]=y.r,f.array[n+1]=y.g,f.array[n+2]=y.b):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z,f.array[n+3]=y.w)}f.offset+=f.size}}}if(v||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,t,c);if(x||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,b.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,u,c);if(B)for(w in B)if(f=B[w],f.__original.needsUpdate||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,
|
|
y.x,f.array[n+1]=y.y):f.size===3?f.type==="c"?(f.array[n]=y.r,f.array[n+1]=y.g,f.array[n+2]=y.b):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z,f.array[n+3]=y.w)}f.offset+=f.size}}}if(v||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,t,c);if(x||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,b.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,u,c);if(B)for(w in B)if(f=B[w],f.__original.needsUpdate||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,
|
|
-f.buffer),m.bufferData(m.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||N.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets);for(var g=0,j=N.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=T&&(m.useProgram(g),T=g);m.uniformMatrix4fv(j.projectionMatrix,!1,Q);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
|
|
|
|
|
|
+f.buffer),m.bufferData(m.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,g){f.program||N.initMaterial(f,c,e,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets);for(var h=0,j=N.maxMorphTargets;h<j;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,k=f.uniforms;h!=T&&(m.useProgram(h),T=h);m.uniformMatrix4fv(j.projectionMatrix,!1,Q);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
|
|
THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,o,t,u=0,p=0,v=0,x,y,B,w=na,A=w.directional.colors,F=w.directional.positions,I=w.point.colors,Y=w.point.positions,G=w.point.distances,
|
|
THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,o,t,u=0,p=0,v=0,x,y,B,w=na,A=w.directional.colors,F=w.directional.positions,I=w.point.colors,Y=w.point.positions,G=w.point.distances,
|
|
H=0,C=0,e=o=B=0;for(n=c.length;e<n;e++)if(o=c[e],t=o.color,x=o.position,y=o.intensity,B=o.distance,o instanceof THREE.AmbientLight)u+=t.r,p+=t.g,v+=t.b;else if(o instanceof THREE.DirectionalLight)B=H*3,A[B]=t.r*y,A[B+1]=t.g*y,A[B+2]=t.b*y,F[B]=x.x,F[B+1]=x.y,F[B+2]=x.z,H+=1;else if(o instanceof THREE.SpotLight)B=H*3,A[B]=t.r*y,A[B+1]=t.g*y,A[B+2]=t.b*y,t=1/x.length(),F[B]=x.x*t,F[B+1]=x.y*t,F[B+2]=x.z*t,H+=1;else if(o instanceof THREE.PointLight)o=C*3,I[o]=t.r*y,I[o+1]=t.g*y,I[o+2]=t.b*y,Y[o]=x.x,
|
|
H=0,C=0,e=o=B=0;for(n=c.length;e<n;e++)if(o=c[e],t=o.color,x=o.position,y=o.intensity,B=o.distance,o instanceof THREE.AmbientLight)u+=t.r,p+=t.g,v+=t.b;else if(o instanceof THREE.DirectionalLight)B=H*3,A[B]=t.r*y,A[B+1]=t.g*y,A[B+2]=t.b*y,F[B]=x.x,F[B+1]=x.y,F[B+2]=x.z,H+=1;else if(o instanceof THREE.SpotLight)B=H*3,A[B]=t.r*y,A[B+1]=t.g*y,A[B+2]=t.b*y,t=1/x.length(),F[B]=x.x*t,F[B+1]=x.y*t,F[B+2]=x.z*t,H+=1;else if(o instanceof THREE.PointLight)o=C*3,I[o]=t.r*y,I[o+1]=t.g*y,I[o+2]=t.b*y,Y[o]=x.x,
|
|
Y[o+1]=x.y,Y[o+2]=x.z,G[C]=B,C+=1;for(e=H*3;e<A.length;e++)A[e]=0;for(e=C*3;e<I.length;e++)I[e]=0;w.point.length=C;w.directional.length=H;w.ambient[0]=u;w.ambient[1]=p;w.ambient[2]=v;c=na;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
|
|
Y[o+1]=x.y,Y[o+2]=x.z,G[C]=B,C+=1;for(e=H*3;e<A.length;e++)A[e]=0;for(e=C*3;e<I.length;e++)I[e]=0;w.point.length=C;w.directional.length=H;w.ambient[0]=u;w.ambient[1]=p;w.ambient[2]=v;c=na;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=f.opacity,k.size.value=f.size,k.scale.value=ua.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=f.opacity,k.size.value=f.size,k.scale.value=ua.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=
|
|
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=N.shadowMap[c];k.shadowDarkness.value=N.shadowMapDarkness;k.shadowBias.value=N.shadowMapBias}for(var J in k)if(n=g.uniforms[J])if(e=k[J],u=e.type,c=e.value,u=="i")m.uniform1i(n,c);else if(u=="f")m.uniform1f(n,c);else if(u=="fv1")m.uniform1fv(n,c);else if(u=="fv")m.uniform3fv(n,c);else if(u==
|
|
|
|
|
|
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=N.shadowMap[c];k.shadowDarkness.value=N.shadowMapDarkness;k.shadowBias.value=N.shadowMapBias}for(var J in k)if(n=h.uniforms[J])if(e=k[J],u=e.type,c=e.value,u=="i")m.uniform1i(n,c);else if(u=="f")m.uniform1f(n,c);else if(u=="fv1")m.uniform1fv(n,c);else if(u=="fv")m.uniform3fv(n,c);else if(u==
|
|
"v2")m.uniform2f(n,c.x,c.y);else if(u=="v3")m.uniform3f(n,c.x,c.y,c.z);else if(u=="v4")m.uniform4f(n,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!e._array)e._array=new Float32Array(16);c.flattenToArray(e._array);m.uniformMatrix4fv(n,!1,e._array)}else if(u=="m4v"){if(!e._array)e._array=new Float32Array(16*c.length);u=0;for(p=c.length;u<p;u++)c[u].flattenToArrayOffset(e._array,u*16);m.uniformMatrix4fv(n,!1,e._array)}else if(u=="c")m.uniform3f(n,c.r,c.g,c.b);else if(u=="t"){if(m.uniform1i(n,c),n=e.texture)if(n.image instanceof
|
|
"v2")m.uniform2f(n,c.x,c.y);else if(u=="v3")m.uniform3f(n,c.x,c.y,c.z);else if(u=="v4")m.uniform4f(n,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!e._array)e._array=new Float32Array(16);c.flattenToArray(e._array);m.uniformMatrix4fv(n,!1,e._array)}else if(u=="m4v"){if(!e._array)e._array=new Float32Array(16*c.length);u=0;for(p=c.length;u<p;u++)c[u].flattenToArrayOffset(e._array,u*16);m.uniformMatrix4fv(n,!1,e._array)}else if(u=="c")m.uniform3f(n,c.r,c.g,c.b);else if(u=="t"){if(m.uniform1i(n,c),n=e.texture)if(n.image instanceof
|
|
Array&&n.image.length==6){if(e=n,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(n=0;n<6;++n)m.texSubImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,m.RGBA,m.UNSIGNED_BYTE,e.image[n])}else{e.image.__webglTextureCube=m.createTexture();m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(n=0;n<6;++n)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,e.image[n]);e.__webglInit=!0}L(m.TEXTURE_CUBE_MAP,
|
|
Array&&n.image.length==6){if(e=n,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(n=0;n<6;++n)m.texSubImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,m.RGBA,m.UNSIGNED_BYTE,e.image[n])}else{e.image.__webglTextureCube=m.createTexture();m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(n=0;n<6;++n)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,e.image[n]);e.__webglInit=!0}L(m.TEXTURE_CUBE_MAP,
|
|
-e,e.image[0]);m.bindTexture(m.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else D(n,c)}else if(u=="tv"){if(!e._array){e._array=[];u=0;for(p=e.texture.length;u<p;u++)e._array[u]=c+u}m.uniform1iv(n,e._array);u=0;for(p=e.texture.length;u<p;u++)(n=e.texture[u])&&D(n,e._array[u])}m.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);m.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
|
|
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&m.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==null&&m.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&m.uniformMatrix4fv(j.viewMatrix,!1,ma);f.skinning&&
|
|
|
|
-(m.uniformMatrix4fv(j.cameraInverseMatrix,!1,ma),m.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,j){if(h.opacity!=0){var k,b=e(b,c,f,h,j).attributes;if(!h.morphTargets&&b.position>=0)m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),m.vertexAttribPointer(c.position,
|
|
|
|
-3,m.FLOAT,!1,0,0)):c.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,n=j.morphTargetForcedOrder,o=j.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<n.length;)m.bindBuffer(m.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),m.vertexAttribPointer(c["morphTarget"+f],3,m.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],u=-1,t=0,o=j.morphTargetInfluences,p,v=
|
|
|
|
-o.length,f=0;for(j.morphTargetBase!==-1&&(n[j.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(p=0;p<v;p++)!n[p]&&o[p]>u&&(t=p,u=o[t]);m.bindBuffer(m.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);m.vertexAttribPointer(c["morphTarget"+f],3,m.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;n[t]=1;u=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
|
|
|
|
-0&&(c=g.__webglCustomAttributes[k],m.bindBuffer(m.ARRAY_BUFFER,c.buffer),m.vertexAttribPointer(b[k],c.size,m.FLOAT,!1,0,0));b.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglColorBuffer),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0));b.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglNormalBuffer),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));b.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglTangentBuffer),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
-g.__webglUVBuffer),m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv)):m.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,g.__webglUV2Buffer),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv2)):m.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinVertexABuffer),m.vertexAttribPointer(b.skinVertexA,4,
|
|
|
|
-m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),m.vertexAttribPointer(b.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(m.lineWidth(h.wireframeLinewidth),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),m.drawElements(m.LINES,g.__webglLineCount,
|
|
|
|
-m.UNSIGNED_SHORT,0)):(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),m.drawElements(m.TRIANGLES,g.__webglFaceCount,m.UNSIGNED_SHORT,0)),N.data.vertices+=g.__webglFaceCount,N.data.faces+=g.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(h.linewidth),m.drawArrays(j,0,g.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,g.__webglParticleCount),N.data.drawCalls++):j instanceof
|
|
|
|
-THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,g.__webglVertexCount),N.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=m.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=m.createBuffer();b.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,b.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(b.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
-b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,j,k,n,o,u,t,p,v=b.count*3;for(p=0;p<v;p+=9)e=b.normalArray,f=e[p],g=e[p+1],h=e[p+2],j=e[p+3],n=e[p+4],u=e[p+5],k=e[p+6],o=e[p+7],t=e[p+8],f=(f+j+k)/3,g=(g+n+o)/3,h=(h+u+t)/3,e[p]=f,e[p+1]=g,e[p+2]=h,e[p+3]=f,e[p+4]=g,e[p+5]=h,e[p+6]=f,e[p+7]=g,e[p+8]=h}m.bufferData(m.ARRAY_BUFFER,b.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,
|
|
|
|
|
|
+e,e.image[0]);m.bindTexture(m.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else D(n,c)}else if(u=="tv"){if(!e._array){e._array=[];u=0;for(p=e.texture.length;u<p;u++)e._array[u]=c+u}m.uniform1iv(n,e._array);u=0;for(p=e.texture.length;u<p;u++)(n=e.texture[u])&&D(n,e._array[u])}m.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);m.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
|
|
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&m.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&j.objectMatrix!==null&&m.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&m.uniformMatrix4fv(j.viewMatrix,!1,ma);f.skinning&&
|
|
|
|
+(m.uniformMatrix4fv(j.cameraInverseMatrix,!1,ma),m.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var k,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),m.vertexAttribPointer(c.position,
|
|
|
|
+3,m.FLOAT,!1,0,0)):c.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,n=j.morphTargetForcedOrder,o=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)m.bindBuffer(m.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),m.vertexAttribPointer(c["morphTarget"+f],3,m.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],u=-1,t=0,o=j.morphTargetInfluences,p,v=
|
|
|
|
+o.length,f=0;for(j.morphTargetBase!==-1&&(n[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(p=0;p<v;p++)!n[p]&&o[p]>u&&(t=p,u=o[t]);m.bindBuffer(m.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t]);m.vertexAttribPointer(c["morphTarget"+f],3,m.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;n[t]=1;u=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
|
|
|
|
+0&&(c=h.__webglCustomAttributes[k],m.bindBuffer(m.ARRAY_BUFFER,c.buffer),m.vertexAttribPointer(b[k],c.size,m.FLOAT,!1,0,0));b.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0));b.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,h.__webglNormalBuffer),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));b.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,h.__webglTangentBuffer),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+h.__webglUVBuffer),m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv)):m.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,h.__webglUV2Buffer),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv2)):m.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,h.__webglSkinVertexABuffer),m.vertexAttribPointer(b.skinVertexA,4,
|
|
|
|
+m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),m.vertexAttribPointer(b.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(m.lineWidth(g.wireframeLinewidth),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),m.drawElements(m.LINES,h.__webglLineCount,
|
|
|
|
+m.UNSIGNED_SHORT,0)):(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),m.drawElements(m.TRIANGLES,h.__webglFaceCount,m.UNSIGNED_SHORT,0)),N.data.vertices+=h.__webglFaceCount,N.data.faces+=h.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(g.linewidth),m.drawArrays(j,0,h.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,h.__webglParticleCount),N.data.drawCalls++):j instanceof
|
|
|
|
+THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,h.__webglVertexCount),N.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=m.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=m.createBuffer();b.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,b.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(b.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,g,j,k,n,o,u,t,p,v=b.count*3;for(p=0;p<v;p+=9)e=b.normalArray,f=e[p],h=e[p+1],g=e[p+2],j=e[p+3],n=e[p+4],u=e[p+5],k=e[p+6],o=e[p+7],t=e[p+8],f=(f+j+k)/3,h=(h+n+o)/3,g=(g+u+t)/3,e[p]=f,e[p+1]=h,e[p+2]=g,e[p+3]=f,e[p+4]=h,e[p+5]=g,e[p+6]=f,e[p+7]=h,e[p+8]=g}m.bufferData(m.ARRAY_BUFFER,b.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,
|
|
0,b.count);b.count=0}function j(b){if(Z!=b.doubleSided)b.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),Z=b.doubleSided;if(ha!=b.flipSided)b.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ha=b.flipSided}function h(b){ca!=b&&(b?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),ca=b)}function k(b,c,e){ia!=b&&(b?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),ia=b);if(b&&(da!=c||$!=e))m.polygonOffset(c,e),da=c,$=e}function t(b){la[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
0,b.count);b.count=0}function j(b){if(Z!=b.doubleSided)b.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),Z=b.doubleSided;if(ha!=b.flipSided)b.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ha=b.flipSided}function h(b){ca!=b&&(b?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),ca=b)}function k(b,c,e){ia!=b&&(b?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),ia=b);if(b&&(da!=c||$!=e))m.polygonOffset(c,e),da=c,$=e}function t(b){la[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
b.n14);la[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);la[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);la[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);la[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);la[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=la[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
|
|
b.n14);la[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);la[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);la[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);la[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);la[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=la[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
|
|
-f=0;f<6;f++)if(b=la[f].x*c.n14+la[f].y*c.n24+la[f].z*c.n34+la[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(g,e)}function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
|
|
|
|
-e;c++)(g=j.materials[c])&&(g.transparent?p(m,g):p(k,g))}else(g=c)&&(g.transparent?p(m,g):p(k,g))}function n(b,c){return c.z-b.z}function x(b,c){var k,n,u,p=0,v,x,y,w,A=b.lights;ea||(ea=new THREE.Camera(N.shadowCameraFov,c.aspect,N.shadowCameraNear,N.shadowCameraFar));k=0;for(n=A.length;k<n;k++)if(u=A[k],u instanceof THREE.SpotLight&&u.castShadow){N.shadowMap[p]||(N.shadowMap[p]=new THREE.WebGLRenderTarget(N.shadowMapWidth,N.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
|
|
|
+f=0;f<6;f++)if(b=la[f].x*c.n14+la[f].y*c.n24+la[f].z*c.n34+la[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(g,e):p(h,e)}function v(b){var c,e,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
|
|
|
|
+e;c++)(h=j.materials[c])&&(h.transparent?p(m,h):p(k,h))}else(h=c)&&(h.transparent?p(m,h):p(k,h))}function n(b,c){return c.z-b.z}function x(b,c){var k,n,u,p=0,v,x,y,w,A=b.lights;ea||(ea=new THREE.Camera(N.shadowCameraFov,c.aspect,N.shadowCameraNear,N.shadowCameraFar));k=0;for(n=A.length;k<n;k++)if(u=A[k],u instanceof THREE.SpotLight&&u.castShadow){N.shadowMap[p]||(N.shadowMap[p]=new THREE.WebGLRenderTarget(N.shadowMapWidth,N.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
format:THREE.RGBAFormat}));ta[p]||(ta[p]=new THREE.Matrix4);v=N.shadowMap[p];x=ta[p];ea.position.copy(u.position);ea.target.position.copy(u.target.position);ea.update(void 0,!0);b.update(void 0,!1,ea);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(ea.projectionMatrix);x.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(ma);ea.projectionMatrix.flattenToArray(Q);Y.multiply(ea.projectionMatrix,ea.matrixWorldInverse);t(Y);N.initWebGLObjects(b);C(v);m.clearColor(1,
|
|
format:THREE.RGBAFormat}));ta[p]||(ta[p]=new THREE.Matrix4);v=N.shadowMap[p];x=ta[p];ea.position.copy(u.position);ea.target.position.copy(u.target.position);ea.update(void 0,!0);b.update(void 0,!1,ea);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(ea.projectionMatrix);x.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(ma);ea.projectionMatrix.flattenToArray(Q);Y.multiply(ea.projectionMatrix,ea.matrixWorldInverse);t(Y);N.initWebGLObjects(b);C(v);m.clearColor(1,
|
|
1,1,1);N.clear();m.clearColor(va.r,va.g,va.b,ya);x=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],w=y.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||o(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),B(w,ea,!1),y.render=!0):y.render=!1:y.render=!1;h(!0);G(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)w=y.object,buffer=y.buffer,j(w),y=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?
|
|
1,1,1);N.clear();m.clearColor(va.r,va.g,va.b,ya);x=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],w=y.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||o(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),B(w,ea,!1),y.render=!0):y.render=!1:y.render=!1;h(!0);G(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)w=y.object,buffer=y.buffer,j(w),y=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?
|
|
-oa:qa,f(ea,A,null,y,buffer,w);for(v=0;v<u;v++)y=b.__webglObjectsImmediate[v],w=y.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),B(w,ea,!1),j(w),program=e(ea,A,null,qa,w),w.render(function(b){g(b,program,qa.shading)}));p++}}function w(b,c){var e,f,g;e=M.attributes;var h=M.uniforms,j=ja/aa,k,o=[],u=aa*0.5,t=ja*0.5,p=!0;m.useProgram(M.program);T=M.program;ca=V=-1;za||(m.enableVertexAttribArray(M.attributes.position),m.enableVertexAttribArray(M.attributes.uv),
|
|
|
|
-za=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,M.vertexBuffer);m.vertexAttribPointer(e.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(e.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,M.elementBuffer);m.uniformMatrix4fv(h.projectionMatrix,!1,Q);m.activeTexture(m.TEXTURE0);m.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
|
-g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(n);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(m.uniform1i(h.useScreenCoordinates,1),m.uniform3f(h.screenPosition,(g.position.x-u)/u,(t-g.position.y)/t,Math.max(0,Math.min(1,g.position.z)))):(m.uniform1i(h.useScreenCoordinates,0),m.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),m.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
|
-!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?ja:1),o[0]=k*j*g.scale.x,o[1]=k*g.scale.y,m.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),m.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),m.uniform2f(h.alignment,g.alignment.x,g.alignment.y),m.uniform1f(h.opacity,g.opacity),m.uniform1f(h.rotation,g.rotation),m.uniform2fv(h.scale,o),g.mergeWith3D&&!p?(m.enable(m.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(m.disable(m.DEPTH_TEST),p=!1),G(g.blending),D(g.map,0),m.drawElements(m.TRIANGLES,
|
|
|
|
-6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(R)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function y(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function F(b){var c,e,f,g;g=b.__materials;b=0;for(e=
|
|
|
|
-g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function A(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function I(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,f,g,h,j,k,m,n,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,m=c(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),
|
|
|
|
-n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function H(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
|
|
|
+oa:qa,f(ea,A,null,y,buffer,w);for(v=0;v<u;v++)y=b.__webglObjectsImmediate[v],w=y.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),B(w,ea,!1),j(w),program=e(ea,A,null,qa,w),w.render(function(b){g(b,program,qa.shading)}));p++}}function w(b,c){var e,f,h;e=M.attributes;var g=M.uniforms,j=ja/aa,k,o=[],u=aa*0.5,t=ja*0.5,p=!0;m.useProgram(M.program);T=M.program;ca=V=-1;za||(m.enableVertexAttribArray(M.attributes.position),m.enableVertexAttribArray(M.attributes.uv),
|
|
|
|
+za=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,M.vertexBuffer);m.vertexAttribPointer(e.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(e.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,M.elementBuffer);m.uniformMatrix4fv(g.projectionMatrix,!1,Q);m.activeTexture(m.TEXTURE0);m.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
|
+h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(n);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(m.uniform1i(g.useScreenCoordinates,1),m.uniform3f(g.screenPosition,(h.position.x-u)/u,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(m.uniform1i(g.useScreenCoordinates,0),m.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),m.uniformMatrix4fv(g.modelViewMatrix,
|
|
|
|
+!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?ja:1),o[0]=k*j*h.scale.x,o[1]=k*h.scale.y,m.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),m.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),m.uniform2f(g.alignment,h.alignment.x,h.alignment.y),m.uniform1f(g.opacity,h.opacity),m.uniform1f(g.rotation,h.rotation),m.uniform2fv(g.scale,o),h.mergeWith3D&&!p?(m.enable(m.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(m.disable(m.DEPTH_TEST),p=!1),G(h.blending),D(h.map,0),m.drawElements(m.TRIANGLES,
|
|
|
|
+6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(R)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function y(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=
|
|
|
|
+h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function A(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function I(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}var e,f,h,g,j,k,m,n,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=c(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),
|
|
|
|
+n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function H(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
|
|
count:0}})}function G(b){if(b!=V){switch(b){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}V=b}}function L(b,c,e){(e.width&
|
|
count:0}})}function G(b){if(b!=V){switch(b){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}V=b}}function L(b,c,e){(e.width&
|
|
e.width-1)==0&&(e.height&e.height-1)==0?(m.texParameteri(b,m.TEXTURE_WRAP_S,K(c.wrapS)),m.texParameteri(b,m.TEXTURE_WRAP_T,K(c.wrapT)),m.texParameteri(b,m.TEXTURE_MAG_FILTER,K(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,K(c.minFilter)),m.generateMipmap(b)):(m.texParameteri(b,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_MAG_FILTER,J(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,J(c.minFilter)))}function D(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
|
|
e.width-1)==0&&(e.height&e.height-1)==0?(m.texParameteri(b,m.TEXTURE_WRAP_S,K(c.wrapS)),m.texParameteri(b,m.TEXTURE_WRAP_T,K(c.wrapT)),m.texParameteri(b,m.TEXTURE_MAG_FILTER,K(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,K(c.minFilter)),m.generateMipmap(b)):(m.texParameteri(b,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_MAG_FILTER,J(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,J(c.minFilter)))}function D(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
|
|
m.createTexture(),b.__webglInit=!0;m.bindTexture(m.TEXTURE_2D,b.__webglTexture);b.image.data?m.texImage2D(m.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),m.UNSIGNED_BYTE,b.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,b.image);L(m.TEXTURE_2D,b,b.image);m.bindTexture(m.TEXTURE_2D,null);b.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,b.__webglTexture)}function C(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
|
|
m.createTexture(),b.__webglInit=!0;m.bindTexture(m.TEXTURE_2D,b.__webglTexture);b.image.data?m.texImage2D(m.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),m.UNSIGNED_BYTE,b.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,b.image);L(m.TEXTURE_2D,b,b.image);m.bindTexture(m.TEXTURE_2D,null);b.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,b.__webglTexture)}function C(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
|
|
@@ -269,36 +270,36 @@ M.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,M.vertices,m.STATIC_DRAW);m.bindBuff
|
|
"uv");M.uniforms.uvOffset=m.getUniformLocation(M.program,"uvOffset");M.uniforms.uvScale=m.getUniformLocation(M.program,"uvScale");M.uniforms.rotation=m.getUniformLocation(M.program,"rotation");M.uniforms.scale=m.getUniformLocation(M.program,"scale");M.uniforms.alignment=m.getUniformLocation(M.program,"alignment");M.uniforms.map=m.getUniformLocation(M.program,"map");M.uniforms.opacity=m.getUniformLocation(M.program,"opacity");M.uniforms.useScreenCoordinates=m.getUniformLocation(M.program,"useScreenCoordinates");
|
|
"uv");M.uniforms.uvOffset=m.getUniformLocation(M.program,"uvOffset");M.uniforms.uvScale=m.getUniformLocation(M.program,"uvScale");M.uniforms.rotation=m.getUniformLocation(M.program,"rotation");M.uniforms.scale=m.getUniformLocation(M.program,"scale");M.uniforms.alignment=m.getUniformLocation(M.program,"alignment");M.uniforms.map=m.getUniformLocation(M.program,"map");M.uniforms.opacity=m.getUniformLocation(M.program,"opacity");M.uniforms.useScreenCoordinates=m.getUniformLocation(M.program,"useScreenCoordinates");
|
|
M.uniforms.affectedByDistance=m.getUniformLocation(M.program,"affectedByDistance");M.uniforms.screenPosition=m.getUniformLocation(M.program,"screenPosition");M.uniforms.modelViewMatrix=m.getUniformLocation(M.program,"modelViewMatrix");M.uniforms.projectionMatrix=m.getUniformLocation(M.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){P=b;fa=c;aa=e;ja=f;m.viewport(P,fa,aa,ja)};this.setScissor=
|
|
M.uniforms.affectedByDistance=m.getUniformLocation(M.program,"affectedByDistance");M.uniforms.screenPosition=m.getUniformLocation(M.program,"screenPosition");M.uniforms.modelViewMatrix=m.getUniformLocation(M.program,"modelViewMatrix");M.uniforms.projectionMatrix=m.getUniformLocation(M.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){P=b;fa=c;aa=e;ja=f;m.viewport(P,fa,aa,ja)};this.setScissor=
|
|
function(b,c,e,f){m.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){R=b;m.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;m.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;m.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){m.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT|m.STENCIL_BUFFER_BIT)};this.getContext=function(){return m};this.initMaterial=
|
|
function(b,c,e,f){m.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){R=b;m.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;m.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;m.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){m.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT|m.STENCIL_BUFFER_BIT)};this.getContext=function(){return m};this.initMaterial=
|
|
-function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=
|
|
|
|
-k.fragmentShader}var n,o,u;n=u=k=0;for(o=c.length;n<o;n++)h=c[n],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&k++;k+u<=_maxLights?n=u:(n=Math.ceil(_maxLights*u/(k+u)),k=_maxLights-n);h={directional:n,point:k};k=u=0;for(n=c.length;k<n;k++)o=c[k],o instanceof THREE.SpotLight&&o.castShadow&&u++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{n=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,c=b.attributes,
|
|
|
|
-e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(n),f.push(o));
|
|
|
|
|
|
+function(b,c,e,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=
|
|
|
|
+k.fragmentShader}var n,o,u;n=u=k=0;for(o=c.length;n<o;n++)g=c[n],g instanceof THREE.SpotLight&&u++,g instanceof THREE.DirectionalLight&&u++,g instanceof THREE.PointLight&&k++;k+u<=_maxLights?n=u:(n=Math.ceil(_maxLights*u/(k+u)),k=_maxLights-n);g={directional:n,point:k};k=u=0;for(n=c.length;k<n;k++)o=c[k],o instanceof THREE.SpotLight&&o.castShadow&&u++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{n=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,c=b.attributes,
|
|
|
|
+e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(n),f.push(o));
|
|
for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=U.length;v<f;v++)if(U[v].code==j){p=U[v].program;break a}v=m.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?
|
|
for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=U.length;v<f;v++)if(U[v].code==j){p=U[v].program;break a}v=m.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?
|
|
"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
|
|
"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
|
|
-h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
|
-"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(v,X("fragment",h+n));m.attachShader(v,X("vertex",f+o));m.linkProgram(v);m.getProgramParameter(v,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(v,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");v.uniforms=
|
|
|
|
|
|
+g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
|
+"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(v,X("fragment",g+n));m.attachShader(v,X("vertex",f+o));m.linkProgram(v);m.getProgramParameter(v,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(v,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");v.uniforms=
|
|
{};v.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in k)f.push(x);x=f;f=0;for(k=x.length;f<k;f++)n=x[f],v.uniforms[n]=m.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<e.maxMorphTargets;x++)f.push("morphTarget"+x);for(p in c)f.push(p);p=f;x=0;for(c=p.length;x<c;x++)e=
|
|
{};v.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in k)f.push(x);x=f;f=0;for(k=x.length;f<k;f++)n=x[f],v.uniforms[n]=m.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<e.maxMorphTargets;x++)f.push("morphTarget"+x);for(p in c)f.push(p);p=f;x=0;for(c=p.length;x<c;x++)e=
|
|
p[x],v.attributes[e]=m.getAttribLocation(v,e);U.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&m.enableVertexAttribArray(p.position);p.color>=0&&m.enableVertexAttribArray(p.color);p.normal>=0&&m.enableVertexAttribArray(p.normal);p.tangent>=0&&m.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(m.enableVertexAttribArray(p.skinVertexA),m.enableVertexAttribArray(p.skinVertexB),m.enableVertexAttribArray(p.skinIndex),
|
|
p[x],v.attributes[e]=m.getAttribLocation(v,e);U.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&m.enableVertexAttribArray(p.position);p.color>=0&&m.enableVertexAttribArray(p.color);p.normal>=0&&m.enableVertexAttribArray(p.normal);p.tangent>=0&&m.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(m.enableVertexAttribArray(p.skinVertexA),m.enableVertexAttribArray(p.skinVertexB),m.enableVertexAttribArray(p.skinIndex),
|
|
-m.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&m.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(m.enableVertexAttribArray(p[x]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,y){var A,F,I,H,J,L,D,P,K=b.lights,M=b.fog;this.shadowMapEnabled&&x(b,c);N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
|
|
|
+m.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&m.enableVertexAttribArray(p[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)x="morphTarget"+h,p[x]>=0&&(m.enableVertexAttribArray(p[x]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,y){var A,F,I,H,J,L,D,P,K=b.lights,M=b.fog;this.shadowMapEnabled&&x(b,c);N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
!1,c);c.matrixWorldInverse.flattenToArray(ma);c.projectionMatrix.flattenToArray(Q);Y.multiply(c.projectionMatrix,c.matrixWorldInverse);t(Y);this.initWebGLObjects(b);C(p);(this.autoClear||y)&&this.clear();J=b.__webglObjects.length;for(y=0;y<J;y++)if(A=b.__webglObjects[y],D=A.object,D.visible)if(!(D instanceof THREE.Mesh)||o(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),B(D,c,!0),v(A),A.render=!0,this.sortObjects)A.object.renderDepth?A.z=A.object.renderDepth:(ka.copy(D.position),Y.multiplyVector3(ka),
|
|
!1,c);c.matrixWorldInverse.flattenToArray(ma);c.projectionMatrix.flattenToArray(Q);Y.multiply(c.projectionMatrix,c.matrixWorldInverse);t(Y);this.initWebGLObjects(b);C(p);(this.autoClear||y)&&this.clear();J=b.__webglObjects.length;for(y=0;y<J;y++)if(A=b.__webglObjects[y],D=A.object,D.visible)if(!(D instanceof THREE.Mesh)||o(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),B(D,c,!0),v(A),A.render=!0,this.sortObjects)A.object.renderDepth?A.z=A.object.renderDepth:(ka.copy(D.position),Y.multiplyVector3(ka),
|
|
A.z=ka.z)}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(n);L=b.__webglObjectsImmediate.length;for(y=0;y<L;y++)A=b.__webglObjectsImmediate[y],D=A.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),B(D,c,!0),u(A));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(y=0;y<J;y++)if(A=b.__webglObjects[y],A.render)D=A.object,P=A.buffer,j(D),f(c,K,M,b.overrideMaterial,P,D);for(y=0;y<L;y++)A=b.__webglObjectsImmediate[y],
|
|
A.z=ka.z)}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(n);L=b.__webglObjectsImmediate.length;for(y=0;y<L;y++)A=b.__webglObjectsImmediate[y],D=A.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),B(D,c,!0),u(A));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(y=0;y<J;y++)if(A=b.__webglObjects[y],A.render)D=A.object,P=A.buffer,j(D),f(c,K,M,b.overrideMaterial,P,D);for(y=0;y<L;y++)A=b.__webglObjectsImmediate[y],
|
|
D=A.object,D.visible&&(j(D),F=e(c,K,M,b.overrideMaterial,D),D.render(function(c){g(c,F,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(y=J-1;y>=0;y--)if(A=b.__webglObjects[y],A.render){D=A.object;P=A.buffer;I=A.opaque;j(D);for(A=0;A<I.count;A++)H=I.list[A],h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,K,M,H,P,D)}for(y=0;y<L;y++)if(A=b.__webglObjectsImmediate[y],D=A.object,D.visible){I=A.opaque;j(D);for(A=0;A<I.count;A++)H=I.list[A],h(H.depthTest),
|
|
D=A.object,D.visible&&(j(D),F=e(c,K,M,b.overrideMaterial,D),D.render(function(c){g(c,F,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(y=J-1;y>=0;y--)if(A=b.__webglObjects[y],A.render){D=A.object;P=A.buffer;I=A.opaque;j(D);for(A=0;A<I.count;A++)H=I.list[A],h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,K,M,H,P,D)}for(y=0;y<L;y++)if(A=b.__webglObjectsImmediate[y],D=A.object,D.visible){I=A.opaque;j(D);for(A=0;A<I.count;A++)H=I.list[A],h(H.depthTest),
|
|
k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),F=e(c,K,M,H,D),D.render(function(b){g(b,F,H.shading)})}for(y=0;y<J;y++)if(A=b.__webglObjects[y],A.render){D=A.object;P=A.buffer;I=A.transparent;j(D);for(A=0;A<I.count;A++)H=I.list[A],G(H.blending),h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,K,M,H,P,D)}for(y=0;y<L;y++)if(A=b.__webglObjectsImmediate[y],D=A.object,D.visible){I=A.transparent;j(D);for(A=0;A<I.count;A++)H=I.list[A],G(H.blending),h(H.depthTest),
|
|
k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),F=e(c,K,M,H,D),D.render(function(b){g(b,F,H.shading)})}for(y=0;y<J;y++)if(A=b.__webglObjects[y],A.render){D=A.object;P=A.buffer;I=A.transparent;j(D);for(A=0;A<I.count;A++)H=I.list[A],G(H.blending),h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,K,M,H,P,D)}for(y=0;y<L;y++)if(A=b.__webglObjectsImmediate[y],D=A.object,D.visible){I=A.transparent;j(D);for(A=0;A<I.count;A++)H=I.list[A],G(H.blending),h(H.depthTest),
|
|
k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),F=e(c,K,M,H,D),D.render(function(b){g(b,F,H.shading)})}}b.__webglSprites.length&&w(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(m.bindTexture(m.TEXTURE_2D,p.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),F=e(c,K,M,H,D),D.render(function(b){g(b,F,H.shading)})}}b.__webglSprites.length&&w(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(m.bindTexture(m.TEXTURE_2D,p.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
-f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&I(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();
|
|
|
|
|
|
+f=b,h=void 0,g=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(h in g=e.geometry,g.geometryGroups==void 0&&I(g),g.geometryGroups){j=g.geometryGroups[h];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();
|
|
k.__webglTangentBuffer=m.createBuffer();k.__webglColorBuffer=m.createBuffer();k.__webglUVBuffer=m.createBuffer();k.__webglUV2Buffer=m.createBuffer();k.__webglSkinVertexABuffer=m.createBuffer();k.__webglSkinVertexBBuffer=m.createBuffer();k.__webglSkinIndicesBuffer=m.createBuffer();k.__webglSkinWeightsBuffer=m.createBuffer();k.__webglFaceBuffer=m.createBuffer();k.__webglLineBuffer=m.createBuffer();if(k.numMorphTargets){var n=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(o=k.numMorphTargets;n<
|
|
k.__webglTangentBuffer=m.createBuffer();k.__webglColorBuffer=m.createBuffer();k.__webglUVBuffer=m.createBuffer();k.__webglUV2Buffer=m.createBuffer();k.__webglSkinVertexABuffer=m.createBuffer();k.__webglSkinVertexBBuffer=m.createBuffer();k.__webglSkinIndicesBuffer=m.createBuffer();k.__webglSkinWeightsBuffer=m.createBuffer();k.__webglFaceBuffer=m.createBuffer();k.__webglLineBuffer=m.createBuffer();if(k.numMorphTargets){var n=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(o=k.numMorphTargets;n<
|
|
o;n++)k.__webglMorphTargetsBuffers.push(m.createBuffer())}for(var k=j,n=e,u=void 0,t=void 0,p=void 0,v=p=void 0,x=void 0,w=void 0,B=w=o=0,Y=p=t=void 0,G=Y=t=u=void 0,p=void 0,v=n.geometry,x=v.faces,Y=k.faces,u=0,t=Y.length;u<t;u++)p=Y[u],p=x[p],p instanceof THREE.Face3?(o+=3,w+=1,B+=3):p instanceof THREE.Face4&&(o+=4,w+=2,B+=4);for(var u=k,t=n,C=Y=x=void 0,D=void 0,C=void 0,p=[],x=0,Y=t.materials.length;x<Y;x++)if(C=t.materials[x],C instanceof THREE.MeshFaceMaterial){C=0;for(l=u.materials.length;C<
|
|
o;n++)k.__webglMorphTargetsBuffers.push(m.createBuffer())}for(var k=j,n=e,u=void 0,t=void 0,p=void 0,v=p=void 0,x=void 0,w=void 0,B=w=o=0,Y=p=t=void 0,G=Y=t=u=void 0,p=void 0,v=n.geometry,x=v.faces,Y=k.faces,u=0,t=Y.length;u<t;u++)p=Y[u],p=x[p],p instanceof THREE.Face3?(o+=3,w+=1,B+=3):p instanceof THREE.Face4&&(o+=4,w+=2,B+=4);for(var u=k,t=n,C=Y=x=void 0,D=void 0,C=void 0,p=[],x=0,Y=t.materials.length;x<Y;x++)if(C=t.materials[x],C instanceof THREE.MeshFaceMaterial){C=0;for(l=u.materials.length;C<
|
|
l;C++)(D=u.materials[C])&&p.push(D)}else(D=C)&&p.push(D);u=p;k.__materials=u;a:{x=t=void 0;Y=u.length;for(t=0;t<Y;t++)if(x=u[t],x.map||x.lightMap||x instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{Y=x=void 0;p=u.length;for(x=0;x<p;x++)if(Y=u[x],!(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:{p=x=void 0;C=u.length;for(x=0;x<C;x++)if(p=u[x],
|
|
l;C++)(D=u.materials[C])&&p.push(D)}else(D=C)&&p.push(D);u=p;k.__materials=u;a:{x=t=void 0;Y=u.length;for(t=0;t<Y;t++)if(x=u[t],x.map||x.lightMap||x instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{Y=x=void 0;p=u.length;for(x=0;x<p;x++)if(Y=u[x],!(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:{p=x=void 0;C=u.length;for(x=0;x<C;x++)if(p=u[x],
|
|
p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(o*3);if(Y)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(p)k.__colorArray=new Float32Array(o*3);if(t){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
|
|
p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(o*3);if(Y)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(p)k.__colorArray=new Float32Array(o*3);if(t){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
|
|
k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(x=k.numMorphTargets;v<x;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=Y==THREE.SmoothShading;k.__uvType=t;k.__vertexColorType=p;k.__normalType=Y;k.__webglFaceCount=
|
|
k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(x=k.numMorphTargets;v<x;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=Y==THREE.SmoothShading;k.__uvType=t;k.__vertexColorType=p;k.__normalType=Y;k.__webglFaceCount=
|
|
w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(x=u.length;v<x;v++)if(t=u[v],t.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in t.attributes){p=t.attributes[a];Y={};for(G in p)Y[G]=p[G];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(o*w),Y.buffer=m.createBuffer(),Y.buffer.belongsToAttribute=
|
|
w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(x=u.length;v<x;v++)if(t=u[v],t.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in t.attributes){p=t.attributes[a];Y={};for(G in p)Y[G]=p[G];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(o*w),Y.buffer=m.createBuffer(),Y.buffer.belongsToAttribute=
|
|
-a,p.needsUpdate=!0,Y.__original=p;k.__webglCustomAttributes[a]=Y}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}H(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*
|
|
|
|
-3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;H(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;H(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=
|
|
|
|
-h;g.__webglVertexBuffer=m.createBuffer();g.__webglColorBuffer=m.createBuffer();g=h;j=e;k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;G=o=n=void 0;n=0;for(o=j.materials.length;n<o;n++)if(G=j.materials[n],G.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in G.attributes){originalAttribute=G.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(k*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
|
|
|
|
-!0;h.__dirtyColors=!0}H(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)A(e.__webglObjects,f);else if(f instanceof
|
|
|
|
-THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&A(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,n=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],n=y(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
|
|
|
|
-n)if(n=k,o=m.DYNAMIC_DRAW,G=!h.dynamic,n.__inittedArrays){var J=B=w=void 0,Q=void 0,L=J=void 0,P=void 0,N=void 0,K=void 0,M=D=C=p=Y=x=t=u=v=void 0,E=Q=K=Q=N=P=void 0,z=void 0,S=z=E=P=void 0,ma=void 0,R=S=z=E=J=J=L=K=Q=S=z=E=ma=S=z=E=ma=S=z=E=void 0,ka=0,V=0,fa=0,X=0,T=0,U=0,aa=0,ja=0,W=0,O=0,Z=0,S=E=0,S=void 0,$=n.__vertexArray,ha=n.__uvArray,ia=n.__uv2Array,la=n.__normalArray,ca=n.__tangentArray,da=n.__colorArray,na=n.__skinVertexAArray,ea=n.__skinVertexBArray,ra=n.__skinIndexArray,sa=n.__skinWeightArray,
|
|
|
|
-ta=n.__morphTargetsArrays,ua=n.__webglCustomAttributes,z=void 0,qa=n.__faceArray,oa=n.__lineArray,va=n.__needsSmoothNormals,u=n.__vertexColorType,v=n.__uvType,t=n.__normalType,xa=g.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=n.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
|
|
|
|
|
|
+a,p.needsUpdate=!0,Y.__original=p;k.__webglCustomAttributes[a]=Y}}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}H(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)h=g,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),h=g,j=h.vertices.length,h.__vertexArray=new Float32Array(j*3),h.__colorArray=new Float32Array(j*
|
|
|
|
+3),h.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;H(f.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)h=g,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),h=g,j=h.vertices.length,h.__vertexArray=new Float32Array(j*3),h.__colorArray=new Float32Array(j*3),h.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;H(f.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){h=
|
|
|
|
+g;h.__webglVertexBuffer=m.createBuffer();h.__webglColorBuffer=m.createBuffer();h=g;j=e;k=h.vertices.length;h.__vertexArray=new Float32Array(k*3);h.__colorArray=new Float32Array(k*3);h.__sortArray=[];h.__webglParticleCount=k;h.__materials=j.materials;G=o=n=void 0;n=0;for(o=j.materials.length;n<o;n++)if(G=j.materials[n],G.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in G.attributes){originalAttribute=G.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(k*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=
|
|
|
|
+!0;g.__dirtyColors=!0}H(f.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)A(e.__webglObjects,f);else if(f instanceof
|
|
|
|
+THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==f&&e.splice(g,1)}else f instanceof THREE.MarchingCubes&&A(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,n=k=g=j=void 0,h instanceof THREE.Mesh){g=h.geometry;for(j in g.geometryGroups)if(k=g.geometryGroups[j],n=y(k),g.__dirtyVertices||g.__dirtyMorphTargets||g.__dirtyElements||g.__dirtyUvs||g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents||
|
|
|
|
+n)if(n=k,o=m.DYNAMIC_DRAW,G=!g.dynamic,n.__inittedArrays){var J=B=w=void 0,Q=void 0,L=J=void 0,P=void 0,N=void 0,K=void 0,M=D=C=p=Y=x=t=u=v=void 0,E=Q=K=Q=N=P=void 0,z=void 0,S=z=E=P=void 0,ma=void 0,R=S=z=E=J=J=L=K=Q=S=z=E=ma=S=z=E=ma=S=z=E=void 0,ka=0,V=0,fa=0,X=0,T=0,U=0,aa=0,ja=0,W=0,O=0,Z=0,S=E=0,S=void 0,$=n.__vertexArray,ha=n.__uvArray,ia=n.__uv2Array,la=n.__normalArray,ca=n.__tangentArray,da=n.__colorArray,na=n.__skinVertexAArray,ea=n.__skinVertexBArray,ra=n.__skinIndexArray,sa=n.__skinWeightArray,
|
|
|
|
+ta=n.__morphTargetsArrays,ua=n.__webglCustomAttributes,z=void 0,qa=n.__faceArray,oa=n.__lineArray,va=n.__needsSmoothNormals,u=n.__vertexColorType,v=n.__uvType,t=n.__normalType,xa=h.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=n.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
|
|
xa.morphTargets;if(ua)for(R in ua)ua[R].offset=0,ua[R].offsetSrc=0;w=0;for(B=Ga.length;w<B;w++)if(J=Ga[w],Q=cb[J],ab&&(x=ab[J]),bb&&(Y=bb[J]),J=Q.vertexNormals,L=Q.normal,P=Q.vertexColors,N=Q.color,K=Q.vertexTangents,Q instanceof THREE.Face3){if(ya)p=Pa[Q.a].position,C=Pa[Q.b].position,D=Pa[Q.c].position,$[V]=p.x,$[V+1]=p.y,$[V+2]=p.z,$[V+3]=C.x,$[V+4]=C.y,$[V+5]=C.z,$[V+6]=D.x,$[V+7]=D.y,$[V+8]=D.z,V+=9;if(ua)for(R in ua)if(z=ua[R],z.__original.needsUpdate)E=z.offset,S=z.offsetSrc,z.size===1?(z.boundTo===
|
|
xa.morphTargets;if(ua)for(R in ua)ua[R].offset=0,ua[R].offsetSrc=0;w=0;for(B=Ga.length;w<B;w++)if(J=Ga[w],Q=cb[J],ab&&(x=ab[J]),bb&&(Y=bb[J]),J=Q.vertexNormals,L=Q.normal,P=Q.vertexColors,N=Q.color,K=Q.vertexTangents,Q instanceof THREE.Face3){if(ya)p=Pa[Q.a].position,C=Pa[Q.b].position,D=Pa[Q.c].position,$[V]=p.x,$[V+1]=p.y,$[V+2]=p.z,$[V+3]=C.x,$[V+4]=C.y,$[V+5]=C.z,$[V+6]=D.x,$[V+7]=D.y,$[V+8]=D.z,V+=9;if(ua)for(R in ua)if(z=ua[R],z.__original.needsUpdate)E=z.offset,S=z.offsetSrc,z.size===1?(z.boundTo===
|
|
void 0||z.boundTo==="vertices"?(z.array[E]=z.value[Q.a],z.array[E+1]=z.value[Q.b],z.array[E+2]=z.value[Q.c]):z.boundTo==="faces"?(S=z.value[S],z.array[E]=S,z.array[E+1]=S,z.array[E+2]=S,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[E]=z.value[S],z.array[E+1]=z.value[S+1],z.array[E+2]=z.value[S+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(p=z.value[Q.a],C=z.value[Q.b],D=z.value[Q.c]):z.boundTo==="faces"?(D=C=p=S=z.value[S],z.offsetSrc++):z.boundTo==="faceVertices"&&
|
|
void 0||z.boundTo==="vertices"?(z.array[E]=z.value[Q.a],z.array[E+1]=z.value[Q.b],z.array[E+2]=z.value[Q.c]):z.boundTo==="faces"?(S=z.value[S],z.array[E]=S,z.array[E+1]=S,z.array[E+2]=S,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[E]=z.value[S],z.array[E+1]=z.value[S+1],z.array[E+2]=z.value[S+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(p=z.value[Q.a],C=z.value[Q.b],D=z.value[Q.c]):z.boundTo==="faces"?(D=C=p=S=z.value[S],z.offsetSrc++):z.boundTo==="faceVertices"&&
|
|
(p=z.value[S],C=z.value[S+1],D=z.value[S+2],z.offsetSrc+=3),z.size===2?(z.array[E]=p.x,z.array[E+1]=p.y,z.array[E+2]=C.x,z.array[E+3]=C.y,z.array[E+4]=D.x,z.array[E+5]=D.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[E]=p.r,z.array[E+1]=p.g,z.array[E+2]=p.b,z.array[E+3]=C.r,z.array[E+4]=C.g,z.array[E+5]=C.b,z.array[E+6]=D.r,z.array[E+7]=D.g,z.array[E+8]=D.b):(z.array[E]=p.x,z.array[E+1]=p.y,z.array[E+2]=p.z,z.array[E+3]=C.x,z.array[E+4]=C.y,z.array[E+5]=C.z,z.array[E+6]=D.x,z.array[E+7]=D.y,z.array[E+
|
|
(p=z.value[S],C=z.value[S+1],D=z.value[S+2],z.offsetSrc+=3),z.size===2?(z.array[E]=p.x,z.array[E+1]=p.y,z.array[E+2]=C.x,z.array[E+3]=C.y,z.array[E+4]=D.x,z.array[E+5]=D.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[E]=p.r,z.array[E+1]=p.g,z.array[E+2]=p.b,z.array[E+3]=C.r,z.array[E+4]=C.g,z.array[E+5]=C.b,z.array[E+6]=D.r,z.array[E+7]=D.g,z.array[E+8]=D.b):(z.array[E]=p.x,z.array[E+1]=p.y,z.array[E+2]=p.z,z.array[E+3]=C.x,z.array[E+4]=C.y,z.array[E+5]=C.z,z.array[E+6]=D.x,z.array[E+7]=D.y,z.array[E+
|
|
@@ -317,10 +318,10 @@ N.z,ca[aa+7]=N.w,ca[aa+8]=Q.x,ca[aa+9]=Q.y,ca[aa+10]=Q.z,ca[aa+11]=Q.w,ca[aa+12]
|
|
ka+3,T+=6,oa[ja]=ka,oa[ja+1]=ka+1,oa[ja+2]=ka,oa[ja+3]=ka+3,oa[ja+4]=ka+1,oa[ja+5]=ka+2,oa[ja+6]=ka+2,oa[ja+7]=ka+3,ja+=8,ka+=4)}ya&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,$,o));if(ua)for(R in ua)z=ua[R],z.__original.needsUpdate&&(m.bindBuffer(m.ARRAY_BUFFER,z.buffer),m.bufferData(m.ARRAY_BUFFER,z.array,o));if(Ea){E=0;for(z=Fa.length;E<z;E++)m.bindBuffer(m.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[E]),m.bufferData(m.ARRAY_BUFFER,ta[E],o)}Da&&W>0&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
ka+3,T+=6,oa[ja]=ka,oa[ja+1]=ka+1,oa[ja+2]=ka,oa[ja+3]=ka+3,oa[ja+4]=ka+1,oa[ja+5]=ka+2,oa[ja+6]=ka+2,oa[ja+7]=ka+3,ja+=8,ka+=4)}ya&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,$,o));if(ua)for(R in ua)z=ua[R],z.__original.needsUpdate&&(m.bindBuffer(m.ARRAY_BUFFER,z.buffer),m.bufferData(m.ARRAY_BUFFER,z.array,o));if(Ea){E=0;for(z=Fa.length;E<z;E++)m.bindBuffer(m.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[E]),m.bufferData(m.ARRAY_BUFFER,ta[E],o)}Da&&W>0&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
n.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,o));Ja&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,la,o));Ka&&xa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,ca,o));za&&fa>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ha,o));za&&X>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ia,o));Ia&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),
|
|
n.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,o));Ja&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,la,o));Ka&&xa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,ca,o));za&&fa>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ha,o));za&&X>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ia,o));Ia&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),
|
|
m.bufferData(m.ELEMENT_ARRAY_BUFFER,qa,o),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,oa,o));O>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,na,o),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),m.bufferData(m.ARRAY_BUFFER,ea,o),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,ra,o),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,
|
|
m.bufferData(m.ELEMENT_ARRAY_BUFFER,qa,o),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,oa,o));O>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,na,o),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),m.bufferData(m.ARRAY_BUFFER,ea,o),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,ra,o),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,
|
|
-sa,o));G&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;F(k)}else if(g instanceof THREE.Ribbon){h=
|
|
|
|
-g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=m.DYNAMIC_DRAW;k=B=w=w=void 0;v=g.vertices;n=g.colors;u=v.length;o=n.length;t=g.__vertexArray;G=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w<u;w++)B=v[w].position,k=w*3,t[k]=B.x,t[k+1]=B.y,t[k+2]=B.z;m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,t,j)}if(x){for(w=0;w<o;w++)color=n[w],k=w*3,G[k]=color.r,G[k+1]=color.g,G[k+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,g.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
|
-G,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=m.DYNAMIC_DRAW;k=B=w=w=void 0;v=g.vertices;n=g.colors;u=v.length;o=n.length;t=g.__vertexArray;G=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w<u;w++)B=v[w].position,k=w*3,t[k]=B.x,t[k+1]=B.y,t[k+2]=B.z;m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,t,j)}if(x){for(w=0;w<o;w++)color=n[w],k=w*3,G[k]=color.r,G[k+1]=color.g,
|
|
|
|
-G[k+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,g.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,G,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,n=y(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||n)&&c(h,m.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,F(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),b=="back"?m.cullFace(m.BACK):b=="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),
|
|
|
|
|
|
+sa,o));G&&(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)}g.__dirtyVertices=!1;g.__dirtyMorphTargets=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyTangents=!1;g.__dirtyColors=!1;F(k)}else if(h instanceof THREE.Ribbon){g=
|
|
|
|
+h.geometry;if(g.__dirtyVertices||g.__dirtyColors){h=g;j=m.DYNAMIC_DRAW;k=B=w=w=void 0;v=h.vertices;n=h.colors;u=v.length;o=n.length;t=h.__vertexArray;G=h.__colorArray;x=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<u;w++)B=v[w].position,k=w*3,t[k]=B.x,t[k+1]=B.y,t[k+2]=B.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,t,j)}if(x){for(w=0;w<o;w++)color=n[w],k=w*3,G[k]=color.r,G[k+1]=color.g,G[k+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
|
+G,j)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(h instanceof THREE.Line){g=h.geometry;if(g.__dirtyVertices||g.__dirtyColors){h=g;j=m.DYNAMIC_DRAW;k=B=w=w=void 0;v=h.vertices;n=h.colors;u=v.length;o=n.length;t=h.__vertexArray;G=h.__colorArray;x=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<u;w++)B=v[w].position,k=w*3,t[k]=B.x,t[k+1]=B.y,t[k+2]=B.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,t,j)}if(x){for(w=0;w<o;w++)color=n[w],k=w*3,G[k]=color.r,G[k+1]=color.g,
|
|
|
|
+G[k+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,G,j)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)g=h.geometry,n=y(g),(g.__dirtyVertices||g.__dirtyColors||h.sortParticles||n)&&c(g,m.DYNAMIC_DRAW,h),g.__dirtyVertices=!1,g.__dirtyColors=!1,F(g)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),b=="back"?m.cullFace(m.BACK):b=="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),
|
|
m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
|
|
m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
@@ -334,7 +335,7 @@ f):h instanceof THREE.Face4&&(n=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));n.norm
|
|
j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var k=g[b],t,o,p=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?t=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(t=new THREE.Face4(k.a,k.b,k.c,k.d));t.normal.copy(k.normal);f=0;for(h=p.length;f<h;f++)o=p[f],t.vertexNormals.push(o.clone());t.color.copy(k.color);f=0;for(h=u.length;f<h;f++)o=u[f],t.vertexColors.push(o.clone());t.materials=k.materials.slice();
|
|
j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var k=g[b],t,o,p=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?t=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(t=new THREE.Face4(k.a,k.b,k.c,k.d));t.normal.copy(k.normal);f=0;for(h=p.length;f<h;f++)o=p[f],t.vertexNormals.push(o.clone());t.color.copy(k.color);f=0;for(h=u.length;f<h;f++)o=u[f],t.vertexColors.push(o.clone());t.materials=k.materials.slice();
|
|
t.centroid.copy(k.centroid);c.faces.push(t)}b=0;for(e=j.length;b<e;b++){g=j[b];t=[];f=0;for(h=g.length;f<h;f++)t.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(t)}return c},randomPointInTriangle:function(b,c,e){var f,g,j,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();f+g>1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);k.copy(c);k.multiplyScalar(g);h.addSelf(k);k.copy(e);k.multiplyScalar(j);h.addSelf(k);return h},randomPointInFace:function(b,
|
|
t.centroid.copy(k.centroid);c.faces.push(t)}b=0;for(e=j.length;b<e;b++){g=j[b];t=[];f=0;for(h=g.length;f<h;f++)t.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(t)}return c},randomPointInTriangle:function(b,c,e){var f,g,j,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();f+g>1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);k.copy(c);k.multiplyScalar(g);h.addSelf(k);k.copy(e);k.multiplyScalar(j);h.addSelf(k);return h},randomPointInFace:function(b,
|
|
c,e){var f,g,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,g=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,g,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;g=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,g,c),h=THREE.GeometryUtils.triangleArea(g,j,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f,
|
|
c,e){var f,g,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,g=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,g,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;g=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,g,c),h=THREE.GeometryUtils.triangleArea(g,j,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f,
|
|
-g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function c(e,f){if(f<e)return e;var g=e+Math.floor((f-e)/2);return o[g]>b?c(e,g-1):o[g]<b?c(g+1,f):g}return c(0,o.length-1)}var f,g,j=b.faces,h=b.vertices,k=j.length,t=0,o=[],p,u,v,n;for(g=0;g<k;g++){f=j[g];if(f instanceof THREE.Face3)p=h[f.a].position,u=h[f.b].position,
|
|
|
|
|
|
+g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function c(e,f){if(f<e)return e;var h=e+Math.floor((f-e)/2);return o[h]>b?c(e,h-1):o[h]<b?c(h+1,f):h}return c(0,o.length-1)}var f,g,j=b.faces,h=b.vertices,k=j.length,t=0,o=[],p,u,v,n;for(g=0;g<k;g++){f=j[g];if(f instanceof THREE.Face3)p=h[f.a].position,u=h[f.b].position,
|
|
v=h[f.c].position,f._area=THREE.GeometryUtils.triangleArea(p,u,v);else if(f instanceof THREE.Face4)p=h[f.a].position,u=h[f.b].position,v=h[f.c].position,n=h[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(p,u,n),f._area2=THREE.GeometryUtils.triangleArea(u,v,n),f._area=f._area1+f._area2;t+=f._area;o[g]=t}f=[];h={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*t,k=e(k),f[g]=THREE.GeometryUtils.randomPointInFace(j[k],b,!0),h[k]?h[k]+=1:h[k]=1;return f},triangleArea:function(b,c,e){var f,g=THREE.GeometryUtils.__v1;
|
|
v=h[f.c].position,f._area=THREE.GeometryUtils.triangleArea(p,u,v);else if(f instanceof THREE.Face4)p=h[f.a].position,u=h[f.b].position,v=h[f.c].position,n=h[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(p,u,n),f._area2=THREE.GeometryUtils.triangleArea(u,v,n),f._area=f._area1+f._area2;t+=f._area;o[g]=t}f=[];h={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*t,k=e(k),f[g]=THREE.GeometryUtils.randomPointInFace(j[k],b,!0),h[k]?h[k]+=1:h[k]=1;return f},triangleArea:function(b,c,e){var f,g=THREE.GeometryUtils.__v1;
|
|
g.sub(b,c);f=g.length();g.sub(b,e);b=g.length();g.sub(c,e);e=g.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
g.sub(b,c);f=g.length();g.sub(b,e);b=g.length();g.sub(c,e);e=g.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return j},getNormalMap:function(b,c){var e=function(b){var c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
|
|
THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return j},getNormalMap:function(b,c){var e=function(b){var c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
|
|
@@ -379,9 +380,9 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown
|
|
1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*
|
|
1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*
|
|
Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
-THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),t=j.length,F=0;h=t-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<t-1;h++)F=f*k.chunks[h]/k.total,c.keys[h]={time:F,pos:j[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
|
|
|
|
-f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
|
|
|
|
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
|
|
|
|
+THREE.PathCamera=function(b){function c(b,c,e,f){var h={name:e,fps:0.6,length:f,hierarchy:[]},g,j=c.getControlPointsArray(),k=c.getLength(),t=j.length,F=0;g=t-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[g]={time:f,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<t-1;g++)F=f*k.chunks[g]/k.total,c.keys[g]={time:F,pos:j[g]};h.hierarchy[0]=c;THREE.AnimationHandler.add(h);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
|
|
|
|
+f,h=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),h.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
|
|
|
|
+16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi=
|
|
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi=
|
|
@@ -462,16 +463,16 @@ THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.se
|
|
THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
|
|
THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,t){function o(b,c,e,h,k,n,o,t){var u,v,x=f||1,w=g||1,K=k/2,N=n/2,m=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",w=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",x=j||1;var U=x+1,T=w+1;k/=x;var W=n/w;for(v=0;v<T;v++)for(n=0;n<U;n++){var R=new THREE.Vector3;R[b]=(n*k-K)*e;R[c]=(v*W-N)*h;R[u]=o;p.vertices.push(new THREE.Vertex(R))}for(v=0;v<w;v++)for(n=0;n<x;n++)p.faces.push(new THREE.Face4(n+U*v+
|
|
THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,t){function o(b,c,e,h,k,n,o,t){var u,v,x=f||1,w=g||1,K=k/2,N=n/2,m=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",w=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",x=j||1;var U=x+1,T=w+1;k/=x;var W=n/w;for(v=0;v<T;v++)for(n=0;n<U;n++){var R=new THREE.Vector3;R[b]=(n*k-K)*e;R[c]=(v*W-N)*h;R[u]=o;p.vertices.push(new THREE.Vertex(R))}for(v=0;v<w;v++)for(n=0;n<x;n++)p.faces.push(new THREE.Face4(n+U*v+
|
|
m,n+U*(v+1)+m,n+1+U*(v+1)+m,n+1+U*v+m,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/x,v/w),new THREE.UV(n/x,(v+1)/w),new THREE.UV((n+1)/x,(v+1)/w),new THREE.UV((n+1)/x,v/w)])}THREE.Geometry.call(this);var p=this,u=b/2,v=c/2,n=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var w in t)this.sides[w]!=void 0&&(this.sides[w]=
|
|
m,n+U*(v+1)+m,n+1+U*(v+1)+m,n+1+U*v+m,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/x,v/w),new THREE.UV(n/x,(v+1)/w),new THREE.UV((n+1)/x,(v+1)/w),new THREE.UV((n+1)/x,v/w)])}THREE.Geometry.call(this);var p=this,u=b/2,v=c/2,n=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var w in t)this.sides[w]!=void 0&&(this.sides[w]=
|
|
-t[w]);this.sides.px&&o("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,c,n,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,c,-n,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],h=!1,j=0,k=b.length;j<k;j++){var n=b[j];if(g.position.x==n.position.x&&
|
|
|
|
-g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=j;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
|
|
+t[w]);this.sides.px&&o("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,c,n,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,c,-n,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var h=p.vertices[e],g=!1,j=0,k=b.length;j<k;j++){var n=b[j];if(h.position.x==n.position.x&&
|
|
|
|
+h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=j;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)h=p.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var k=this,t,o=Math.PI*2,p=f/2;for(t=0;t<b;t++)h(Math.sin(o*t/b)*c,Math.cos(o*t/b)*c,-p);for(t=0;t<b;t++)h(Math.sin(o*t/b)*e,Math.cos(o*t/b)*e,p);for(t=0;t<b;t++)k.faces.push(new THREE.Face4(t,t+b,b+(t+1)%b,(t+1)%b));if(e>0){h(0,0,-p-(j||0));for(t=b;t<b+b/2;t++)k.faces.push(new THREE.Face4(2*b,(2*t-2*b)%b,(2*t-2*b+1)%b,(2*t-2*b+2)%b))}if(c>0){h(0,0,p+
|
|
THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var k=this,t,o=Math.PI*2,p=f/2;for(t=0;t<b;t++)h(Math.sin(o*t/b)*c,Math.cos(o*t/b)*c,-p);for(t=0;t<b;t++)h(Math.sin(o*t/b)*e,Math.cos(o*t/b)*e,p);for(t=0;t<b;t++)k.faces.push(new THREE.Face4(t,t+b,b+(t+1)%b,(t+1)%b));if(e>0){h(0,0,-p-(j||0));for(t=b;t<b+b/2;t++)k.faces.push(new THREE.Face4(2*b,(2*t-2*b)%b,(2*t-2*b+1)%b,(2*t-2*b+2)%b))}if(c>0){h(0,0,p+
|
|
(g||0));for(t=b+b/2;t<2*b;t++)k.faces.push(new THREE.Face4(2*b+1,(2*t-2*b+2)%b+b,(2*t-2*b+1)%b+b,(2*t-2*b)%b+b))}t=0;for(b=this.faces.length;t<b;t++){var c=[],e=this.faces[t],g=this.vertices[e.a],j=this.vertices[e.b],p=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/o,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
|
|
(g||0));for(t=b+b/2;t<2*b;t++)k.faces.push(new THREE.Face4(2*b+1,(2*t-2*b+2)%b+b,(2*t-2*b+1)%b+b,(2*t-2*b)%b+b))}t=0;for(b=this.faces.length;t<b;t++){var c=[],e=this.faces[t],g=this.vertices[e.a],j=this.vertices[e.b],p=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/o,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/o,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/o,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)g=b[e],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)g=b[e],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();h.set(-f.y,f.x);j.set(g.y,-g.x);k.copy(b).addSelf(h);n.copy(b).addSelf(j);if(k.equals(n))return j.clone();
|
|
|
|
-k.copy(c).addSelf(h);n.copy(e).addSelf(j);h=f.dot(j);j=n.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(J=b.length;--J>=0;){ia=J;da=J-1;da<0&&(da=b.length-
|
|
|
|
-1);for(var c=0,e=n+p*2,c=0;c<e;c++){var f=W*c,g=W*(c+1),h=$+ia+f,j=$+ia+g,m=h,f=$+da+f,g=$+da+g,o=j;m+=X;f+=X;g+=X;o+=X;C.faces.push(new THREE.Face4(m,f,g,o,null,null,I));I&&(m=c/e,f=(c+1)/e,g=k+t*2,h=(C.vertices[h].position.z+t)/g,j=(C.vertices[j].position.z+t)/g,C.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(j,m),new THREE.UV(j,f),new THREE.UV(h,f)]))}}}function j(b,c,e){C.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=X;c+=X;e+=X;C.faces.push(new THREE.Face3(b,
|
|
|
|
-c,e,null,null,A));if(A){var f=H.maxY,g=H.maxX,h=C.vertices[c].position.x,c=C.vertices[c].position.y,j=C.vertices[e].position.x,e=C.vertices[e].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[b].position.x/g,C.vertices[b].position.y/f),new THREE.UV(h/g,c/f),new THREE.UV(j/g,e/f)])}}var k=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,o=c.bevelSize!==void 0?c.bevelSize:t-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);k.copy(b).addSelf(g);n.copy(b).addSelf(j);if(k.equals(n))return j.clone();
|
|
|
|
+k.copy(c).addSelf(g);n.copy(e).addSelf(j);g=f.dot(j);j=n.subSelf(k).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(J=b.length;--J>=0;){ia=J;da=J-1;da<0&&(da=b.length-
|
|
|
|
+1);for(var c=0,e=n+p*2,c=0;c<e;c++){var f=W*c,h=W*(c+1),g=$+ia+f,j=$+ia+h,m=g,f=$+da+f,h=$+da+h,o=j;m+=X;f+=X;h+=X;o+=X;C.faces.push(new THREE.Face4(m,f,h,o,null,null,I));I&&(m=c/e,f=(c+1)/e,h=k+t*2,g=(C.vertices[g].position.z+t)/h,j=(C.vertices[j].position.z+t)/h,C.faceVertexUvs[0].push([new THREE.UV(g,m),new THREE.UV(j,m),new THREE.UV(j,f),new THREE.UV(g,f)]))}}}function j(b,c,e){C.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=X;c+=X;e+=X;C.faces.push(new THREE.Face3(b,
|
|
|
|
+c,e,null,null,A));if(A){var f=H.maxY,h=H.maxX,g=C.vertices[c].position.x,c=C.vertices[c].position.y,j=C.vertices[e].position.x,e=C.vertices[e].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[b].position.x/h,C.vertices[b].position.y/f),new THREE.UV(g/h,c/f),new THREE.UV(j/h,e/f)])}}var k=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,o=c.bevelSize!==void 0?c.bevelSize:t-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
!0,v=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,x=c.bendPath,w=c.extrudePath,B,y=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,A=c.material,I=c.extrudeMaterial,H=this.shapebb;if(w)B=w.getPoints(v),n=B.length,y=!0,u=!1;u||(o=t=p=0);var G,L,D,C=this,X=this.vertices.length;x&&b.addWrapPath(x);v=F?b.extractAllSpacedPoints(v):b.extractAllPoints(v);x=v.shape;v=v.holes;if(w=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();L=0;for(D=v.length;L<D;L++)G=v[L],THREE.Shape.Utils.isClockWise(G)&&
|
|
!0,v=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,x=c.bendPath,w=c.extrudePath,B,y=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,A=c.material,I=c.extrudeMaterial,H=this.shapebb;if(w)B=w.getPoints(v),n=B.length,y=!0,u=!1;u||(o=t=p=0);var G,L,D,C=this,X=this.vertices.length;x&&b.addWrapPath(x);v=F?b.extractAllSpacedPoints(v):b.extractAllPoints(v);x=v.shape;v=v.holes;if(w=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();L=0;for(D=v.length;L<D;L++)G=v[L],THREE.Shape.Utils.isClockWise(G)&&
|
|
(v[L]=G.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(x,v);F=x;L=0;for(D=v.length;L<D;L++)G=v[L],x=x.concat(G);var J,K,N,m,U,T,W=x.length,R=w.length,Z=[];J=0;K=F.length;ia=K-1;for(da=J+1;J<K;J++,ia++,da++)ia==K&&(ia=0),da==K&&(da=0),Z[J]=f(F[J],F[ia],F[da]);var ha=[],V,ca=Z.concat();L=0;for(D=v.length;L<D;L++){G=v[L];V=[];J=0;K=G.length;ia=K-1;for(da=J+1;J<K;J++,ia++,da++)ia==K&&(ia=0),da==K&&(da=0),V[J]=f(G[J],G[ia],G[da]);ha.push(V);ca=ca.concat(V)}for(N=0;N<p;N++){m=N/p;U=t*(1-m);m=o*Math.sin(m*
|
|
(v[L]=G.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(x,v);F=x;L=0;for(D=v.length;L<D;L++)G=v[L],x=x.concat(G);var J,K,N,m,U,T,W=x.length,R=w.length,Z=[];J=0;K=F.length;ia=K-1;for(da=J+1;J<K;J++,ia++,da++)ia==K&&(ia=0),da==K&&(da=0),Z[J]=f(F[J],F[ia],F[da]);var ha=[],V,ca=Z.concat();L=0;for(D=v.length;L<D;L++){G=v[L];V=[];J=0;K=G.length;ia=K-1;for(da=J+1;J<K;J++,ia++,da++)ia==K&&(ia=0),da==K&&(da=0),V[J]=f(G[J],G[ia],G[da]);ha.push(V);ca=ca.concat(V)}for(N=0;N<p;N++){m=N/p;U=t*(1-m);m=o*Math.sin(m*
|
|
Math.PI/2);J=0;for(K=F.length;J<K;J++)T=e(F[J],Z[J],m),j(T.x,T.y,-U);L=0;for(D=v.length;L<D;L++){G=v[L];V=ha[L];J=0;for(K=G.length;J<K;J++)T=e(G[J],V[J],m),j(T.x,T.y,-U)}}m=o;for(J=0;J<W;J++)T=u?e(x[J],ca[J],m):x[J],y?j(T.x,T.y+B[0].y,B[0].x):j(T.x,T.y,0);for(N=1;N<=n;N++)for(J=0;J<W;J++)T=u?e(x[J],ca[J],m):x[J],y?j(T.x,T.y+B[N-1].y,B[N-1].x):j(T.x,T.y,k/n*N);for(N=p-1;N>=0;N--){m=N/p;U=t*(1-m);m=o*Math.sin(m*Math.PI/2);J=0;for(K=F.length;J<K;J++)T=e(F[J],Z[J],m),j(T.x,T.y,k+U);L=0;for(D=v.length;L<
|
|
Math.PI/2);J=0;for(K=F.length;J<K;J++)T=e(F[J],Z[J],m),j(T.x,T.y,-U);L=0;for(D=v.length;L<D;L++){G=v[L];V=ha[L];J=0;for(K=G.length;J<K;J++)T=e(G[J],V[J],m),j(T.x,T.y,-U)}}m=o;for(J=0;J<W;J++)T=u?e(x[J],ca[J],m):x[J],y?j(T.x,T.y+B[0].y,B[0].x):j(T.x,T.y,0);for(N=1;N<=n;N++)for(J=0;J<W;J++)T=u?e(x[J],ca[J],m):x[J],y?j(T.x,T.y+B[N-1].y,B[N-1].x):j(T.x,T.y,k/n*N);for(N=p-1;N>=0;N--){m=N/p;U=t*(1-m);m=o*Math.sin(m*Math.PI/2);J=0;for(K=F.length;J<K;J++)T=e(F[J],Z[J],m),j(T.x,T.y,k+U);L=0;for(D=v.length;L<
|
|
@@ -500,14 +501,14 @@ H=void 0,G=void 0,L=void 0,D=void 0,C=void 0,X=void 0,A=v[y[n]].x,I=v[y[n]].y,H=
|
|
THREE.TorusGeometry=function(b,c,e,f,g){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=g||2*Math.PI;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e)f=e/this.segmentsT*this.arc,g=c/this.segmentsR*2*Math.PI,this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g)))),b.push([e/this.segmentsT,1-c/this.segmentsR]);
|
|
THREE.TorusGeometry=function(b,c,e,f,g){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=g||2*Math.PI;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e)f=e/this.segmentsT*this.arc,g=c/this.segmentsR*2*Math.PI,this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g)))),b.push([e/this.segmentsT,1-c/this.segmentsR]);
|
|
for(c=1;c<=this.segmentsR;++c)for(e=1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
for(c=1;c<=this.segmentsR;++c)for(e=1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
-THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function k(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
|
|
|
+THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function k(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
this.segmentsT;++c){var t=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=k(t,h,this.q,this.p,this.radius,this.heightScale),t=k(t+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=t.x-g.x;e.y=t.y-g.y;e.z=t.z-g.z;f.x=t.x+g.x;f.y=t.y+g.y;f.z=t.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();t=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=t*f.x+h*j.x;g.y+=t*f.y+h*j.y;g.z+=t*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
this.segmentsT;++c){var t=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=k(t,h,this.q,this.p,this.radius,this.heightScale),t=k(t+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=t.x-g.x;e.y=t.y-g.y;e.z=t.z-g.z;f.x=t.x+g.x;f.y=t.y+g.y;f.z=t.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();t=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=t*f.x+h*j.x;g.y+=t*f.y+h*j.y;g.z+=t*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,t,o,p])}this.computeCentroids();
|
|
g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,t,o,p])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,g,h,j,k){var o=document.createElement("canvas");b[e]=new THREE.Texture(o);b[e].sourceFile=g;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(h[1]!=
|
|
|
|
-1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)b[e].wrapS=h[k[0]];if(h[k[1]]!==void 0)b[e].wrapT=h[k[1]]}f(b[e],c+"/"+g)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,k,t;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?k="MeshPhongMaterial":b.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
|
|
|
|
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,j,k){var o=document.createElement("canvas");b[e]=new THREE.Texture(o);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
|
|
|
|
+1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(k){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[k[0]]!==void 0)b[e].wrapS=g[k[0]];if(g[k[1]]!==void 0)b[e].wrapT=g[k[1]]}f(b[e],c+"/"+h)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,k,t;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?k="MeshPhongMaterial":b.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=j(b.colorDiffuse);
|
|
if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=j(b.colorDiffuse);
|
|
else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpecular);if(b.colorAmbient)h.ambient=j(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpecular);if(b.colorAmbient)h.ambient=j(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var o=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(o.uniforms),u=h.color;k=h.specular;t=h.ambient;var v=h.shininess;p.tNormal.texture=h.normalMap;if(b.mapNormalFactor)p.uNormalScale.value=b.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=
|
|
b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var o=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(o.uniforms),u=h.color;k=h.specular;t=h.ambient;var v=h.shininess;p.tNormal.texture=h.normalMap;if(b.mapNormalFactor)p.uNormalScale.value=b.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=
|