|
@@ -1,96 +1,96 @@
|
|
// Three.js r38 - http://github.com/mrdoob/three.js
|
|
// Three.js r38 - http://github.com/mrdoob/three.js
|
|
var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)};
|
|
var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)};
|
|
-THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,c){this.r=b;this.g=d;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,c){var f,g,h,j,k,n;if(c==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=c*(1-d);n=c*(1-d*k);d=c*(1-d*(1-k));switch(j){case 1:f=n;g=c;h=b;break;case 2:f=b;g=c;h=d;break;case 3:f=b;g=n;h=c;break;case 4:f=d;g=b;h=c;break;case 5:f=c;g=b;
|
|
|
|
-h=n;break;case 6:case 0:f=c;g=d;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
|
|
|
|
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
|
|
|
|
-THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
|
|
-this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,c){this.set(b||0,d||0,c||0)};
|
|
|
|
-THREE.Vector3.prototype={set:function(b,d,c){this.x=b;this.y=d;this.z=c;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b,
|
|
|
|
-d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,c=this.y,f=this.z;this.set(c*b.z-f*b.y,f*b.x-d*b.z,d*b.y-c*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/
|
|
|
|
-b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,c=this.y-b.y;b=this.z-b.z;return d*d+c*c+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b=
|
|
|
|
-this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var d=Math.cos(this.y);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n13/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
|
|
|
|
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,c,f){this.set(b||0,d||0,c||0,f||1)};
|
|
|
|
-THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
|
|
-b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
|
|
-THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(F,H,U,z){z=z.clone().subSelf(H);U=U.clone().subSelf(H);var J=F.clone().subSelf(H);F=z.dot(z);H=z.dot(U);z=z.dot(J);var L=U.dot(U);U=U.dot(J);J=1/(F*L-H*H);L=(L*z-H*U)*J;F=(F*U-H*z)*J;return L>0&&F>0&&L+F<1}var c,f,g,h,j,k,n,p,o,u,
|
|
|
|
-y,v=b.geometry,B=v.vertices,C=[];c=0;for(f=v.faces.length;c<f;c++){g=v.faces[c];u=this.origin.clone();y=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(B[g.a].position.clone());j=n.multiplyVector3(B[g.b].position.clone());k=n.multiplyVector3(B[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(o<0){p=p.dot((new THREE.Vector3).sub(h,u))/o;u=u.addSelf(y.multiplyScalar(p));
|
|
|
|
-if(g instanceof THREE.Face3){if(d(u,h,j,k)){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};C.push(g)}}else if(g instanceof THREE.Face4&&(d(u,h,j,n)||d(u,j,k,n))){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};C.push(g)}}}return C}};
|
|
|
|
-THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,u){k=!1;d=n;c=p;f=o;g=u;b()};this.addPoint=function(n,p){if(k){k=!1;d=n;c=p;f=n;g=p}else{d=d<n?d:n;c=c<p?c:p;f=f>n?f:n;g=g>p?g:p}b()};
|
|
|
|
-this.add3Points=function(n,p,o,u,y,v){if(k){k=!1;d=n<o?n<y?n:y:o<y?o:y;c=p<u?p<v?p:v:u<v?u:v;f=n>o?n>y?n:y:o>y?o:y;g=p>u?p>v?p:v:u>v?u:v}else{d=n<o?n<y?n<d?n:d:y<d?y:d:o<y?o<d?o:d:y<d?y:d;c=p<u?p<v?p<c?p:c:v<c?v:c:u<v?u<c?u:c:v<c?v:c;f=n>o?n>y?n>f?n:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>u?p>v?p>g?p:g:v>g?v:g:u>v?u>g?u:g:v>g?v:g}b()};this.addRectangle=function(n){if(k){k=!1;d=n.getLeft();c=n.getTop();f=n.getRight();g=n.getBottom()}else{d=d<n.getLeft()?d:n.getLeft();c=c<n.getTop()?c:n.getTop();f=f>n.getRight()?
|
|
|
|
-f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){d-=n;c-=n;f+=n;g+=n;b()};this.minSelf=function(n){d=d>n.getLeft()?d:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f<n.getRight()?f:n.getRight();g=g<n.getBottom()?g:n.getBottom();b()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(d,n.getLeft())>=0&&Math.min(g,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
|
|
|
|
-THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
|
|
|
|
-THREE.Matrix4=function(b,d,c,f,g,h,j,k,n,p,o,u,y,v,B,C){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,u||0,y||0,v||0,B||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,n,p,o,u,y,v,B,C){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=u;this.n41=y;this.n42=v;this.n43=B;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
|
|
|
|
-g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
|
|
|
|
-f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
|
|
|
|
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,y=b.n33,v=b.n34,B=b.n41,C=b.n42,F=b.n43,H=b.n44,U=d.n11,z=d.n12,J=d.n13,L=d.n14,M=d.n21,Fa=d.n22,
|
|
|
|
-oa=d.n23,xa=d.n24,Z=d.n31,e=d.n32,da=d.n33,Ca=d.n34;this.n11=c*U+f*M+g*Z;this.n12=c*z+f*Fa+g*e;this.n13=c*J+f*oa+g*da;this.n14=c*L+f*xa+g*Ca+h;this.n21=j*U+k*M+n*Z;this.n22=j*z+k*Fa+n*e;this.n23=j*J+k*oa+n*da;this.n24=j*L+k*xa+n*Ca+p;this.n31=o*U+u*M+y*Z;this.n32=o*z+u*Fa+y*e;this.n33=o*J+u*oa+y*da;this.n34=o*L+u*xa+y*Ca+v;this.n41=B*U+C*M+F*Z;this.n42=B*z+C*Fa+F*e;this.n43=B*J+C*oa+F*da;this.n44=B*L+C*xa+F*Ca+H;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=this.n21;
|
|
|
|
-c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},
|
|
|
|
-determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,u=this.n34,y=this.n41,v=this.n42,B=this.n43,C=this.n44;return f*j*p*y-c*k*p*y-f*h*o*y+d*k*o*y+c*h*u*y-d*j*u*y-f*j*n*v+c*k*n*v+f*g*o*v-b*k*o*v-c*g*u*v+b*j*u*v+f*h*n*B-d*k*n*B-f*g*p*B+b*k*p*B+d*g*u*B-b*h*u*B-c*h*n*C+d*j*n*C+c*g*p*C-b*j*p*C-d*g*o*C+b*h*o*C},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
|
|
|
|
|
|
+THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,c,d){var f,g,h,j,k,n;if(d==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=d*(1-c);n=d*(1-c*k);c=d*(1-c*(1-k));switch(j){case 1:f=n;g=d;h=b;break;case 2:f=b;g=d;h=c;break;case 3:f=b;g=n;h=d;break;case 4:f=c;g=b;h=d;break;case 5:f=d;g=b;
|
|
|
|
+h=n;break;case 6:case 0:f=d;g=c;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
|
|
|
|
+255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
|
|
|
|
+THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
|
|
+this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,c,d){this.set(b||0,c||0,d||0)};
|
|
|
|
+THREE.Vector3.prototype={set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b,
|
|
|
|
+c){this.set(b.y*c.z-b.z*c.y,b.z*c.x-b.x*c.z,b.x*c.y-b.y*c.x);return this},crossSelf:function(b){var c=this.x,d=this.y,f=this.z;this.set(d*b.z-f*b.y,f*b.x-c*b.z,c*b.y-d*b.x);return this},multiply:function(b,c){this.set(b.x*c.x,b.y*c.y,b.z*c.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/
|
|
|
|
+b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,d=this.y-b.y;b=this.z-b.z;return c*c+d*d+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b=
|
|
|
|
+this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-b.n23/c,b.n33/c);this.z=Math.atan2(-b.n13/c,b.n11/c)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
|
|
|
|
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,c,d,f){this.set(b||0,c||0,d||0,f||1)};
|
|
|
|
+THREE.Vector4.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
|
|
+b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,c){this.set(this.x+(b.x-this.x)*c,this.y+(b.y-this.y)*c,this.z+(b.z-this.z)*c,this.w+(b.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(F,H,U,z){z=z.clone().subSelf(H);U=U.clone().subSelf(H);var J=F.clone().subSelf(H);F=z.dot(z);H=z.dot(U);z=z.dot(J);var L=U.dot(U);U=U.dot(J);J=1/(F*L-H*H);L=(L*z-H*U)*J;F=(F*U-H*z)*J;return L>0&&F>0&&L+F<1}var d,f,g,h,j,k,n,p,o,u,
|
|
|
|
+y,v=b.geometry,B=v.vertices,C=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];u=this.origin.clone();y=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(B[g.a].position.clone());j=n.multiplyVector3(B[g.b].position.clone());k=n.multiplyVector3(B[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(o<0){p=p.dot((new THREE.Vector3).sub(h,u))/o;u=u.addSelf(y.multiplyScalar(p));
|
|
|
|
+if(g instanceof THREE.Face3){if(c(u,h,j,k)){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};C.push(g)}}else if(g instanceof THREE.Face4&&(c(u,h,j,n)||c(u,j,k,n))){g={distance:this.origin.distanceTo(u),point:u,face:g,object:b};C.push(g)}}}return C}};
|
|
|
|
+THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,u){k=!1;c=n;d=p;f=o;g=u;b()};this.addPoint=function(n,p){if(k){k=!1;c=n;d=p;f=n;g=p}else{c=c<n?c:n;d=d<p?d:p;f=f>n?f:n;g=g>p?g:p}b()};
|
|
|
|
+this.add3Points=function(n,p,o,u,y,v){if(k){k=!1;c=n<o?n<y?n:y:o<y?o:y;d=p<u?p<v?p:v:u<v?u:v;f=n>o?n>y?n:y:o>y?o:y;g=p>u?p>v?p:v:u>v?u:v}else{c=n<o?n<y?n<c?n:c:y<c?y:c:o<y?o<c?o:c:y<c?y:c;d=p<u?p<v?p<d?p:d:v<d?v:d:u<v?u<d?u:d:v<d?v:d;f=n>o?n>y?n>f?n:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>u?p>v?p>g?p:g:v>g?v:g:u>v?u>g?u:g:v>g?v:g}b()};this.addRectangle=function(n){if(k){k=!1;c=n.getLeft();d=n.getTop();f=n.getRight();g=n.getBottom()}else{c=c<n.getLeft()?c:n.getLeft();d=d<n.getTop()?d:n.getTop();f=f>n.getRight()?
|
|
|
|
+f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){c-=n;d-=n;f+=n;g+=n;b()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();f=f<n.getRight()?f:n.getRight();g=g<n.getBottom()?g:n.getBottom();b()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(c,n.getLeft())>=0&&Math.min(g,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){k=!0;g=f=d=c=0;b()};this.isEmpty=function(){return k}};
|
|
|
|
+THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
|
|
|
|
+THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,p,o,u,y,v,B,C){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,u||0,y||0,v||0,B||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,p,o,u,y,v,B,C){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=u;this.n41=y;this.n42=v;this.n43=B;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var f=THREE.Matrix4.__v1,
|
|
|
|
+g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(d,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,g=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*d+this.n23*
|
|
|
|
+f+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+d*this.n32+f*this.n33;b.normalize();
|
|
|
|
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,y=b.n33,v=b.n34,B=b.n41,C=b.n42,F=b.n43,H=b.n44,U=c.n11,z=c.n12,J=c.n13,L=c.n14,M=c.n21,Fa=c.n22,
|
|
|
|
+oa=c.n23,xa=c.n24,Z=c.n31,e=c.n32,da=c.n33,Ca=c.n34;this.n11=d*U+f*M+g*Z;this.n12=d*z+f*Fa+g*e;this.n13=d*J+f*oa+g*da;this.n14=d*L+f*xa+g*Ca+h;this.n21=j*U+k*M+n*Z;this.n22=j*z+k*Fa+n*e;this.n23=j*J+k*oa+n*da;this.n24=j*L+k*xa+n*Ca+p;this.n31=o*U+u*M+y*Z;this.n32=o*z+u*Fa+y*e;this.n33=o*J+u*oa+y*da;this.n34=o*L+u*xa+y*Ca+v;this.n41=B*U+C*M+F*Z;this.n42=B*z+C*Fa+F*e;this.n43=B*J+C*oa+F*da;this.n44=B*L+C*xa+F*Ca+H;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;
|
|
|
|
+d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},
|
|
|
|
+determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,u=this.n34,y=this.n41,v=this.n42,B=this.n43,C=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*u*y-c*j*u*y-f*j*n*v+d*k*n*v+f*g*o*v-b*k*o*v-d*g*u*v+b*j*u*v+f*h*n*B-c*k*n*B-f*g*p*B+b*k*p*B+c*g*u*B-b*h*u*B-d*h*n*C+c*j*n*C+d*g*p*C-b*j*p*C-c*g*o*C+b*h*o*C},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
|
|
b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;
|
|
b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;
|
|
this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;
|
|
this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;
|
|
-b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,0,1);return this},
|
|
|
|
-setScale:function(b,d,c){this.set(b,0,0,0,0,d,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var c=Math.cos(d),f=Math.sin(d),g=1-c,h=b.x,j=b.y,k=
|
|
|
|
-b.z,n=g*h,p=g*j;this.set(n*h+c,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+c,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33=b*g;return this},
|
|
|
|
-setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var n=d*j;d*=k;var p=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=d+j;this.n21=n+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+p);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
|
|
-b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;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,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,y=b.n33,v=b.n34,B=b.n41,C=b.n42,F=b.n43,H=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*v*C-p*y*C+p*u*F-k*v*F-n*u*H+k*y*H;d.n12=h*y*C-g*v*C-h*u*F+f*v*F+g*u*H-f*y*H;d.n13=g*p*C-h*n*C+h*k*F-f*p*F-g*k*H+f*n*H;d.n14=h*n*u-g*p*u-h*k*y+f*p*y+g*k*v-f*n*v;d.n21=p*y*B-n*v*B-p*o*F+j*v*F+n*o*H-j*y*H;d.n22=g*v*B-h*y*B+h*o*F-c*v*F-g*o*H+c*y*H;d.n23=h*n*B-g*p*B-h*j*F+c*p*F+g*j*H-c*n*H;
|
|
|
|
-d.n24=g*p*o-h*n*o+h*j*y-c*p*y-g*j*v+c*n*v;d.n31=k*v*B-p*u*B+p*o*C-j*v*C-k*o*H+j*u*H;d.n32=h*u*B-f*v*B-h*o*C+c*v*C+f*o*H-c*u*H;d.n33=g*p*B-h*k*B+h*j*C-c*p*C-f*j*H+c*k*H;d.n34=h*k*o-f*p*o-h*j*u+c*p*u+f*j*v-c*k*v;d.n41=n*u*B-k*y*B-n*o*C+j*y*C+k*o*F-j*u*F;d.n42=f*y*B-g*u*B+g*o*C-c*y*C-f*o*F+c*u*F;d.n43=g*k*B-f*n*B-g*j*C+c*n*C+f*j*F-c*k*F;d.n44=f*n*o-g*k*o+g*j*u-c*n*u-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*n;c[6]=b*p;c[7]=b*o;c[8]=b*u;return d};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
|
|
|
|
-THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=d-b;n=c-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
|
|
|
+b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},
|
|
|
|
+setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),g=1-d,h=b.x,j=b.y,k=
|
|
|
|
+b.z,n=g*h,p=g*j;this.set(n*h+d,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+d,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33=b*g;return this},
|
|
|
|
+setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var n=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
|
|
+b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,y=b.n33,v=b.n34,B=b.n41,C=b.n42,F=b.n43,H=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*C-p*y*C+p*u*F-k*v*F-n*u*H+k*y*H;c.n12=h*y*C-g*v*C-h*u*F+f*v*F+g*u*H-f*y*H;c.n13=g*p*C-h*n*C+h*k*F-f*p*F-g*k*H+f*n*H;c.n14=h*n*u-g*p*u-h*k*y+f*p*y+g*k*v-f*n*v;c.n21=p*y*B-n*v*B-p*o*F+j*v*F+n*o*H-j*y*H;c.n22=g*v*B-h*y*B+h*o*F-d*v*F-g*o*H+d*y*H;c.n23=h*n*B-g*p*B-h*j*F+d*p*F+g*j*H-d*n*H;
|
|
|
|
+c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*v+d*n*v;c.n31=k*v*B-p*u*B+p*o*C-j*v*C-k*o*H+j*u*H;c.n32=h*u*B-f*v*B-h*o*C+d*v*C+f*o*H-d*u*H;c.n33=g*p*B-h*k*B+h*j*C-d*p*C-f*j*H+d*k*H;c.n34=h*k*o-f*p*o-h*j*u+d*p*u+f*j*v-d*k*v;c.n41=n*u*B-k*y*B-n*o*C+j*y*C+k*o*F-j*u*F;c.n42=f*y*B-g*u*B+g*o*C-d*y*C-f*o*F+d*u*F;c.n43=g*k*B-f*n*B-g*j*C+d*n*C+f*j*F-d*k*F;c.n44=f*n*o-g*k*o+g*j*u-d*n*u-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*o;d[8]=b*u;return c};
|
|
|
|
+THREE.Matrix4.makeFrustum=function(b,c,d,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,f)};
|
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
!0;this._vector=new THREE.Vector3};
|
|
!0;this._vector=new THREE.Vector3};
|
|
-THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
|
|
|
|
-undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);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,d,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,
|
|
|
|
-d,c)}};THREE.Quaternion=function(b,d,c,f){this.set(b||0,d||0,c||0,f!==undefined?f:1)};
|
|
|
|
-THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,c=b.x*d,f=b.y*d,g=b.z*d;b=Math.cos(f);f=Math.sin(f);d=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var j=b*d,k=f*g;this.w=j*h-k*c;this.x=j*c+k*h;this.y=f*d*h+b*g*c;this.z=b*g*h-f*d*c;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);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},
|
|
|
|
-multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*c+j*g-k*f,o=n*f+k*c-h*g,u=n*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*n+c*-h+o*-k-u*-j;d.y=o*n+c*-j+u*-h-p*-k;d.z=u*n+c*-k+p*-j-o*-h;return d}};
|
|
|
|
-THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
|
-THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
|
-THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
|
-THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
|
-THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
|
|
|
|
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);n.sub(d.position,c.position);k.crossSelf(n)}k.isZero()||
|
|
|
|
-k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
|
|
|
|
-this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
|
|
|
|
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b($,pa,Da,ga,Y,la,Ga){k=$.vertices[pa].position;n=$.vertices[Da].position;p=$.vertices[ga].position;o=j[Y];u=j[la];y=j[Ga];v=n.x-k.x;B=p.x-k.x;C=n.y-k.y;F=p.y-k.y;H=n.z-k.z;U=p.z-k.z;z=u.u-o.u;J=y.u-o.u;L=u.v-o.v;M=y.v-o.v;Fa=1/(z*M-J*L);
|
|
|
|
-e.set((M*v-L*B)*Fa,(M*C-L*F)*Fa,(M*H-L*U)*Fa);da.set((z*B-J*v)*Fa,(z*F-J*C)*Fa,(z*U-J*H)*Fa);xa[pa].addSelf(e);xa[Da].addSelf(e);xa[ga].addSelf(e);Z[pa].addSelf(da);Z[Da].addSelf(da);Z[ga].addSelf(da)}var d,c,f,g,h,j,k,n,p,o,u,y,v,B,C,F,H,U,z,J,L,M,Fa,oa,xa=[],Z=[],e=new THREE.Vector3,da=new THREE.Vector3,Ca=new THREE.Vector3,Aa=new THREE.Vector3,Ha=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){xa[d]=new THREE.Vector3;Z[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];
|
|
|
|
-j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var qa=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Ha.copy(h.vertexNormals[f]);g=h[qa[f]];oa=xa[g];Ca.copy(oa);Ca.subSelf(Ha.multiplyScalar(Ha.dot(oa))).normalize();Aa.cross(h.vertexNormals[f],oa);g=Aa.dot(Z[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(Ca.x,Ca.y,
|
|
|
|
-Ca.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
|
|
|
|
-if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
|
|
|
|
|
|
+THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
|
|
|
|
+undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1){b.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
|
|
|
|
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}b=0;for(var f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,
|
|
|
|
+c,d)}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==undefined?f:1)};
|
|
|
|
+THREE.Quaternion.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=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);var h=Math.cos(d);d=Math.sin(d);var j=b*c,k=f*g;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*g*d;this.z=b*g*h-f*c*d;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);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var c=this.x,d=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=c*b+g*h+d*k-f*j;this.y=d*b+g*j+f*h-c*k;this.z=f*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-f*k;return this},
|
|
|
|
+multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,u=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-u*-j;c.y=o*n+d*-j+u*-h-p*-k;c.z=u*n+d*-k+p*-j-o*-h;return c}};
|
|
|
|
+THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){d.w=0.5*(b.w+c.w);d.x=0.5*(b.x+c.x);d.y=0.5*(b.y+c.y);d.z=0.5*(b.z+c.z);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
|
+THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
|
+THREE.Face4=function(b,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
|
+THREE.UV.prototype={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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
|
|
|
|
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var c,d,f,g,h,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,d.position);n.sub(c.position,d.position);k.crossSelf(n)}k.isZero()||
|
|
|
|
+k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
|
|
|
|
+this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);
|
|
|
|
+d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b($,pa,Da,ga,Y,la,Ga){k=$.vertices[pa].position;n=$.vertices[Da].position;p=$.vertices[ga].position;o=j[Y];u=j[la];y=j[Ga];v=n.x-k.x;B=p.x-k.x;C=n.y-k.y;F=p.y-k.y;H=n.z-k.z;U=p.z-k.z;z=u.u-o.u;J=y.u-o.u;L=u.v-o.v;M=y.v-o.v;Fa=1/(z*M-J*L);
|
|
|
|
+e.set((M*v-L*B)*Fa,(M*C-L*F)*Fa,(M*H-L*U)*Fa);da.set((z*B-J*v)*Fa,(z*F-J*C)*Fa,(z*U-J*H)*Fa);xa[pa].addSelf(e);xa[Da].addSelf(e);xa[ga].addSelf(e);Z[pa].addSelf(da);Z[Da].addSelf(da);Z[ga].addSelf(da)}var c,d,f,g,h,j,k,n,p,o,u,y,v,B,C,F,H,U,z,J,L,M,Fa,oa,xa=[],Z=[],e=new THREE.Vector3,da=new THREE.Vector3,Ca=new THREE.Vector3,Aa=new THREE.Vector3,Ha=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){xa[c]=new THREE.Vector3;Z[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];
|
|
|
|
+j=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var qa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++){Ha.copy(h.vertexNormals[f]);g=h[qa[f]];oa=xa[g];Ca.copy(oa);Ca.subSelf(Ha.multiplyScalar(Ha.dot(oa))).normalize();Aa.cross(h.vertexNormals[f],oa);g=Aa.dot(Z[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(Ca.x,Ca.y,
|
|
|
|
+Ca.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
|
|
|
|
+if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere=
|
|
{radius:b}}};THREE.GeometryIdCounter=0;
|
|
{radius:b}}};THREE.GeometryIdCounter=0;
|
|
-THREE.Spline=function(b){function d(v,B,C,F,H,U,z){v=(C-v)*0.5;F=(F-B)*0.5;return(2*(B-C)+v+F)*z+(-3*(B-C)-2*v-F)*U+v*H+B}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,u,y;this.initFromArray=function(v){this.points=[];for(var B=0;B<v.length;B++)this.points[B]={x:v[B][0],y:v[B][1],z:v[B][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]];
|
|
|
|
-u=this.points[c[2]];y=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,u.x,y.x,j,k,n);f.y=d(p.y,o.y,u.y,y.y,j,k,n);f.z=d(p.z,o.z,u.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,B,C=this.points.length,F=[];for(v=0;v<C;v++){B=this.points[v];F[v]=[B.x,B.y,B.z]}return F};this.getLength=function(v){var B,C,F=B=B=0,H=new THREE.Vector3,U=new THREE.Vector3,z=[],J=0;z[0]=0;v||(v=100);C=this.points.length*v;H.copy(this.points[0]);for(v=1;v<C;v++){B=v/C;position=this.getPoint(B);U.copy(position);
|
|
|
|
|
|
+THREE.Spline=function(b){function c(v,B,C,F,H,U,z){v=(C-v)*0.5;F=(F-B)*0.5;return(2*(B-C)+v+F)*z+(-3*(B-C)-2*v-F)*U+v*H+B}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,u,y;this.initFromArray=function(v){this.points=[];for(var B=0;B<v.length;B++)this.points[B]={x:v[B][0],y:v[B][1],z:v[B][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]];
|
|
|
|
+u=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,u.x,y.x,j,k,n);f.y=c(p.y,o.y,u.y,y.y,j,k,n);f.z=c(p.z,o.z,u.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,B,C=this.points.length,F=[];for(v=0;v<C;v++){B=this.points[v];F[v]=[B.x,B.y,B.z]}return F};this.getLength=function(v){var B,C,F=B=B=0,H=new THREE.Vector3,U=new THREE.Vector3,z=[],J=0;z[0]=0;v||(v=100);C=this.points.length*v;H.copy(this.points[0]);for(v=1;v<C;v++){B=v/C;position=this.getPoint(B);U.copy(position);
|
|
J+=U.distanceTo(H);H.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=F){z[B]=J;F=B}}z[z.length]=J;return{chunks:z,total:J}};this.reparametrizeByArcLength=function(v){var B,C,F,H,U,z,J=[],L=new THREE.Vector3,M=this.getLength();J.push(L.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){C=M.chunks[B]-M.chunks[B-1];z=Math.ceil(v*C/M.total);H=(B-1)/(this.points.length-1);U=B/(this.points.length-1);for(C=1;C<z-1;C++){F=H+C*(1/z)*(U-H);position=this.getPoint(F);J.push(L.copy(position).clone())}J.push(L.copy(this.points[B]).clone())}this.points=
|
|
J+=U.distanceTo(H);H.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=F){z[B]=J;F=B}}z[z.length]=J;return{chunks:z,total:J}};this.reparametrizeByArcLength=function(v){var B,C,F,H,U,z,J=[],L=new THREE.Vector3,M=this.getLength();J.push(L.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){C=M.chunks[B]-M.chunks[B-1];z=Math.ceil(v*C/M.total);H=(B-1)/(this.points.length-1);U=B/(this.points.length-1);for(C=1;C<z-1;C++){F=H+C*(1/z)*(U-H);position=this.getPoint(F);J.push(L.copy(position).clone())}J.push(L.copy(this.points[B]).clone())}this.points=
|
|
J}};
|
|
J}};
|
|
-THREE.AnimationHandler=function(){var b=[],d={},c={};c.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};c.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};c.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};c.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<0)g.hierarchy[h].keys[j].time=
|
|
|
|
|
|
+THREE.AnimationHandler=function(){var b=[],c={},d={};d.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};d.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};d.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};d.add=function(g){c[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");c[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<0)g.hierarchy[h].keys[j].time=
|
|
0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var p=g.hierarchy[h].keys[j].morphTargets[n];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
|
|
0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var p=g.hierarchy[h].keys[j].morphTargets[n];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
|
|
{};for(p in k){for(n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++)if(g.hierarchy[h].keys[j].morphTargets[n]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
|
|
{};for(p in k){for(n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++)if(g.hierarchy[h].keys[j].morphTargets[n]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
|
|
-g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(h=0;h<g.hierarchy.length;h++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};c.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};c.parse=function(g){var h=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)h.push(g.bones[j]);else f(g,h);return h};var f=function(g,h){h.push(g);for(var j=0;j<g.children.length;j++)f(g.children[j],h)};c.LINEAR=
|
|
|
|
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(b,d,c,f){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
|
-THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var c,f=this.hierarchy.length,g;for(c=0;c<f;c++){g=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
|
|
|
|
-g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
|
|
|
+g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(h=0;h<g.hierarchy.length;h++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};d.get=function(g){if(typeof g==="string")if(c[g])return c[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};d.parse=function(g){var h=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)h.push(g.bones[j]);else f(g,h);return h};var f=function(g,h){h.push(g);for(var j=0;j<g.children.length;j++)f(g.children[j],h)};d.LINEAR=
|
|
|
|
+0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(b,c,d,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
|
+THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=c!==undefined?c:0;var d,f=this.hierarchy.length,g;for(d=0;d<f;d++){g=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
|
|
|
|
+g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];g.pos=this.getNextKeyWith("pos",d,1);g.rot=this.getNextKeyWith("rot",d,1);g.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
|
|
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,n,p,o=this.data.JIT.hierarchy,u,y;this.currentTime+=b*this.timeScale;y=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,B=this.hierarchy.length;v<B;v++){b=this.hierarchy[v];n=b.animationCache;if(this.JITCompile&&o[v][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
|
|
|
|
-!1}else{b.matrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var C=0;C<3;C++){c=d[C];j=n.prevKey[c];k=n.nextKey[c];if(k.time<=y){if(u<y)if(this.loop){j=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(c,v,1);k.time<u;){j=k;k=this.getNextKeyWith(c,v,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,v,k.index+1)}while(k.time<
|
|
|
|
-u)}n.prevKey[c]=j;n.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
|
-this.getPrevKeyWith("pos",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
|
|
|
|
-"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var c=[],f=[],g,h,j,k,n,p;g=(b.length-1)*d;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>b.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];n=b[c[2]];p=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,c,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,c,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,c,j);return f};
|
|
|
|
-THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[0]};
|
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]};
|
|
|
|
-THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
-THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
|
|
-THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
|
-!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
|
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,c){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,c){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
|
|
|
|
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,d,c,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,d,c,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
-THREE.LensFlare.prototype.add=function(b,d,c,f){d===undefined&&(d=-1);c===undefined&&(c=0);if(f===undefined)f=THREE.BillboardBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:b,size:d,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
|
|
|
|
-THREE.LensFlare.prototype.updateLensFlares=function(b){var d,c=this.lensFlares.length,f,g=-this.positionScreen.x*2,h=-this.positionScreen.y*2;for(d=0;d<c;d++){f=this.lensFlares[d];f.x=this.positionScreen.x+g*f.distance;f.y=this.positionScreen.y+h*f.distance;f.wantedScale=b*0.2+0.8;f.wantedRotation=f.x*Math.PI*0.25;f.wantedOpacity=b;f.scale+=(f.wantedScale-f.scale)*0.25;f.rotation+=(f.wantedRotation-f.rotation)*0.25;f.opacity+=(f.wantedOpacity-f.opacity)*0.5}};
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,f,g,h,j,k,n,p,o=this.data.JIT.hierarchy,u,y;this.currentTime+=b*this.timeScale;y=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,B=this.hierarchy.length;v<B;v++){b=this.hierarchy[v];n=b.animationCache;if(this.JITCompile&&o[v][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
|
|
|
|
+!1}else{b.matrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var C=0;C<3;C++){d=c[C];j=n.prevKey[d];k=n.nextKey[d];if(k.time<=y){if(u<y)if(this.loop){j=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(d,v,1);k.time<u;){j=k;k=this.getNextKeyWith(d,v,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(d,v,k.index+1)}while(k.time<
|
|
|
|
+u)}n.prevKey[d]=j;n.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(k.time-j.time);g=j[d];h=k[d];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);f=f<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
|
+this.getPrevKeyWith("pos",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);d.x=g[0];d.y=g[1];d.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(d===
|
|
|
|
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],f=[],g,h,j,k,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];n=b[d[2]];p=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,d,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,d,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,d,j);return f};
|
|
|
|
+THREE.Animation.prototype.interpolate=function(b,c,d,f,g,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<f.length-1?d:f.length-1;else d%=f.length;for(;d<f.length;d++)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[0]};
|
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+f.length;d>=0;d--)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[f.length-1]};
|
|
|
|
+THREE.Camera=function(b,c,d,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
|
|
+THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
|
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
|
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};THREE.PointLight.prototype=new THREE.Light;
|
|
|
|
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,c,d,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.LensFlare.prototype.add=function(b,c,d,f){c===undefined&&(c=-1);d===undefined&&(d=0);if(f===undefined)f=THREE.BillboardBlending;d=Math.min(d,Math.max(0,d));this.lensFlares.push({texture:b,size:c,distance:d,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
|
|
|
|
+THREE.LensFlare.prototype.updateLensFlares=function(b){var c,d=this.lensFlares.length,f,g=-this.positionScreen.x*2,h=-this.positionScreen.y*2;for(c=0;c<d;c++){f=this.lensFlares[c];f.x=this.positionScreen.x+g*f.distance;f.y=this.positionScreen.y+h*f.distance;f.wantedScale=b*0.2+0.8;f.wantedRotation=f.x*Math.PI*0.25;f.wantedOpacity=b;f.scale+=(f.wantedScale-f.scale)*0.25;f.rotation+=(f.wantedRotation-f.rotation)*0.25;f.opacity+=(f.wantedOpacity-f.opacity)*0.5}};
|
|
THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==undefined?b.opacity:1;this.transparent=b.transparent!==undefined?b.transparent:!1;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==undefined?b.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
|
|
THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==undefined?b.opacity:1;this.transparent=b.transparent!==undefined?b.transparent:!1;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==undefined?b.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
|
|
THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==undefined?b.linewidth:1;this.linecap=b.linecap!==undefined?b.linecap:"round";this.linejoin=b.linejoin!==undefined?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
|
|
THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==undefined?b.linewidth:1;this.linecap=b.linecap!==undefined?b.linecap:"round";this.linejoin=b.linejoin!==undefined?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
|
|
@@ -112,70 +112,70 @@ THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{
|
|
undefined?b.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
|
|
undefined?b.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
|
|
THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.size=b.size!==undefined?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==undefined?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.size=b.size!==undefined?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==undefined?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==undefined?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
|
|
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==undefined?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
|
|
-THREE.Texture=function(b,d,c,f,g,h){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
|
|
|
|
+THREE.Texture=function(b,c,d,f,g,h){this.image=b;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
|
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
|
-THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;var Uniforms={clone:function(b){var d,c,f,g={};for(d in b){g[d]={};for(c in b[d]){f=b[d][c];g[d][c]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return g},merge:function(b){var d,c,f,g={};for(d=0;d<b.length;d++){f=this.clone(b[d]);for(c in f)g[c]=f[c]}return g}};
|
|
|
|
-THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
|
|
-THREE.Line=function(b,d,c){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
|
-THREE.Mesh=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d&&d.length?d:[d];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=b.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
|
|
|
|
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==undefined)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
|
|
|
|
|
|
+THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;var Uniforms={clone:function(b){var c,d,f,g={};for(c in b){g[c]={};for(d in b[c]){f=b[c][d];g[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return g},merge:function(b){var c,d,f,g={};for(c=0;c<b.length;c++){f=this.clone(b[c]);for(d in f)g[d]=f[d]}return g}};
|
|
|
|
+THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
|
|
+THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
|
+THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=b.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
|
|
|
|
+this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==undefined)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
|
|
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
-THREE.Bone.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++){b=this.children[f];b instanceof THREE.Bone?b.update(this.skinMatrix,d,c):b.update(this.matrixWorld,!0,c)}}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
|
|
|
|
-d,c)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);if(!(b instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
|
-THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,f,g,h,j,k;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){g=this.geometry.bones[c];h=g.pos;j=g.rotq;k=g.scl;f=this.addBone();f.name=g.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;k!==undefined?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){g=this.geometry.bones[c];
|
|
|
|
-f=this.bones[c];g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
|
-THREE.SkinnedMesh.prototype.update=function(b,d,c){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var f,g=this.children.length;for(f=0;f<g;f++){b=this.children[f];b instanceof THREE.Bone?b.update(this.identityMatrix,!1,c):b.update(this.matrixWorld,d,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<c;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
|
|
|
|
-d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===undefined&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var b,d=[],c=0;c<this.bones.length;c++){b=this.bones[c];d.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){c=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;
|
|
|
|
-f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(d[g].multiplyVector3(f));f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(d[h].multiplyVector3(f));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){c=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=c;this.geometry.skinWeights[b].y+=c}}}};
|
|
|
|
-THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
|
|
-THREE.Sound=function(b,d,c,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=d!==undefined?Math.abs(d):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=b instanceof Array?b:[b];var g;c=this.sources.length;for(b=0;b<c;b++){d=this.sources[b];d.toLowerCase();if(d.indexOf(".mp3")!==-1)g=
|
|
|
|
-"audio/mpeg";else if(d.indexOf(".ogg")!==-1)g="audio/ogg";else d.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
|
|
+THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++){b=this.children[f];b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
|
|
|
|
+c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);if(!(b instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
|
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,f,g,h,j,k;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];h=g.pos;j=g.rotq;k=g.scl;f=this.addBone();f.name=g.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;k!==undefined?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];
|
|
|
|
+f=this.bones[d];g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
|
+THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var f,g=this.children.length;for(f=0;f<g;f++){b=this.children[f];b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
|
+c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===undefined&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var b,c=[],d=0;d<this.bones.length;d++){b=this.bones[d];c.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){d=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;
|
|
|
|
+f=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=d;this.geometry.skinWeights[b].y+=d}}}};
|
|
|
|
+THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
|
|
+THREE.Sound=function(b,c,d,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=b instanceof Array?b:[b];var g;d=this.sources.length;for(b=0;b<d;b++){c=this.sources[b];c.toLowerCase();if(c.indexOf(".mp3")!==-1)g=
|
|
|
|
+"audio/mpeg";else if(c.indexOf(".ogg")!==-1)g="audio/ogg";else c.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);b.isLoaded=!0;b.duration=this.duration;b.isPlaying&&b.play()}};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=!0;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(b)this.domElement.currentTime=b%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
|
|
THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);b.isLoaded=!0;b.duration=this.duration;b.isPlaying&&b.play()}};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=!0;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(b)this.domElement.currentTime=b%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
|
|
THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(b){b=b.length();this.domElement.volume=b<=this.radius?this.volume*(1-b/this.radius):0};
|
|
THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(b){b=b.length();this.domElement.volume=b<=this.radius?this.volume*(1-b/this.radius):0};
|
|
-THREE.Sound.prototype.update=function(b,d,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);d=!0}if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var f=this.children.length;for(b=0;b<f;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
|
|
-THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,d){d===undefined&&(d=0);d=Math.abs(d);for(var c=0;c<this.LODs.length;c++)if(d<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:d,object3D:b});this.addChild(b)};
|
|
|
|
-THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
|
|
|
|
-!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
|
|
|
|
|
|
+THREE.Sound.prototype.update=function(b,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var f=this.children.length;for(b=0;b<f;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
|
|
+THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===undefined&&(c=0);c=Math.abs(c);for(var d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
|
|
|
|
+THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
|
|
|
|
+!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(b,c){THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
|
|
THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){k=d.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);for(k=
|
|
|
|
-0;k<p;k++){o=b[j[u[k]]];d.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
|
|
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,n,p,o,u,y,v,B,C,F=0,H=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=d[H[B]];k=b[h];for(C=0;C<g;C++){j=c[H[C]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){F++;if(F===1){p=k;o=n;u=h;y=j;v=H[B]}if(F===2){v+=H[B];return v==="ad"||v==="ac"?{faces:[d,c],vertices:[p,o,n,k],indices:[u,
|
|
|
|
-y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[p,k,n,o],indices:[u,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
-THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
|
|
-THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
|
|
-THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
|
|
|
|
-THREE.Projector=function(){function b(){var e=n[k]=n[k]||new THREE.RenderableVertex;k++;return e}function d(e,da){return da.z-e.z}function c(e,da){var Ca=0,Aa=1,Ha=e.z+e.w,qa=da.z+da.w,$=-e.z+e.w,pa=-da.z+da.w;if(Ha>=0&&qa>=0&&$>=0&&pa>=0)return!0;else if(Ha<0&&qa<0||$<0&&pa<0)return!1;else{if(Ha<0)Ca=Math.max(Ca,Ha/(Ha-qa));else qa<0&&(Aa=Math.min(Aa,Ha/(Ha-qa)));if($<0)Ca=Math.max(Ca,$/($-pa));else pa<0&&(Aa=Math.min(Aa,$/($-pa)));if(Aa<Ca)return!1;else{e.lerpSelf(da,Ca);da.lerpSelf(e,1-Aa);return!0}}}
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){k=c.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);d.push(k);for(k=
|
|
|
|
+0;k<p;k++){o=b[j[u[k]]];c.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=d[h];for(j=h+1;j<g.length;j++){k=d[j];k=this.facesShareEdge(c,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
|
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,n,p,o,u,y,v,B,C,F=0,H=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=c[H[B]];k=b[h];for(C=0;C<g;C++){j=d[H[C]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){F++;if(F===1){p=k;o=n;u=h;y=j;v=H[B]}if(F===2){v+=H[B];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[p,o,n,k],indices:[u,
|
|
|
|
+y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[p,k,n,o],indices:[u,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
|
|
|
|
+THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else if(b instanceof THREE.Sound){c=this.sounds.indexOf(b);c!==-1&&this.sounds.splice(c,1)}else if(!(b instanceof THREE.Camera)){c=this.objects.indexOf(b);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(b)}}for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
|
|
|
|
+THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==undefined?c:2.5E-4};
|
|
|
|
+THREE.Projector=function(){function b(){var e=n[k]=n[k]||new THREE.RenderableVertex;k++;return e}function c(e,da){return da.z-e.z}function d(e,da){var Ca=0,Aa=1,Ha=e.z+e.w,qa=da.z+da.w,$=-e.z+e.w,pa=-da.z+da.w;if(Ha>=0&&qa>=0&&$>=0&&pa>=0)return!0;else if(Ha<0&&qa<0||$<0&&pa<0)return!1;else{if(Ha<0)Ca=Math.max(Ca,Ha/(Ha-qa));else qa<0&&(Aa=Math.min(Aa,Ha/(Ha-qa)));if($<0)Ca=Math.max(Ca,$/($-pa));else pa<0&&(Aa=Math.min(Aa,$/($-pa)));if(Aa<Ca)return!1;else{e.lerpSelf(da,Ca);da.lerpSelf(e,1-Aa);return!0}}}
|
|
var f,g,h=[],j,k,n=[],p,o,u=[],y,v=[],B,C,F=[],H,U,z=[],J=new THREE.Vector4,L=new THREE.Vector4,M=new THREE.Matrix4,Fa=new THREE.Matrix4,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(e,da){M.multiply(da.projectionMatrix,da.matrixWorldInverse);M.multiplyVector3(e);return e};this.unprojectVector=function(e,da){M.multiply(da.matrixWorld,THREE.Matrix4.makeInvert(da.projectionMatrix));
|
|
var f,g,h=[],j,k,n=[],p,o,u=[],y,v=[],B,C,F=[],H,U,z=[],J=new THREE.Vector4,L=new THREE.Vector4,M=new THREE.Matrix4,Fa=new THREE.Matrix4,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Vector4,Z=new THREE.Vector4;this.projectVector=function(e,da){M.multiply(da.projectionMatrix,da.matrixWorldInverse);M.multiplyVector3(e);return e};this.unprojectVector=function(e,da){M.multiply(da.matrixWorld,THREE.Matrix4.makeInvert(da.projectionMatrix));
|
|
M.multiplyVector3(e);return e};this.projectObjects=function(e,da,Ca){da=[];var Aa,Ha,qa;g=0;Ha=e.objects;e=0;for(Aa=Ha.length;e<Aa;e++){qa=Ha[e];var $;if(!($=!qa.visible))if($=qa instanceof THREE.Mesh){a:{$=void 0;for(var pa=qa.matrixWorld,Da=-qa.geometry.boundingSphere.radius*Math.max(qa.scale.x,Math.max(qa.scale.y,qa.scale.z)),ga=0;ga<6;ga++){$=oa[ga].x*pa.n14+oa[ga].y*pa.n24+oa[ga].z*pa.n34+oa[ga].w;if($<=Da){$=!1;break a}}$=!0}$=!$}if(!$){$=h[g]=h[g]||new THREE.RenderableObject;g++;f=$;J.copy(qa.position);
|
|
M.multiplyVector3(e);return e};this.projectObjects=function(e,da,Ca){da=[];var Aa,Ha,qa;g=0;Ha=e.objects;e=0;for(Aa=Ha.length;e<Aa;e++){qa=Ha[e];var $;if(!($=!qa.visible))if($=qa instanceof THREE.Mesh){a:{$=void 0;for(var pa=qa.matrixWorld,Da=-qa.geometry.boundingSphere.radius*Math.max(qa.scale.x,Math.max(qa.scale.y,qa.scale.z)),ga=0;ga<6;ga++){$=oa[ga].x*pa.n14+oa[ga].y*pa.n24+oa[ga].z*pa.n34+oa[ga].w;if($<=Da){$=!1;break a}}$=!0}$=!$}if(!$){$=h[g]=h[g]||new THREE.RenderableObject;g++;f=$;J.copy(qa.position);
|
|
-M.multiplyVector3(J);f.object=qa;f.z=J.z;da.push(f)}}Ca&&da.sort(d);return da};this.projectScene=function(e,da,Ca){var Aa=[],Ha=da.near,qa=da.far,$,pa,Da,ga,Y,la,Ga,ka,na,wa,Ua,cb,ab,Pa,N,X,ma;U=C=y=o=0;da.matrixAutoUpdate&&da.updateMatrix();e.update(undefined,!1,da);M.multiply(da.projectionMatrix,da.matrixWorldInverse);oa[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);oa[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);oa[2].set(M.n41+M.n21,M.n42+M.n22,M.n43+M.n23,M.n44+M.n24);oa[3].set(M.n41-
|
|
|
|
|
|
+M.multiplyVector3(J);f.object=qa;f.z=J.z;da.push(f)}}Ca&&da.sort(c);return da};this.projectScene=function(e,da,Ca){var Aa=[],Ha=da.near,qa=da.far,$,pa,Da,ga,Y,la,Ga,ka,na,wa,Ua,cb,ab,Pa,N,X,ma;U=C=y=o=0;da.matrixAutoUpdate&&da.updateMatrix();e.update(undefined,!1,da);M.multiply(da.projectionMatrix,da.matrixWorldInverse);oa[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);oa[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);oa[2].set(M.n41+M.n21,M.n42+M.n22,M.n43+M.n23,M.n44+M.n24);oa[3].set(M.n41-
|
|
M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);oa[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);oa[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for($=0;$<6;$++){na=oa[$];na.divideScalar(Math.sqrt(na.x*na.x+na.y*na.y+na.z*na.z))}na=this.projectObjects(e,da,!0);e=0;for($=na.length;e<$;e++){wa=na[e].object;if(wa.visible){Ua=wa.matrixWorld;cb=wa.matrixRotationWorld;ab=wa.materials;Pa=wa.overdraw;k=0;if(wa instanceof THREE.Mesh){N=wa.geometry;ga=N.vertices;X=N.faces;N=N.faceVertexUvs;
|
|
M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);oa[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);oa[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for($=0;$<6;$++){na=oa[$];na.divideScalar(Math.sqrt(na.x*na.x+na.y*na.y+na.z*na.z))}na=this.projectObjects(e,da,!0);e=0;for($=na.length;e<$;e++){wa=na[e].object;if(wa.visible){Ua=wa.matrixWorld;cb=wa.matrixRotationWorld;ab=wa.materials;Pa=wa.overdraw;k=0;if(wa instanceof THREE.Mesh){N=wa.geometry;ga=N.vertices;X=N.faces;N=N.faceVertexUvs;
|
|
pa=0;for(Da=ga.length;pa<Da;pa++){j=b();j.positionWorld.copy(ga[pa].position);Ua.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ha&&j.positionScreen.z<qa}ga=0;for(pa=X.length;ga<pa;ga++){Da=X[ga];if(Da instanceof THREE.Face3){Y=n[Da.a];la=n[Da.b];Ga=n[Da.c];if(Y.visible&&la.visible&&Ga.visible&&(wa.doubleSided||wa.flipSided!=(Ga.positionScreen.x-
|
|
pa=0;for(Da=ga.length;pa<Da;pa++){j=b();j.positionWorld.copy(ga[pa].position);Ua.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ha&&j.positionScreen.z<qa}ga=0;for(pa=X.length;ga<pa;ga++){Da=X[ga];if(Da instanceof THREE.Face3){Y=n[Da.a];la=n[Da.b];Ga=n[Da.c];if(Y.visible&&la.visible&&Ga.visible&&(wa.doubleSided||wa.flipSided!=(Ga.positionScreen.x-
|
|
Y.positionScreen.x)*(la.positionScreen.y-Y.positionScreen.y)-(Ga.positionScreen.y-Y.positionScreen.y)*(la.positionScreen.x-Y.positionScreen.x)<0)){ka=u[o]=u[o]||new THREE.RenderableFace3;o++;p=ka;p.v1.copy(Y);p.v2.copy(la);p.v3.copy(Ga)}else continue}else if(Da instanceof THREE.Face4){Y=n[Da.a];la=n[Da.b];Ga=n[Da.c];ka=n[Da.d];if(Y.visible&&la.visible&&Ga.visible&&ka.visible&&(wa.doubleSided||wa.flipSided!=((ka.positionScreen.x-Y.positionScreen.x)*(la.positionScreen.y-Y.positionScreen.y)-(ka.positionScreen.y-
|
|
Y.positionScreen.x)*(la.positionScreen.y-Y.positionScreen.y)-(Ga.positionScreen.y-Y.positionScreen.y)*(la.positionScreen.x-Y.positionScreen.x)<0)){ka=u[o]=u[o]||new THREE.RenderableFace3;o++;p=ka;p.v1.copy(Y);p.v2.copy(la);p.v3.copy(Ga)}else continue}else if(Da instanceof THREE.Face4){Y=n[Da.a];la=n[Da.b];Ga=n[Da.c];ka=n[Da.d];if(Y.visible&&la.visible&&Ga.visible&&ka.visible&&(wa.doubleSided||wa.flipSided!=((ka.positionScreen.x-Y.positionScreen.x)*(la.positionScreen.y-Y.positionScreen.y)-(ka.positionScreen.y-
|
|
Y.positionScreen.y)*(la.positionScreen.x-Y.positionScreen.x)<0||(la.positionScreen.x-Ga.positionScreen.x)*(ka.positionScreen.y-Ga.positionScreen.y)-(la.positionScreen.y-Ga.positionScreen.y)*(ka.positionScreen.x-Ga.positionScreen.x)<0))){ma=v[y]=v[y]||new THREE.RenderableFace4;y++;p=ma;p.v1.copy(Y);p.v2.copy(la);p.v3.copy(Ga);p.v4.copy(ka)}else continue}p.normalWorld.copy(Da.normal);cb.multiplyVector3(p.normalWorld);p.centroidWorld.copy(Da.centroid);Ua.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);
|
|
Y.positionScreen.y)*(la.positionScreen.x-Y.positionScreen.x)<0||(la.positionScreen.x-Ga.positionScreen.x)*(ka.positionScreen.y-Ga.positionScreen.y)-(la.positionScreen.y-Ga.positionScreen.y)*(ka.positionScreen.x-Ga.positionScreen.x)<0))){ma=v[y]=v[y]||new THREE.RenderableFace4;y++;p=ma;p.v1.copy(Y);p.v2.copy(la);p.v3.copy(Ga);p.v4.copy(ka)}else continue}p.normalWorld.copy(Da.normal);cb.multiplyVector3(p.normalWorld);p.centroidWorld.copy(Da.centroid);Ua.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);
|
|
M.multiplyVector3(p.centroidScreen);Ga=Da.vertexNormals;Y=0;for(la=Ga.length;Y<la;Y++){ka=p.vertexNormalsWorld[Y];ka.copy(Ga[Y]);cb.multiplyVector3(ka)}Y=0;for(la=N.length;Y<la;Y++)if(ma=N[Y][ga]){Ga=0;for(ka=ma.length;Ga<ka;Ga++)p.uvs[Y][Ga]=ma[Ga]}p.meshMaterials=ab;p.faceMaterials=Da.materials;p.overdraw=Pa;p.z=p.centroidScreen.z;Aa.push(p)}}else if(wa instanceof THREE.Line){Fa.multiply(M,Ua);ga=wa.geometry.vertices;Y=b();Y.positionScreen.copy(ga[0].position);Fa.multiplyVector4(Y.positionScreen);
|
|
M.multiplyVector3(p.centroidScreen);Ga=Da.vertexNormals;Y=0;for(la=Ga.length;Y<la;Y++){ka=p.vertexNormalsWorld[Y];ka.copy(Ga[Y]);cb.multiplyVector3(ka)}Y=0;for(la=N.length;Y<la;Y++)if(ma=N[Y][ga]){Ga=0;for(ka=ma.length;Ga<ka;Ga++)p.uvs[Y][Ga]=ma[Ga]}p.meshMaterials=ab;p.faceMaterials=Da.materials;p.overdraw=Pa;p.z=p.centroidScreen.z;Aa.push(p)}}else if(wa instanceof THREE.Line){Fa.multiply(M,Ua);ga=wa.geometry.vertices;Y=b();Y.positionScreen.copy(ga[0].position);Fa.multiplyVector4(Y.positionScreen);
|
|
-pa=1;for(Da=ga.length;pa<Da;pa++){Y=b();Y.positionScreen.copy(ga[pa].position);Fa.multiplyVector4(Y.positionScreen);la=n[k-2];xa.copy(Y.positionScreen);Z.copy(la.positionScreen);if(c(xa,Z)){xa.multiplyScalar(1/xa.w);Z.multiplyScalar(1/Z.w);Ua=F[C]=F[C]||new THREE.RenderableLine;C++;B=Ua;B.v1.positionScreen.copy(xa);B.v2.positionScreen.copy(Z);B.z=Math.max(xa.z,Z.z);B.materials=wa.materials;Aa.push(B)}}}else if(wa instanceof THREE.Particle){L.set(wa.position.x,wa.position.y,wa.position.z,1);M.multiplyVector4(L);
|
|
|
|
-L.z/=L.w;if(L.z>0&&L.z<1){Ua=z[U]=z[U]||new THREE.RenderableParticle;U++;H=Ua;H.x=L.x/L.w;H.y=L.y/L.w;H.z=L.z;H.rotation=wa.rotation.z;H.scale.x=wa.scale.x*Math.abs(H.x-(L.x+da.projectionMatrix.n11)/(L.w+da.projectionMatrix.n14));H.scale.y=wa.scale.y*Math.abs(H.y-(L.y+da.projectionMatrix.n22)/(L.w+da.projectionMatrix.n24));H.materials=wa.materials;Aa.push(H)}}}}Ca&&Aa.sort(d);return Aa}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var n,p,o,u,y,v,B,C;b=d.projectScene(j,k);n=0;for(p=b.length;n<p;n++){y=b[n];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;C=y.y*h+h;o=0;for(u=y.material.length;o<u;o++){v=y.material[o];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=B+"px";v.style.top=C+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){function b(ra){if(v!=ra)o.globalAlpha=v=ra}function d(ra){if(B!=ra){switch(ra){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=ra}}function c(ra){if(C!=ra)o.strokeStyle=C=ra}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),u=new THREE.Color(0),y=0,v=1,B=0,
|
|
|
|
|
|
+pa=1;for(Da=ga.length;pa<Da;pa++){Y=b();Y.positionScreen.copy(ga[pa].position);Fa.multiplyVector4(Y.positionScreen);la=n[k-2];xa.copy(Y.positionScreen);Z.copy(la.positionScreen);if(d(xa,Z)){xa.multiplyScalar(1/xa.w);Z.multiplyScalar(1/Z.w);Ua=F[C]=F[C]||new THREE.RenderableLine;C++;B=Ua;B.v1.positionScreen.copy(xa);B.v2.positionScreen.copy(Z);B.z=Math.max(xa.z,Z.z);B.materials=wa.materials;Aa.push(B)}}}else if(wa instanceof THREE.Particle){L.set(wa.position.x,wa.position.y,wa.position.z,1);M.multiplyVector4(L);
|
|
|
|
+L.z/=L.w;if(L.z>0&&L.z<1){Ua=z[U]=z[U]||new THREE.RenderableParticle;U++;H=Ua;H.x=L.x/L.w;H.y=L.y/L.w;H.z=L.z;H.rotation=wa.rotation.z;H.scale.x=wa.scale.x*Math.abs(H.x-(L.x+da.projectionMatrix.n11)/(L.w+da.projectionMatrix.n14));H.scale.y=wa.scale.y*Math.abs(H.y-(L.y+da.projectionMatrix.n22)/(L.w+da.projectionMatrix.n24));H.materials=wa.materials;Aa.push(H)}}}}Ca&&Aa.sort(c);return Aa}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,p,o,u,y,v,B,C;b=c.projectScene(j,k);n=0;for(p=b.length;n<p;n++){y=b[n];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;C=y.y*h+h;o=0;for(u=y.material.length;o<u;o++){v=y.material[o];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=B+"px";v.style.top=C+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){function b(ra){if(v!=ra)o.globalAlpha=v=ra}function c(ra){if(B!=ra){switch(ra){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=ra}}function d(ra){if(C!=ra)o.strokeStyle=C=ra}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),u=new THREE.Color(0),y=0,v=1,B=0,
|
|
C=null,F=null,H=null,U=null,z=null,J,L,M,Fa,oa=new THREE.RenderableVertex,xa=new THREE.RenderableVertex,Z,e,da,Ca,Aa,Ha,qa,$,pa,Da,ga,Y,la=new THREE.Color,Ga=new THREE.Color,ka=new THREE.Color,na=new THREE.Color,wa=new THREE.Color,Ua,cb,ab,Pa,N,X,ma,Ea,Ka,ya,ia=new THREE.Rectangle,m=new THREE.Rectangle,A=new THREE.Rectangle,x=!1,t=new THREE.Color,w=new THREE.Color,S=new THREE.Color,E=new THREE.Color,G=new THREE.Vector3,O,D,I,Q,sa,W,Ba=16;O=document.createElement("canvas");O.width=O.height=2;D=O.getContext("2d");
|
|
C=null,F=null,H=null,U=null,z=null,J,L,M,Fa,oa=new THREE.RenderableVertex,xa=new THREE.RenderableVertex,Z,e,da,Ca,Aa,Ha,qa,$,pa,Da,ga,Y,la=new THREE.Color,Ga=new THREE.Color,ka=new THREE.Color,na=new THREE.Color,wa=new THREE.Color,Ua,cb,ab,Pa,N,X,ma,Ea,Ka,ya,ia=new THREE.Rectangle,m=new THREE.Rectangle,A=new THREE.Rectangle,x=!1,t=new THREE.Color,w=new THREE.Color,S=new THREE.Color,E=new THREE.Color,G=new THREE.Vector3,O,D,I,Q,sa,W,Ba=16;O=document.createElement("canvas");O.width=O.height=2;D=O.getContext("2d");
|
|
D.fillStyle="rgba(0,0,0,1)";D.fillRect(0,0,2,2);I=D.getImageData(0,0,2,2);Q=I.data;sa=document.createElement("canvas");sa.width=sa.height=Ba;W=sa.getContext("2d");W.translate(-Ba/2,-Ba/2);W.scale(Ba,Ba);Ba--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ra,za){j=ra;k=za;n=j/2;p=k/2;h.width=j;h.height=k;ia.set(-n,-p,n,p);v=1;B=0;z=U=H=F=C=null};this.setClearColor=function(ra,za){u=ra;y=za};this.setClearColorHex=function(ra,za){u.setHex(ra);y=za};
|
|
D.fillStyle="rgba(0,0,0,1)";D.fillRect(0,0,2,2);I=D.getImageData(0,0,2,2);Q=I.data;sa=document.createElement("canvas");sa.width=sa.height=Ba;W=sa.getContext("2d");W.translate(-Ba/2,-Ba/2);W.scale(Ba,Ba);Ba--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ra,za){j=ra;k=za;n=j/2;p=k/2;h.width=j;h.height=k;ia.set(-n,-p,n,p);v=1;B=0;z=U=H=F=C=null};this.setClearColor=function(ra,za){u=ra;y=za};this.setClearColorHex=function(ra,za){u.setHex(ra);y=za};
|
|
-this.clear=function(){o.setTransform(1,0,0,-1,n,p);if(!m.isEmpty()){m.inflate(1);m.minSelf(ia);if(u.hex==0&&y==0)o.clearRect(m.getX(),m.getY(),m.getWidth(),m.getHeight());else{d(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+y+")";o.fillRect(m.getX(),m.getY(),m.getWidth(),m.getHeight())}m.empty()}};this.render=function(ra,za){function Ia(T){var ta,fa,aa,va=T.lights;w.setRGB(0,0,0);S.setRGB(0,0,0);E.setRGB(0,0,0);T=0;for(ta=va.length;T<
|
|
|
|
|
|
+this.clear=function(){o.setTransform(1,0,0,-1,n,p);if(!m.isEmpty()){m.inflate(1);m.minSelf(ia);if(u.hex==0&&y==0)o.clearRect(m.getX(),m.getY(),m.getWidth(),m.getHeight());else{c(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+y+")";o.fillRect(m.getX(),m.getY(),m.getWidth(),m.getHeight())}m.empty()}};this.render=function(ra,za){function Ia(T){var ta,fa,aa,va=T.lights;w.setRGB(0,0,0);S.setRGB(0,0,0);E.setRGB(0,0,0);T=0;for(ta=va.length;T<
|
|
ta;T++){fa=va[T];aa=fa.color;if(fa instanceof THREE.AmbientLight){w.r+=aa.r;w.g+=aa.g;w.b+=aa.b}else if(fa instanceof THREE.DirectionalLight){S.r+=aa.r;S.g+=aa.g;S.b+=aa.b}else if(fa instanceof THREE.PointLight){E.r+=aa.r;E.g+=aa.g;E.b+=aa.b}}}function Sa(T,ta,fa,aa){var va,ua,ha,K,Qa=T.lights;T=0;for(va=Qa.length;T<va;T++){ua=Qa[T];ha=ua.color;if(ua instanceof THREE.DirectionalLight){K=fa.dot(ua.position);if(!(K<=0)){K*=ua.intensity;aa.r+=ha.r*K;aa.g+=ha.g*K;aa.b+=ha.b*K}}else if(ua instanceof THREE.PointLight){K=
|
|
ta;T++){fa=va[T];aa=fa.color;if(fa instanceof THREE.AmbientLight){w.r+=aa.r;w.g+=aa.g;w.b+=aa.b}else if(fa instanceof THREE.DirectionalLight){S.r+=aa.r;S.g+=aa.g;S.b+=aa.b}else if(fa instanceof THREE.PointLight){E.r+=aa.r;E.g+=aa.g;E.b+=aa.b}}}function Sa(T,ta,fa,aa){var va,ua,ha,K,Qa=T.lights;T=0;for(va=Qa.length;T<va;T++){ua=Qa[T];ha=ua.color;if(ua instanceof THREE.DirectionalLight){K=fa.dot(ua.position);if(!(K<=0)){K*=ua.intensity;aa.r+=ha.r*K;aa.g+=ha.g*K;aa.b+=ha.b*K}}else if(ua instanceof THREE.PointLight){K=
|
|
-fa.dot(G.sub(ua.position,ta).normalize());if(!(K<=0)){K*=ua.distance==0?1:1-Math.min(ta.distanceTo(ua.position)/ua.distance,1);if(K!=0){K*=ua.intensity;aa.r+=ha.r*K;aa.g+=ha.g*K;aa.b+=ha.b*K}}}}}function ea(T,ta,fa){b(fa.opacity);d(fa.blending);var aa,va,ua,ha,K,Qa;if(fa instanceof THREE.ParticleBasicMaterial){if(fa.map){ha=fa.map.image;K=ha.width>>1;Qa=ha.height>>1;fa=ta.scale.x*n;ua=ta.scale.y*p;aa=fa*K;va=ua*Qa;A.set(T.x-aa,T.y-va,T.x+aa,T.y+va);if(ia.instersects(A)){o.save();o.translate(T.x,T.y);
|
|
|
|
-o.rotate(-ta.rotation);o.scale(fa,-ua);o.translate(-K,-Qa);o.drawImage(ha,0,0);o.restore()}}}else if(fa instanceof THREE.ParticleCanvasMaterial){aa=ta.scale.x*n;va=ta.scale.y*p;A.set(T.x-aa,T.y-va,T.x+aa,T.y+va);if(ia.instersects(A)){c(fa.color.__styleString);ua=fa.color.__styleString;if(F!=ua)o.fillStyle=F=ua;o.save();o.translate(T.x,T.y);o.rotate(-ta.rotation);o.scale(aa,va);fa.program(o);o.restore()}}}function ca(T,ta,fa,aa){b(aa.opacity);d(aa.blending);o.beginPath();o.moveTo(T.positionScreen.x,
|
|
|
|
-T.positionScreen.y);o.lineTo(ta.positionScreen.x,ta.positionScreen.y);o.closePath();if(aa instanceof THREE.LineBasicMaterial){la.__styleString=aa.color.__styleString;T=aa.linewidth;if(H!=T)o.lineWidth=H=T;T=aa.linecap;if(U!=T)o.lineCap=U=T;T=aa.linejoin;if(z!=T)o.lineJoin=z=T;c(la.__styleString);o.stroke();A.inflate(aa.linewidth*2)}}function ja(T,ta,fa,aa,va,ua,ha,K,Qa){b(K.opacity);d(K.blending);Z=T.positionScreen.x;e=T.positionScreen.y;da=ta.positionScreen.x;Ca=ta.positionScreen.y;Aa=fa.positionScreen.x;
|
|
|
|
|
|
+fa.dot(G.sub(ua.position,ta).normalize());if(!(K<=0)){K*=ua.distance==0?1:1-Math.min(ta.distanceTo(ua.position)/ua.distance,1);if(K!=0){K*=ua.intensity;aa.r+=ha.r*K;aa.g+=ha.g*K;aa.b+=ha.b*K}}}}}function ea(T,ta,fa){b(fa.opacity);c(fa.blending);var aa,va,ua,ha,K,Qa;if(fa instanceof THREE.ParticleBasicMaterial){if(fa.map){ha=fa.map.image;K=ha.width>>1;Qa=ha.height>>1;fa=ta.scale.x*n;ua=ta.scale.y*p;aa=fa*K;va=ua*Qa;A.set(T.x-aa,T.y-va,T.x+aa,T.y+va);if(ia.instersects(A)){o.save();o.translate(T.x,T.y);
|
|
|
|
+o.rotate(-ta.rotation);o.scale(fa,-ua);o.translate(-K,-Qa);o.drawImage(ha,0,0);o.restore()}}}else if(fa instanceof THREE.ParticleCanvasMaterial){aa=ta.scale.x*n;va=ta.scale.y*p;A.set(T.x-aa,T.y-va,T.x+aa,T.y+va);if(ia.instersects(A)){d(fa.color.__styleString);ua=fa.color.__styleString;if(F!=ua)o.fillStyle=F=ua;o.save();o.translate(T.x,T.y);o.rotate(-ta.rotation);o.scale(aa,va);fa.program(o);o.restore()}}}function ca(T,ta,fa,aa){b(aa.opacity);c(aa.blending);o.beginPath();o.moveTo(T.positionScreen.x,
|
|
|
|
+T.positionScreen.y);o.lineTo(ta.positionScreen.x,ta.positionScreen.y);o.closePath();if(aa instanceof THREE.LineBasicMaterial){la.__styleString=aa.color.__styleString;T=aa.linewidth;if(H!=T)o.lineWidth=H=T;T=aa.linecap;if(U!=T)o.lineCap=U=T;T=aa.linejoin;if(z!=T)o.lineJoin=z=T;d(la.__styleString);o.stroke();A.inflate(aa.linewidth*2)}}function ja(T,ta,fa,aa,va,ua,ha,K,Qa){b(K.opacity);c(K.blending);Z=T.positionScreen.x;e=T.positionScreen.y;da=ta.positionScreen.x;Ca=ta.positionScreen.y;Aa=fa.positionScreen.x;
|
|
Ha=fa.positionScreen.y;V(Z,e,da,Ca,Aa,Ha);if(K instanceof THREE.MeshBasicMaterial)if(K.map){if(K.map.mapping instanceof THREE.UVMapping){Pa=ha.uvs[0];Na(Z,e,da,Ca,Aa,Ha,K.map.image,Pa[aa].u,Pa[aa].v,Pa[va].u,Pa[va].v,Pa[ua].u,Pa[ua].v)}}else if(K.envMap){if(K.envMap.mapping instanceof THREE.SphericalReflectionMapping){T=za.matrixWorldInverse;G.copy(ha.vertexNormalsWorld[0]);N=(G.x*T.n11+G.y*T.n12+G.z*T.n13)*0.5+0.5;X=-(G.x*T.n21+G.y*T.n22+G.z*T.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[1]);ma=(G.x*
|
|
Ha=fa.positionScreen.y;V(Z,e,da,Ca,Aa,Ha);if(K instanceof THREE.MeshBasicMaterial)if(K.map){if(K.map.mapping instanceof THREE.UVMapping){Pa=ha.uvs[0];Na(Z,e,da,Ca,Aa,Ha,K.map.image,Pa[aa].u,Pa[aa].v,Pa[va].u,Pa[va].v,Pa[ua].u,Pa[ua].v)}}else if(K.envMap){if(K.envMap.mapping instanceof THREE.SphericalReflectionMapping){T=za.matrixWorldInverse;G.copy(ha.vertexNormalsWorld[0]);N=(G.x*T.n11+G.y*T.n12+G.z*T.n13)*0.5+0.5;X=-(G.x*T.n21+G.y*T.n22+G.z*T.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[1]);ma=(G.x*
|
|
T.n11+G.y*T.n12+G.z*T.n13)*0.5+0.5;Ea=-(G.x*T.n21+G.y*T.n22+G.z*T.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[2]);Ka=(G.x*T.n11+G.y*T.n12+G.z*T.n13)*0.5+0.5;ya=-(G.x*T.n21+G.y*T.n22+G.z*T.n23)*0.5+0.5;Na(Z,e,da,Ca,Aa,Ha,K.envMap.image,N,X,ma,Ea,Ka,ya)}}else K.wireframe?Oa(K.color.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString);else if(K instanceof THREE.MeshLambertMaterial){if(K.map&&!K.wireframe){if(K.map.mapping instanceof THREE.UVMapping){Pa=ha.uvs[0];
|
|
T.n11+G.y*T.n12+G.z*T.n13)*0.5+0.5;Ea=-(G.x*T.n21+G.y*T.n22+G.z*T.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[2]);Ka=(G.x*T.n11+G.y*T.n12+G.z*T.n13)*0.5+0.5;ya=-(G.x*T.n21+G.y*T.n22+G.z*T.n23)*0.5+0.5;Na(Z,e,da,Ca,Aa,Ha,K.envMap.image,N,X,ma,Ea,Ka,ya)}}else K.wireframe?Oa(K.color.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString);else if(K instanceof THREE.MeshLambertMaterial){if(K.map&&!K.wireframe){if(K.map.mapping instanceof THREE.UVMapping){Pa=ha.uvs[0];
|
|
-Na(Z,e,da,Ca,Aa,Ha,K.map.image,Pa[aa].u,Pa[aa].v,Pa[va].u,Pa[va].v,Pa[ua].u,Pa[ua].v)}d(THREE.SubtractiveBlending)}if(x)if(!K.wireframe&&K.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=ka.r=na.r=w.r;Ga.g=ka.g=na.g=w.g;Ga.b=ka.b=na.b=w.b;Sa(Qa,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Sa(Qa,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Sa(Qa,ha.v3.positionWorld,ha.vertexNormalsWorld[2],na);wa.r=(ka.r+na.r)*0.5;wa.g=(ka.g+na.g)*0.5;wa.b=(ka.b+na.b)*0.5;ab=Xa(Ga,ka,na,
|
|
|
|
|
|
+Na(Z,e,da,Ca,Aa,Ha,K.map.image,Pa[aa].u,Pa[aa].v,Pa[va].u,Pa[va].v,Pa[ua].u,Pa[ua].v)}c(THREE.SubtractiveBlending)}if(x)if(!K.wireframe&&K.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=ka.r=na.r=w.r;Ga.g=ka.g=na.g=w.g;Ga.b=ka.b=na.b=w.b;Sa(Qa,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Sa(Qa,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Sa(Qa,ha.v3.positionWorld,ha.vertexNormalsWorld[2],na);wa.r=(ka.r+na.r)*0.5;wa.g=(ka.g+na.g)*0.5;wa.b=(ka.b+na.b)*0.5;ab=Xa(Ga,ka,na,
|
|
wa);Na(Z,e,da,Ca,Aa,Ha,ab,0,0,1,0,0,1)}else{t.r=w.r;t.g=w.g;t.b=w.b;Sa(Qa,ha.centroidWorld,ha.normalWorld,t);la.r=K.color.r*t.r;la.g=K.color.g*t.g;la.b=K.color.b*t.b;la.updateStyleString();K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}else K.wireframe?Oa(K.color.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString)}else if(K instanceof THREE.MeshDepthMaterial){Ua=za.near;cb=za.far;Ga.r=
|
|
wa);Na(Z,e,da,Ca,Aa,Ha,ab,0,0,1,0,0,1)}else{t.r=w.r;t.g=w.g;t.b=w.b;Sa(Qa,ha.centroidWorld,ha.normalWorld,t);la.r=K.color.r*t.r;la.g=K.color.g*t.g;la.b=K.color.b*t.b;la.updateStyleString();K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}else K.wireframe?Oa(K.color.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString)}else if(K instanceof THREE.MeshDepthMaterial){Ua=za.near;cb=za.far;Ga.r=
|
|
Ga.g=Ga.b=1-gb(T.positionScreen.z,Ua,cb);ka.r=ka.g=ka.b=1-gb(ta.positionScreen.z,Ua,cb);na.r=na.g=na.b=1-gb(fa.positionScreen.z,Ua,cb);wa.r=(ka.r+na.r)*0.5;wa.g=(ka.g+na.g)*0.5;wa.b=(ka.b+na.b)*0.5;ab=Xa(Ga,ka,na,wa);Na(Z,e,da,Ca,Aa,Ha,ab,0,0,1,0,0,1)}else if(K instanceof THREE.MeshNormalMaterial){la.r=hb(ha.normalWorld.x);la.g=hb(ha.normalWorld.y);la.b=hb(ha.normalWorld.z);la.updateStyleString();K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}}
|
|
Ga.g=Ga.b=1-gb(T.positionScreen.z,Ua,cb);ka.r=ka.g=ka.b=1-gb(ta.positionScreen.z,Ua,cb);na.r=na.g=na.b=1-gb(fa.positionScreen.z,Ua,cb);wa.r=(ka.r+na.r)*0.5;wa.g=(ka.g+na.g)*0.5;wa.b=(ka.b+na.b)*0.5;ab=Xa(Ga,ka,na,wa);Na(Z,e,da,Ca,Aa,Ha,ab,0,0,1,0,0,1)}else if(K instanceof THREE.MeshNormalMaterial){la.r=hb(ha.normalWorld.x);la.g=hb(ha.normalWorld.y);la.b=hb(ha.normalWorld.z);la.updateStyleString();K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}}
|
|
-function La(T,ta,fa,aa,va,ua,ha,K,Qa){b(K.opacity);d(K.blending);if(K.map||K.envMap){ja(T,ta,aa,0,1,3,ha,K,Qa);ja(va,fa,ua,1,2,3,ha,K,Qa)}else{Z=T.positionScreen.x;e=T.positionScreen.y;da=ta.positionScreen.x;Ca=ta.positionScreen.y;Aa=fa.positionScreen.x;Ha=fa.positionScreen.y;qa=aa.positionScreen.x;$=aa.positionScreen.y;pa=va.positionScreen.x;Da=va.positionScreen.y;ga=ua.positionScreen.x;Y=ua.positionScreen.y;if(K instanceof THREE.MeshBasicMaterial){P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(K.color.__styleString,
|
|
|
|
|
|
+function La(T,ta,fa,aa,va,ua,ha,K,Qa){b(K.opacity);c(K.blending);if(K.map||K.envMap){ja(T,ta,aa,0,1,3,ha,K,Qa);ja(va,fa,ua,1,2,3,ha,K,Qa)}else{Z=T.positionScreen.x;e=T.positionScreen.y;da=ta.positionScreen.x;Ca=ta.positionScreen.y;Aa=fa.positionScreen.x;Ha=fa.positionScreen.y;qa=aa.positionScreen.x;$=aa.positionScreen.y;pa=va.positionScreen.x;Da=va.positionScreen.y;ga=ua.positionScreen.x;Y=ua.positionScreen.y;if(K instanceof THREE.MeshBasicMaterial){P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(K.color.__styleString,
|
|
K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString)}else if(K instanceof THREE.MeshLambertMaterial)if(x)if(!K.wireframe&&K.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=ka.r=na.r=wa.r=w.r;Ga.g=ka.g=na.g=wa.g=w.g;Ga.b=ka.b=na.b=wa.b=w.b;Sa(Qa,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Sa(Qa,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Sa(Qa,ha.v4.positionWorld,ha.vertexNormalsWorld[3],na);Sa(Qa,ha.v3.positionWorld,ha.vertexNormalsWorld[2],
|
|
K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString)}else if(K instanceof THREE.MeshLambertMaterial)if(x)if(!K.wireframe&&K.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=ka.r=na.r=wa.r=w.r;Ga.g=ka.g=na.g=wa.g=w.g;Ga.b=ka.b=na.b=wa.b=w.b;Sa(Qa,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Sa(Qa,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Sa(Qa,ha.v4.positionWorld,ha.vertexNormalsWorld[3],na);Sa(Qa,ha.v3.positionWorld,ha.vertexNormalsWorld[2],
|
|
wa);ab=Xa(Ga,ka,na,wa);V(Z,e,da,Ca,qa,$);Na(Z,e,da,Ca,qa,$,ab,0,0,1,0,0,1);V(pa,Da,Aa,Ha,ga,Y);Na(pa,Da,Aa,Ha,ga,Y,ab,1,0,1,1,0,1)}else{t.r=w.r;t.g=w.g;t.b=w.b;Sa(Qa,ha.centroidWorld,ha.normalWorld,t);la.r=K.color.r*t.r;la.g=K.color.g*t.g;la.b=K.color.b*t.b;la.updateStyleString();P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}else{P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(K.color.__styleString,K.wireframeLinewidth,
|
|
wa);ab=Xa(Ga,ka,na,wa);V(Z,e,da,Ca,qa,$);Na(Z,e,da,Ca,qa,$,ab,0,0,1,0,0,1);V(pa,Da,Aa,Ha,ga,Y);Na(pa,Da,Aa,Ha,ga,Y,ab,1,0,1,1,0,1)}else{t.r=w.r;t.g=w.g;t.b=w.b;Sa(Qa,ha.centroidWorld,ha.normalWorld,t);la.r=K.color.r*t.r;la.g=K.color.g*t.g;la.b=K.color.b*t.b;la.updateStyleString();P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}else{P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(K.color.__styleString,K.wireframeLinewidth,
|
|
K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString)}else if(K instanceof THREE.MeshNormalMaterial){la.r=hb(ha.normalWorld.x);la.g=hb(ha.normalWorld.y);la.b=hb(ha.normalWorld.z);la.updateStyleString();P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}else if(K instanceof THREE.MeshDepthMaterial){Ua=za.near;cb=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ua,cb);ka.r=ka.g=ka.b=1-gb(ta.positionScreen.z,
|
|
K.wireframeLinecap,K.wireframeLinejoin):fb(K.color.__styleString)}else if(K instanceof THREE.MeshNormalMaterial){la.r=hb(ha.normalWorld.x);la.g=hb(ha.normalWorld.y);la.b=hb(ha.normalWorld.z);la.updateStyleString();P(Z,e,da,Ca,Aa,Ha,qa,$);K.wireframe?Oa(la.__styleString,K.wireframeLinewidth,K.wireframeLinecap,K.wireframeLinejoin):fb(la.__styleString)}else if(K instanceof THREE.MeshDepthMaterial){Ua=za.near;cb=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ua,cb);ka.r=ka.g=ka.b=1-gb(ta.positionScreen.z,
|
|
Ua,cb);na.r=na.g=na.b=1-gb(aa.positionScreen.z,Ua,cb);wa.r=wa.g=wa.b=1-gb(fa.positionScreen.z,Ua,cb);ab=Xa(Ga,ka,na,wa);V(Z,e,da,Ca,qa,$);Na(Z,e,da,Ca,qa,$,ab,0,0,1,0,0,1);V(pa,Da,Aa,Ha,ga,Y);Na(pa,Da,Aa,Ha,ga,Y,ab,1,0,1,1,0,1)}}}function V(T,ta,fa,aa,va,ua){o.beginPath();o.moveTo(T,ta);o.lineTo(fa,aa);o.lineTo(va,ua);o.lineTo(T,ta);o.closePath()}function P(T,ta,fa,aa,va,ua,ha,K){o.beginPath();o.moveTo(T,ta);o.lineTo(fa,aa);o.lineTo(va,ua);o.lineTo(ha,K);o.lineTo(T,ta);o.closePath()}function Oa(T,
|
|
Ua,cb);na.r=na.g=na.b=1-gb(aa.positionScreen.z,Ua,cb);wa.r=wa.g=wa.b=1-gb(fa.positionScreen.z,Ua,cb);ab=Xa(Ga,ka,na,wa);V(Z,e,da,Ca,qa,$);Na(Z,e,da,Ca,qa,$,ab,0,0,1,0,0,1);V(pa,Da,Aa,Ha,ga,Y);Na(pa,Da,Aa,Ha,ga,Y,ab,1,0,1,1,0,1)}}}function V(T,ta,fa,aa,va,ua){o.beginPath();o.moveTo(T,ta);o.lineTo(fa,aa);o.lineTo(va,ua);o.lineTo(T,ta);o.closePath()}function P(T,ta,fa,aa,va,ua,ha,K){o.beginPath();o.moveTo(T,ta);o.lineTo(fa,aa);o.lineTo(va,ua);o.lineTo(ha,K);o.lineTo(T,ta);o.closePath()}function Oa(T,
|
|
-ta,fa,aa){if(H!=ta)o.lineWidth=H=ta;if(U!=fa)o.lineCap=U=fa;if(z!=aa)o.lineJoin=z=aa;c(T);o.stroke();A.inflate(ta*2)}function fb(T){if(F!=T)o.fillStyle=F=T;o.fill()}function Na(T,ta,fa,aa,va,ua,ha,K,Qa,db,Wa,bb,lb){var Ta,ib;Ta=ha.width-1;ib=ha.height-1;K*=Ta;Qa*=ib;db*=Ta;Wa*=ib;bb*=Ta;lb*=ib;fa-=T;aa-=ta;va-=T;ua-=ta;db-=K;Wa-=Qa;bb-=K;lb-=Qa;Ta=db*lb-bb*Wa;if(Ta!=0){ib=1/Ta;Ta=(lb*fa-Wa*va)*ib;Wa=(lb*aa-Wa*ua)*ib;fa=(db*va-bb*fa)*ib;aa=(db*ua-bb*aa)*ib;T=T-Ta*K-fa*Qa;ta=ta-Wa*K-aa*Qa;o.save();
|
|
|
|
|
|
+ta,fa,aa){if(H!=ta)o.lineWidth=H=ta;if(U!=fa)o.lineCap=U=fa;if(z!=aa)o.lineJoin=z=aa;d(T);o.stroke();A.inflate(ta*2)}function fb(T){if(F!=T)o.fillStyle=F=T;o.fill()}function Na(T,ta,fa,aa,va,ua,ha,K,Qa,db,Wa,bb,lb){var Ta,ib;Ta=ha.width-1;ib=ha.height-1;K*=Ta;Qa*=ib;db*=Ta;Wa*=ib;bb*=Ta;lb*=ib;fa-=T;aa-=ta;va-=T;ua-=ta;db-=K;Wa-=Qa;bb-=K;lb-=Qa;Ta=db*lb-bb*Wa;if(Ta!=0){ib=1/Ta;Ta=(lb*fa-Wa*va)*ib;Wa=(lb*aa-Wa*ua)*ib;fa=(db*va-bb*fa)*ib;aa=(db*ua-bb*aa)*ib;T=T-Ta*K-fa*Qa;ta=ta-Wa*K-aa*Qa;o.save();
|
|
o.transform(Ta,Wa,fa,aa,T,ta);o.clip();o.drawImage(ha,0,0);o.restore()}}function Xa(T,ta,fa,aa){var va=~~(T.r*255),ua=~~(T.g*255);T=~~(T.b*255);var ha=~~(ta.r*255),K=~~(ta.g*255);ta=~~(ta.b*255);var Qa=~~(fa.r*255),db=~~(fa.g*255);fa=~~(fa.b*255);var Wa=~~(aa.r*255),bb=~~(aa.g*255);aa=~~(aa.b*255);Q[0]=va<0?0:va>255?255:va;Q[1]=ua<0?0:ua>255?255:ua;Q[2]=T<0?0:T>255?255:T;Q[4]=ha<0?0:ha>255?255:ha;Q[5]=K<0?0:K>255?255:K;Q[6]=ta<0?0:ta>255?255:ta;Q[8]=Qa<0?0:Qa>255?255:Qa;Q[9]=db<0?0:db>255?255:db;
|
|
o.transform(Ta,Wa,fa,aa,T,ta);o.clip();o.drawImage(ha,0,0);o.restore()}}function Xa(T,ta,fa,aa){var va=~~(T.r*255),ua=~~(T.g*255);T=~~(T.b*255);var ha=~~(ta.r*255),K=~~(ta.g*255);ta=~~(ta.b*255);var Qa=~~(fa.r*255),db=~~(fa.g*255);fa=~~(fa.b*255);var Wa=~~(aa.r*255),bb=~~(aa.g*255);aa=~~(aa.b*255);Q[0]=va<0?0:va>255?255:va;Q[1]=ua<0?0:ua>255?255:ua;Q[2]=T<0?0:T>255?255:T;Q[4]=ha<0?0:ha>255?255:ha;Q[5]=K<0?0:K>255?255:K;Q[6]=ta<0?0:ta>255?255:ta;Q[8]=Qa<0?0:Qa>255?255:Qa;Q[9]=db<0?0:db>255?255:db;
|
|
Q[10]=fa<0?0:fa>255?255:fa;Q[12]=Wa<0?0:Wa>255?255:Wa;Q[13]=bb<0?0:bb>255?255:bb;Q[14]=aa<0?0:aa>255?255:aa;D.putImageData(I,0,0);W.drawImage(O,0,0);return sa}function gb(T,ta,fa){T=(T-ta)/(fa-ta);return T*T*(3-2*T)}function hb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function Ya(T,ta){var fa=ta.x-T.x,aa=ta.y-T.y,va=1/Math.sqrt(fa*fa+aa*aa);fa*=va;aa*=va;ta.x+=fa;ta.y+=aa;T.x-=fa;T.y-=aa}var eb,Ra,Ja,Ma,R,Va,Za,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ra,za,this.sortElements);
|
|
Q[10]=fa<0?0:fa>255?255:fa;Q[12]=Wa<0?0:Wa>255?255:Wa;Q[13]=bb<0?0:bb>255?255:bb;Q[14]=aa<0?0:aa>255?255:aa;D.putImageData(I,0,0);W.drawImage(O,0,0);return sa}function gb(T,ta,fa){T=(T-ta)/(fa-ta);return T*T*(3-2*T)}function hb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function Ya(T,ta){var fa=ta.x-T.x,aa=ta.y-T.y,va=1/Math.sqrt(fa*fa+aa*aa);fa*=va;aa*=va;ta.x+=fa;ta.y+=aa;T.x-=fa;T.y-=aa}var eb,Ra,Ja,Ma,R,Va,Za,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ra,za,this.sortElements);
|
|
(x=ra.lights.length>0)&&Ia(ra);eb=0;for(Ra=f.length;eb<Ra;eb++){Ja=f[eb];A.empty();if(Ja instanceof THREE.RenderableParticle){J=Ja;J.x*=n;J.y*=p;Ma=0;for(R=Ja.materials.length;Ma<R;){$a=Ja.materials[Ma++];$a.opacity!=0&&ea(J,Ja,$a,ra)}}else if(Ja instanceof THREE.RenderableLine){J=Ja.v1;L=Ja.v2;J.positionScreen.x*=n;J.positionScreen.y*=p;L.positionScreen.x*=n;L.positionScreen.y*=p;A.addPoint(J.positionScreen.x,J.positionScreen.y);A.addPoint(L.positionScreen.x,L.positionScreen.y);if(ia.instersects(A)){Ma=
|
|
(x=ra.lights.length>0)&&Ia(ra);eb=0;for(Ra=f.length;eb<Ra;eb++){Ja=f[eb];A.empty();if(Ja instanceof THREE.RenderableParticle){J=Ja;J.x*=n;J.y*=p;Ma=0;for(R=Ja.materials.length;Ma<R;){$a=Ja.materials[Ma++];$a.opacity!=0&&ea(J,Ja,$a,ra)}}else if(Ja instanceof THREE.RenderableLine){J=Ja.v1;L=Ja.v2;J.positionScreen.x*=n;J.positionScreen.y*=p;L.positionScreen.x*=n;L.positionScreen.y*=p;A.addPoint(J.positionScreen.x,J.positionScreen.y);A.addPoint(L.positionScreen.x,L.positionScreen.y);if(ia.instersects(A)){Ma=
|
|
@@ -183,10 +183,10 @@ Q[10]=fa<0?0:fa>255?255:fa;Q[12]=Wa<0?0:Wa>255?255:Wa;Q[13]=bb<0?0:bb>255?255:bb
|
|
M.positionScreen.x,M.positionScreen.y);if(ia.instersects(A)){Ma=0;for(R=Ja.meshMaterials.length;Ma<R;){$a=Ja.meshMaterials[Ma++];if($a instanceof THREE.MeshFaceMaterial){Va=0;for(Za=Ja.faceMaterials.length;Va<Za;)($a=Ja.faceMaterials[Va++])&&$a.opacity!=0&&ja(J,L,M,0,1,2,Ja,$a,ra)}else $a.opacity!=0&&ja(J,L,M,0,1,2,Ja,$a,ra)}}}else if(Ja instanceof THREE.RenderableFace4){J=Ja.v1;L=Ja.v2;M=Ja.v3;Fa=Ja.v4;J.positionScreen.x*=n;J.positionScreen.y*=p;L.positionScreen.x*=n;L.positionScreen.y*=p;M.positionScreen.x*=
|
|
M.positionScreen.x,M.positionScreen.y);if(ia.instersects(A)){Ma=0;for(R=Ja.meshMaterials.length;Ma<R;){$a=Ja.meshMaterials[Ma++];if($a instanceof THREE.MeshFaceMaterial){Va=0;for(Za=Ja.faceMaterials.length;Va<Za;)($a=Ja.faceMaterials[Va++])&&$a.opacity!=0&&ja(J,L,M,0,1,2,Ja,$a,ra)}else $a.opacity!=0&&ja(J,L,M,0,1,2,Ja,$a,ra)}}}else if(Ja instanceof THREE.RenderableFace4){J=Ja.v1;L=Ja.v2;M=Ja.v3;Fa=Ja.v4;J.positionScreen.x*=n;J.positionScreen.y*=p;L.positionScreen.x*=n;L.positionScreen.y*=p;M.positionScreen.x*=
|
|
n;M.positionScreen.y*=p;Fa.positionScreen.x*=n;Fa.positionScreen.y*=p;oa.positionScreen.copy(L.positionScreen);xa.positionScreen.copy(Fa.positionScreen);if(Ja.overdraw){Ya(J.positionScreen,L.positionScreen);Ya(L.positionScreen,Fa.positionScreen);Ya(Fa.positionScreen,J.positionScreen);Ya(M.positionScreen,oa.positionScreen);Ya(M.positionScreen,xa.positionScreen)}A.addPoint(J.positionScreen.x,J.positionScreen.y);A.addPoint(L.positionScreen.x,L.positionScreen.y);A.addPoint(M.positionScreen.x,M.positionScreen.y);
|
|
n;M.positionScreen.y*=p;Fa.positionScreen.x*=n;Fa.positionScreen.y*=p;oa.positionScreen.copy(L.positionScreen);xa.positionScreen.copy(Fa.positionScreen);if(Ja.overdraw){Ya(J.positionScreen,L.positionScreen);Ya(L.positionScreen,Fa.positionScreen);Ya(Fa.positionScreen,J.positionScreen);Ya(M.positionScreen,oa.positionScreen);Ya(M.positionScreen,xa.positionScreen)}A.addPoint(J.positionScreen.x,J.positionScreen.y);A.addPoint(L.positionScreen.x,L.positionScreen.y);A.addPoint(M.positionScreen.x,M.positionScreen.y);
|
|
A.addPoint(Fa.positionScreen.x,Fa.positionScreen.y);if(ia.instersects(A)){Ma=0;for(R=Ja.meshMaterials.length;Ma<R;){$a=Ja.meshMaterials[Ma++];if($a instanceof THREE.MeshFaceMaterial){Va=0;for(Za=Ja.faceMaterials.length;Va<Za;)($a=Ja.faceMaterials[Va++])&&$a.opacity!=0&&La(J,L,M,Fa,oa,xa,Ja,$a,ra)}else $a.opacity!=0&&La(J,L,M,Fa,oa,xa,Ja,$a,ra)}}}m.addRectangle(A)}o.setTransform(1,0,0,1,0,0)}};
|
|
A.addPoint(Fa.positionScreen.x,Fa.positionScreen.y);if(ia.instersects(A)){Ma=0;for(R=Ja.meshMaterials.length;Ma<R;){$a=Ja.meshMaterials[Ma++];if($a instanceof THREE.MeshFaceMaterial){Va=0;for(Za=Ja.faceMaterials.length;Va<Za;)($a=Ja.faceMaterials[Va++])&&$a.opacity!=0&&La(J,L,M,Fa,oa,xa,Ja,$a,ra)}else $a.opacity!=0&&La(J,L,M,Fa,oa,xa,Ja,$a,ra)}}}m.addRectangle(A)}o.setTransform(1,0,0,1,0,0)}};
|
|
-THREE.SVGRenderer=function(){function b(qa,$,pa){var Da,ga,Y,la;Da=0;for(ga=qa.lights.length;Da<ga;Da++){Y=qa.lights[Da];if(Y instanceof THREE.DirectionalLight){la=$.normalWorld.dot(Y.position)*Y.intensity;if(la>0){pa.r+=Y.color.r*la;pa.g+=Y.color.g*la;pa.b+=Y.color.b*la}}else if(Y instanceof THREE.PointLight){xa.sub(Y.position,$.centroidWorld);xa.normalize();la=$.normalWorld.dot(xa)*Y.intensity;if(la>0){pa.r+=Y.color.r*la;pa.g+=Y.color.g*la;pa.b+=Y.color.b*la}}}}function d(qa,$,pa,Da,ga,Y){da=f(Ca++);
|
|
|
|
|
|
+THREE.SVGRenderer=function(){function b(qa,$,pa){var Da,ga,Y,la;Da=0;for(ga=qa.lights.length;Da<ga;Da++){Y=qa.lights[Da];if(Y instanceof THREE.DirectionalLight){la=$.normalWorld.dot(Y.position)*Y.intensity;if(la>0){pa.r+=Y.color.r*la;pa.g+=Y.color.g*la;pa.b+=Y.color.b*la}}else if(Y instanceof THREE.PointLight){xa.sub(Y.position,$.centroidWorld);xa.normalize();la=$.normalWorld.dot(xa)*Y.intensity;if(la>0){pa.r+=Y.color.r*la;pa.g+=Y.color.g*la;pa.b+=Y.color.b*la}}}}function c(qa,$,pa,Da,ga,Y){da=f(Ca++);
|
|
da.setAttribute("d","M "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ga instanceof THREE.MeshBasicMaterial)z.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshLambertMaterial)if(U){J.r=L.r;J.g=L.g;J.b=L.b;b(Y,Da,J);z.r=ga.color.r*J.r;z.g=ga.color.g*J.g;z.b=ga.color.b*J.b;z.updateStyleString()}else z.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshDepthMaterial){oa=
|
|
da.setAttribute("d","M "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ga instanceof THREE.MeshBasicMaterial)z.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshLambertMaterial)if(U){J.r=L.r;J.g=L.g;J.b=L.b;b(Y,Da,J);z.r=ga.color.r*J.r;z.g=ga.color.g*J.g;z.b=ga.color.b*J.b;z.updateStyleString()}else z.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshDepthMaterial){oa=
|
|
1-ga.__2near/(ga.__farPlusNear-Da.z*ga.__farMinusNear);z.setRGB(oa,oa,oa)}else ga instanceof THREE.MeshNormalMaterial&&z.setRGB(g(Da.normalWorld.x),g(Da.normalWorld.y),g(Da.normalWorld.z));ga.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ga.wireframeLinewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.wireframeLinecap+"; stroke-linejoin: "+ga.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ga.opacity);
|
|
1-ga.__2near/(ga.__farPlusNear-Da.z*ga.__farMinusNear);z.setRGB(oa,oa,oa)}else ga instanceof THREE.MeshNormalMaterial&&z.setRGB(g(Da.normalWorld.x),g(Da.normalWorld.y),g(Da.normalWorld.z));ga.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ga.wireframeLinewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.wireframeLinecap+"; stroke-linejoin: "+ga.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ga.opacity);
|
|
-k.appendChild(da)}function c(qa,$,pa,Da,ga,Y,la){da=f(Ca++);da.setAttribute("d","M "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+Da.positionScreen.x+","+Da.positionScreen.y+"z");if(Y instanceof THREE.MeshBasicMaterial)z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshLambertMaterial)if(U){J.r=L.r;J.g=L.g;J.b=L.b;b(la,ga,J);z.r=Y.color.r*J.r;z.g=Y.color.g*J.g;z.b=Y.color.b*J.b;
|
|
|
|
|
|
+k.appendChild(da)}function d(qa,$,pa,Da,ga,Y,la){da=f(Ca++);da.setAttribute("d","M "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+Da.positionScreen.x+","+Da.positionScreen.y+"z");if(Y instanceof THREE.MeshBasicMaterial)z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshLambertMaterial)if(U){J.r=L.r;J.g=L.g;J.b=L.b;b(la,ga,J);z.r=Y.color.r*J.r;z.g=Y.color.g*J.g;z.b=Y.color.b*J.b;
|
|
z.updateStyleString()}else z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshDepthMaterial){oa=1-Y.__2near/(Y.__farPlusNear-ga.z*Y.__farMinusNear);z.setRGB(oa,oa,oa)}else Y instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ga.normalWorld.x),g(ga.normalWorld.y),g(ga.normalWorld.z));Y.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Y.wireframeLinewidth+"; stroke-opacity: "+Y.opacity+"; stroke-linecap: "+Y.wireframeLinecap+"; stroke-linejoin: "+
|
|
z.updateStyleString()}else z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshDepthMaterial){oa=1-Y.__2near/(Y.__farPlusNear-ga.z*Y.__farMinusNear);z.setRGB(oa,oa,oa)}else Y instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ga.normalWorld.x),g(ga.normalWorld.y),g(ga.normalWorld.z));Y.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Y.wireframeLinewidth+"; stroke-opacity: "+Y.opacity+"; stroke-linecap: "+Y.wireframeLinecap+"; stroke-linejoin: "+
|
|
Y.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Y.opacity);k.appendChild(da)}function f(qa){if(Z[qa]==null){Z[qa]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&Z[qa].setAttribute("shape-rendering","crispEdges")}return Z[qa]}function g(qa){return qa<0?Math.min((1+qa)*0.5,0.5):0.5+Math.min(qa*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,u,y,v,B,C,F=new THREE.Rectangle,H=
|
|
Y.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Y.opacity);k.appendChild(da)}function f(qa){if(Z[qa]==null){Z[qa]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&Z[qa].setAttribute("shape-rendering","crispEdges")}return Z[qa]}function g(qa){return qa<0?Math.min((1+qa)*0.5,0.5):0.5+Math.min(qa*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,u,y,v,B,C,F=new THREE.Rectangle,H=
|
|
new THREE.Rectangle,U=!1,z=new THREE.Color(16777215),J=new THREE.Color(16777215),L=new THREE.Color(0),M=new THREE.Color(0),Fa=new THREE.Color(0),oa,xa=new THREE.Vector3,Z=[],e=[],da,Ca,Aa,Ha=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(qa){switch(qa){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(qa,$){n=qa;p=$;o=n/2;u=p/2;k.setAttribute("viewBox",-o+" "+-u+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height",p);
|
|
new THREE.Rectangle,U=!1,z=new THREE.Color(16777215),J=new THREE.Color(16777215),L=new THREE.Color(0),M=new THREE.Color(0),Fa=new THREE.Color(0),oa,xa=new THREE.Vector3,Z=[],e=[],da,Ca,Aa,Ha=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(qa){switch(qa){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(qa,$){n=qa;p=$;o=n/2;u=p/2;k.setAttribute("viewBox",-o+" "+-u+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height",p);
|
|
@@ -194,9 +194,9 @@ F.set(-o,-u,o,u)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChil
|
|
M.b+=Y.b}else if(ga instanceof THREE.PointLight){Fa.r+=Y.r;Fa.g+=Y.g;Fa.b+=Y.b}}}pa=0;for(Da=h.length;pa<Da;pa++){ka=h[pa];H.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=o;y.y*=-u;ga=0;for(Y=ka.materials.length;ga<Y;)ga++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;v=ka.v2;y.positionScreen.x*=o;y.positionScreen.y*=-u;v.positionScreen.x*=o;v.positionScreen.y*=-u;H.addPoint(y.positionScreen.x,y.positionScreen.y);H.addPoint(v.positionScreen.x,v.positionScreen.y);if(F.instersects(H)){ga=
|
|
M.b+=Y.b}else if(ga instanceof THREE.PointLight){Fa.r+=Y.r;Fa.g+=Y.g;Fa.b+=Y.b}}}pa=0;for(Da=h.length;pa<Da;pa++){ka=h[pa];H.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=o;y.y*=-u;ga=0;for(Y=ka.materials.length;ga<Y;)ga++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;v=ka.v2;y.positionScreen.x*=o;y.positionScreen.y*=-u;v.positionScreen.x*=o;v.positionScreen.y*=-u;H.addPoint(y.positionScreen.x,y.positionScreen.y);H.addPoint(v.positionScreen.x,v.positionScreen.y);if(F.instersects(H)){ga=
|
|
0;for(Y=ka.materials.length;ga<Y;)if((na=ka.materials[ga++])&&na.opacity!=0){la=y;Ga=v;var wa=Aa++;if(e[wa]==null){e[wa]=document.createElementNS("http://www.w3.org/2000/svg","line");Ha==0&&e[wa].setAttribute("shape-rendering","crispEdges")}da=e[wa];da.setAttribute("x1",la.positionScreen.x);da.setAttribute("y1",la.positionScreen.y);da.setAttribute("x2",Ga.positionScreen.x);da.setAttribute("y2",Ga.positionScreen.y);if(na instanceof THREE.LineBasicMaterial){z.__styleString=na.color.__styleString;da.setAttribute("style",
|
|
0;for(Y=ka.materials.length;ga<Y;)if((na=ka.materials[ga++])&&na.opacity!=0){la=y;Ga=v;var wa=Aa++;if(e[wa]==null){e[wa]=document.createElementNS("http://www.w3.org/2000/svg","line");Ha==0&&e[wa].setAttribute("shape-rendering","crispEdges")}da=e[wa];da.setAttribute("x1",la.positionScreen.x);da.setAttribute("y1",la.positionScreen.y);da.setAttribute("x2",Ga.positionScreen.x);da.setAttribute("y2",Ga.positionScreen.y);if(na instanceof THREE.LineBasicMaterial){z.__styleString=na.color.__styleString;da.setAttribute("style",
|
|
"fill: none; stroke: "+z.__styleString+"; stroke-width: "+na.linewidth+"; stroke-opacity: "+na.opacity+"; stroke-linecap: "+na.linecap+"; stroke-linejoin: "+na.linejoin);k.appendChild(da)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;v=ka.v2;B=ka.v3;y.positionScreen.x*=o;y.positionScreen.y*=-u;v.positionScreen.x*=o;v.positionScreen.y*=-u;B.positionScreen.x*=o;B.positionScreen.y*=-u;H.addPoint(y.positionScreen.x,y.positionScreen.y);H.addPoint(v.positionScreen.x,v.positionScreen.y);H.addPoint(B.positionScreen.x,
|
|
"fill: none; stroke: "+z.__styleString+"; stroke-width: "+na.linewidth+"; stroke-opacity: "+na.opacity+"; stroke-linecap: "+na.linecap+"; stroke-linejoin: "+na.linejoin);k.appendChild(da)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;v=ka.v2;B=ka.v3;y.positionScreen.x*=o;y.positionScreen.y*=-u;v.positionScreen.x*=o;v.positionScreen.y*=-u;B.positionScreen.x*=o;B.positionScreen.y*=-u;H.addPoint(y.positionScreen.x,y.positionScreen.y);H.addPoint(v.positionScreen.x,v.positionScreen.y);H.addPoint(B.positionScreen.x,
|
|
-B.positionScreen.y);if(F.instersects(H)){ga=0;for(Y=ka.meshMaterials.length;ga<Y;){na=ka.meshMaterials[ga++];if(na instanceof THREE.MeshFaceMaterial){la=0;for(Ga=ka.faceMaterials.length;la<Ga;)(na=ka.faceMaterials[la++])&&na.opacity!=0&&d(y,v,B,ka,na,qa)}else na&&na.opacity!=0&&d(y,v,B,ka,na,qa)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;v=ka.v2;B=ka.v3;C=ka.v4;y.positionScreen.x*=o;y.positionScreen.y*=-u;v.positionScreen.x*=o;v.positionScreen.y*=-u;B.positionScreen.x*=o;B.positionScreen.y*=
|
|
|
|
--u;C.positionScreen.x*=o;C.positionScreen.y*=-u;H.addPoint(y.positionScreen.x,y.positionScreen.y);H.addPoint(v.positionScreen.x,v.positionScreen.y);H.addPoint(B.positionScreen.x,B.positionScreen.y);H.addPoint(C.positionScreen.x,C.positionScreen.y);if(F.instersects(H)){ga=0;for(Y=ka.meshMaterials.length;ga<Y;){na=ka.meshMaterials[ga++];if(na instanceof THREE.MeshFaceMaterial){la=0;for(Ga=ka.faceMaterials.length;la<Ga;)(na=ka.faceMaterials[la++])&&na.opacity!=0&&c(y,v,B,C,ka,na,qa)}else na&&na.opacity!=
|
|
|
|
-0&&c(y,v,B,C,ka,na,qa)}}}}}};
|
|
|
|
|
|
+B.positionScreen.y);if(F.instersects(H)){ga=0;for(Y=ka.meshMaterials.length;ga<Y;){na=ka.meshMaterials[ga++];if(na instanceof THREE.MeshFaceMaterial){la=0;for(Ga=ka.faceMaterials.length;la<Ga;)(na=ka.faceMaterials[la++])&&na.opacity!=0&&c(y,v,B,ka,na,qa)}else na&&na.opacity!=0&&c(y,v,B,ka,na,qa)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;v=ka.v2;B=ka.v3;C=ka.v4;y.positionScreen.x*=o;y.positionScreen.y*=-u;v.positionScreen.x*=o;v.positionScreen.y*=-u;B.positionScreen.x*=o;B.positionScreen.y*=
|
|
|
|
+-u;C.positionScreen.x*=o;C.positionScreen.y*=-u;H.addPoint(y.positionScreen.x,y.positionScreen.y);H.addPoint(v.positionScreen.x,v.positionScreen.y);H.addPoint(B.positionScreen.x,B.positionScreen.y);H.addPoint(C.positionScreen.x,C.positionScreen.y);if(F.instersects(H)){ga=0;for(Y=ka.meshMaterials.length;ga<Y;){na=ka.meshMaterials[ga++];if(na instanceof THREE.MeshFaceMaterial){la=0;for(Ga=ka.faceMaterials.length;la<Ga;)(na=ka.faceMaterials[la++])&&na.opacity!=0&&d(y,v,B,C,ka,na,qa)}else na&&na.opacity!=
|
|
|
|
+0&&d(y,v,B,C,ka,na,qa)}}}}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
|
@@ -222,8 +222,8 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
-THREE.WebGLRenderer=function(b){function d(m,A,x){var t,w,S,E=m.vertices,G=E.length,O=m.colors,D=O.length,I=m.__vertexArray,Q=m.__colorArray,sa=m.__sortArray,W=m.__dirtyVertices,Ba=m.__dirtyColors;if(x.sortParticles){Ua.multiplySelf(x.matrixWorld);for(t=0;t<G;t++){w=E[t].position;Pa.copy(w);Ua.multiplyVector3(Pa);sa[t]=[Pa.z,t]}sa.sort(function(ra,za){return za[0]-ra[0]});for(t=0;t<G;t++){w=E[sa[t][1]].position;S=t*3;I[S]=w.x;I[S+1]=w.y;I[S+2]=w.z}for(t=0;t<D;t++){S=t*3;color=O[sa[t][1]];Q[S]=color.r;
|
|
|
|
-Q[S+1]=color.g;Q[S+2]=color.b}}else{if(W)for(t=0;t<G;t++){w=E[t].position;S=t*3;I[S]=w.x;I[S+1]=w.y;I[S+2]=w.z}if(Ba)for(t=0;t<D;t++){color=O[t];S=t*3;Q[S]=color.r;Q[S+1]=color.g;Q[S+2]=color.b}}if(W||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,A)}if(Ba||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,A)}}function c(m,A){m.uniforms=Uniforms.clone(A.uniforms);m.vertexShader=A.vertexShader;m.fragmentShader=
|
|
|
|
|
|
+THREE.WebGLRenderer=function(b){function c(m,A,x){var t,w,S,E=m.vertices,G=E.length,O=m.colors,D=O.length,I=m.__vertexArray,Q=m.__colorArray,sa=m.__sortArray,W=m.__dirtyVertices,Ba=m.__dirtyColors;if(x.sortParticles){Ua.multiplySelf(x.matrixWorld);for(t=0;t<G;t++){w=E[t].position;Pa.copy(w);Ua.multiplyVector3(Pa);sa[t]=[Pa.z,t]}sa.sort(function(ra,za){return za[0]-ra[0]});for(t=0;t<G;t++){w=E[sa[t][1]].position;S=t*3;I[S]=w.x;I[S+1]=w.y;I[S+2]=w.z}for(t=0;t<D;t++){S=t*3;color=O[sa[t][1]];Q[S]=color.r;
|
|
|
|
+Q[S+1]=color.g;Q[S+2]=color.b}}else{if(W)for(t=0;t<G;t++){w=E[t].position;S=t*3;I[S]=w.x;I[S+1]=w.y;I[S+2]=w.z}if(Ba)for(t=0;t<D;t++){color=O[t];S=t*3;Q[S]=color.r;Q[S+1]=color.g;Q[S+2]=color.b}}if(W||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,A)}if(Ba||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,A)}}function d(m,A){m.uniforms=Uniforms.clone(A.uniforms);m.vertexShader=A.vertexShader;m.fragmentShader=
|
|
A.fragmentShader}function f(m,A,x,t,w){t.program||$.initMaterial(t,A,x,w);var S=t.program,E=S.uniforms,G=t.uniforms;if(S!=Aa){e.useProgram(S);Aa=S}e.uniformMatrix4fv(E.projectionMatrix,!1,cb);if(x&&(t instanceof THREE.MeshBasicMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshPhongMaterial||t instanceof THREE.LineBasicMaterial||t instanceof THREE.ParticleBasicMaterial||t.fog)){G.fogColor.value.setHex(x.color.hex);if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=
|
|
A.fragmentShader}function f(m,A,x,t,w){t.program||$.initMaterial(t,A,x,w);var S=t.program,E=S.uniforms,G=t.uniforms;if(S!=Aa){e.useProgram(S);Aa=S}e.uniformMatrix4fv(E.projectionMatrix,!1,cb);if(x&&(t instanceof THREE.MeshBasicMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshPhongMaterial||t instanceof THREE.LineBasicMaterial||t instanceof THREE.ParticleBasicMaterial||t.fog)){G.fogColor.value.setHex(x.color.hex);if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=
|
|
x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(t instanceof THREE.MeshPhongMaterial||t instanceof THREE.MeshLambertMaterial||t.lights){var O,D,I=0,Q=0,sa=0,W,Ba,ra,za,Ia=N,Sa=Ia.directional.colors,ea=Ia.directional.positions,ca=Ia.point.colors,ja=Ia.point.positions,La=Ia.point.distances,V=0,P=0;x=D=za=0;for(O=A.length;x<O;x++){D=A[x];W=D.color;Ba=D.position;ra=D.intensity;za=D.distance;if(D instanceof THREE.AmbientLight){I+=W.r;Q+=W.g;sa+=W.b}else if(D instanceof THREE.DirectionalLight){za=
|
|
x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(t instanceof THREE.MeshPhongMaterial||t instanceof THREE.MeshLambertMaterial||t.lights){var O,D,I=0,Q=0,sa=0,W,Ba,ra,za,Ia=N,Sa=Ia.directional.colors,ea=Ia.directional.positions,ca=Ia.point.colors,ja=Ia.point.positions,La=Ia.point.distances,V=0,P=0;x=D=za=0;for(O=A.length;x<O;x++){D=A[x];W=D.color;Ba=D.position;ra=D.intensity;za=D.distance;if(D instanceof THREE.AmbientLight){I+=W.r;Q+=W.g;sa+=W.b}else if(D instanceof THREE.DirectionalLight){za=
|
|
V*3;Sa[za]=W.r*ra;Sa[za+1]=W.g*ra;Sa[za+2]=W.b*ra;ea[za]=Ba.x;ea[za+1]=Ba.y;ea[za+2]=Ba.z;V+=1}else if(D instanceof THREE.PointLight){D=P*3;ca[D]=W.r*ra;ca[D+1]=W.g*ra;ca[D+2]=W.b*ra;ja[D]=Ba.x;ja[D+1]=Ba.y;ja[D+2]=Ba.z;La[P]=za;P+=1}}for(x=V*3;x<Sa.length;x++)Sa[x]=0;for(x=P*3;x<ca.length;x++)ca[x]=0;Ia.point.length=P;Ia.directional.length=V;Ia.ambient[0]=I;Ia.ambient[1]=Q;Ia.ambient[2]=sa;x=N;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=
|
|
V*3;Sa[za]=W.r*ra;Sa[za+1]=W.g*ra;Sa[za+2]=W.b*ra;ea[za]=Ba.x;ea[za+1]=Ba.y;ea[za+2]=Ba.z;V+=1}else if(D instanceof THREE.PointLight){D=P*3;ca[D]=W.r*ra;ca[D+1]=W.g*ra;ca[D+2]=W.b*ra;ja[D]=Ba.x;ja[D+1]=Ba.y;ja[D+2]=Ba.z;La[P]=za;P+=1}}for(x=V*3;x<Sa.length;x++)Sa[x]=0;for(x=P*3;x<ca.length;x++)ca[x]=0;Ia.point.length=P;Ia.directional.length=V;Ia.ambient[0]=I;Ia.ambient[1]=Q;Ia.ambient[2]=sa;x=N;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=
|
|
@@ -276,7 +276,7 @@ Ta.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,t.__webglTangentBuffer);e.bufferData
|
|
t.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,S);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,S);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ha,S);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,K,S)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=
|
|
t.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,S);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,S);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ha,S);e.bindBuffer(e.ARRAY_BUFFER,t.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,K,S)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=
|
|
m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;S=t.length;Ia=m.__vertexArray;E=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(G=0;G<za;G++){Ba=ra[G].position;w=G*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(G=0;G<S;G++){color=t[G];w=G*3;E[w]=color.r;E[w+1]=color.g;E[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;S=t.length;Ia=m.__vertexArray;E=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(G=0;G<za;G++){Ba=ra[G].position;w=G*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(G=0;G<S;G++){color=t[G];w=G*3;E[w]=color.r;E[w+1]=color.g;E[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
E,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Line){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;S=t.length;Ia=m.__vertexArray;E=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(G=0;G<za;G++){Ba=ra[G].position;w=G*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(G=0;G<S;G++){color=t[G];w=G*3;E[w]=color.r;E[w+1]=
|
|
E,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Line){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;A=e.DYNAMIC_DRAW;ra=m.vertices;t=m.colors;za=ra.length;S=t.length;Ia=m.__vertexArray;E=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(G=0;G<za;G++){Ba=ra[G].position;w=G*3;Ia[w]=Ba.x;Ia[w+1]=Ba.y;Ia[w+2]=Ba.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,A)}if(Sa){for(G=0;G<S;G++){color=t[G];w=G*3;E[w]=color.r;E[w+1]=
|
|
-color.g;E[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){x=m.geometry;(x.__dirtyVertices||x.__dirtyColors||m.sortParticles)&&d(x,e.DYNAMIC_DRAW,m);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(m){function A(sa){var W=[];x=0;for(t=sa.length;x<t;x++)sa[x]==undefined?W.push("undefined"):W.push(sa[x].id);return W.join("_")}var x,t,w,S,E,G,O,D,I={},Q=m.morphTargets!==
|
|
|
|
|
|
+color.g;E[w+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,A)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){x=m.geometry;(x.__dirtyVertices||x.__dirtyColors||m.sortParticles)&&c(x,e.DYNAMIC_DRAW,m);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(m){function A(sa){var W=[];x=0;for(t=sa.length;x<t;x++)sa[x]==undefined?W.push("undefined"):W.push(sa[x].id);return W.join("_")}var x,t,w,S,E,G,O,D,I={},Q=m.morphTargets!==
|
|
undefined?m.morphTargets.length:0;m.geometryGroups={};w=0;for(S=m.faces.length;w<S;w++){E=m.faces[w];G=E.materials;O=A(G);I[O]==undefined&&(I[O]={hash:O,counter:0});D=I[O].hash+"_"+I[O].counter;m.geometryGroups[D]==undefined&&(m.geometryGroups[D]={faces:[],materials:G,vertices:0,numMorphTargets:Q});E=E instanceof THREE.Face3?3:4;if(m.geometryGroups[D].vertices+E>65535){I[O].counter+=1;D=I[O].hash+"_"+I[O].counter;m.geometryGroups[D]==undefined&&(m.geometryGroups[D]={faces:[],materials:G,vertices:0,
|
|
undefined?m.morphTargets.length:0;m.geometryGroups={};w=0;for(S=m.faces.length;w<S;w++){E=m.faces[w];G=E.materials;O=A(G);I[O]==undefined&&(I[O]={hash:O,counter:0});D=I[O].hash+"_"+I[O].counter;m.geometryGroups[D]==undefined&&(m.geometryGroups[D]={faces:[],materials:G,vertices:0,numMorphTargets:Q});E=E instanceof THREE.Face3?3:4;if(m.geometryGroups[D].vertices+E>65535){I[O].counter+=1;D=I[O].hash+"_"+I[O].counter;m.geometryGroups[D]==undefined&&(m.geometryGroups[D]={faces:[],materials:G,vertices:0,
|
|
numMorphTargets:Q})}m.geometryGroups[D].faces.push(w);m.geometryGroups[D].vertices+=E}}function z(m,A,x){m.push({buffer:A,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(m){if(m!=ga){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);
|
|
numMorphTargets:Q})}m.geometryGroups[D].faces.push(w);m.geometryGroups[D].vertices+=E}}function z(m,A,x){m.push({buffer:A,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(m){if(m!=ga){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);
|
|
break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=m}}function L(m,A,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,Z(A.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,Z(A.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,Z(A.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Z(A.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);
|
|
break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=m}}function L(m,A,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,Z(A.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,Z(A.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,Z(A.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Z(A.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);
|
|
@@ -296,8 +296,8 @@ ia.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuff
|
|
e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ia.program=e.createProgram();e.attachShader(ia.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ia.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ia.program);ia.attributes={};ia.uniforms={};ia.attributes.vertex=e.getAttribLocation(ia.program,"position");ia.attributes.uv=e.getAttribLocation(ia.program,"UV");ia.uniforms.map=e.getUniformLocation(ia.program,
|
|
e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ia.program=e.createProgram();e.attachShader(ia.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ia.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ia.program);ia.attributes={};ia.uniforms={};ia.attributes.vertex=e.getAttribLocation(ia.program,"position");ia.attributes.uv=e.getAttribLocation(ia.program,"UV");ia.uniforms.map=e.getUniformLocation(ia.program,
|
|
"map");ia.uniforms.opacity=e.getUniformLocation(ia.program,"opacity");ia.uniforms.scale=e.getUniformLocation(ia.program,"scale");ia.uniforms.rotation=e.getUniformLocation(ia.program,"rotation");ia.uniforms.screenPosition=e.getUniformLocation(ia.program,"screenPosition");ia.uniforms.renderPink=e.getUniformLocation(ia.program,"renderPink");this.setSize=function(m,A){da.width=m;da.height=A;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(m,A,x,t){la=m;Ga=A;ka=x;na=t;e.viewport(la,
|
|
"map");ia.uniforms.opacity=e.getUniformLocation(ia.program,"opacity");ia.uniforms.scale=e.getUniformLocation(ia.program,"scale");ia.uniforms.rotation=e.getUniformLocation(ia.program,"rotation");ia.uniforms.screenPosition=e.getUniformLocation(ia.program,"screenPosition");ia.uniforms.renderPink=e.getUniformLocation(ia.program,"renderPink");this.setSize=function(m,A){da.width=m;da.height=A;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(m,A,x,t){la=m;Ga=A;ka=x;na=t;e.viewport(la,
|
|
Ga,ka,na)};this.setScissor=function(m,A,x,t){e.scissor(m,A,x,t)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){qa=m;e.depthMask(m)};this.setClearColorHex=function(m,A){var x=new THREE.Color(m);e.clearColor(x.r,x.g,x.b,A)};this.setClearColor=function(m,A){e.clearColor(m.r,m.g,m.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ya.darkness=
|
|
Ga,ka,na)};this.setScissor=function(m,A,x,t){e.scissor(m,A,x,t)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){qa=m;e.depthMask(m)};this.setClearColorHex=function(m,A){var x=new THREE.Color(m);e.clearColor(x.r,x.g,x.b,A)};this.setClearColor=function(m,A){e.clearColor(m.r,m.g,m.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ya.darkness=
|
|
-m};this.initMaterial=function(m,A,x,t){var w,S,E,G;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);
|
|
|
|
-else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);var O,D,I,Q;G=I=Q=0;for(O=A.length;G<O;G++){D=A[G];D instanceof THREE.DirectionalLight&&I++;D instanceof THREE.PointLight&&Q++}if(Q+I<=4)A=I;else{A=Math.ceil(4*I/(Q+I));Q=4-A}G={directional:A,point:Q};O=50;if(t!==undefined&&t instanceof THREE.SkinnedMesh)O=t.bones.length;a:{Q=m.fragmentShader;A=m.vertexShader;x={map:m.map,envMap:m.envMap,lightMap:m.lightMap,
|
|
|
|
|
|
+m};this.initMaterial=function(m,A,x,t){var w,S,E,G;if(m instanceof THREE.MeshDepthMaterial)d(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)d(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof THREE.MeshNormalMaterial)d(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)d(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)d(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)d(m,THREE.ShaderLib.phong);
|
|
|
|
+else if(m instanceof THREE.LineBasicMaterial)d(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&d(m,THREE.ShaderLib.particle_basic);var O,D,I,Q;G=I=Q=0;for(O=A.length;G<O;G++){D=A[G];D instanceof THREE.DirectionalLight&&I++;D instanceof THREE.PointLight&&Q++}if(Q+I<=4)A=I;else{A=Math.ceil(4*I/(Q+I));Q=4-A}G={directional:A,point:Q};O=50;if(t!==undefined&&t instanceof THREE.SkinnedMesh)O=t.bones.length;a:{Q=m.fragmentShader;A=m.vertexShader;x={map:m.map,envMap:m.envMap,lightMap:m.lightMap,
|
|
vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:G.directional,maxPointLights:G.point,maxBones:O};G=Q+"\n\n"+A+"\n\n";for(E in x)G+=E+": "+x[E]+",\n";E=0;for(O=Ca.length;E<O;E++)if(Ca[E].code==G){E=Ca[E].program;break a}E=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof
|
|
vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:G.directional,maxPointLights:G.point,maxBones:O};G=Q+"\n\n"+A+"\n\n";for(E in x)G+=E+": "+x[E]+",\n";E=0;for(O=Ca.length;E<O;E++)if(Ca[E].code==G){E=Ca[E].program;break a}E=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof
|
|
THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":
|
|
THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":
|
|
"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.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");
|
|
"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.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");
|
|
@@ -322,27 +322,41 @@ w,A)}else if(A instanceof THREE.Line){w=A.geometry;if(!w.__webglVertexBuffer){t=
|
|
t=w;S=t.vertices.length;t.__vertexArray=new Float32Array(S*3);t.__colorArray=new Float32Array(S*3);t.__sortArray=[];t.__webglParticleCount=S;w.__dirtyVertices=!0;w.__dirtyColors=!0}z(x.__webglObjects,w,A)}else THREE.MarchingCubes!==undefined&&A instanceof THREE.MarchingCubes&&x.__webglObjectsImmediate.push({object:A,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){A=m.__objectsRemoved[0];x=m;w=void 0;t=void 0;for(w=x.__webglObjects.length-
|
|
t=w;S=t.vertices.length;t.__vertexArray=new Float32Array(S*3);t.__colorArray=new Float32Array(S*3);t.__sortArray=[];t.__webglParticleCount=S;w.__dirtyVertices=!0;w.__dirtyColors=!0}z(x.__webglObjects,w,A)}else THREE.MarchingCubes!==undefined&&A instanceof THREE.MarchingCubes&&x.__webglObjectsImmediate.push({object:A,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){A=m.__objectsRemoved[0];x=m;w=void 0;t=void 0;for(w=x.__webglObjects.length-
|
|
1;w>=0;w--){t=x.__webglObjects[w].object;A==t&&x.__webglObjects.splice(w,1)}m.__objectsRemoved.splice(0,1)}A=0;for(x=m.__webglObjects.length;A<x;A++)H(m.__webglObjects[A].object,m);A=0;for(x=m.__webglShadowVolumes.length;A<x;A++)H(m.__webglShadowVolumes[A].object,m);A=0;for(x=m.__webglLensFlares.length;A<x;A++)H(m.__webglLensFlares[A].object,m)};this.setFaceCulling=function(m,A){if(m){!A||A=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="front"?e.cullFace(e.FRONT):
|
|
1;w>=0;w--){t=x.__webglObjects[w].object;A==t&&x.__webglObjects.splice(w,1)}m.__objectsRemoved.splice(0,1)}A=0;for(x=m.__webglObjects.length;A<x;A++)H(m.__webglObjects[A].object,m);A=0;for(x=m.__webglShadowVolumes.length;A<x;A++)H(m.__webglShadowVolumes[A].object,m);A=0;for(x=m.__webglLensFlares.length;A<x;A++)H(m.__webglLensFlares[A].object,m)};this.setFaceCulling=function(m,A){if(m){!A||A=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="front"?e.cullFace(e.FRONT):
|
|
e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
-THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
|
|
|
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
|
|
|
+THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
|
|
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,d){d&&b.update(undefined,!1,c);d=b.sounds;var f,g=d.length;for(f=0;f<g;f++){b=d[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
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.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.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
-THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
|
|
-var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var o=0,u=j.length;o<u;o++){var y=new THREE.Vertex(j[o].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(u=n.length;o<u;o++){j=n[o];var v,B,C=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)v=new THREE.Face3(j.a+f,j.b+f,j.c+
|
|
|
|
-f);else j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);c=0;for(h=C.length;c<h;c++){B=C[c];v.vertexNormals.push(B.clone())}v.color.copy(j.color);c=0;for(h=y.length;c<h;c++){B=y[c];v.vertexColors.push(B.clone())}v.materials=j.materials.slice();v.centroid.copy(j.centroid);k.push(v)}o=0;for(u=g.length;o<u;o++){f=g[o];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));p.push(k)}}},ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=
|
|
|
|
-new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}},SceneUtils={loadScene:function(b,d,c,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(Da,ga){return ga=="relativeToHTML"?
|
|
|
|
|
|
+THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};
|
|
|
|
+THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0};THREE.MeshCollider=function(b,c,d,f){this.vertices=b;this.faces=c;this.normals=d;this.box=f;this.numFaces=this.faces.length};THREE.CollisionSystem=function(){this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
|
|
|
|
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();var c=0;for(var d=this.hits.length=0;d<this.colliders.length;d++){var f=this.rayCast(b,this.colliders[d]);if(f<Number.MAX_VALUE){this.colliders[d].distance=f;f>c?this.hits.push(this.colliders[d]):this.hits.unshift(this.colliders[d]);c=f}}return this.hits};
|
|
|
|
+THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[d]);if(f<Number.MAX_VALUE){c[d].distance=f;break}d++}if(d>c.length)return null;return c[d]};
|
|
|
|
+THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
|
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g=0;g<c.numFaces/3;g++){var h=g*3;f=Math.min(f,this.rayTriangle(d,c.vertices[c.faces[h+0]],c.vertices[c.faces[h+1]],c.vertices[c.faces[h+2]],c.normals[c.faces[g]],f))}return f};
|
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,f,g,h){var j=(new THREE.Vector3).sub(d,c);g=(new THREE.Vector3).sub(f,d);g=(new THREE.Vector3).cross(j,g);var k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;k=b.origin.clone().addSelf(b.direction.clone().multiplyScalar(j));if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-c.y;h=d.y-c.y;g=f.y-c.y;k=k.z-c.z;d=d.z-
|
|
|
|
+c.z;f=f.z-c.z}else{b=k.x-c.x;h=d.x-c.x;g=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-c.x;h=d.x-c.x;g=f.x-c.x;k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;h=d.x-c.x;g=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}c=h*f-d*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
|
|
|
|
+THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(c.matrixWorld);f.multiplyVector3(d.origin);f.rotateAxis(d.direction);d.direction.normalize();return d};
|
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;d=c.dynamic&&c.mesh&&c.mesh.matrixWorld?this.makeRayLocal(b,c.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,n=0,p=!0;if(d.origin.x<c.min.x){f=c.min.x-d.origin.x;f/=d.direction.x;p=!1;j=-1}else if(d.origin.x>c.max.x){f=c.max.x-d.origin.x;f/=d.direction.x;p=!1;j=1}if(d.origin.y<c.min.y){g=c.min.y-d.origin.y;g/=d.direction.y;p=!1;k=-1}else if(d.origin.y>c.max.y){g=c.max.y-d.origin.y;g/=d.direction.y;p=!1;k=
|
|
|
|
+1}if(d.origin.z<c.min.z){h=c.min.z-d.origin.z;h/=d.direction.z;p=!1;n=-1}else if(d.origin.z>c.max.z){h=c.max.z-d.origin.z;h/=d.direction.z;p=!1;n=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(j,0,0);break;case 1:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+
|
|
|
|
+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,k,0);break;case 2:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(d<0)d=(f-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
|
|
|
|
+THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var f=d.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-f*f);if(d>=0)return Math.abs(f)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionUtils={};
|
|
|
|
+THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]);c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]);d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
|
|
+THREE.CollisionUtils.MeshColliderWBox=function(b){for(var c=b.geometry.vertices,d=c.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],n=0;n<d;n++)h.push(new THREE.Vector3(c[n].position.x,c[n].position.y,c[n].position.z));for(n=0;n<g;n++){j.push(f[n].a,f[n].b,f[n].c);k.push(new THREE.Vector3(f[n].normal.x,f[n].normal.y,f[n].normal.z))}c=new THREE.MeshCollider(h,j,k,THREE.CollisionUtils.MeshOBB(b));c.mesh=b;return c};
|
|
|
|
+var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,f=b.vertices.length,g=d?c.geometry:c,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,u=j.length;o<u;o++){var y=new THREE.Vertex(j[o].position.clone());d&&c.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(u=n.length;o<u;o++){j=n[o];var v,B,C=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)v=new THREE.Face3(j.a+f,j.b+f,j.c+
|
|
|
|
+f);else j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);d=0;for(h=C.length;d<h;d++){B=C[d];v.vertexNormals.push(B.clone())}v.color.copy(j.color);d=0;for(h=y.length;d<h;d++){B=y[d];v.vertexColors.push(B.clone())}v.materials=j.materials.slice();v.centroid.copy(j.centroid);k.push(v)}o=0;for(u=g.length;o<u;o++){f=g[o];k=[];d=0;for(h=f.length;d<h;d++)k.push(new THREE.UV(f[d].u,f[d].v));p.push(k)}}},ImageUtils={loadTexture:function(b,c,d){var f=new Image,g=
|
|
|
|
+new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;d&&d(this)};f.src=b;return g},loadTextureCube:function(b,c,d){var f,g=[],h=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)h.needsUpdate=!0;d&&d(this)};g[c].src=b[c]}return h}},SceneUtils={loadScene:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(Da,ga){return ga=="relativeToHTML"?
|
|
Da:h+"/"+Da}function n(){for(v in Z.objects)if(!$.objects[v]){U=Z.objects[v];if(M=$.geometries[U.geometry]){xa=[];for(pa=0;pa<U.materials.length;pa++)xa[pa]=$.materials[U.materials[pa]];z=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;xa.length==0&&(xa[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(M,xa);object.position.set(z[0],z[1],z[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);
|
|
Da:h+"/"+Da}function n(){for(v in Z.objects)if(!$.objects[v]){U=Z.objects[v];if(M=$.geometries[U.geometry]){xa=[];for(pa=0;pa<U.materials.length;pa++)xa[pa]=$.materials[U.materials[pa]];z=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;xa.length==0&&(xa[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(M,xa);object.position.set(z[0],z[1],z[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);
|
|
-object.visible=U.visible;$.scene.addObject(object);$.objects[v]=object}}}function p(Da){return function(ga){$.geometries[Da]=ga;n();Ca-=1;o()}}function o(){f({total_models:Ha,total_textures:qa,loaded_models:Ha-Ca,loaded_textures:qa-Aa},$);Ca==0&&Aa==0&&c($)}var u,y,v,B,C,F,H,U,z,J,L,M,Fa,oa,xa,Z,e,da,Ca,Aa,Ha,qa,$;Z=j.data;e=new THREE.BinaryLoader;da=new THREE.JSONLoader;Aa=Ca=0;$={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Aa-=
|
|
|
|
|
|
+object.visible=U.visible;$.scene.addObject(object);$.objects[v]=object}}}function p(Da){return function(ga){$.geometries[Da]=ga;n();Ca-=1;o()}}function o(){f({total_models:Ha,total_textures:qa,loaded_models:Ha-Ca,loaded_textures:qa-Aa},$);Ca==0&&Aa==0&&d($)}var u,y,v,B,C,F,H,U,z,J,L,M,Fa,oa,xa,Z,e,da,Ca,Aa,Ha,qa,$;Z=j.data;e=new THREE.BinaryLoader;da=new THREE.JSONLoader;Aa=Ca=0;$={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Aa-=
|
|
1;o()};for(C in Z.cameras){J=Z.cameras[C];if(J.type=="perspective")Fa=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho"){Fa=new THREE.Camera;Fa.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far)}z=J.position;J=J.target;Fa.position.set(z[0],z[1],z[2]);Fa.target.position.set(J[0],J[1],J[2]);$.cameras[C]=Fa}for(B in Z.lights){C=Z.lights[B];Fa=C.color!==undefined?C.color:16777215;J=C.intensity!==undefined?C.intensity:1;if(C.type=="directional"){z=
|
|
1;o()};for(C in Z.cameras){J=Z.cameras[C];if(J.type=="perspective")Fa=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho"){Fa=new THREE.Camera;Fa.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far)}z=J.position;J=J.target;Fa.position.set(z[0],z[1],z[2]);Fa.target.position.set(J[0],J[1],J[2]);$.cameras[C]=Fa}for(B in Z.lights){C=Z.lights[B];Fa=C.color!==undefined?C.color:16777215;J=C.intensity!==undefined?C.intensity:1;if(C.type=="directional"){z=
|
|
C.direction;light=new THREE.DirectionalLight(Fa,J);light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(C.type=="point"){z=C.position;light=new THREE.PointLight(Fa,J);light.position.set(z[0],z[1],z[2])}$.scene.addLight(light);$.lights[B]=light}for(F in Z.fogs){B=Z.fogs[F];if(B.type=="linear")oa=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(oa=new THREE.FogExp2(0,B.density));J=B.color;oa.color.setRGB(J[0],J[1],J[2]);$.fogs[F]=oa}if($.cameras&&Z.defaults.camera)$.currentCamera=
|
|
C.direction;light=new THREE.DirectionalLight(Fa,J);light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(C.type=="point"){z=C.position;light=new THREE.PointLight(Fa,J);light.position.set(z[0],z[1],z[2])}$.scene.addLight(light);$.lights[B]=light}for(F in Z.fogs){B=Z.fogs[F];if(B.type=="linear")oa=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(oa=new THREE.FogExp2(0,B.density));J=B.color;oa.color.setRGB(J[0],J[1],J[2]);$.fogs[F]=oa}if($.cameras&&Z.defaults.camera)$.currentCamera=
|
|
$.cameras[Z.defaults.camera];if($.fogs&&Z.defaults.fog)$.scene.fog=$.fogs[Z.defaults.fog];J=Z.defaults.bgcolor;$.bgColor=new THREE.Color;$.bgColor.setRGB(J[0],J[1],J[2]);$.bgColorAlpha=Z.defaults.bgalpha;for(u in Z.geometries){F=Z.geometries[u];if(F.type=="bin_mesh"||F.type=="ascii_mesh")Ca+=1}Ha=Ca;for(u in Z.geometries){F=Z.geometries[u];if(F.type=="cube"){M=new Cube(F.width,F.height,F.depth,F.segmentsWidth,F.segmentsHeight,F.segmentsDepth,null,F.flipped,F.sides);$.geometries[u]=M}else if(F.type==
|
|
$.cameras[Z.defaults.camera];if($.fogs&&Z.defaults.fog)$.scene.fog=$.fogs[Z.defaults.fog];J=Z.defaults.bgcolor;$.bgColor=new THREE.Color;$.bgColor.setRGB(J[0],J[1],J[2]);$.bgColorAlpha=Z.defaults.bgalpha;for(u in Z.geometries){F=Z.geometries[u];if(F.type=="bin_mesh"||F.type=="ascii_mesh")Ca+=1}Ha=Ca;for(u in Z.geometries){F=Z.geometries[u];if(F.type=="cube"){M=new Cube(F.width,F.height,F.depth,F.segmentsWidth,F.segmentsHeight,F.segmentsDepth,null,F.flipped,F.sides);$.geometries[u]=M}else if(F.type==
|
|
"plane"){M=new Plane(F.width,F.height,F.segmentsWidth,F.segmentsHeight);$.geometries[u]=M}else if(F.type=="sphere"){M=new Sphere(F.radius,F.segmentsWidth,F.segmentsHeight);$.geometries[u]=M}else if(F.type=="cylinder"){M=new Cylinder(F.numSegs,F.topRad,F.botRad,F.height,F.topOffset,F.botOffset);$.geometries[u]=M}else if(F.type=="torus"){M=new Torus(F.radius,F.tube,F.segmentsR,F.segmentsT);$.geometries[u]=M}else if(F.type=="icosahedron"){M=new Icosahedron(F.subdivisions);$.geometries[u]=M}else if(F.type==
|
|
"plane"){M=new Plane(F.width,F.height,F.segmentsWidth,F.segmentsHeight);$.geometries[u]=M}else if(F.type=="sphere"){M=new Sphere(F.radius,F.segmentsWidth,F.segmentsHeight);$.geometries[u]=M}else if(F.type=="cylinder"){M=new Cylinder(F.numSegs,F.topRad,F.botRad,F.height,F.topOffset,F.botOffset);$.geometries[u]=M}else if(F.type=="torus"){M=new Torus(F.radius,F.tube,F.segmentsR,F.segmentsT);$.geometries[u]=M}else if(F.type=="icosahedron"){M=new Icosahedron(F.subdivisions);$.geometries[u]=M}else if(F.type==
|
|
"bin_mesh")e.load({model:k(F.url,Z.urlBaseType),callback:p(u)});else F.type=="ascii_mesh"&&da.load({model:k(F.url,Z.urlBaseType),callback:p(u)})}for(H in Z.textures){u=Z.textures[H];Aa+=u.url instanceof Array?u.url.length:1}qa=Aa;for(H in Z.textures){u=Z.textures[H];if(u.mapping!=undefined&&THREE[u.mapping]!=undefined)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){F=[];for(var pa=0;pa<u.url.length;pa++)F[pa]=k(u.url[pa],Z.urlBaseType);F=ImageUtils.loadTextureCube(F,u.mapping,j)}else{F=
|
|
"bin_mesh")e.load({model:k(F.url,Z.urlBaseType),callback:p(u)});else F.type=="ascii_mesh"&&da.load({model:k(F.url,Z.urlBaseType),callback:p(u)})}for(H in Z.textures){u=Z.textures[H];Aa+=u.url instanceof Array?u.url.length:1}qa=Aa;for(H in Z.textures){u=Z.textures[H];if(u.mapping!=undefined&&THREE[u.mapping]!=undefined)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){F=[];for(var pa=0;pa<u.url.length;pa++)F[pa]=k(u.url[pa],Z.urlBaseType);F=ImageUtils.loadTextureCube(F,u.mapping,j)}else{F=
|
|
ImageUtils.loadTexture(k(u.url,Z.urlBaseType),u.mapping,j);if(THREE[u.minFilter]!=undefined)F.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=undefined)F.magFilter=THREE[u.magFilter]}$.textures[H]=F}for(y in Z.materials){H=Z.materials[y];for(L in H.parameters)if(L=="envMap"||L=="map"||L=="lightMap")H.parameters[L]=$.textures[H.parameters[L]];else if(L=="shading")H.parameters[L]=H.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")H.parameters[L]=THREE[H.parameters[L]]?
|
|
ImageUtils.loadTexture(k(u.url,Z.urlBaseType),u.mapping,j);if(THREE[u.minFilter]!=undefined)F.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=undefined)F.magFilter=THREE[u.magFilter]}$.textures[H]=F}for(y in Z.materials){H=Z.materials[y];for(L in H.parameters)if(L=="envMap"||L=="map"||L=="lightMap")H.parameters[L]=$.textures[H.parameters[L]];else if(L=="shading")H.parameters[L]=H.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")H.parameters[L]=THREE[H.parameters[L]]?
|
|
-THREE[H.parameters[L]]:THREE.NormalBlending;else L=="combine"&&(H.parameters[L]=H.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);H=new THREE[H.type](H.parameters);$.materials[y]=H}n();d($)}},addMesh:function(b,d,c,f,g,h,j,k,n,p){d=new THREE.Mesh(d,p);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=n;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=
|
|
|
|
-c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));
|
|
|
|
-f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new Cube(d,d,d,1,1,f,!0),new THREE.MeshFaceMaterial);b.addObject(d);return d},addPanoramaCubePlanes:function(b,d,c){var f=d/2;d=new Plane(d,d);var g=Math.PI,h=Math.PI/2;SceneUtils.addMesh(b,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(b,d,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(b,d,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));
|
|
|
|
-SceneUtils.addMesh(b,d,1,0,f,0,h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));SceneUtils.addMesh(b,d,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))},showHierarchy:function(b,d){SceneUtils.traverseHierarchy(b,function(c){c.visible=d})},traverseHierarchy:function(b,d){var c,f,g=b.children.length;for(f=0;f<g;f++){c=b.children[f];d(c);SceneUtils.traverseHierarchy(c,d)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
|
|
|
|
|
|
+THREE[H.parameters[L]]:THREE.NormalBlending;else L=="combine"&&(H.parameters[L]=H.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);H=new THREE[H.type](H.parameters);$.materials[y]=H}n();c($)}},addMesh:function(b,c,d,f,g,h,j,k,n,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=j;c.rotation.y=k;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=
|
|
|
|
+d;d=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),d);b.addObject(c);return c},addPanoramaCube:function(b,c,d){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));
|
|
|
|
+f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,f,!0),new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,d){var f=c/2;c=new Plane(c,c);var g=Math.PI,h=Math.PI/2;SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(b,c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));
|
|
|
|
+SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))},showHierarchy:function(b,c){SceneUtils.traverseHierarchy(b,function(d){d.visible=c})},traverseHierarchy:function(b,c){var d,f,g=b.children.length;for(f=0;f<g;f++){d=b.children[f];c(d);SceneUtils.traverseHierarchy(d,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
|
|
value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
|
|
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
|
|
@@ -352,61 +366,61 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
|
|
|
|
-THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
|
|
|
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,d,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;d=Array(h);for(c=f=0;c<h;++c){d[c]=Math.exp(-((c-g)*(c-g))/(2*b*b));f+=d[c]}for(c=0;c<h;++c)d[c]/=f;return d}};
|
|
|
|
+THREE.QuakeCamera=function(b){function c(d,f){return function(){f.apply(d,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
|
|
b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=
|
|
b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=
|
|
-b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();
|
|
|
|
-c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=
|
|
|
|
-!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-
|
|
|
|
-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;c=this.target.position;var f=this.position;c.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=f.y+100*Math.cos(this.phi);c.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",
|
|
|
|
-d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
|
-THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
|
|
|
|
-THREE.PathCamera=function(b){function d(p,o,u,y){var v={name:u,fps:0.6,length:y,hierarchy:[]},B,C=o.getControlPointsArray(),F=o.getLength(),H=C.length,U=0;B=H-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:C[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:C[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<H-1;B++){U=y*F.chunks[B]/F.total;o.keys[B]={time:U,pos:C[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,u,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(p,o){var u,
|
|
|
|
-y,v=new THREE.Geometry;for(u=0;u<p.points.length*o;u++){y=u/(p.points.length*o);y=p.getPoint(y);v.vertices[u]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var u=c(o,10),y=c(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(u,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
|
|
|
|
|
|
+b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(d){d.preventDefault();
|
|
|
|
+d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(d){d.preventDefault();d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(d){this.mouseX=d.clientX-this.windowHalfX;this.mouseY=d.clientY-this.windowHalfY};this.onKeyDown=function(d){switch(d.keyCode){case 38:case 87:this.moveForward=
|
|
|
|
+!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(d){switch(d.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-
|
|
|
|
+this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);var d=this.lookSpeed;this.activeLook||(d=0);this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);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;d=this.target.position;var f=this.position;d.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);d.y=f.y+100*Math.cos(this.phi);d.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(d){d.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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
|
+THREE.QuakeCamera.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(p,o,u,y){var v={name:u,fps:0.6,length:y,hierarchy:[]},B,C=o.getControlPointsArray(),F=o.getLength(),H=C.length,U=0;B=H-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:C[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:C[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<H-1;B++){U=y*F.chunks[B]/F.total;o.keys[B]={time:U,pos:C[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,u,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var u,
|
|
|
|
+y,v=new THREE.Geometry;for(u=0;u<p.points.length*o;u++){y=u/(p.points.length*o);y=p.getPoint(y);v.vertices[u]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var u=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(u,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
|
|
16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){u=new THREE.Mesh(y,v);u.position.copy(o.points[i]);u.updateMatrix();p.addChild(u)}}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.lookVertical=
|
|
16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){u=new THREE.Mesh(y,v);u.position.copy(o.points[i]);u.updateMatrix();p.addChild(u)}}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.lookVertical=
|
|
!0;this.lookHorizontal=!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!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
!0;this.lookHorizontal=!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!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)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,h=Math.PI/180;this.update=function(p,o,u){var y,v;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)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
|
|
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,u){var y,v;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)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
|
|
this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,u)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,u)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
|
|
|
|
-d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
|
-var Cube=function(b,d,c,f,g,h,j,k,n){function p(F,H,U,z,J,L,M,Fa){var oa,xa,Z=f||1,e=g||1,da=J/2,Ca=L/2,Aa=o.vertices.length;if(F=="x"&&H=="y"||F=="y"&&H=="x")oa="z";else if(F=="x"&&H=="z"||F=="z"&&H=="x"){oa="y";e=h||1}else if(F=="z"&&H=="y"||F=="y"&&H=="z"){oa="x";Z=h||1}var Ha=Z+1,qa=e+1;J/=Z;var $=L/e;for(xa=0;xa<qa;xa++)for(L=0;L<Ha;L++){var pa=new THREE.Vector3;pa[F]=(L*J-da)*U;pa[H]=(xa*$-Ca)*z;pa[oa]=M;o.vertices.push(new THREE.Vertex(pa))}for(xa=0;xa<e;xa++)for(L=0;L<Z;L++){o.faces.push(new THREE.Face4(L+
|
|
|
|
-Ha*xa+Aa,L+Ha*(xa+1)+Aa,L+1+Ha*(xa+1)+Aa,L+1+Ha*xa+Aa,null,null,Fa));o.faceVertexUvs[0].push([new THREE.UV(L/Z,xa/e),new THREE.UV(L/Z,(xa+1)/e),new THREE.UV((L+1)/Z,(xa+1)/e),new THREE.UV((L+1)/Z,xa/e)])}}THREE.Geometry.call(this);var o=this,u=b/2,y=d/2,v=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var C in n)this.sides[C]!=
|
|
|
|
-undefined&&(this.sides[C]=n[C]);this.sides.px&&p("z","y",1*k,-1,c,d,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,c,d,u,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,d,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,d,-v,this.materials[5]);(function(){for(var F=[],H=[],U=0,z=o.vertices.length;U<z;U++){for(var J=o.vertices[U],L=!1,M=0,Fa=F.length;M<Fa;M++){var oa=
|
|
|
|
|
|
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
|
|
|
|
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
|
+var Cube=function(b,c,d,f,g,h,j,k,n){function p(F,H,U,z,J,L,M,Fa){var oa,xa,Z=f||1,e=g||1,da=J/2,Ca=L/2,Aa=o.vertices.length;if(F=="x"&&H=="y"||F=="y"&&H=="x")oa="z";else if(F=="x"&&H=="z"||F=="z"&&H=="x"){oa="y";e=h||1}else if(F=="z"&&H=="y"||F=="y"&&H=="z"){oa="x";Z=h||1}var Ha=Z+1,qa=e+1;J/=Z;var $=L/e;for(xa=0;xa<qa;xa++)for(L=0;L<Ha;L++){var pa=new THREE.Vector3;pa[F]=(L*J-da)*U;pa[H]=(xa*$-Ca)*z;pa[oa]=M;o.vertices.push(new THREE.Vertex(pa))}for(xa=0;xa<e;xa++)for(L=0;L<Z;L++){o.faces.push(new THREE.Face4(L+
|
|
|
|
+Ha*xa+Aa,L+Ha*(xa+1)+Aa,L+1+Ha*(xa+1)+Aa,L+1+Ha*xa+Aa,null,null,Fa));o.faceVertexUvs[0].push([new THREE.UV(L/Z,xa/e),new THREE.UV(L/Z,(xa+1)/e),new THREE.UV((L+1)/Z,(xa+1)/e),new THREE.UV((L+1)/Z,xa/e)])}}THREE.Geometry.call(this);var o=this,u=b/2,y=c/2,v=d/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var C in n)this.sides[C]!=
|
|
|
|
+undefined&&(this.sides[C]=n[C]);this.sides.px&&p("z","y",1*k,-1,d,c,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,u,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var F=[],H=[],U=0,z=o.vertices.length;U<z;U++){for(var J=o.vertices[U],L=!1,M=0,Fa=F.length;M<Fa;M++){var oa=
|
|
F[M];if(J.position.x==oa.position.x&&J.position.y==oa.position.y&&J.position.z==oa.position.z){H[U]=M;L=!0;break}}if(!L){H[U]=F.length;F.push(new THREE.Vertex(J.position.clone()))}}U=0;for(z=o.faces.length;U<z;U++){J=o.faces[U];J.a=H[J.a];J.b=H[J.b];J.c=H[J.c];J.d=H[J.d]}o.vertices=F})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
F[M];if(J.position.x==oa.position.x&&J.position.y==oa.position.y&&J.position.z==oa.position.z){H[U]=M;L=!0;break}}if(!L){H[U]=F.length;F.push(new THREE.Vertex(J.position.clone()))}}U=0;for(z=o.faces.length;U<z;U++){J=o.faces[U];J.a=H[J.a];J.b=H[J.b];J.c=H[J.c];J.d=H[J.d]}o.vertices=F})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
-var Cylinder=function(b,d,c,f,g,h){function j(o,u,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(o,u,y)))}THREE.Geometry.call(this);var k=this,n=Math.PI,p=f/2;for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*d,Math.cos(2*n*f/b)*d,-p);for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*c,Math.cos(2*n*f/b)*c,p);for(f=0;f<b;f++)k.faces.push(new THREE.Face4(f,f+b,b+(f+1)%b,(f+1)%b));if(c>0){j(0,0,-p-(h||0));for(f=b;f<b+b/2;f++)k.faces.push(new THREE.Face4(2*b,(2*f-2*b)%b,(2*f-2*b+1)%b,(2*f-2*b+2)%b))}if(d>0){j(0,0,p+(g||0));
|
|
|
|
|
|
+var Cylinder=function(b,c,d,f,g,h){function j(o,u,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(o,u,y)))}THREE.Geometry.call(this);var k=this,n=Math.PI,p=f/2;for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*c,Math.cos(2*n*f/b)*c,-p);for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*d,Math.cos(2*n*f/b)*d,p);for(f=0;f<b;f++)k.faces.push(new THREE.Face4(f,f+b,b+(f+1)%b,(f+1)%b));if(d>0){j(0,0,-p-(h||0));for(f=b;f<b+b/2;f++)k.faces.push(new THREE.Face4(2*b,(2*f-2*b)%b,(2*f-2*b+1)%b,(2*f-2*b+2)%b))}if(c>0){j(0,0,p+(g||0));
|
|
for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
-var Icosahedron=function(b){function d(u,y,v){var B=Math.sqrt(u*u+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(u/B,y/B,v/B)))-1}function c(u,y,v,B){B.faces.push(new THREE.Face3(u,y,v))}function f(u,y){var v=g.vertices[u].position,B=g.vertices[y].position;return d((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
|
|
|
|
-1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,n,o,j);c(h.faces[k].b,p,n,j);c(h.faces[k].c,
|
|
|
|
-o,p,j);c(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
|
-function Lathe(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;for(var f=[],g=[],h=[],j=[],k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));f[k]=b[k].clone();g[k]=this.vertices.length-1}for(var n=(new THREE.Matrix4).setRotationZ(d),p=0;p<=this.angle+0.0010;p+=d){for(k=0;k<f.length;k++)if(p<this.angle){f[k]=n.multiplyVector3(f[k].clone());this.vertices.push(new THREE.Vertex(f[k]));h[k]=this.vertices.length-1}else h=j;p==0&&(j=g);for(k=
|
|
|
|
-0;k<g.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],g[k+1],g[k]));this.faceVertexUvs[0].push([new THREE.UV(p/c,k/b.length),new THREE.UV(p/c,(k+1)/b.length),new THREE.UV((p-d)/c,(k+1)/b.length),new THREE.UV((p-d)/c,k/b.length)])}g=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
|
-var Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,n=f+1;b/=c;var p=d/f;for(g=0;g<n;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+var Icosahedron=function(b){function c(u,y,v){var B=Math.sqrt(u*u+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(u/B,y/B,v/B)))-1}function d(u,y,v,B){B.faces.push(new THREE.Face3(u,y,v))}function f(u,y){var v=g.vertices[u].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
|
|
|
|
+1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,n,o,j);d(h.faces[k].b,p,n,j);d(h.faces[k].c,
|
|
|
|
+o,p,j);d(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
|
+function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;for(var f=[],g=[],h=[],j=[],k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));f[k]=b[k].clone();g[k]=this.vertices.length-1}for(var n=(new THREE.Matrix4).setRotationZ(c),p=0;p<=this.angle+0.0010;p+=c){for(k=0;k<f.length;k++)if(p<this.angle){f[k]=n.multiplyVector3(f[k].clone());this.vertices.push(new THREE.Vertex(f[k]));h[k]=this.vertices.length-1}else h=j;p==0&&(j=g);for(k=
|
|
|
|
+0;k<g.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],g[k+1],g[k]));this.faceVertexUvs[0].push([new THREE.UV(p/d,k/b.length),new THREE.UV(p/d,(k+1)/b.length),new THREE.UV((p-c)/d,(k+1)/b.length),new THREE.UV((p-c)/d,k/b.length)])}g=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
|
+var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,n=f+1;b/=d;var p=c/f;for(g=0;g<n;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
-var Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,y=n*Math.sin(u*g);u=n*Math.cos(u*g);(c==0||c==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,y)))-1);p.push(o)}d.push(p)}var v,B,C;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){p=f==h-1;j=d[c][p?0:f+1];k=d[c][p?h-1:f];n=d[c-1][p?h-1:f];p=d[c-1][p?
|
|
|
|
-0:f+1];y=c/(g-1);v=(c-1)/(g-1);B=(f+1)/h;u=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-u,y);u=new THREE.UV(1-u,v);var F=new THREE.UV(1-B,v);if(c<d.length-1){v=this.vertices[j].position.clone();B=this.vertices[k].position.clone();C=this.vertices[n].position.clone();v.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.faceVertexUvs[0].push([o,y,u])}if(c>1){v=this.vertices[j].position.clone();
|
|
|
|
|
|
+var Sphere=function(b,c,d){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6);c=[];for(d=0;d<j+1;d++){f=d/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,y=n*Math.sin(u*g);u=n*Math.cos(u*g);(d==0||d==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,y)))-1);p.push(o)}c.push(p)}var v,B,C;g=c.length;for(d=0;d<g;d++){h=c[d].length;if(d>0)for(f=0;f<h;f++){p=f==h-1;j=c[d][p?0:f+1];k=c[d][p?h-1:f];n=c[d-1][p?h-1:f];p=c[d-1][p?
|
|
|
|
+0:f+1];y=d/(g-1);v=(d-1)/(g-1);B=(f+1)/h;u=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-u,y);u=new THREE.UV(1-u,v);var F=new THREE.UV(1-B,v);if(d<c.length-1){v=this.vertices[j].position.clone();B=this.vertices[k].position.clone();C=this.vertices[n].position.clone();v.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.faceVertexUvs[0].push([o,y,u])}if(d>1){v=this.vertices[j].position.clone();
|
|
B=this.vertices[n].position.clone();C=this.vertices[p].position.clone();v.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.faceVertexUvs[0].push([o,u,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
B=this.vertices[n].position.clone();C=this.vertices[p].position.clone();v.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.faceVertexUvs[0].push([o,u,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
-var Torus=function(b,d,c,f){this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/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([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
|
|
|
|
-1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));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[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
|
-var TorusKnot=function(b,d,c,f,g,h,j){function k(u,y,v,B,C,F){y=v/B*u;v=Math.cos(y);return new THREE.Vector3(C*(2+v)*0.5*Math.cos(u),C*(2+v)*Math.sin(u)*0.5,F*C*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var n=
|
|
|
|
-b/this.segmentsR*2*this.p*Math.PI;j=d/this.segmentsT*2*Math.PI;g=k(n,j,this.q,this.p,this.radius,this.heightScale);n=k(n+0.01,j,this.q,this.p,this.radius,this.heightScale);c.x=n.x-g.x;c.y=n.y-g.y;c.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();n=this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.z;this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
|
|
|
|
-0;d<this.segmentsT;++d){h=(b+1)%this.segmentsR;j=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[h][d];f=this.grid[b][j];h=this.grid[h][j];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);n=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var p=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,c,f));this.faceVertexUvs[0].push([j,n,p]);this.faces.push(new THREE.Face3(h,f,c));this.faceVertexUvs[0].push([o,
|
|
|
|
|
|
+var Torus=function(b,c,d,f){this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){f=d/this.segmentsT*2*Math.PI;var 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([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
|
|
|
|
+1;d<=this.segmentsT;++d){f=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(f,g,h,j));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[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
|
+var TorusKnot=function(b,c,d,f,g,h,j){function k(u,y,v,B,C,F){y=v/B*u;v=Math.cos(y);return new THREE.Vector3(C*(2+v)*0.5*Math.cos(u),C*(2+v)*Math.sin(u)*0.5,F*C*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var n=
|
|
|
|
+b/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;g=k(n,j,this.q,this.p,this.radius,this.heightScale);n=k(n+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=n.x-g.x;d.y=n.y-g.y;d.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(d,f);f.cross(h,d);h.normalize();f.normalize();n=this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.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){h=(b+1)%this.segmentsR;j=(c+1)%this.segmentsT;g=this.grid[b][c];d=this.grid[h][c];f=this.grid[b][j];h=this.grid[h][j];j=new THREE.UV(b/this.segmentsR,c/this.segmentsT);n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT);var p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,d,f));this.faceVertexUvs[0].push([j,n,p]);this.faces.push(new THREE.Face3(h,f,d));this.faceVertexUvs[0].push([o,
|
|
p,n])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
p,n])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;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 d="Loaded ";d+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
|
|
-this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,n){var p=new Image;p.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),u=Math.pow(2,Math.round(Math.log(this.height)/
|
|
|
|
|
|
+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,d){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],d)]},createMaterial:function(b,c){function d(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,n){var p=new Image;p.onload=function(){if(!d(this.width)||!d(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),u=Math.pow(2,Math.round(Math.log(this.height)/
|
|
Math.LN2));k.image.width=o;k.image.height=u;k.image.getContext("2d").drawImage(this,0,0,o,u)}else k.image=this;k.needsUpdate=!0};p.src=n}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:b.vertexColors?THREE.VertexColors:!1,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=
|
|
Math.LN2));k.image.width=o;k.image.height=u;k.image.getContext("2d").drawImage(this,0,0,o,u)}else k.image=this;k.needsUpdate=!0};p.src=n}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:b.vertexColors?THREE.VertexColors:!1,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="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!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=
|
|
|
|
-b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
-THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
|
-THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,u,y,v,B,C,F,H,U,z=b.faces;p=b.vertices;var J=b.normals,L=b.colors,M=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&M++;for(g=0;g<M;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=p.length;k<n;){o=new THREE.Vertex;o.position.x=p[k++];o.position.y=p[k++];o.position.z=
|
|
|
|
|
|
+THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.mapDiffuse&&c){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=
|
|
|
|
+b.DbgColor;if(b.mapLightmap&&c){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,c+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
+THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(d);b=new Worker(d);b.onmessage=function(h){c.createModel(h.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,u,y,v,B,C,F,H,U,z=b.faces;p=b.vertices;var J=b.normals,L=b.colors,M=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&M++;for(g=0;g<M;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=p.length;k<n;){o=new THREE.Vertex;o.position.x=p[k++];o.position.y=p[k++];o.position.z=
|
|
p[k++];f.vertices.push(o)}k=0;for(n=z.length;k<n;){v=z[k++];p=v&1;j=v&2;g=v&4;h=v&8;u=v&16;o=v&32;B=v&64;v&=128;if(p){C=new THREE.Face4;C.a=z[k++];C.b=z[k++];C.c=z[k++];C.d=z[k++];p=4}else{C=new THREE.Face3;C.a=z[k++];C.b=z[k++];C.c=z[k++];p=3}if(j){j=z[k++];C.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<M;g++){F=b.uvs[g];y=z[k++];U=F[y*2];y=F[y*2+1];f.faceUvs[g][j]=new THREE.UV(U,y)}if(h)for(g=0;g<M;g++){F=b.uvs[g];H=[];for(h=0;h<p;h++){y=z[k++];U=F[y*2];y=F[y*2+1];H[h]=new THREE.UV(U,
|
|
p[k++];f.vertices.push(o)}k=0;for(n=z.length;k<n;){v=z[k++];p=v&1;j=v&2;g=v&4;h=v&8;u=v&16;o=v&32;B=v&64;v&=128;if(p){C=new THREE.Face4;C.a=z[k++];C.b=z[k++];C.c=z[k++];C.d=z[k++];p=4}else{C=new THREE.Face3;C.a=z[k++];C.b=z[k++];C.c=z[k++];p=3}if(j){j=z[k++];C.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<M;g++){F=b.uvs[g];y=z[k++];U=F[y*2];y=F[y*2+1];f.faceUvs[g][j]=new THREE.UV(U,y)}if(h)for(g=0;g<M;g++){F=b.uvs[g];H=[];for(h=0;h<p;h++){y=z[k++];U=F[y*2];y=F[y*2+1];H[h]=new THREE.UV(U,
|
|
y)}f.faceVertexUvs[g][j]=H}if(u){u=z[k++]*3;h=new THREE.Vector3;h.x=J[u++];h.y=J[u++];h.z=J[u];C.normal=h}if(o)for(g=0;g<p;g++){u=z[k++]*3;h=new THREE.Vector3;h.x=J[u++];h.y=J[u++];h.z=J[u];C.vertexNormals.push(h)}if(B){o=new THREE.Color(z[k++]);C.color=o}if(v)for(g=0;g<p;g++){o=z[k++];o=new THREE.Color(L[o]);C.vertexColors.push(o)}f.faces.push(C)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,
|
|
y)}f.faceVertexUvs[g][j]=H}if(u){u=z[k++]*3;h=new THREE.Vector3;h.x=J[u++];h.y=J[u++];h.z=J[u];C.normal=h}if(o)for(g=0;g<p;g++){u=z[k++]*3;h=new THREE.Vector3;h.x=J[u++];h.y=J[u++];h.z=J[u];C.vertexNormals.push(h)}if(B){o=new THREE.Color(z[k++]);C.color=o}if(v)for(g=0;g<p;g++){o=z[k++];o=new THREE.Color(L[o]);C.vertexColors.push(o)}f.faces.push(C)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,
|
|
k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];dstVertices=f.morphTargets[g].vertices;srcVertices=b.morphTargets[g].vertices;j=0;for(k=srcVertices.length;j<
|
|
k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];dstVertices=f.morphTargets[g].vertices;srcVertices=b.morphTargets[g].vertices;j=0;for(k=srcVertices.length;j<
|
|
-k;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();f.computeCentroids();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
-THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
|
|
-d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,n=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){n==0&&(n=j.getResponseHeader("Content-Length"));h({total:n,loaded:j.responseText.length})}}else j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(N,X){var ma=o(N,X),Ea=o(N,X+1),Ka=o(N,X+2),ya=o(N,X+3),ia=(ya<<1&255|Ka>>7)-127;ma|=(Ka&127)<<16|Ea<<8;if(ma==0&&ia==-127)return 0;return(1-2*(ya>>7))*(1+ma*Math.pow(2,-23))*Math.pow(2,ia)}function k(N,X){var ma=o(N,X),Ea=o(N,X+1),Ka=o(N,X+2);return(o(N,X+3)<<24)+(Ka<<16)+(Ea<<8)+ma}function n(N,X){var ma=o(N,X);return(o(N,X+1)<<8)+ma}function p(N,X){var ma=o(N,X);return ma>
|
|
|
|
|
|
+k;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();f.computeCentroids();f.computeFaceNormals();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
+THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c);b=(new Date).getTime();c=new Worker(c);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,d,g,f,h)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
|
|
|
|
+c.postMessage(b)},loadAjaxBuffers:function(b,c,d,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,n=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,g,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){n==0&&(n=j.getResponseHeader("Content-Length"));h({total:n,loaded:j.responseText.length})}}else j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,f){var g=function(h){function j(N,X){var ma=o(N,X),Ea=o(N,X+1),Ka=o(N,X+2),ya=o(N,X+3),ia=(ya<<1&255|Ka>>7)-127;ma|=(Ka&127)<<16|Ea<<8;if(ma==0&&ia==-127)return 0;return(1-2*(ya>>7))*(1+ma*Math.pow(2,-23))*Math.pow(2,ia)}function k(N,X){var ma=o(N,X),Ea=o(N,X+1),Ka=o(N,X+2);return(o(N,X+3)<<24)+(Ka<<16)+(Ea<<8)+ma}function n(N,X){var ma=o(N,X);return(o(N,X+1)<<8)+ma}function p(N,X){var ma=o(N,X);return ma>
|
|
127?ma-256:ma}function o(N,X){return N.charCodeAt(X)&255}function u(N){var X,ma,Ea;X=k(b,N);ma=k(b,N+M);Ea=k(b,N+Fa);N=n(b,N+oa);THREE.BinaryLoader.prototype.f3(H,X,ma,Ea,N)}function y(N){var X,ma,Ea,Ka,ya,ia;X=k(b,N);ma=k(b,N+M);Ea=k(b,N+Fa);Ka=n(b,N+oa);ya=k(b,N+xa);ia=k(b,N+Z);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(H,J,X,ma,Ea,Ka,ya,ia,N)}function v(N){var X,ma,Ea,Ka;X=k(b,N);ma=k(b,N+da);Ea=k(b,N+Ca);Ka=k(b,N+Aa);N=n(b,N+Ha);THREE.BinaryLoader.prototype.f4(H,X,ma,Ea,Ka,N)}function B(N){var X,
|
|
127?ma-256:ma}function o(N,X){return N.charCodeAt(X)&255}function u(N){var X,ma,Ea;X=k(b,N);ma=k(b,N+M);Ea=k(b,N+Fa);N=n(b,N+oa);THREE.BinaryLoader.prototype.f3(H,X,ma,Ea,N)}function y(N){var X,ma,Ea,Ka,ya,ia;X=k(b,N);ma=k(b,N+M);Ea=k(b,N+Fa);Ka=n(b,N+oa);ya=k(b,N+xa);ia=k(b,N+Z);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(H,J,X,ma,Ea,Ka,ya,ia,N)}function v(N){var X,ma,Ea,Ka;X=k(b,N);ma=k(b,N+da);Ea=k(b,N+Ca);Ka=k(b,N+Aa);N=n(b,N+Ha);THREE.BinaryLoader.prototype.f4(H,X,ma,Ea,Ka,N)}function B(N){var X,
|
|
ma,Ea,Ka,ya,ia,m,A;X=k(b,N);ma=k(b,N+da);Ea=k(b,N+Ca);Ka=k(b,N+Aa);ya=n(b,N+Ha);ia=k(b,N+qa);m=k(b,N+$);A=k(b,N+pa);N=k(b,N+Da);THREE.BinaryLoader.prototype.f4n(H,J,X,ma,Ea,Ka,ya,ia,m,A,N)}function C(N){var X,ma;X=k(b,N);ma=k(b,N+ga);N=k(b,N+Y);THREE.BinaryLoader.prototype.uv3(H.faceVertexUvs[0],L[X*2],L[X*2+1],L[ma*2],L[ma*2+1],L[N*2],L[N*2+1])}function F(N){var X,ma,Ea;X=k(b,N);ma=k(b,N+la);Ea=k(b,N+Ga);N=k(b,N+ka);THREE.BinaryLoader.prototype.uv4(H.faceVertexUvs[0],L[X*2],L[X*2+1],L[ma*2],L[ma*
|
|
ma,Ea,Ka,ya,ia,m,A;X=k(b,N);ma=k(b,N+da);Ea=k(b,N+Ca);Ka=k(b,N+Aa);ya=n(b,N+Ha);ia=k(b,N+qa);m=k(b,N+$);A=k(b,N+pa);N=k(b,N+Da);THREE.BinaryLoader.prototype.f4n(H,J,X,ma,Ea,Ka,ya,ia,m,A,N)}function C(N){var X,ma;X=k(b,N);ma=k(b,N+ga);N=k(b,N+Y);THREE.BinaryLoader.prototype.uv3(H.faceVertexUvs[0],L[X*2],L[X*2+1],L[ma*2],L[ma*2+1],L[N*2],L[N*2+1])}function F(N){var X,ma,Ea;X=k(b,N);ma=k(b,N+la);Ea=k(b,N+Ga);N=k(b,N+ka);THREE.BinaryLoader.prototype.uv4(H.faceVertexUvs[0],L[X*2],L[X*2+1],L[ma*2],L[ma*
|
|
2+1],L[Ea*2],L[Ea*2+1],L[N*2],L[N*2+1])}var H=this,U=0,z,J=[],L=[],M,Fa,oa,xa,Z,e,da,Ca,Aa,Ha,qa,$,pa,Da,ga,Y,la,Ga,ka,na,wa,Ua,cb,ab,Pa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(H,f,h);z={signature:b.substr(U,8),header_bytes:o(b,U+8),vertex_coordinate_bytes:o(b,U+9),normal_coordinate_bytes:o(b,U+10),uv_coordinate_bytes:o(b,U+11),vertex_index_bytes:o(b,U+12),normal_index_bytes:o(b,U+13),uv_index_bytes:o(b,U+14),material_index_bytes:o(b,U+15),nvertices:k(b,U+16),nnormals:k(b,
|
|
2+1],L[Ea*2],L[Ea*2+1],L[N*2],L[N*2+1])}var H=this,U=0,z,J=[],L=[],M,Fa,oa,xa,Z,e,da,Ca,Aa,Ha,qa,$,pa,Da,ga,Y,la,Ga,ka,na,wa,Ua,cb,ab,Pa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(H,f,h);z={signature:b.substr(U,8),header_bytes:o(b,U+8),vertex_coordinate_bytes:o(b,U+9),normal_coordinate_bytes:o(b,U+10),uv_coordinate_bytes:o(b,U+11),vertex_index_bytes:o(b,U+12),normal_index_bytes:o(b,U+13),uv_index_bytes:o(b,U+14),material_index_bytes:o(b,U+15),nvertices:k(b,U+16),nnormals:k(b,
|
|
@@ -416,23 +430,23 @@ Pa=z.vertex_index_bytes*4+z.material_index_bytes;na=z.ntri_flat*h;wa=z.ntri_smoo
|
|
THREE.BinaryLoader.prototype.v(H,X,ma,Ea)}return z.nvertices*Ka}(U);U+=function(N){for(var X,ma,Ea,Ka=z.normal_coordinate_bytes*3,ya=N+z.nnormals*Ka;N<ya;N+=Ka){X=p(b,N);ma=p(b,N+z.normal_coordinate_bytes);Ea=p(b,N+z.normal_coordinate_bytes*2);J.push(X/127,ma/127,Ea/127)}return z.nnormals*Ka}(U);U+=function(N){for(var X,ma,Ea=z.uv_coordinate_bytes*2,Ka=N+z.nuvs*Ea;N<Ka;N+=Ea){X=j(b,N);ma=j(b,N+z.uv_coordinate_bytes);L.push(X,ma)}return z.nuvs*Ea}(U);na=U+na;wa=na+wa;Ua=wa+Ua;cb=Ua+cb;ab=cb+ab;h=ab+
|
|
THREE.BinaryLoader.prototype.v(H,X,ma,Ea)}return z.nvertices*Ka}(U);U+=function(N){for(var X,ma,Ea,Ka=z.normal_coordinate_bytes*3,ya=N+z.nnormals*Ka;N<ya;N+=Ka){X=p(b,N);ma=p(b,N+z.normal_coordinate_bytes);Ea=p(b,N+z.normal_coordinate_bytes*2);J.push(X/127,ma/127,Ea/127)}return z.nnormals*Ka}(U);U+=function(N){for(var X,ma,Ea=z.uv_coordinate_bytes*2,Ka=N+z.nuvs*Ea;N<Ka;N+=Ea){X=j(b,N);ma=j(b,N+z.uv_coordinate_bytes);L.push(X,ma)}return z.nuvs*Ea}(U);na=U+na;wa=na+wa;Ua=wa+Ua;cb=Ua+cb;ab=cb+ab;h=ab+
|
|
h;Pa=h+Pa;(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes,Ea=ma+z.uv_index_bytes*3,Ka=N+z.ntri_flat_uv*Ea;for(X=N;X<Ka;X+=Ea){u(X);C(X+ma)}return Ka-N})(wa);(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ea=ma+z.uv_index_bytes*3,Ka=N+z.ntri_smooth_uv*Ea;for(X=N;X<Ka;X+=Ea){y(X);C(X+ma)}return Ka-N})(Ua);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes,Ea=ma+z.uv_index_bytes*4,Ka=N+z.nquad_flat_uv*Ea;for(X=N;X<Ka;X+=
|
|
h;Pa=h+Pa;(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes,Ea=ma+z.uv_index_bytes*3,Ka=N+z.ntri_flat_uv*Ea;for(X=N;X<Ka;X+=Ea){u(X);C(X+ma)}return Ka-N})(wa);(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ea=ma+z.uv_index_bytes*3,Ka=N+z.ntri_smooth_uv*Ea;for(X=N;X<Ka;X+=Ea){y(X);C(X+ma)}return Ka-N})(Ua);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes,Ea=ma+z.uv_index_bytes*4,Ka=N+z.nquad_flat_uv*Ea;for(X=N;X<Ka;X+=
|
|
Ea){v(X);F(X+ma)}return Ka-N})(h);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ea=ma+z.uv_index_bytes*4,Ka=N+z.nquad_smooth_uv*Ea;for(X=N;X<Ka;X+=Ea){B(X);F(X+ma)}return Ka-N})(Pa);(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes,Ea=N+z.ntri_flat*ma;for(X=N;X<Ea;X+=ma)u(X);return Ea-N})(U);(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ea=N+z.ntri_smooth*ma;for(X=N;X<Ea;X+=ma)y(X);return Ea-
|
|
Ea){v(X);F(X+ma)}return Ka-N})(h);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ea=ma+z.uv_index_bytes*4,Ka=N+z.nquad_smooth_uv*Ea;for(X=N;X<Ka;X+=Ea){B(X);F(X+ma)}return Ka-N})(Pa);(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes,Ea=N+z.ntri_flat*ma;for(X=N;X<Ea;X+=ma)u(X);return Ea-N})(U);(function(N){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ea=N+z.ntri_smooth*ma;for(X=N;X<Ea;X+=ma)y(X);return Ea-
|
|
-N})(na);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes,Ea=N+z.nquad_flat*ma;for(X=N;X<Ea;X+=ma)v(X);return Ea-N})(cb);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ea=N+z.nquad_smooth*ma;for(X=N;X<Ea;X+=ma)B(X);return Ea-N})(ab);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,
|
|
|
|
-d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,n){h=b.materials[h];var p=d[k*3],o=d[k*3+1];k=d[k*3+2];var u=d[n*3],y=d[n*3+1];n=d[n*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(u,y,n)],null,h))},f4n:function(b,d,c,f,g,h,j,k,n,p,o){j=b.materials[j];var u=d[n*3],y=d[n*3+1];n=
|
|
|
|
-d[n*3+2];var v=d[p*3],B=d[p*3+1];p=d[p*3+2];var C=d[o*3],F=d[o*3+1];o=d[o*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*3],d[k*3+1],d[k*3+2]),new THREE.Vector3(u,y,n),new THREE.Vector3(v,B,p),new THREE.Vector3(C,F,o)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(d,c));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,
|
|
|
|
|
|
+N})(na);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes,Ea=N+z.nquad_flat*ma;for(X=N;X<Ea;X+=ma)v(X);return Ea-N})(cb);(function(N){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ea=N+z.nquad_smooth*ma;for(X=N;X<Ea;X+=ma)B(X);return Ea-N})(ab);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,f)))},f3:function(b,
|
|
|
|
+c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,n){h=b.materials[h];var p=c[k*3],o=c[k*3+1];k=c[k*3+2];var u=c[n*3],y=c[n*3+1];n=c[n*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(u,y,n)],null,h))},f4n:function(b,c,d,f,g,h,j,k,n,p,o){j=b.materials[j];var u=c[n*3],y=c[n*3+1];n=
|
|
|
|
+c[n*3+2];var v=c[p*3],B=c[p*3+1];p=c[p*3+2];var C=c[o*3],F=c[o*3+1];o=c[o*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,y,n),new THREE.Vector3(v,B,p),new THREE.Vector3(C,F,o)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,
|
|
n));b.push(p)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
n));b.push(p)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
-THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
|
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=p;g[h]=this.lerp(o[c],o[c+3],j);g[h+1]=this.lerp(o[c+1],o[c+4],j);g[h+2]=this.lerp(o[c+2],o[c+5],j)};this.VIntY=function(c,f,g,h,j,k,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
|
|
|
|
-2]=p;f=c+this.yd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=p+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(o[c],o[f],j);g[h+1]=this.lerp(o[c+1],o[f+1],j);g[h+2]=this.lerp(o[c+2],o[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
|
|
|
|
-this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,u=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,B=n+this.yd+this.zd,C=0,F=this.field[h],H=this.field[n],U=this.field[p],z=this.field[u],J=this.field[o],L=this.field[y],M=this.field[v],Fa=this.field[B];F<j&&(C|=1);H<j&&(C|=2);U<j&&(C|=8);z<j&&(C|=4);J<j&&(C|=16);L<j&&(C|=32);M<j&&(C|=128);Fa<j&&(C|=64);var oa=THREE.edgeTable[C];if(oa==0)return 0;
|
|
|
|
-var xa=this.delta,Z=c+xa,e=f+xa;xa=g+xa;if(oa&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,F,H)}if(oa&2){this.compNorm(n);this.compNorm(u);this.VIntY(n*3,this.vlist,this.nlist,3,j,Z,f,g,H,z)}if(oa&4){this.compNorm(p);this.compNorm(u);this.VIntX(p*3,this.vlist,this.nlist,6,j,c,e,g,U,z)}if(oa&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,F,U)}if(oa&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
|
|
|
|
-12,j,c,f,xa,J,L)}if(oa&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,Z,f,xa,L,Fa)}if(oa&64){this.compNorm(v);this.compNorm(B);this.VIntX(v*3,this.vlist,this.nlist,18,j,c,e,xa,M,Fa)}if(oa&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,c,f,xa,J,M)}if(oa&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,F,J)}if(oa&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,Z,
|
|
|
|
-f,g,H,L)}if(oa&1024){this.compNorm(u);this.compNorm(B);this.VIntZ(u*3,this.vlist,this.nlist,30,j,Z,e,g,z,Fa)}if(oa&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,c,e,g,U,M)}C<<=4;for(j=h=0;THREE.triTable[C+j]!=-1;){c=C+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=c[g];this.positionArray[n+1]=c[g+
|
|
|
|
-1];this.positionArray[n+2]=c[g+2];this.positionArray[n+3]=c[h];this.positionArray[n+4]=c[h+1];this.positionArray[n+5]=c[h+2];this.positionArray[n+6]=c[j];this.positionArray[n+7]=c[j+1];this.positionArray[n+8]=c[j+2];this.normalArray[n]=f[g];this.normalArray[n+1]=f[g+1];this.normalArray[n+2]=f[g+2];this.normalArray[n+3]=f[h];this.normalArray[n+4]=f[h+1];this.normalArray[n+5]=f[h+2];this.normalArray[n+6]=f[j];this.normalArray[n+7]=f[j+1];this.normalArray[n+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
|
|
|
|
-this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,p=f*this.size,o=c*this.size,u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
|
|
|
|
-this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,C,F,H,U,z;u<n;u++){o=this.size2*u;C=u/this.size-g;U=C*C;for(C=y;C<p;C++){F=o+this.size*C;B=C/this.size-f;z=B*B;for(B=v;B<k;B++){H=B/this.size-c;H=h/(1.0E-6+H*H+z+U)-j;H>0&&(this.field[F+B]+=H)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,u=this.zd,y=this.field,v=p*Math.sqrt(c/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
|
|
|
|
-0;j<p;j++)y[u*j+n]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,n,p,o=this.size,u=this.yd,y=this.zd,v=this.field,B=o*Math.sqrt(c/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=c/(1.0E-4+g)-f;if(k>0){n=h*u;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)v[y*j+p]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;
|
|
|
|
-for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,n,p,o,u,y=this.size-2;for(j=1;j<y;j++){u=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,n,p,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry;
|
|
|
|
-this.render(function(g){var h,j,k,n,p,o,u,y;for(h=0;h<g.count;h++){p=h*3;u=p+1;y=p+2;j=g.positionArray[p];k=g.positionArray[u];n=g.positionArray[y];o=new THREE.Vector3(j,k,n);j=g.normalArray[p];k=g.normalArray[u];n=g.normalArray[y];p=new THREE.Vector3(j,k,n);p.normalize();p=new THREE.Vertex(o,p);f.vertices.push(p)}nfaces=g.count/3;for(h=0;h<nfaces;h++){p=(c+h)*3;u=p+1;y=p+2;o=f.vertices[p].normal;j=f.vertices[u].normal;k=f.vertices[y].normal;p=new THREE.Face3(p,u,y,[o,j,k]);f.faces.push(p)}c+=nfaces;
|
|
|
|
|
|
+THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(d){this.isolation=80;this.size=d;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
|
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(d,f,g){return d+(f-d)*g};this.VIntX=function(d,f,g,h,j,k,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=p;g[h]=this.lerp(o[d],o[d+3],j);g[h+1]=this.lerp(o[d+1],o[d+4],j);g[h+2]=this.lerp(o[d+2],o[d+5],j)};this.VIntY=function(d,f,g,h,j,k,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
|
|
|
|
+2]=p;f=d+this.yd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.VIntZ=function(d,f,g,h,j,k,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=p+j*this.delta;f=d+this.zd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.compNorm=function(d){var f=d*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[d-1]-this.field[d+1];this.normal_cache[f+1]=this.field[d-this.yd]-
|
|
|
|
+this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,u=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,B=n+this.yd+this.zd,C=0,F=this.field[h],H=this.field[n],U=this.field[p],z=this.field[u],J=this.field[o],L=this.field[y],M=this.field[v],Fa=this.field[B];F<j&&(C|=1);H<j&&(C|=2);U<j&&(C|=8);z<j&&(C|=4);J<j&&(C|=16);L<j&&(C|=32);M<j&&(C|=128);Fa<j&&(C|=64);var oa=THREE.edgeTable[C];if(oa==0)return 0;
|
|
|
|
+var xa=this.delta,Z=d+xa,e=f+xa;xa=g+xa;if(oa&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,F,H)}if(oa&2){this.compNorm(n);this.compNorm(u);this.VIntY(n*3,this.vlist,this.nlist,3,j,Z,f,g,H,z)}if(oa&4){this.compNorm(p);this.compNorm(u);this.VIntX(p*3,this.vlist,this.nlist,6,j,d,e,g,U,z)}if(oa&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,F,U)}if(oa&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
|
|
|
|
+12,j,d,f,xa,J,L)}if(oa&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,Z,f,xa,L,Fa)}if(oa&64){this.compNorm(v);this.compNorm(B);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,e,xa,M,Fa)}if(oa&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,d,f,xa,J,M)}if(oa&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,F,J)}if(oa&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,Z,
|
|
|
|
+f,g,H,L)}if(oa&1024){this.compNorm(u);this.compNorm(B);this.VIntZ(u*3,this.vlist,this.nlist,30,j,Z,e,g,z,Fa)}if(oa&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,d,e,g,U,M)}C<<=4;for(j=h=0;THREE.triTable[C+j]!=-1;){d=C+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=d[g];this.positionArray[n+1]=d[g+
|
|
|
|
+1];this.positionArray[n+2]=d[g+2];this.positionArray[n+3]=d[h];this.positionArray[n+4]=d[h+1];this.positionArray[n+5]=d[h+2];this.positionArray[n+6]=d[j];this.positionArray[n+7]=d[j+1];this.positionArray[n+8]=d[j+2];this.normalArray[n]=f[g];this.normalArray[n+1]=f[g+1];this.normalArray[n+2]=f[g+2];this.normalArray[n+3]=f[h];this.normalArray[n+4]=f[h+1];this.normalArray[n+5]=f[h+2];this.normalArray[n+6]=f[j];this.normalArray[n+7]=f[j+1];this.normalArray[n+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
|
|
|
|
+this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;d(this)}};this.addBall=function(d,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,p=f*this.size,o=d*this.size,u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
|
|
|
|
+this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,C,F,H,U,z;u<n;u++){o=this.size2*u;C=u/this.size-g;U=C*C;for(C=y;C<p;C++){F=o+this.size*C;B=C/this.size-f;z=B*B;for(B=v;B<k;B++){H=B/this.size-d;H=h/(1.0E-6+H*H+z+U)-j;H>0&&(this.field[F+B]+=H)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,u=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
|
|
|
|
+0;j<p;j++)y[u*j+n]+=k}}};this.addPlaneY=function(d,f){var g,h,j,k,n,p,o=this.size,u=this.yd,y=this.zd,v=this.field,B=o*Math.sqrt(d/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=h*u;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)v[y*j+p]+=k}}}};this.addPlaneZ=function(d,f){var g,h,j,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;
|
|
|
|
+for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var d;for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var f,g,h,j,k,n,p,o,u,y=this.size-2;for(j=1;j<y;j++){u=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,n,p,f,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,f=new THREE.Geometry;
|
|
|
|
+this.render(function(g){var h,j,k,n,p,o,u,y;for(h=0;h<g.count;h++){p=h*3;u=p+1;y=p+2;j=g.positionArray[p];k=g.positionArray[u];n=g.positionArray[y];o=new THREE.Vector3(j,k,n);j=g.normalArray[p];k=g.normalArray[u];n=g.normalArray[y];p=new THREE.Vector3(j,k,n);p.normalize();p=new THREE.Vertex(o,p);f.vertices.push(p)}nfaces=g.count/3;for(h=0;h<nfaces;h++){p=(d+h)*3;u=p+1;y=p+2;o=f.vertices[p].normal;j=f.vertices[u].normal;k=f.vertices[y].normal;p=new THREE.Face3(p,u,y,[o,j,k]);f.faces.push(p)}d+=nfaces;
|
|
g.count=0});return f};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
g.count=0});return f};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|