|
@@ -1,278 +1,278 @@
|
|
|
-// ThreeDebug.js r32 - http://github.com/mrdoob/three.js
|
|
|
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
|
|
|
-THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,o,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-b);k=d*(1-b*o);b=d*(1-b*(1-o));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
|
|
|
-setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
|
|
|
-this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
-THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
|
|
|
-THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
|
-a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
|
|
|
-this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
|
|
|
-this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1};
|
|
|
-THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
-return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
-THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(H,r,Z,E){E=E.clone().subSelf(r);Z=Z.clone().subSelf(r);var L=H.clone().subSelf(r);H=E.dot(E);r=E.dot(Z);E=E.dot(L);var c=Z.dot(Z);Z=Z.dot(L);L=1/(H*c-r*r);c=(c*E-r*Z)*L;H=(H*Z-r*E)*L;return c>0&&H>0&&c+H<1}var d,e,g,i,l,o,k,m,s,w,
|
|
|
-u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];w=this.origin.clone();u=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());o=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());s=u.dot(m);if(s<0){m=m.dot((new THREE.Vector3).sub(i,
|
|
|
-w))/s;w=w.addSelf(u.multiplyScalar(m));if(g instanceof THREE.Face3){if(b(w,i,l,o)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,o,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}}return I}};
|
|
|
-THREE.Rectangle=function(){function a(){i=e-b;l=g-d}var b,d,e,g,i,l,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,m,s,w){o=!1;b=k;d=m;e=s;g=w;a()};this.addPoint=function(k,m){if(o){o=!1;b=k;d=m;e=k;g=m}else{b=b<k?b:k;d=d<m?d:m;e=e>k?e:k;g=g>m?g:m}a()};
|
|
|
-this.add3Points=function(k,m,s,w,u,x){if(o){o=!1;b=k<s?k<u?k:u:s<u?s:u;d=m<w?m<x?m:x:w<x?w:x;e=k>s?k>u?k:u:s>u?s:u;g=m>w?m>x?m:x:w>x?w:x}else{b=k<s?k<u?k<b?k:b:u<b?u:b:s<u?s<b?s:b:u<b?u:b;d=m<w?m<x?m<d?m:d:x<d?x:d:w<x?w<d?w:d:x<d?x:d;e=k>s?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=m>w?m>x?m>g?m:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(o){o=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();e=e>k.getRight()?
|
|
|
-e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=!0;g=e=d=b=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
|
|
|
-b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+i+", height: "+l+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
-THREE.Matrix4=function(a,b,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=s||1;this.n34=w||0;this.n41=u||0;this.n42=x||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=o;this.n31=k;this.n32=m;this.n33=s;this.n34=w;this.n41=u;this.n42=x;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(d,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
|
|
|
-this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*
|
|
|
-a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
|
|
|
-a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44,Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43,ja=b.n44;this.n11=d*Z+e*ia+g*S+i*J;this.n12=d*E+e*T+g*ba+i*la;this.n13=d*L+e*O+g*V+i*Q;this.n14=d*c+e*ca+g*D+i*ja;this.n21=l*Z+o*ia+k*S+m*J;this.n22=l*E+o*T+k*ba+m*la;
|
|
|
-this.n23=l*L+o*O+k*V+m*Q;this.n24=l*c+o*ca+k*D+m*ja;this.n31=s*Z+w*ia+u*S+x*J;this.n32=s*E+w*T+u*ba+x*la;this.n33=s*L+w*O+u*V+x*Q;this.n34=s*c+w*ca+u*D+x*ja;this.n41=F*Z+I*ia+H*S+r*J;this.n42=F*E+I*T+H*ba+r*la;this.n43=F*L+I*O+H*V+r*Q;this.n44=F*c+I*ca+H*D+r*ja;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,o=a.n21,k=a.n22,m=a.n23,s=a.n24,w=a.n31,u=a.n32,x=a.n33,F=a.n34,I=a.n41,H=a.n42,r=a.n43;a=a.n44;var Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=
|
|
|
-b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43;b=b.n44;this.n11=e*Z+g*ia+i*S+l*J;this.n12=e*E+g*T+i*ba+l*la;this.n13=e*L+g*O+i*V+l*Q;this.n14=e*c+g*ca+i*D+l*b;this.n21=o*Z+k*ia+m*S+s*J;this.n22=o*E+k*T+m*ba+s*la;this.n23=o*L+k*O+m*V+s*Q;this.n24=o*c+k*ca+m*D+s*b;this.n31=w*Z+u*ia+x*S+F*J;this.n32=w*E+u*T+x*ba+F*la;this.n33=w*L+u*O+x*V+F*Q;this.n34=w*c+u*ca+x*D+F*b;this.n41=I*Z+H*ia+r*S+a*J;this.n42=I*E+H*T+r*ba+a*la;this.n43=I*L+H*O+r*V+a*Q;this.n44=I*c+H*ca+r*D+a*b;d[0]=this.n11;
|
|
|
-d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,o=this.n23,k=this.n24,m=this.n31,s=this.n32,w=this.n33,u=this.n34,x=this.n41,F=this.n42,I=this.n43,H=this.n44,r=a.n11,Z=a.n21,E=a.n31,L=a.n41,c=a.n12,ia=a.n22,T=a.n32,O=a.n42,ca=
|
|
|
-a.n13,S=a.n23,ba=a.n33,V=a.n43,D=a.n14,J=a.n24,la=a.n34;a=a.n44;this.n11=b*r+d*Z+e*E+g*L;this.n12=b*c+d*ia+e*T+g*O;this.n13=b*ca+d*S+e*ba+g*V;this.n14=b*D+d*J+e*la+g*a;this.n21=i*r+l*Z+o*E+k*L;this.n22=i*c+l*ia+o*T+k*O;this.n23=i*ca+l*S+o*ba+k*V;this.n24=i*D+l*J+o*la+k*a;this.n31=m*r+s*Z+w*E+u*L;this.n32=m*c+s*ia+w*T+u*O;this.n33=m*ca+s*S+w*ba+u*V;this.n34=m*D+s*J+w*la+u*a;this.n41=x*r+F*Z+I*E+H*L;this.n42=x*c+F*ia+I*T+H*O;this.n43=x*ca+F*S+I*ba+H*V;this.n44=x*D+F*J+I*la+H*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,b=this.n12,d=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,o=this.n24,k=this.n31,m=this.n32,s=this.n33,w=this.n34,u=this.n41,x=this.n42,F=this.n43,I=this.n44;return e*l*m*u-d*o*m*u-e*i*s*u+b*o*s*u+d*i*w*u-b*l*w*u-e*l*k*x+d*o*k*x+e*g*s*x-a*o*s*x-d*g*w*x+a*l*w*x+
|
|
|
-e*i*k*F-b*o*k*F-e*g*m*F+a*o*m*F+b*g*w*F-a*i*w*F-d*i*k*I+b*l*k*I+d*g*m*I-a*l*m*I-b*g*s*I+a*i*s*I},transpose:function(){function a(b,d,e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=
|
|
|
-this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);
|
|
|
-return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,i=a.x,l=a.y,o=a.z,k=g*
|
|
|
-i,m=g*l;this.set(k*i+d,k*l-e*o,k*o+e*l,0,k*l+e*o,m*l+d,m*o-e*i,0,k*o-e*l,m*o+e*i,g*o*o+d,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 b=a.x,d=a.y,e=a.z;a=Math.cos(d);d=Math.sin(d);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,o=d*e;this.n11=a*g;this.n12=d*b-l*i;this.n13=l*b+d*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-d*g;this.n32=o*i+a*b;this.n33=-o*b+a*i},setRotationFromQuaternion:function(a){var b=
|
|
|
-a.x,d=a.y,e=a.z,g=a.w,i=b+b,l=d+d,o=e+e;a=b*i;var k=b*l;b*=o;var m=d*l;d*=o;e*=o;i*=g;l*=g;g*=o;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=d-i;this.n31=b-l;this.n32=d+i;this.n33=1-(a+m)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
|
|
|
-a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};
|
|
|
-THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
|
|
|
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*I-m*u*I+m*w*H-o*x*H-k*w*r+o*u*r;b.n12=i*u*I-g*x*I-i*w*H+e*x*H+g*w*r-e*u*r;b.n13=g*m*I-i*k*I+i*o*H-e*m*H-g*o*r+e*k*r;b.n14=i*k*w-g*m*w-i*o*u+e*m*u+g*o*x-e*k*x;b.n21=m*u*F-k*x*F-m*s*H+l*x*H+k*s*r-l*u*r;b.n22=g*x*F-i*u*F+i*s*H-d*x*H-g*s*r+d*u*r;b.n23=i*k*F-g*m*F-i*l*H+d*m*H+g*l*r-d*k*r;
|
|
|
-b.n24=g*m*s-i*k*s+i*l*u-d*m*u-g*l*x+d*k*x;b.n31=o*x*F-m*w*F+m*s*I-l*x*I-o*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*I+d*x*I+e*s*r-d*w*r;b.n33=g*m*F-i*o*F+i*l*I-d*m*I-e*l*r+d*o*r;b.n34=i*o*s-e*m*s-i*l*w+d*m*w+e*l*x-d*o*x;b.n41=k*w*F-o*u*F-k*s*I+l*u*I+o*s*H-l*w*H;b.n42=e*u*F-g*w*F+g*s*I-d*u*I-e*s*H+d*w*H;b.n43=g*o*F-e*k*F-g*l*I+d*k*I+e*l*H-d*o*H;b.n44=e*k*s-g*o*s+g*l*w-d*k*w-e*l*u+d*o*u;b.multiplyScalar(1/a.determinant());return b};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*i;d[3]=a*l;d[4]=a*o;d[5]=a*k;d[6]=a*m;d[7]=a*s;d[8]=a*w;return b};
|
|
|
-THREE.Matrix4.makeFrustum=function(a,b,d,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,d,e,g,i){var l,o,k,m;l=new THREE.Matrix4;o=b-a;k=d-e;m=i-g;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((d+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((i+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
-THREE.Quaternion=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
|
|
|
-THREE.Quaternion.prototype.set=function(a,b,d,e){var g=this.that;g.x=a;g.y=b;g.z=d;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var l=a*b,o=e*g,k=this.that;k.w=l*i-o*d;k.x=l*d+o*i;k.y=e*b*i+a*g*d;k.z=a*g*i-e*b*d;this.isDirty=!0;return this};
|
|
|
-THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,d=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-d*d-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
|
|
|
-THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,d=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+d*d+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=d*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this};
|
|
|
-THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
|
|
|
-THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var d=this.that,e=a.x,g=a.y,i=a.z,l=d.x,o=d.y,k=d.z;d=d.w;var m=d*e+o*i-k*g,s=d*g+k*e-l*i,w=d*i+l*g-o*e;e=-l*e-o*g-k*i;b.x=m*d+e*-l+s*-k-w*-o;b.y=s*d+e*-o+w*-l-m*-k;b.z=w*d+e*-k+m*-o-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
|
|
|
-THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
|
|
|
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
-THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
-THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|
|
|
-THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
|
|
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
|
|
|
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,i,l,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){i=this.vertices[e];i.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];if(a&&i.vertexNormals.length){o.set(0,0,0);b=0;for(d=i.normal.length;b<d;b++)o.addSelf(i.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[i.a];d=this.vertices[i.b];l=this.vertices[i.c];o.sub(l.position,
|
|
|
-d.position);k.sub(b.position,d.position);o.crossSelf(k)}o.isZero()||o.normalize();i.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
|
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(D,J,la,Q,ja,ea,R){i=D.vertices[J].position;l=D.vertices[la].position;o=D.vertices[Q].position;k=g[ja];m=g[ea];s=g[R];w=l.x-i.x;u=o.x-i.x;x=l.y-i.y;F=o.y-
|
|
|
-i.y;I=l.z-i.z;H=o.z-i.z;r=m.u-k.u;Z=s.u-k.u;E=m.v-k.v;L=s.v-k.v;c=1/(r*L-Z*E);O.set((L*w-E*u)*c,(L*x-E*F)*c,(L*I-E*H)*c);ca.set((r*u-Z*w)*c,(r*F-Z*x)*c,(r*H-Z*I)*c);ia[J].addSelf(O);ia[la].addSelf(O);ia[Q].addSelf(O);T[J].addSelf(ca);T[la].addSelf(ca);T[Q].addSelf(ca)}var b,d,e,g,i,l,o,k,m,s,w,u,x,F,I,H,r,Z,E,L,c,ia=[],T=[],O=new THREE.Vector3,ca=new THREE.Vector3,S=new THREE.Vector3,ba=new THREE.Vector3,V=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){ia[b]=new THREE.Vector3;T[b]=new THREE.Vector3}b=
|
|
|
-0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
|
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){V.copy(this.vertices[b].normal);e=ia[b];S.copy(e);S.subSelf(V.multiplyScalar(V.dot(e))).normalize();ba.cross(this.vertices[b].normal,e);e=ba.dot(T[b]);e=e<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(d=s.length;b<d;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,d,e,g,i,l,o,k,m={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
|
|
|
-l=i.materials;o=a(l);m[o]==undefined&&(m[o]={hash:o,counter:0});k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
|
|
|
-new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,d)}};
|
|
|
-THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
|
|
|
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
-THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Mesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)}};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,b,d){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.globalMatrix,!0,d)}}else for(e=
|
|
|
-0;e<g;e++)this.children[e].update(this.skinMatrix,b,d)};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,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,i,l,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];i=g.pos;l=g.rotq;o=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];e=this.bones[d];
|
|
|
-g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}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,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.globalMatrix,b,d)}}};
|
|
|
-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,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
|
|
|
-e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
|
|
|
-THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
|
-THREE.AnimationHandler=function(){var a=[],b={};b.update=function(d){for(var e=0;e<a.length;e++)a[e].update(d)};b.add=function(d){a.indexOf(d)===-1&&a.push(d)};b.remove=function(d){a.indexOf(d)!==-1&&a.splice(childIndex,1)};b.initData=function(d){if(d.initialized!==!0){for(var e=0;e<d.hierarchy.length;e++)for(var g=0;g<d.hierarchy[e].keys.length;g++){if(d.hierarchy[e].keys[g].time<0)d.hierarchy[e].keys[g].time=0;d.hierarchy[e].keys[g].index=g;if(d.hierarchy[e].keys[g].rot!==undefined&&!(d.hierarchy[e].keys[g].rot instanceof
|
|
|
-THREE.Quaternion)){var i=d.hierarchy[e].keys[g].rot;d.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(d.length*d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(e=0;e<d.hierarchy.length;e++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};return b}();
|
|
|
-THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var d=0;d<this.root.bones.length;d++)this.hierarchy.push(this.root.bones[d])};
|
|
|
-THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
|
-this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
|
-THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,d,e,g,i,l,o=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,m=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(o[s][l]!==
|
|
|
-undefined){i.skinMatrix=o[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var u=0;u<3;u++){d=a[u];e=i.prevKey[d];g=i.nextKey[d];if(g.time<m){if(k<m)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(d,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(d,s,g.index+1)}while(g.time<k)}i.prevKey[d]=e;i.nextKey[d]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[d];
|
|
|
-g=g[d];if(d==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)o[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
-THREE.Animation.prototype.getNextKeyWith=function(a,b,d){for(var e=this.data.hierarchy[b].keys;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
|
|
|
-THREE.Camera=function(a,b,d,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=d||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
|
|
|
-this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
|
|
|
-THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
-this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)};
|
|
|
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,d=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*d+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var o=this.projectionMatrix,k=1/(o.n43*l),m=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*o.n11*m;i=o.n11*i*m;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*o.n22*k*this.screenCenterY;
|
|
|
-if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};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;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
|
-THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
|
|
-THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
|
|
|
-THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;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;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
|
-a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
-THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!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.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
-undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
-THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
|
|
|
-"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!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.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
-undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
-THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
|
|
|
-"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/> )"}};
|
|
|
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
-this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
|
|
-if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
|
|
-if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
-THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
|
|
|
-this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
-THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
-undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};
|
|
|
-THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
-undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
|
-a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
|
-undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
-THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
-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.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!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.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
|
|
-undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
-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.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
|
|
|
-THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
|
|
|
-THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
|
-var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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 a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};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 b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};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,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
-THREE.Projector=function(){function a(T,O){return O.z-T.z}function b(T,O){var ca=0,S=1,ba=T.z+T.w,V=O.z+O.w,D=-T.z+T.w,J=-O.z+O.w;if(ba>=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(S<ca)return!1;else{T.lerpSelf(O,ca);O.lerpSelf(T,1-S);return!0}}}var d,e,g=[],i,l,o,k=[],m,s,w=[],u,x,F=[],I=new THREE.Vector4,H=new THREE.Vector4,r=new THREE.Matrix4,
|
|
|
-Z=new THREE.Matrix4,E=[],L=new THREE.Vector4,c=new THREE.Vector4,ia;this.projectObjects=function(T,O,ca){O=[];var S,ba,V;e=0;ba=T.objects;T=0;for(S=ba.length;T<S;T++){V=ba[T];var D;if(!(D=!V.visible))if(D=V instanceof THREE.Mesh){a:{D=void 0;for(var J=V.globalMatrix,la=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),Q=0;Q<6;Q++){D=E[Q].x*J.n14+E[Q].y*J.n24+E[Q].z*J.n34+E[Q].w;if(D<=la){D=!1;break a}}D=!0}D=!D}if(!D){d=g[e]=g[e]||new THREE.RenderableObject;I.copy(V.position);
|
|
|
-r.multiplyVector3(I);d.object=V;d.z=I.z;O.push(d);e++}}ca&&O.sort(a);return O};this.projectScene=function(T,O,ca){var S=[],ba=O.near,V=O.far,D,J,la,Q,ja,ea,R,ra,wa,f,n,p,j,h,q,t;o=s=x=0;O.autoUpdateMatrix&&O.update();r.multiply(O.projectionMatrix,O.globalMatrix);E[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);E[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);E[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);E[3]=new THREE.Vector4(r.n41-
|
|
|
-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);E[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);E[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);D=0;for(ea=E.length;D<ea;D++){R=E[D];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}T.update(undefined,!1,O);ea=this.projectObjects(T,O,!0);T=0;for(D=ea.length;T<D;T++){R=ea[T].object;if(R.visible){R.autoUpdateMatrix&&R.updateMatrix();ra=R.globalMatrix;ra.extractRotationMatrix(R.rotationMatrix);n=R.rotationMatrix;
|
|
|
-wa=R.materials;f=R.overdraw;if(R instanceof THREE.Mesh){p=R.geometry;j=p.vertices;J=0;for(la=j.length;J<la;J++){h=j[J];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);Q=h.positionScreen;Q.copy(h.positionWorld);r.multiplyVector4(Q);Q.x/=Q.w;Q.y/=Q.w;h.__visible=Q.z>ba&&Q.z<V}p=p.faces;J=0;for(la=p.length;J<la;J++){h=p[J];if(h instanceof THREE.Face3){Q=j[h.a];ja=j[h.b];q=j[h.c];if(Q.__visible&&ja.__visible&&q.__visible&&(R.doubleSided||R.flipSided!=(q.positionScreen.x-Q.positionScreen.x)*
|
|
|
-(ja.positionScreen.y-Q.positionScreen.y)-(q.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0)){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
|
|
|
-ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ia=i.vertexNormalsWorld;Q=0;for(ja=q.length;Q<ja;Q++){t=ia[Q]=ia[Q]||new THREE.Vector3;t.copy(q[Q]);n.multiplyVector3(t)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][2]}S.push(i);o++}}else if(h instanceof THREE.Face4){Q=j[h.a];
|
|
|
-ja=j[h.b];q=j[h.c];t=j[h.d];if(Q.__visible&&ja.__visible&&q.__visible&&t.__visible&&(R.doubleSided||R.flipSided!=((t.positionScreen.x-Q.positionScreen.x)*(ja.positionScreen.y-Q.positionScreen.y)-(t.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0||(ja.positionScreen.x-q.positionScreen.x)*(t.positionScreen.y-q.positionScreen.y)-(ja.positionScreen.y-q.positionScreen.y)*(t.positionScreen.x-q.positionScreen.x)<0))){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);
|
|
|
-i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(t.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(t.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;
|
|
|
-if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][3]}S.push(i);o++;l=k[o]=k[o]||new THREE.RenderableFace3;l.v1.positionWorld.copy(ja.positionWorld);l.v2.positionWorld.copy(q.positionWorld);l.v3.positionWorld.copy(t.positionWorld);l.v1.positionScreen.copy(ja.positionScreen);l.v2.positionScreen.copy(q.positionScreen);l.v3.positionScreen.copy(t.positionScreen);l.normalWorld.copy(i.normalWorld);l.centroidWorld.copy(i.centroidWorld);l.centroidScreen.copy(i.centroidScreen);
|
|
|
-l.z=l.centroidScreen.z;l.meshMaterials=wa;l.faceMaterials=h.materials;l.overdraw=f;if(R.geometry.uvs[J]){l.uvs[0]=R.geometry.uvs[J][1];l.uvs[1]=R.geometry.uvs[J][2];l.uvs[2]=R.geometry.uvs[J][3]}S.push(l);o++}}}}else if(R instanceof THREE.Line){Z.multiply(r,ra);j=R.geometry.vertices;h=j[0];h.positionScreen.copy(h.position);Z.multiplyVector4(h.positionScreen);J=1;for(la=j.length;J<la;J++){Q=j[J];Q.positionScreen.copy(Q.position);Z.multiplyVector4(Q.positionScreen);ja=j[J-1];L.copy(Q.positionScreen);
|
|
|
-c.copy(ja.positionScreen);if(b(L,c)){L.multiplyScalar(1/L.w);c.multiplyScalar(1/c.w);m=w[s]=w[s]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(c);m.z=Math.max(L.z,c.z);m.materials=R.materials;S.push(m);s++}}}else if(R instanceof THREE.Particle){H.set(R.position.x,R.position.y,R.position.z,1);r.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){u=F[x]=F[x]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x-
|
|
|
-(H.x+O.projectionMatrix.n11)/(H.w+O.projectionMatrix.n14));u.scale.y=R.scale.y*Math.abs(u.y-(H.y+O.projectionMatrix.n22)/(H.w+O.projectionMatrix.n24));u.materials=R.materials;S.push(u);x++}}}}ca&&S.sort(a);return S};this.unprojectVector=function(T,O){var ca=THREE.Matrix4.makeInvert(O.globalMatrix);ca.multiplySelf(THREE.Matrix4.makeInvert(O.projectionMatrix));ca.multiplyVector3(T);return T}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,o){d=l;e=o;g=d/2;i=e/2};this.render=function(l,o){var k,m,s,w,u,x,F,I;a=b.projectScene(l,o);k=0;for(m=a.length;k<m;k++){u=a[k];if(u instanceof THREE.RenderableParticle){F=u.x*g+g;I=u.y*i+i;s=0;for(w=u.material.length;s<w;s++){x=u.material[s];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=F+"px";x.style.top=I+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(na){if(u!=na)m.globalAlpha=u=na}function b(na){if(x!=na){switch(na){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}x=na}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),i,l,o,k,m=g.getContext("2d"),s=new THREE.Color(0),w=0,u=1,x=0,F=null,I=null,H=1,r,Z,E,L,c,ia,T,O,ca,S=new THREE.Color,
|
|
|
-ba=new THREE.Color,V=new THREE.Color,D=new THREE.Color,J=new THREE.Color,la,Q,ja,ea,R,ra,wa,f,n,p=new THREE.Rectangle,j=new THREE.Rectangle,h=new THREE.Rectangle,q=!1,t=new THREE.Color,A=new THREE.Color,W=new THREE.Color,G=new THREE.Color,M=Math.PI*2,C=new THREE.Vector3,aa,da,ua,ka,fa,ga,ha=16;aa=document.createElement("canvas");aa.width=aa.height=2;da=aa.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);ua=da.getImageData(0,0,2,2);ka=ua.data;fa=document.createElement("canvas");fa.width=
|
|
|
-fa.height=ha;ga=fa.getContext("2d");ga.translate(-ha/2,-ha/2);ga.scale(ha,ha);ha--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(na,z){i=na;l=z;o=i/2;k=l/2;g.width=i;g.height=l;p.set(-o,-k,o,k);u=1;x=0;I=F=null;H=1};this.setClearColor=function(na,z){s=na;w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.setClearColorHex=function(na,z){s.setHex(na);w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
-0,0,-1,o,k);if(!j.isEmpty()){j.inflate(1);j.minSelf(p);if(s.hex==0&&w==0)m.clearRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+w+")";m.fillRect(j.getX(),j.getY(),j.getWidth(),j.getHeight())}j.empty()}};this.render=function(na,z){function Fa(y){var X,Y,B,U=y.lights;A.setRGB(0,0,0);W.setRGB(0,0,0);G.setRGB(0,0,0);y=0;for(X=U.length;y<X;y++){Y=U[y];B=Y.color;if(Y instanceof
|
|
|
-THREE.AmbientLight){A.r+=B.r;A.g+=B.g;A.b+=B.b}else if(Y instanceof THREE.DirectionalLight){W.r+=B.r;W.g+=B.g;W.b+=B.b}else if(Y instanceof THREE.PointLight){G.r+=B.r;G.g+=B.g;G.b+=B.b}}}function za(y,X,Y,B){var U,ma,xa,Da,Ea=y.lights;y=0;for(U=Ea.length;y<U;y++){ma=Ea[y];xa=ma.color;Da=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=Y.dot(ma.position)*Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){C.sub(ma.position,X);C.normalize();ma=Y.dot(C)*
|
|
|
-Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}}}function Ga(y,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var B,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*o;ma=X.scale.y*k;Y=U*Da;B=ma*Ea;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(!p.instersects(h))return;m.save();m.translate(y.x,y.y);m.rotate(-X.rotation);m.scale(U,-ma);m.translate(-Da,-Ea);m.drawImage(xa,0,0);m.restore()}m.beginPath();m.moveTo(y.x-
|
|
|
-10,y.y);m.lineTo(y.x+10,y.y);m.moveTo(y.x,y.y-10);m.lineTo(y.x,y.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){t.r=A.r+W.r+G.r;t.g=A.g+W.g+G.g;t.b=A.b+W.b+G.b;S.r=Y.color.r*t.r;S.g=Y.color.g*t.g;S.b=Y.color.b*t.b;S.updateStyleString()}else S.__styleString=Y.color.__styleString;Y=X.scale.x*o;B=X.scale.y*k;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(p.instersects(h)){U=S.__styleString;if(I!=U)m.fillStyle=I=U;m.save();m.translate(y.x,y.y);
|
|
|
-m.rotate(-X.rotation);m.scale(Y,B);m.beginPath();m.arc(0,0,1,0,M,!0);m.closePath();m.fill();m.restore()}}}}function P(y,X,Y,B){if(B.opacity!=0){a(B.opacity);b(B.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(B instanceof THREE.LineBasicMaterial){S.__styleString=B.color.__styleString;y=B.linewidth;if(H!=y)m.lineWidth=H=y;y=S.__styleString;if(F!=y)m.strokeStyle=F=y;m.stroke();h.inflate(B.linewidth*2)}}}function N(y,
|
|
|
-X,Y,B,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);L=y.positionScreen.x;c=y.positionScreen.y;ia=X.positionScreen.x;T=X.positionScreen.y;O=Y.positionScreen.x;ca=Y.positionScreen.y;m.beginPath();m.moveTo(L,c);m.lineTo(ia,T);m.lineTo(O,ca);m.lineTo(L,c);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&
|
|
|
-U.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=z.globalMatrix;C.copy(B.vertexNormalsWorld[0]);ea=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;R=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[1]);ra=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;wa=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[2]);f=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;n=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;Ca(L,c,ia,T,O,ca,U.env_map.image,ea,R,ra,wa,f,n)}}else U.wireframe?
|
|
|
-K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){ba.r=V.r=D.r=A.r;ba.g=V.g=D.g=A.g;ba.b=V.b=D.b=A.b;za(ma,B.v1.positionWorld,B.vertexNormalsWorld[0],ba);
|
|
|
-za(ma,B.v2.positionWorld,B.vertexNormalsWorld[1],V);za(ma,B.v3.positionWorld,B.vertexNormalsWorld[2],D);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else{t.r=A.r;t.g=A.g;t.b=A.b;za(ma,B.centroidWorld,B.normalWorld,t);S.r=U.color.r*t.r;S.g=U.color.g*t.g;S.b=U.color.b*t.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof
|
|
|
-THREE.MeshDepthMaterial){la=z.near;Q=z.far;ba.r=ba.g=ba.b=1-v(y.positionScreen.z,la,Q);V.r=V.g=V.b=1-v(X.positionScreen.z,la,Q);D.r=D.g=D.b=1-v(Y.positionScreen.z,la,Q);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Ba(B.normalWorld.x);S.g=Ba(B.normalWorld.y);S.b=Ba(B.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}}}function K(y,
|
|
|
-X){if(F!=y)m.strokeStyle=F=y;if(H!=X)m.lineWidth=H=X;m.stroke();h.inflate(X*2)}function oa(y){if(I!=y)m.fillStyle=I=y;m.fill()}function Ca(y,X,Y,B,U,ma,xa,Da,Ea,Ia,ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=y;B-=X;U-=y;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*B-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;B=(Ia*ma-Ja*B)*La;y=y-Ka*Da-Y*Ea;X=X-ya*Da-B*Ea;m.save();m.transform(Ka,ya,Y,B,y,X);m.clip();m.drawImage(xa,0,
|
|
|
-0);m.restore()}}function Aa(y,X,Y,B){var U=~~(y.r*255),ma=~~(y.g*255);y=~~(y.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(B.r*255),Ja=~~(B.g*255);B=~~(B.b*255);ka[0]=U<0?0:U>255?255:U;ka[1]=ma<0?0:ma>255?255:ma;ka[2]=y<0?0:y>255?255:y;ka[4]=xa<0?0:xa>255?255:xa;ka[5]=Da<0?0:Da>255?255:Da;ka[6]=X<0?0:X>255?255:X;ka[8]=Ea<0?0:Ea>255?255:Ea;ka[9]=Ia<0?0:Ia>255?255:Ia;ka[10]=Y<0?0:Y>255?255:Y;ka[12]=ya<0?0:ya>255?255:ya;ka[13]=Ja<0?0:
|
|
|
-Ja>255?255:Ja;ka[14]=B<0?0:B>255?255:B;da.putImageData(ua,0,0);ga.drawImage(aa,0,0);return fa}function v(y,X,Y){y=(y-X)/(Y-X);return y*y*(3-2*y)}function Ba(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Oa(y,X){var Y=X.x-y.x,B=X.y-y.y,U=1/Math.sqrt(Y*Y+B*B);Y*=U;B*=U;X.x+=Y;X.y+=B;y.x-=Y;y.y-=B}var Ma,Ha,$,sa,pa,ta,va,qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);d=e.projectScene(na,z,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(p.getX(),p.getY(),p.getWidth(),
|
|
|
-p.getHeight());(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=d.length;Ma<Ha;Ma++){$=d[Ma];h.empty();if($ instanceof THREE.RenderableParticle){r=$;r.x*=o;r.y*=k;sa=0;for(pa=$.materials.length;sa<pa;sa++)Ga(r,$,$.materials[sa],na)}else if($ instanceof THREE.RenderableLine){r=$.v1;Z=$.v2;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;h.addPoint(r.positionScreen.x,r.positionScreen.y);h.addPoint(Z.positionScreen.x,Z.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=
|
|
|
-$.materials.length;sa<pa;)P(r,Z,$,$.materials[sa++],na)}}else if($ instanceof THREE.RenderableFace3){r=$.v1;Z=$.v2;E=$.v3;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;E.positionScreen.x*=o;E.positionScreen.y*=k;if($.overdraw){Oa(r.positionScreen,Z.positionScreen);Oa(Z.positionScreen,E.positionScreen);Oa(E.positionScreen,r.positionScreen)}h.add3Points(r.positionScreen.x,r.positionScreen.y,Z.positionScreen.x,Z.positionScreen.y,E.positionScreen.x,E.positionScreen.y);
|
|
|
-if(p.instersects(h)){sa=0;for(pa=$.meshMaterials.length;sa<pa;){qa=$.meshMaterials[sa++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(va=$.faceMaterials.length;ta<va;)(qa=$.faceMaterials[ta++])&&N(r,Z,E,$,qa,na)}else N(r,Z,E,$,qa,na)}}}j.addRectangle(h)}m.lineWidth=1;m.strokeStyle="rgba( 255, 0, 0, 0.5 )";m.strokeRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());m.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(ea,R,ra){var wa,f,n,p;wa=0;for(f=ea.lights.length;wa<f;wa++){n=ea.lights[wa];if(n instanceof THREE.DirectionalLight){p=R.normalWorld.dot(n.position)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}else if(n instanceof THREE.PointLight){ca.sub(n.position,R.centroidWorld);ca.normalize();p=R.normalWorld.dot(ca)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}}}function b(ea,R,ra,wa,f,n){D=e(J++);D.setAttribute("d",
|
|
|
-"M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(n,wa,L);E.r=f.color.r*L.r;E.g=f.color.g*L.g;E.b=f.color.b*L.b;E.updateStyleString()}else E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){O=1-f.__2near/(f.__farPlusNear-
|
|
|
-wa.z*f.__farMinusNear);E.setRGB(O,O,O)}else f instanceof THREE.MeshNormalMaterial&&E.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+f.opacity);o.appendChild(D)}function d(ea,R,ra,wa,
|
|
|
-f,n,p){D=e(J++);D.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)E.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(p,f,L);E.r=n.color.r*L.r;E.g=n.color.g*L.g;E.b=n.color.b*L.b;E.updateStyleString()}else E.__styleString=n.color.__styleString;
|
|
|
-else if(n instanceof THREE.MeshDepthMaterial){O=1-n.__2near/(n.__farPlusNear-f.z*n.__farMinusNear);E.setRGB(O,O,O)}else n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));n.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+
|
|
|
-"; fill-opacity: "+n.opacity);o.appendChild(D)}function e(ea){if(S[ea]==null){S[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ea].setAttribute("shape-rendering","crispEdges")}return S[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var i=null,l=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,s,w,u,x,F,I,H=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,E=new THREE.Color(16777215),L=new THREE.Color(16777215),
|
|
|
-c=new THREE.Color(0),ia=new THREE.Color(0),T=new THREE.Color(0),O,ca=new THREE.Vector3,S=[],ba=[],V=[],D,J,la,Q,ja=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ea){switch(ea){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ea,R){k=ea;m=R;s=k/2;w=m/2;o.setAttribute("viewBox",-s+" "+-w+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);H.set(-s,-w,s,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};
|
|
|
-this.render=function(ea,R){var ra,wa,f,n,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ea,R,this.sortElements);Q=la=J=0;if(Z=ea.lights.length>0){h=ea.lights;c.setRGB(0,0,0);ia.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra<wa;ra++){f=h[ra];n=f.color;if(f instanceof THREE.AmbientLight){c.r+=n.r;c.g+=n.g;c.b+=n.b}else if(f instanceof THREE.DirectionalLight){ia.r+=n.r;ia.g+=n.g;ia.b+=n.b}else if(f instanceof THREE.PointLight){T.r+=n.r;T.g+=n.g;T.b+=n.b}}}ra=0;for(wa=i.length;ra<wa;ra++){h=
|
|
|
-i[ra];r.empty();if(h instanceof THREE.RenderableParticle){u=h;u.x*=s;u.y*=-w;f=0;for(n=h.materials.length;f<n;f++)if(q=h.materials[f]){p=u;j=h;var t=la++;if(ba[t]==null){ba[t]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&ba[t].setAttribute("shape-rendering","crispEdges")}D=ba[t];D.setAttribute("cx",p.x);D.setAttribute("cy",p.y);D.setAttribute("r",j.scale.x*s);if(q instanceof THREE.ParticleCircleMaterial){if(Z){L.r=c.r+ia.r+T.r;L.g=c.g+ia.g+T.g;L.b=c.b+ia.b+T.b;E.r=q.color.r*
|
|
|
-L.r;E.g=q.color.g*L.g;E.b=q.color.b*L.b;E.updateStyleString()}else E=q.color;D.setAttribute("style","fill: "+E.__styleString)}o.appendChild(D)}}else if(h instanceof THREE.RenderableLine){u=h.v1;x=h.v2;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.materials.length;f<n;)if(q=h.materials[f++]){p=u;j=x;t=Q++;if(V[t]==null){V[t]=
|
|
|
-document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&V[t].setAttribute("shape-rendering","crispEdges")}D=V[t];D.setAttribute("x1",p.positionScreen.x);D.setAttribute("y1",p.positionScreen.y);D.setAttribute("x2",j.positionScreen.x);D.setAttribute("y2",j.positionScreen.y);if(q instanceof THREE.LineBasicMaterial){E.__styleString=q.color.__styleString;D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+
|
|
|
-q.linecap+"; stroke-linejoin: "+q.linejoin);o.appendChild(D)}}}}else if(h instanceof THREE.RenderableFace3){u=h.v1;x=h.v2;F=h.v3;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof
|
|
|
-THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&b(u,x,F,h,q,ea)}else q&&b(u,x,F,h,q,ea)}}}else if(h instanceof THREE.RenderableFace4){u=h.v1;x=h.v2;F=h.v3;I=h.v4;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;I.positionScreen.x*=s;I.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,
|
|
|
-F.positionScreen.y);r.addPoint(I.positionScreen.x,I.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&d(u,x,F,I,h,q,ea)}else q&&d(u,x,F,I,h,q,ea)}}}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(f,n,p){var j,h,q,t=f.vertices,A=t.length,W=f.colors,G=W.length,M=f.__vertexArray,C=f.__colorArray,aa=f.__sortArray,da=f.__dirtyVertices,ua=f.__dirtyColors;if(p.sortParticles){J.multiplySelf(p.globalMatrix);for(j=0;j<A;j++){h=t[j].position;ea.copy(h);J.multiplyVector3(ea);aa[j]=[ea.z,j]}aa.sort(function(ka,fa){return fa[0]-ka[0]});for(j=0;j<A;j++){h=t[aa[j][1]].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}for(j=0;j<G;j++){q=j*3;color=W[aa[j][1]];C[q]=color.r;
|
|
|
-C[q+1]=color.g;C[q+2]=color.b}}else{if(da)for(j=0;j<A;j++){h=t[j].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}if(ua)for(j=0;j<G;j++){color=W[j];q=j*3;C[q]=color.r;C[q+1]=color.g;C[q+2]=color.b}}if(da||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,M,n)}if(ua||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,C,n)}}function d(f,n){f.fragment_shader=n.fragment_shader;f.vertex_shader=n.vertex_shader;f.uniforms=
|
|
|
-Uniforms.clone(n.uniforms)}function e(f,n,p,j,h){j.program||O.initMaterial(j,n,p);var q=j.program,t=q.uniforms,A=j.uniforms;if(q!=ia){c.useProgram(q);ia=q;c.uniformMatrix4fv(t.projectionMatrix,!1,la)}if(p&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){A.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){A.fogNear.value=p.near;A.fogFar.value=
|
|
|
-p.far}else if(p instanceof THREE.FogExp2)A.fogDensity.value=p.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){var W,G,M=0,C=0,aa=0,da,ua,ka,fa=O.lights,ga=fa.directional.colors,ha=fa.directional.positions,na=fa.point.colors,z=fa.point.positions,Fa=0,za=0;p=G=G=0;for(W=n.length;p<W;p++){G=n[p];da=G.color;ua=G.position;ka=G.intensity;if(G instanceof THREE.AmbientLight){M+=da.r;C+=da.g;aa+=da.b}else if(G instanceof THREE.DirectionalLight){G=Fa*3;ga[G]=da.r*ka;
|
|
|
-ga[G+1]=da.g*ka;ga[G+2]=da.b*ka;ha[G]=ua.x;ha[G+1]=ua.y;ha[G+2]=ua.z;Fa+=1}else if(G instanceof THREE.PointLight){G=za*3;na[G]=da.r*ka;na[G+1]=da.g*ka;na[G+2]=da.b*ka;z[G]=ua.x;z[G+1]=ua.y;z[G+2]=ua.z;za+=1}}for(p=Fa*3;p<ga.length;p++)ga[p]=0;for(p=za*3;p<na.length;p++)na[p]=0;fa.point.length=za;fa.directional.length=Fa;fa.ambient[0]=M;fa.ambient[1]=C;fa.ambient[2]=aa;n=O.lights;A.enableLighting.value=n.directional.length+n.point.length;A.ambientLightColor.value=n.ambient;A.directionalLightColor.value=
|
|
|
-n.directional.colors;A.directionalLightDirection.value=n.directional.positions;A.pointLightColor.value=n.point.colors;A.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.map.texture=j.map;A.light_map.texture=j.light_map;A.env_map.texture=j.env_map;A.reflectivity.value=j.reflectivity;
|
|
|
-A.refraction_ratio.value=j.refraction_ratio;A.combine.value=j.combine;A.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){A.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.size.value=j.size;A.map.texture=
|
|
|
-j.map}else if(j instanceof THREE.MeshPhongMaterial){A.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);A.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);A.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){A.mNear.value=f.zNear;A.mFar.value=f.zFar;A.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)A.opacity.value=j.opacity;for(var Ga in A)if(M=q.uniforms[Ga]){p=A[Ga];W=p.type;n=p.value;if(W=="i")c.uniform1i(M,n);else if(W=="f")c.uniform1f(M,
|
|
|
-n);else if(W=="fv1")c.uniform1fv(M,n);else if(W=="fv")c.uniform3fv(M,n);else if(W=="v2")c.uniform2f(M,n.x,n.y);else if(W=="v3")c.uniform3f(M,n.x,n.y,n.z);else if(W=="c")c.uniform3f(M,n.r,n.g,n.b);else if(W=="t"){c.uniform1i(M,n);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(!p.image.__webGLTextureCube&&!p.image.__cubeMapInitialized&&p.image.loadCount==6){p.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);
|
|
|
-c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image[W]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);p.image.__cubeMapInitialized=!0}c.activeTexture(c.TEXTURE0+
|
|
|
-n);c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(!p.__webGLTexture&&p.image.loaded){p.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(p.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(p.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(p.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(p.min_filter));
|
|
|
-c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_2D,p.__webGLTexture)}}}c.uniformMatrix4fv(t.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(t.normalMatrix,!1,h._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&c.uniform3f(t.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&c.uniformMatrix4fv(t.objectMatrix,
|
|
|
-!1,h._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(t.viewMatrix,!1,ja);if(j.skinning){c.uniformMatrix4fv(t.cameraInverseMatrix,!1,Q);c.uniformMatrix4fv(t.uBoneGlobalMatrices,!1,h.boneMatrices)}return q}function g(f,n,p,j,h,q){f=e(f,n,p,j,q).attributes;c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-h.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=
|
|
|
-0)if(h.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-h.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.drawElements(c.LINES,h.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,h.__webGLFaceCount,c.UNSIGNED_SHORT,
|
|
|
-0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(q,0,h.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,h.__webGLParticleCount);else q instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,h.__webGLVertexCount)}function i(f,n){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.position);c.vertexAttribPointer(n.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.normal);c.vertexAttribPointer(n.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(ca!=f.doubleSided){f.doubleSided?
|
|
|
-c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(S!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);S=f.flipSided}}function o(f){if(V!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);V=f}}function k(f){D[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);D[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);D[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);D[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);D[4].set(f.n41-f.n31,f.n42-f.n32,
|
|
|
-f.n43-f.n33,f.n44-f.n34);D[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var n;for(f=0;f<5;f++){n=D[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function m(f){for(var n=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=D[j].x*n.n14+D[j].y*n.n24+D[j].z*n.n34+D[j].w;if(f<=p)return!1}return!0}function s(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=
|
|
|
-0;for(n=j.materials.length;f<n;f++){p=j.materials[f];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?s(q,p):s(h,p)}}function u(f){var n,p,j,h,q=f.object,t=f.buffer,A=f.opaque,W=f.transparent;W.count=0;f=A.count=0;for(j=q.materials.length;f<j;f++){n=q.materials[f];if(n instanceof THREE.MeshFaceMaterial){n=0;for(p=t.materials.length;n<p;n++)(h=t.materials[n])&&(h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(A,h))}else{h=n;h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?
|
|
|
-s(W,h):s(A,h)}}}function x(f,n){return n.z-f.z}function F(f,n,p,j,h){if(n[p]==undefined){f.push({buffer:j,object:h,opaque:{list:[],count:0},transparent:{list:[],count:0}});n[p]=1}}function I(f,n){f._modelViewMatrix.multiplyToArray(n.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){if(f!=ba){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
|
|
|
-c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ba=f}}function r(f,n){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);
|
|
|
-c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(f.min_filter));c.texImage2D(c.TEXTURE_2D,0,E(f.format),f.width,f.height,0,E(f.format),E(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,
|
|
|
-f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var p,j,h;if(f){p=f.__webGLFramebuffer;j=f.width;h=f.height}else{p=null;j=L.width;h=L.height}if(p!=T){c.bindFramebuffer(c.FRAMEBUFFER,p);c.viewport(0,0,j,h);n&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);T=p}}function Z(f,n){var p;if(f=="fragment")p=c.createShader(c.FRAGMENT_SHADER);
|
|
|
-else f=="vertex"&&(p=c.createShader(c.VERTEX_SHADER));c.shaderSource(p,n);c.compileShader(p);if(!c.getShaderParameter(p,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(p));return null}return p}function E(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
|
|
|
-case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
|
|
|
-case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var L=document.createElement("canvas"),c,ia=null,T=null,O=this,ca=null,S=null,ba=null,V=null,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,la=new Float32Array(16),Q=new Float32Array(16),ja=new Float32Array(16),ea=new THREE.Vector4,R=
|
|
|
-!0,ra=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=L;this.autoClear=!0;this.sortObjects=!1;(function(f,n,p){try{c=L.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);
|
|
|
-c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(n.r,n.g,n.b,p);_cullEnabled=!0})(R,ra,wa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,n){L.width=f;L.height=n;c.viewport(0,0,L.width,L.height)};this.setClearColorHex=function(f,n){var p=new THREE.Color(f);c.clearColor(p.r,p.g,p.b,n)};this.setClearColor=function(f,n){c.clearColor(f.r,f.g,f.b,n)};
|
|
|
-this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,n,p){var j,h;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,
|
|
|
-THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var q,t,A,W;h=A=W=0;for(q=n.length;h<q;h++){t=n[h];t instanceof THREE.DirectionalLight&&A++;t instanceof THREE.PointLight&&W++}if(W+A<=4)n=A;else{n=Math.ceil(4*A/(W+A));W=4-n}h={directional:n,point:W};W=f.fragment_shader;n=f.vertex_shader;q={fog:p,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:h.directional,maxPointLights:h.point};
|
|
|
-p=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
|
|
|
-"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
-c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+n));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(n=p.length;W<
|
|
|
-n;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(n=p.length;W<n;W++){h=p[W];j.attributes[h]=c.getAttribLocation(j,h)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
|
|
|
-0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,n,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;n.autoUpdateMatrix&&n.update();n.globalMatrix.flattenToArray(ja);n.projectionMatrix.flattenToArray(la);n.inverseMatrix.flattenToArray(Q);J.multiply(n.projectionMatrix,n.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
-f.update(undefined,!1,n);this.initWebGLObjects(f,n);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];M=h.object;if(M.visible)if(!(M instanceof THREE.Mesh)||m(M)){M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,n);u(h);h.render=!0;if(this.sortObjects){ea.copy(M.position);J.multiplyVector3(ea);h.z=ea.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);G=f.__webGLObjectsImmediate.length;for(j=0;j<
|
|
|
-G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){M.autoUpdateMatrix&&M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,n);w(h)}}H(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];o(A.depth_test);g(n,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];o(A.depth_test);q=e(n,aa,da,A,M);M.render(function(ua){i(ua,
|
|
|
-q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);o(A.depth_test);g(n,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);o(A.depth_test);q=e(n,aa,da,A,M);M.render(function(ua){i(ua,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);
|
|
|
-c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var n,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}n=0;for(p=f.objects.length;n<p;n++){j=f.objects[n];var h=f,q=void 0,t=void 0,A=void 0,W=void 0;t=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
|
|
|
-j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in t.geometryChunks){A=t.geometryChunks[q];if(!A.__webGLVertexBuffer){h=A;h.__webGLVertexBuffer=c.createBuffer();h.__webGLNormalBuffer=c.createBuffer();h.__webGLTangentBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h.__webGLUVBuffer=c.createBuffer();h.__webGLUV2Buffer=c.createBuffer();h.__webGLSkinVertexABuffer=
|
|
|
-c.createBuffer();h.__webGLSkinVertexBBuffer=c.createBuffer();h.__webGLSkinIndicesBuffer=c.createBuffer();h.__webGLSkinWeightsBuffer=c.createBuffer();h.__webGLFaceBuffer=c.createBuffer();h.__webGLLineBuffer=c.createBuffer();h=A;var G=j,M=void 0,C=void 0,aa=0,da=0,ua=0,ka=G.geometry.faces,fa=h.faces;M=0;for(C=fa.length;M<C;M++){fi=fa[M];face=ka[fi];if(face instanceof THREE.Face3){aa+=3;da+=1;ua+=3}else if(face instanceof THREE.Face4){aa+=4;da+=2;ua+=4}}h.__vertexArray=new Float32Array(aa*3);h.__normalArray=
|
|
|
-new Float32Array(aa*3);h.__tangentArray=new Float32Array(aa*4);h.__colorArray=new Float32Array(aa*3);h.__uvArray=new Float32Array(aa*2);h.__uv2Array=new Float32Array(aa*2);h.__skinVertexAArray=new Float32Array(aa*4);h.__skinVertexBArray=new Float32Array(aa*4);h.__skinIndexArray=new Float32Array(aa*4);h.__skinWeightArray=new Float32Array(aa*4);h.__faceArray=new Uint16Array(da*3);h.__lineArray=new Uint16Array(ua*2);C=M=h;aa=void 0;ka=void 0;var ga=void 0,ha=void 0;ga=void 0;fa=!1;aa=0;for(ka=G.materials.length;aa<
|
|
|
-ka;aa++){ga=G.materials[aa];if(ga instanceof THREE.MeshFaceMaterial){ga=0;for(ha=C.materials.length;ga<ha;ga++)if(C.materials[ga]&&C.materials[ga].shading!=undefined&&C.materials[ga].shading==THREE.SmoothShading){fa=!0;break}}else if(ga&&ga.shading!=undefined&&ga.shading==THREE.SmoothShading){fa=!0;break}if(fa)break}M.__needsSmoothNormals=fa;h.__webGLFaceCount=da*3;h.__webGLLineCount=ua*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=
|
|
|
-!0}if(t.__dirtyVertices||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){h=A;da=c.DYNAMIC_DRAW;ua=void 0;M=void 0;var na=void 0,z=void 0,Fa=void 0,za=void 0,Ga=void 0;na=void 0;var P=void 0,N=void 0,K=void 0,oa=void 0;P=void 0;N=void 0;K=void 0;z=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;z=void 0;za=void 0;Fa=void 0;
|
|
|
-Ga=void 0;var Ca=ha=ga=fa=ka=aa=G=C=0,Aa=0,v=0,Ba=h.__vertexArray,Oa=h.__uvArray,Ma=h.__uv2Array,Ha=h.__normalArray,$=h.__tangentArray,sa=h.__colorArray,pa=h.__skinVertexAArray,ta=h.__skinVertexBArray,va=h.__skinIndexArray,qa=h.__skinWeightArray,y=h.__faceArray,X=h.__lineArray,Y=h.__needsSmoothNormals,B=j.geometry,U=B.__dirtyVertices,ma=B.__dirtyElements,xa=B.__dirtyUvs,Da=B.__dirtyNormals,Ea=B.__dirtyTangents,Ia=B.__dirtyColors,ya=B.vertices,Ja=h.faces,Qa=B.faces,Ka=B.uvs,La=B.uvs2,Na=B.colors,Ra=
|
|
|
-B.skinVerticesA,Sa=B.skinVerticesB,Ta=B.skinIndices,Pa=B.skinWeights;ua=0;for(M=Ja.length;ua<M;ua++){na=Ja[ua];z=Qa[na];Ga=Ka[na];na=La[na];Fa=z.vertexNormals;za=z.normal;if(z instanceof THREE.Face3){if(U){P=ya[z.a].position;N=ya[z.b].position;K=ya[z.c].position;Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;G+=9}if(Pa.length){P=Pa[z.a];N=Pa[z.b];K=Pa[z.c];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+
|
|
|
-7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;P=Ta[z.a];N=Ta[z.b];K=Ta[z.c];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;P=Ra[z.a];N=Ra[z.b];K=Ra[z.c];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;P=Sa[z.a];N=Sa[z.b];K=Sa[z.c];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+
|
|
|
-6]=N.z;ta[v+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;v+=12}if(Ia&&Na.length){P=Na[z.a];N=Na[z.b];K=Na[z.c];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;Aa+=9}if(Ea&&B.hasTangents){P=ya[z.a].tangent;N=ya[z.b].tangent;K=ya[z.c].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;ha+=12}if(Da)if(Fa.length==3&&Y)for(z=0;z<
|
|
|
-3;z++){za=Fa[z];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(z=0;z<3;z++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(z=0;z<3;z++){Fa=Ga[z];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(z=0;z<3;z++){Ga=na[z];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){y[fa]=C;y[fa+1]=C+1;y[fa+2]=C+2;fa+=3;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+2;X[Ca+4]=C+1;X[Ca+5]=C+2;Ca+=6;C+=3}}else if(z instanceof THREE.Face4){if(U){P=ya[z.a].position;N=ya[z.b].position;K=ya[z.c].position;oa=ya[z.d].position;
|
|
|
-Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;Ba[G+9]=oa.x;Ba[G+10]=oa.y;Ba[G+11]=oa.z;G+=12}if(Pa.length){P=Pa[z.a];N=Pa[z.b];K=Pa[z.c];oa=Pa[z.d];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;qa[v+12]=oa.x;qa[v+13]=oa.y;qa[v+14]=oa.z;qa[v+15]=oa.w;P=Ta[z.a];N=Ta[z.b];K=Ta[z.c];oa=Ta[z.d];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=
|
|
|
-N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;va[v+12]=oa.x;va[v+13]=oa.y;va[v+14]=oa.z;va[v+15]=oa.w;P=Ra[z.a];N=Ra[z.b];K=Ra[z.c];oa=Ra[z.d];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;pa[v+12]=oa.x;pa[v+13]=oa.y;pa[v+14]=oa.z;pa[v+15]=1;P=Sa[z.a];N=Sa[z.b];K=Sa[z.c];oa=Sa[z.d];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+6]=N.z;ta[v+
|
|
|
-7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;ta[v+12]=oa.x;ta[v+13]=oa.y;ta[v+14]=oa.z;ta[v+15]=1;v+=16}if(Ia&&Na.length){P=Na[z.a];N=Na[z.b];K=Na[z.c];oa=Na[z.d];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;sa[Aa+9]=oa.r;sa[Aa+10]=oa.g;sa[Aa+11]=oa.b;Aa+=12}if(Ea&&B.hasTangents){P=ya[z.a].tangent;N=ya[z.b].tangent;K=ya[z.c].tangent;z=ya[z.d].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;
|
|
|
-$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;$[ha+12]=z.x;$[ha+13]=z.y;$[ha+14]=z.z;$[ha+15]=z.w;ha+=16}if(Da)if(Fa.length==4&&Y)for(z=0;z<4;z++){za=Fa[z];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(z=0;z<4;z++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(z=0;z<4;z++){Fa=Ga[z];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(z=0;z<4;z++){Ga=na[z];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){y[fa]=C;y[fa+1]=C+1;y[fa+2]=C+2;y[fa+3]=C;y[fa+4]=C+2;y[fa+5]=
|
|
|
-C+3;fa+=6;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+3;X[Ca+4]=C+1;X[Ca+5]=C+2;X[Ca+6]=C+2;X[Ca+7]=C+3;Ca+=8;C+=4}}}if(U){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ba,da)}if(Ia&&Na.length){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,sa,da)}if(Da){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ha,da)}if(Ea&&B.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,
|
|
|
-$,da)}if(xa&&aa>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Oa,da)}if(xa&&ka>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ma,da)}if(ma){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y,da);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X,da)}if(v>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,pa,da);
|
|
|
-c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ta,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,va,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,qa,da)}}F(objlist,W,q,A,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();
|
|
|
-q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__webGLVertexCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=
|
|
|
-new Float32Array(A*3);q.__webGLLineCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];
|
|
|
-h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__sortArray=[];q.__webGLParticleCount=A;t.__dirtyVertices=
|
|
|
-!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||j.sortParticles)&&b(t,c.DYNAMIC_DRAW,j,camera);F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){t=W;if(t[0]==undefined){h.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(f,n){var p,j;for(p=f.__webGLObjects.length-1;p>=0;p--){j=f.__webGLObjects[p].object;n==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=
|
|
|
-function(f,n){if(f){!n||n=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
-THREE.Snippets={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 env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, 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 refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
|
-map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
|
|
-lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
-lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
-lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
|
-color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
|
-THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
|
|
-value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
|
-THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
|
|
-value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
|
|
-THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
|
|
-THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
|
|
-THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
|
|
-THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
|
|
-THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
|
|
-THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
|
-THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.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.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
|
|
-THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};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};
|
|
|
+// ThreeDebug.js r32 - http://github.com/mrdoob/three.js
|
|
|
+var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
|
|
|
+THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,o,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-b);k=d*(1-b*o);b=d*(1-b*(1-o));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
|
|
|
+setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
|
|
|
+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
+THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
|
|
|
+THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
|
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
|
|
|
+this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
|
|
|
+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1};
|
|
|
+THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
+return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
+THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(H,r,Z,E){E=E.clone().subSelf(r);Z=Z.clone().subSelf(r);var L=H.clone().subSelf(r);H=E.dot(E);r=E.dot(Z);E=E.dot(L);var c=Z.dot(Z);Z=Z.dot(L);L=1/(H*c-r*r);c=(c*E-r*Z)*L;H=(H*Z-r*E)*L;return c>0&&H>0&&c+H<1}var d,e,g,i,l,o,k,m,s,w,
|
|
|
+u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];w=this.origin.clone();u=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());o=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());s=u.dot(m);if(s<0){m=m.dot((new THREE.Vector3).sub(i,
|
|
|
+w))/s;w=w.addSelf(u.multiplyScalar(m));if(g instanceof THREE.Face3){if(b(w,i,l,o)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,o,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}}return I}};
|
|
|
+THREE.Rectangle=function(){function a(){i=e-b;l=g-d}var b,d,e,g,i,l,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,m,s,w){o=!1;b=k;d=m;e=s;g=w;a()};this.addPoint=function(k,m){if(o){o=!1;b=k;d=m;e=k;g=m}else{b=b<k?b:k;d=d<m?d:m;e=e>k?e:k;g=g>m?g:m}a()};
|
|
|
+this.add3Points=function(k,m,s,w,u,x){if(o){o=!1;b=k<s?k<u?k:u:s<u?s:u;d=m<w?m<x?m:x:w<x?w:x;e=k>s?k>u?k:u:s>u?s:u;g=m>w?m>x?m:x:w>x?w:x}else{b=k<s?k<u?k<b?k:b:u<b?u:b:s<u?s<b?s:b:u<b?u:b;d=m<w?m<x?m<d?m:d:x<d?x:d:w<x?w<d?w:d:x<d?x:d;e=k>s?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=m>w?m>x?m>g?m:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(o){o=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();e=e>k.getRight()?
|
|
|
+e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=!0;g=e=d=b=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
|
|
|
+b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+i+", height: "+l+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
+THREE.Matrix4=function(a,b,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=s||1;this.n34=w||0;this.n41=u||0;this.n42=x||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=o;this.n31=k;this.n32=m;this.n33=s;this.n34=w;this.n41=u;this.n42=x;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(d,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
|
|
|
+this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*
|
|
|
+a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
|
|
|
+a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44,Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43,ja=b.n44;this.n11=d*Z+e*ia+g*S+i*J;this.n12=d*E+e*T+g*ba+i*la;this.n13=d*L+e*O+g*V+i*Q;this.n14=d*c+e*ca+g*D+i*ja;this.n21=l*Z+o*ia+k*S+m*J;this.n22=l*E+o*T+k*ba+m*la;
|
|
|
+this.n23=l*L+o*O+k*V+m*Q;this.n24=l*c+o*ca+k*D+m*ja;this.n31=s*Z+w*ia+u*S+x*J;this.n32=s*E+w*T+u*ba+x*la;this.n33=s*L+w*O+u*V+x*Q;this.n34=s*c+w*ca+u*D+x*ja;this.n41=F*Z+I*ia+H*S+r*J;this.n42=F*E+I*T+H*ba+r*la;this.n43=F*L+I*O+H*V+r*Q;this.n44=F*c+I*ca+H*D+r*ja;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,o=a.n21,k=a.n22,m=a.n23,s=a.n24,w=a.n31,u=a.n32,x=a.n33,F=a.n34,I=a.n41,H=a.n42,r=a.n43;a=a.n44;var Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=
|
|
|
+b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43;b=b.n44;this.n11=e*Z+g*ia+i*S+l*J;this.n12=e*E+g*T+i*ba+l*la;this.n13=e*L+g*O+i*V+l*Q;this.n14=e*c+g*ca+i*D+l*b;this.n21=o*Z+k*ia+m*S+s*J;this.n22=o*E+k*T+m*ba+s*la;this.n23=o*L+k*O+m*V+s*Q;this.n24=o*c+k*ca+m*D+s*b;this.n31=w*Z+u*ia+x*S+F*J;this.n32=w*E+u*T+x*ba+F*la;this.n33=w*L+u*O+x*V+F*Q;this.n34=w*c+u*ca+x*D+F*b;this.n41=I*Z+H*ia+r*S+a*J;this.n42=I*E+H*T+r*ba+a*la;this.n43=I*L+H*O+r*V+a*Q;this.n44=I*c+H*ca+r*D+a*b;d[0]=this.n11;
|
|
|
+d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,o=this.n23,k=this.n24,m=this.n31,s=this.n32,w=this.n33,u=this.n34,x=this.n41,F=this.n42,I=this.n43,H=this.n44,r=a.n11,Z=a.n21,E=a.n31,L=a.n41,c=a.n12,ia=a.n22,T=a.n32,O=a.n42,ca=
|
|
|
+a.n13,S=a.n23,ba=a.n33,V=a.n43,D=a.n14,J=a.n24,la=a.n34;a=a.n44;this.n11=b*r+d*Z+e*E+g*L;this.n12=b*c+d*ia+e*T+g*O;this.n13=b*ca+d*S+e*ba+g*V;this.n14=b*D+d*J+e*la+g*a;this.n21=i*r+l*Z+o*E+k*L;this.n22=i*c+l*ia+o*T+k*O;this.n23=i*ca+l*S+o*ba+k*V;this.n24=i*D+l*J+o*la+k*a;this.n31=m*r+s*Z+w*E+u*L;this.n32=m*c+s*ia+w*T+u*O;this.n33=m*ca+s*S+w*ba+u*V;this.n34=m*D+s*J+w*la+u*a;this.n41=x*r+F*Z+I*E+H*L;this.n42=x*c+F*ia+I*T+H*O;this.n43=x*ca+F*S+I*ba+H*V;this.n44=x*D+F*J+I*la+H*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,b=this.n12,d=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,o=this.n24,k=this.n31,m=this.n32,s=this.n33,w=this.n34,u=this.n41,x=this.n42,F=this.n43,I=this.n44;return e*l*m*u-d*o*m*u-e*i*s*u+b*o*s*u+d*i*w*u-b*l*w*u-e*l*k*x+d*o*k*x+e*g*s*x-a*o*s*x-d*g*w*x+a*l*w*x+
|
|
|
+e*i*k*F-b*o*k*F-e*g*m*F+a*o*m*F+b*g*w*F-a*i*w*F-d*i*k*I+b*l*k*I+d*g*m*I-a*l*m*I-b*g*s*I+a*i*s*I},transpose:function(){function a(b,d,e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=
|
|
|
+this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);
|
|
|
+return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,i=a.x,l=a.y,o=a.z,k=g*
|
|
|
+i,m=g*l;this.set(k*i+d,k*l-e*o,k*o+e*l,0,k*l+e*o,m*l+d,m*o-e*i,0,k*o-e*l,m*o+e*i,g*o*o+d,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 b=a.x,d=a.y,e=a.z;a=Math.cos(d);d=Math.sin(d);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,o=d*e;this.n11=a*g;this.n12=d*b-l*i;this.n13=l*b+d*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-d*g;this.n32=o*i+a*b;this.n33=-o*b+a*i},setRotationFromQuaternion:function(a){var b=
|
|
|
+a.x,d=a.y,e=a.z,g=a.w,i=b+b,l=d+d,o=e+e;a=b*i;var k=b*l;b*=o;var m=d*l;d*=o;e*=o;i*=g;l*=g;g*=o;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=d-i;this.n31=b-l;this.n32=d+i;this.n33=1-(a+m)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
|
|
|
+a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};
|
|
|
+THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*I-m*u*I+m*w*H-o*x*H-k*w*r+o*u*r;b.n12=i*u*I-g*x*I-i*w*H+e*x*H+g*w*r-e*u*r;b.n13=g*m*I-i*k*I+i*o*H-e*m*H-g*o*r+e*k*r;b.n14=i*k*w-g*m*w-i*o*u+e*m*u+g*o*x-e*k*x;b.n21=m*u*F-k*x*F-m*s*H+l*x*H+k*s*r-l*u*r;b.n22=g*x*F-i*u*F+i*s*H-d*x*H-g*s*r+d*u*r;b.n23=i*k*F-g*m*F-i*l*H+d*m*H+g*l*r-d*k*r;
|
|
|
+b.n24=g*m*s-i*k*s+i*l*u-d*m*u-g*l*x+d*k*x;b.n31=o*x*F-m*w*F+m*s*I-l*x*I-o*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*I+d*x*I+e*s*r-d*w*r;b.n33=g*m*F-i*o*F+i*l*I-d*m*I-e*l*r+d*o*r;b.n34=i*o*s-e*m*s-i*l*w+d*m*w+e*l*x-d*o*x;b.n41=k*w*F-o*u*F-k*s*I+l*u*I+o*s*H-l*w*H;b.n42=e*u*F-g*w*F+g*s*I-d*u*I-e*s*H+d*w*H;b.n43=g*o*F-e*k*F-g*l*I+d*k*I+e*l*H-d*o*H;b.n44=e*k*s-g*o*s+g*l*w-d*k*w-e*l*u+d*o*u;b.multiplyScalar(1/a.determinant());return b};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*i;d[3]=a*l;d[4]=a*o;d[5]=a*k;d[6]=a*m;d[7]=a*s;d[8]=a*w;return b};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,b,d,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,b,d,e,g,i){var l,o,k,m;l=new THREE.Matrix4;o=b-a;k=d-e;m=i-g;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((d+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((i+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
+THREE.Quaternion=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
|
|
|
+THREE.Quaternion.prototype.set=function(a,b,d,e){var g=this.that;g.x=a;g.y=b;g.z=d;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var l=a*b,o=e*g,k=this.that;k.w=l*i-o*d;k.x=l*d+o*i;k.y=e*b*i+a*g*d;k.z=a*g*i-e*b*d;this.isDirty=!0;return this};
|
|
|
+THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,d=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-d*d-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
|
|
|
+THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,d=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+d*d+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=d*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this};
|
|
|
+THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
|
|
|
+THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var d=this.that,e=a.x,g=a.y,i=a.z,l=d.x,o=d.y,k=d.z;d=d.w;var m=d*e+o*i-k*g,s=d*g+k*e-l*i,w=d*i+l*g-o*e;e=-l*e-o*g-k*i;b.x=m*d+e*-l+s*-k-w*-o;b.y=s*d+e*-o+w*-l-m*-k;b.z=w*d+e*-k+m*-o-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
|
|
|
+THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
|
|
|
+THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
+THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
+THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|
|
|
+THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
|
|
|
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,i,l,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){i=this.vertices[e];i.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];if(a&&i.vertexNormals.length){o.set(0,0,0);b=0;for(d=i.normal.length;b<d;b++)o.addSelf(i.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[i.a];d=this.vertices[i.b];l=this.vertices[i.c];o.sub(l.position,
|
|
|
+d.position);k.sub(b.position,d.position);o.crossSelf(k)}o.isZero()||o.normalize();i.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
|
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(D,J,la,Q,ja,ea,R){i=D.vertices[J].position;l=D.vertices[la].position;o=D.vertices[Q].position;k=g[ja];m=g[ea];s=g[R];w=l.x-i.x;u=o.x-i.x;x=l.y-i.y;F=o.y-
|
|
|
+i.y;I=l.z-i.z;H=o.z-i.z;r=m.u-k.u;Z=s.u-k.u;E=m.v-k.v;L=s.v-k.v;c=1/(r*L-Z*E);O.set((L*w-E*u)*c,(L*x-E*F)*c,(L*I-E*H)*c);ca.set((r*u-Z*w)*c,(r*F-Z*x)*c,(r*H-Z*I)*c);ia[J].addSelf(O);ia[la].addSelf(O);ia[Q].addSelf(O);T[J].addSelf(ca);T[la].addSelf(ca);T[Q].addSelf(ca)}var b,d,e,g,i,l,o,k,m,s,w,u,x,F,I,H,r,Z,E,L,c,ia=[],T=[],O=new THREE.Vector3,ca=new THREE.Vector3,S=new THREE.Vector3,ba=new THREE.Vector3,V=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){ia[b]=new THREE.Vector3;T[b]=new THREE.Vector3}b=
|
|
|
+0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
|
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){V.copy(this.vertices[b].normal);e=ia[b];S.copy(e);S.subSelf(V.multiplyScalar(V.dot(e))).normalize();ba.cross(this.vertices[b].normal,e);e=ba.dot(T[b]);e=e<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
+z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(d=s.length;b<d;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,d,e,g,i,l,o,k,m={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
|
|
|
+l=i.materials;o=a(l);m[o]==undefined&&(m[o]={hash:o,counter:0});k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
|
|
|
+new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,d)}};
|
|
|
+THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
|
|
|
+THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
+THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Mesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)}};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,b,d){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.globalMatrix,!0,d)}}else for(e=
|
|
|
+0;e<g;e++)this.children[e].update(this.skinMatrix,b,d)};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,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,i,l,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];i=g.pos;l=g.rotq;o=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];e=this.bones[d];
|
|
|
+g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}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,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.globalMatrix,b,d)}}};
|
|
|
+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,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
|
|
|
+e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
|
|
|
+THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
|
+THREE.AnimationHandler=function(){var a=[],b={};b.update=function(d){for(var e=0;e<a.length;e++)a[e].update(d)};b.add=function(d){a.indexOf(d)===-1&&a.push(d)};b.remove=function(d){a.indexOf(d)!==-1&&a.splice(childIndex,1)};b.initData=function(d){if(d.initialized!==!0){for(var e=0;e<d.hierarchy.length;e++)for(var g=0;g<d.hierarchy[e].keys.length;g++){if(d.hierarchy[e].keys[g].time<0)d.hierarchy[e].keys[g].time=0;d.hierarchy[e].keys[g].index=g;if(d.hierarchy[e].keys[g].rot!==undefined&&!(d.hierarchy[e].keys[g].rot instanceof
|
|
|
+THREE.Quaternion)){var i=d.hierarchy[e].keys[g].rot;d.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(d.length*d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(e=0;e<d.hierarchy.length;e++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};return b}();
|
|
|
+THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var d=0;d<this.root.bones.length;d++)this.hierarchy.push(this.root.bones[d])};
|
|
|
+THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.001;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
|
+this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
|
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,d,e,g,i,l,o=this.data.JIT.hierarchy,k=(new Date).getTime()*0.001-this.startTime+this.offset,m=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.001-k;k=(new Date).getTime()*0.001-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(o[s][l]!==undefined){i.skinMatrix=
|
|
|
+o[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var u=0;u<3;u++){d=a[u];e=i.prevKey[d];g=i.nextKey[d];if(g.time<m){if(k<m)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(d,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(d,s,g.index+1)}while(g.time<k)}i.prevKey[d]=e;i.nextKey[d]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[d];g=g[d];if(d==="rot"){if(b<
|
|
|
+0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)o[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
+THREE.Animation.prototype.getNextKeyWith=function(a,b,d){for(var e=this.data.hierarchy[b].keys;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
|
|
|
+THREE.Camera=function(a,b,d,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=d||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
|
|
|
+this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
|
|
|
+THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
+this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)};
|
|
|
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,d=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*d+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var o=this.projectionMatrix,k=1/(o.n43*l),m=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*o.n11*m;i=o.n11*i*m;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*o.n22*k*this.screenCenterY;
|
|
|
+if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};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;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
|
+THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
|
|
+THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
|
|
|
+THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;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;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
|
+a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
+THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!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.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
+undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
|
|
|
+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!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.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
+undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
|
|
|
+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/> )"}};
|
|
|
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
+this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
|
|
+if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
|
|
+if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
|
|
|
+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};
|
|
|
+THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
|
+a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
|
+undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+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.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!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.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
|
|
+undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
+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.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
|
|
|
+THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
|
|
|
+THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
|
+var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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 a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};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 b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};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,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
+THREE.Projector=function(){function a(T,O){return O.z-T.z}function b(T,O){var ca=0,S=1,ba=T.z+T.w,V=O.z+O.w,D=-T.z+T.w,J=-O.z+O.w;if(ba>=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(S<ca)return!1;else{T.lerpSelf(O,ca);O.lerpSelf(T,1-S);return!0}}}var d,e,g=[],i,l,o,k=[],m,s,w=[],u,x,F=[],I=new THREE.Vector4,H=new THREE.Vector4,r=new THREE.Matrix4,
|
|
|
+Z=new THREE.Matrix4,E=[],L=new THREE.Vector4,c=new THREE.Vector4,ia;this.projectObjects=function(T,O,ca){O=[];var S,ba,V;e=0;ba=T.objects;T=0;for(S=ba.length;T<S;T++){V=ba[T];var D;if(!(D=!V.visible))if(D=V instanceof THREE.Mesh){a:{D=void 0;for(var J=V.globalMatrix,la=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),Q=0;Q<6;Q++){D=E[Q].x*J.n14+E[Q].y*J.n24+E[Q].z*J.n34+E[Q].w;if(D<=la){D=!1;break a}}D=!0}D=!D}if(!D){d=g[e]=g[e]||new THREE.RenderableObject;I.copy(V.position);
|
|
|
+r.multiplyVector3(I);d.object=V;d.z=I.z;O.push(d);e++}}ca&&O.sort(a);return O};this.projectScene=function(T,O,ca){var S=[],ba=O.zNear,V=O.zFar,D,J,la,Q,ja,ea,R,ra,wa,f,n,p,j,h,q,t;o=s=x=0;O.autoUpdateMatrix&&O.update();r.multiply(O.projectionMatrix,O.globalMatrix);E[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);E[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);E[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);E[3]=new THREE.Vector4(r.n41-
|
|
|
+r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);E[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);E[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);D=0;for(ea=E.length;D<ea;D++){R=E[D];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}T.update(undefined,!1,O);ea=this.projectObjects(T,O,!0);T=0;for(D=ea.length;T<D;T++){R=ea[T].object;if(R.visible){R.autoUpdateMatrix&&R.updateMatrix();ra=R.globalMatrix;ra.extractRotationMatrix(R.rotationMatrix);n=R.rotationMatrix;
|
|
|
+wa=R.materials;f=R.overdraw;if(R instanceof THREE.Mesh){p=R.geometry;j=p.vertices;J=0;for(la=j.length;J<la;J++){h=j[J];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);Q=h.positionScreen;Q.copy(h.positionWorld);r.multiplyVector4(Q);Q.x/=Q.w;Q.y/=Q.w;h.__visible=Q.z>ba&&Q.z<V}p=p.faces;J=0;for(la=p.length;J<la;J++){h=p[J];if(h instanceof THREE.Face3){Q=j[h.a];ja=j[h.b];q=j[h.c];if(Q.__visible&&ja.__visible&&q.__visible&&(R.doubleSided||R.flipSided!=(q.positionScreen.x-Q.positionScreen.x)*
|
|
|
+(ja.positionScreen.y-Q.positionScreen.y)-(q.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0)){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
|
|
|
+ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ia=i.vertexNormalsWorld;Q=0;for(ja=q.length;Q<ja;Q++){t=ia[Q]=ia[Q]||new THREE.Vector3;t.copy(q[Q]);n.multiplyVector3(t)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][2]}S.push(i);o++}}else if(h instanceof THREE.Face4){Q=j[h.a];
|
|
|
+ja=j[h.b];q=j[h.c];t=j[h.d];if(Q.__visible&&ja.__visible&&q.__visible&&t.__visible&&(R.doubleSided||R.flipSided!=((t.positionScreen.x-Q.positionScreen.x)*(ja.positionScreen.y-Q.positionScreen.y)-(t.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0||(ja.positionScreen.x-q.positionScreen.x)*(t.positionScreen.y-q.positionScreen.y)-(ja.positionScreen.y-q.positionScreen.y)*(t.positionScreen.x-q.positionScreen.x)<0))){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);
|
|
|
+i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(t.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(t.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;
|
|
|
+if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][3]}S.push(i);o++;l=k[o]=k[o]||new THREE.RenderableFace3;l.v1.positionWorld.copy(ja.positionWorld);l.v2.positionWorld.copy(q.positionWorld);l.v3.positionWorld.copy(t.positionWorld);l.v1.positionScreen.copy(ja.positionScreen);l.v2.positionScreen.copy(q.positionScreen);l.v3.positionScreen.copy(t.positionScreen);l.normalWorld.copy(i.normalWorld);l.centroidWorld.copy(i.centroidWorld);l.centroidScreen.copy(i.centroidScreen);
|
|
|
+l.z=l.centroidScreen.z;l.meshMaterials=wa;l.faceMaterials=h.materials;l.overdraw=f;if(R.geometry.uvs[J]){l.uvs[0]=R.geometry.uvs[J][1];l.uvs[1]=R.geometry.uvs[J][2];l.uvs[2]=R.geometry.uvs[J][3]}S.push(l);o++}}}}else if(R instanceof THREE.Line){Z.multiply(r,ra);j=R.geometry.vertices;h=j[0];h.positionScreen.copy(h.position);Z.multiplyVector4(h.positionScreen);J=1;for(la=j.length;J<la;J++){Q=j[J];Q.positionScreen.copy(Q.position);Z.multiplyVector4(Q.positionScreen);ja=j[J-1];L.copy(Q.positionScreen);
|
|
|
+c.copy(ja.positionScreen);if(b(L,c)){L.multiplyScalar(1/L.w);c.multiplyScalar(1/c.w);m=w[s]=w[s]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(c);m.z=Math.max(L.z,c.z);m.materials=R.materials;S.push(m);s++}}}else if(R instanceof THREE.Particle){H.set(R.position.x,R.position.y,R.position.z,1);r.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){u=F[x]=F[x]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x-
|
|
|
+(H.x+O.projectionMatrix.n11)/(H.w+O.projectionMatrix.n14));u.scale.y=R.scale.y*Math.abs(u.y-(H.y+O.projectionMatrix.n22)/(H.w+O.projectionMatrix.n24));u.materials=R.materials;S.push(u);x++}}}}ca&&S.sort(a);return S};this.unprojectVector=function(T,O){var ca=THREE.Matrix4.makeInvert(O.globalMatrix);ca.multiplySelf(THREE.Matrix4.makeInvert(O.projectionMatrix));ca.multiplyVector3(T);return T}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,o){d=l;e=o;g=d/2;i=e/2};this.render=function(l,o){var k,m,s,w,u,x,F,I;a=b.projectScene(l,o);k=0;for(m=a.length;k<m;k++){u=a[k];if(u instanceof THREE.RenderableParticle){F=u.x*g+g;I=u.y*i+i;s=0;for(w=u.material.length;s<w;s++){x=u.material[s];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=F+"px";x.style.top=I+"px"}}}}}};
|
|
|
+THREE.CanvasRenderer=function(){function a(na){if(u!=na)m.globalAlpha=u=na}function b(na){if(x!=na){switch(na){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}x=na}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),i,l,o,k,m=g.getContext("2d"),s=new THREE.Color(0),w=0,u=1,x=0,F=null,I=null,H=1,r,Z,E,L,c,ia,T,O,ca,S=new THREE.Color,
|
|
|
+ba=new THREE.Color,V=new THREE.Color,D=new THREE.Color,J=new THREE.Color,la,Q,ja,ea,R,ra,wa,f,n,p=new THREE.Rectangle,j=new THREE.Rectangle,h=new THREE.Rectangle,q=!1,t=new THREE.Color,A=new THREE.Color,W=new THREE.Color,G=new THREE.Color,M=Math.PI*2,C=new THREE.Vector3,aa,da,ua,ka,fa,ga,ha=16;aa=document.createElement("canvas");aa.width=aa.height=2;da=aa.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);ua=da.getImageData(0,0,2,2);ka=ua.data;fa=document.createElement("canvas");fa.width=
|
|
|
+fa.height=ha;ga=fa.getContext("2d");ga.translate(-ha/2,-ha/2);ga.scale(ha,ha);ha--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(na,z){i=na;l=z;o=i/2;k=l/2;g.width=i;g.height=l;p.set(-o,-k,o,k);u=1;x=0;I=F=null;H=1};this.setClearColor=function(na,z){s=na;w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.setClearColorHex=function(na,z){s.setHex(na);w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
+0,0,-1,o,k);if(!j.isEmpty()){j.inflate(1);j.minSelf(p);if(s.hex==0&&w==0)m.clearRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+w+")";m.fillRect(j.getX(),j.getY(),j.getWidth(),j.getHeight())}j.empty()}};this.render=function(na,z){function Fa(y){var X,Y,B,U=y.lights;A.setRGB(0,0,0);W.setRGB(0,0,0);G.setRGB(0,0,0);y=0;for(X=U.length;y<X;y++){Y=U[y];B=Y.color;if(Y instanceof
|
|
|
+THREE.AmbientLight){A.r+=B.r;A.g+=B.g;A.b+=B.b}else if(Y instanceof THREE.DirectionalLight){W.r+=B.r;W.g+=B.g;W.b+=B.b}else if(Y instanceof THREE.PointLight){G.r+=B.r;G.g+=B.g;G.b+=B.b}}}function za(y,X,Y,B){var U,ma,xa,Da,Ea=y.lights;y=0;for(U=Ea.length;y<U;y++){ma=Ea[y];xa=ma.color;Da=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=Y.dot(ma.position)*Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){C.sub(ma.position,X);C.normalize();ma=Y.dot(C)*
|
|
|
+Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}}}function Ga(y,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var B,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*o;ma=X.scale.y*k;Y=U*Da;B=ma*Ea;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(!p.instersects(h))return;m.save();m.translate(y.x,y.y);m.rotate(-X.rotation);m.scale(U,-ma);m.translate(-Da,-Ea);m.drawImage(xa,0,0);m.restore()}m.beginPath();m.moveTo(y.x-
|
|
|
+10,y.y);m.lineTo(y.x+10,y.y);m.moveTo(y.x,y.y-10);m.lineTo(y.x,y.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){t.r=A.r+W.r+G.r;t.g=A.g+W.g+G.g;t.b=A.b+W.b+G.b;S.r=Y.color.r*t.r;S.g=Y.color.g*t.g;S.b=Y.color.b*t.b;S.updateStyleString()}else S.__styleString=Y.color.__styleString;Y=X.scale.x*o;B=X.scale.y*k;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(p.instersects(h)){U=S.__styleString;if(I!=U)m.fillStyle=I=U;m.save();m.translate(y.x,y.y);
|
|
|
+m.rotate(-X.rotation);m.scale(Y,B);m.beginPath();m.arc(0,0,1,0,M,!0);m.closePath();m.fill();m.restore()}}}}function P(y,X,Y,B){if(B.opacity!=0){a(B.opacity);b(B.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(B instanceof THREE.LineBasicMaterial){S.__styleString=B.color.__styleString;y=B.linewidth;if(H!=y)m.lineWidth=H=y;y=S.__styleString;if(F!=y)m.strokeStyle=F=y;m.stroke();h.inflate(B.linewidth*2)}}}function N(y,
|
|
|
+X,Y,B,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);L=y.positionScreen.x;c=y.positionScreen.y;ia=X.positionScreen.x;T=X.positionScreen.y;O=Y.positionScreen.x;ca=Y.positionScreen.y;m.beginPath();m.moveTo(L,c);m.lineTo(ia,T);m.lineTo(O,ca);m.lineTo(L,c);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&
|
|
|
+U.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=z.globalMatrix;C.copy(B.vertexNormalsWorld[0]);ea=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;R=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[1]);ra=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;wa=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[2]);f=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;n=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;Ca(L,c,ia,T,O,ca,U.env_map.image,ea,R,ra,wa,f,n)}}else U.wireframe?
|
|
|
+K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){ba.r=V.r=D.r=A.r;ba.g=V.g=D.g=A.g;ba.b=V.b=D.b=A.b;za(ma,B.v1.positionWorld,B.vertexNormalsWorld[0],ba);
|
|
|
+za(ma,B.v2.positionWorld,B.vertexNormalsWorld[1],V);za(ma,B.v3.positionWorld,B.vertexNormalsWorld[2],D);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else{t.r=A.r;t.g=A.g;t.b=A.b;za(ma,B.centroidWorld,B.normalWorld,t);S.r=U.color.r*t.r;S.g=U.color.g*t.g;S.b=U.color.b*t.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof
|
|
|
+THREE.MeshDepthMaterial){la=z.near;Q=z.far;ba.r=ba.g=ba.b=1-v(y.positionScreen.z,la,Q);V.r=V.g=V.b=1-v(X.positionScreen.z,la,Q);D.r=D.g=D.b=1-v(Y.positionScreen.z,la,Q);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Ba(B.normalWorld.x);S.g=Ba(B.normalWorld.y);S.b=Ba(B.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}}}function K(y,
|
|
|
+X){if(F!=y)m.strokeStyle=F=y;if(H!=X)m.lineWidth=H=X;m.stroke();h.inflate(X*2)}function oa(y){if(I!=y)m.fillStyle=I=y;m.fill()}function Ca(y,X,Y,B,U,ma,xa,Da,Ea,Ia,ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=y;B-=X;U-=y;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*B-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;B=(Ia*ma-Ja*B)*La;y=y-Ka*Da-Y*Ea;X=X-ya*Da-B*Ea;m.save();m.transform(Ka,ya,Y,B,y,X);m.clip();m.drawImage(xa,0,
|
|
|
+0);m.restore()}}function Aa(y,X,Y,B){var U=~~(y.r*255),ma=~~(y.g*255);y=~~(y.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(B.r*255),Ja=~~(B.g*255);B=~~(B.b*255);ka[0]=U<0?0:U>255?255:U;ka[1]=ma<0?0:ma>255?255:ma;ka[2]=y<0?0:y>255?255:y;ka[4]=xa<0?0:xa>255?255:xa;ka[5]=Da<0?0:Da>255?255:Da;ka[6]=X<0?0:X>255?255:X;ka[8]=Ea<0?0:Ea>255?255:Ea;ka[9]=Ia<0?0:Ia>255?255:Ia;ka[10]=Y<0?0:Y>255?255:Y;ka[12]=ya<0?0:ya>255?255:ya;ka[13]=Ja<0?0:
|
|
|
+Ja>255?255:Ja;ka[14]=B<0?0:B>255?255:B;da.putImageData(ua,0,0);ga.drawImage(aa,0,0);return fa}function v(y,X,Y){y=(y-X)/(Y-X);return y*y*(3-2*y)}function Ba(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Oa(y,X){var Y=X.x-y.x,B=X.y-y.y,U=1/Math.sqrt(Y*Y+B*B);Y*=U;B*=U;X.x+=Y;X.y+=B;y.x-=Y;y.y-=B}var Ma,Ha,$,sa,pa,ta,va,qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);d=e.projectScene(na,z,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(p.getX(),p.getY(),p.getWidth(),
|
|
|
+p.getHeight());(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=d.length;Ma<Ha;Ma++){$=d[Ma];h.empty();if($ instanceof THREE.RenderableParticle){r=$;r.x*=o;r.y*=k;sa=0;for(pa=$.materials.length;sa<pa;sa++)Ga(r,$,$.materials[sa],na)}else if($ instanceof THREE.RenderableLine){r=$.v1;Z=$.v2;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;h.addPoint(r.positionScreen.x,r.positionScreen.y);h.addPoint(Z.positionScreen.x,Z.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=
|
|
|
+$.materials.length;sa<pa;)P(r,Z,$,$.materials[sa++],na)}}else if($ instanceof THREE.RenderableFace3){r=$.v1;Z=$.v2;E=$.v3;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;E.positionScreen.x*=o;E.positionScreen.y*=k;if($.overdraw){Oa(r.positionScreen,Z.positionScreen);Oa(Z.positionScreen,E.positionScreen);Oa(E.positionScreen,r.positionScreen)}h.add3Points(r.positionScreen.x,r.positionScreen.y,Z.positionScreen.x,Z.positionScreen.y,E.positionScreen.x,E.positionScreen.y);
|
|
|
+if(p.instersects(h)){sa=0;for(pa=$.meshMaterials.length;sa<pa;){qa=$.meshMaterials[sa++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(va=$.faceMaterials.length;ta<va;)(qa=$.faceMaterials[ta++])&&N(r,Z,E,$,qa,na)}else N(r,Z,E,$,qa,na)}}}j.addRectangle(h)}m.lineWidth=1;m.strokeStyle="rgba( 255, 0, 0, 0.5 )";m.strokeRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());m.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(ea,R,ra){var wa,f,n,p;wa=0;for(f=ea.lights.length;wa<f;wa++){n=ea.lights[wa];if(n instanceof THREE.DirectionalLight){p=R.normalWorld.dot(n.position)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}else if(n instanceof THREE.PointLight){ca.sub(n.position,R.centroidWorld);ca.normalize();p=R.normalWorld.dot(ca)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}}}function b(ea,R,ra,wa,f,n){D=e(J++);D.setAttribute("d",
|
|
|
+"M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(n,wa,L);E.r=f.color.r*L.r;E.g=f.color.g*L.g;E.b=f.color.b*L.b;E.updateStyleString()}else E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){O=1-f.__2near/(f.__farPlusNear-
|
|
|
+wa.z*f.__farMinusNear);E.setRGB(O,O,O)}else f instanceof THREE.MeshNormalMaterial&&E.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+f.opacity);o.appendChild(D)}function d(ea,R,ra,wa,
|
|
|
+f,n,p){D=e(J++);D.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)E.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(p,f,L);E.r=n.color.r*L.r;E.g=n.color.g*L.g;E.b=n.color.b*L.b;E.updateStyleString()}else E.__styleString=n.color.__styleString;
|
|
|
+else if(n instanceof THREE.MeshDepthMaterial){O=1-n.__2near/(n.__farPlusNear-f.z*n.__farMinusNear);E.setRGB(O,O,O)}else n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));n.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+
|
|
|
+"; fill-opacity: "+n.opacity);o.appendChild(D)}function e(ea){if(S[ea]==null){S[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ea].setAttribute("shape-rendering","crispEdges")}return S[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var i=null,l=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,s,w,u,x,F,I,H=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,E=new THREE.Color(16777215),L=new THREE.Color(16777215),
|
|
|
+c=new THREE.Color(0),ia=new THREE.Color(0),T=new THREE.Color(0),O,ca=new THREE.Vector3,S=[],ba=[],V=[],D,J,la,Q,ja=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ea){switch(ea){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ea,R){k=ea;m=R;s=k/2;w=m/2;o.setAttribute("viewBox",-s+" "+-w+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);H.set(-s,-w,s,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};
|
|
|
+this.render=function(ea,R){var ra,wa,f,n,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ea,R,this.sortElements);Q=la=J=0;if(Z=ea.lights.length>0){h=ea.lights;c.setRGB(0,0,0);ia.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra<wa;ra++){f=h[ra];n=f.color;if(f instanceof THREE.AmbientLight){c.r+=n.r;c.g+=n.g;c.b+=n.b}else if(f instanceof THREE.DirectionalLight){ia.r+=n.r;ia.g+=n.g;ia.b+=n.b}else if(f instanceof THREE.PointLight){T.r+=n.r;T.g+=n.g;T.b+=n.b}}}ra=0;for(wa=i.length;ra<wa;ra++){h=
|
|
|
+i[ra];r.empty();if(h instanceof THREE.RenderableParticle){u=h;u.x*=s;u.y*=-w;f=0;for(n=h.materials.length;f<n;f++)if(q=h.materials[f]){p=u;j=h;var t=la++;if(ba[t]==null){ba[t]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&ba[t].setAttribute("shape-rendering","crispEdges")}D=ba[t];D.setAttribute("cx",p.x);D.setAttribute("cy",p.y);D.setAttribute("r",j.scale.x*s);if(q instanceof THREE.ParticleCircleMaterial){if(Z){L.r=c.r+ia.r+T.r;L.g=c.g+ia.g+T.g;L.b=c.b+ia.b+T.b;E.r=q.color.r*
|
|
|
+L.r;E.g=q.color.g*L.g;E.b=q.color.b*L.b;E.updateStyleString()}else E=q.color;D.setAttribute("style","fill: "+E.__styleString)}o.appendChild(D)}}else if(h instanceof THREE.RenderableLine){u=h.v1;x=h.v2;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.materials.length;f<n;)if(q=h.materials[f++]){p=u;j=x;t=Q++;if(V[t]==null){V[t]=
|
|
|
+document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&V[t].setAttribute("shape-rendering","crispEdges")}D=V[t];D.setAttribute("x1",p.positionScreen.x);D.setAttribute("y1",p.positionScreen.y);D.setAttribute("x2",j.positionScreen.x);D.setAttribute("y2",j.positionScreen.y);if(q instanceof THREE.LineBasicMaterial){E.__styleString=q.color.__styleString;D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+
|
|
|
+q.linecap+"; stroke-linejoin: "+q.linejoin);o.appendChild(D)}}}}else if(h instanceof THREE.RenderableFace3){u=h.v1;x=h.v2;F=h.v3;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof
|
|
|
+THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&b(u,x,F,h,q,ea)}else q&&b(u,x,F,h,q,ea)}}}else if(h instanceof THREE.RenderableFace4){u=h.v1;x=h.v2;F=h.v3;I=h.v4;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;I.positionScreen.x*=s;I.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,
|
|
|
+F.positionScreen.y);r.addPoint(I.positionScreen.x,I.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&d(u,x,F,I,h,q,ea)}else q&&d(u,x,F,I,h,q,ea)}}}}}};
|
|
|
+THREE.WebGLRenderer=function(a){function b(f,n,p){var j,h,q,t=f.vertices,A=t.length,W=f.colors,G=W.length,M=f.__vertexArray,C=f.__colorArray,aa=f.__sortArray,da=f.__dirtyVertices,ua=f.__dirtyColors;if(p.sortParticles){J.multiplySelf(p.globalMatrix);for(j=0;j<A;j++){h=t[j].position;ea.copy(h);J.multiplyVector3(ea);aa[j]=[ea.z,j]}aa.sort(function(ka,fa){return fa[0]-ka[0]});for(j=0;j<A;j++){h=t[aa[j][1]].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}for(j=0;j<G;j++){q=j*3;color=W[aa[j][1]];C[q]=color.r;
|
|
|
+C[q+1]=color.g;C[q+2]=color.b}}else{if(da)for(j=0;j<A;j++){h=t[j].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}if(ua)for(j=0;j<G;j++){color=W[j];q=j*3;C[q]=color.r;C[q+1]=color.g;C[q+2]=color.b}}if(da||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,M,n)}if(ua||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,C,n)}}function d(f,n){f.fragment_shader=n.fragment_shader;f.vertex_shader=n.vertex_shader;f.uniforms=
|
|
|
+Uniforms.clone(n.uniforms)}function e(f,n,p,j,h){j.program||O.initMaterial(j,n,p);var q=j.program,t=q.uniforms,A=j.uniforms;if(q!=ia){c.useProgram(q);ia=q;c.uniformMatrix4fv(t.projectionMatrix,!1,la)}if(p&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){A.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){A.fogNear.value=p.near;A.fogFar.value=
|
|
|
+p.far}else if(p instanceof THREE.FogExp2)A.fogDensity.value=p.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){var W,G,M=0,C=0,aa=0,da,ua,ka,fa=O.lights,ga=fa.directional.colors,ha=fa.directional.positions,na=fa.point.colors,z=fa.point.positions,Fa=0,za=0;p=G=G=0;for(W=n.length;p<W;p++){G=n[p];da=G.color;ua=G.position;ka=G.intensity;if(G instanceof THREE.AmbientLight){M+=da.r;C+=da.g;aa+=da.b}else if(G instanceof THREE.DirectionalLight){G=Fa*3;ga[G]=da.r*ka;
|
|
|
+ga[G+1]=da.g*ka;ga[G+2]=da.b*ka;ha[G]=ua.x;ha[G+1]=ua.y;ha[G+2]=ua.z;Fa+=1}else if(G instanceof THREE.PointLight){G=za*3;na[G]=da.r*ka;na[G+1]=da.g*ka;na[G+2]=da.b*ka;z[G]=ua.x;z[G+1]=ua.y;z[G+2]=ua.z;za+=1}}for(p=Fa*3;p<ga.length;p++)ga[p]=0;for(p=za*3;p<na.length;p++)na[p]=0;fa.point.length=za;fa.directional.length=Fa;fa.ambient[0]=M;fa.ambient[1]=C;fa.ambient[2]=aa;n=O.lights;A.enableLighting.value=n.directional.length+n.point.length;A.ambientLightColor.value=n.ambient;A.directionalLightColor.value=
|
|
|
+n.directional.colors;A.directionalLightDirection.value=n.directional.positions;A.pointLightColor.value=n.point.colors;A.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.map.texture=j.map;A.light_map.texture=j.light_map;A.env_map.texture=j.env_map;A.reflectivity.value=j.reflectivity;
|
|
|
+A.refraction_ratio.value=j.refraction_ratio;A.combine.value=j.combine;A.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){A.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.size.value=j.size;A.map.texture=
|
|
|
+j.map}else if(j instanceof THREE.MeshPhongMaterial){A.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);A.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);A.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){A.mNear.value=f.zNear;A.mFar.value=f.zFar;A.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)A.opacity.value=j.opacity;for(var Ga in A)if(M=q.uniforms[Ga]){p=A[Ga];W=p.type;n=p.value;if(W=="i")c.uniform1i(M,n);else if(W=="f")c.uniform1f(M,
|
|
|
+n);else if(W=="fv1")c.uniform1fv(M,n);else if(W=="fv")c.uniform3fv(M,n);else if(W=="v2")c.uniform2f(M,n.x,n.y);else if(W=="v3")c.uniform3f(M,n.x,n.y,n.z);else if(W=="c")c.uniform3f(M,n.r,n.g,n.b);else if(W=="t"){c.uniform1i(M,n);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(!p.image.__webGLTextureCube&&!p.image.__cubeMapInitialized&&p.image.loadCount==6){p.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);
|
|
|
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image[W]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);p.image.__cubeMapInitialized=!0}c.activeTexture(c.TEXTURE0+
|
|
|
+n);c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(!p.__webGLTexture&&p.image.loaded){p.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(p.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(p.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(p.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(p.min_filter));
|
|
|
+c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_2D,p.__webGLTexture)}}}c.uniformMatrix4fv(t.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(t.normalMatrix,!1,h._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&c.uniform3f(t.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&c.uniformMatrix4fv(t.objectMatrix,
|
|
|
+!1,h._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(t.viewMatrix,!1,ja);if(j.skinning){c.uniformMatrix4fv(t.cameraInverseMatrix,!1,Q);c.uniformMatrix4fv(t.uBoneGlobalMatrices,!1,h.boneMatrices)}return q}function g(f,n,p,j,h,q){f=e(f,n,p,j,q).attributes;c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+h.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=
|
|
|
+0)if(h.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+h.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.drawElements(c.LINES,h.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,h.__webGLFaceCount,c.UNSIGNED_SHORT,
|
|
|
+0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(q,0,h.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,h.__webGLParticleCount);else q instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,h.__webGLVertexCount)}function i(f,n){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.position);c.vertexAttribPointer(n.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.normal);c.vertexAttribPointer(n.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(ca!=f.doubleSided){f.doubleSided?
|
|
|
+c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(S!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);S=f.flipSided}}function o(f){if(V!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);V=f}}function k(f){D[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);D[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);D[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);D[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);D[4].set(f.n41-f.n31,f.n42-f.n32,
|
|
|
+f.n43-f.n33,f.n44-f.n34);D[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var n;for(f=0;f<5;f++){n=D[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function m(f){for(var n=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=D[j].x*n.n14+D[j].y*n.n24+D[j].z*n.n34+D[j].w;if(f<=p)return!1}return!0}function s(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=
|
|
|
+0;for(n=j.materials.length;f<n;f++){p=j.materials[f];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?s(q,p):s(h,p)}}function u(f){var n,p,j,h,q=f.object,t=f.buffer,A=f.opaque,W=f.transparent;W.count=0;f=A.count=0;for(j=q.materials.length;f<j;f++){n=q.materials[f];if(n instanceof THREE.MeshFaceMaterial){n=0;for(p=t.materials.length;n<p;n++)(h=t.materials[n])&&(h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(A,h))}else{h=n;h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?
|
|
|
+s(W,h):s(A,h)}}}function x(f,n){return n.z-f.z}function F(f,n,p,j,h){if(n[p]==undefined){f.push({buffer:j,object:h,opaque:{list:[],count:0},transparent:{list:[],count:0}});n[p]=1}}function I(f,n){f._modelViewMatrix.multiplyToArray(n.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){if(f!=ba){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
|
|
|
+c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ba=f}}function r(f,n){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);
|
|
|
+c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(f.min_filter));c.texImage2D(c.TEXTURE_2D,0,E(f.format),f.width,f.height,0,E(f.format),E(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,
|
|
|
+f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var p,j,h;if(f){p=f.__webGLFramebuffer;j=f.width;h=f.height}else{p=null;j=L.width;h=L.height}if(p!=T){c.bindFramebuffer(c.FRAMEBUFFER,p);c.viewport(0,0,j,h);n&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);T=p}}function Z(f,n){var p;if(f=="fragment")p=c.createShader(c.FRAGMENT_SHADER);
|
|
|
+else f=="vertex"&&(p=c.createShader(c.VERTEX_SHADER));c.shaderSource(p,n);c.compileShader(p);if(!c.getShaderParameter(p,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(p));return null}return p}function E(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
|
|
|
+case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
|
|
|
+case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var L=document.createElement("canvas"),c,ia=null,T=null,O=this,ca=null,S=null,ba=null,V=null,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,la=new Float32Array(16),Q=new Float32Array(16),ja=new Float32Array(16),ea=new THREE.Vector4,R=
|
|
|
+!0,ra=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=L;this.autoClear=!0;this.sortObjects=!1;(function(f,n,p){try{c=L.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);
|
|
|
+c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(n.r,n.g,n.b,p);_cullEnabled=!0})(R,ra,wa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,n){L.width=f;L.height=n;c.viewport(0,0,L.width,L.height)};this.setClearColorHex=function(f,n){var p=new THREE.Color(f);c.clearColor(p.r,p.g,p.b,n)};this.setClearColor=function(f,n){c.clearColor(f.r,f.g,f.b,n)};
|
|
|
+this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,n,p){var j,h;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,
|
|
|
+THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var q,t,A,W;h=A=W=0;for(q=n.length;h<q;h++){t=n[h];t instanceof THREE.DirectionalLight&&A++;t instanceof THREE.PointLight&&W++}if(W+A<=4)n=A;else{n=Math.ceil(4*A/(W+A));W=4-n}h={directional:n,point:W};W=f.fragment_shader;n=f.vertex_shader;q={fog:p,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:h.directional,maxPointLights:h.point};
|
|
|
+p=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
|
|
|
+"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+n));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(n=p.length;W<
|
|
|
+n;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(n=p.length;W<n;W++){h=p[W];j.attributes[h]=c.getAttribLocation(j,h)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
|
|
|
+0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,n,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;n.autoUpdateMatrix&&n.update();n.globalMatrix.flattenToArray(ja);n.projectionMatrix.flattenToArray(la);n.inverseMatrix.flattenToArray(Q);J.multiply(n.projectionMatrix,n.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
+f.update(undefined,!1,n);this.initWebGLObjects(f,n);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];M=h.object;if(M.visible)if(!(M instanceof THREE.Mesh)||m(M)){M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,n);u(h);h.render=!0;if(this.sortObjects){ea.copy(M.position);J.multiplyVector3(ea);h.z=ea.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);G=f.__webGLObjectsImmediate.length;for(j=0;j<
|
|
|
+G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){M.autoUpdateMatrix&&M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,n);w(h)}}H(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];o(A.depth_test);g(n,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];o(A.depth_test);q=e(n,aa,da,A,M);M.render(function(ua){i(ua,
|
|
|
+q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);o(A.depth_test);g(n,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);o(A.depth_test);q=e(n,aa,da,A,M);M.render(function(ua){i(ua,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);
|
|
|
+c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var n,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}n=0;for(p=f.objects.length;n<p;n++){j=f.objects[n];var h=f,q=void 0,t=void 0,A=void 0,W=void 0;t=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
|
|
|
+j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in t.geometryChunks){A=t.geometryChunks[q];if(!A.__webGLVertexBuffer){h=A;h.__webGLVertexBuffer=c.createBuffer();h.__webGLNormalBuffer=c.createBuffer();h.__webGLTangentBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h.__webGLUVBuffer=c.createBuffer();h.__webGLUV2Buffer=c.createBuffer();h.__webGLSkinVertexABuffer=
|
|
|
+c.createBuffer();h.__webGLSkinVertexBBuffer=c.createBuffer();h.__webGLSkinIndicesBuffer=c.createBuffer();h.__webGLSkinWeightsBuffer=c.createBuffer();h.__webGLFaceBuffer=c.createBuffer();h.__webGLLineBuffer=c.createBuffer();h=A;var G=j,M=void 0,C=void 0,aa=0,da=0,ua=0,ka=G.geometry.faces,fa=h.faces;M=0;for(C=fa.length;M<C;M++){fi=fa[M];face=ka[fi];if(face instanceof THREE.Face3){aa+=3;da+=1;ua+=3}else if(face instanceof THREE.Face4){aa+=4;da+=2;ua+=4}}h.__vertexArray=new Float32Array(aa*3);h.__normalArray=
|
|
|
+new Float32Array(aa*3);h.__tangentArray=new Float32Array(aa*4);h.__colorArray=new Float32Array(aa*3);h.__uvArray=new Float32Array(aa*2);h.__uv2Array=new Float32Array(aa*2);h.__skinVertexAArray=new Float32Array(aa*4);h.__skinVertexBArray=new Float32Array(aa*4);h.__skinIndexArray=new Float32Array(aa*4);h.__skinWeightArray=new Float32Array(aa*4);h.__faceArray=new Uint16Array(da*3);h.__lineArray=new Uint16Array(ua*2);C=M=h;aa=void 0;ka=void 0;var ga=void 0,ha=void 0;ga=void 0;fa=!1;aa=0;for(ka=G.materials.length;aa<
|
|
|
+ka;aa++){ga=G.materials[aa];if(ga instanceof THREE.MeshFaceMaterial){ga=0;for(ha=C.materials.length;ga<ha;ga++)if(C.materials[ga]&&C.materials[ga].shading!=undefined&&C.materials[ga].shading==THREE.SmoothShading){fa=!0;break}}else if(ga&&ga.shading!=undefined&&ga.shading==THREE.SmoothShading){fa=!0;break}if(fa)break}M.__needsSmoothNormals=fa;h.__webGLFaceCount=da*3;h.__webGLLineCount=ua*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=
|
|
|
+!0}if(t.__dirtyVertices||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){h=A;da=c.DYNAMIC_DRAW;ua=void 0;M=void 0;var na=void 0,z=void 0,Fa=void 0,za=void 0,Ga=void 0;na=void 0;var P=void 0,N=void 0,K=void 0,oa=void 0;P=void 0;N=void 0;K=void 0;z=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;z=void 0;za=void 0;Fa=void 0;
|
|
|
+Ga=void 0;var Ca=ha=ga=fa=ka=aa=G=C=0,Aa=0,v=0,Ba=h.__vertexArray,Oa=h.__uvArray,Ma=h.__uv2Array,Ha=h.__normalArray,$=h.__tangentArray,sa=h.__colorArray,pa=h.__skinVertexAArray,ta=h.__skinVertexBArray,va=h.__skinIndexArray,qa=h.__skinWeightArray,y=h.__faceArray,X=h.__lineArray,Y=h.__needsSmoothNormals,B=j.geometry,U=B.__dirtyVertices,ma=B.__dirtyElements,xa=B.__dirtyUvs,Da=B.__dirtyNormals,Ea=B.__dirtyTangents,Ia=B.__dirtyColors,ya=B.vertices,Ja=h.faces,Qa=B.faces,Ka=B.uvs,La=B.uvs2,Na=B.colors,Ra=
|
|
|
+B.skinVerticesA,Sa=B.skinVerticesB,Ta=B.skinIndices,Pa=B.skinWeights;ua=0;for(M=Ja.length;ua<M;ua++){na=Ja[ua];z=Qa[na];Ga=Ka[na];na=La[na];Fa=z.vertexNormals;za=z.normal;if(z instanceof THREE.Face3){if(U){P=ya[z.a].position;N=ya[z.b].position;K=ya[z.c].position;Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;G+=9}if(Pa.length){P=Pa[z.a];N=Pa[z.b];K=Pa[z.c];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+
|
|
|
+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;P=Ta[z.a];N=Ta[z.b];K=Ta[z.c];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;P=Ra[z.a];N=Ra[z.b];K=Ra[z.c];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;P=Sa[z.a];N=Sa[z.b];K=Sa[z.c];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+
|
|
|
+6]=N.z;ta[v+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;v+=12}if(Ia&&Na.length){P=Na[z.a];N=Na[z.b];K=Na[z.c];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;Aa+=9}if(Ea&&B.hasTangents){P=ya[z.a].tangent;N=ya[z.b].tangent;K=ya[z.c].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;ha+=12}if(Da)if(Fa.length==3&&Y)for(z=0;z<
|
|
|
+3;z++){za=Fa[z];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(z=0;z<3;z++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(z=0;z<3;z++){Fa=Ga[z];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(z=0;z<3;z++){Ga=na[z];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){y[fa]=C;y[fa+1]=C+1;y[fa+2]=C+2;fa+=3;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+2;X[Ca+4]=C+1;X[Ca+5]=C+2;Ca+=6;C+=3}}else if(z instanceof THREE.Face4){if(U){P=ya[z.a].position;N=ya[z.b].position;K=ya[z.c].position;oa=ya[z.d].position;
|
|
|
+Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;Ba[G+9]=oa.x;Ba[G+10]=oa.y;Ba[G+11]=oa.z;G+=12}if(Pa.length){P=Pa[z.a];N=Pa[z.b];K=Pa[z.c];oa=Pa[z.d];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;qa[v+12]=oa.x;qa[v+13]=oa.y;qa[v+14]=oa.z;qa[v+15]=oa.w;P=Ta[z.a];N=Ta[z.b];K=Ta[z.c];oa=Ta[z.d];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=
|
|
|
+N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;va[v+12]=oa.x;va[v+13]=oa.y;va[v+14]=oa.z;va[v+15]=oa.w;P=Ra[z.a];N=Ra[z.b];K=Ra[z.c];oa=Ra[z.d];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;pa[v+12]=oa.x;pa[v+13]=oa.y;pa[v+14]=oa.z;pa[v+15]=1;P=Sa[z.a];N=Sa[z.b];K=Sa[z.c];oa=Sa[z.d];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+6]=N.z;ta[v+
|
|
|
+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;ta[v+12]=oa.x;ta[v+13]=oa.y;ta[v+14]=oa.z;ta[v+15]=1;v+=16}if(Ia&&Na.length){P=Na[z.a];N=Na[z.b];K=Na[z.c];oa=Na[z.d];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;sa[Aa+9]=oa.r;sa[Aa+10]=oa.g;sa[Aa+11]=oa.b;Aa+=12}if(Ea&&B.hasTangents){P=ya[z.a].tangent;N=ya[z.b].tangent;K=ya[z.c].tangent;z=ya[z.d].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;
|
|
|
+$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;$[ha+12]=z.x;$[ha+13]=z.y;$[ha+14]=z.z;$[ha+15]=z.w;ha+=16}if(Da)if(Fa.length==4&&Y)for(z=0;z<4;z++){za=Fa[z];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(z=0;z<4;z++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(z=0;z<4;z++){Fa=Ga[z];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(z=0;z<4;z++){Ga=na[z];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){y[fa]=C;y[fa+1]=C+1;y[fa+2]=C+2;y[fa+3]=C;y[fa+4]=C+2;y[fa+5]=
|
|
|
+C+3;fa+=6;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+3;X[Ca+4]=C+1;X[Ca+5]=C+2;X[Ca+6]=C+2;X[Ca+7]=C+3;Ca+=8;C+=4}}}if(U){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ba,da)}if(Ia&&Na.length){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,sa,da)}if(Da){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ha,da)}if(Ea&&B.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,
|
|
|
+$,da)}if(xa&&aa>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Oa,da)}if(xa&&ka>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ma,da)}if(ma){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y,da);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X,da)}if(v>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,pa,da);
|
|
|
+c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ta,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,va,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,qa,da)}}F(objlist,W,q,A,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();
|
|
|
+q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__webGLVertexCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=
|
|
|
+new Float32Array(A*3);q.__webGLLineCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];
|
|
|
+h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__sortArray=[];q.__webGLParticleCount=A;t.__dirtyVertices=
|
|
|
+!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||j.sortParticles)&&b(t,c.DYNAMIC_DRAW,j,camera);F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){t=W;if(t[0]==undefined){h.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(f,n){var p,j;for(p=f.__webGLObjects.length-1;p>=0;p--){j=f.__webGLObjects[p].object;n==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=
|
|
|
+function(f,n){if(f){!n||n=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+THREE.Snippets={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 env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, 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 refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
|
+map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
|
|
+lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
+lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
+lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
|
+color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
|
+THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
|
|
+value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
|
+THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
|
|
+value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
|
|
+THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
|
|
+THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
|
|
+THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
|
|
+THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
|
|
+THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
|
|
+THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
|
+THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.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.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
|
|
+THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};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};
|