|
@@ -1,6 +1,6 @@
|
|
|
// Three.js r36 - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
|
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,f,g,h,m,j;if(b==0)d=f=g=0;else{h=Math.floor(a*6);m=a*6-h;a=b*(1-c);j=b*(1-c*m);c=b*(1-c*(1-m));switch(h){case 1:d=j;f=b;g=a;break;case 2:d=a;f=b;g=c;break;case 3:d=a;f=j;g=b;break;case 4:d=c;f=a;g=b;break;case 5:d=b;f=a;g=j;break;case 6:case 0:d=b;f=c;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();
|
|
|
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,j,k;if(b==0)d=e=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();
|
|
|
this.updateStyleString()}},setHex:function(a){this.hex=~~a&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(a,c){this.set(a||0,c||0)};
|
|
|
THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
@@ -12,79 +12,79 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
|
|
|
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(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
|
|
|
THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,f=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(E,w,M,J){J=J.clone().subSelf(w);M=M.clone().subSelf(w);var N=E.clone().subSelf(w);E=J.dot(J);w=J.dot(M);J=J.dot(N);var R=M.dot(M);M=M.dot(N);N=1/(E*R-w*w);R=(R*J-w*M)*N;E=(E*M-w*J)*N;return R>0&&E>0&&R+E<1}var b,d,f,g,h,m,j,n,p,v,
|
|
|
-u,o=a.geometry,x=o.vertices,B=[];b=0;for(d=o.faces.length;b<d;b++){f=o.faces[b];v=this.origin.clone();u=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());m=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());p=u.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,v))/p;v=v.addSelf(u.multiplyScalar(n));
|
|
|
-if(f instanceof THREE.Face3){if(c(v,g,h,m)){f={distance:this.origin.distanceTo(v),point:v,face:f,object:a};B.push(f)}}else if(f instanceof THREE.Face4&&(c(v,g,h,j)||c(v,h,m,j))){f={distance:this.origin.distanceTo(v),point:v,face:f,object:a};B.push(f)}}}return B}};
|
|
|
-THREE.Rectangle=function(){function a(){g=d-c;h=f-b}var c,b,d,f,g,h,m=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,n,p,v){m=!1;c=j;b=n;d=p;f=v;a()};this.addPoint=function(j,n){if(m){m=!1;c=j;b=n;d=j;f=n}else{c=c<j?c:j;b=b<n?b:n;d=d>j?d:j;f=f>n?f:n}a()};
|
|
|
-this.add3Points=function(j,n,p,v,u,o){if(m){m=!1;c=j<p?j<u?j:u:p<u?p:u;b=n<v?n<o?n:o:v<o?v:o;d=j>p?j>u?j:u:p>u?p:u;f=n>v?n>o?n:o:v>o?v:o}else{c=j<p?j<u?j<c?j:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c;b=n<v?n<o?n<b?n:b:o<b?o:b:v<o?v<b?v:b:o<b?o:b;d=j>p?j>u?j>d?j:d:u>d?u:d:p>u?p>d?p:d:u>d?u:d;f=n>v?n>o?n>f?n:f:o>f?o:f:v>o?v>f?v:f:o>f?o:f}a()};this.addRectangle=function(j){if(m){m=!1;c=j.getLeft();b=j.getTop();d=j.getRight();f=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();b=b<j.getTop()?b:j.getTop();d=d>j.getRight()?
|
|
|
-d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){c-=j;b-=j;d+=j;f+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();b=b>j.getTop()?b:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(b,j.getTop())>=0};this.empty=function(){m=!0;f=d=b=c=0;a()};this.isEmpty=function(){return m}};
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(I,A,J,z){z=z.clone().subSelf(A);J=J.clone().subSelf(A);var Q=I.clone().subSelf(A);I=z.dot(z);A=z.dot(J);z=z.dot(Q);var N=J.dot(J);J=J.dot(Q);Q=1/(I*N-A*A);N=(N*z-A*J)*Q;I=(I*J-A*z)*Q;return N>0&&I>0&&N+I<1}var b,d,e,g,h,j,k,o,w,y,
|
|
|
+x,t=a.geometry,B=t.vertices,G=[];b=0;for(d=t.faces.length;b<d;b++){e=t.faces[b];y=this.origin.clone();x=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(B[e.a].position.clone());h=k.multiplyVector3(B[e.b].position.clone());j=k.multiplyVector3(B[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(B[e.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(e.normal.clone());w=x.dot(o);if(w<0){o=o.dot((new THREE.Vector3).sub(g,y))/w;y=y.addSelf(x.multiplyScalar(o));
|
|
|
+if(e instanceof THREE.Face3){if(c(y,g,h,j)){e={distance:this.origin.distanceTo(y),point:y,face:e,object:a};G.push(e)}}else if(e instanceof THREE.Face4&&(c(y,g,h,k)||c(y,h,j,k))){e={distance:this.origin.distanceTo(y),point:y,face:e,object:a};G.push(e)}}}return G}};
|
|
|
+THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,o,w,y){j=!1;c=k;b=o;d=w;e=y;a()};this.addPoint=function(k,o){if(j){j=!1;c=k;b=o;d=k;e=o}else{c=c<k?c:k;b=b<o?b:o;d=d>k?d:k;e=e>o?e:o}a()};
|
|
|
+this.add3Points=function(k,o,w,y,x,t){if(j){j=!1;c=k<w?k<x?k:x:w<x?w:x;b=o<y?o<t?o:t:y<t?y:t;d=k>w?k>x?k:x:w>x?w:x;e=o>y?o>t?o:t:y>t?y:t}else{c=k<w?k<x?k<c?k:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c;b=o<y?o<t?o<b?o:b:t<b?t:b:y<t?y<b?y:b:t<b?t:b;d=k>w?k>x?k>d?k:d:x>d?x:d:w>x?w>d?w:d:x>d?x:d;e=o>y?o>t?o>e?o:e:t>e?t:e:y>t?y>e?y:e:t>e?t:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
|
|
|
+d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d<k.getRight()?d:k.getRight();e=e<k.getBottom()?e:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}};
|
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
|
-THREE.Matrix4=function(a,c,b,d,f,g,h,m,j,n,p,v,u,o,x,B){this.set(a||1,c||0,b||0,d||0,f||0,g||1,h||0,m||0,j||0,n||0,p||1,v||0,u||0,o||0,x||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(a,c,b,d,f,g,h,m,j,n,p,v,u,o,x,B){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=m;this.n31=j;this.n32=n;this.n33=p;this.n34=v;this.n41=u;this.n42=o;this.n43=x;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
|
|
|
-f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,f=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
|
|
|
-d+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
|
|
|
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,m=a.n22,j=a.n23,n=a.n24,p=a.n31,v=a.n32,u=a.n33,o=a.n34,x=a.n41,B=a.n42,E=a.n43,w=a.n44,M=c.n11,J=c.n12,N=c.n13,R=c.n14,da=c.n21,O=c.n22,
|
|
|
-e=c.n23,Y=c.n24,V=c.n31,ma=c.n32,ka=c.n33,K=c.n34;this.n11=b*M+d*da+f*V;this.n12=b*J+d*O+f*ma;this.n13=b*N+d*e+f*ka;this.n14=b*R+d*Y+f*K+g;this.n21=h*M+m*da+j*V;this.n22=h*J+m*O+j*ma;this.n23=h*N+m*e+j*ka;this.n24=h*R+m*Y+j*K+n;this.n31=p*M+v*da+u*V;this.n32=p*J+v*O+u*ma;this.n33=p*N+v*e+u*ka;this.n34=p*R+v*Y+u*K+o;this.n41=x*M+B*da+E*V;this.n42=x*J+B*O+E*ma;this.n43=x*N+B*e+E*ka;this.n44=x*R+B*Y+E*K+w;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=
|
|
|
+THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,o,w,y,x,t,B,G){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,o||0,w||1,y||0,x||0,t||0,B||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,o,w,y,x,t,B,G){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=w;this.n34=y;this.n41=x;this.n42=t;this.n43=B;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
|
|
|
+e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
|
|
|
+d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
|
|
|
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,w=a.n31,y=a.n32,x=a.n33,t=a.n34,B=a.n41,G=a.n42,I=a.n43,A=a.n44,J=c.n11,z=c.n12,Q=c.n13,N=c.n14,fa=c.n21,R=c.n22,
|
|
|
+f=c.n23,Y=c.n24,W=c.n31,na=c.n32,ja=c.n33,M=c.n34;this.n11=b*J+d*fa+e*W;this.n12=b*z+d*R+e*na;this.n13=b*Q+d*f+e*ja;this.n14=b*N+d*Y+e*M+g;this.n21=h*J+j*fa+k*W;this.n22=h*z+j*R+k*na;this.n23=h*Q+j*f+k*ja;this.n24=h*N+j*Y+k*M+o;this.n31=w*J+y*fa+x*W;this.n32=w*z+y*R+x*na;this.n33=w*Q+y*f+x*ja;this.n34=w*N+y*Y+x*M+t;this.n41=B*J+G*fa+I*W;this.n42=B*z+G*R+I*na;this.n43=B*Q+G*f+I*ja;this.n44=B*N+G*Y+I*M+A;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
|
|
|
-determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,m=this.n24,j=this.n31,n=this.n32,p=this.n33,v=this.n34,u=this.n41,o=this.n42,x=this.n43,B=this.n44;return d*h*n*u-b*m*n*u-d*g*p*u+c*m*p*u+b*g*v*u-c*h*v*u-d*h*j*o+b*m*j*o+d*f*p*o-a*m*p*o-b*f*v*o+a*h*v*o+d*g*j*x-c*m*j*x-d*f*n*x+a*m*n*x+c*f*v*x-a*g*v*x-b*g*j*B+c*h*j*B+b*f*n*B-a*h*n*B-c*f*p*B+a*g*p*B},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
|
|
|
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,w=this.n33,y=this.n34,x=this.n41,t=this.n42,B=this.n43,G=this.n44;return d*h*o*x-b*j*o*x-d*g*w*x+c*j*w*x+b*g*y*x-c*h*y*x-d*h*k*t+b*j*k*t+d*e*w*t-a*j*w*t-b*e*y*t+a*h*y*t+d*g*k*B-c*j*k*B-d*e*o*B+a*j*o*B+c*e*y*B-a*g*y*B-b*g*k*G+c*h*k*G+b*e*o*G-a*h*o*G-c*e*w*G+a*g*w*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
|
|
|
a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;
|
|
|
this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
|
|
|
a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
|
|
|
-setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),f=1-b,g=a.x,h=a.y,m=
|
|
|
-a.z,j=f*g,n=f*h;this.set(j*g+b,j*h-d*m,j*m+d*h,0,j*h+d*m,n*h+b,n*m-d*g,0,j*m-d*h,n*m+d*g,f*m*m+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,m=c*b;this.n11=f*g;this.n12=-f*d;this.n13=b;this.n21=m*g+a*d;this.n22=-m*d+a*g;this.n23=-c*f;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*f;return this},
|
|
|
-setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,f=a.w,g=c+c,h=b+b,m=d+d;a=c*g;var j=c*h;c*=m;var n=b*h;b*=m;d*=m;g*=f;h*=f;f*=m;this.n11=1-(n+d);this.n12=j-f;this.n13=c+h;this.n21=j+f;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
|
|
|
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,m=a.n22,j=a.n23,n=a.n24,p=a.n31,v=a.n32,u=a.n33,o=a.n34,x=a.n41,B=a.n42,E=a.n43,w=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*o*B-n*u*B+n*v*E-m*o*E-j*v*w+m*u*w;c.n12=g*u*B-f*o*B-g*v*E+d*o*E+f*v*w-d*u*w;c.n13=f*n*B-g*j*B+g*m*E-d*n*E-f*m*w+d*j*w;c.n14=g*j*v-f*n*v-g*m*u+d*n*u+f*m*o-d*j*o;c.n21=n*u*x-j*o*x-n*p*E+h*o*E+j*p*w-h*u*w;c.n22=f*o*x-g*u*x+g*p*E-b*o*E-f*p*w+b*u*w;c.n23=g*j*x-f*n*x-g*h*E+b*n*E+f*h*w-b*j*w;
|
|
|
-c.n24=f*n*p-g*j*p+g*h*u-b*n*u-f*h*o+b*j*o;c.n31=m*o*x-n*v*x+n*p*B-h*o*B-m*p*w+h*v*w;c.n32=g*v*x-d*o*x-g*p*B+b*o*B+d*p*w-b*v*w;c.n33=f*n*x-g*m*x+g*h*B-b*n*B-d*h*w+b*m*w;c.n34=g*m*p-d*n*p-g*h*v+b*n*v+d*h*o-b*m*o;c.n41=j*v*x-m*u*x-j*p*B+h*u*B+m*p*E-h*v*E;c.n42=d*u*x-f*v*x+f*p*B-b*u*B-d*p*E+b*v*E;c.n43=f*m*x-d*j*x-f*h*B+b*j*B+d*h*E-b*m*E;c.n44=d*j*p-f*m*p+f*h*v-b*j*v-d*h*u+b*m*u;c.multiplyScalar(1/a.determinant());return c};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,v=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*m;b[5]=a*j;b[6]=a*n;b[7]=a*p;b[8]=a*v;return c};
|
|
|
-THREE.Matrix4.makeFrustum=function(a,c,b,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,d)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,b,d,f,g){var h,m,j,n;h=new THREE.Matrix4;m=c-a;j=b-d;n=g-f;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+a)/m);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((b+d)/j);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
+setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,j=
|
|
|
+a.z,k=e*g,o=e*h;this.set(k*g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,o*h+b,o*j-d*g,0,k*j-d*h,o*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},
|
|
|
+setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var o=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(o+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
|
|
|
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,w=a.n31,y=a.n32,x=a.n33,t=a.n34,B=a.n41,G=a.n42,I=a.n43,A=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*t*G-o*x*G+o*y*I-j*t*I-k*y*A+j*x*A;c.n12=g*x*G-e*t*G-g*y*I+d*t*I+e*y*A-d*x*A;c.n13=e*o*G-g*k*G+g*j*I-d*o*I-e*j*A+d*k*A;c.n14=g*k*y-e*o*y-g*j*x+d*o*x+e*j*t-d*k*t;c.n21=o*x*B-k*t*B-o*w*I+h*t*I+k*w*A-h*x*A;c.n22=e*t*B-g*x*B+g*w*I-b*t*I-e*w*A+b*x*A;c.n23=g*k*B-e*o*B-g*h*I+b*o*I+e*h*A-b*k*A;
|
|
|
+c.n24=e*o*w-g*k*w+g*h*x-b*o*x-e*h*t+b*k*t;c.n31=j*t*B-o*y*B+o*w*G-h*t*G-j*w*A+h*y*A;c.n32=g*y*B-d*t*B-g*w*G+b*t*G+d*w*A-b*y*A;c.n33=e*o*B-g*j*B+g*h*G-b*o*G-d*h*A+b*j*A;c.n34=g*j*w-d*o*w-g*h*y+b*o*y+d*h*t-b*j*t;c.n41=k*y*B-j*x*B-k*w*G+h*x*G+j*w*I-h*y*I;c.n42=d*x*B-e*y*B+e*w*G-b*x*G-d*w*I+b*y*I;c.n43=e*j*B-d*k*B-e*h*G+b*k*G+d*h*I-b*j*I;c.n44=d*k*w-e*j*w+e*h*y-b*k*y-d*h*x+b*j*x;c.multiplyScalar(1/a.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,w=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*o;b[7]=a*w;b[8]=a*y;return c};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,o;h=new THREE.Matrix4;j=c-a;k=b-d;o=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+e)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};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=
|
|
|
!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
|
|
|
undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.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(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
|
|
|
c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
|
|
|
-THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,f=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,m=d*f;this.w=h*g-m*b;this.x=h*b+m*g;this.y=d*c*g+a*f*b;this.z=a*f*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,f=this.w,g=a.x,h=a.y,m=a.z;a=a.w;this.x=c*a+f*g+b*m-d*h;this.y=b*a+f*h+d*g-c*m;this.z=d*a+f*m+c*h-b*g;this.w=f*a-c*g-b*h-d*m;return this},
|
|
|
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,f=a.z,g=this.x,h=this.y,m=this.z,j=this.w,n=j*b+h*f-m*d,p=j*d+m*b-g*f,v=j*f+g*d-h*b;b=-g*b-h*d-m*f;c.x=n*j+b*-g+p*-m-v*-h;c.y=p*j+b*-h+v*-g-n*-m;c.z=v*j+b*-m+n*-h-p*-g;return c}};
|
|
|
-THREE.Quaternion.slerp=function(a,c,b,d){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*f+c.w*d;b.x=a.x*f+c.x*d;b.y=a.y*f+c.y*d;b.z=a.z*f+c.z*d;return b};
|
|
|
+THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
|
|
|
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,o=k*b+h*e-j*d,w=k*d+j*b-g*e,y=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=o*k+b*-g+w*-j-y*-h;c.y=w*k+b*-h+y*-g-o*-j;c.z=y*k+b*-j+o*-h-w*-g;return c}};
|
|
|
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
|
|
|
THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
|
|
-THREE.Face3=function(a,c,b,d,f,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
|
|
|
-THREE.Face4=function(a,c,b,d,f,g,h){this.a=a;this.b=c;this.c=b;this.d=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.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};
|
|
|
+THREE.Face3=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
|
|
|
+THREE.Face4=function(a,c,b,d,e,g,h){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.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 a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
|
|
|
-b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,f,g,h,m=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){m.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)m.addSelf(g.vertexNormals[c]);m.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];m.sub(h.position,
|
|
|
-b.position);j.sub(c.position,b.position);m.crossSelf(j)}m.isZero()||m.normalize();g.normal.copy(m)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
|
|
|
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
|
|
|
+b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
|
|
|
-c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(K,ea,Ha,fa,Ca,na,ja){g=K.vertices[ea].position;h=K.vertices[Ha].position;m=K.vertices[fa].position;j=f[Ca];n=f[na];p=f[ja];v=h.x-g.x;u=m.x-g.x;o=h.y-g.y;
|
|
|
-x=m.y-g.y;B=h.z-g.z;E=m.z-g.z;w=n.u-j.u;M=p.u-j.u;J=n.v-j.v;N=p.v-j.v;R=1/(w*N-M*J);e.set((N*v-J*u)*R,(N*o-J*x)*R,(N*B-J*E)*R);Y.set((w*u-M*v)*R,(w*x-M*o)*R,(w*E-M*B)*R);da[ea].addSelf(e);da[Ha].addSelf(e);da[fa].addSelf(e);O[ea].addSelf(Y);O[Ha].addSelf(Y);O[fa].addSelf(Y)}var c,b,d,f,g,h,m,j,n,p,v,u,o,x,B,E,w,M,J,N,R,da=[],O=[],e=new THREE.Vector3,Y=new THREE.Vector3,V=new THREE.Vector3,ma=new THREE.Vector3,ka=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){da[c]=new THREE.Vector3;O[c]=
|
|
|
-new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){d=this.faces[c];f=this.faceVertexUvs[c][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
|
|
|
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ka.copy(this.vertices[c].normal);d=da[c];V.copy(d);V.subSelf(ka.multiplyScalar(ka.dot(d))).normalize();ma.cross(this.vertices[c].normal,d);d=ma.dot(O[c]);d=d<0?-1:1;this.vertices[c].tangent.set(V.x,V.y,V.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
+c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(M,ga,Ga,ha,Ba,oa,ka){g=M.vertices[ga].position;h=M.vertices[Ga].position;j=M.vertices[ha].position;k=e[Ba];o=e[oa];w=e[ka];y=h.x-g.x;x=j.x-g.x;t=h.y-g.y;
|
|
|
+B=j.y-g.y;G=h.z-g.z;I=j.z-g.z;A=o.u-k.u;J=w.u-k.u;z=o.v-k.v;Q=w.v-k.v;N=1/(A*Q-J*z);f.set((Q*y-z*x)*N,(Q*t-z*B)*N,(Q*G-z*I)*N);Y.set((A*x-J*y)*N,(A*B-J*t)*N,(A*I-J*G)*N);fa[ga].addSelf(f);fa[Ga].addSelf(f);fa[ha].addSelf(f);R[ga].addSelf(Y);R[Ga].addSelf(Y);R[ha].addSelf(Y)}var c,b,d,e,g,h,j,k,o,w,y,x,t,B,G,I,A,J,z,Q,N,fa=[],R=[],f=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3,na=new THREE.Vector3,ja=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){fa[c]=new THREE.Vector3;R[c]=
|
|
|
+new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.faceVertexUvs[c][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
|
|
|
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ja.copy(this.vertices[c].normal);d=fa[c];W.copy(d);W.subSelf(ja.multiplyScalar(ja.dot(d))).normalize();na.cross(this.vertices[c].normal,d);d=na.dot(R[c]);d=d<0?-1:1;this.vertices[c].tangent.set(W.x,W.y,W.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(a){function c(o,x,B,E,w,M,J){o=(B-o)*0.5;E=(E-x)*0.5;return(2*(x-B)+o+E)*J+(-3*(x-B)-2*o-E)*M+o*w+x}this.points=a;var b=[],d={x:0,y:0,z:0},f,g,h,m,j,n,p,v,u;this.initFromArray=function(o){this.points=[];for(var x=0;x<o.length;x++)this.points[x]={x:o[x][0],y:o[x][1],z:o[x][2]}};this.getPoint=function(o){f=(this.points.length-1)*o;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];p=this.points[b[1]];
|
|
|
-v=this.points[b[2]];u=this.points[b[3]];m=h*h;j=h*m;d.x=c(n.x,p.x,v.x,u.x,h,m,j);d.y=c(n.y,p.y,v.y,u.y,h,m,j);d.z=c(n.z,p.z,v.z,u.z,h,m,j);return d};this.getControlPointsArray=function(){var o,x,B=this.points.length,E=[];for(o=0;o<B;o++){x=this.points[o];E[o]=[x.x,x.y,x.z]}return E};this.getLength=function(o){var x,B,E=x=x=0,w=new THREE.Vector3,M=new THREE.Vector3,J=[],N=0;J[0]=0;o||(o=100);B=this.points.length*o;w.copy(this.points[0]);for(o=1;o<B;o++){x=o/B;position=this.getPoint(x);M.copy(position);
|
|
|
-N+=M.distanceTo(w);w.copy(position);x*=this.points.length-1;x=Math.floor(x);if(x!=E){J[x]=N;E=x}}J[J.length]=N;return{chunks:J,total:N}};this.reparametrizeByArcLength=function(o){var x,B,E,w,M,J,N=[],R=new THREE.Vector3,da=this.getLength();N.push(R.copy(this.points[0]).clone());for(x=1;x<this.points.length;x++){B=da.chunks[x]-da.chunks[x-1];J=Math.ceil(o*B/da.total);w=(x-1)/(this.points.length-1);M=x/(this.points.length-1);for(B=1;B<J-1;B++){E=w+B*(1/J)*(M-w);position=this.getPoint(E);N.push(R.copy(position).clone())}N.push(R.copy(this.points[x]).clone())}this.points=
|
|
|
-N}};
|
|
|
-THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
|
|
|
-0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var m=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){m={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var j=0;j<f.hierarchy[g].keys[h].morphTargets.length;j++){var n=f.hierarchy[g].keys[h].morphTargets[j];m[n]=-1}f.hierarchy[g].usedMorphTargets=m;for(h=0;h<f.hierarchy[g].keys.length;h++){var p=
|
|
|
-{};for(n in m){for(j=0;j<f.hierarchy[g].keys[h].morphTargets.length;j++)if(f.hierarchy[g].keys[h].morphTargets[j]===n){p[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[j];break}j===f.hierarchy[g].keys[h].morphTargets.length&&(p[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=p}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
|
|
|
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else d(f,g);return g};var d=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)d(f.children[h],g)};b.LINEAR=
|
|
|
+THREE.Spline=function(a){function c(t,B,G,I,A,J,z){t=(G-t)*0.5;I=(I-B)*0.5;return(2*(B-G)+t+I)*z+(-3*(B-G)-2*t-I)*J+t*A+B}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,j,k,o,w,y,x;this.initFromArray=function(t){this.points=[];for(var B=0;B<t.length;B++)this.points[B]={x:t[B][0],y:t[B][1],z:t[B][2]}};this.getPoint=function(t){e=(this.points.length-1)*t;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];w=this.points[b[1]];
|
|
|
+y=this.points[b[2]];x=this.points[b[3]];j=h*h;k=h*j;d.x=c(o.x,w.x,y.x,x.x,h,j,k);d.y=c(o.y,w.y,y.y,x.y,h,j,k);d.z=c(o.z,w.z,y.z,x.z,h,j,k);return d};this.getControlPointsArray=function(){var t,B,G=this.points.length,I=[];for(t=0;t<G;t++){B=this.points[t];I[t]=[B.x,B.y,B.z]}return I};this.getLength=function(t){var B,G,I=B=B=0,A=new THREE.Vector3,J=new THREE.Vector3,z=[],Q=0;z[0]=0;t||(t=100);G=this.points.length*t;A.copy(this.points[0]);for(t=1;t<G;t++){B=t/G;position=this.getPoint(B);J.copy(position);
|
|
|
+Q+=J.distanceTo(A);A.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=I){z[B]=Q;I=B}}z[z.length]=Q;return{chunks:z,total:Q}};this.reparametrizeByArcLength=function(t){var B,G,I,A,J,z,Q=[],N=new THREE.Vector3,fa=this.getLength();Q.push(N.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){G=fa.chunks[B]-fa.chunks[B-1];z=Math.ceil(t*G/fa.total);A=(B-1)/(this.points.length-1);J=B/(this.points.length-1);for(G=1;G<z-1;G++){I=A+G*(1/z)*(J-A);position=this.getPoint(I);Q.push(N.copy(position).clone())}Q.push(N.copy(this.points[B]).clone())}this.points=
|
|
|
+Q}};
|
|
|
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<0)e.hierarchy[g].keys[h].time=
|
|
|
+0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++){var o=e.hierarchy[g].keys[h].morphTargets[k];j[o]=-1}e.hierarchy[g].usedMorphTargets=j;for(h=0;h<e.hierarchy[g].keys.length;h++){var w=
|
|
|
+{};for(o in j){for(k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++)if(e.hierarchy[g].keys[h].morphTargets[k]===o){w[o]=e.hierarchy[g].keys[h].morphTargetsInfluences[k];break}k===e.hierarchy[g].keys[h].morphTargets.length&&(w[o]=0)}e.hierarchy[g].keys[h].morphTargetsInfluences=w}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*
|
|
|
+e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=
|
|
|
0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,f;for(b=0;b<d;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
|
|
|
-f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
|
+e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,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.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,h,m,j,n,p=this.data.JIT.hierarchy,v,u;this.currentTime+=a*this.timeScale;u=this.currentTime;v=this.currentTime%=this.data.length;n=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,x=this.hierarchy.length;o<x;o++){a=this.hierarchy[o];j=a.animationCache;if(this.JITCompile&&p[o][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
-!1}else{a.matrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var B=0;B<3;B++){b=c[B];h=j.prevKey[b];m=j.nextKey[b];if(m.time<=u){if(v<u)if(this.loop){h=this.data.hierarchy[o].keys[0];for(m=this.getNextKeyWith(b,o,1);m.time<v;){h=m;m=this.getNextKeyWith(b,o,m.index+1)}}else{this.stop();return}else{do{h=m;m=this.getNextKeyWith(b,o,m.index+1)}while(m.time<
|
|
|
-v)}j.prevKey[b]=h;j.nextKey[b]=m}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(v-h.time)/(m.time-h.time);f=h[b];g=m[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",o,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,m.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
|
|
|
-"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}}}}if(this.JITCompile&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)p[o][n]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],f,g,h,m,j,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];m=a[b[1]];j=a[b[2]];n=a[b[3]];b=f*f;h=f*b;d[0]=this.interpolate(g[0],m[0],j[0],n[0],f,b,h);d[1]=this.interpolate(g[1],m[1],j[1],n[1],f,b,h);d[2]=this.interpolate(g[2],m[2],j[2],n[2],f,b,h);return d};
|
|
|
-THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,o,w=this.data.JIT.hierarchy,y,x;this.currentTime+=a*this.timeScale;x=this.currentTime;y=this.currentTime%=this.data.length;o=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,B=this.hierarchy.length;t<B;t++){a=this.hierarchy[t];k=a.animationCache;if(this.JITCompile&&w[t][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=w[t][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
+!1}else{a.matrix=w[t][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=x){if(y<x)if(this.loop){h=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(b,t,1);j.time<y;){h=j;j=this.getNextKeyWith(b,t,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,t,j.index+1)}while(j.time<
|
|
|
+y)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(y-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+t);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",t,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",t,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
|
|
|
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&w[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)w[t][o]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,o;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];o=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],o[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],o[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],o[2],e,b,h);return d};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
|
-THREE.Camera=function(a,c,b,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=f||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=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||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(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};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(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,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){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
@@ -114,27 +114,27 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
|
|
|
if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
|
|
|
a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
-THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,c,b,d,f,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
|
|
|
+THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,c,b,d,e,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g: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.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
|
THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
|
|
|
-var Uniforms={clone:function(a){var c,b,d,f={};for(c in a){f[c]={};for(b in a[c]){d=a[c][b];f[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var c,b,d,f={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)f[b]=d[b]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
+var Uniforms={clone:function(a){var c,b,d,e={};for(c in a){e[c]={};for(b in a[c]){d=a[c][b];e[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return e},merge:function(a){var c,b,d,e={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)e[b]=d[b]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;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(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=b!=undefined?b:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;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=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0;b<this.geometry.morphTargets.length;b++){this.morphTargetInfluences.push(0);
|
|
|
this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
|
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;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(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
|
|
|
+THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
|
|
|
c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,f,g,h,m;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;m=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;m!==undefined?d.scale.set(m[0],m[1],m[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
|
|
|
-d=this.bones[b];f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}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(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,g,h,j;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];g=e.pos;h=e.rotq;j=e.scl;d=this.addBone();d.name=e.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;j!==undefined?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
|
|
|
+d=this.bones[b];e.parent===-1?this.addChild(d):this.bones[e.parent].addChild(d)}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(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
|
|
|
-d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
|
|
|
+d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
|
|
|
THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;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(a,c,b,d){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,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var f;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
|
|
|
-"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);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=function(a,c,b,d){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,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)e=
|
|
|
+"audio/mpeg";else if(c.indexOf(".ogg")!==-1)e="audio/ogg";else c.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);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 a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%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(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
|
|
|
THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
@@ -144,53 +144,54 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
|
|
|
THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
|
|
|
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.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(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
|
|
|
-THREE.Projector=function(){function a(O,e){return e.z-O.z}function c(O,e){var Y=0,V=1,ma=O.z+O.w,ka=e.z+e.w,K=-O.z+O.w,ea=-e.z+e.w;if(ma>=0&&ka>=0&&K>=0&&ea>=0)return!0;else if(ma<0&&ka<0||K<0&&ea<0)return!1;else{if(ma<0)Y=Math.max(Y,ma/(ma-ka));else ka<0&&(V=Math.min(V,ma/(ma-ka)));if(K<0)Y=Math.max(Y,K/(K-ea));else ea<0&&(V=Math.min(V,K/(K-ea)));if(V<Y)return!1;else{O.lerpSelf(e,Y);e.lerpSelf(O,1-V);return!0}}}var b,d,f=[],g,h,m,j=[],n,p,v=[],u,o,x=[],B=new THREE.Vector4,E=new THREE.Vector4,w=new THREE.Matrix4,
|
|
|
-M=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,R=new THREE.Vector4,da;this.projectObjects=function(O,e,Y){e=[];var V,ma,ka;d=0;ma=O.objects;O=0;for(V=ma.length;O<V;O++){ka=ma[O];var K;if(!(K=!ka.visible))if(K=ka instanceof THREE.Mesh){a:{K=void 0;for(var ea=ka.matrixWorld,Ha=-ka.geometry.boundingSphere.radius*Math.max(ka.scale.x,Math.max(ka.scale.y,ka.scale.z)),fa=0;fa<6;fa++){K=J[fa].x*ea.n14+
|
|
|
-J[fa].y*ea.n24+J[fa].z*ea.n34+J[fa].w;if(K<=Ha){K=!1;break a}}K=!0}K=!K}if(!K){b=f[d]=f[d]||new THREE.RenderableObject;B.copy(ka.position);w.multiplyVector3(B);b.object=ka;b.z=B.z;e.push(b);d++}}Y&&e.sort(a);return e};this.projectScene=function(O,e,Y){var V=[],ma=e.near,ka=e.far,K,ea,Ha,fa,Ca,na,ja,wa,Ga,la,aa,ta,xa,U,qa,Ba;m=p=o=0;e.matrixAutoUpdate&&e.updateMatrix();O.update(undefined,!1,e);w.multiply(e.projectionMatrix,e.matrixWorldInverse);J[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);
|
|
|
-J[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);J[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);J[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);J[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);J[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(K=0;K<6;K++){na=J[K];na.divideScalar(Math.sqrt(na.x*na.x+na.y*na.y+na.z*na.z))}na=this.projectObjects(O,e,!0);O=0;for(K=na.length;O<K;O++){ja=na[O].object;if(ja.visible){wa=ja.matrixWorld;aa=ja.matrixRotationWorld;
|
|
|
-Ga=ja.materials;la=ja.overdraw;if(ja instanceof THREE.Mesh){ta=ja.geometry;xa=ta.vertices;ea=0;for(Ha=xa.length;ea<Ha;ea++){U=xa[ea];U.positionWorld.copy(U.position);wa.multiplyVector3(U.positionWorld);fa=U.positionScreen;fa.copy(U.positionWorld);w.multiplyVector4(fa);fa.x/=fa.w;fa.y/=fa.w;U.__visible=fa.z>ma&&fa.z<ka}ta=ta.faces;ea=0;for(Ha=ta.length;ea<Ha;ea++){U=ta[ea];if(U instanceof THREE.Face3){fa=xa[U.a];Ca=xa[U.b];qa=xa[U.c];if(fa.__visible&&Ca.__visible&&qa.__visible&&(ja.doubleSided||ja.flipSided!=
|
|
|
-(qa.positionScreen.x-fa.positionScreen.x)*(Ca.positionScreen.y-fa.positionScreen.y)-(qa.positionScreen.y-fa.positionScreen.y)*(Ca.positionScreen.x-fa.positionScreen.x)<0)){g=j[m]=j[m]||new THREE.RenderableFace3;g.v1.positionWorld.copy(fa.positionWorld);g.v2.positionWorld.copy(Ca.positionWorld);g.v3.positionWorld.copy(qa.positionWorld);g.v1.positionScreen.copy(fa.positionScreen);g.v2.positionScreen.copy(Ca.positionScreen);g.v3.positionScreen.copy(qa.positionScreen);g.normalWorld.copy(U.normal);aa.multiplyVector3(g.normalWorld);
|
|
|
-g.centroidWorld.copy(U.centroid);wa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);qa=U.vertexNormals;da=g.vertexNormalsWorld;fa=0;for(Ca=qa.length;fa<Ca;fa++){Ba=da[fa]=da[fa]||new THREE.Vector3;Ba.copy(qa[fa]);aa.multiplyVector3(Ba)}g.z=g.centroidScreen.z;g.meshMaterials=Ga;g.faceMaterials=U.materials;g.overdraw=la;if(ja.geometry.uvs[ea]){g.uvs[0]=ja.geometry.uvs[ea][0];g.uvs[1]=ja.geometry.uvs[ea][1];g.uvs[2]=ja.geometry.uvs[ea][2]}V.push(g);
|
|
|
-m++}}else if(U instanceof THREE.Face4){fa=xa[U.a];Ca=xa[U.b];qa=xa[U.c];Ba=xa[U.d];if(fa.__visible&&Ca.__visible&&qa.__visible&&Ba.__visible&&(ja.doubleSided||ja.flipSided!=((Ba.positionScreen.x-fa.positionScreen.x)*(Ca.positionScreen.y-fa.positionScreen.y)-(Ba.positionScreen.y-fa.positionScreen.y)*(Ca.positionScreen.x-fa.positionScreen.x)<0||(Ca.positionScreen.x-qa.positionScreen.x)*(Ba.positionScreen.y-qa.positionScreen.y)-(Ca.positionScreen.y-qa.positionScreen.y)*(Ba.positionScreen.x-qa.positionScreen.x)<
|
|
|
-0))){g=j[m]=j[m]||new THREE.RenderableFace3;g.v1.positionWorld.copy(fa.positionWorld);g.v2.positionWorld.copy(Ca.positionWorld);g.v3.positionWorld.copy(Ba.positionWorld);g.v1.positionScreen.copy(fa.positionScreen);g.v2.positionScreen.copy(Ca.positionScreen);g.v3.positionScreen.copy(Ba.positionScreen);g.normalWorld.copy(U.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(U.centroid);wa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);
|
|
|
-g.z=g.centroidScreen.z;g.meshMaterials=Ga;g.faceMaterials=U.materials;g.overdraw=la;if(ja.geometry.uvs[ea]){g.uvs[0]=ja.geometry.uvs[ea][0];g.uvs[1]=ja.geometry.uvs[ea][1];g.uvs[2]=ja.geometry.uvs[ea][3]}V.push(g);m++;h=j[m]=j[m]||new THREE.RenderableFace3;h.v1.positionWorld.copy(Ca.positionWorld);h.v2.positionWorld.copy(qa.positionWorld);h.v3.positionWorld.copy(Ba.positionWorld);h.v1.positionScreen.copy(Ca.positionScreen);h.v2.positionScreen.copy(qa.positionScreen);h.v3.positionScreen.copy(Ba.positionScreen);
|
|
|
-h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Ga;h.faceMaterials=U.materials;h.overdraw=la;if(ja.geometry.uvs[ea]){h.uvs[0]=ja.geometry.uvs[ea][1];h.uvs[1]=ja.geometry.uvs[ea][2];h.uvs[2]=ja.geometry.uvs[ea][3]}V.push(h);m++}}}}else if(ja instanceof THREE.Line){M.multiply(w,wa);xa=ja.geometry.vertices;U=xa[0];U.positionScreen.copy(U.position);M.multiplyVector4(U.positionScreen);ea=1;for(Ha=xa.length;ea<
|
|
|
-Ha;ea++){fa=xa[ea];fa.positionScreen.copy(fa.position);M.multiplyVector4(fa.positionScreen);Ca=xa[ea-1];N.copy(fa.positionScreen);R.copy(Ca.positionScreen);if(c(N,R)){N.multiplyScalar(1/N.w);R.multiplyScalar(1/R.w);n=v[p]=v[p]||new THREE.RenderableLine;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(R);n.z=Math.max(N.z,R.z);n.materials=ja.materials;V.push(n);p++}}}else if(ja instanceof THREE.Particle){E.set(ja.position.x,ja.position.y,ja.position.z,1);w.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
|
|
|
-E.z<1){u=x[o]=x[o]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=ja.rotation.z;u.scale.x=ja.scale.x*Math.abs(u.x-(E.x+e.projectionMatrix.n11)/(E.w+e.projectionMatrix.n14));u.scale.y=ja.scale.y*Math.abs(u.y-(E.y+e.projectionMatrix.n22)/(E.w+e.projectionMatrix.n24));u.materials=ja.materials;V.push(u);o++}}}}Y&&V.sort(a);return V};this.unprojectVector=function(O,e){var Y=e.matrixWorld.clone();Y.multiplySelf(THREE.Matrix4.makeInvert(e.projectionMatrix));Y.multiplyVector3(O);
|
|
|
-return O}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,m){b=h;d=m;f=b/2;g=d/2};this.render=function(h,m){var j,n,p,v,u,o,x,B;a=c.projectScene(h,m);j=0;for(n=a.length;j<n;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;B=u.y*g+g;p=0;for(v=u.material.length;p<v;p++){o=u.material[p];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=x+"px";o.style.top=B+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(oa){if(u!=oa)n.globalAlpha=u=oa}function c(oa){if(o!=oa){switch(oa){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}o=oa}}var b=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,m,j,n=f.getContext("2d"),p=new THREE.Color(0),v=0,u=1,o=0,x=null,B=null,E=1,w,M,J,N,R,da,O,e,Y,V=new THREE.Color,
|
|
|
-ma=new THREE.Color,ka=new THREE.Color,K=new THREE.Color,ea=new THREE.Color,Ha,fa,Ca,na,ja,wa,Ga,la,aa,ta=new THREE.Rectangle,xa=new THREE.Rectangle,U=new THREE.Rectangle,qa=!1,Ba=new THREE.Color,k=new THREE.Color,y=new THREE.Color,z=new THREE.Color,q=Math.PI*2,t=new THREE.Vector3,D,A,C,S,G,H,ia=16;D=document.createElement("canvas");D.width=D.height=2;A=D.getContext("2d");A.fillStyle="rgba(0,0,0,1)";A.fillRect(0,0,2,2);C=A.getImageData(0,0,2,2);S=C.data;G=document.createElement("canvas");G.width=G.height=
|
|
|
-ia;H=G.getContext("2d");H.translate(-ia/2,-ia/2);H.scale(ia,ia);ia--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(oa,W){g=oa;h=W;m=g/2;j=h/2;f.width=g;f.height=h;ta.set(-m,-j,m,j);u=1;o=0;B=x=null;E=1};this.setClearColor=function(oa,W){p=oa;v=W};this.setClearColorHex=function(oa,W){p.setHex(oa);v=W};this.clear=function(){n.setTransform(1,0,0,-1,m,j);if(!xa.isEmpty()){xa.inflate(1);xa.minSelf(ta);if(p.hex==0&&v==0)n.clearRect(xa.getX(),xa.getY(),
|
|
|
-xa.getWidth(),xa.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+v+")";n.fillRect(xa.getX(),xa.getY(),xa.getWidth(),xa.getHeight())}xa.empty()}};this.render=function(oa,W){function ha(I){var $,ga,Q,X=I.lights;k.setRGB(0,0,0);y.setRGB(0,0,0);z.setRGB(0,0,0);I=0;for($=X.length;I<$;I++){ga=X[I];Q=ga.color;if(ga instanceof THREE.AmbientLight){k.r+=Q.r;k.g+=Q.g;k.b+=Q.b}else if(ga instanceof THREE.DirectionalLight){y.r+=
|
|
|
-Q.r;y.g+=Q.g;y.b+=Q.b}else if(ga instanceof THREE.PointLight){z.r+=Q.r;z.g+=Q.g;z.b+=Q.b}}}function pa(I,$,ga,Q){var X,ca,va,sa,ua=I.lights;I=0;for(X=ua.length;I<X;I++){ca=ua[I];va=ca.color;sa=ca.intensity;if(ca instanceof THREE.DirectionalLight){ca=ga.dot(ca.position)*sa;if(ca>0){Q.r+=va.r*ca;Q.g+=va.g*ca;Q.b+=va.b*ca}}else if(ca instanceof THREE.PointLight){t.sub(ca.position,$);t.normalize();ca=ga.dot(t)*sa;if(ca>0){Q.r+=va.r*ca;Q.g+=va.g*ca;Q.b+=va.b*ca}}}}function za(I,$,ga){if(ga.opacity!=0){a(ga.opacity);
|
|
|
-c(ga.blending);var Q,X,ca,va,sa,ua;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map){va=ga.map.image;sa=va.width>>1;ua=va.height>>1;X=$.scale.x*m;ca=$.scale.y*j;ga=X*sa;Q=ca*ua;U.set(I.x-ga,I.y-Q,I.x+ga,I.y+Q);if(ta.instersects(U)){n.save();n.translate(I.x,I.y);n.rotate(-$.rotation);n.scale(X,-ca);n.translate(-sa,-ua);n.drawImage(va,0,0);n.restore()}}}else if(ga instanceof THREE.ParticleCircleMaterial){if(qa){Ba.r=k.r+y.r+z.r;Ba.g=k.g+y.g+z.g;Ba.b=k.b+y.b+z.b;V.r=ga.color.r*Ba.r;V.g=ga.color.g*
|
|
|
-Ba.g;V.b=ga.color.b*Ba.b;V.updateStyleString()}else V.__styleString=ga.color.__styleString;ga=$.scale.x*m;Q=$.scale.y*j;U.set(I.x-ga,I.y-Q,I.x+ga,I.y+Q);if(ta.instersects(U)){X=V.__styleString;if(B!=X)n.fillStyle=B=X;n.save();n.translate(I.x,I.y);n.rotate(-$.rotation);n.scale(ga,Q);n.beginPath();n.arc(0,0,1,0,q,!0);n.closePath();n.fill();n.restore()}}}}function Ea(I,$,ga,Q){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);n.beginPath();n.moveTo(I.positionScreen.x,I.positionScreen.y);n.lineTo($.positionScreen.x,
|
|
|
-$.positionScreen.y);n.closePath();if(Q instanceof THREE.LineBasicMaterial){V.__styleString=Q.color.__styleString;I=Q.linewidth;if(E!=I)n.lineWidth=E=I;I=V.__styleString;if(x!=I)n.strokeStyle=x=I;n.stroke();U.inflate(Q.linewidth*2)}}}function ra(I,$,ga,Q,X,ca){if(X.opacity!=0){a(X.opacity);c(X.blending);N=I.positionScreen.x;R=I.positionScreen.y;da=$.positionScreen.x;O=$.positionScreen.y;e=ga.positionScreen.x;Y=ga.positionScreen.y;n.beginPath();n.moveTo(N,R);n.lineTo(da,O);n.lineTo(e,Y);n.lineTo(N,
|
|
|
-R);n.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&Ma(N,R,da,O,e,Y,X.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){I=W.matrixWorldInverse;t.copy(Q.vertexNormalsWorld[0]);na=(t.x*I.n11+t.y*I.n12+t.z*I.n13)*0.5+0.5;ja=-(t.x*I.n21+t.y*I.n22+t.z*I.n23)*0.5+0.5;t.copy(Q.vertexNormalsWorld[1]);wa=(t.x*I.n11+t.y*I.n12+t.z*I.n13)*0.5+0.5;
|
|
|
-Ga=-(t.x*I.n21+t.y*I.n22+t.z*I.n23)*0.5+0.5;t.copy(Q.vertexNormalsWorld[2]);la=(t.x*I.n11+t.y*I.n12+t.z*I.n13)*0.5+0.5;aa=-(t.x*I.n21+t.y*I.n22+t.z*I.n23)*0.5+0.5;Ma(N,R,da,O,e,Y,X.envMap.image,na,ja,wa,Ga,la,aa)}}else X.wireframe?Na(X.color.__styleString,X.wireframeLinewidth):L(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof THREE.UVMapping&&Ma(N,R,da,O,e,Y,X.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);
|
|
|
-c(THREE.SubtractiveBlending)}if(qa)if(!X.wireframe&&X.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){ma.r=ka.r=K.r=k.r;ma.g=ka.g=K.g=k.g;ma.b=ka.b=K.b=k.b;pa(ca,Q.v1.positionWorld,Q.vertexNormalsWorld[0],ma);pa(ca,Q.v2.positionWorld,Q.vertexNormalsWorld[1],ka);pa(ca,Q.v3.positionWorld,Q.vertexNormalsWorld[2],K);ea.r=(ka.r+K.r)*0.5;ea.g=(ka.g+K.g)*0.5;ea.b=(ka.b+K.b)*0.5;Ca=La(ma,ka,K,ea);Ma(N,R,da,O,e,Y,Ca,0,0,1,0,0,1)}else{Ba.r=k.r;Ba.g=k.g;Ba.b=k.b;pa(ca,Q.centroidWorld,Q.normalWorld,
|
|
|
-Ba);V.r=X.color.r*Ba.r;V.g=X.color.g*Ba.g;V.b=X.color.b*Ba.b;V.updateStyleString();X.wireframe?Na(V.__styleString,X.wireframeLinewidth):L(V.__styleString)}else X.wireframe?Na(X.color.__styleString,X.wireframeLinewidth):L(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Ha=W.near;fa=W.far;ma.r=ma.g=ma.b=1-Fa(I.positionScreen.z,Ha,fa);ka.r=ka.g=ka.b=1-Fa($.positionScreen.z,Ha,fa);K.r=K.g=K.b=1-Fa(ga.positionScreen.z,Ha,fa);ea.r=(ka.r+K.r)*0.5;ea.g=(ka.g+K.g)*0.5;ea.b=(ka.b+K.b)*
|
|
|
-0.5;Ca=La(ma,ka,K,ea);Ma(N,R,da,O,e,Y,Ca,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){V.r=Pa(Q.normalWorld.x);V.g=Pa(Q.normalWorld.y);V.b=Pa(Q.normalWorld.z);V.updateStyleString();X.wireframe?Na(V.__styleString,X.wireframeLinewidth):L(V.__styleString)}}}function Na(I,$){if(x!=I)n.strokeStyle=x=I;if(E!=$)n.lineWidth=E=$;n.stroke();U.inflate($*2)}function L(I){if(B!=I)n.fillStyle=B=I;n.fill()}function Ma(I,$,ga,Q,X,ca,va,sa,ua,Da,ya,Ta,Qa){var Ja,Ua;Ja=va.width-1;Ua=va.height-1;sa*=Ja;
|
|
|
-ua*=Ua;Da*=Ja;ya*=Ua;Ta*=Ja;Qa*=Ua;ga-=I;Q-=$;X-=I;ca-=$;Da-=sa;ya-=ua;Ta-=sa;Qa-=ua;Ja=Da*Qa-Ta*ya;if(Ja!=0){Ua=1/Ja;Ja=(Qa*ga-ya*X)*Ua;ya=(Qa*Q-ya*ca)*Ua;ga=(Da*X-Ta*ga)*Ua;Q=(Da*ca-Ta*Q)*Ua;I=I-Ja*sa-ga*ua;$=$-ya*sa-Q*ua;n.save();n.transform(Ja,ya,ga,Q,I,$);n.clip();n.drawImage(va,0,0);n.restore()}}function La(I,$,ga,Q){var X=~~(I.r*255),ca=~~(I.g*255);I=~~(I.b*255);var va=~~($.r*255),sa=~~($.g*255);$=~~($.b*255);var ua=~~(ga.r*255),Da=~~(ga.g*255);ga=~~(ga.b*255);var ya=~~(Q.r*255),Ta=~~(Q.g*
|
|
|
-255);Q=~~(Q.b*255);S[0]=X<0?0:X>255?255:X;S[1]=ca<0?0:ca>255?255:ca;S[2]=I<0?0:I>255?255:I;S[4]=va<0?0:va>255?255:va;S[5]=sa<0?0:sa>255?255:sa;S[6]=$<0?0:$>255?255:$;S[8]=ua<0?0:ua>255?255:ua;S[9]=Da<0?0:Da>255?255:Da;S[10]=ga<0?0:ga>255?255:ga;S[12]=ya<0?0:ya>255?255:ya;S[13]=Ta<0?0:Ta>255?255:Ta;S[14]=Q<0?0:Q>255?255:Q;A.putImageData(C,0,0);H.drawImage(D,0,0);return G}function Fa(I,$,ga){I=(I-$)/(ga-$);return I*I*(3-2*I)}function Pa(I){I=(I+1)*0.5;return I<0?0:I>1?1:I}function Ra(I,$){var ga=$.x-
|
|
|
-I.x,Q=$.y-I.y,X=1/Math.sqrt(ga*ga+Q*Q);ga*=X;Q*=X;$.x+=ga;$.y+=Q;I.x-=ga;I.y-=Q}var T,Z,P,Aa,Ia,Va,Ka,F;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,j);b=d.projectScene(oa,W,this.sortElements);(qa=oa.lights.length>0)&&ha(oa);T=0;for(Z=b.length;T<Z;T++){P=b[T];U.empty();if(P instanceof THREE.RenderableParticle){w=P;w.x*=m;w.y*=j;Aa=0;for(Ia=P.materials.length;Aa<Ia;Aa++)za(w,P,P.materials[Aa],oa)}else if(P instanceof THREE.RenderableLine){w=P.v1;M=P.v2;w.positionScreen.x*=m;w.positionScreen.y*=
|
|
|
-j;M.positionScreen.x*=m;M.positionScreen.y*=j;U.addPoint(w.positionScreen.x,w.positionScreen.y);U.addPoint(M.positionScreen.x,M.positionScreen.y);if(ta.instersects(U)){Aa=0;for(Ia=P.materials.length;Aa<Ia;)Ea(w,M,P,P.materials[Aa++],oa)}}else if(P instanceof THREE.RenderableFace3){w=P.v1;M=P.v2;J=P.v3;w.positionScreen.x*=m;w.positionScreen.y*=j;M.positionScreen.x*=m;M.positionScreen.y*=j;J.positionScreen.x*=m;J.positionScreen.y*=j;if(P.overdraw){Ra(w.positionScreen,M.positionScreen);Ra(M.positionScreen,
|
|
|
-J.positionScreen);Ra(J.positionScreen,w.positionScreen)}U.add3Points(w.positionScreen.x,w.positionScreen.y,M.positionScreen.x,M.positionScreen.y,J.positionScreen.x,J.positionScreen.y);if(ta.instersects(U)){Aa=0;for(Ia=P.meshMaterials.length;Aa<Ia;){F=P.meshMaterials[Aa++];if(F instanceof THREE.MeshFaceMaterial){Va=0;for(Ka=P.faceMaterials.length;Va<Ka;)(F=P.faceMaterials[Va++])&&ra(w,M,J,P,F,oa)}else ra(w,M,J,P,F,oa)}}}xa.addRectangle(U)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(na,ja,wa){var Ga,la,aa,ta;Ga=0;for(la=na.lights.length;Ga<la;Ga++){aa=na.lights[Ga];if(aa instanceof THREE.DirectionalLight){ta=ja.normalWorld.dot(aa.position)*aa.intensity;if(ta>0){wa.r+=aa.color.r*ta;wa.g+=aa.color.g*ta;wa.b+=aa.color.b*ta}}else if(aa instanceof THREE.PointLight){Y.sub(aa.position,ja.centroidWorld);Y.normalize();ta=ja.normalWorld.dot(Y)*aa.intensity;if(ta>0){wa.r+=aa.color.r*ta;wa.g+=aa.color.g*ta;wa.b+=aa.color.b*ta}}}}function c(na,ja,wa,
|
|
|
-Ga,la,aa){K=d(ea++);K.setAttribute("d","M "+na.positionScreen.x+" "+na.positionScreen.y+" L "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(la instanceof THREE.MeshBasicMaterial)J.__styleString=la.color.__styleString;else if(la instanceof THREE.MeshLambertMaterial)if(M){N.r=R.r;N.g=R.g;N.b=R.b;a(aa,Ga,N);J.r=la.color.r*N.r;J.g=la.color.g*N.g;J.b=la.color.b*N.b;J.updateStyleString()}else J.__styleString=la.color.__styleString;else if(la instanceof
|
|
|
-THREE.MeshDepthMaterial){e=1-la.__2near/(la.__farPlusNear-Ga.z*la.__farMinusNear);J.setRGB(e,e,e)}else la instanceof THREE.MeshNormalMaterial&&J.setRGB(f(Ga.normalWorld.x),f(Ga.normalWorld.y),f(Ga.normalWorld.z));la.wireframe?K.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+la.wireframeLinewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.wireframeLinecap+"; stroke-linejoin: "+la.wireframeLinejoin):K.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+
|
|
|
-la.opacity);m.appendChild(K)}function b(na,ja,wa,Ga,la,aa,ta){K=d(ea++);K.setAttribute("d","M "+na.positionScreen.x+" "+na.positionScreen.y+" L "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+" L "+Ga.positionScreen.x+","+Ga.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)J.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(M){N.r=R.r;N.g=R.g;N.b=R.b;a(ta,la,N);J.r=aa.color.r*N.r;J.g=aa.color.g*N.g;
|
|
|
-J.b=aa.color.b*N.b;J.updateStyleString()}else J.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){e=1-aa.__2near/(aa.__farPlusNear-la.z*aa.__farMinusNear);J.setRGB(e,e,e)}else aa instanceof THREE.MeshNormalMaterial&&J.setRGB(f(la.normalWorld.x),f(la.normalWorld.y),f(la.normalWorld.z));aa.wireframe?K.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
|
|
|
-"; stroke-linejoin: "+aa.wireframeLinejoin):K.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+aa.opacity);m.appendChild(K)}function d(na){if(V[na]==null){V[na]=document.createElementNS("http://www.w3.org/2000/svg","path");Ca==0&&V[na].setAttribute("shape-rendering","crispEdges")}return V[na]}function f(na){return na<0?Math.min((1+na)*0.5,0.5):0.5+Math.min(na*0.5,0.5)}var g=null,h=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,n,p,v,u,o,x,B,E=
|
|
|
-new THREE.Rectangle,w=new THREE.Rectangle,M=!1,J=new THREE.Color(16777215),N=new THREE.Color(16777215),R=new THREE.Color(0),da=new THREE.Color(0),O=new THREE.Color(0),e,Y=new THREE.Vector3,V=[],ma=[],ka=[],K,ea,Ha,fa,Ca=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(na){switch(na){case "high":Ca=1;break;case "low":Ca=0}};this.setSize=function(na,ja){j=na;n=ja;p=j/2;v=n/2;m.setAttribute("viewBox",-p+" "+-v+" "+j+" "+n);m.setAttribute("width",
|
|
|
-j);m.setAttribute("height",n);E.set(-p,-v,p,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(na,ja){var wa,Ga,la,aa,ta,xa,U,qa;this.autoClear&&this.clear();g=h.projectScene(na,ja,this.sortElements);fa=Ha=ea=0;if(M=na.lights.length>0){U=na.lights;R.setRGB(0,0,0);da.setRGB(0,0,0);O.setRGB(0,0,0);wa=0;for(Ga=U.length;wa<Ga;wa++){la=U[wa];aa=la.color;if(la instanceof THREE.AmbientLight){R.r+=aa.r;R.g+=aa.g;R.b+=aa.b}else if(la instanceof THREE.DirectionalLight){da.r+=
|
|
|
-aa.r;da.g+=aa.g;da.b+=aa.b}else if(la instanceof THREE.PointLight){O.r+=aa.r;O.g+=aa.g;O.b+=aa.b}}}wa=0;for(Ga=g.length;wa<Ga;wa++){U=g[wa];w.empty();if(U instanceof THREE.RenderableParticle){u=U;u.x*=p;u.y*=-v;la=0;for(aa=U.materials.length;la<aa;la++)if(qa=U.materials[la]){ta=u;xa=U;var Ba=Ha++;if(ma[Ba]==null){ma[Ba]=document.createElementNS("http://www.w3.org/2000/svg","circle");Ca==0&&ma[Ba].setAttribute("shape-rendering","crispEdges")}K=ma[Ba];K.setAttribute("cx",ta.x);K.setAttribute("cy",ta.y);
|
|
|
-K.setAttribute("r",xa.scale.x*p);if(qa instanceof THREE.ParticleCircleMaterial){if(M){N.r=R.r+da.r+O.r;N.g=R.g+da.g+O.g;N.b=R.b+da.b+O.b;J.r=qa.color.r*N.r;J.g=qa.color.g*N.g;J.b=qa.color.b*N.b;J.updateStyleString()}else J=qa.color;K.setAttribute("style","fill: "+J.__styleString)}m.appendChild(K)}}else if(U instanceof THREE.RenderableLine){u=U.v1;o=U.v2;u.positionScreen.x*=p;u.positionScreen.y*=-v;o.positionScreen.x*=p;o.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,
|
|
|
-o.positionScreen.y);if(E.instersects(w)){la=0;for(aa=U.materials.length;la<aa;)if(qa=U.materials[la++]){ta=u;xa=o;Ba=fa++;if(ka[Ba]==null){ka[Ba]=document.createElementNS("http://www.w3.org/2000/svg","line");Ca==0&&ka[Ba].setAttribute("shape-rendering","crispEdges")}K=ka[Ba];K.setAttribute("x1",ta.positionScreen.x);K.setAttribute("y1",ta.positionScreen.y);K.setAttribute("x2",xa.positionScreen.x);K.setAttribute("y2",xa.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){J.__styleString=qa.color.__styleString;
|
|
|
-K.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+qa.linewidth+"; stroke-opacity: "+qa.opacity+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);m.appendChild(K)}}}}else if(U instanceof THREE.RenderableFace3){u=U.v1;o=U.v2;x=U.v3;u.positionScreen.x*=p;u.positionScreen.y*=-v;o.positionScreen.x*=p;o.positionScreen.y*=-v;x.positionScreen.x*=p;x.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);
|
|
|
-w.addPoint(x.positionScreen.x,x.positionScreen.y);if(E.instersects(w)){la=0;for(aa=U.meshMaterials.length;la<aa;){qa=U.meshMaterials[la++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(xa=U.faceMaterials.length;ta<xa;)(qa=U.faceMaterials[ta++])&&c(u,o,x,U,qa,na)}else qa&&c(u,o,x,U,qa,na)}}}else if(U instanceof THREE.RenderableFace4){u=U.v1;o=U.v2;x=U.v3;B=U.v4;u.positionScreen.x*=p;u.positionScreen.y*=-v;o.positionScreen.x*=p;o.positionScreen.y*=-v;x.positionScreen.x*=p;x.positionScreen.y*=-v;
|
|
|
-B.positionScreen.x*=p;B.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(x.positionScreen.x,x.positionScreen.y);w.addPoint(B.positionScreen.x,B.positionScreen.y);if(E.instersects(w)){la=0;for(aa=U.meshMaterials.length;la<aa;){qa=U.meshMaterials[la++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(xa=U.faceMaterials.length;ta<xa;)(qa=U.faceMaterials[ta++])&&b(u,o,x,B,U,qa,na)}else qa&&b(u,o,x,B,U,qa,na)}}}}}};
|
|
|
+THREE.Projector=function(){function a(R,f){return f.z-R.z}function c(R,f){var Y=0,W=1,na=R.z+R.w,ja=f.z+f.w,M=-R.z+R.w,ga=-f.z+f.w;if(na>=0&&ja>=0&&M>=0&&ga>=0)return!0;else if(na<0&&ja<0||M<0&&ga<0)return!1;else{if(na<0)Y=Math.max(Y,na/(na-ja));else ja<0&&(W=Math.min(W,na/(na-ja)));if(M<0)Y=Math.max(Y,M/(M-ga));else ga<0&&(W=Math.min(W,M/(M-ga)));if(W<Y)return!1;else{R.lerpSelf(f,Y);f.lerpSelf(R,1-W);return!0}}}var b,d,e=[],g,h,j,k=[],o,w,y=[],x,t,B=[],G=new THREE.Vector4,I=new THREE.Vector4,A=new THREE.Matrix4,
|
|
|
+J=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Vector4,N=new THREE.Vector4,fa;this.projectObjects=function(R,f,Y){f=[];var W,na,ja;d=0;na=R.objects;R=0;for(W=na.length;R<W;R++){ja=na[R];var M;if(!(M=!ja.visible))if(M=ja instanceof THREE.Mesh){a:{M=void 0;for(var ga=ja.matrixWorld,Ga=-ja.geometry.boundingSphere.radius*Math.max(ja.scale.x,Math.max(ja.scale.y,ja.scale.z)),ha=0;ha<6;ha++){M=z[ha].x*ga.n14+
|
|
|
+z[ha].y*ga.n24+z[ha].z*ga.n34+z[ha].w;if(M<=Ga){M=!1;break a}}M=!0}M=!M}if(!M){b=e[d]=e[d]||new THREE.RenderableObject;G.copy(ja.position);A.multiplyVector3(G);b.object=ja;b.z=G.z;f.push(b);d++}}Y&&f.sort(a);return f};this.projectScene=function(R,f,Y){var W=[],na=f.near,ja=f.far,M,ga,Ga,ha,Ba,oa,ka,wa,Ha,ma,da,ra,sa,T,pa,ua;j=w=t=0;f.matrixAutoUpdate&&f.updateMatrix();R.update(undefined,!1,f);A.multiply(f.projectionMatrix,f.matrixWorldInverse);z[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);
|
|
|
+z[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);z[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);z[3].set(A.n41-A.n21,A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);z[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);z[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(M=0;M<6;M++){oa=z[M];oa.divideScalar(Math.sqrt(oa.x*oa.x+oa.y*oa.y+oa.z*oa.z))}oa=this.projectObjects(R,f,!0);R=0;for(M=oa.length;R<M;R++){ka=oa[R].object;if(ka.visible){wa=ka.matrixWorld;da=ka.matrixRotationWorld;
|
|
|
+Ha=ka.materials;ma=ka.overdraw;if(ka instanceof THREE.Mesh){ra=ka.geometry;sa=ra.vertices;ga=0;for(Ga=sa.length;ga<Ga;ga++){T=sa[ga];T.positionWorld.copy(T.position);wa.multiplyVector3(T.positionWorld);ha=T.positionScreen;ha.copy(T.positionWorld);A.multiplyVector4(ha);ha.x/=ha.w;ha.y/=ha.w;T.__visible=ha.z>na&&ha.z<ja}ra=ra.faces;ga=0;for(Ga=ra.length;ga<Ga;ga++){T=ra[ga];if(T instanceof THREE.Face3){ha=sa[T.a];Ba=sa[T.b];pa=sa[T.c];if(ha.__visible&&Ba.__visible&&pa.__visible&&(ka.doubleSided||ka.flipSided!=
|
|
|
+(pa.positionScreen.x-ha.positionScreen.x)*(Ba.positionScreen.y-ha.positionScreen.y)-(pa.positionScreen.y-ha.positionScreen.y)*(Ba.positionScreen.x-ha.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ha.positionWorld);g.v2.positionWorld.copy(Ba.positionWorld);g.v3.positionWorld.copy(pa.positionWorld);g.v1.positionScreen.copy(ha.positionScreen);g.v2.positionScreen.copy(Ba.positionScreen);g.v3.positionScreen.copy(pa.positionScreen);g.normalWorld.copy(T.normal);da.multiplyVector3(g.normalWorld);
|
|
|
+g.centroidWorld.copy(T.centroid);wa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);A.multiplyVector3(g.centroidScreen);pa=T.vertexNormals;fa=g.vertexNormalsWorld;ha=0;for(Ba=pa.length;ha<Ba;ha++){ua=fa[ha]=fa[ha]||new THREE.Vector3;ua.copy(pa[ha]);da.multiplyVector3(ua)}g.z=g.centroidScreen.z;g.meshMaterials=Ha;g.faceMaterials=T.materials;g.overdraw=ma;if(ka.geometry.uvs[ga]){g.uvs[0]=ka.geometry.uvs[ga][0];g.uvs[1]=ka.geometry.uvs[ga][1];g.uvs[2]=ka.geometry.uvs[ga][2]}W.push(g);
|
|
|
+j++}}else if(T instanceof THREE.Face4){ha=sa[T.a];Ba=sa[T.b];pa=sa[T.c];ua=sa[T.d];if(ha.__visible&&Ba.__visible&&pa.__visible&&ua.__visible&&(ka.doubleSided||ka.flipSided!=((ua.positionScreen.x-ha.positionScreen.x)*(Ba.positionScreen.y-ha.positionScreen.y)-(ua.positionScreen.y-ha.positionScreen.y)*(Ba.positionScreen.x-ha.positionScreen.x)<0||(Ba.positionScreen.x-pa.positionScreen.x)*(ua.positionScreen.y-pa.positionScreen.y)-(Ba.positionScreen.y-pa.positionScreen.y)*(ua.positionScreen.x-pa.positionScreen.x)<
|
|
|
+0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ha.positionWorld);g.v2.positionWorld.copy(Ba.positionWorld);g.v3.positionWorld.copy(ua.positionWorld);g.v1.positionScreen.copy(ha.positionScreen);g.v2.positionScreen.copy(Ba.positionScreen);g.v3.positionScreen.copy(ua.positionScreen);g.normalWorld.copy(T.normal);da.multiplyVector3(g.normalWorld);g.centroidWorld.copy(T.centroid);wa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);A.multiplyVector3(g.centroidScreen);
|
|
|
+g.z=g.centroidScreen.z;g.meshMaterials=Ha;g.faceMaterials=T.materials;g.overdraw=ma;if(ka.geometry.uvs[ga]){g.uvs[0]=ka.geometry.uvs[ga][0];g.uvs[1]=ka.geometry.uvs[ga][1];g.uvs[2]=ka.geometry.uvs[ga][3]}W.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(Ba.positionWorld);h.v2.positionWorld.copy(pa.positionWorld);h.v3.positionWorld.copy(ua.positionWorld);h.v1.positionScreen.copy(Ba.positionScreen);h.v2.positionScreen.copy(pa.positionScreen);h.v3.positionScreen.copy(ua.positionScreen);
|
|
|
+h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=Ha;h.faceMaterials=T.materials;h.overdraw=ma;if(ka.geometry.uvs[ga]){h.uvs[0]=ka.geometry.uvs[ga][1];h.uvs[1]=ka.geometry.uvs[ga][2];h.uvs[2]=ka.geometry.uvs[ga][3]}W.push(h);j++}}}}else if(ka instanceof THREE.Line){J.multiply(A,wa);sa=ka.geometry.vertices;T=sa[0];T.positionScreen.copy(T.position);J.multiplyVector4(T.positionScreen);ga=1;for(Ga=sa.length;ga<
|
|
|
+Ga;ga++){ha=sa[ga];ha.positionScreen.copy(ha.position);J.multiplyVector4(ha.positionScreen);Ba=sa[ga-1];Q.copy(ha.positionScreen);N.copy(Ba.positionScreen);if(c(Q,N)){Q.multiplyScalar(1/Q.w);N.multiplyScalar(1/N.w);o=y[w]=y[w]||new THREE.RenderableLine;o.v1.positionScreen.copy(Q);o.v2.positionScreen.copy(N);o.z=Math.max(Q.z,N.z);o.materials=ka.materials;W.push(o);w++}}}else if(ka instanceof THREE.Particle){I.set(ka.position.x,ka.position.y,ka.position.z,1);A.multiplyVector4(I);I.z/=I.w;if(I.z>0&&
|
|
|
+I.z<1){x=B[t]=B[t]||new THREE.RenderableParticle;x.x=I.x/I.w;x.y=I.y/I.w;x.z=I.z;x.rotation=ka.rotation.z;x.scale.x=ka.scale.x*Math.abs(x.x-(I.x+f.projectionMatrix.n11)/(I.w+f.projectionMatrix.n14));x.scale.y=ka.scale.y*Math.abs(x.y-(I.y+f.projectionMatrix.n22)/(I.w+f.projectionMatrix.n24));x.materials=ka.materials;W.push(x);t++}}}}Y&&W.sort(a);return W};this.unprojectVector=function(R,f){var Y=f.matrixWorld.clone();Y.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));Y.multiplyVector3(R);
|
|
|
+return R}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,o,w,y,x,t,B,G;a=c.projectScene(h,j);k=0;for(o=a.length;k<o;k++){x=a[k];if(x instanceof THREE.RenderableParticle){B=x.x*e+e;G=x.y*g+g;w=0;for(y=x.material.length;w<y;w++){t=x.material[w];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=B+"px";t.style.top=G+"px"}}}}}};
|
|
|
+THREE.CanvasRenderer=function(){function a(qa){if(x!=qa)o.globalAlpha=x=qa}function c(qa){if(t!=qa){switch(qa){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}t=qa}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,o=e.getContext("2d"),w=new THREE.Color(0),y=0,x=1,t=0,B=null,G=null,I=1,A,J,z,Q,N,fa,R,f,Y,W=new THREE.Color,
|
|
|
+na=new THREE.Color,ja=new THREE.Color,M=new THREE.Color,ga=new THREE.Color,Ga,ha,Ba,oa,ka,wa,Ha,ma,da,ra=new THREE.Rectangle,sa=new THREE.Rectangle,T=new THREE.Rectangle,pa=!1,ua=new THREE.Color,m=new THREE.Color,D=new THREE.Color,p=new THREE.Color,n=Math.PI*2,q=new THREE.Vector3,E,C,F,S,P,H,X=16;E=document.createElement("canvas");E.width=E.height=2;C=E.getContext("2d");C.fillStyle="rgba(0,0,0,1)";C.fillRect(0,0,2,2);F=C.getImageData(0,0,2,2);S=F.data;P=document.createElement("canvas");P.width=P.height=
|
|
|
+X;H=P.getContext("2d");H.translate(-X/2,-X/2);H.scale(X,X);X--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(qa,Z){g=qa;h=Z;j=g/2;k=h/2;e.width=g;e.height=h;ra.set(-j,-k,j,k);x=1;t=0;G=B=null;I=1};this.setClearColor=function(qa,Z){w=qa;y=Z};this.setClearColorHex=function(qa,Z){w.setHex(qa);y=Z};this.clear=function(){o.setTransform(1,0,0,-1,j,k);if(!sa.isEmpty()){sa.inflate(1);sa.minSelf(ra);if(w.hex==0&&y==0)o.clearRect(sa.getX(),sa.getY(),sa.getWidth(),
|
|
|
+sa.getHeight());else{c(THREE.NormalBlending);a(1);o.fillStyle="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+y+")";o.fillRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight())}sa.empty()}};this.render=function(qa,Z){function Ca(L){var ea,la,U,$=L.lights;m.setRGB(0,0,0);D.setRGB(0,0,0);p.setRGB(0,0,0);L=0;for(ea=$.length;L<ea;L++){la=$[L];U=la.color;if(la instanceof THREE.AmbientLight){m.r+=U.r;m.g+=U.g;m.b+=U.b}else if(la instanceof THREE.DirectionalLight){D.r+=U.r;
|
|
|
+D.g+=U.g;D.b+=U.b}else if(la instanceof THREE.PointLight){p.r+=U.r;p.g+=U.g;p.b+=U.b}}}function ya(L,ea,la,U){var $,ia,za,ta,va=L.lights;L=0;for($=va.length;L<$;L++){ia=va[L];za=ia.color;ta=ia.intensity;if(ia instanceof THREE.DirectionalLight){ia=la.dot(ia.position)*ta;if(ia>0){U.r+=za.r*ia;U.g+=za.g*ia;U.b+=za.b*ia}}else if(ia instanceof THREE.PointLight){q.sub(ia.position,ea);q.normalize();ia=la.dot(q)*ta;if(ia>0){U.r+=za.r*ia;U.g+=za.g*ia;U.b+=za.b*ia}}}}function Ea(L,ea,la){if(la.opacity!=0){a(la.opacity);
|
|
|
+c(la.blending);var U,$,ia,za,ta,va;if(la instanceof THREE.ParticleBasicMaterial){if(la.map){za=la.map.image;ta=za.width>>1;va=za.height>>1;$=ea.scale.x*j;ia=ea.scale.y*k;la=$*ta;U=ia*va;T.set(L.x-la,L.y-U,L.x+la,L.y+U);if(ra.instersects(T)){o.save();o.translate(L.x,L.y);o.rotate(-ea.rotation);o.scale($,-ia);o.translate(-ta,-va);o.drawImage(za,0,0);o.restore()}}}else if(la instanceof THREE.ParticleCircleMaterial){if(pa){ua.r=m.r+D.r+p.r;ua.g=m.g+D.g+p.g;ua.b=m.b+D.b+p.b;W.r=la.color.r*ua.r;W.g=la.color.g*
|
|
|
+ua.g;W.b=la.color.b*ua.b;W.updateStyleString()}else W.__styleString=la.color.__styleString;la=ea.scale.x*j;U=ea.scale.y*k;T.set(L.x-la,L.y-U,L.x+la,L.y+U);if(ra.instersects(T)){$=W.__styleString;if(G!=$)o.fillStyle=G=$;o.save();o.translate(L.x,L.y);o.rotate(-ea.rotation);o.scale(la,U);o.beginPath();o.arc(0,0,1,0,n,!0);o.closePath();o.fill();o.restore()}}}}function Aa(L,ea,la,U){if(U.opacity!=0){a(U.opacity);c(U.blending);o.beginPath();o.moveTo(L.positionScreen.x,L.positionScreen.y);o.lineTo(ea.positionScreen.x,
|
|
|
+ea.positionScreen.y);o.closePath();if(U instanceof THREE.LineBasicMaterial){W.__styleString=U.color.__styleString;L=U.linewidth;if(I!=L)o.lineWidth=I=L;L=W.__styleString;if(B!=L)o.strokeStyle=B=L;o.stroke();T.inflate(U.linewidth*2)}}}function La(L,ea,la,U,$,ia){if($.opacity!=0){a($.opacity);c($.blending);Q=L.positionScreen.x;N=L.positionScreen.y;fa=ea.positionScreen.x;R=ea.positionScreen.y;f=la.positionScreen.x;Y=la.positionScreen.y;o.beginPath();o.moveTo(Q,N);o.lineTo(fa,R);o.lineTo(f,Y);o.lineTo(Q,
|
|
|
+N);o.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.mapping instanceof THREE.UVMapping&&Na(Q,N,fa,R,f,Y,$.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if($.envMap){if($.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=Z.matrixWorldInverse;q.copy(U.vertexNormalsWorld[0]);oa=(q.x*L.n11+q.y*L.n12+q.z*L.n13)*0.5+0.5;ka=-(q.x*L.n21+q.y*L.n22+q.z*L.n23)*0.5+0.5;q.copy(U.vertexNormalsWorld[1]);wa=(q.x*L.n11+q.y*L.n12+q.z*L.n13)*0.5+0.5;
|
|
|
+Ha=-(q.x*L.n21+q.y*L.n22+q.z*L.n23)*0.5+0.5;q.copy(U.vertexNormalsWorld[2]);ma=(q.x*L.n11+q.y*L.n12+q.z*L.n13)*0.5+0.5;da=-(q.x*L.n21+q.y*L.n22+q.z*L.n23)*0.5+0.5;Na(Q,N,fa,R,f,Y,$.envMap.image,oa,ka,wa,Ha,ma,da)}}else $.wireframe?Ia($.color.__styleString,$.wireframeLinewidth):O($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Na(Q,N,fa,R,f,Y,$.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);
|
|
|
+c(THREE.SubtractiveBlending)}if(pa)if(!$.wireframe&&$.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){na.r=ja.r=M.r=m.r;na.g=ja.g=M.g=m.g;na.b=ja.b=M.b=m.b;ya(ia,U.v1.positionWorld,U.vertexNormalsWorld[0],na);ya(ia,U.v2.positionWorld,U.vertexNormalsWorld[1],ja);ya(ia,U.v3.positionWorld,U.vertexNormalsWorld[2],M);ga.r=(ja.r+M.r)*0.5;ga.g=(ja.g+M.g)*0.5;ga.b=(ja.b+M.b)*0.5;Ba=Ja(na,ja,M,ga);Na(Q,N,fa,R,f,Y,Ba,0,0,1,0,0,1)}else{ua.r=m.r;ua.g=m.g;ua.b=m.b;ya(ia,U.centroidWorld,U.normalWorld,
|
|
|
+ua);W.r=$.color.r*ua.r;W.g=$.color.g*ua.g;W.b=$.color.b*ua.b;W.updateStyleString();$.wireframe?Ia(W.__styleString,$.wireframeLinewidth):O(W.__styleString)}else $.wireframe?Ia($.color.__styleString,$.wireframeLinewidth):O($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){Ga=Z.near;ha=Z.far;na.r=na.g=na.b=1-Qa(L.positionScreen.z,Ga,ha);ja.r=ja.g=ja.b=1-Qa(ea.positionScreen.z,Ga,ha);M.r=M.g=M.b=1-Qa(la.positionScreen.z,Ga,ha);ga.r=(ja.r+M.r)*0.5;ga.g=(ja.g+M.g)*0.5;ga.b=(ja.b+M.b)*
|
|
|
+0.5;Ba=Ja(na,ja,M,ga);Na(Q,N,fa,R,f,Y,Ba,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){W.r=V(U.normalWorld.x);W.g=V(U.normalWorld.y);W.b=V(U.normalWorld.z);W.updateStyleString();$.wireframe?Ia(W.__styleString,$.wireframeLinewidth):O(W.__styleString)}}}function Ia(L,ea){if(B!=L)o.strokeStyle=B=L;if(I!=ea)o.lineWidth=I=ea;o.stroke();T.inflate(ea*2)}function O(L){if(G!=L)o.fillStyle=G=L;o.fill()}function Na(L,ea,la,U,$,ia,za,ta,va,Fa,Da,Wa,Ua){var Oa,Xa;Oa=za.width-1;Xa=za.height-1;ta*=
|
|
|
+Oa;va*=Xa;Fa*=Oa;Da*=Xa;Wa*=Oa;Ua*=Xa;la-=L;U-=ea;$-=L;ia-=ea;Fa-=ta;Da-=va;Wa-=ta;Ua-=va;Oa=Fa*Ua-Wa*Da;if(Oa!=0){Xa=1/Oa;Oa=(Ua*la-Da*$)*Xa;Da=(Ua*U-Da*ia)*Xa;la=(Fa*$-Wa*la)*Xa;U=(Fa*ia-Wa*U)*Xa;L=L-Oa*ta-la*va;ea=ea-Da*ta-U*va;o.save();o.transform(Oa,Da,la,U,L,ea);o.clip();o.drawImage(za,0,0);o.restore()}}function Ja(L,ea,la,U){var $=~~(L.r*255),ia=~~(L.g*255);L=~~(L.b*255);var za=~~(ea.r*255),ta=~~(ea.g*255);ea=~~(ea.b*255);var va=~~(la.r*255),Fa=~~(la.g*255);la=~~(la.b*255);var Da=~~(U.r*255),
|
|
|
+Wa=~~(U.g*255);U=~~(U.b*255);S[0]=$<0?0:$>255?255:$;S[1]=ia<0?0:ia>255?255:ia;S[2]=L<0?0:L>255?255:L;S[4]=za<0?0:za>255?255:za;S[5]=ta<0?0:ta>255?255:ta;S[6]=ea<0?0:ea>255?255:ea;S[8]=va<0?0:va>255?255:va;S[9]=Fa<0?0:Fa>255?255:Fa;S[10]=la<0?0:la>255?255:la;S[12]=Da<0?0:Da>255?255:Da;S[13]=Wa<0?0:Wa>255?255:Wa;S[14]=U<0?0:U>255?255:U;C.putImageData(F,0,0);H.drawImage(E,0,0);return P}function Qa(L,ea,la){L=(L-ea)/(la-ea);return L*L*(3-2*L)}function V(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function ca(L,
|
|
|
+ea){var la=ea.x-L.x,U=ea.y-L.y,$=1/Math.sqrt(la*la+U*U);la*=$;U*=$;ea.x+=la;ea.y+=U;L.x-=la;L.y-=U}var aa,Ka,xa,Ta,Ma,Ra,Pa,K;this.autoClear?this.clear():o.setTransform(1,0,0,-1,j,k);b=d.projectScene(qa,Z,this.sortElements);(pa=qa.lights.length>0)&&Ca(qa);aa=0;for(Ka=b.length;aa<Ka;aa++){xa=b[aa];T.empty();if(xa instanceof THREE.RenderableParticle){A=xa;A.x*=j;A.y*=k;Ta=0;for(Ma=xa.materials.length;Ta<Ma;Ta++)Ea(A,xa,xa.materials[Ta],qa)}else if(xa instanceof THREE.RenderableLine){A=xa.v1;J=xa.v2;
|
|
|
+A.positionScreen.x*=j;A.positionScreen.y*=k;J.positionScreen.x*=j;J.positionScreen.y*=k;T.addPoint(A.positionScreen.x,A.positionScreen.y);T.addPoint(J.positionScreen.x,J.positionScreen.y);if(ra.instersects(T)){Ta=0;for(Ma=xa.materials.length;Ta<Ma;)Aa(A,J,xa,xa.materials[Ta++],qa)}}else if(xa instanceof THREE.RenderableFace3){A=xa.v1;J=xa.v2;z=xa.v3;A.positionScreen.x*=j;A.positionScreen.y*=k;J.positionScreen.x*=j;J.positionScreen.y*=k;z.positionScreen.x*=j;z.positionScreen.y*=k;if(xa.overdraw){ca(A.positionScreen,
|
|
|
+J.positionScreen);ca(J.positionScreen,z.positionScreen);ca(z.positionScreen,A.positionScreen)}T.add3Points(A.positionScreen.x,A.positionScreen.y,J.positionScreen.x,J.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(ra.instersects(T)){Ta=0;for(Ma=xa.meshMaterials.length;Ta<Ma;){K=xa.meshMaterials[Ta++];if(K instanceof THREE.MeshFaceMaterial){Ra=0;for(Pa=xa.faceMaterials.length;Ra<Pa;)(K=xa.faceMaterials[Ra++])&&La(A,J,z,xa,K,qa)}else La(A,J,z,xa,K,qa)}}}sa.addRectangle(T)}o.setTransform(1,
|
|
|
+0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(oa,ka,wa){var Ha,ma,da,ra;Ha=0;for(ma=oa.lights.length;Ha<ma;Ha++){da=oa.lights[Ha];if(da instanceof THREE.DirectionalLight){ra=ka.normalWorld.dot(da.position)*da.intensity;if(ra>0){wa.r+=da.color.r*ra;wa.g+=da.color.g*ra;wa.b+=da.color.b*ra}}else if(da instanceof THREE.PointLight){Y.sub(da.position,ka.centroidWorld);Y.normalize();ra=ka.normalWorld.dot(Y)*da.intensity;if(ra>0){wa.r+=da.color.r*ra;wa.g+=da.color.g*ra;wa.b+=da.color.b*ra}}}}function c(oa,ka,wa,
|
|
|
+Ha,ma,da){M=d(ga++);M.setAttribute("d","M "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(ma instanceof THREE.MeshBasicMaterial)z.__styleString=ma.color.__styleString;else if(ma instanceof THREE.MeshLambertMaterial)if(J){Q.r=N.r;Q.g=N.g;Q.b=N.b;a(da,Ha,Q);z.r=ma.color.r*Q.r;z.g=ma.color.g*Q.g;z.b=ma.color.b*Q.b;z.updateStyleString()}else z.__styleString=ma.color.__styleString;else if(ma instanceof
|
|
|
+THREE.MeshDepthMaterial){f=1-ma.__2near/(ma.__farPlusNear-Ha.z*ma.__farMinusNear);z.setRGB(f,f,f)}else ma instanceof THREE.MeshNormalMaterial&&z.setRGB(e(Ha.normalWorld.x),e(Ha.normalWorld.y),e(Ha.normalWorld.z));ma.wireframe?M.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ma.wireframeLinewidth+"; stroke-opacity: "+ma.opacity+"; stroke-linecap: "+ma.wireframeLinecap+"; stroke-linejoin: "+ma.wireframeLinejoin):M.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+
|
|
|
+ma.opacity);j.appendChild(M)}function b(oa,ka,wa,Ha,ma,da,ra){M=d(ga++);M.setAttribute("d","M "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+" L "+Ha.positionScreen.x+","+Ha.positionScreen.y+"z");if(da instanceof THREE.MeshBasicMaterial)z.__styleString=da.color.__styleString;else if(da instanceof THREE.MeshLambertMaterial)if(J){Q.r=N.r;Q.g=N.g;Q.b=N.b;a(ra,ma,Q);z.r=da.color.r*Q.r;z.g=da.color.g*Q.g;
|
|
|
+z.b=da.color.b*Q.b;z.updateStyleString()}else z.__styleString=da.color.__styleString;else if(da instanceof THREE.MeshDepthMaterial){f=1-da.__2near/(da.__farPlusNear-ma.z*da.__farMinusNear);z.setRGB(f,f,f)}else da instanceof THREE.MeshNormalMaterial&&z.setRGB(e(ma.normalWorld.x),e(ma.normalWorld.y),e(ma.normalWorld.z));da.wireframe?M.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+da.wireframeLinewidth+"; stroke-opacity: "+da.opacity+"; stroke-linecap: "+da.wireframeLinecap+
|
|
|
+"; stroke-linejoin: "+da.wireframeLinejoin):M.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+da.opacity);j.appendChild(M)}function d(oa){if(W[oa]==null){W[oa]=document.createElementNS("http://www.w3.org/2000/svg","path");Ba==0&&W[oa].setAttribute("shape-rendering","crispEdges")}return W[oa]}function e(oa){return oa<0?Math.min((1+oa)*0.5,0.5):0.5+Math.min(oa*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,w,y,x,t,B,G,I=
|
|
|
+new THREE.Rectangle,A=new THREE.Rectangle,J=!1,z=new THREE.Color(16777215),Q=new THREE.Color(16777215),N=new THREE.Color(0),fa=new THREE.Color(0),R=new THREE.Color(0),f,Y=new THREE.Vector3,W=[],na=[],ja=[],M,ga,Ga,ha,Ba=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(oa){switch(oa){case "high":Ba=1;break;case "low":Ba=0}};this.setSize=function(oa,ka){k=oa;o=ka;w=k/2;y=o/2;j.setAttribute("viewBox",-w+" "+-y+" "+k+" "+o);j.setAttribute("width",
|
|
|
+k);j.setAttribute("height",o);I.set(-w,-y,w,y)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(oa,ka){var wa,Ha,ma,da,ra,sa,T,pa;this.autoClear&&this.clear();g=h.projectScene(oa,ka,this.sortElements);ha=Ga=ga=0;if(J=oa.lights.length>0){T=oa.lights;N.setRGB(0,0,0);fa.setRGB(0,0,0);R.setRGB(0,0,0);wa=0;for(Ha=T.length;wa<Ha;wa++){ma=T[wa];da=ma.color;if(ma instanceof THREE.AmbientLight){N.r+=da.r;N.g+=da.g;N.b+=da.b}else if(ma instanceof THREE.DirectionalLight){fa.r+=
|
|
|
+da.r;fa.g+=da.g;fa.b+=da.b}else if(ma instanceof THREE.PointLight){R.r+=da.r;R.g+=da.g;R.b+=da.b}}}wa=0;for(Ha=g.length;wa<Ha;wa++){T=g[wa];A.empty();if(T instanceof THREE.RenderableParticle){x=T;x.x*=w;x.y*=-y;ma=0;for(da=T.materials.length;ma<da;ma++)if(pa=T.materials[ma]){ra=x;sa=T;var ua=Ga++;if(na[ua]==null){na[ua]=document.createElementNS("http://www.w3.org/2000/svg","circle");Ba==0&&na[ua].setAttribute("shape-rendering","crispEdges")}M=na[ua];M.setAttribute("cx",ra.x);M.setAttribute("cy",ra.y);
|
|
|
+M.setAttribute("r",sa.scale.x*w);if(pa instanceof THREE.ParticleCircleMaterial){if(J){Q.r=N.r+fa.r+R.r;Q.g=N.g+fa.g+R.g;Q.b=N.b+fa.b+R.b;z.r=pa.color.r*Q.r;z.g=pa.color.g*Q.g;z.b=pa.color.b*Q.b;z.updateStyleString()}else z=pa.color;M.setAttribute("style","fill: "+z.__styleString)}j.appendChild(M)}}else if(T instanceof THREE.RenderableLine){x=T.v1;t=T.v2;x.positionScreen.x*=w;x.positionScreen.y*=-y;t.positionScreen.x*=w;t.positionScreen.y*=-y;A.addPoint(x.positionScreen.x,x.positionScreen.y);A.addPoint(t.positionScreen.x,
|
|
|
+t.positionScreen.y);if(I.instersects(A)){ma=0;for(da=T.materials.length;ma<da;)if(pa=T.materials[ma++]){ra=x;sa=t;ua=ha++;if(ja[ua]==null){ja[ua]=document.createElementNS("http://www.w3.org/2000/svg","line");Ba==0&&ja[ua].setAttribute("shape-rendering","crispEdges")}M=ja[ua];M.setAttribute("x1",ra.positionScreen.x);M.setAttribute("y1",ra.positionScreen.y);M.setAttribute("x2",sa.positionScreen.x);M.setAttribute("y2",sa.positionScreen.y);if(pa instanceof THREE.LineBasicMaterial){z.__styleString=pa.color.__styleString;
|
|
|
+M.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+pa.linewidth+"; stroke-opacity: "+pa.opacity+"; stroke-linecap: "+pa.linecap+"; stroke-linejoin: "+pa.linejoin);j.appendChild(M)}}}}else if(T instanceof THREE.RenderableFace3){x=T.v1;t=T.v2;B=T.v3;x.positionScreen.x*=w;x.positionScreen.y*=-y;t.positionScreen.x*=w;t.positionScreen.y*=-y;B.positionScreen.x*=w;B.positionScreen.y*=-y;A.addPoint(x.positionScreen.x,x.positionScreen.y);A.addPoint(t.positionScreen.x,t.positionScreen.y);
|
|
|
+A.addPoint(B.positionScreen.x,B.positionScreen.y);if(I.instersects(A)){ma=0;for(da=T.meshMaterials.length;ma<da;){pa=T.meshMaterials[ma++];if(pa instanceof THREE.MeshFaceMaterial){ra=0;for(sa=T.faceMaterials.length;ra<sa;)(pa=T.faceMaterials[ra++])&&c(x,t,B,T,pa,oa)}else pa&&c(x,t,B,T,pa,oa)}}}else if(T instanceof THREE.RenderableFace4){x=T.v1;t=T.v2;B=T.v3;G=T.v4;x.positionScreen.x*=w;x.positionScreen.y*=-y;t.positionScreen.x*=w;t.positionScreen.y*=-y;B.positionScreen.x*=w;B.positionScreen.y*=-y;
|
|
|
+G.positionScreen.x*=w;G.positionScreen.y*=-y;A.addPoint(x.positionScreen.x,x.positionScreen.y);A.addPoint(t.positionScreen.x,t.positionScreen.y);A.addPoint(B.positionScreen.x,B.positionScreen.y);A.addPoint(G.positionScreen.x,G.positionScreen.y);if(I.instersects(A)){ma=0;for(da=T.meshMaterials.length;ma<da;){pa=T.meshMaterials[ma++];if(pa instanceof THREE.MeshFaceMaterial){ra=0;for(sa=T.faceMaterials.length;ra<sa;)(pa=T.faceMaterials[ra++])&&b(x,t,B,G,T,pa,oa)}else pa&&b(x,t,B,G,T,pa,oa)}}}}}};
|
|
|
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",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -215,100 +216,100 @@ 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,
|
|
|
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.WebGLRenderer=function(a){function c(k,y,z){var q,t,D,A=k.vertices,C=A.length,S=k.colors,G=S.length,H=k.__vertexArray,ia=k.__colorArray,oa=k.__sortArray,W=k.__dirtyVertices,ha=k.__dirtyColors;if(z.sortParticles){Ga.multiplySelf(z.matrixWorld);for(q=0;q<C;q++){t=A[q].position;ta.copy(t);Ga.multiplyVector3(ta);oa[q]=[ta.z,q]}oa.sort(function(pa,za){return za[0]-pa[0]});for(q=0;q<C;q++){t=A[oa[q][1]].position;D=q*3;H[D]=t.x;H[D+1]=t.y;H[D+2]=t.z}for(q=0;q<G;q++){D=q*3;color=S[oa[q][1]];ia[D]=color.r;
|
|
|
-ia[D+1]=color.g;ia[D+2]=color.b}}else{if(W)for(q=0;q<C;q++){t=A[q].position;D=q*3;H[D]=t.x;H[D+1]=t.y;H[D+2]=t.z}if(ha)for(q=0;q<G;q++){color=S[q];D=q*3;ia[D]=color.r;ia[D+1]=color.g;ia[D+2]=color.b}}if(W||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,H,y)}if(ha||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,ia,y)}}function b(k,y){k.fragmentShader=y.fragmentShader;k.vertexShader=y.vertexShader;k.uniforms=
|
|
|
-Uniforms.clone(y.uniforms)}function d(k,y,z,q,t){q.program||ma.initMaterial(q,y,z,t);var D=q.program,A=D.uniforms,C=q.uniforms;if(D!=Y){e.useProgram(D);Y=D}e.uniformMatrix4fv(A.projectionMatrix,!1,la);if(z&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q instanceof THREE.ParticleBasicMaterial)){C.fogColor.value.setHex(z.color.hex);if(z instanceof THREE.Fog){C.fogNear.value=z.near;C.fogFar.value=
|
|
|
-z.far}else if(z instanceof THREE.FogExp2)C.fogDensity.value=z.density}if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q.lights){var S,G,H=0,ia=0,oa=0,W,ha,pa,za=xa,Ea=za.directional.colors,ra=za.directional.positions,Na=za.point.colors,L=za.point.positions,Ma=0,La=0;z=G=G=0;for(S=y.length;z<S;z++){G=y[z];W=G.color;ha=G.position;pa=G.intensity;if(G instanceof THREE.AmbientLight){H+=W.r;ia+=W.g;oa+=W.b}else if(G instanceof THREE.DirectionalLight){G=Ma*3;Ea[G]=W.r*pa;
|
|
|
-Ea[G+1]=W.g*pa;Ea[G+2]=W.b*pa;ra[G]=ha.x;ra[G+1]=ha.y;ra[G+2]=ha.z;Ma+=1}else if(G instanceof THREE.PointLight){G=La*3;Na[G]=W.r*pa;Na[G+1]=W.g*pa;Na[G+2]=W.b*pa;L[G]=ha.x;L[G+1]=ha.y;L[G+2]=ha.z;La+=1}}for(z=Ma*3;z<Ea.length;z++)Ea[z]=0;for(z=La*3;z<Na.length;z++)Na[z]=0;za.point.length=La;za.directional.length=Ma;za.ambient[0]=H;za.ambient[1]=ia;za.ambient[2]=oa;y=xa;C.enableLighting.value=y.directional.length+y.point.length;C.ambientLightColor.value=y.ambient;C.directionalLightColor.value=y.directional.colors;
|
|
|
-C.directionalLightDirection.value=y.directional.positions;C.pointLightColor.value=y.point.colors;C.pointLightPosition.value=y.point.positions}if(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial){C.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);C.opacity.value=q.opacity;C.map.texture=q.map;C.lightMap.texture=q.lightMap;C.envMap.texture=q.envMap;C.reflectivity.value=q.reflectivity;C.refractionRatio.value=
|
|
|
-q.refractionRatio;C.combine.value=q.combine;C.useRefract.value=q.envMap&&q.envMap.mapping instanceof THREE.CubeRefractionMapping}if(q instanceof THREE.LineBasicMaterial){C.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);C.opacity.value=q.opacity}else if(q instanceof THREE.ParticleBasicMaterial){C.psColor.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);C.opacity.value=q.opacity;C.size.value=q.size;C.scale.value=O.height/2;C.map.texture=q.map}else if(q instanceof
|
|
|
-THREE.MeshPhongMaterial){C.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);C.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);C.shininess.value=q.shininess}else if(q instanceof THREE.MeshDepthMaterial){C.mNear.value=k.near;C.mFar.value=k.far;C.opacity.value=q.opacity}else if(q instanceof THREE.MeshNormalMaterial)C.opacity.value=q.opacity;for(var Fa in C)if(H=D.uniforms[Fa]){z=C[Fa];S=z.type;y=z.value;if(S=="i")e.uniform1i(H,y);else if(S=="f")e.uniform1f(H,y);else if(S=="fv1")e.uniform1fv(H,
|
|
|
-y);else if(S=="fv")e.uniform3fv(H,y);else if(S=="v2")e.uniform2f(H,y.x,y.y);else if(S=="v3")e.uniform3f(H,y.x,y.y,y.z);else if(S=="c")e.uniform3f(H,y.r,y.g,y.b);else if(S=="t"){e.uniform1i(H,y);if(z=z.texture)if(z.image instanceof Array&&z.image.length==6){if(z.image.length==6){if(z.needsUpdate){if(z.__wasSetOnce){e.bindTexture(e.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube);for(S=0;S<6;++S)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,e.RGBA,e.UNSIGNED_BYTE,z.image[S])}else{z.image.__webGLTextureCube=
|
|
|
-e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube);for(S=0;S<6;++S)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,z.image[S]);z.__wasSetOnce=!0}M(e.TEXTURE_CUBE_MAP,z,z.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube)}}else{if(z.needsUpdate){if(z.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,z.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,
|
|
|
-0,0,0,e.RGBA,e.UNSIGNED_BYTE,z.image)}else{z.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,z.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,z.image);z.__wasSetOnce=!0}M(e.TEXTURE_2D,z,z.image);e.bindTexture(e.TEXTURE_2D,null);z.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_2D,z.__webGLTexture)}}}e.uniformMatrix4fv(A.modelViewMatrix,!1,t._modelViewMatrixArray);e.uniformMatrix3fv(A.normalMatrix,!1,t._normalMatrixArray);(q instanceof THREE.MeshShaderMaterial||
|
|
|
-q instanceof THREE.MeshPhongMaterial||q.envMap)&&e.uniform3f(A.cameraPosition,k.position.x,k.position.y,k.position.z);(q instanceof THREE.MeshShaderMaterial||q.envMap||q.skinning)&&e.uniformMatrix4fv(A.objectMatrix,!1,t._objectMatrixArray);(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshShaderMaterial||q.skinning)&&e.uniformMatrix4fv(A.viewMatrix,!1,aa);if(q.skinning){e.uniformMatrix4fv(A.cameraInverseMatrix,!1,aa);e.uniformMatrix4fv(A.boneGlobalMatrices,
|
|
|
-!1,t.boneMatrices)}return D}function f(k,y,z,q,t,D){if(q.opacity!=0){k=d(k,y,z,q,D).attributes;if(q.morphTargets){y=q.program.attributes;D.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,t.__webGLMorphTargetsBuffers[D.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(y.position,3,e.FLOAT,!1,0,0);if(D.morphTargetForcedOrder.length){z=0;for(var A=D.morphTargetForcedOrder,C=D.morphTargetInfluences;z<q.numSupportedMorphTargets&&z<A.length;){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-t.__webGLMorphTargetsBuffers[A[z]]);e.vertexAttribPointer(y["morphTarget"+z],3,e.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[z]=C[A[z]];z++}}else{A=[];var S=-1,G=0;C=D.morphTargetInfluences;var H,ia=C.length;z=0;for(D.morphTargetBase!==-1&&(A[D.morphTargetBase]=!0);z<q.numSupportedMorphTargets;){for(H=0;H<ia;H++)if(!A[H]&&C[H]>S){G=H;S=C[G]}e.bindBuffer(e.ARRAY_BUFFER,t.__webGLMorphTargetsBuffers[G]);e.vertexAttribPointer(y["morphTarget"+z],3,e.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[z]=S;A[G]=
|
|
|
-1;S=-1;z++}}e.uniform1fv(q.program.uniforms.morphTargetInfluences,D.__webGLMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(k.position,3,e.FLOAT,!1,0,0)}if(k.color>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLColorBuffer);e.vertexAttribPointer(k.color,3,e.FLOAT,!1,0,0)}if(k.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLNormalBuffer);e.vertexAttribPointer(k.normal,3,e.FLOAT,!1,0,0)}if(k.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLTangentBuffer);
|
|
|
-e.vertexAttribPointer(k.tangent,4,e.FLOAT,!1,0,0)}if(k.uv>=0)if(t.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUVBuffer);e.vertexAttribPointer(k.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(k.uv)}else e.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(t.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUV2Buffer);e.vertexAttribPointer(k.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(k.uv2)}else e.disableVertexAttribArray(k.uv2);if(q.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=
|
|
|
-0&&k.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexABuffer);e.vertexAttribPointer(k.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexBBuffer);e.vertexAttribPointer(k.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinIndicesBuffer);e.vertexAttribPointer(k.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinWeightsBuffer);e.vertexAttribPointer(k.skinWeight,4,e.FLOAT,!1,0,0)}if(D instanceof THREE.Mesh)if(q.wireframe){e.lineWidth(q.wireframeLinewidth);
|
|
|
-e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);e.drawElements(e.LINES,t.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,t.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(q.linewidth);e.drawArrays(D,0,t.__webGLLineCount)}else if(D instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,t.__webGLParticleCount);else D instanceof THREE.Ribbon&&
|
|
|
-e.drawArrays(e.TRIANGLE_STRIP,0,t.__webGLVertexCount)}}function g(k,y){if(!k.__webGLVertexBuffer)k.__webGLVertexBuffer=e.createBuffer();if(!k.__webGLNormalBuffer)k.__webGLNormalBuffer=e.createBuffer();if(k.hasPos){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,k.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.position);e.vertexAttribPointer(y.attributes.position,3,e.FLOAT,!1,0,0)}if(k.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,k.__webGLNormalBuffer);
|
|
|
-e.bufferData(e.ARRAY_BUFFER,k.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.normal);e.vertexAttribPointer(y.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,k.count);k.count=0}function h(k){if(ka!=k.doubleSided){k.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ka=k.doubleSided}if(K!=k.flipSided){k.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);K=k.flipSided}}function m(k){if(Ha!=k){k?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Ha=k}}function j(k){wa[0].set(k.n41-
|
|
|
-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);wa[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);wa[2].set(k.n41+k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);wa[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);wa[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);wa[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var y;for(k=0;k<6;k++){y=wa[k];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}function n(k){for(var y=k.matrixWorld,z=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,
|
|
|
-Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++){k=wa[q].x*y.n14+wa[q].y*y.n24+wa[q].z*y.n34+wa[q].w;if(k<=z)return!1}return!0}function p(k,y){k.list[k.count]=y;k.count+=1}function v(k){var y,z,q=k.object,t=k.opaque,D=k.transparent;D.count=0;k=t.count=0;for(y=q.materials.length;k<y;k++){z=q.materials[k];z.opacity&&z.opacity<1||z.blending!=THREE.NormalBlending?p(D,z):p(t,z)}}function u(k){var y,z,q,t,D=k.object,A=k.buffer,C=k.opaque,S=k.transparent;S.count=0;k=C.count=0;for(q=D.materials.length;k<q;k++){y=
|
|
|
-D.materials[k];if(y instanceof THREE.MeshFaceMaterial){y=0;for(z=A.materials.length;y<z;y++)(t=A.materials[y])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?p(S,t):p(C,t))}else{t=y;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?p(S,t):p(C,t)}}}function o(k,y){return y.z-k.z}function x(k,y){k._modelViewMatrix.multiplyToArray(y.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function B(k){function y(oa){var W=
|
|
|
-[];z=0;for(q=oa.length;z<q;z++)oa[z]==undefined?W.push("undefined"):W.push(oa[z].id);return W.join("_")}var z,q,t,D,A,C,S,G,H={},ia=k.morphTargets!==undefined?k.morphTargets.length:0;k.geometryGroups={};t=0;for(D=k.faces.length;t<D;t++){A=k.faces[t];C=A.materials;S=y(C);H[S]==undefined&&(H[S]={hash:S,counter:0});G=H[S].hash+"_"+H[S].counter;k.geometryGroups[G]==undefined&&(k.geometryGroups[G]={faces:[],materials:C,vertices:0,numMorphTargets:ia});A=A instanceof THREE.Face3?3:4;if(k.geometryGroups[G].vertices+
|
|
|
-A>65535){H[S].counter+=1;G=H[S].hash+"_"+H[S].counter;k.geometryGroups[G]==undefined&&(k.geometryGroups[G]={faces:[],materials:C,vertices:0,numMorphTargets:ia})}k.geometryGroups[G].faces.push(t);k.geometryGroups[G].vertices+=A}}function E(k,y,z){k.push({buffer:y,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(k){if(k!=ea){switch(k){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,
|
|
|
-e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ea=k}}function M(k,y,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(k,e.TEXTURE_WRAP_S,da(y.wrapS));e.texParameteri(k,e.TEXTURE_WRAP_T,da(y.wrapT));e.texParameteri(k,
|
|
|
-e.TEXTURE_MAG_FILTER,da(y.magFilter));e.texParameteri(k,e.TEXTURE_MIN_FILTER,da(y.minFilter));e.generateMipmap(k)}else{e.texParameteri(k,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(k,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(k,e.TEXTURE_MAG_FILTER,R(y.magFilter));e.texParameteri(k,e.TEXTURE_MIN_FILTER,R(y.minFilter))}}function J(k){if(k&&!k.__webGLFramebuffer){k.__webGLFramebuffer=e.createFramebuffer();k.__webGLRenderbuffer=e.createRenderbuffer();k.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,
|
|
|
-k.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,k.width,k.height);e.bindTexture(e.TEXTURE_2D,k.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,da(k.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,da(k.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,da(k.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,da(k.minFilter));e.texImage2D(e.TEXTURE_2D,0,da(k.format),k.width,k.height,0,da(k.format),da(k.type),null);e.bindFramebuffer(e.FRAMEBUFFER,
|
|
|
-k.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,k.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,k.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,z;if(k){y=k.__webGLFramebuffer;z=k.width;k=k.height}else{y=null;z=na;k=ja}if(y!=V){e.bindFramebuffer(e.FRAMEBUFFER,y);e.viewport(fa,Ca,z,k);V=y}}function N(k,y){var z;if(k=="fragment")z=
|
|
|
-e.createShader(e.FRAGMENT_SHADER);else k=="vertex"&&(z=e.createShader(e.VERTEX_SHADER));e.shaderSource(z,y);e.compileShader(z);if(!e.getShaderParameter(z,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(z));return null}return z}function R(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return e.LINEAR}}function da(k){switch(k){case THREE.RepeatWrapping:return e.REPEAT;
|
|
|
-case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
|
|
|
-case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var O=document.createElement("canvas"),
|
|
|
-e,Y=null,V=null,ma=this,ka=null,K=null,ea=null,Ha=null,fa=0,Ca=0,na=0,ja=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,la=new Float32Array(16),aa=new Float32Array(16),ta=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},U=!0,qa=new THREE.Color(0),Ba=0;if(a){if(a.antialias!==undefined)U=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);
|
|
|
-if(a.clearAlpha!==undefined)Ba=a.clearAlpha}this.maxMorphTargets=8;this.domElement=O;this.autoClear=!0;this.sortObjects=!0;(function(k,y,z){try{if(!(e=O.getContext("experimental-webgl",{antialias:k})))throw"Error creating WebGL context.";}catch(q){console.error(q)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,z);_cullEnabled=
|
|
|
-!0})(U,qa,Ba);this.context=e;this.setSize=function(k,y){O.width=k;O.height=y;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(k,y,z,q){fa=k;Ca=y;na=z;ja=q;e.viewport(fa,Ca,na,ja)};this.setScissor=function(k,y,z,q){e.scissor(k,y,z,q)};this.enableScissorTest=function(k){k?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){e.depthMask(k)};this.setClearColorHex=function(k,y){var z=new THREE.Color(k);e.clearColor(z.r,z.g,z.b,y)};this.setClearColor=
|
|
|
-function(k,y){e.clearColor(k.r,k.g,k.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(k,y,z,q){var t,D,A;if(k instanceof THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);
|
|
|
-else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);var C,S,G,H;A=G=H=0;for(C=y.length;A<C;A++){S=y[A];S instanceof THREE.DirectionalLight&&G++;S instanceof THREE.PointLight&&H++}if(H+G<=4)y=G;else{y=Math.ceil(4*G/(H+G));H=4-y}A={directional:y,point:H};C=50;if(q!==undefined&&q instanceof THREE.SkinnedMesh)C=q.bones.length;H=k.fragmentShader;y=k.vertexShader;C={fog:z,map:k.map,envMap:k.envMap,lightMap:k.lightMap,
|
|
|
-vertexColors:k.vertexColors,sizeAttenuation:k.sizeAttenuation,skinning:k.skinning,morphTargets:k.morphTargets,maxDirLights:A.directional,maxPointLights:A.point,maxBones:C};z=e.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.fog?"#define USE_FOG":"",C.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":
|
|
|
-"",C.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");C=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,"#define MAX_BONES "+C.maxBones,C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"",C.skinning?"#define USE_SKINNING":"",C.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
-"",C.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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
-e.attachShader(z,N("fragment",A+H));e.attachShader(z,N("vertex",C+y));e.linkProgram(z);e.getProgramParameter(z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");z.uniforms={};z.attributes={};k.program=z;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in k.uniforms)z.push(t);
|
|
|
-t=k.program;H=0;for(y=z.length;H<y;H++){A=z[H];t.uniforms[A]=e.getUniformLocation(t,A)}z=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<this.maxMorphTargets;t++)z.push("morphTarget"+t);for(D in k.attributes)z.push(D);D=k.program;t=z;z=0;for(H=t.length;z<H;z++){y=t[z];D.attributes[y]=e.getAttribLocation(D,y)}D=k.program.attributes;e.enableVertexAttribArray(D.position);D.color>=0&&e.enableVertexAttribArray(D.color);D.normal>=0&&e.enableVertexAttribArray(D.normal);
|
|
|
-D.tangent>=0&&e.enableVertexAttribArray(D.tangent);if(k.skinning&&D.skinVertexA>=0&&D.skinVertexB>=0&&D.skinIndex>=0&&D.skinWeight>=0){e.enableVertexAttribArray(D.skinVertexA);e.enableVertexAttribArray(D.skinVertexB);e.enableVertexAttribArray(D.skinIndex);e.enableVertexAttribArray(D.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(D.morphTarget0>=0){e.enableVertexAttribArray(D.morphTarget0);k.numSupportedMorphTargets++}if(D.morphTarget1>=0){e.enableVertexAttribArray(D.morphTarget1);
|
|
|
-k.numSupportedMorphTargets++}if(D.morphTarget2>=0){e.enableVertexAttribArray(D.morphTarget2);k.numSupportedMorphTargets++}if(D.morphTarget3>=0){e.enableVertexAttribArray(D.morphTarget3);k.numSupportedMorphTargets++}if(D.morphTarget4>=0){e.enableVertexAttribArray(D.morphTarget4);k.numSupportedMorphTargets++}if(D.morphTarget5>=0){e.enableVertexAttribArray(D.morphTarget5);k.numSupportedMorphTargets++}if(D.morphTarget6>=0){e.enableVertexAttribArray(D.morphTarget6);k.numSupportedMorphTargets++}if(D.morphTarget7>=
|
|
|
-0){e.enableVertexAttribArray(D.morphTarget7);k.numSupportedMorphTargets++}q.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(t=0;t<this.maxMorphTargets;t++)q.__webGLMorphTargetInfluences[t]=0}};this.render=function(k,y,z,q){var t,D,A,C,S,G,H,ia,oa=k.lights,W=k.fog;y.matrixAutoUpdate&&y.updateMatrix();k.update(undefined,!1,y);y.matrixWorldInverse.flattenToArray(aa);y.projectionMatrix.flattenToArray(la);Ga.multiply(y.projectionMatrix,y.matrixWorldInverse);j(Ga);this.initWebGLObjects(k);
|
|
|
-J(z);(this.autoClear||q)&&this.clear();S=k.__webglObjects.length;for(q=0;q<S;q++){t=k.__webglObjects[q];H=t.object;if(H.visible)if(!(H instanceof THREE.Mesh)||n(H)){H.matrixWorld.flattenToArray(H._objectMatrixArray);x(H,y);u(t);t.render=!0;if(this.sortObjects){ta.copy(H.position);Ga.multiplyVector3(ta);t.z=ta.z}}else t.render=!1;else t.render=!1}this.sortObjects&&k.__webglObjects.sort(o);G=k.__webglObjectsImmediate.length;for(q=0;q<G;q++){t=k.__webglObjectsImmediate[q];H=t.object;if(H.visible){H.matrixAutoUpdate&&
|
|
|
-H.matrixWorld.flattenToArray(H._objectMatrixArray);x(H,y);v(t)}}w(THREE.NormalBlending);for(q=0;q<S;q++){t=k.__webglObjects[q];if(t.render){H=t.object;ia=t.buffer;A=t.opaque;h(H);for(t=0;t<A.count;t++){C=A.list[t];m(C.depthTest);f(y,oa,W,C,ia,H)}}}for(q=0;q<G;q++){t=k.__webglObjectsImmediate[q];H=t.object;if(H.visible){A=t.opaque;h(H);for(t=0;t<A.count;t++){C=A.list[t];m(C.depthTest);D=d(y,oa,W,C,H);H.render(function(ha){g(ha,D)})}}}for(q=0;q<S;q++){t=k.__webglObjects[q];if(t.render){H=t.object;ia=
|
|
|
-t.buffer;A=t.transparent;h(H);for(t=0;t<A.count;t++){C=A.list[t];w(C.blending);m(C.depthTest);f(y,oa,W,C,ia,H)}}}for(q=0;q<G;q++){t=k.__webglObjectsImmediate[q];H=t.object;if(H.visible){A=t.transparent;h(H);for(t=0;t<A.count;t++){C=A.list[t];w(C.blending);m(C.depthTest);D=d(y,oa,W,C,H);H.render(function(ha){g(ha,D)})}}}if(z&&z.minFilter!==THREE.NearestFilter&&z.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,z.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};
|
|
|
-this.initWebGLObjects=function(k){if(!k.__webglObjects){k.__webglObjects=[];k.__webglObjectsImmediate=[]}for(;k.__objectsAdded.length;){var y=k.__objectsAdded[0],z=k,q=void 0,t=void 0,D=void 0;if(y._modelViewMatrix==undefined){y._modelViewMatrix=new THREE.Matrix4;y._normalMatrixArray=new Float32Array(9);y._modelViewMatrixArray=new Float32Array(16);y._objectMatrixArray=new Float32Array(16);y.matrixWorld.flattenToArray(y._objectMatrixArray)}if(y instanceof THREE.Mesh){t=y.geometry;t.geometryGroups==
|
|
|
-undefined&&B(t);for(q in t.geometryGroups){D=t.geometryGroups[q];if(!D.__webGLVertexBuffer){var A=D;A.__webGLVertexBuffer=e.createBuffer();A.__webGLNormalBuffer=e.createBuffer();A.__webGLTangentBuffer=e.createBuffer();A.__webGLColorBuffer=e.createBuffer();A.__webGLUVBuffer=e.createBuffer();A.__webGLUV2Buffer=e.createBuffer();A.__webGLSkinVertexABuffer=e.createBuffer();A.__webGLSkinVertexBBuffer=e.createBuffer();A.__webGLSkinIndicesBuffer=e.createBuffer();A.__webGLSkinWeightsBuffer=e.createBuffer();
|
|
|
-A.__webGLFaceBuffer=e.createBuffer();A.__webGLLineBuffer=e.createBuffer();if(A.numMorphTargets){var C=void 0,S=void 0;A.__webGLMorphTargetsBuffers=[];C=0;for(S=A.numMorphTargets;C<S;C++)A.__webGLMorphTargetsBuffers.push(e.createBuffer())}A=D;var G=y,H=void 0,ia=void 0,oa=S=C=0;H=void 0;var W=void 0;ia=void 0;ia=void 0;var ha=G.geometry;W=ha.faces;var pa=A.faces;H=0;for(ia=pa.length;H<ia;H++){fi=pa[H];face=W[fi];if(face instanceof THREE.Face3){C+=3;S+=1;oa+=3}else if(face instanceof THREE.Face4){C+=
|
|
|
-4;S+=2;oa+=4}}H=A;ia=G;W=void 0;pa=void 0;var za=void 0,Ea=void 0;za=void 0;var ra=[];W=0;for(pa=ia.materials.length;W<pa;W++){za=ia.materials[W];if(za instanceof THREE.MeshFaceMaterial){za=0;for(l=H.materials.length;za<l;za++)(Ea=H.materials[za])&&ra.push(Ea)}else(Ea=za)&&ra.push(Ea)}ia=ra;a:{H=void 0;W=void 0;pa=ia.length;for(H=0;H<pa;H++){W=ia[H];if(W.map||W.lightMap){H=!0;break a}}H=!1}a:{W=void 0;pa=void 0;ra=ia.length;for(W=0;W<ra;W++){pa=ia[W];if(pa.vertexColors){W=pa.vertexColors;break a}}W=
|
|
|
-!1}a:{pa=void 0;ra=void 0;za=ia.length;for(pa=0;pa<za;pa++){ra=ia[pa];if(!(ra instanceof THREE.MeshBasicMaterial||ra instanceof THREE.MeshDepthMaterial)){ia=ra&&ra.shading!=undefined&&ra.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ia=!1}A.__vertexArray=new Float32Array(C*3);if(ia)A.__normalArray=new Float32Array(C*3);if(ha.hasTangents)A.__tangentArray=new Float32Array(C*4);if(W)A.__colorArray=new Float32Array(C*3);if(H){if(ha.faceUvs.length>0||ha.faceVertexUvs.length>
|
|
|
-0)A.__uvArray=new Float32Array(C*2);if(ha.faceUvs.length>1||ha.faceVertexUvs.length>1)A.__uv2Array=new Float32Array(C*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){A.__skinVertexAArray=new Float32Array(C*4);A.__skinVertexBArray=new Float32Array(C*4);A.__skinIndexArray=new Float32Array(C*4);A.__skinWeightArray=new Float32Array(C*4)}A.__faceArray=new Uint16Array(S*3);A.__lineArray=new Uint16Array(oa*2);if(A.numMorphTargets){G=void 0;ha=void 0;A.__morphTargetsArrays=[];G=0;for(ha=
|
|
|
-A.numMorphTargets;G<ha;G++)A.__morphTargetsArrays.push(new Float32Array(C*3))}A.__needsSmoothNormals=ia==THREE.SmoothShading;A.__uvType=H;A.__vertexColorType=W;A.__normalType=ia;A.__webGLFaceCount=S*3;A.__webGLLineCount=oa*2;t.__dirtyVertices=!0;t.__dirtyMorphTargets=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=!0}E(z.__webglObjects,D,y)}}else if(y instanceof THREE.Ribbon){t=y.geometry;if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=e.createBuffer();
|
|
|
-q.__webGLColorBuffer=e.createBuffer();q=t;D=q.vertices.length;q.__vertexArray=new Float32Array(D*3);q.__colorArray=new Float32Array(D*3);q.__webGLVertexCount=D;t.__dirtyVertices=!0;t.__dirtyColors=!0}E(z.__webglObjects,t,y)}else if(y instanceof THREE.Line){t=y.geometry;if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=e.createBuffer();q.__webGLColorBuffer=e.createBuffer();q=t;D=q.vertices.length;q.__vertexArray=new Float32Array(D*3);q.__colorArray=new Float32Array(D*3);q.__webGLLineCount=D;t.__dirtyVertices=
|
|
|
-!0;t.__dirtyColors=!0}E(z.__webglObjects,t,y)}else if(y instanceof THREE.ParticleSystem){t=y.geometry;if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=e.createBuffer();q.__webGLColorBuffer=e.createBuffer();q=t;D=q.vertices.length;q.__vertexArray=new Float32Array(D*3);q.__colorArray=new Float32Array(D*3);q.__sortArray=[];q.__webGLParticleCount=D;t.__dirtyVertices=!0;t.__dirtyColors=!0}E(z.__webglObjects,t,y)}else THREE.MarchingCubes!==undefined&&y instanceof THREE.MarchingCubes&&z.__webglObjectsImmediate.push({object:y,
|
|
|
-opaque:{list:[],count:0},transparent:{list:[],count:0}});k.__objectsAdded.splice(0,1)}for(;k.__objectsRemoved.length;){y=k.__objectsRemoved[0];z=k;t=void 0;q=void 0;for(t=z.__webglObjects.length-1;t>=0;t--){q=z.__webglObjects[t].object;y==q&&z.__webglObjects.splice(t,1)}k.__objectsRemoved.splice(0,1)}y=0;for(z=k.__webglObjects.length;y<z;y++){q=k.__webglObjects[y].object;D=void 0;t=void 0;A=void 0;if(q instanceof THREE.Mesh){t=q.geometry;for(D in t.geometryGroups){A=t.geometryGroups[D];if(t.__dirtyVertices||
|
|
|
-t.__dirtyMorphTargets||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){C=e.DYNAMIC_DRAW;S=void 0;oa=void 0;var Na=void 0,L=void 0,Ma=void 0,La=void 0,Fa=void 0,Pa=void 0,Ra=void 0;Na=void 0;var T=void 0,Z=void 0,P=void 0,Aa=void 0;Fa=void 0;Pa=void 0;T=void 0;L=void 0;T=void 0;Z=void 0;P=void 0;Fa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;T=void 0;Z=void 0;P=void 0;Aa=void 0;L=void 0;
|
|
|
-La=void 0;Ma=void 0;Ra=void 0;var Ia=void 0,Va=void 0,Ka=void 0,F=Ea=za=ra=pa=W=ia=H=ha=G=0,I=0,$=A.__vertexArray,ga=A.__uvArray,Q=A.__uv2Array,X=A.__normalArray,ca=A.__tangentArray,va=A.__colorArray,sa=A.__skinVertexAArray,ua=A.__skinVertexBArray,Da=A.__skinIndexArray,ya=A.__skinWeightArray,Ta=A.__morphTargetsArrays,Qa=A.__faceArray,Ja=A.__lineArray,Ua=A.__needsSmoothNormals,bb=A.__vertexColorType,Oa=q.geometry,cb=Oa.__dirtyVertices,db=Oa.__dirtyElements,ab=Oa.__dirtyUvs,eb=Oa.__dirtyNormals,fb=
|
|
|
-Oa.__dirtyTangents,gb=Oa.__dirtyColors,hb=Oa.__dirtyMorphTargets,Sa=Oa.vertices,ib=A.faces,jb=Oa.faces,kb=Oa.faceVertexUvs[0],lb=Oa.faceVertexUvs[1],mb=Oa.colors,Ya=Oa.skinVerticesA,Za=Oa.skinVerticesB,$a=Oa.skinIndices,Xa=Oa.skinWeights,Wa=Oa.morphTargets;S=0;for(oa=ib.length;S<oa;S++){Na=ib[S];L=jb[Na];Ra=kb[Na];Na=lb[Na];Ma=L.vertexNormals;La=L.normal;Fa=L.vertexColors;Pa=L.color;if(L instanceof THREE.Face3){if(cb){T=Sa[L.a].position;Z=Sa[L.b].position;P=Sa[L.c].position;$[ha]=T.x;$[ha+1]=T.y;
|
|
|
-$[ha+2]=T.z;$[ha+3]=Z.x;$[ha+4]=Z.y;$[ha+5]=Z.z;$[ha+6]=P.x;$[ha+7]=P.y;$[ha+8]=P.z;ha+=9}if(hb){Ia=0;for(Va=Wa.length;Ia<Va;Ia++){T=Wa[Ia].vertices[L.a].position;Z=Wa[Ia].vertices[L.b].position;P=Wa[Ia].vertices[L.c].position;Ka=Ta[Ia];Ka[I+0]=T.x;Ka[I+1]=T.y;Ka[I+2]=T.z;Ka[I+3]=Z.x;Ka[I+4]=Z.y;Ka[I+5]=Z.z;Ka[I+6]=P.x;Ka[I+7]=P.y;Ka[I+8]=P.z}I+=9}if(Xa.length){T=Xa[L.a];Z=Xa[L.b];P=Xa[L.c];ya[F]=T.x;ya[F+1]=T.y;ya[F+2]=T.z;ya[F+3]=T.w;ya[F+4]=Z.x;ya[F+5]=Z.y;ya[F+6]=Z.z;ya[F+7]=Z.w;ya[F+8]=P.x;ya[F+
|
|
|
-9]=P.y;ya[F+10]=P.z;ya[F+11]=P.w;T=$a[L.a];Z=$a[L.b];P=$a[L.c];Da[F]=T.x;Da[F+1]=T.y;Da[F+2]=T.z;Da[F+3]=T.w;Da[F+4]=Z.x;Da[F+5]=Z.y;Da[F+6]=Z.z;Da[F+7]=Z.w;Da[F+8]=P.x;Da[F+9]=P.y;Da[F+10]=P.z;Da[F+11]=P.w;T=Ya[L.a];Z=Ya[L.b];P=Ya[L.c];sa[F]=T.x;sa[F+1]=T.y;sa[F+2]=T.z;sa[F+3]=1;sa[F+4]=Z.x;sa[F+5]=Z.y;sa[F+6]=Z.z;sa[F+7]=1;sa[F+8]=P.x;sa[F+9]=P.y;sa[F+10]=P.z;sa[F+11]=1;T=Za[L.a];Z=Za[L.b];P=Za[L.c];ua[F]=T.x;ua[F+1]=T.y;ua[F+2]=T.z;ua[F+3]=1;ua[F+4]=Z.x;ua[F+5]=Z.y;ua[F+6]=Z.z;ua[F+7]=1;ua[F+8]=
|
|
|
-P.x;ua[F+9]=P.y;ua[F+10]=P.z;ua[F+11]=1;F+=12}if(gb&&bb){if(Fa.length==3&&bb==THREE.VertexColors){T=Fa[0];Z=Fa[1];P=Fa[2]}else P=Z=T=Pa;va[Ea]=T.r;va[Ea+1]=T.g;va[Ea+2]=T.b;va[Ea+3]=Z.r;va[Ea+4]=Z.g;va[Ea+5]=Z.b;va[Ea+6]=P.r;va[Ea+7]=P.g;va[Ea+8]=P.b;Ea+=9}if(fb&&Oa.hasTangents){Fa=Sa[L.a].tangent;Pa=Sa[L.b].tangent;T=Sa[L.c].tangent;ca[ra]=Fa.x;ca[ra+1]=Fa.y;ca[ra+2]=Fa.z;ca[ra+3]=Fa.w;ca[ra+4]=Pa.x;ca[ra+5]=Pa.y;ca[ra+6]=Pa.z;ca[ra+7]=Pa.w;ca[ra+8]=T.x;ca[ra+9]=T.y;ca[ra+10]=T.z;ca[ra+11]=T.w;ra+=
|
|
|
-12}if(eb)if(Ma.length==3&&Ua)for(L=0;L<3;L++){La=Ma[L];X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}else for(L=0;L<3;L++){X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}if(ab&&Ra)for(L=0;L<3;L++){Ma=Ra[L];ga[H]=Ma.u;ga[H+1]=Ma.v;H+=2}if(ab&&Na)for(L=0;L<3;L++){Ra=Na[L];Q[ia]=Ra.u;Q[ia+1]=Ra.v;ia+=2}if(db){Qa[W]=G;Qa[W+1]=G+1;Qa[W+2]=G+2;W+=3;Ja[za]=G;Ja[za+1]=G+1;Ja[za+2]=G;Ja[za+3]=G+2;Ja[za+4]=G+1;Ja[za+5]=G+2;za+=6;G+=3}}else if(L instanceof THREE.Face4){if(cb){T=Sa[L.a].position;Z=Sa[L.b].position;
|
|
|
-P=Sa[L.c].position;Aa=Sa[L.d].position;$[ha]=T.x;$[ha+1]=T.y;$[ha+2]=T.z;$[ha+3]=Z.x;$[ha+4]=Z.y;$[ha+5]=Z.z;$[ha+6]=P.x;$[ha+7]=P.y;$[ha+8]=P.z;$[ha+9]=Aa.x;$[ha+10]=Aa.y;$[ha+11]=Aa.z;ha+=12}if(hb){Ia=0;for(Va=Wa.length;Ia<Va;Ia++){T=Wa[Ia].vertices[L.a].position;Z=Wa[Ia].vertices[L.b].position;P=Wa[Ia].vertices[L.c].position;Aa=Wa[Ia].vertices[L.d].position;Ka=Ta[Ia];Ka[I+0]=T.x;Ka[I+1]=T.y;Ka[I+2]=T.z;Ka[I+3]=Z.x;Ka[I+4]=Z.y;Ka[I+5]=Z.z;Ka[I+6]=P.x;Ka[I+7]=P.y;Ka[I+8]=P.z;Ka[I+9]=Aa.x;Ka[I+10]=
|
|
|
-Aa.y;Ka[I+11]=Aa.z}I+=12}if(Xa.length){T=Xa[L.a];Z=Xa[L.b];P=Xa[L.c];Aa=Xa[L.d];ya[F]=T.x;ya[F+1]=T.y;ya[F+2]=T.z;ya[F+3]=T.w;ya[F+4]=Z.x;ya[F+5]=Z.y;ya[F+6]=Z.z;ya[F+7]=Z.w;ya[F+8]=P.x;ya[F+9]=P.y;ya[F+10]=P.z;ya[F+11]=P.w;ya[F+12]=Aa.x;ya[F+13]=Aa.y;ya[F+14]=Aa.z;ya[F+15]=Aa.w;T=$a[L.a];Z=$a[L.b];P=$a[L.c];Aa=$a[L.d];Da[F]=T.x;Da[F+1]=T.y;Da[F+2]=T.z;Da[F+3]=T.w;Da[F+4]=Z.x;Da[F+5]=Z.y;Da[F+6]=Z.z;Da[F+7]=Z.w;Da[F+8]=P.x;Da[F+9]=P.y;Da[F+10]=P.z;Da[F+11]=P.w;Da[F+12]=Aa.x;Da[F+13]=Aa.y;Da[F+14]=
|
|
|
-Aa.z;Da[F+15]=Aa.w;T=Ya[L.a];Z=Ya[L.b];P=Ya[L.c];Aa=Ya[L.d];sa[F]=T.x;sa[F+1]=T.y;sa[F+2]=T.z;sa[F+3]=1;sa[F+4]=Z.x;sa[F+5]=Z.y;sa[F+6]=Z.z;sa[F+7]=1;sa[F+8]=P.x;sa[F+9]=P.y;sa[F+10]=P.z;sa[F+11]=1;sa[F+12]=Aa.x;sa[F+13]=Aa.y;sa[F+14]=Aa.z;sa[F+15]=1;T=Za[L.a];Z=Za[L.b];P=Za[L.c];Aa=Za[L.d];ua[F]=T.x;ua[F+1]=T.y;ua[F+2]=T.z;ua[F+3]=1;ua[F+4]=Z.x;ua[F+5]=Z.y;ua[F+6]=Z.z;ua[F+7]=1;ua[F+8]=P.x;ua[F+9]=P.y;ua[F+10]=P.z;ua[F+11]=1;ua[F+12]=Aa.x;ua[F+13]=Aa.y;ua[F+14]=Aa.z;ua[F+15]=1;F+=16}if(gb&&bb){if(Fa.length==
|
|
|
-4&&bb==THREE.VertexColors){T=Fa[0];Z=Fa[1];P=Fa[2];Fa=Fa[3]}else Fa=P=Z=T=Pa;va[Ea]=T.r;va[Ea+1]=T.g;va[Ea+2]=T.b;va[Ea+3]=Z.r;va[Ea+4]=Z.g;va[Ea+5]=Z.b;va[Ea+6]=P.r;va[Ea+7]=P.g;va[Ea+8]=P.b;va[Ea+9]=Fa.r;va[Ea+10]=Fa.g;va[Ea+11]=Fa.b;Ea+=12}if(fb&&Oa.hasTangents){Fa=Sa[L.a].tangent;Pa=Sa[L.b].tangent;T=Sa[L.c].tangent;L=Sa[L.d].tangent;ca[ra]=Fa.x;ca[ra+1]=Fa.y;ca[ra+2]=Fa.z;ca[ra+3]=Fa.w;ca[ra+4]=Pa.x;ca[ra+5]=Pa.y;ca[ra+6]=Pa.z;ca[ra+7]=Pa.w;ca[ra+8]=T.x;ca[ra+9]=T.y;ca[ra+10]=T.z;ca[ra+11]=T.w;
|
|
|
-ca[ra+12]=L.x;ca[ra+13]=L.y;ca[ra+14]=L.z;ca[ra+15]=L.w;ra+=16}if(eb)if(Ma.length==4&&Ua)for(L=0;L<4;L++){La=Ma[L];X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}else for(L=0;L<4;L++){X[pa]=La.x;X[pa+1]=La.y;X[pa+2]=La.z;pa+=3}if(ab&&Ra)for(L=0;L<4;L++){Ma=Ra[L];ga[H]=Ma.u;ga[H+1]=Ma.v;H+=2}if(ab&&Na)for(L=0;L<4;L++){Ra=Na[L];Q[ia]=Ra.u;Q[ia+1]=Ra.v;ia+=2}if(db){Qa[W]=G;Qa[W+1]=G+1;Qa[W+2]=G+2;Qa[W+3]=G;Qa[W+4]=G+2;Qa[W+5]=G+3;W+=6;Ja[za]=G;Ja[za+1]=G+1;Ja[za+2]=G;Ja[za+3]=G+3;Ja[za+4]=G+1;Ja[za+5]=G+
|
|
|
-2;Ja[za+6]=G+2;Ja[za+7]=G+3;za+=8;G+=4}}}if(cb){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,$,C)}if(hb){Ia=0;for(Va=Wa.length;Ia<Va;Ia++){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLMorphTargetsBuffers[Ia]);e.bufferData(e.ARRAY_BUFFER,Ta[Ia],C)}}if(gb&&mb.length){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,va,C)}if(eb){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,X,C)}if(fb&&Oa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
-A.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ca,C)}if(ab&&H>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,ga,C)}if(ab&&ia>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Q,C)}if(db){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Qa,C);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ja,C)}if(F>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);
|
|
|
-e.bufferData(e.ARRAY_BUFFER,sa,C);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,C);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Da,C);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ya,C)}}}t.__dirtyVertices=!1;t.__dirtyMorphTargets=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(q instanceof THREE.Ribbon){t=q.geometry;if(t.__dirtyVertices||
|
|
|
-t.__dirtyColors){q=t;D=e.DYNAMIC_DRAW;G=void 0;G=void 0;ha=void 0;A=void 0;H=q.vertices;C=q.colors;ia=H.length;S=C.length;W=q.__vertexArray;oa=q.__colorArray;pa=q.__dirtyColors;if(q.__dirtyVertices){for(G=0;G<ia;G++){ha=H[G].position;A=G*3;W[A]=ha.x;W[A+1]=ha.y;W[A+2]=ha.z}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,W,D)}if(pa){for(G=0;G<S;G++){color=C[G];A=G*3;oa[A]=color.r;oa[A+1]=color.g;oa[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
-oa,D)}}t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(q instanceof THREE.Line){t=q.geometry;if(t.__dirtyVertices||t.__dirtyColors){q=t;D=e.DYNAMIC_DRAW;G=void 0;G=void 0;ha=void 0;A=void 0;H=q.vertices;C=q.colors;ia=H.length;S=C.length;W=q.__vertexArray;oa=q.__colorArray;pa=q.__dirtyColors;if(q.__dirtyVertices){for(G=0;G<ia;G++){ha=H[G].position;A=G*3;W[A]=ha.x;W[A+1]=ha.y;W[A+2]=ha.z}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,W,D)}if(pa){for(G=0;G<S;G++){color=
|
|
|
-C[G];A=G*3;oa[A]=color.r;oa[A+1]=color.g;oa[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,q.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,oa,D)}}t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(q instanceof THREE.ParticleSystem){t=q.geometry;(t.__dirtyVertices||t.__dirtyColors||q.sortParticles)&&c(t,e.DYNAMIC_DRAW,q);t.__dirtyVertices=!1;t.__dirtyColors=!1}}};this.setFaceCulling=function(k,y){if(k){!y||y=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(k=="back")e.cullFace(e.BACK);else k=="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}};
|
|
|
-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(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,f=b.length;for(d=0;d<f;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
+THREE.WebGLRenderer=function(a){function c(m,D,p){var n,q,E,C=m.vertices,F=C.length,S=m.colors,P=S.length,H=m.__vertexArray,X=m.__colorArray,qa=m.__sortArray,Z=m.__dirtyVertices,Ca=m.__dirtyColors;if(p.sortParticles){Ha.multiplySelf(p.matrixWorld);for(n=0;n<F;n++){q=C[n].position;ra.copy(q);Ha.multiplyVector3(ra);qa[n]=[ra.z,n]}qa.sort(function(ya,Ea){return Ea[0]-ya[0]});for(n=0;n<F;n++){q=C[qa[n][1]].position;E=n*3;H[E]=q.x;H[E+1]=q.y;H[E+2]=q.z}for(n=0;n<P;n++){E=n*3;color=S[qa[n][1]];X[E]=color.r;
|
|
|
+X[E+1]=color.g;X[E+2]=color.b}}else{if(Z)for(n=0;n<F;n++){q=C[n].position;E=n*3;H[E]=q.x;H[E+1]=q.y;H[E+2]=q.z}if(Ca)for(n=0;n<P;n++){color=S[n];E=n*3;X[E]=color.r;X[E+1]=color.g;X[E+2]=color.b}}if(Z||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,H,D)}if(Ca||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,X,D)}}function b(m,D){m.fragmentShader=D.fragmentShader;m.vertexShader=D.vertexShader;m.uniforms=
|
|
|
+Uniforms.clone(D.uniforms)}function d(m,D,p,n,q){n.program||na.initMaterial(n,D,p,q);var E=n.program,C=E.uniforms,F=n.uniforms;if(E!=Y){f.useProgram(E);Y=E}f.uniformMatrix4fv(C.projectionMatrix,!1,ma);if(p&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){F.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){F.fogNear.value=p.near;F.fogFar.value=
|
|
|
+p.far}else if(p instanceof THREE.FogExp2)F.fogDensity.value=p.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n.lights){var S,P,H=0,X=0,qa=0,Z,Ca,ya,Ea=sa,Aa=Ea.directional.colors,La=Ea.directional.positions,Ia=Ea.point.colors,O=Ea.point.positions,Na=0,Ja=0;p=P=P=0;for(S=D.length;p<S;p++){P=D[p];Z=P.color;Ca=P.position;ya=P.intensity;if(P instanceof THREE.AmbientLight){H+=Z.r;X+=Z.g;qa+=Z.b}else if(P instanceof THREE.DirectionalLight){P=Na*3;Aa[P]=Z.r*ya;Aa[P+
|
|
|
+1]=Z.g*ya;Aa[P+2]=Z.b*ya;La[P]=Ca.x;La[P+1]=Ca.y;La[P+2]=Ca.z;Na+=1}else if(P instanceof THREE.PointLight){P=Ja*3;Ia[P]=Z.r*ya;Ia[P+1]=Z.g*ya;Ia[P+2]=Z.b*ya;O[P]=Ca.x;O[P+1]=Ca.y;O[P+2]=Ca.z;Ja+=1}}for(p=Na*3;p<Aa.length;p++)Aa[p]=0;for(p=Ja*3;p<Ia.length;p++)Ia[p]=0;Ea.point.length=Ja;Ea.directional.length=Na;Ea.ambient[0]=H;Ea.ambient[1]=X;Ea.ambient[2]=qa;D=sa;F.enableLighting.value=D.directional.length+D.point.length;F.ambientLightColor.value=D.ambient;F.directionalLightColor.value=D.directional.colors;
|
|
|
+F.directionalLightDirection.value=D.directional.positions;F.pointLightColor.value=D.point.colors;F.pointLightPosition.value=D.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){F.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);F.opacity.value=n.opacity;F.map.texture=n.map;F.lightMap.texture=n.lightMap;F.envMap.texture=n.envMap;F.reflectivity.value=n.reflectivity;F.refractionRatio.value=
|
|
|
+n.refractionRatio;F.combine.value=n.combine;F.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){F.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);F.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){F.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);F.opacity.value=n.opacity;F.size.value=n.size;F.scale.value=R.height/2;F.map.texture=n.map}else if(n instanceof
|
|
|
+THREE.MeshPhongMaterial){F.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);F.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);F.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){F.mNear.value=m.near;F.mFar.value=m.far;F.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)F.opacity.value=n.opacity;for(var Qa in F)if(H=E.uniforms[Qa]){p=F[Qa];S=p.type;D=p.value;if(S=="i")f.uniform1i(H,D);else if(S=="f")f.uniform1f(H,D);else if(S=="fv1")f.uniform1fv(H,
|
|
|
+D);else if(S=="fv")f.uniform3fv(H,D);else if(S=="v2")f.uniform2f(H,D.x,D.y);else if(S=="v3")f.uniform3f(H,D.x,D.y,D.z);else if(S=="c")f.uniform3f(H,D.r,D.g,D.b);else if(S=="t"){f.uniform1i(H,D);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(S=0;S<6;++S)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[S])}else{p.image.__webGLTextureCube=
|
|
|
+f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(S=0;S<6;++S)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[S]);p.__wasSetOnce=!0}J(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+D);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,
|
|
|
+0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}J(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+D);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,q._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,!1,q._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||
|
|
|
+n instanceof THREE.MeshPhongMaterial||n.envMap)&&f.uniform3f(C.cameraPosition,m.position.x,m.position.y,m.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,q._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,da);if(n.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,!1,da);f.uniformMatrix4fv(C.boneGlobalMatrices,
|
|
|
+!1,q.boneMatrices)}return E}function e(m,D,p,n,q,E){if(n.opacity!=0){m=d(m,D,p,n,E).attributes;if(n.morphTargets){D=n.program.attributes;E.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[E.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,q.__webGLVertexBuffer);f.vertexAttribPointer(D.position,3,f.FLOAT,!1,0,0);if(E.morphTargetForcedOrder.length){p=0;for(var C=E.morphTargetForcedOrder,F=E.morphTargetInfluences;p<n.numSupportedMorphTargets&&p<C.length;){f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
+q.__webGLMorphTargetsBuffers[C[p]]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,0,0);E.__webGLMorphTargetInfluences[p]=F[C[p]];p++}}else{C=[];var S=-1,P=0;F=E.morphTargetInfluences;var H,X=F.length;p=0;for(E.morphTargetBase!==-1&&(C[E.morphTargetBase]=!0);p<n.numSupportedMorphTargets;){for(H=0;H<X;H++)if(!C[H]&&F[H]>S){P=H;S=F[P]}f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[P]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,0,0);E.__webGLMorphTargetInfluences[p]=S;C[P]=
|
|
|
+1;S=-1;p++}}f.uniform1fv(n.program.uniforms.morphTargetInfluences,E.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,q.__webGLVertexBuffer);f.vertexAttribPointer(m.position,3,f.FLOAT,!1,0,0)}if(m.color>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLColorBuffer);f.vertexAttribPointer(m.color,3,f.FLOAT,!1,0,0)}if(m.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLNormalBuffer);f.vertexAttribPointer(m.normal,3,f.FLOAT,!1,0,0)}if(m.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLTangentBuffer);
|
|
|
+f.vertexAttribPointer(m.tangent,4,f.FLOAT,!1,0,0)}if(m.uv>=0)if(q.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLUVBuffer);f.vertexAttribPointer(m.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv)}else f.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(q.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLUV2Buffer);f.vertexAttribPointer(m.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv2)}else f.disableVertexAttribArray(m.uv2);if(n.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=
|
|
|
+0&&m.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);f.vertexAttribPointer(m.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);f.vertexAttribPointer(m.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);f.vertexAttribPointer(m.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);f.vertexAttribPointer(m.skinWeight,4,f.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);
|
|
|
+f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);f.drawElements(f.LINES,q.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,q.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(E,0,q.__webGLLineCount)}else if(E instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,q.__webGLParticleCount);else E instanceof THREE.Ribbon&&
|
|
|
+f.drawArrays(f.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function g(m,D){if(!m.__webGLVertexBuffer)m.__webGLVertexBuffer=f.createBuffer();if(!m.__webGLNormalBuffer)m.__webGLNormalBuffer=f.createBuffer();if(m.hasPos){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,m.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.position);f.vertexAttribPointer(D.attributes.position,3,f.FLOAT,!1,0,0)}if(m.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLNormalBuffer);
|
|
|
+f.bufferData(f.ARRAY_BUFFER,m.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.normal);f.vertexAttribPointer(D.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,m.count);m.count=0}function h(m){if(ja!=m.doubleSided){m.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ja=m.doubleSided}if(M!=m.flipSided){m.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);M=m.flipSided}}function j(m){if(Ga!=m){m?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);Ga=m}}function k(m){wa[0].set(m.n41-
|
|
|
+m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);wa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);wa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);wa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);wa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);wa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var D;for(m=0;m<6;m++){D=wa[m];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function o(m){for(var D=m.matrixWorld,p=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,
|
|
|
+Math.max(m.scale.y,m.scale.z)),n=0;n<6;n++){m=wa[n].x*D.n14+wa[n].y*D.n24+wa[n].z*D.n34+wa[n].w;if(m<=p)return!1}return!0}function w(m,D){m.list[m.count]=D;m.count+=1}function y(m){var D,p,n=m.object,q=m.opaque,E=m.transparent;E.count=0;m=q.count=0;for(D=n.materials.length;m<D;m++){p=n.materials[m];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?w(E,p):w(q,p)}}function x(m){var D,p,n,q,E=m.object,C=m.buffer,F=m.opaque,S=m.transparent;S.count=0;m=F.count=0;for(n=E.materials.length;m<n;m++){D=
|
|
|
+E.materials[m];if(D instanceof THREE.MeshFaceMaterial){D=0;for(p=C.materials.length;D<p;D++)(q=C.materials[D])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?w(S,q):w(F,q))}else{q=D;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?w(S,q):w(F,q)}}}function t(m,D){return D.z-m.z}function B(m,D){m._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){function D(qa){var Z=
|
|
|
+[];p=0;for(n=qa.length;p<n;p++)qa[p]==undefined?Z.push("undefined"):Z.push(qa[p].id);return Z.join("_")}var p,n,q,E,C,F,S,P,H={},X=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};q=0;for(E=m.faces.length;q<E;q++){C=m.faces[q];F=C.materials;S=D(F);H[S]==undefined&&(H[S]={hash:S,counter:0});P=H[S].hash+"_"+H[S].counter;m.geometryGroups[P]==undefined&&(m.geometryGroups[P]={faces:[],materials:F,vertices:0,numMorphTargets:X});C=C instanceof THREE.Face3?3:4;if(m.geometryGroups[P].vertices+
|
|
|
+C>65535){H[S].counter+=1;P=H[S].hash+"_"+H[S].counter;m.geometryGroups[P]==undefined&&(m.geometryGroups[P]={faces:[],materials:F,vertices:0,numMorphTargets:X})}m.geometryGroups[P].faces.push(q);m.geometryGroups[P].vertices+=C}}function I(m,D,p){m.push({buffer:D,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function A(m){if(m!=ga){switch(m){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,
|
|
|
+f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ga=m}}function J(m,D,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(m,f.TEXTURE_WRAP_S,fa(D.wrapS));f.texParameteri(m,f.TEXTURE_WRAP_T,fa(D.wrapT));f.texParameteri(m,
|
|
|
+f.TEXTURE_MAG_FILTER,fa(D.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,fa(D.minFilter));f.generateMipmap(m)}else{f.texParameteri(m,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_MAG_FILTER,N(D.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,N(D.minFilter))}}function z(m){if(m&&!m.__webGLFramebuffer){m.__webGLFramebuffer=f.createFramebuffer();m.__webGLRenderbuffer=f.createRenderbuffer();m.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,
|
|
|
+m.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,m.width,m.height);f.bindTexture(f.TEXTURE_2D,m.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,fa(m.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,fa(m.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,fa(m.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,fa(m.minFilter));f.texImage2D(f.TEXTURE_2D,0,fa(m.format),m.width,m.height,0,fa(m.format),fa(m.type),null);f.bindFramebuffer(f.FRAMEBUFFER,
|
|
|
+m.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,m.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,m.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var D,p;if(m){D=m.__webGLFramebuffer;p=m.width;m=m.height}else{D=null;p=oa;m=ka}if(D!=W){f.bindFramebuffer(f.FRAMEBUFFER,D);f.viewport(ha,Ba,p,m);W=D}}function Q(m,D){var p;if(m=="fragment")p=
|
|
|
+f.createShader(f.FRAGMENT_SHADER);else m=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,D);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));return null}return p}function N(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function fa(m){switch(m){case THREE.RepeatWrapping:return f.REPEAT;
|
|
|
+case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;
|
|
|
+case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var R=document.createElement("canvas"),
|
|
|
+f,Y=null,W=null,na=this,ja=null,M=null,ga=null,Ga=null,ha=0,Ba=0,oa=0,ka=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ha=new THREE.Matrix4,ma=new Float32Array(16),da=new Float32Array(16),ra=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},T=!0,pa=new THREE.Color(0),ua=0;if(a){if(a.antialias!==undefined)T=a.antialias;a.clearColor!==undefined&&pa.setHex(a.clearColor);
|
|
|
+if(a.clearAlpha!==undefined)ua=a.clearAlpha}this.maxMorphTargets=8;this.domElement=R;this.autoClear=!0;this.sortObjects=!0;(function(m,D,p){try{if(!(f=R.getContext("experimental-webgl",{antialias:m})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(D.r,D.g,D.b,p);_cullEnabled=
|
|
|
+!0})(T,pa,ua);this.context=f;this.setSize=function(m,D){R.width=m;R.height=D;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(m,D,p,n){ha=m;Ba=D;oa=p;ka=n;f.viewport(ha,Ba,oa,ka)};this.setScissor=function(m,D,p,n){f.scissor(m,D,p,n)};this.enableScissorTest=function(m){m?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){f.depthMask(m)};this.setClearColorHex=function(m,D){var p=new THREE.Color(m);f.clearColor(p.r,p.g,p.b,D)};this.setClearColor=
|
|
|
+function(m,D){f.clearColor(m.r,m.g,m.b,D)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(m,D,p,n){var q,E,C;if(m instanceof THREE.MeshDepthMaterial)b(m,THREE.ShaderLib.depth);else if(m instanceof THREE.MeshNormalMaterial)b(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)b(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)b(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)b(m,THREE.ShaderLib.phong);
|
|
|
+else if(m instanceof THREE.LineBasicMaterial)b(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&b(m,THREE.ShaderLib.particle_basic);var F,S,P,H;C=P=H=0;for(F=D.length;C<F;C++){S=D[C];S instanceof THREE.DirectionalLight&&P++;S instanceof THREE.PointLight&&H++}if(H+P<=4)D=P;else{D=Math.ceil(4*P/(H+P));H=4-D}C={directional:D,point:H};F=50;if(n!==undefined&&n instanceof THREE.SkinnedMesh)F=n.bones.length;H=m.fragmentShader;D=m.vertexShader;F={fog:p,map:m.map,envMap:m.envMap,lightMap:m.lightMap,
|
|
|
+vertexColors:m.vertexColors,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:C.directional,maxPointLights:C.point,maxBones:F};p=f.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.fog?"#define USE_FOG":"",F.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":
|
|
|
+"",F.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");F=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,"#define MAX_BONES "+F.maxBones,F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"",F.skinning?"#define USE_SKINNING":"",F.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
+"",F.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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+f.attachShader(p,Q("fragment",C+H));f.attachShader(p,Q("vertex",F+D));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};m.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in m.uniforms)p.push(q);
|
|
|
+q=m.program;H=0;for(D=p.length;H<D;H++){C=p[H];q.uniforms[C]=f.getUniformLocation(q,C)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)p.push("morphTarget"+q);for(E in m.attributes)p.push(E);E=m.program;q=p;p=0;for(H=q.length;p<H;p++){D=q[p];E.attributes[D]=f.getAttribLocation(E,D)}E=m.program.attributes;f.enableVertexAttribArray(E.position);E.color>=0&&f.enableVertexAttribArray(E.color);E.normal>=0&&f.enableVertexAttribArray(E.normal);
|
|
|
+E.tangent>=0&&f.enableVertexAttribArray(E.tangent);if(m.skinning&&E.skinVertexA>=0&&E.skinVertexB>=0&&E.skinIndex>=0&&E.skinWeight>=0){f.enableVertexAttribArray(E.skinVertexA);f.enableVertexAttribArray(E.skinVertexB);f.enableVertexAttribArray(E.skinIndex);f.enableVertexAttribArray(E.skinWeight)}if(m.morphTargets){m.numSupportedMorphTargets=0;if(E.morphTarget0>=0){f.enableVertexAttribArray(E.morphTarget0);m.numSupportedMorphTargets++}if(E.morphTarget1>=0){f.enableVertexAttribArray(E.morphTarget1);
|
|
|
+m.numSupportedMorphTargets++}if(E.morphTarget2>=0){f.enableVertexAttribArray(E.morphTarget2);m.numSupportedMorphTargets++}if(E.morphTarget3>=0){f.enableVertexAttribArray(E.morphTarget3);m.numSupportedMorphTargets++}if(E.morphTarget4>=0){f.enableVertexAttribArray(E.morphTarget4);m.numSupportedMorphTargets++}if(E.morphTarget5>=0){f.enableVertexAttribArray(E.morphTarget5);m.numSupportedMorphTargets++}if(E.morphTarget6>=0){f.enableVertexAttribArray(E.morphTarget6);m.numSupportedMorphTargets++}if(E.morphTarget7>=
|
|
|
+0){f.enableVertexAttribArray(E.morphTarget7);m.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q<this.maxMorphTargets;q++)n.__webGLMorphTargetInfluences[q]=0}};this.render=function(m,D,p,n){var q,E,C,F,S,P,H,X,qa=m.lights,Z=m.fog;D.matrixAutoUpdate&&D.updateMatrix();m.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(da);D.projectionMatrix.flattenToArray(ma);Ha.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ha);this.initWebGLObjects(m);
|
|
|
+z(p);(this.autoClear||n)&&this.clear();S=m.__webglObjects.length;for(n=0;n<S;n++){q=m.__webglObjects[n];H=q.object;if(H.visible)if(!(H instanceof THREE.Mesh)||o(H)){H.matrixWorld.flattenToArray(H._objectMatrixArray);B(H,D);x(q);q.render=!0;if(this.sortObjects){ra.copy(H.position);Ha.multiplyVector3(ra);q.z=ra.z}}else q.render=!1;else q.render=!1}this.sortObjects&&m.__webglObjects.sort(t);P=m.__webglObjectsImmediate.length;for(n=0;n<P;n++){q=m.__webglObjectsImmediate[n];H=q.object;if(H.visible){H.matrixAutoUpdate&&
|
|
|
+H.matrixWorld.flattenToArray(H._objectMatrixArray);B(H,D);y(q)}}A(THREE.NormalBlending);for(n=0;n<S;n++){q=m.__webglObjects[n];if(q.render){H=q.object;X=q.buffer;C=q.opaque;h(H);for(q=0;q<C.count;q++){F=C.list[q];j(F.depthTest);e(D,qa,Z,F,X,H)}}}for(n=0;n<P;n++){q=m.__webglObjectsImmediate[n];H=q.object;if(H.visible){C=q.opaque;h(H);for(q=0;q<C.count;q++){F=C.list[q];j(F.depthTest);E=d(D,qa,Z,F,H);H.render(function(Ca){g(Ca,E)})}}}for(n=0;n<S;n++){q=m.__webglObjects[n];if(q.render){H=q.object;X=q.buffer;
|
|
|
+C=q.transparent;h(H);for(q=0;q<C.count;q++){F=C.list[q];A(F.blending);j(F.depthTest);e(D,qa,Z,F,X,H)}}}for(n=0;n<P;n++){q=m.__webglObjectsImmediate[n];H=q.object;if(H.visible){C=q.transparent;h(H);for(q=0;q<C.count;q++){F=C.list[q];A(F.blending);j(F.depthTest);E=d(D,qa,Z,F,H);H.render(function(Ca){g(Ca,E)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=
|
|
|
+function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var D=m.__objectsAdded[0],p=m,n=void 0,q=void 0,E=void 0;if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){q=D.geometry;q.geometryGroups==undefined&&G(q);for(n in q.geometryGroups){E=
|
|
|
+q.geometryGroups[n];if(!E.__webGLVertexBuffer){var C=E;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=
|
|
|
+f.createBuffer();if(C.numMorphTargets){var F=void 0,S=void 0;C.__webGLMorphTargetsBuffers=[];F=0;for(S=C.numMorphTargets;F<S;F++)C.__webGLMorphTargetsBuffers.push(f.createBuffer())}C=E;var P=D,H=void 0,X=void 0,qa=S=F=0;H=void 0;X=void 0;var Z=void 0;Z=void 0;var Ca=P.geometry;Z=Ca.faces;var ya=C.faces;H=0;for(X=ya.length;H<X;H++){fi=ya[H];face=Z[fi];if(face instanceof THREE.Face3){F+=3;S+=1;qa+=3}else if(face instanceof THREE.Face4){F+=4;S+=2;qa+=4}}H=C;X=P;Z=void 0;ya=void 0;var Ea=void 0,Aa=void 0;
|
|
|
+Ea=void 0;var La=[];Z=0;for(ya=X.materials.length;Z<ya;Z++){Ea=X.materials[Z];if(Ea instanceof THREE.MeshFaceMaterial){Ea=0;for(l=H.materials.length;Ea<l;Ea++)(Aa=H.materials[Ea])&&La.push(Aa)}else(Aa=Ea)&&La.push(Aa)}Z=La;a:{H=void 0;X=void 0;ya=Z.length;for(H=0;H<ya;H++){X=Z[H];if(X.map||X.lightMap){H=!0;break a}}H=!1}a:{X=void 0;ya=void 0;La=Z.length;for(X=0;X<La;X++){ya=Z[X];if(ya.vertexColors){X=ya.vertexColors;break a}}X=!1}a:{ya=void 0;La=void 0;Ea=Z.length;for(ya=0;ya<Ea;ya++){La=Z[ya];if(!(La instanceof
|
|
|
+THREE.MeshBasicMaterial||La instanceof THREE.MeshDepthMaterial)){Z=La&&La.shading!=undefined&&La.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Z=!1}C.__vertexArray=new Float32Array(F*3);if(Z)C.__normalArray=new Float32Array(F*3);if(Ca.hasTangents)C.__tangentArray=new Float32Array(F*4);if(X)C.__colorArray=new Float32Array(F*3);if(H){if(Ca.faceUvs.length>0||Ca.faceVertexUvs.length>0)C.__uvArray=new Float32Array(F*2);if(Ca.faceUvs.length>1||Ca.faceVertexUvs.length>1)C.__uv2Array=
|
|
|
+new Float32Array(F*2)}if(P.geometry.skinWeights.length&&P.geometry.skinIndices.length){C.__skinVertexAArray=new Float32Array(F*4);C.__skinVertexBArray=new Float32Array(F*4);C.__skinIndexArray=new Float32Array(F*4);C.__skinWeightArray=new Float32Array(F*4)}C.__faceArray=new Uint16Array(S*3);C.__lineArray=new Uint16Array(qa*2);if(C.numMorphTargets){P=void 0;Ca=void 0;C.__morphTargetsArrays=[];P=0;for(Ca=C.numMorphTargets;P<Ca;P++)C.__morphTargetsArrays.push(new Float32Array(F*3))}C.__needsSmoothNormals=
|
|
|
+Z==THREE.SmoothShading;C.__uvType=H;C.__vertexColorType=X;C.__normalType=Z;C.__webGLFaceCount=S*3;C.__webGLLineCount=qa*2;q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}I(p.__webglObjects,E,D)}}else if(D instanceof THREE.Ribbon){q=D.geometry;if(!q.__webGLVertexBuffer){n=q;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=q;E=n.vertices.length;n.__vertexArray=new Float32Array(E*
|
|
|
+3);n.__colorArray=new Float32Array(E*3);n.__webGLVertexCount=E;q.__dirtyVertices=!0;q.__dirtyColors=!0}I(p.__webglObjects,q,D)}else if(D instanceof THREE.Line){q=D.geometry;if(!q.__webGLVertexBuffer){n=q;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=q;E=n.vertices.length;n.__vertexArray=new Float32Array(E*3);n.__colorArray=new Float32Array(E*3);n.__webGLLineCount=E;q.__dirtyVertices=!0;q.__dirtyColors=!0}I(p.__webglObjects,q,D)}else if(D instanceof THREE.ParticleSystem){q=
|
|
|
+D.geometry;if(!q.__webGLVertexBuffer){n=q;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=q;E=n.vertices.length;n.__vertexArray=new Float32Array(E*3);n.__colorArray=new Float32Array(E*3);n.__sortArray=[];n.__webGLParticleCount=E;q.__dirtyVertices=!0;q.__dirtyColors=!0}I(p.__webglObjects,q,D)}else THREE.MarchingCubes!==undefined&&D instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,
|
|
|
+1)}for(;m.__objectsRemoved.length;){D=m.__objectsRemoved[0];p=m;q=void 0;n=void 0;for(q=p.__webglObjects.length-1;q>=0;q--){n=p.__webglObjects[q].object;D==n&&p.__webglObjects.splice(q,1)}m.__objectsRemoved.splice(0,1)}D=0;for(p=m.__webglObjects.length;D<p;D++){n=m.__webglObjects[D].object;E=void 0;q=void 0;C=void 0;if(n instanceof THREE.Mesh){q=n.geometry;for(E in q.geometryGroups){C=q.geometryGroups[E];if(q.__dirtyVertices||q.__dirtyMorphTargets||q.__dirtyElements||q.__dirtyUvs||q.__dirtyNormals||
|
|
|
+q.__dirtyColors||q.__dirtyTangents){F=f.DYNAMIC_DRAW;S=void 0;qa=void 0;var Ia=void 0,O=void 0;Ia=void 0;var Na=void 0,Ja=void 0,Qa=void 0;P=void 0;Ca=void 0;var V=void 0,ca=void 0,aa=void 0,Ka=void 0;Ja=void 0;Qa=void 0;V=void 0;O=void 0;V=void 0;ca=void 0;aa=void 0;Ja=void 0;V=void 0;ca=void 0;aa=void 0;Ka=void 0;V=void 0;ca=void 0;aa=void 0;Ka=void 0;V=void 0;ca=void 0;aa=void 0;Ka=void 0;V=void 0;ca=void 0;aa=void 0;Ka=void 0;O=void 0;Na=void 0;Ia=void 0;Ia=void 0;var xa=void 0,Ta=void 0,Ma=void 0,
|
|
|
+Ra=Aa=Ea=La=ya=Z=X=H=0,Pa=0,K=0,L=0,ea=C.__vertexArray,la=C.__uvArray,U=C.__uv2Array,$=C.__normalArray,ia=C.__tangentArray,za=C.__colorArray,ta=C.__skinVertexAArray,va=C.__skinVertexBArray,Fa=C.__skinIndexArray,Da=C.__skinWeightArray,Wa=C.__morphTargetsArrays,Ua=C.__faceArray,Oa=C.__lineArray,Xa=C.__needsSmoothNormals,db=C.__vertexColorType,Sa=n.geometry,eb=Sa.__dirtyVertices,fb=Sa.__dirtyElements,cb=Sa.__dirtyUvs,gb=Sa.__dirtyNormals,hb=Sa.__dirtyTangents,ib=Sa.__dirtyColors,jb=Sa.__dirtyMorphTargets,
|
|
|
+Va=Sa.vertices,kb=C.faces,nb=Sa.faces,lb=Sa.faceVertexUvs[0],mb=Sa.faceVertexUvs[1],ob=Sa.colors,$a=Sa.skinVerticesA,ab=Sa.skinVerticesB,bb=Sa.skinIndices,Za=Sa.skinWeights,Ya=Sa.morphTargets;S=0;for(qa=kb.length;S<qa;S++){Ia=kb[S];O=nb[Ia];lb&&(P=lb[Ia]);mb&&(Ca=mb[Ia]);Ia=O.vertexNormals;Na=O.normal;Ja=O.vertexColors;Qa=O.color;if(O instanceof THREE.Face3){if(eb){V=Va[O.a].position;ca=Va[O.b].position;aa=Va[O.c].position;ea[X]=V.x;ea[X+1]=V.y;ea[X+2]=V.z;ea[X+3]=ca.x;ea[X+4]=ca.y;ea[X+5]=ca.z;ea[X+
|
|
|
+6]=aa.x;ea[X+7]=aa.y;ea[X+8]=aa.z;X+=9}if(jb){xa=0;for(Ta=Ya.length;xa<Ta;xa++){V=Ya[xa].vertices[O.a].position;ca=Ya[xa].vertices[O.b].position;aa=Ya[xa].vertices[O.c].position;Ma=Wa[xa];Ma[L+0]=V.x;Ma[L+1]=V.y;Ma[L+2]=V.z;Ma[L+3]=ca.x;Ma[L+4]=ca.y;Ma[L+5]=ca.z;Ma[L+6]=aa.x;Ma[L+7]=aa.y;Ma[L+8]=aa.z}L+=9}if(Za.length){V=Za[O.a];ca=Za[O.b];aa=Za[O.c];Da[K]=V.x;Da[K+1]=V.y;Da[K+2]=V.z;Da[K+3]=V.w;Da[K+4]=ca.x;Da[K+5]=ca.y;Da[K+6]=ca.z;Da[K+7]=ca.w;Da[K+8]=aa.x;Da[K+9]=aa.y;Da[K+10]=aa.z;Da[K+11]=aa.w;
|
|
|
+V=bb[O.a];ca=bb[O.b];aa=bb[O.c];Fa[K]=V.x;Fa[K+1]=V.y;Fa[K+2]=V.z;Fa[K+3]=V.w;Fa[K+4]=ca.x;Fa[K+5]=ca.y;Fa[K+6]=ca.z;Fa[K+7]=ca.w;Fa[K+8]=aa.x;Fa[K+9]=aa.y;Fa[K+10]=aa.z;Fa[K+11]=aa.w;V=$a[O.a];ca=$a[O.b];aa=$a[O.c];ta[K]=V.x;ta[K+1]=V.y;ta[K+2]=V.z;ta[K+3]=1;ta[K+4]=ca.x;ta[K+5]=ca.y;ta[K+6]=ca.z;ta[K+7]=1;ta[K+8]=aa.x;ta[K+9]=aa.y;ta[K+10]=aa.z;ta[K+11]=1;V=ab[O.a];ca=ab[O.b];aa=ab[O.c];va[K]=V.x;va[K+1]=V.y;va[K+2]=V.z;va[K+3]=1;va[K+4]=ca.x;va[K+5]=ca.y;va[K+6]=ca.z;va[K+7]=1;va[K+8]=aa.x;va[K+
|
|
|
+9]=aa.y;va[K+10]=aa.z;va[K+11]=1;K+=12}if(ib&&db){if(Ja.length==3&&db==THREE.VertexColors){V=Ja[0];ca=Ja[1];aa=Ja[2]}else aa=ca=V=Qa;za[Pa]=V.r;za[Pa+1]=V.g;za[Pa+2]=V.b;za[Pa+3]=ca.r;za[Pa+4]=ca.g;za[Pa+5]=ca.b;za[Pa+6]=aa.r;za[Pa+7]=aa.g;za[Pa+8]=aa.b;Pa+=9}if(hb&&Sa.hasTangents){Ja=Va[O.a].tangent;Qa=Va[O.b].tangent;V=Va[O.c].tangent;ia[Aa]=Ja.x;ia[Aa+1]=Ja.y;ia[Aa+2]=Ja.z;ia[Aa+3]=Ja.w;ia[Aa+4]=Qa.x;ia[Aa+5]=Qa.y;ia[Aa+6]=Qa.z;ia[Aa+7]=Qa.w;ia[Aa+8]=V.x;ia[Aa+9]=V.y;ia[Aa+10]=V.z;ia[Aa+11]=V.w;
|
|
|
+Aa+=12}if(gb)if(Ia.length==3&&Xa)for(O=0;O<3;O++){Na=Ia[O];$[Ea]=Na.x;$[Ea+1]=Na.y;$[Ea+2]=Na.z;Ea+=3}else for(O=0;O<3;O++){$[Ea]=Na.x;$[Ea+1]=Na.y;$[Ea+2]=Na.z;Ea+=3}if(cb&&P!==undefined)for(O=0;O<3;O++){Ia=P[O];la[Z]=Ia.u;la[Z+1]=Ia.v;Z+=2}if(cb&&Ca!==undefined)for(O=0;O<3;O++){Ia=Ca[O];U[ya]=Ia.u;U[ya+1]=Ia.v;ya+=2}if(fb){Ua[La]=H;Ua[La+1]=H+1;Ua[La+2]=H+2;La+=3;Oa[Ra]=H;Oa[Ra+1]=H+1;Oa[Ra+2]=H;Oa[Ra+3]=H+2;Oa[Ra+4]=H+1;Oa[Ra+5]=H+2;Ra+=6;H+=3}}else if(O instanceof THREE.Face4){if(eb){V=Va[O.a].position;
|
|
|
+ca=Va[O.b].position;aa=Va[O.c].position;Ka=Va[O.d].position;ea[X]=V.x;ea[X+1]=V.y;ea[X+2]=V.z;ea[X+3]=ca.x;ea[X+4]=ca.y;ea[X+5]=ca.z;ea[X+6]=aa.x;ea[X+7]=aa.y;ea[X+8]=aa.z;ea[X+9]=Ka.x;ea[X+10]=Ka.y;ea[X+11]=Ka.z;X+=12}if(jb){xa=0;for(Ta=Ya.length;xa<Ta;xa++){V=Ya[xa].vertices[O.a].position;ca=Ya[xa].vertices[O.b].position;aa=Ya[xa].vertices[O.c].position;Ka=Ya[xa].vertices[O.d].position;Ma=Wa[xa];Ma[L+0]=V.x;Ma[L+1]=V.y;Ma[L+2]=V.z;Ma[L+3]=ca.x;Ma[L+4]=ca.y;Ma[L+5]=ca.z;Ma[L+6]=aa.x;Ma[L+7]=aa.y;
|
|
|
+Ma[L+8]=aa.z;Ma[L+9]=Ka.x;Ma[L+10]=Ka.y;Ma[L+11]=Ka.z}L+=12}if(Za.length){V=Za[O.a];ca=Za[O.b];aa=Za[O.c];Ka=Za[O.d];Da[K]=V.x;Da[K+1]=V.y;Da[K+2]=V.z;Da[K+3]=V.w;Da[K+4]=ca.x;Da[K+5]=ca.y;Da[K+6]=ca.z;Da[K+7]=ca.w;Da[K+8]=aa.x;Da[K+9]=aa.y;Da[K+10]=aa.z;Da[K+11]=aa.w;Da[K+12]=Ka.x;Da[K+13]=Ka.y;Da[K+14]=Ka.z;Da[K+15]=Ka.w;V=bb[O.a];ca=bb[O.b];aa=bb[O.c];Ka=bb[O.d];Fa[K]=V.x;Fa[K+1]=V.y;Fa[K+2]=V.z;Fa[K+3]=V.w;Fa[K+4]=ca.x;Fa[K+5]=ca.y;Fa[K+6]=ca.z;Fa[K+7]=ca.w;Fa[K+8]=aa.x;Fa[K+9]=aa.y;Fa[K+10]=
|
|
|
+aa.z;Fa[K+11]=aa.w;Fa[K+12]=Ka.x;Fa[K+13]=Ka.y;Fa[K+14]=Ka.z;Fa[K+15]=Ka.w;V=$a[O.a];ca=$a[O.b];aa=$a[O.c];Ka=$a[O.d];ta[K]=V.x;ta[K+1]=V.y;ta[K+2]=V.z;ta[K+3]=1;ta[K+4]=ca.x;ta[K+5]=ca.y;ta[K+6]=ca.z;ta[K+7]=1;ta[K+8]=aa.x;ta[K+9]=aa.y;ta[K+10]=aa.z;ta[K+11]=1;ta[K+12]=Ka.x;ta[K+13]=Ka.y;ta[K+14]=Ka.z;ta[K+15]=1;V=ab[O.a];ca=ab[O.b];aa=ab[O.c];Ka=ab[O.d];va[K]=V.x;va[K+1]=V.y;va[K+2]=V.z;va[K+3]=1;va[K+4]=ca.x;va[K+5]=ca.y;va[K+6]=ca.z;va[K+7]=1;va[K+8]=aa.x;va[K+9]=aa.y;va[K+10]=aa.z;va[K+11]=1;
|
|
|
+va[K+12]=Ka.x;va[K+13]=Ka.y;va[K+14]=Ka.z;va[K+15]=1;K+=16}if(ib&&db){if(Ja.length==4&&db==THREE.VertexColors){V=Ja[0];ca=Ja[1];aa=Ja[2];Ja=Ja[3]}else Ja=aa=ca=V=Qa;za[Pa]=V.r;za[Pa+1]=V.g;za[Pa+2]=V.b;za[Pa+3]=ca.r;za[Pa+4]=ca.g;za[Pa+5]=ca.b;za[Pa+6]=aa.r;za[Pa+7]=aa.g;za[Pa+8]=aa.b;za[Pa+9]=Ja.r;za[Pa+10]=Ja.g;za[Pa+11]=Ja.b;Pa+=12}if(hb&&Sa.hasTangents){Ja=Va[O.a].tangent;Qa=Va[O.b].tangent;V=Va[O.c].tangent;O=Va[O.d].tangent;ia[Aa]=Ja.x;ia[Aa+1]=Ja.y;ia[Aa+2]=Ja.z;ia[Aa+3]=Ja.w;ia[Aa+4]=Qa.x;
|
|
|
+ia[Aa+5]=Qa.y;ia[Aa+6]=Qa.z;ia[Aa+7]=Qa.w;ia[Aa+8]=V.x;ia[Aa+9]=V.y;ia[Aa+10]=V.z;ia[Aa+11]=V.w;ia[Aa+12]=O.x;ia[Aa+13]=O.y;ia[Aa+14]=O.z;ia[Aa+15]=O.w;Aa+=16}if(gb)if(Ia.length==4&&Xa)for(O=0;O<4;O++){Na=Ia[O];$[Ea]=Na.x;$[Ea+1]=Na.y;$[Ea+2]=Na.z;Ea+=3}else for(O=0;O<4;O++){$[Ea]=Na.x;$[Ea+1]=Na.y;$[Ea+2]=Na.z;Ea+=3}if(cb&&P!==undefined)for(O=0;O<4;O++){Ia=P[O];la[Z]=Ia.u;la[Z+1]=Ia.v;Z+=2}if(cb&&Ca!==undefined)for(O=0;O<4;O++){Ia=Ca[O];U[ya]=Ia.u;U[ya+1]=Ia.v;ya+=2}if(fb){Ua[La]=H;Ua[La+1]=H+1;
|
|
|
+Ua[La+2]=H+2;Ua[La+3]=H;Ua[La+4]=H+2;Ua[La+5]=H+3;La+=6;Oa[Ra]=H;Oa[Ra+1]=H+1;Oa[Ra+2]=H;Oa[Ra+3]=H+3;Oa[Ra+4]=H+1;Oa[Ra+5]=H+2;Oa[Ra+6]=H+2;Oa[Ra+7]=H+3;Ra+=8;H+=4}}}if(eb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ea,F)}if(jb){xa=0;for(Ta=Ya.length;xa<Ta;xa++){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[xa]);f.bufferData(f.ARRAY_BUFFER,Wa[xa],F)}}if(ib&&ob.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,za,F)}if(gb){f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
+C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,$,F)}if(hb&&Sa.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,ia,F)}if(cb&&Z>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,la,F)}if(cb&&ya>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,U,F)}if(fb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ua,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);
|
|
|
+f.bufferData(f.ELEMENT_ARRAY_BUFFER,Oa,F)}if(K>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,ta,F);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,va,F);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Fa,F);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,Da,F)}}}q.__dirtyVertices=!1;q.__dirtyMorphTargets=!1;q.__dirtyElements=!1;q.__dirtyUvs=!1;q.__dirtyNormals=
|
|
|
+!1;q.__dirtyTangents=!1;q.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){q=n.geometry;if(q.__dirtyVertices||q.__dirtyColors){n=q;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;Ca=void 0;C=void 0;H=n.vertices;F=n.colors;X=H.length;S=F.length;Z=n.__vertexArray;qa=n.__colorArray;ya=n.__dirtyColors;if(n.__dirtyVertices){for(P=0;P<X;P++){Ca=H[P].position;C=P*3;Z[C]=Ca.x;Z[C+1]=Ca.y;Z[C+2]=Ca.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Z,E)}if(ya){for(P=0;P<S;P++){color=F[P];
|
|
|
+C=P*3;qa[C]=color.r;qa[C+1]=color.g;qa[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,qa,E)}}q.__dirtyVertices=!1;q.__dirtyColors=!1}else if(n instanceof THREE.Line){q=n.geometry;if(q.__dirtyVertices||q.__dirtyColors){n=q;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;Ca=void 0;C=void 0;H=n.vertices;F=n.colors;X=H.length;S=F.length;Z=n.__vertexArray;qa=n.__colorArray;ya=n.__dirtyColors;if(n.__dirtyVertices){for(P=0;P<X;P++){Ca=H[P].position;C=P*3;Z[C]=Ca.x;Z[C+1]=Ca.y;
|
|
|
+Z[C+2]=Ca.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Z,E)}if(ya){for(P=0;P<S;P++){color=F[P];C=P*3;qa[C]=color.r;qa[C+1]=color.g;qa[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,qa,E)}}q.__dirtyVertices=!1;q.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){q=n.geometry;(q.__dirtyVertices||q.__dirtyColors||n.sortParticles)&&c(q,f.DYNAMIC_DRAW,n);q.__dirtyVertices=!1;q.__dirtyColors=!1}}};this.setFaceCulling=
|
|
|
+function(m,D){if(m){!D||D=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+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(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,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.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,m=a.faces,j=f.faces,n=a.uvs;f=f.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,v=h.length;p<v;p++){var u=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}p=0;for(v=j.length;p<v;p++){h=j[p];var o,x=h.vertexNormals;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+
|
|
|
-d,h.b+d,h.c+d,h.d+d));o.centroid.copy(h.centroid);o.normal.copy(h.normal);b=0;for(g=x.length;b<g;b++){u=x[b];o.vertexNormals.push(u.clone())}o.materials=h.materials.slice();m.push(o)}p=0;for(v=f.length;p<v;p++){d=f[p];m=[];b=0;for(g=d.length;b<g;b++)m.push(new THREE.UV(d[b].u,d[b].v));n.push(m)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,
|
|
|
-c);c=f.loadCount=0;for(d=a.length;c<d;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(p in O.objects)if(!K.objects[p]){B=O.objects[p];if(J=K.geometries[B.geometry]){da=[];for(i=0;i<B.materials.length;i++)da[i]=K.materials[B.materials[i]];E=B.position;r=B.rotation;s=B.scale;object=new THREE.Mesh(J,da);object.position.set(E[0],
|
|
|
-E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;K.scene.addObject(object);K.objects[p]=object}}}function h(ea){return function(Ha){K.geometries[ea]=Ha;g();Y-=1;m()}}function m(){d({total_models:ma,total_textures:ka,loaded_models:ma-Y,loaded_textures:ka-V},K);Y==0&&V==0&&b(K)}var j,n,p,v,u,o,x,B,E,w,M,J,N,R,da,O,e,Y,V,ma,ka,K;O=f.data;e=new THREE.Loader;V=Y=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
-lights:{},fogs:{}};f=function(){V-=1;m()};for(u in O.cameras){w=O.cameras[u];if(w.type=="perspective")N=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}E=w.position;w=w.target;N.position.set(E[0],E[1],E[2]);N.target.position.set(w[0],w[1],w[2]);K.cameras[u]=N}for(v in O.lights){u=O.lights[v];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
|
|
|
-E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}w=u.color;i=u.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);K.scene.addLight(light);K.lights[v]=light}for(o in O.fogs){v=O.fogs[o];if(v.type=="linear")R=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(R=new THREE.FogExp2(0,v.density));w=v.color;R.color.setRGB(w[0],w[1],w[2]);K.fogs[o]=R}if(K.cameras&&O.defaults.camera)K.currentCamera=K.cameras[O.defaults.camera];
|
|
|
-if(K.fogs&&O.defaults.fog)K.scene.fog=K.fogs[O.defaults.fog];w=O.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(w[0],w[1],w[2]);K.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){o=O.geometries[j];if(o.type=="bin_mesh"||o.type=="ascii_mesh")Y+=1}ma=Y;for(j in O.geometries){o=O.geometries[j];if(o.type=="cube"){J=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);K.geometries[j]=J}else if(o.type=="plane"){J=new Plane(o.width,
|
|
|
-o.height,o.segmentsWidth,o.segmentsHeight);K.geometries[j]=J}else if(o.type=="sphere"){J=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);K.geometries[j]=J}else if(o.type=="cylinder"){J=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);K.geometries[j]=J}else if(o.type=="torus"){J=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);K.geometries[j]=J}else if(o.type=="icosahedron"){J=new Icosahedron(o.subdivisions);K.geometries[j]=J}else if(o.type=="bin_mesh")e.loadBinary({model:o.url,
|
|
|
-callback:h(j)});else o.type=="ascii_mesh"&&e.loadAscii({model:o.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];V+=j.url instanceof Array?j.url.length:1}ka=V;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)o=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{o=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)o.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)o.magFilter=
|
|
|
-THREE[j.magFilter]}K.textures[x]=o}for(n in O.materials){x=O.materials[n];for(M in x.parameters)if(M=="envMap"||M=="map"||M=="lightMap")x.parameters[M]=K.textures[x.parameters[M]];else if(M=="shading")x.parameters[M]=x.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")x.parameters[M]=THREE[x.parameters[M]]?THREE[x.parameters[M]]:THREE.NormalBlending;else M=="combine"&&(x.parameters[M]=x.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);
|
|
|
-K.materials[n]=x}g();c(K)}},addMesh:function(a,c,b,d,f,g,h,m,j,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=m;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
|
|
|
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,o=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var w=0,y=h.length;w<y;w++){var x=new THREE.Vertex(h[w].position.clone());b&&c.matrix.multiplyVector3(x.position);g.push(x)}w=0;for(y=k.length;w<y;w++){h=k[w];var t,B=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
|
|
|
+d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);b=0;for(g=B.length;b<g;b++){x=B[b];t.vertexNormals.push(x.clone())}t.materials=h.materials.slice();j.push(t)}w=0;for(y=e.length;w<y;w++){d=e[w];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));o.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
|
|
|
+c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(w in R.objects)if(!M.objects[w]){G=R.objects[w];if(z=M.geometries[G.geometry]){fa=[];for(i=0;i<G.materials.length;i++)fa[i]=M.materials[G.materials[i]];I=G.position;r=G.rotation;s=G.scale;object=new THREE.Mesh(z,fa);object.position.set(I[0],
|
|
|
+I[1],I[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;M.scene.addObject(object);M.objects[w]=object}}}function h(ga){return function(Ga){M.geometries[ga]=Ga;g();Y-=1;j()}}function j(){d({total_models:na,total_textures:ja,loaded_models:na-Y,loaded_textures:ja-W},M);Y==0&&W==0&&b(M)}var k,o,w,y,x,t,B,G,I,A,J,z,Q,N,fa,R,f,Y,W,na,ja,M;R=e.data;f=new THREE.Loader;W=Y=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
+lights:{},fogs:{}};e=function(){W-=1;j()};for(x in R.cameras){A=R.cameras[x];if(A.type=="perspective")Q=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho"){Q=new THREE.Camera;Q.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far)}I=A.position;A=A.target;Q.position.set(I[0],I[1],I[2]);Q.target.position.set(A[0],A[1],A[2]);M.cameras[x]=Q}for(y in R.lights){x=R.lights[y];if(x.type=="directional"){I=x.direction;light=new THREE.DirectionalLight;light.position.set(I[0],
|
|
|
+I[1],I[2]);light.position.normalize()}else if(x.type=="point"){I=x.position;light=new THREE.PointLight;light.position.set(I[0],I[1],I[2])}A=x.color;i=x.intensity||1;light.color.setRGB(A[0]*i,A[1]*i,A[2]*i);M.scene.addLight(light);M.lights[y]=light}for(t in R.fogs){y=R.fogs[t];if(y.type=="linear")N=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(N=new THREE.FogExp2(0,y.density));A=y.color;N.color.setRGB(A[0],A[1],A[2]);M.fogs[t]=N}if(M.cameras&&R.defaults.camera)M.currentCamera=M.cameras[R.defaults.camera];
|
|
|
+if(M.fogs&&R.defaults.fog)M.scene.fog=M.fogs[R.defaults.fog];A=R.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(A[0],A[1],A[2]);M.bgColorAlpha=R.defaults.bgalpha;for(k in R.geometries){t=R.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")Y+=1}na=Y;for(k in R.geometries){t=R.geometries[k];if(t.type=="cube"){z=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides);M.geometries[k]=z}else if(t.type=="plane"){z=new Plane(t.width,
|
|
|
+t.height,t.segmentsWidth,t.segmentsHeight);M.geometries[k]=z}else if(t.type=="sphere"){z=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);M.geometries[k]=z}else if(t.type=="cylinder"){z=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);M.geometries[k]=z}else if(t.type=="torus"){z=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);M.geometries[k]=z}else if(t.type=="icosahedron"){z=new Icosahedron(t.subdivisions);M.geometries[k]=z}else if(t.type=="bin_mesh")f.loadBinary({model:t.url,
|
|
|
+callback:h(k)});else t.type=="ascii_mesh"&&f.loadAscii({model:t.url,callback:h(k)})}for(B in R.textures){k=R.textures[B];W+=k.url instanceof Array?k.url.length:1}ja=W;for(B in R.textures){k=R.textures[B];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)t=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{t=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
|
|
|
+THREE[k.magFilter]}M.textures[B]=t}for(o in R.materials){B=R.materials[o];for(J in B.parameters)if(J=="envMap"||J=="map"||J=="lightMap")B.parameters[J]=M.textures[B.parameters[J]];else if(J=="shading")B.parameters[J]=B.parameters[J]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")B.parameters[J]=THREE[B.parameters[J]]?THREE[B.parameters[J]]:THREE.NormalBlending;else J=="combine"&&(B.parameters[J]=B.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);B=new THREE[B.type](B.parameters);
|
|
|
+M.materials[o]=B}g();c(M)}},addMesh:function(a,c,b,d,e,g,h,j,k,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
|
|
|
return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
|
|
|
-a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
|
|
|
-SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,f=a.children.length;for(d=0;d<f;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,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",
|
|
|
+a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
|
|
|
+SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,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}",
|
|
|
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},
|
|
@@ -318,7 +319,7 @@ 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}"},
|
|
|
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}",
|
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
|
|
|
THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
|
|
|
a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.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(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
|
|
@@ -327,54 +328,71 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
|
|
|
var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
|
|
|
!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
|
|
|
-THREE.PathCamera=function(a){function c(n,p,v,u){var o={name:v,fps:0.6,length:u,hierarchy:[]},x,B=p.getControlPointsArray(),E=p.getLength(),w=B.length,M=0;x=w-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[x]={time:u,pos:B[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<w-1;x++){M=u*E.chunks[x]/E.total;p.keys[x]={time:M,pos:B[x]}}o.hierarchy[0]=p;THREE.AnimationHandler.add(o);return new THREE.Animation(n,v,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var v,
|
|
|
-u,o=new THREE.Geometry;for(v=0;v<n.points.length*p;v++){u=v/(n.points.length*p);u=n.getPoint(u);o.vertices[v]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return o}function d(n,p){var v=b(p,10),u=b(p,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(v,o);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);u=new Sphere(1,
|
|
|
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){v=new THREE.Mesh(u,o);v.position.copy(p.points[i]);v.updateMatrix();n.addChild(v)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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=
|
|
|
+THREE.PathCamera=function(a){function c(o,w,y,x){var t={name:y,fps:0.6,length:x,hierarchy:[]},B,G=w.getControlPointsArray(),I=w.getLength(),A=G.length,J=0;B=A-1;w={parent:-1,keys:[]};w.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};w.keys[B]={time:x,pos:G[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<A-1;B++){J=x*I.chunks[B]/I.total;w.keys[B]={time:J,pos:G[B]}}t.hierarchy[0]=w;THREE.AnimationHandler.add(t);return new THREE.Animation(o,y,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,w){var y,
|
|
|
+x,t=new THREE.Geometry;for(y=0;y<o.points.length*w;y++){x=y/(o.points.length*w);x=o.getPoint(x);t.vertices[y]=new THREE.Vertex(new THREE.Vector3(x.x,x.y,x.z))}return t}function d(o,w){var y=b(w,10),x=b(w,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(y,t);particleObj=new THREE.ParticleSystem(x,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);x=new Sphere(1,
|
|
|
+16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<w.points.length;i++){y=new THREE.Mesh(x,t);y.position.copy(w.points[i]);y.updateMatrix();o.addChild(y)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
|
|
|
if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.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 f=Math.PI*2,g=Math.PI/180;this.update=function(n,p,v){var u,o;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)*g;this.theta=this.lon*g;u=this.phi%f;this.phi=u>=0?u:u+f;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
|
|
|
-this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,v)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
|
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),m=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(m,a);a=new THREE.Mesh(j,h);a.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(a)}else{this.animation=
|
|
|
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,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(a,c,b,d,f,g,h,m,j){function n(E,w,M,J,N,R,da,O){var e,Y,V=d||1,ma=f||1,ka=N/2,K=R/2,ea=p.vertices.length;if(E=="x"&&w=="y"||E=="y"&&w=="x")e="z";else if(E=="x"&&w=="z"||E=="z"&&w=="x"){e="y";ma=g||1}else if(E=="z"&&w=="y"||E=="y"&&w=="z"){e="x";V=g||1}var Ha=V+1,fa=ma+1;N/=V;var Ca=R/ma;for(Y=0;Y<fa;Y++)for(R=0;R<Ha;R++){var na=new THREE.Vector3;na[E]=(R*N-ka)*M;na[w]=(Y*Ca-K)*J;na[e]=da;p.vertices.push(new THREE.Vertex(na))}p.faceVertexUvs[0]=[];for(Y=0;Y<ma;Y++)for(R=0;R<V;R++){p.faces.push(new THREE.Face4(R+
|
|
|
-Ha*Y+ea,R+Ha*(Y+1)+ea,R+1+Ha*(Y+1)+ea,R+1+Ha*Y+ea,null,null,O));p.faceVertexUvs[0].push([new THREE.UV(R/V,Y/ma),new THREE.UV(R/V,(Y+1)/ma),new THREE.UV((R+1)/V,(Y+1)/ma),new THREE.UV((R+1)/V,Y/ma)])}}THREE.Geometry.call(this);var p=this,v=a/2,u=c/2,o=b/2;m=m?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var B in j)this.sides[B]!=
|
|
|
-undefined&&(this.sides[B]=j[B]);this.sides.px&&n("z","y",1*m,-1,b,c,-v,this.materials[0]);this.sides.nx&&n("z","y",-1*m,-1,b,c,v,this.materials[1]);this.sides.py&&n("x","z",1*m,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*m,-1,a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*m,-1,a,c,o,this.materials[4]);this.sides.nz&&n("x","y",-1*m,-1,a,c,-o,this.materials[5]);(function(){for(var E=[],w=[],M=0,J=p.vertices.length;M<J;M++){for(var N=p.vertices[M],R=!1,da=0,O=E.length;da<O;da++){var e=
|
|
|
-E[da];if(N.position.x==e.position.x&&N.position.y==e.position.y&&N.position.z==e.position.z){w[M]=da;R=!0;break}}if(!R){w[M]=E.length;E.push(new THREE.Vertex(N.position.clone()))}}M=0;for(J=p.faces.length;M<J;M++){N=p.faces[M];N.a=w[N.a];N.b=w[N.b];N.c=w[N.c];N.d=w[N.d]}p.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
-var Cylinder=function(a,c,b,d,f,g){function h(p,v,u){m.vertices.push(new THREE.Vertex(new THREE.Vector3(p,v,u)))}THREE.Geometry.call(this);var m=this,j=Math.PI,n=d/2;for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-n);for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*b,Math.cos(2*j*d/a)*b,n);for(d=0;d<a;d++)m.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-n-(g||0));for(d=a;d<a+a/2;d++)m.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
|
|
|
-for(d=a+a/2;d<2*a;d++)m.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
|
-var Icosahedron=function(a){function c(v,u,o){var x=Math.sqrt(v*v+u*u+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(v/x,u/x,o/x)))-1}function b(v,u,o,x){x.faces.push(new THREE.Face3(v,u,o))}function d(v,u){var o=f.vertices[v].position,x=f.vertices[u].position;return c((o.x+x.x)/2,(o.y+x.y)/2,(o.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
|
|
|
-1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var m in g.faces){var j=d(g.faces[m].a,g.faces[m].b),n=d(g.faces[m].b,g.faces[m].c),p=d(g.faces[m].c,g.faces[m].a);b(g.faces[m].a,j,p,h);b(g.faces[m].b,n,j,h);b(g.faces[m].c,
|
|
|
-p,n,h);b(j,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],f=[],g=[],h=[],m=0;m<a.length;m++){this.vertices.push(new THREE.Vertex(a[m]));d[m]=a[m].clone();f[m]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<d.length;m++)if(n<this.angle){d[m]=j.multiplyVector3(d[m].clone());this.vertices.push(new THREE.Vertex(d[m]));g[m]=this.vertices.length-1}else g=h;n==0&&(h=f);for(m=
|
|
|
-0;m<f.length-1;m++){this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m]));this.uvs.push([new THREE.UV(n/b,m/a.length),new THREE.UV(n/b,(m+1)/a.length),new THREE.UV((n-c)/b,(m+1)/a.length),new THREE.UV((n-c)/b,m/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;d=d||1;var m=b+1,j=d+1;a/=b;var n=c/d;for(f=0;f<j;f++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));this.faceVertexUvs[0]=[];for(f=0;f<d;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+m*f,c+m*(f+1),c+1+m*(f+1),c+1+m*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)])}this.computeCentroids();
|
|
|
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(o,w,y){var x,t;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)*g;this.theta=this.lon*g;x=this.phi%e;this.phi=x>=0?x:x+e;x=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;
|
|
|
+this.phi=(this.phi-x[0])*(t[1]-t[0])/(x[1]-x[0])+t[0];x=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-x[0])*(t[1]-t[0])/(x[1]-x[0])+t[0];x=this.target.position;x.x=100*Math.sin(this.phi)*Math.cos(this.theta);x.y=100*Math.cos(this.phi);x.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,w,y)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
|
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.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(a)}else{this.animation=
|
|
|
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,w){return function(){w.apply(o,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(a,c,b,d,e,g,h,j,k){function o(I,A,J,z,Q,N,fa,R){var f,Y,W=d||1,na=e||1,ja=Q/2,M=N/2,ga=w.vertices.length;if(I=="x"&&A=="y"||I=="y"&&A=="x")f="z";else if(I=="x"&&A=="z"||I=="z"&&A=="x"){f="y";na=g||1}else if(I=="z"&&A=="y"||I=="y"&&A=="z"){f="x";W=g||1}var Ga=W+1,ha=na+1;Q/=W;var Ba=N/na;for(Y=0;Y<ha;Y++)for(N=0;N<Ga;N++){var oa=new THREE.Vector3;oa[I]=(N*Q-ja)*J;oa[A]=(Y*Ba-M)*z;oa[f]=fa;w.vertices.push(new THREE.Vertex(oa))}w.faceVertexUvs[0]=[];for(Y=0;Y<na;Y++)for(N=0;N<W;N++){w.faces.push(new THREE.Face4(N+
|
|
|
+Ga*Y+ga,N+Ga*(Y+1)+ga,N+1+Ga*(Y+1)+ga,N+1+Ga*Y+ga,null,null,R));w.faceVertexUvs[0].push([new THREE.UV(N/W,Y/na),new THREE.UV(N/W,(Y+1)/na),new THREE.UV((N+1)/W,(Y+1)/na),new THREE.UV((N+1)/W,Y/na)])}}THREE.Geometry.call(this);var w=this,y=a/2,x=c/2,t=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var G in k)this.sides[G]!=
|
|
|
+undefined&&(this.sides[G]=k[G]);this.sides.px&&o("z","y",1*j,-1,b,c,-y,this.materials[0]);this.sides.nx&&o("z","y",-1*j,-1,b,c,y,this.materials[1]);this.sides.py&&o("x","z",1*j,1,a,b,x,this.materials[2]);this.sides.ny&&o("x","z",1*j,-1,a,b,-x,this.materials[3]);this.sides.pz&&o("x","y",1*j,-1,a,c,t,this.materials[4]);this.sides.nz&&o("x","y",-1*j,-1,a,c,-t,this.materials[5]);(function(){for(var I=[],A=[],J=0,z=w.vertices.length;J<z;J++){for(var Q=w.vertices[J],N=!1,fa=0,R=I.length;fa<R;fa++){var f=
|
|
|
+I[fa];if(Q.position.x==f.position.x&&Q.position.y==f.position.y&&Q.position.z==f.position.z){A[J]=fa;N=!0;break}}if(!N){A[J]=I.length;I.push(new THREE.Vertex(Q.position.clone()))}}J=0;for(z=w.faces.length;J<z;J++){Q=w.faces[J];Q.a=A[Q.a];Q.b=A[Q.b];Q.c=A[Q.c];Q.d=A[Q.d]}w.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
+var Cylinder=function(a,c,b,d,e,g){function h(w,y,x){j.vertices.push(new THREE.Vertex(new THREE.Vector3(w,y,x)))}THREE.Geometry.call(this);var j=this,k=Math.PI,o=d/2;for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*c,Math.cos(2*k*d/a)*c,-o);for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*b,Math.cos(2*k*d/a)*b,o);for(d=0;d<a;d++)j.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-o-(g||0));for(d=a;d<a+a/2;d++)j.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,o+(e||0));
|
|
|
+for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
|
+var Icosahedron=function(a){function c(y,x,t){var B=Math.sqrt(y*y+x*x+t*t);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(y/B,x/B,t/B)))-1}function b(y,x,t,B){B.faces.push(new THREE.Face3(y,x,t))}function d(y,x){var t=e.vertices[y].position,B=e.vertices[x].position;return c((t.x+B.x)/2,(t.y+B.y)/2,(t.z+B.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
|
|
|
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),o=d(g.faces[j].b,g.faces[j].c),w=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,w,h);b(g.faces[j].b,o,k,h);b(g.faces[j].c,
|
|
|
+w,o,h);b(k,o,w,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(j=0;j<d.length;j++)if(o<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;o==0&&(h=e);for(j=
|
|
|
+0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(o/b,j/a.length),new THREE.UV(o/b,(j+1)/a.length),new THREE.UV((o-c)/b,(j+1)/a.length),new THREE.UV((o-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
+var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var o=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*o-h),0)));this.faceVertexUvs[0]=[];for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();
|
|
|
this.computeFaceNormals()};Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
|
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var m=a*Math.cos(d*f),j=a*Math.sin(d*f),n=[],p=0;for(d=0;d<g;d++){var v=2*d/g,u=j*Math.sin(v*f);v=j*Math.cos(v*f);(b==0||b==h)&&d>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,m,u)))-1);n.push(p)}c.push(n)}var o,x,B;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];m=c[b][n?g-1:d];j=c[b-1][n?g-1:d];n=c[b-1][n?
|
|
|
-0:d+1];u=b/(f-1);o=(b-1)/(f-1);x=(d+1)/g;v=d/g;p=new THREE.UV(1-x,u);u=new THREE.UV(1-v,u);v=new THREE.UV(1-v,o);var E=new THREE.UV(1-x,o);if(b<c.length-1){o=this.vertices[h].position.clone();x=this.vertices[m].position.clone();B=this.vertices[j].position.clone();o.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(h,m,j,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([p,u,v])}if(b>1){o=this.vertices[h].position.clone();
|
|
|
-x=this.vertices[j].position.clone();B=this.vertices[n].position.clone();o.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(h,j,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([p,v,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
-var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
|
|
|
-1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
-var TorusKnot=function(a,c,b,d,f,g,h){function m(v,u,o,x,B,E){u=o/x*v;o=Math.cos(u);return new THREE.Vector3(B*(2+o)*0.5*Math.cos(v),B*(2+o)*Math.sin(v)*0.5,E*B*Math.sin(u)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var j=
|
|
|
-a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=m(j,h,this.q,this.p,this.radius,this.heightScale);j=m(j+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=j.x-f.x;b.y=j.y-f.y;b.z=j.z-f.z;d.x=j.x+f.x;d.y=j.y+f.y;d.z=j.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();j=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=j*d.x+h*g.x;f.y+=j*d.y+h*g.y;f.z+=j*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
|
|
|
-0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,d));this.uvs.push([h,j,n]);this.faces.push(new THREE.Face3(g,d,b));this.uvs.push([p,n,j])}this.computeCentroids();
|
|
|
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),o=[],w=0;for(d=0;d<g;d++){var y=2*d/g,x=k*Math.sin(y*e);y=k*Math.cos(y*e);(b==0||b==h)&&d>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,j,x)))-1);o.push(w)}c.push(o)}var t,B,G;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){o=d==g-1;h=c[b][o?0:d+1];j=c[b][o?g-1:d];k=c[b-1][o?g-1:d];o=c[b-1][o?
|
|
|
+0:d+1];x=b/(e-1);t=(b-1)/(e-1);B=(d+1)/g;y=d/g;w=new THREE.UV(1-B,x);x=new THREE.UV(1-y,x);y=new THREE.UV(1-y,t);var I=new THREE.UV(1-B,t);if(b<c.length-1){t=this.vertices[h].position.clone();B=this.vertices[j].position.clone();G=this.vertices[k].position.clone();t.normalize();B.normalize();G.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(G.x,G.y,G.z)]));this.uvs.push([w,x,y])}if(b>1){t=this.vertices[h].position.clone();
|
|
|
+B=this.vertices[k].position.clone();G=this.vertices[o].position.clone();t.normalize();B.normalize();G.normalize();this.faces.push(new THREE.Face3(h,k,o,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(G.x,G.y,G.z)]));this.uvs.push([w,y,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
+var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
|
|
|
+1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
+var TorusKnot=function(a,c,b,d,e,g,h){function j(y,x,t,B,G,I){x=t/B*y;t=Math.cos(x);return new THREE.Vector3(G*(2+t)*0.5*Math.cos(y),G*(2+t)*Math.sin(y)*0.5,I*G*Math.sin(x)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
|
|
|
+a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=j(k,h,this.q,this.p,this.radius,this.heightScale);k=j(k+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=k.x-e.x;b.y=k.y-e.y;b.z=k.z-e.z;d.x=k.x+e.x;d.y=k.y+e.y;d.z=k.z+e.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();k=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=k*d.x+h*g.x;e.y+=k*d.y+h*g.y;e.z+=k*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
|
|
|
+0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.uvs.push([h,k,o]);this.faces.push(new THREE.Face3(g,d,b));this.uvs.push([w,o,k])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(){this.statusDomElement=(this.showStatus=showStatus)?this.addStatusElement():null};
|
|
|
THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
|
|
|
-c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(m){m=Math.log(m)/Math.LN2;return Math.floor(m)==m}function d(m,j){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
|
|
|
-m.image.width=p;m.image.height=v;m.image.getContext("2d").drawImage(this,0,0,p,v)}else m.image=this;m.needsUpdate=!0};n.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
|
|
|
-255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
|
+c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var w=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),y=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
|
|
|
+j.image.width=w;j.image.height=y;j.image.getContext("2d").drawImage(this,0,0,w,y)}else j.image=this;j.needsUpdate=!0};o.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
|
|
|
+255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(){}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
+THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.LoaderOld.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);
|
|
|
+h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",
|
|
|
+j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var e=function(g){function h(p,n){var q=w(p,n),E=w(p,n+1),C=w(p,n+2),F=w(p,n+3),S=(F<<1&255|C>>7)-127;q|=(C&127)<<16|E<<8;if(q==0&&S==-127)return 0;return(1-2*(F>>7))*(1+q*Math.pow(2,-23))*Math.pow(2,S)}function j(p,n){var q=w(p,n),E=w(p,n+1),C=w(p,n+2);return(w(p,n+3)<<24)+(C<<16)+(E<<8)+q}function k(p,n){var q=w(p,n);return(w(p,n+1)<<8)+q}
|
|
|
+function o(p,n){var q=w(p,n);return q>127?q-256:q}function w(p,n){return p.charCodeAt(n)&255}function y(p){var n,q,E;n=j(a,p);q=j(a,p+fa);E=j(a,p+R);p=k(a,p+f);THREE.BinaryLoader.prototype.f3(A,n,q,E,p)}function x(p){var n,q,E,C,F,S;n=j(a,p);q=j(a,p+fa);E=j(a,p+R);C=k(a,p+f);F=j(a,p+Y);S=j(a,p+W);p=j(a,p+na);THREE.BinaryLoader.prototype.f3n(A,Q,n,q,E,C,F,S,p)}function t(p){var n,q,E,C;n=j(a,p);q=j(a,p+ja);E=j(a,p+M);C=j(a,p+ga);p=k(a,p+Ga);THREE.BinaryLoader.prototype.f4(A,n,q,E,C,p)}function B(p){var n,
|
|
|
+q,E,C,F,S,P,H;n=j(a,p);q=j(a,p+ja);E=j(a,p+M);C=j(a,p+ga);F=k(a,p+Ga);S=j(a,p+ha);P=j(a,p+Ba);H=j(a,p+oa);p=j(a,p+ka);THREE.BinaryLoader.prototype.f4n(A,Q,n,q,E,C,F,S,P,H,p)}function G(p){var n,q;n=j(a,p);q=j(a,p+wa);p=j(a,p+Ha);THREE.BinaryLoader.prototype.uv3(A.uvs,N[n*2],N[n*2+1],N[q*2],N[q*2+1],N[p*2],N[p*2+1])}function I(p){var n,q,E;n=j(a,p);q=j(a,p+ma);E=j(a,p+da);p=j(a,p+ra);THREE.BinaryLoader.prototype.uv4(A.uvs,N[n*2],N[n*2+1],N[q*2],N[q*2+1],N[E*2],N[E*2+1],N[p*2],N[p*2+1])}var A=this,
|
|
|
+J=0,z,Q=[],N=[],fa,R,f,Y,W,na,ja,M,ga,Ga,ha,Ba,oa,ka,wa,Ha,ma,da,ra,sa,T,pa,ua,m,D;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,d,g);z={signature:a.substr(J,8),header_bytes:w(a,J+8),vertex_coordinate_bytes:w(a,J+9),normal_coordinate_bytes:w(a,J+10),uv_coordinate_bytes:w(a,J+11),vertex_index_bytes:w(a,J+12),normal_index_bytes:w(a,J+13),uv_index_bytes:w(a,J+14),material_index_bytes:w(a,J+15),nvertices:j(a,J+16),nnormals:j(a,J+16+4),nuvs:j(a,J+16+8),ntri_flat:j(a,J+16+12),ntri_smooth:j(a,
|
|
|
+J+16+16),ntri_flat_uv:j(a,J+16+20),ntri_smooth_uv:j(a,J+16+24),nquad_flat:j(a,J+16+28),nquad_smooth:j(a,J+16+32),nquad_flat_uv:j(a,J+16+36),nquad_smooth_uv:j(a,J+16+40)};J+=z.header_bytes;fa=z.vertex_index_bytes;R=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;Y=z.vertex_index_bytes*3+z.material_index_bytes;W=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;ja=z.vertex_index_bytes;M=z.vertex_index_bytes*2;ga=
|
|
|
+z.vertex_index_bytes*3;Ga=z.vertex_index_bytes*4;ha=z.vertex_index_bytes*4+z.material_index_bytes;Ba=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ka=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;wa=z.uv_index_bytes;Ha=z.uv_index_bytes*2;ma=z.uv_index_bytes;da=z.uv_index_bytes*2;ra=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;D=z.vertex_index_bytes*4+z.material_index_bytes;
|
|
|
+sa=z.ntri_flat*g;T=z.ntri_smooth*(g+z.normal_index_bytes*3);pa=z.ntri_flat_uv*(g+z.uv_index_bytes*3);ua=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);m=z.nquad_flat*D;g=z.nquad_smooth*(D+z.normal_index_bytes*4);D=z.nquad_flat_uv*(D+z.uv_index_bytes*4);J+=function(p){for(var n,q,E,C=z.vertex_coordinate_bytes*3,F=p+z.nvertices*C;p<F;p+=C){n=h(a,p);q=h(a,p+z.vertex_coordinate_bytes);E=h(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,n,q,E)}return z.nvertices*C}(J);
|
|
|
+J+=function(p){for(var n,q,E,C=z.normal_coordinate_bytes*3,F=p+z.nnormals*C;p<F;p+=C){n=o(a,p);q=o(a,p+z.normal_coordinate_bytes);E=o(a,p+z.normal_coordinate_bytes*2);Q.push(n/127,q/127,E/127)}return z.nnormals*C}(J);J+=function(p){for(var n,q,E=z.uv_coordinate_bytes*2,C=p+z.nuvs*E;p<C;p+=E){n=h(a,p);q=h(a,p+z.uv_coordinate_bytes);N.push(n,q)}return z.nuvs*E}(J);sa=J+sa;T=sa+T;pa=T+pa;ua=pa+ua;m=ua+m;g=m+g;D=g+D;(function(p){var n,q=z.vertex_index_bytes*3+z.material_index_bytes,E=q+z.uv_index_bytes*
|
|
|
+3,C=p+z.ntri_flat_uv*E;for(n=p;n<C;n+=E){y(n);G(n+q)}return C-p})(T);(function(p){var n,q=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=q+z.uv_index_bytes*3,C=p+z.ntri_smooth_uv*E;for(n=p;n<C;n+=E){x(n);G(n+q)}return C-p})(pa);(function(p){var n,q=z.vertex_index_bytes*4+z.material_index_bytes,E=q+z.uv_index_bytes*4,C=p+z.nquad_flat_uv*E;for(n=p;n<C;n+=E){t(n);I(n+q)}return C-p})(g);(function(p){var n,q=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,E=
|
|
|
+q+z.uv_index_bytes*4,C=p+z.nquad_smooth_uv*E;for(n=p;n<C;n+=E){B(n);I(n+q)}return C-p})(D);(function(p){var n,q=z.vertex_index_bytes*3+z.material_index_bytes,E=p+z.ntri_flat*q;for(n=p;n<E;n+=q)y(n);return E-p})(J);(function(p){var n,q=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=p+z.ntri_smooth*q;for(n=p;n<E;n+=q)x(n);return E-p})(sa);(function(p){var n,q=z.vertex_index_bytes*4+z.material_index_bytes,E=p+z.nquad_flat*q;for(n=p;n<E;n+=q)t(n);return E-p})(ua);(function(p){var n,
|
|
|
+q=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,E=p+z.nquad_smooth*q;for(n=p;n<E;n+=q)B(n);return E-p})(m);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,
|
|
|
+c,b,d,e,g,h,j,k){g=a.materials[g];var o=c[j*3],w=c[j*3+1];j=c[j*3+2];var y=c[k*3],x=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,w,j),new THREE.Vector3(y,x,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,o,w){h=a.materials[h];var y=c[k*3],x=c[k*3+1];k=c[k*3+2];var t=c[o*3],B=c[o*3+1];o=c[o*3+2];var G=c[w*3],I=c[w*3+1];w=c[w*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(y,x,
|
|
|
+k),new THREE.Vector3(t,B,o),new THREE.Vector3(G,I,w)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(d,e));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,k));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;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(b,d,f){return b+(d-b)*f};this.VIntX=function(b,d,f,g,h,m,j,n,p,v){h=(h-p)/(v-p);p=this.normal_cache;d[g]=m+h*this.delta;d[g+1]=j;d[g+2]=n;f[g]=this.lerp(p[b],p[b+3],h);f[g+1]=this.lerp(p[b+1],p[b+4],h);f[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,d,f,g,h,m,j,n,p,v){h=(h-p)/(v-p);p=this.normal_cache;d[g]=m;d[g+1]=j+h*this.delta;d[g+
|
|
|
-2]=n;d=b+this.yd*3;f[g]=this.lerp(p[b],p[d],h);f[g+1]=this.lerp(p[b+1],p[d+1],h);f[g+2]=this.lerp(p[b+2],p[d+2],h)};this.VIntZ=function(b,d,f,g,h,m,j,n,p,v){h=(h-p)/(v-p);p=this.normal_cache;d[g]=m;d[g+1]=j;d[g+2]=n+h*this.delta;d=b+this.zd*3;f[g]=this.lerp(p[b],p[d],h);f[g+1]=this.lerp(p[b+1],p[d+1],h);f[g+2]=this.lerp(p[b+2],p[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
|
|
|
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,f,g,h,m){var j=g+1,n=g+this.yd,p=g+this.zd,v=j+this.yd,u=j+this.zd,o=g+this.yd+this.zd,x=j+this.yd+this.zd,B=0,E=this.field[g],w=this.field[j],M=this.field[n],J=this.field[v],N=this.field[p],R=this.field[u],da=this.field[o],O=this.field[x];E<h&&(B|=1);w<h&&(B|=2);M<h&&(B|=8);J<h&&(B|=4);N<h&&(B|=16);R<h&&(B|=32);da<h&&(B|=128);O<h&&(B|=64);var e=THREE.edgeTable[B];if(e==0)return 0;
|
|
|
-var Y=this.delta,V=b+Y,ma=d+Y;Y=f+Y;if(e&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,f,E,w)}if(e&2){this.compNorm(j);this.compNorm(v);this.VIntY(j*3,this.vlist,this.nlist,3,h,V,d,f,w,J)}if(e&4){this.compNorm(n);this.compNorm(v);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,ma,f,M,J)}if(e&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,f,E,M)}if(e&16){this.compNorm(p);this.compNorm(u);this.VIntX(p*3,this.vlist,this.nlist,12,h,b,d,
|
|
|
-Y,N,R)}if(e&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,V,d,Y,R,O)}if(e&64){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,ma,Y,da,O)}if(e&128){this.compNorm(p);this.compNorm(o);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,d,Y,N,da)}if(e&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,f,E,N)}if(e&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,V,d,f,w,R)}if(e&1024){this.compNorm(v);
|
|
|
-this.compNorm(x);this.VIntZ(v*3,this.vlist,this.nlist,30,h,V,ma,f,J,O)}if(e&2048){this.compNorm(n);this.compNorm(o);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,ma,f,M,da)}B<<=4;for(h=g=0;THREE.triTable[B+h]!=-1;){b=B+h;d=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[f],m);h+=3;g++}return g};this.posnormtriv=function(b,d,f,g,h,m){var j=this.count*3;this.positionArray[j]=b[f];this.positionArray[j+1]=b[f+1];this.positionArray[j+2]=b[f+2];this.positionArray[j+
|
|
|
-3]=b[g];this.positionArray[j+4]=b[g+1];this.positionArray[j+5]=b[g+2];this.positionArray[j+6]=b[h];this.positionArray[j+7]=b[h+1];this.positionArray[j+8]=b[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=
|
|
|
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,f,g,h){var m=this.size*Math.sqrt(g/h),j=f*this.size,n=d*this.size,p=b*this.size,v=Math.floor(j-m);v<1&&(v=1);j=Math.floor(j+m);j>this.size-1&&(j=this.size-1);var u=Math.floor(n-m);u<1&&(u=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var o=Math.floor(p-m);o<1&&(o=1);m=Math.floor(p+m);
|
|
|
-m>this.size-1&&(m=this.size-1);for(var x,B,E,w,M,J;v<j;v++){p=this.size2*v;B=v/this.size-f;M=B*B;for(B=u;B<n;B++){E=p+this.size*B;x=B/this.size-d;J=x*x;for(x=o;x<m;x++){w=x/this.size-b;w=g/(1.0E-6+w*w+J+M)-h;w>0&&(this.field[E+x]+=w)}}}};this.addPlaneX=function(b,d){var f,g,h,m,j,n=this.size,p=this.yd,v=this.zd,u=this.field,o=n*Math.sqrt(b/d);o>n&&(o=n);for(f=0;f<o;f++){g=f/n;g*=g;m=b/(1.0E-4+g)-d;if(m>0)for(g=0;g<n;g++){j=f+g*p;for(h=0;h<n;h++)u[v*h+j]+=m}}};this.addPlaneY=function(b,d){var f,g,
|
|
|
-h,m,j,n,p=this.size,v=this.yd,u=this.zd,o=this.field,x=p*Math.sqrt(b/d);x>p&&(x=p);for(g=0;g<x;g++){f=g/p;f*=f;m=b/(1.0E-4+f)-d;if(m>0){j=g*v;for(f=0;f<p;f++){n=j+f;for(h=0;h<p;h++)o[u*h+n]+=m}}}};this.addPlaneZ=function(b,d){var f,g,h,m,j,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;m=b/(1.0E-4+f)-d;if(m>0){j=zd*h;for(g=0;g<size;g++){n=j+g*yd;for(f=0;f<size;f++)field[n+f]+=m}}}};this.reset=function(){var b;
|
|
|
-for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,f,g,h,m,j,n,p,v,u=this.size-2;for(h=1;h<u;h++){v=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){p=v+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){m=(f-this.halfsize)/this.halfsize;d=p+f;this.polygonize(m,j,n,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(f){var g,h,m,j,n,p,v,u;for(g=
|
|
|
-0;g<f.count;g++){n=g*3;v=n+1;u=n+2;h=f.positionArray[n];m=f.positionArray[v];j=f.positionArray[u];p=new THREE.Vector3(h,m,j);h=f.normalArray[n];m=f.normalArray[v];j=f.normalArray[u];n=new THREE.Vector3(h,m,j);n.normalize();n=new THREE.Vertex(p,n);d.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;v=n+1;u=n+2;p=d.vertices[n].normal;h=d.vertices[v].normal;m=d.vertices[u].normal;n=new THREE.Face3(n,v,u,[p,h,m]);d.faces.push(n)}b+=nfaces;f.count=0});return d};this.init(a)};
|
|
|
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,o,w,y){h=(h-w)/(y-w);w=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=o;e[g]=this.lerp(w[b],w[b+3],h);e[g+1]=this.lerp(w[b+1],w[b+4],h);e[g+2]=this.lerp(w[b+2],w[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,o,w,y){h=(h-w)/(y-w);w=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
|
|
|
+2]=o;d=b+this.yd*3;e[g]=this.lerp(w[b],w[d],h);e[g+1]=this.lerp(w[b+1],w[d+1],h);e[g+2]=this.lerp(w[b+2],w[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,o,w,y){h=(h-w)/(y-w);w=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=o+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(w[b],w[d],h);e[g+1]=this.lerp(w[b+1],w[d+1],h);e[g+2]=this.lerp(w[b+2],w[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
|
|
|
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,o=g+this.yd,w=g+this.zd,y=k+this.yd,x=k+this.zd,t=g+this.yd+this.zd,B=k+this.yd+this.zd,G=0,I=this.field[g],A=this.field[k],J=this.field[o],z=this.field[y],Q=this.field[w],N=this.field[x],fa=this.field[t],R=this.field[B];I<h&&(G|=1);A<h&&(G|=2);J<h&&(G|=8);z<h&&(G|=4);Q<h&&(G|=16);N<h&&(G|=32);fa<h&&(G|=128);R<h&&(G|=64);var f=THREE.edgeTable[G];if(f==0)return 0;
|
|
|
+var Y=this.delta,W=b+Y,na=d+Y;Y=e+Y;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,I,A)}if(f&2){this.compNorm(k);this.compNorm(y);this.VIntY(k*3,this.vlist,this.nlist,3,h,W,d,e,A,z)}if(f&4){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,6,h,b,na,e,J,z)}if(f&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,I,J)}if(f&16){this.compNorm(w);this.compNorm(x);this.VIntX(w*3,this.vlist,this.nlist,12,h,b,d,
|
|
|
+Y,Q,N)}if(f&32){this.compNorm(x);this.compNorm(B);this.VIntY(x*3,this.vlist,this.nlist,15,h,W,d,Y,N,R)}if(f&64){this.compNorm(t);this.compNorm(B);this.VIntX(t*3,this.vlist,this.nlist,18,h,b,na,Y,fa,R)}if(f&128){this.compNorm(w);this.compNorm(t);this.VIntY(w*3,this.vlist,this.nlist,21,h,b,d,Y,Q,fa)}if(f&256){this.compNorm(g);this.compNorm(w);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,I,Q)}if(f&512){this.compNorm(k);this.compNorm(x);this.VIntZ(k*3,this.vlist,this.nlist,27,h,W,d,e,A,N)}if(f&1024){this.compNorm(y);
|
|
|
+this.compNorm(B);this.VIntZ(y*3,this.vlist,this.nlist,30,h,W,na,e,z,R)}if(f&2048){this.compNorm(o);this.compNorm(t);this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,na,e,J,fa)}G<<=4;for(h=g=0;THREE.triTable[G+h]!=-1;){b=G+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
|
|
|
+3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
|
|
|
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,o=d*this.size,w=b*this.size,y=Math.floor(k-j);y<1&&(y=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var x=Math.floor(o-j);x<1&&(x=1);o=Math.floor(o+j);o>this.size-1&&(o=this.size-1);var t=Math.floor(w-j);t<1&&(t=1);j=Math.floor(w+j);
|
|
|
+j>this.size-1&&(j=this.size-1);for(var B,G,I,A,J,z;y<k;y++){w=this.size2*y;G=y/this.size-e;J=G*G;for(G=x;G<o;G++){I=w+this.size*G;B=G/this.size-d;z=B*B;for(B=t;B<j;B++){A=B/this.size-b;A=g/(1.0E-6+A*A+z+J)-h;A>0&&(this.field[I+B]+=A)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,o=this.size,w=this.yd,y=this.zd,x=this.field,t=o*Math.sqrt(b/d);t>o&&(t=o);for(e=0;e<t;e++){g=e/o;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<o;g++){k=e+g*w;for(h=0;h<o;h++)x[y*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
|
|
|
+h,j,k,o,w=this.size,y=this.yd,x=this.zd,t=this.field,B=w*Math.sqrt(b/d);B>w&&(B=w);for(g=0;g<B;g++){e=g/w;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*y;for(e=0;e<w;e++){o=k+e;for(h=0;h<w;h++)t[x*h+o]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){o=k+g*yd;for(e=0;e<size;e++)field[o+e]+=j}}}};this.reset=function(){var b;
|
|
|
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,g,h,j,k,o,w,y,x=this.size-2;for(h=1;h<x;h++){y=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(g=1;g<x;g++){w=y+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<x;e++){j=(e-this.halfsize)/this.halfsize;d=w+e;this.polygonize(j,k,o,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,o,w,y,x;for(g=
|
|
|
+0;g<e.count;g++){o=g*3;y=o+1;x=o+2;h=e.positionArray[o];j=e.positionArray[y];k=e.positionArray[x];w=new THREE.Vector3(h,j,k);h=e.normalArray[o];j=e.normalArray[y];k=e.normalArray[x];o=new THREE.Vector3(h,j,k);o.normalize();o=new THREE.Vertex(w,o);d.vertices.push(o)}nfaces=e.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;y=o+1;x=o+2;w=d.vertices[o].normal;h=d.vertices[y].normal;j=d.vertices[x].normal;o=new THREE.Face3(o,y,x,[w,h,j]);d.faces.push(o)}b+=nfaces;e.count=0});return d};this.init(a)};
|
|
|
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,
|
|
|
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,
|