123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- // ThreeWebGL.js r33 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
- THREE.Color.prototype={autoUpdate:!0,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,k,i,o,l;if(d==0)e=g=k=0;else{i=Math.floor(a*6);o=a*6-i;a=d*(1-b);l=d*(1-b*o);b=d*(1-b*(1-o));switch(i){case 1:e=l;g=d;k=a;break;case 2:e=a;g=d;k=b;break;case 3:e=a;g=l;k=d;break;case 4:e=b;g=a;k=d;break;case 5:e=d;g=a;k=l;break;case 6:case 0:e=d;g=b;k=a}}this.r=e;this.g=g;this.b=k;if(this.autoUpdate){this.updateHex();
- this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
- THREE.Vector2=function(a,b){this.set(a||0,b||0)};
- THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
- this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,d){this.set(a||0,b||0,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.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
- b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.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.set(d*a.z-e*a.y,e*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
- a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(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.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
- this.length();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)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,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.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
- a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(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)}};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(k,i){return k.distance-i.distance});return g},intersectObject:function(a){function b(L,J,T,S){S=S.clone().subSelf(J);T=T.clone().subSelf(J);var M=L.clone().subSelf(J);L=S.dot(S);J=S.dot(T);S=S.dot(M);var O=T.dot(T);T=T.dot(M);M=1/(L*O-J*J);O=(O*S-J*T)*M;L=(L*T-J*S)*M;return O>0&&L>0&&O+L<1}var d,e,g,k,i,o,l,v,x,w,
- z,A=a.geometry,I=A.vertices,G=[];d=0;for(e=A.faces.length;d<e;d++){g=A.faces[d];w=this.origin.clone();z=this.direction.clone();l=a.matrixWorld;k=l.multiplyVector3(I[g.a].position.clone());i=l.multiplyVector3(I[g.b].position.clone());o=l.multiplyVector3(I[g.c].position.clone());l=g instanceof THREE.Face4?l.multiplyVector3(I[g.d].position.clone()):null;v=a.matrixRotationWorld.multiplyVector3(g.normal.clone());x=z.dot(v);if(x<0){v=v.dot((new THREE.Vector3).sub(k,w))/x;w=w.addSelf(z.multiplyScalar(v));
- if(g instanceof THREE.Face3){if(b(w,k,i,o)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};G.push(g)}}else if(g instanceof THREE.Face4&&(b(w,k,i,l)||b(w,i,o,l))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};G.push(g)}}}return G}};
- THREE.Rectangle=function(){function a(){k=e-b;i=g-d}var b,d,e,g,k,i,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(l,v,x,w){o=!1;b=l;d=v;e=x;g=w;a()};this.addPoint=function(l,v){if(o){o=!1;b=l;d=v;e=l;g=v}else{b=b<l?b:l;d=d<v?d:v;e=e>l?e:l;g=g>v?g:v}a()};
- this.add3Points=function(l,v,x,w,z,A){if(o){o=!1;b=l<x?l<z?l:z:x<z?x:z;d=v<w?v<A?v:A:w<A?w:A;e=l>x?l>z?l:z:x>z?x:z;g=v>w?v>A?v:A:w>A?w:A}else{b=l<x?l<z?l<b?l:b:z<b?z:b:x<z?x<b?x:b:z<b?z:b;d=v<w?v<A?v<d?v:d:A<d?A:d:w<A?w<d?w:d:A<d?A:d;e=l>x?l>z?l>e?l:e:z>e?z:e:x>z?x>e?x:e:z>e?z:e;g=v>w?v>A?v>g?v:g:A>g?A:g:w>A?w>g?w:g:A>g?A:g}a()};this.addRectangle=function(l){if(o){o=!1;b=l.getLeft();d=l.getTop();e=l.getRight();g=l.getBottom()}else{b=b<l.getLeft()?b:l.getLeft();d=d<l.getTop()?d:l.getTop();e=e>l.getRight()?
- e:l.getRight();g=g>l.getBottom()?g:l.getBottom()}a()};this.inflate=function(l){b-=l;d-=l;e+=l;g+=l;a()};this.minSelf=function(l){b=b>l.getLeft()?b:l.getLeft();d=d>l.getTop()?d:l.getTop();e=e<l.getRight()?e:l.getRight();g=g<l.getBottom()?g:l.getBottom();a()};this.instersects=function(l){return Math.min(e,l.getRight())-Math.max(b,l.getLeft())>=0&&Math.min(g,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){o=!0;g=e=d=b=0;a()};this.isEmpty=function(){return o}};
- 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,k,i,o,l,v,x,w,z,A,I,G){this.set(a||1,b||0,d||0,e||0,g||0,k||1,i||0,o||0,l||0,v||0,x||1,w||0,z||0,A||0,I||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={set:function(a,b,d,e,g,k,i,o,l,v,x,w,z,A,I,G){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=k;this.n23=i;this.n24=o;this.n31=l;this.n32=v;this.n33=x;this.n34=w;this.n41=z;this.n42=A;this.n43=I;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,
- g=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,b).normalize();e.cross(d,k).normalize();g.cross(k,e).normalize();this.n11=e.x;this.n12=g.x;this.n13=k.x;this.n14=a.x;this.n21=e.y;this.n22=g.y;this.n23=k.y;this.n24=a.y;this.n31=e.z;this.n32=g.z;this.n33=k.z;this.n34=a.z;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,k=a.n14,i=a.n21,o=a.n22,l=a.n23,v=a.n24,x=a.n31,w=a.n32,z=a.n33,A=a.n34,I=a.n41,G=a.n42,L=a.n43,J=a.n44,T=b.n11,S=b.n12,M=b.n13,O=b.n14,c=b.n21,aa=b.n22,fa=b.n23,ba=b.n24,ca=b.n31,ia=b.n32,na=b.n33,oa=b.n34;this.n11=
- d*T+e*c+g*ca;this.n12=d*S+e*aa+g*ia;this.n13=d*M+e*fa+g*na;this.n14=d*O+e*ba+g*oa+k;this.n21=i*T+o*c+l*ca;this.n22=i*S+o*aa+l*ia;this.n23=i*M+o*fa+l*na;this.n24=i*O+o*ba+l*oa+v;this.n31=x*T+w*c+z*ca;this.n32=x*S+w*aa+z*ia;this.n33=x*M+w*fa+z*na;this.n34=x*O+w*ba+z*oa+A;this.n41=I*T+G*c+L*ca;this.n42=I*S+G*aa+L*ia;this.n43=I*M+G*fa+L*na;this.n44=I*O+G*ba+L*oa+J;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,k=a.n13,i=a.n14,o=a.n21,l=a.n22,v=a.n23,x=a.n24,w=a.n31,z=a.n32,A=a.n33,I=
- a.n34,G=a.n41,L=a.n42,J=a.n43;a=a.n44;var T=b.n11,S=b.n12,M=b.n13,O=b.n14,c=b.n21,aa=b.n22,fa=b.n23,ba=b.n24,ca=b.n31,ia=b.n32,na=b.n33,oa=b.n34,ja=b.n41,ra=b.n42,wa=b.n43;b=b.n44;this.n11=e*T+g*c+k*ca+i*ja;this.n12=e*S+g*aa+k*ia+i*ra;this.n13=e*M+g*fa+k*na+i*wa;this.n14=e*O+g*ba+k*oa+i*b;this.n21=o*T+l*c+v*ca+x*ja;this.n22=o*S+l*aa+v*ia+x*ra;this.n23=o*M+l*fa+v*na+x*wa;this.n24=o*O+l*ba+v*oa+x*b;this.n31=w*T+z*c+A*ca+I*ja;this.n32=w*S+z*aa+A*ia+I*ra;this.n33=w*M+z*fa+A*na+I*wa;this.n34=w*O+z*ba+
- A*oa+I*b;this.n41=G*T+L*c+J*ca+a*ja;this.n42=G*S+L*aa+J*ia+a*ra;this.n43=G*M+L*fa+J*na+a*wa;this.n44=G*O+L*ba+J*oa+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,k=this.n21,i=this.n22,o=this.n23,l=this.n24,v=this.n31,x=this.n32,
- w=this.n33,z=this.n34,A=this.n41,I=this.n42,G=this.n43,L=this.n44,J=a.n11,T=a.n21,S=a.n31,M=a.n12,O=a.n22,c=a.n32,aa=a.n13,fa=a.n23,ba=a.n33,ca=a.n14,ia=a.n24;a=a.n34;this.n11=b*J+d*T+e*S;this.n12=b*M+d*O+e*c;this.n13=b*aa+d*fa+e*ba;this.n14=b*ca+d*ia+e*a+g;this.n21=k*J+i*T+o*S;this.n22=k*M+i*O+o*c;this.n23=k*aa+i*fa+o*ba;this.n24=k*ca+i*ia+o*a+l;this.n31=v*J+x*T+w*S;this.n32=v*M+x*O+w*c;this.n33=v*aa+x*fa+w*ba;this.n34=v*ca+x*ia+w*a+z;this.n41=A*J+I*T+G*S;this.n42=A*M+I*O+G*c;this.n43=A*aa+I*fa+
- G*ba;this.n44=A*ca+I*ia+G*a+L;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,k=this.n22,i=this.n23,o=this.n24,l=this.n31,v=this.n32,x=this.n33,w=this.n34,z=this.n41,A=this.n42,I=this.n43,G=this.n44;return e*i*v*z-d*o*v*z-
- e*k*x*z+b*o*x*z+d*k*w*z-b*i*w*z-e*i*l*A+d*o*l*A+e*g*x*A-a*o*x*A-d*g*w*A+a*i*w*A+e*k*l*I-b*o*l*I-e*g*v*I+a*o*v*I+b*g*w*I-a*k*w*I-d*k*l*G+b*i*l*G+d*g*v*G-a*i*v*G-b*g*x*G+a*k*x*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=
- this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;
- a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,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,k=a.x,i=a.y,o=a.z,l=g*k,v=g*i;this.set(l*k+d,l*i-e*o,l*o+e*i,0,l*i+e*o,v*i+
- d,v*o-e*k,0,l*o-e*i,v*o+e*k,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(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var k=Math.cos(e);e=Math.sin(e);var i=a*d,o=b*d;this.n11=g*k;this.n12=-g*e;this.n13=d;this.n21=o*k+a*e;this.n22=-o*e+a*k;this.n23=-b*g;this.n31=-i*k+b*e;this.n32=i*e+b*k;this.n33=a*g},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,g=a.w,
- k=b+b,i=d+d,o=e+e;a=b*k;var l=b*i;b*=o;var v=d*i;d*=o;e*=o;k*=g;i*=g;g*=o;this.n11=1-(v+e);this.n12=l-g;this.n13=b+i;this.n21=l+g;this.n22=1-(a+e);this.n23=d-k;this.n31=b-i;this.n32=d+k;this.n33=1-(a+v)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this}};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,k=a.n14,i=a.n21,o=a.n22,l=a.n23,v=a.n24,x=a.n31,w=a.n32,z=a.n33,A=a.n34,I=a.n41,G=a.n42,L=a.n43,J=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=l*A*G-v*z*G+v*w*L-o*A*L-l*w*J+o*z*J;b.n12=k*z*G-g*A*G-k*w*L+e*A*L+g*w*J-e*z*J;b.n13=g*v*G-k*l*G+k*o*L-e*v*L-g*o*J+e*l*J;b.n14=k*l*w-g*v*w-k*o*z+e*v*z+g*o*A-e*l*A;b.n21=v*z*I-l*A*I-v*x*L+i*A*L+l*x*J-i*z*J;b.n22=g*A*I-k*z*I+k*x*L-d*A*L-g*x*J+d*z*J;b.n23=k*l*I-g*v*I-k*i*L+d*v*L+g*i*J-d*l*J;
- b.n24=g*v*x-k*l*x+k*i*z-d*v*z-g*i*A+d*l*A;b.n31=o*A*I-v*w*I+v*x*G-i*A*G-o*x*J+i*w*J;b.n32=k*w*I-e*A*I-k*x*G+d*A*G+e*x*J-d*w*J;b.n33=g*v*I-k*o*I+k*i*G-d*v*G-e*i*J+d*o*J;b.n34=k*o*x-e*v*x-k*i*w+d*v*w+e*i*A-d*o*A;b.n41=l*w*I-o*z*I-l*x*G+i*z*G+o*x*L-i*w*L;b.n42=e*z*I-g*w*I+g*x*G-d*z*G-e*x*L+d*w*L;b.n43=g*o*I-e*l*I-g*i*G+d*l*G+e*i*L-d*o*L;b.n44=e*l*x-g*o*x+g*i*w-d*l*w-e*i*z+d*o*z;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,k=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,v=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*i+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*k;d[3]=a*i;d[4]=a*o;d[5]=a*l;d[6]=a*v;d[7]=a*x;d[8]=a*w;return b};
- THREE.Matrix4.makeFrustum=function(a,b,d,e,g,k){var i;i=new THREE.Matrix4;i.n11=2*g/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*g/(e-d);i.n23=(e+d)/(e-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(k+g)/(k-g);i.n34=-2*k*g/(k-g);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};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,k){var i,o,l,v;i=new THREE.Matrix4;o=b-a;l=d-e;v=k-g;i.n11=2/o;i.n12=0;i.n13=0;i.n14=-((b+a)/o);i.n21=0;i.n22=2/l;i.n23=0;i.n24=-((d+e)/l);i.n31=0;i.n32=0;i.n33=-2/v;i.n34=-((k+g)/v);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
- THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
- this.visible=!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);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);
- if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);b=1/this.scale.x;a=1/this.scale.y;var e=1/this.scale.z;this.matrixRotationWorld.n11=this.matrixWorld.n11*b;this.matrixRotationWorld.n21=
- this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.matrixRotationWorld.n12=this.matrixWorld.n12*a;this.matrixRotationWorld.n22=this.matrixWorld.n22*a;this.matrixRotationWorld.n32=this.matrixWorld.n32*a;this.matrixRotationWorld.n13=this.matrixWorld.n13*e;this.matrixRotationWorld.n23=this.matrixWorld.n23*e;this.matrixRotationWorld.n33=this.matrixWorld.n33*e;this.matrixNeedsUpdate=!1;b=!0}a=0;for(e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,d)}}};
- THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
- THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},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 k=Math.cos(d);d=Math.sin(d);var i=a*b,o=e*g;this.w=i*k-o*d;this.x=i*d+o*k;this.y=e*b*k+a*g*d;this.z=a*g*k-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
- -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,k=a.x,i=a.y,o=a.z;a=a.w;this.x=b*a+g*k+d*o-e*i;this.y=d*a+g*i+e*k-b*o;this.z=e*a+g*o+b*i-d*k;this.w=g*a-b*k-d*i-e*o;return this},
- multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,k=this.x,i=this.y,o=this.z,l=this.w,v=l*d+i*g-o*e,x=l*e+o*d-k*g,w=l*g+k*e-i*d;d=-k*d-i*e-o*g;b.x=v*l+d*-k+x*-o-w*-i;b.y=x*l+d*-i+w*-k-v*-o;b.z=w*l+d*-o+v*-i-x*-k;return b}};
- 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 k=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<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)*k)/i;e=Math.sin(e*k)/i;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.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.Face4=function(a,b,d,e,g,k){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=k instanceof Array?k:[k]};
- THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};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.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,k,i,o=new THREE.Vector3,l=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){k=this.vertices[e];k.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){k=this.faces[e];if(a&&k.vertexNormals.length){o.set(0,0,0);b=0;for(d=k.normal.length;b<d;b++)o.addSelf(k.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[k.a];d=this.vertices[k.b];i=this.vertices[k.c];o.sub(i.position,
- d.position);l.sub(b.position,d.position);o.crossSelf(l)}o.isZero()||o.normalize();k.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(oa,ja,ra,wa,Fa,Aa,Ia){k=oa.vertices[ja].position;i=oa.vertices[ra].position;o=oa.vertices[wa].position;l=g[Fa];v=g[Aa];x=g[Ia];w=i.x-k.x;z=o.x-k.x;A=i.y-
- k.y;I=o.y-k.y;G=i.z-k.z;L=o.z-k.z;J=v.u-l.u;T=x.u-l.u;S=v.v-l.v;M=x.v-l.v;O=1/(J*M-T*S);fa.set((M*w-S*z)*O,(M*A-S*I)*O,(M*G-S*L)*O);ba.set((J*z-T*w)*O,(J*I-T*A)*O,(J*L-T*G)*O);c[ja].addSelf(fa);c[ra].addSelf(fa);c[wa].addSelf(fa);aa[ja].addSelf(ba);aa[ra].addSelf(ba);aa[wa].addSelf(ba)}var b,d,e,g,k,i,o,l,v,x,w,z,A,I,G,L,J,T,S,M,O,c=[],aa=[],fa=new THREE.Vector3,ba=new THREE.Vector3,ca=new THREE.Vector3,ia=new THREE.Vector3,na=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){c[b]=new THREE.Vector3;
- aa[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++){na.copy(this.vertices[b].normal);e=c[b];ca.copy(e);ca.subSelf(na.multiplyScalar(na.dot(e))).normalize();ia.cross(this.vertices[b].normal,e);e=ia.dot(aa[b]);e=e<0?-1:1;this.vertices[b].tangent.set(ca.x,ca.y,ca.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}}};THREE.GeometryIdCounter=0;
- THREE.Camera=function(a,b,d,e,g){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(k,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.tmpVec.crossSelf(this.up);if(i)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
- this.target.position.addSelf(this.tmpVec)};this.translateZ=function(k,i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);if(i)this.tmpVec.y=0;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.near,this.far)};
- THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
- this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};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.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
- THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!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.depthTest!==undefined)this.depthTest=a.depthTest;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.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!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.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!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.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- 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.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
- this.wireframeLinecap="round";this.vertexColors=!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.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==
- undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==
- undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==undefined)this.vertexShader=
- a.vertexShader;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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==
- undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- 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.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
- undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
- THREE.Texture=function(a,b,d,e,g,k){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
- THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
- THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
- THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
- 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.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
- THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,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.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.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,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.matrixWorld,!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}};
- THREE.Sound=function(a,b,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var g;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)g=
- "audio/mpeg";else if(b.indexOf(".ogg")!==-1)g="audio/ogg";else b.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
- THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
- THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
- THREE.Sound.prototype.update=function(a,b,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null;this.matrixAutoUpdate=!1};
- 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 if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.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.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.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.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,g=d.length;for(e=0;e<g;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
- THREE.WebGLRenderer=function(a){function b(f,n,m){var h,j,t,q=f.vertices,r=q.length,p=f.colors,E=p.length,F=f.__vertexArray,H=f.__colorArray,Q=f.__sortArray,y=f.__dirtyVertices,K=f.__dirtyColors;if(m.sortParticles){ra.multiplySelf(m.matrixWorld);for(h=0;h<r;h++){j=q[h].position;Aa.copy(j);ra.multiplyVector3(Aa);Q[h]=[Aa.z,h]}Q.sort(function(da,$){return $[0]-da[0]});for(h=0;h<r;h++){j=q[Q[h][1]].position;t=h*3;F[t]=j.x;F[t+1]=j.y;F[t+2]=j.z}for(h=0;h<E;h++){t=h*3;color=p[Q[h][1]];H[t]=color.r;H[t+
- 1]=color.g;H[t+2]=color.b}}else{if(y)for(h=0;h<r;h++){j=q[h].position;t=h*3;F[t]=j.x;F[t+1]=j.y;F[t+2]=j.z}if(K)for(h=0;h<E;h++){color=p[h];t=h*3;H[t]=color.r;H[t+1]=color.g;H[t+2]=color.b}}if(y||m.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,F,n)}if(K||m.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,H,n)}}function d(f,n){f.fragmentShader=n.fragmentShader;f.vertexShader=n.vertexShader;f.uniforms=Uniforms.clone(n.uniforms)}
- function e(f,n,m,h,j){h.program||ba.initMaterial(h,n,m);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=aa){c.useProgram(t);aa=t;c.uniformMatrix4fv(q.projectionMatrix,!1,wa)}if(m&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){r.fogNear.value=m.near;r.fogFar.value=m.far}else if(m instanceof
- THREE.FogExp2)r.fogDensity.value=m.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){var p,E,F=0,H=0,Q=0,y,K,da,$=ba.lights,R=$.directional.colors,P=$.directional.positions,N=$.point.colors,sa=$.point.positions,u=0,ma=0;m=E=E=0;for(p=n.length;m<p;m++){E=n[m];y=E.color;K=E.position;da=E.intensity;if(E instanceof THREE.AmbientLight){F+=y.r;H+=y.g;Q+=y.b}else if(E instanceof THREE.DirectionalLight){E=u*3;R[E]=y.r*da;R[E+1]=y.g*da;R[E+2]=y.b*da;P[E]=K.x;P[E+1]=K.y;
- P[E+2]=K.z;u+=1}else if(E instanceof THREE.PointLight){E=ma*3;N[E]=y.r*da;N[E+1]=y.g*da;N[E+2]=y.b*da;sa[E]=K.x;sa[E+1]=K.y;sa[E+2]=K.z;ma+=1}}for(m=u*3;m<R.length;m++)R[m]=0;for(m=ma*3;m<N.length;m++)N[m]=0;$.point.length=ma;$.directional.length=u;$.ambient[0]=F;$.ambient[1]=H;$.ambient[2]=Q;n=ba.lights;r.enableLighting.value=n.directional.length+n.point.length;r.ambientLightColor.value=n.ambient;r.directionalLightColor.value=n.directional.colors;r.directionalLightDirection.value=n.directional.positions;
- r.pointLightColor.value=n.point.colors;r.pointLightPosition.value=n.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.map.texture=h.map;r.lightMap.texture=h.lightMap;r.envMap.texture=h.envMap;r.reflectivity.value=h.reflectivity;r.refractionRatio.value=h.refractionRatio;r.combine.value=h.combine;r.useRefract.value=
- h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.size.value=h.size;r.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(h.ambient.r,h.ambient.g,
- h.ambient.b);r.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);r.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){r.mNear.value=f.near;r.mFar.value=f.far;r.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)r.opacity.value=h.opacity;for(var ka in r)if(F=t.uniforms[ka]){m=r[ka];p=m.type;n=m.value;if(p=="i")c.uniform1i(F,n);else if(p=="f")c.uniform1f(F,n);else if(p=="fv1")c.uniform1fv(F,n);else if(p=="fv")c.uniform3fv(F,n);else if(p=="v2")c.uniform2f(F,
- n.x,n.y);else if(p=="v3")c.uniform3f(F,n.x,n.y,n.z);else if(p=="c")c.uniform3f(F,n.r,n.g,n.b);else if(p=="t"){c.uniform1i(F,n);if(m=m.texture)if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(!m.image.__webGLTextureCube)m.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,m.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(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image[p]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube)}}else{if(m.needsUpdate){if(m.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,
- m.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,m.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,M(m.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(m.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(m.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(m.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{m.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,m.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
- 0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,M(m.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(m.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(m.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(m.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);m.__wasSetOnce=!0}m.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_2D,m.__webGLTexture)}}}c.uniformMatrix4fv(q.modelViewMatrix,
- !1,j._modelViewMatrixArray);c.uniformMatrix3fv(q.normalMatrix,!1,j._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||h.envMap)&&c.uniform3f(q.cameraPosition,f.position.x,f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&c.uniformMatrix4fv(q.objectMatrix,!1,j._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(q.viewMatrix,
- !1,Fa);if(h.skinning){c.uniformMatrix4fv(q.cameraInverseMatrix,!1,Fa);c.uniformMatrix4fv(q.boneGlobalMatrices,!1,j.boneMatrices)}return t}function g(f,n,m,h,j,t){f=e(f,n,m,h,t).attributes;c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,
- 3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(j.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,j.__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(j.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
- if(h.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
- 4,c.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.drawElements(c.LINES,j.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,j.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(t,0,j.__webGLLineCount)}else if(t instanceof
- THREE.ParticleSystem)c.drawArrays(c.POINTS,0,j.__webGLParticleCount);else t instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,j.__webGLVertexCount)}function k(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 i(f){if(ca!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(ia!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ia=f.flipSided}}function o(f){if(oa!=
- f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);oa=f}}function l(f){ja[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ja[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ja[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ja[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ja[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ja[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var n;for(f=0;f<6;f++){n=ja[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*
- n.z))}}function v(f){for(var n=f.matrixWorld,m=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),h=0;h<6;h++){f=ja[h].x*n.n14+ja[h].y*n.n24+ja[h].z*n.n34+ja[h].w;if(f<=m)return!1}return!0}function x(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,m,h=f.object,j=f.opaque,t=f.transparent;t.count=0;f=j.count=0;for(n=h.materials.length;f<n;f++){m=h.materials[f];m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?x(t,m):x(j,m)}}function z(f){var n,m,h,j,t=f.object,
- q=f.buffer,r=f.opaque,p=f.transparent;p.count=0;f=r.count=0;for(h=t.materials.length;f<h;f++){n=t.materials[f];if(n instanceof THREE.MeshFaceMaterial){n=0;for(m=q.materials.length;n<m;n++)(j=q.materials[n])&&(j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?x(p,j):x(r,j))}else{j=n;j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?x(p,j):x(r,j)}}}function A(f,n){return n.z-f.z}function I(f){function n(H){var Q=[];m=0;for(h=H.length;m<h;m++)H[m]==undefined?Q.push("undefined"):Q.push(H[m].id);
- return Q.join("_")}var m,h,j,t,q,r,p,E,F={};f.geometryGroups={};j=0;for(t=f.faces.length;j<t;j++){q=f.faces[j];r=q.materials;p=n(r);F[p]==undefined&&(F[p]={hash:p,counter:0});E=F[p].hash+"_"+F[p].counter;f.geometryGroups[E]==undefined&&(f.geometryGroups[E]={faces:[],materials:r,vertices:0});q=q instanceof THREE.Face3?3:4;if(f.geometryGroups[E].vertices+q>65535){F[p].counter+=1;E=F[p].hash+"_"+F[p].counter;f.geometryGroups[E]==undefined&&(f.geometryGroups[E]={faces:[],materials:r,vertices:0})}f.geometryGroups[E].faces.push(j);
- f.geometryGroups[E].vertices+=q}}function G(f,n,m,h,j){if(n[m]==undefined){f.push({buffer:h,object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});n[m]=1}}function L(f,n){f._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function J(f){if(f!=na){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;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}na=f}}function T(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,M(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,M(f.format),f.width,f.height,0,M(f.format),M(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 m,h,j;if(f){m=f.__webGLFramebuffer;h=f.width;j=f.height}else{m=null;h=O.width;j=O.height}if(m!=fa){c.bindFramebuffer(c.FRAMEBUFFER,m);c.viewport(0,0,h,j);n&&c.clear(c.COLOR_BUFFER_BIT|
- c.DEPTH_BUFFER_BIT);fa=m}}function S(f,n){var m;if(f=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(m=c.createShader(c.VERTEX_SHADER));c.shaderSource(m,n);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(m));return null}return m}function M(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 O=document.createElement("canvas"),c,aa=null,fa=null,ba=this,ca=null,ia=null,na=null,oa=null,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
- ra=new THREE.Matrix4,wa=new Float32Array(16),Fa=new Float32Array(16),Aa=new THREE.Vector4,Ia=!0,Oa=new THREE.Color(0),Pa=0;if(a){if(a.antialias!==undefined)Ia=a.antialias;a.clearColor!==undefined&&Oa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Pa=a.clearAlpha}this.domElement=O;this.autoClear=!0;this.sortObjects=!1;(function(f,n,m){try{c=O.getContext("experimental-webgl",{antialias:f})}catch(h){console.log(h)}if(!c)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,m);_cullEnabled=!0})(Ia,Oa,Pa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,n){O.width=f;O.height=n;c.viewport(0,0,O.width,O.height)};this.setClearColorHex=function(f,n){var m=new THREE.Color(f);c.clearColor(m.r,m.g,m.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,m){var h,j;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 t,q,r,p;j=r=p=0;for(t=n.length;j<t;j++){q=n[j];q instanceof THREE.DirectionalLight&&r++;q instanceof THREE.PointLight&&p++}if(p+r<=4)n=r;else{n=Math.ceil(4*r/(p+r));p=4-n}j={directional:n,point:p};p=f.fragmentShader;n=f.vertexShader;t={fog:m,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:j.directional,
- maxPointLights:j.point};m=c.createProgram();j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+t.maxPointLights,t.fog?"#define USE_FOG":"",t.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.lightMap?"#define USE_LIGHTMAP":"",t.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
- 0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+t.maxPointLights,t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.lightMap?"#define USE_LIGHTMAP":"",t.vertexColors?"#define USE_COLOR":"",t.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(m,S("fragment",j+p));c.attachShader(m,S("vertex",t+n));c.linkProgram(m);c.getProgramParameter(m,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(m,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");m.uniforms={};m.attributes={};f.program=m;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(h in f.uniforms)m.push(h);h=f.program;p=0;for(n=m.length;p<
- n;p++){j=m[p];h.uniforms[j]=c.getUniformLocation(h,j)}h=f.program;m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];p=0;for(n=m.length;p<n;p++){j=m[p];h.attributes[j]=c.getAttribLocation(h,j)}h=f.program.attributes;c.enableVertexAttribArray(h.position);h.color>=0&&c.enableVertexAttribArray(h.color);h.normal>=0&&c.enableVertexAttribArray(h.normal);h.tangent>=0&&c.enableVertexAttribArray(h.tangent);if(f.skinning&&h.skinVertexA>=0&&h.skinVertexB>=
- 0&&h.skinIndex>=0&&h.skinWeight>=0){c.enableVertexAttribArray(h.skinVertexA);c.enableVertexAttribArray(h.skinVertexB);c.enableVertexAttribArray(h.skinIndex);c.enableVertexAttribArray(h.skinWeight)}};this.render=function(f,n,m,h){var j,t,q,r,p,E,F,H,Q=f.lights,y=f.fog;n.matrixAutoUpdate&&n.update();n.matrixWorldInverse.flattenToArray(Fa);n.projectionMatrix.flattenToArray(wa);ra.multiply(n.projectionMatrix,n.matrixWorldInverse);l(ra);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,
- !1,n);this.initWebGLObjects(f,n);T(m,h!==undefined?h:!0);this.autoClear&&this.clear();p=f.__webGLObjects.length;for(h=0;h<p;h++){j=f.__webGLObjects[h];F=j.object;if(F.visible)if(!(F instanceof THREE.Mesh)||v(F)){F.matrixWorld.flattenToArray(F._objectMatrixArray);L(F,n);z(j);j.render=!0;if(this.sortObjects){Aa.copy(F.position);ra.multiplyVector3(Aa);j.z=Aa.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webGLObjects.sort(A);E=f.__webGLObjectsImmediate.length;for(h=0;h<E;h++){j=f.__webGLObjectsImmediate[h];
- F=j.object;if(F.visible){F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray);L(F,n);w(j)}}J(THREE.NormalBlending);for(h=0;h<p;h++){j=f.__webGLObjects[h];if(j.render){F=j.object;H=j.buffer;q=j.opaque;i(F);for(j=0;j<q.count;j++){r=q.list[j];o(r.depthTest);g(n,Q,y,r,H,F)}}}for(h=0;h<E;h++){j=f.__webGLObjectsImmediate[h];F=j.object;if(F.visible){q=j.opaque;i(F);for(j=0;j<q.count;j++){r=q.list[j];o(r.depthTest);t=e(n,Q,y,r,F);F.render(function(K){k(K,t)})}}}for(h=0;h<p;h++){j=f.__webGLObjects[h];
- if(j.render){F=j.object;H=j.buffer;q=j.transparent;i(F);for(j=0;j<q.count;j++){r=q.list[j];J(r.blending);o(r.depthTest);g(n,Q,y,r,H,F)}}}for(h=0;h<E;h++){j=f.__webGLObjectsImmediate[h];F=j.object;if(F.visible){q=j.transparent;i(F);for(j=0;j<q.count;j++){r=q.list[j];J(r.blending);o(r.depthTest);t=e(n,Q,y,r,F);F.render(function(K){k(K,t)})}}}if(m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,m.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,
- null)}};this.initWebGLObjects=function(f,n){if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}for(var m=0,h=f.objects.length;m<h;m++){var j=f.objects[m],t=f,q=n,r=void 0,p=void 0,E=void 0,F=void 0;if(t.__webGLObjectsMap[j.id]==undefined){t.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrixWorld.flattenToArray(j._objectMatrixArray)}F=
- t.__webGLObjectsMap[j.id];objlist=t.__webGLObjects;if(j instanceof THREE.Mesh){p=j.geometry;p.geometryGroups==undefined&&I(p);for(r in p.geometryGroups){E=p.geometryGroups[r];if(!E.__webGLVertexBuffer){q=E;q.__webGLVertexBuffer=c.createBuffer();q.__webGLNormalBuffer=c.createBuffer();q.__webGLTangentBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q.__webGLUVBuffer=c.createBuffer();q.__webGLUV2Buffer=c.createBuffer();q.__webGLSkinVertexABuffer=c.createBuffer();q.__webGLSkinVertexBBuffer=
- c.createBuffer();q.__webGLSkinIndicesBuffer=c.createBuffer();q.__webGLSkinWeightsBuffer=c.createBuffer();q.__webGLFaceBuffer=c.createBuffer();q.__webGLLineBuffer=c.createBuffer();q=E;var H=j,Q=void 0,y=void 0,K=0,da=t=0,$=H.geometry.faces,R=q.faces;Q=0;for(y=R.length;Q<y;Q++){fi=R[Q];face=$[fi];if(face instanceof THREE.Face3){K+=3;t+=1;da+=3}else if(face instanceof THREE.Face4){K+=4;t+=2;da+=4}}q.__vertexArray=new Float32Array(K*3);q.__normalArray=new Float32Array(K*3);q.__tangentArray=new Float32Array(K*
- 4);q.__colorArray=new Float32Array(K*3);q.__uvArray=new Float32Array(K*2);q.__uv2Array=new Float32Array(K*2);q.__skinVertexAArray=new Float32Array(K*4);q.__skinVertexBArray=new Float32Array(K*4);q.__skinIndexArray=new Float32Array(K*4);q.__skinWeightArray=new Float32Array(K*4);q.__faceArray=new Uint16Array(t*3);q.__lineArray=new Uint16Array(da*2);y=Q=q;K=void 0;$=void 0;var P=void 0,N=void 0;P=void 0;R=!1;K=0;for($=H.materials.length;K<$;K++){P=H.materials[K];if(P instanceof THREE.MeshFaceMaterial){P=
- 0;for(N=y.materials.length;P<N;P++)if(y.materials[P]&&y.materials[P].shading!=undefined&&y.materials[P].shading==THREE.SmoothShading){R=!0;break}}else if(P&&P.shading!=undefined&&P.shading==THREE.SmoothShading){R=!0;break}if(R)break}Q.__needsSmoothNormals=R;q.__webGLFaceCount=t*3;q.__webGLLineCount=da*2;p.__dirtyVertices=!0;p.__dirtyElements=!0;p.__dirtyUvs=!0;p.__dirtyNormals=!0;p.__dirtyTangents=!0;p.__dirtyColors=!0}if(p.__dirtyVertices||p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||
- p.__dirtyTangents){q=E;t=c.DYNAMIC_DRAW;da=void 0;Q=void 0;var sa=void 0,u=void 0,ma=void 0,ka=void 0,va=void 0;sa=void 0;var B=void 0,C=void 0,D=void 0,U=void 0;B=void 0;C=void 0;D=void 0;u=void 0;B=void 0;C=void 0;D=void 0;U=void 0;B=void 0;C=void 0;D=void 0;U=void 0;B=void 0;C=void 0;D=void 0;U=void 0;B=void 0;C=void 0;D=void 0;U=void 0;B=void 0;C=void 0;D=void 0;U=void 0;u=void 0;ka=void 0;ma=void 0;va=void 0;var pa=N=P=R=$=K=H=y=0,ea=0,s=0,ga=q.__vertexArray,Ga=q.__uvArray,Ha=q.__uv2Array,ua=
- q.__normalArray,V=q.__tangentArray,ha=q.__colorArray,W=q.__skinVertexAArray,X=q.__skinVertexBArray,Y=q.__skinIndexArray,Z=q.__skinWeightArray,xa=q.__faceArray,qa=q.__lineArray,Qa=q.__needsSmoothNormals,la=j.geometry,Ja=la.__dirtyVertices,Ka=la.__dirtyElements,Ea=la.__dirtyUvs,La=la.__dirtyNormals,Ma=la.__dirtyTangents,Na=la.__dirtyColors,ta=la.vertices,Ra=q.faces,Sa=la.faces,Ta=la.uvs,Ua=la.uvs2,ya=la.colors,Ba=la.skinVerticesA,Ca=la.skinVerticesB,Da=la.skinIndices,za=la.skinWeights;da=0;for(Q=Ra.length;da<
- Q;da++){sa=Ra[da];u=Sa[sa];va=Ta[sa];sa=Ua[sa];ma=u.vertexNormals;ka=u.normal;if(u instanceof THREE.Face3){if(Ja){B=ta[u.a].position;C=ta[u.b].position;D=ta[u.c].position;ga[H]=B.x;ga[H+1]=B.y;ga[H+2]=B.z;ga[H+3]=C.x;ga[H+4]=C.y;ga[H+5]=C.z;ga[H+6]=D.x;ga[H+7]=D.y;ga[H+8]=D.z;H+=9}if(za.length){B=za[u.a];C=za[u.b];D=za[u.c];Z[s]=B.x;Z[s+1]=B.y;Z[s+2]=B.z;Z[s+3]=B.w;Z[s+4]=C.x;Z[s+5]=C.y;Z[s+6]=C.z;Z[s+7]=C.w;Z[s+8]=D.x;Z[s+9]=D.y;Z[s+10]=D.z;Z[s+11]=D.w;B=Da[u.a];C=Da[u.b];D=Da[u.c];Y[s]=B.x;Y[s+
- 1]=B.y;Y[s+2]=B.z;Y[s+3]=B.w;Y[s+4]=C.x;Y[s+5]=C.y;Y[s+6]=C.z;Y[s+7]=C.w;Y[s+8]=D.x;Y[s+9]=D.y;Y[s+10]=D.z;Y[s+11]=D.w;B=Ba[u.a];C=Ba[u.b];D=Ba[u.c];W[s]=B.x;W[s+1]=B.y;W[s+2]=B.z;W[s+3]=1;W[s+4]=C.x;W[s+5]=C.y;W[s+6]=C.z;W[s+7]=1;W[s+8]=D.x;W[s+9]=D.y;W[s+10]=D.z;W[s+11]=1;B=Ca[u.a];C=Ca[u.b];D=Ca[u.c];X[s]=B.x;X[s+1]=B.y;X[s+2]=B.z;X[s+3]=1;X[s+4]=C.x;X[s+5]=C.y;X[s+6]=C.z;X[s+7]=1;X[s+8]=D.x;X[s+9]=D.y;X[s+10]=D.z;X[s+11]=1;s+=12}if(Na&&ya.length){B=ya[u.a];C=ya[u.b];D=ya[u.c];ha[ea]=B.r;ha[ea+
- 1]=B.g;ha[ea+2]=B.b;ha[ea+3]=C.r;ha[ea+4]=C.g;ha[ea+5]=C.b;ha[ea+6]=D.r;ha[ea+7]=D.g;ha[ea+8]=D.b;ea+=9}if(Ma&&la.hasTangents){B=ta[u.a].tangent;C=ta[u.b].tangent;D=ta[u.c].tangent;V[N]=B.x;V[N+1]=B.y;V[N+2]=B.z;V[N+3]=B.w;V[N+4]=C.x;V[N+5]=C.y;V[N+6]=C.z;V[N+7]=C.w;V[N+8]=D.x;V[N+9]=D.y;V[N+10]=D.z;V[N+11]=D.w;N+=12}if(La)if(ma.length==3&&Qa)for(u=0;u<3;u++){ka=ma[u];ua[P]=ka.x;ua[P+1]=ka.y;ua[P+2]=ka.z;P+=3}else for(u=0;u<3;u++){ua[P]=ka.x;ua[P+1]=ka.y;ua[P+2]=ka.z;P+=3}if(Ea&&va)for(u=0;u<3;u++){ma=
- va[u];Ga[K]=ma.u;Ga[K+1]=ma.v;K+=2}if(Ea&&sa)for(u=0;u<3;u++){va=sa[u];Ha[$]=va.u;Ha[$+1]=va.v;$+=2}if(Ka){xa[R]=y;xa[R+1]=y+1;xa[R+2]=y+2;R+=3;qa[pa]=y;qa[pa+1]=y+1;qa[pa+2]=y;qa[pa+3]=y+2;qa[pa+4]=y+1;qa[pa+5]=y+2;pa+=6;y+=3}}else if(u instanceof THREE.Face4){if(Ja){B=ta[u.a].position;C=ta[u.b].position;D=ta[u.c].position;U=ta[u.d].position;ga[H]=B.x;ga[H+1]=B.y;ga[H+2]=B.z;ga[H+3]=C.x;ga[H+4]=C.y;ga[H+5]=C.z;ga[H+6]=D.x;ga[H+7]=D.y;ga[H+8]=D.z;ga[H+9]=U.x;ga[H+10]=U.y;ga[H+11]=U.z;H+=12}if(za.length){B=
- za[u.a];C=za[u.b];D=za[u.c];U=za[u.d];Z[s]=B.x;Z[s+1]=B.y;Z[s+2]=B.z;Z[s+3]=B.w;Z[s+4]=C.x;Z[s+5]=C.y;Z[s+6]=C.z;Z[s+7]=C.w;Z[s+8]=D.x;Z[s+9]=D.y;Z[s+10]=D.z;Z[s+11]=D.w;Z[s+12]=U.x;Z[s+13]=U.y;Z[s+14]=U.z;Z[s+15]=U.w;B=Da[u.a];C=Da[u.b];D=Da[u.c];U=Da[u.d];Y[s]=B.x;Y[s+1]=B.y;Y[s+2]=B.z;Y[s+3]=B.w;Y[s+4]=C.x;Y[s+5]=C.y;Y[s+6]=C.z;Y[s+7]=C.w;Y[s+8]=D.x;Y[s+9]=D.y;Y[s+10]=D.z;Y[s+11]=D.w;Y[s+12]=U.x;Y[s+13]=U.y;Y[s+14]=U.z;Y[s+15]=U.w;B=Ba[u.a];C=Ba[u.b];D=Ba[u.c];U=Ba[u.d];W[s]=B.x;W[s+1]=B.y;W[s+
- 2]=B.z;W[s+3]=1;W[s+4]=C.x;W[s+5]=C.y;W[s+6]=C.z;W[s+7]=1;W[s+8]=D.x;W[s+9]=D.y;W[s+10]=D.z;W[s+11]=1;W[s+12]=U.x;W[s+13]=U.y;W[s+14]=U.z;W[s+15]=1;B=Ca[u.a];C=Ca[u.b];D=Ca[u.c];U=Ca[u.d];X[s]=B.x;X[s+1]=B.y;X[s+2]=B.z;X[s+3]=1;X[s+4]=C.x;X[s+5]=C.y;X[s+6]=C.z;X[s+7]=1;X[s+8]=D.x;X[s+9]=D.y;X[s+10]=D.z;X[s+11]=1;X[s+12]=U.x;X[s+13]=U.y;X[s+14]=U.z;X[s+15]=1;s+=16}if(Na&&ya.length){B=ya[u.a];C=ya[u.b];D=ya[u.c];U=ya[u.d];ha[ea]=B.r;ha[ea+1]=B.g;ha[ea+2]=B.b;ha[ea+3]=C.r;ha[ea+4]=C.g;ha[ea+5]=C.b;ha[ea+
- 6]=D.r;ha[ea+7]=D.g;ha[ea+8]=D.b;ha[ea+9]=U.r;ha[ea+10]=U.g;ha[ea+11]=U.b;ea+=12}if(Ma&&la.hasTangents){B=ta[u.a].tangent;C=ta[u.b].tangent;D=ta[u.c].tangent;u=ta[u.d].tangent;V[N]=B.x;V[N+1]=B.y;V[N+2]=B.z;V[N+3]=B.w;V[N+4]=C.x;V[N+5]=C.y;V[N+6]=C.z;V[N+7]=C.w;V[N+8]=D.x;V[N+9]=D.y;V[N+10]=D.z;V[N+11]=D.w;V[N+12]=u.x;V[N+13]=u.y;V[N+14]=u.z;V[N+15]=u.w;N+=16}if(La)if(ma.length==4&&Qa)for(u=0;u<4;u++){ka=ma[u];ua[P]=ka.x;ua[P+1]=ka.y;ua[P+2]=ka.z;P+=3}else for(u=0;u<4;u++){ua[P]=ka.x;ua[P+1]=ka.y;
- ua[P+2]=ka.z;P+=3}if(Ea&&va)for(u=0;u<4;u++){ma=va[u];Ga[K]=ma.u;Ga[K+1]=ma.v;K+=2}if(Ea&&sa)for(u=0;u<4;u++){va=sa[u];Ha[$]=va.u;Ha[$+1]=va.v;$+=2}if(Ka){xa[R]=y;xa[R+1]=y+1;xa[R+2]=y+2;xa[R+3]=y;xa[R+4]=y+2;xa[R+5]=y+3;R+=6;qa[pa]=y;qa[pa+1]=y+1;qa[pa+2]=y;qa[pa+3]=y+3;qa[pa+4]=y+1;qa[pa+5]=y+2;qa[pa+6]=y+2;qa[pa+7]=y+3;pa+=8;y+=4}}}if(Ja){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,ga,t)}if(Na&&ya.length){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,
- ha,t)}if(La){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ua,t)}if(Ma&&la.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,V,t)}if(Ea&&K>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ga,t)}if(Ea&&$>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ha,t)}if(Ka){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,xa,t);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- q.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,qa,t)}if(s>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,W,t);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,X,t);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,Y,t);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,Z,t)}}G(objlist,F,r,E,j)}p.__dirtyVertices=!1;p.__dirtyElements=!1;p.__dirtyUvs=
- !1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){p=j.geometry;if(!p.__webGLVertexBuffer){r=p;r.__webGLVertexBuffer=c.createBuffer();r.__webGLColorBuffer=c.createBuffer();r=p;E=r.vertices.length;r.__vertexArray=new Float32Array(E*3);r.__colorArray=new Float32Array(E*3);r.__webGLVertexCount=E;p.__dirtyVertices=!0;p.__dirtyColors=!0}if(p.__dirtyVertices||p.__dirtyColors){r=p;E=c.DYNAMIC_DRAW;y=void 0;y=void 0;H=void 0;q=void 0;K=r.vertices;t=r.colors;
- $=K.length;da=t.length;R=r.__vertexArray;Q=r.__colorArray;P=r.__dirtyColors;if(r.__dirtyVertices){for(y=0;y<$;y++){H=K[y].position;q=y*3;R[q]=H.x;R[q+1]=H.y;R[q+2]=H.z}c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,R,E)}if(P){for(y=0;y<da;y++){color=t[y];q=y*3;Q[q]=color.r;Q[q+1]=color.g;Q[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,Q,E)}}G(objlist,F,0,p,j);p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(j instanceof THREE.Line){p=
- j.geometry;if(!p.__webGLVertexBuffer){r=p;r.__webGLVertexBuffer=c.createBuffer();r.__webGLColorBuffer=c.createBuffer();r=p;E=r.vertices.length;r.__vertexArray=new Float32Array(E*3);r.__colorArray=new Float32Array(E*3);r.__webGLLineCount=E;p.__dirtyVertices=!0;p.__dirtyColors=!0}if(p.__dirtyVertices||p.__dirtyColors){r=p;E=c.DYNAMIC_DRAW;y=void 0;y=void 0;H=void 0;q=void 0;K=r.vertices;t=r.colors;$=K.length;da=t.length;R=r.__vertexArray;Q=r.__colorArray;P=r.__dirtyColors;if(r.__dirtyVertices){for(y=
- 0;y<$;y++){H=K[y].position;q=y*3;R[q]=H.x;R[q+1]=H.y;R[q+2]=H.z}c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,R,E)}if(P){for(y=0;y<da;y++){color=t[y];q=y*3;Q[q]=color.r;Q[q+1]=color.g;Q[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,Q,E)}}G(objlist,F,0,p,j);p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){p=j.geometry;if(!p.__webGLVertexBuffer){r=p;r.__webGLVertexBuffer=c.createBuffer();
- r.__webGLColorBuffer=c.createBuffer();r=p;E=r.vertices.length;r.__vertexArray=new Float32Array(E*3);r.__colorArray=new Float32Array(E*3);r.__sortArray=[];r.__webGLParticleCount=E;p.__dirtyVertices=!0;p.__dirtyColors=!0}(p.__dirtyVertices||p.__dirtyColors||j.sortParticles)&&b(p,c.DYNAMIC_DRAW,j,q);G(objlist,F,0,p,j);p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes){p=F;if(p[0]==undefined){t.__webGLObjectsImmediate.push({object:j,opaque:{list:[],
- count:0},transparent:{list:[],count:0}});p[0]=1}}}};this.removeObject=function(f,n){var m,h;for(m=f.__webGLObjects.length-1;m>=0;m--){h=f.__webGLObjects[m].object;n==h&&f.__webGLObjects.splice(m,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 envMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
- lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, 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 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ 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},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{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}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
- value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["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"),vertexShader:[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]),fragmentShader:["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"),vertexShader:["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}}]),fragmentShader:["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"),vertexShader:["#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,fragmentShader:["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"),vertexShader:["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")}};
|