|
@@ -1,89 +1,89 @@
|
|
// ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
|
|
// ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var f,e,h,j,p,n;if(c==0)f=e=h=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:f=n;e=c;h=a;break;case 2:f=a;e=c;h=b;break;case 3:f=a;e=n;h=c;break;case 4:f=b;e=a;h=c;break;case 5:f=c;e=a;
|
|
|
|
-h=n;break;case 6:case 0:f=c;e=b;h=a}}this.r=f;this.g=e;this.b=h;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,c){this.set(a||0,b||0,c||0)};
|
|
|
|
-THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;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,c=this.y,f=this.z;this.set(c*a.z-f*a.y,f*a.x-b*a.z,b*a.y-c*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,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+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},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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,c,f){this.set(a||0,b||0,c||0,f||1)};
|
|
|
|
-THREE.Vector4.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;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,c,f=a.objects,e=[];a=0;for(b=f.length;a<b;a++){c=f[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,j){return h.distance-j.distance});return e},intersectObject:function(a){function b(P,L,ja,ma){ma=ma.clone().subSelf(L);ja=ja.clone().subSelf(L);var sa=P.clone().subSelf(L);P=ma.dot(ma);L=ma.dot(ja);ma=ma.dot(sa);var U=ja.dot(ja);ja=ja.dot(sa);sa=1/(P*U-L*L);U=(U*ma-L*ja)*sa;P=(P*ja-L*ma)*sa;return U>0&&P>0&&U+P<
|
|
|
|
-1}var c,f,e,h,j,p,n,s,x,z,C,y=a.geometry,J=y.vertices,K=[];c=0;for(f=y.faces.length;c<f;c++){e=y.faces[c];z=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;h=n.multiplyVector3(J[e.a].position.clone());j=n.multiplyVector3(J[e.b].position.clone());p=n.multiplyVector3(J[e.c].position.clone());n=e instanceof THREE.Face4?n.multiplyVector3(J[e.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(e.normal.clone());x=C.dot(s);if(x<0){s=s.dot((new THREE.Vector3).sub(h,z))/x;z=z.addSelf(C.multiplyScalar(s));
|
|
|
|
-if(e instanceof THREE.Face3){if(b(z,h,j,p)){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}else if(e instanceof THREE.Face4&&(b(z,h,j,n)||b(z,j,p,n))){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}}return K}};
|
|
|
|
-THREE.Rectangle=function(){function a(){h=f-b;j=e-c}var b,c,f,e,h,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return e};this.set=function(n,s,x,z){p=!1;b=n;c=s;f=x;e=z;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;f=n;e=s}else{b=b<n?b:n;c=c<s?c:s;f=f>n?f:n;e=e>s?e:s}a()};
|
|
|
|
-this.add3Points=function(n,s,x,z,C,y){if(p){p=!1;b=n<x?n<C?n:C:x<C?x:C;c=s<z?s<y?s:y:z<y?z:y;f=n>x?n>C?n:C:x>C?x:C;e=s>z?s>y?s:y:z>y?z:y}else{b=n<x?n<C?n<b?n:b:C<b?C:b:x<C?x<b?x:b:C<b?C:b;c=s<z?s<y?s<c?s:c:y<c?y:c:z<y?z<c?z:c:y<c?y:c;f=n>x?n>C?n>f?n:f:C>f?C:f:x>C?x>f?x:f:C>f?C:f;e=s>z?s>y?s>e?s:e:y>e?y:e:z>y?z>e?z:e:y>e?y:e}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();f=n.getRight();e=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();f=f>n.getRight()?
|
|
|
|
-f:n.getRight();e=e>n.getBottom()?e:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;f+=n;e+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f<n.getRight()?f:n.getRight();e=e<n.getBottom()?e:n.getBottom();a()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(e,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;e=f=c=b=0;a()};this.isEmpty=function(){return p}};
|
|
|
|
-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,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.set(a||1,b||0,c||0,f||0,e||0,h||1,j||0,p||0,n||0,s||0,x||1,z||0,C||0,y||0,J||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(a,b,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.n11=a;this.n12=b;this.n13=c;this.n14=f;this.n21=e;this.n22=h;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=x;this.n34=z;this.n41=C;this.n42=y;this.n43=J;this.n44=K;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,c){var f=THREE.Matrix4.__v1,
|
|
|
|
-e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}e.cross(h,f).normalize();this.n11=f.x;this.n12=e.x;this.n13=h.x;this.n21=f.y;this.n22=e.y;this.n23=h.y;this.n31=f.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,f=a.z,e=1/(this.n41*b+this.n42*c+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*f+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
|
|
|
|
-f+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*f+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,f=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*f+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*f+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*f+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*f+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,f=a.z;a.x=b*this.n11+c*this.n12+f*this.n13;a.y=b*this.n21+c*this.n22+f*this.n23;a.z=b*this.n31+c*this.n32+f*this.n33;a.normalize();
|
|
|
|
-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 c=a.n11,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44,ja=b.n11,ma=b.n12,sa=b.n13,U=b.n14,A=b.n21,oa=b.n22,
|
|
|
|
-d=b.n23,Ba=b.n24,Ca=b.n31,Q=b.n32,N=b.n33,pa=b.n34;this.n11=c*ja+f*A+e*Ca;this.n12=c*ma+f*oa+e*Q;this.n13=c*sa+f*d+e*N;this.n14=c*U+f*Ba+e*pa+h;this.n21=j*ja+p*A+n*Ca;this.n22=j*ma+p*oa+n*Q;this.n23=j*sa+p*d+n*N;this.n24=j*U+p*Ba+n*pa+s;this.n31=x*ja+z*A+C*Ca;this.n32=x*ma+z*oa+C*Q;this.n33=x*sa+z*d+C*N;this.n34=x*U+z*Ba+C*pa+y;this.n41=J*ja+K*A+P*Ca;this.n42=J*ma+K*oa+P*Q;this.n43=J*sa+K*d+P*N;this.n44=J*U+K*Ba+P*pa+L;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;
|
|
|
|
-c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
|
|
|
|
-a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,f=this.n14,e=this.n21,h=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,x=this.n33,z=this.n34,C=this.n41,y=this.n42,J=this.n43,K=this.n44;return f*j*s*C-c*p*s*C-f*h*x*C+b*p*x*C+c*h*z*C-b*j*z*C-f*j*n*y+c*p*n*y+f*e*x*y-a*p*x*y-c*e*z*y+a*j*z*y+f*h*n*J-b*p*n*J-f*e*s*J+a*p*s*J+b*e*z*J-a*h*z*J-c*h*n*K+b*j*n*K+c*e*s*K-a*j*s*K-b*e*x*K+a*h*x*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
|
|
|
|
|
|
+THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,f,h,i,m,o;if(d==0)g=f=h=0;else{i=Math.floor(a*6);m=a*6-i;a=d*(1-c);o=d*(1-c*m);c=d*(1-c*(1-m));switch(i){case 1:g=o;f=d;h=a;break;case 2:g=a;f=d;h=c;break;case 3:g=a;f=o;h=d;break;case 4:g=c;f=a;h=d;break;case 5:g=d;f=a;
|
|
|
|
+h=o;break;case 6:case 0:g=d;f=c;h=a}}this.r=g;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
|
|
|
|
+255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
|
|
|
|
+THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
|
|
+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,c,d){this.set(a||0,c||0,d||0)};
|
|
|
|
+THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.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,c){this.set(a.x-c.x,a.y-c.y,a.z-c.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,
|
|
|
|
+c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.set(d*a.z-g*a.y,g*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.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 c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+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},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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,c,d,g){this.set(a||0,c||0,d||0,g||1)};
|
|
|
|
+THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
|
+a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,d,g=a.objects,f=[];a=0;for(c=g.length;a<c;a++){d=g[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,i){return h.distance-i.distance});return f},intersectObject:function(a){function c(Q,K,ia,la){la=la.clone().subSelf(K);ia=ia.clone().subSelf(K);var wa=Q.clone().subSelf(K);Q=la.dot(la);K=la.dot(ia);la=la.dot(wa);var S=ia.dot(ia);ia=ia.dot(wa);wa=1/(Q*S-K*K);S=(S*la-K*ia)*wa;Q=(Q*ia-K*la)*wa;return S>0&&Q>0&&S+Q<
|
|
|
|
+1}var d,g,f,h,i,m,o,t,x,y,B,z=a.geometry,H=z.vertices,J=[];d=0;for(g=z.faces.length;d<g;d++){f=z.faces[d];y=this.origin.clone();B=this.direction.clone();o=a.matrixWorld;h=o.multiplyVector3(H[f.a].position.clone());i=o.multiplyVector3(H[f.b].position.clone());m=o.multiplyVector3(H[f.c].position.clone());o=f instanceof THREE.Face4?o.multiplyVector3(H[f.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(f.normal.clone());x=B.dot(t);if(x<0){t=t.dot((new THREE.Vector3).sub(h,y))/x;y=y.addSelf(B.multiplyScalar(t));
|
|
|
|
+if(f instanceof THREE.Face3){if(c(y,h,i,m)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}else if(f instanceof THREE.Face4&&(c(y,h,i,o)||c(y,i,m,o))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}}return J}};
|
|
|
|
+THREE.Rectangle=function(){function a(){h=g-c;i=f-d}var c,d,g,f,h,i,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return f};this.set=function(o,t,x,y){m=!1;c=o;d=t;g=x;f=y;a()};this.addPoint=function(o,t){if(m){m=!1;c=o;d=t;g=o;f=t}else{c=c<o?c:o;d=d<t?d:t;g=g>o?g:o;f=f>t?f:t}a()};
|
|
|
|
+this.add3Points=function(o,t,x,y,B,z){if(m){m=!1;c=o<x?o<B?o:B:x<B?x:B;d=t<y?t<z?t:z:y<z?y:z;g=o>x?o>B?o:B:x>B?x:B;f=t>y?t>z?t:z:y>z?y:z}else{c=o<x?o<B?o<c?o:c:B<c?B:c:x<B?x<c?x:c:B<c?B:c;d=t<y?t<z?t<d?t:d:z<d?z:d:y<z?y<d?y:d:z<d?z:d;g=o>x?o>B?o>g?o:g:B>g?B:g:x>B?x>g?x:g:B>g?B:g;f=t>y?t>z?t>f?t:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(o){if(m){m=!1;c=o.getLeft();d=o.getTop();g=o.getRight();f=o.getBottom()}else{c=c<o.getLeft()?c:o.getLeft();d=d<o.getTop()?d:o.getTop();g=g>o.getRight()?
|
|
|
|
+g:o.getRight();f=f>o.getBottom()?f:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;g+=o;f+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();g=g<o.getRight()?g:o.getRight();f=f<o.getBottom()?f:o.getBottom();a()};this.instersects=function(o){return Math.min(g,o.getRight())-Math.max(c,o.getLeft())>=0&&Math.min(f,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){m=!0;f=g=d=c=0;a()};this.isEmpty=function(){return m}};
|
|
|
|
+THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
|
|
+THREE.Matrix4=function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.set(a||1,c||0,d||0,g||0,f||0,h||1,i||0,m||0,o||0,t||0,x||1,y||0,B||0,z||0,H||0,J||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=h;this.n23=i;this.n24=m;this.n31=o;this.n32=t;this.n33=x;this.n34=y;this.n41=B;this.n42=z;this.n43=H;this.n44=J;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__v1,
|
|
|
|
+f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;g.cross(d,h).normalize();if(g.length()===0){h.x+=1.0E-4;g.cross(d,h).normalize()}f.cross(h,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=h.x;this.n21=g.y;this.n22=f.y;this.n23=h.y;this.n31=g.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,f=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*
|
|
|
|
+g+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*f;return a},rotateAxis:function(a){var c=a.x,d=a.y,g=a.z;a.x=c*this.n11+d*this.n12+g*this.n13;a.y=c*this.n21+d*this.n22+g*this.n23;a.z=c*this.n31+d*this.n32+g*this.n33;a.normalize();
|
|
|
|
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44,ia=c.n11,la=c.n12,wa=c.n13,S=c.n14,E=c.n21,fa=c.n22,
|
|
|
|
+Y=c.n23,b=c.n24,ra=c.n31,R=c.n32,N=c.n33,pa=c.n34;this.n11=d*ia+g*E+f*ra;this.n12=d*la+g*fa+f*R;this.n13=d*wa+g*Y+f*N;this.n14=d*S+g*b+f*pa+h;this.n21=i*ia+m*E+o*ra;this.n22=i*la+m*fa+o*R;this.n23=i*wa+m*Y+o*N;this.n24=i*S+m*b+o*pa+t;this.n31=x*ia+y*E+B*ra;this.n32=x*la+y*fa+B*R;this.n33=x*wa+y*Y+B*N;this.n34=x*S+y*b+B*pa+z;this.n41=H*ia+J*E+Q*ra;this.n42=H*la+J*fa+Q*R;this.n43=H*wa+J*Y+Q*N;this.n44=H*S+J*b+Q*pa+K;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=
|
|
|
|
+this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
|
|
|
|
+a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,g=this.n14,f=this.n21,h=this.n22,i=this.n23,m=this.n24,o=this.n31,t=this.n32,x=this.n33,y=this.n34,B=this.n41,z=this.n42,H=this.n43,J=this.n44;return g*i*t*B-d*m*t*B-g*h*x*B+c*m*x*B+d*h*y*B-c*i*y*B-g*i*o*z+d*m*o*z+g*f*x*z-a*m*x*z-d*f*y*z+a*i*y*z+g*h*o*H-c*m*o*H-g*f*t*H+a*m*t*H+c*f*y*H-a*h*y*H-d*h*o*J+c*i*o*J+d*f*t*J-a*i*t*J-c*f*x*J+a*h*x*J},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
|
|
this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
|
|
this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
|
|
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
|
|
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
|
|
-a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,
|
|
|
|
-0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),f=Math.sin(b),e=
|
|
|
|
-1-c,h=a.x,j=a.y,p=a.z,n=e*h,s=e*j;this.set(n*h+c,n*j-f*p,n*p+f*j,0,n*j+f*p,s*j+c,s*p-f*h,0,n*p-f*j,s*p+f*h,e*p*p+c,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,c=a.y,f=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=a*c,p=b*c;this.n11=e*h;this.n12=-e*f;this.n13=c;this.n21=p*h+a*f;this.n22=-p*f+a*h;this.n23=-b*e;this.n31=-j*h+b*f;this.n32=j*f+b*h;this.n33=
|
|
|
|
-a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,f=a.z,e=a.w,h=b+b,j=c+c,p=f+f;a=b*h;var n=b*j;b*=p;var s=c*j;c*=p;f*=p;h*=e;j*=e;e*=p;this.n11=1-(s+f);this.n12=n-e;this.n13=b+j;this.n21=n+e;this.n22=1-(a+f);this.n23=c-h;this.n31=b-j;this.n32=c+h;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
|
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,f=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*f;this.n22=a.n22*f;this.n32=a.n32*f;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
|
|
|
|
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*K-s*C*K+s*z*P-p*y*P-n*z*L+p*C*L;b.n12=h*C*K-e*y*K-h*z*P+f*y*P+e*z*L-f*C*L;b.n13=e*s*K-h*n*K+h*p*P-f*s*P-e*p*L+f*n*L;b.n14=h*n*z-e*s*z-h*p*C+f*s*C+e*p*y-f*n*y;b.n21=s*C*J-n*y*J-s*x*P+j*y*P+n*x*L-j*C*L;b.n22=e*y*J-h*C*J+h*x*P-c*y*P-e*x*L+c*C*L;b.n23=h*n*J-e*s*J-h*j*P+c*s*P+e*j*L-c*n*L;
|
|
|
|
-b.n24=e*s*x-h*n*x+h*j*C-c*s*C-e*j*y+c*n*y;b.n31=p*y*J-s*z*J+s*x*K-j*y*K-p*x*L+j*z*L;b.n32=h*z*J-f*y*J-h*x*K+c*y*K+f*x*L-c*z*L;b.n33=e*s*J-h*p*J+h*j*K-c*s*K-f*j*L+c*p*L;b.n34=h*p*x-f*s*x-h*j*z+c*s*z+f*j*y-c*p*y;b.n41=n*z*J-p*C*J-n*x*K+j*C*K+p*x*P-j*z*P;b.n42=f*C*J-e*z*J+e*x*K-c*C*K-f*x*P+c*z*P;b.n43=e*p*J-f*n*J-e*j*K+c*n*K+f*j*P-c*p*P;b.n44=f*n*x-e*p*x+e*j*z-c*n*z-f*j*C+c*p*C;b.multiplyScalar(1/a.determinant());return b};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,f=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*f;c[1]=a*e;c[2]=a*h;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*x;c[8]=a*z;return b};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(a,b,c,f,e,h){var j;j=new THREE.Matrix4;j.n11=2*e/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*e/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+e)/(h-e);j.n34=-2*h*e/(h-e);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,f){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,f)};
|
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,c,f,e,h){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-f;s=h-e;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((h+e)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
|
|
|
+a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,
|
|
|
|
+0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f=
|
|
|
|
+1-d,h=a.x,i=a.y,m=a.z,o=f*h,t=f*i;this.set(o*h+d,o*i-g*m,o*m+g*i,0,o*i+g*m,t*i+d,t*m-g*h,0,o*m-g*i,t*m+g*h,f*m*m+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 c=a.x,d=a.y,g=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(g);g=Math.sin(g);var i=a*d,m=c*d;this.n11=f*h;this.n12=-f*g;this.n13=d;this.n21=m*h+a*g;this.n22=-m*g+a*h;this.n23=-c*f;this.n31=-i*h+c*g;this.n32=i*g+c*h;this.n33=
|
|
|
|
+a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,h=c+c,i=d+d,m=g+g;a=c*h;var o=c*i;c*=m;var t=d*i;d*=m;g*=m;h*=f;i*=f;f*=m;this.n11=1-(t+g);this.n12=o-f;this.n13=c+i;this.n21=o+f;this.n22=1-(a+g);this.n23=d-h;this.n31=c-i;this.n32=d+h;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
|
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,g=1/c.y,f=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*g;this.n22=a.n22*g;this.n32=a.n32*g;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
|
|
|
|
+THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=o*z*J-t*B*J+t*y*Q-m*z*Q-o*y*K+m*B*K;c.n12=h*B*J-f*z*J-h*y*Q+g*z*Q+f*y*K-g*B*K;c.n13=f*t*J-h*o*J+h*m*Q-g*t*Q-f*m*K+g*o*K;c.n14=h*o*y-f*t*y-h*m*B+g*t*B+f*m*z-g*o*z;c.n21=t*B*H-o*z*H-t*x*Q+i*z*Q+o*x*K-i*B*K;c.n22=f*z*H-h*B*H+h*x*Q-d*z*Q-f*x*K+d*B*K;c.n23=h*o*H-f*t*H-h*i*Q+d*t*Q+f*i*K-d*o*K;
|
|
|
|
+c.n24=f*t*x-h*o*x+h*i*B-d*t*B-f*i*z+d*o*z;c.n31=m*z*H-t*y*H+t*x*J-i*z*J-m*x*K+i*y*K;c.n32=h*y*H-g*z*H-h*x*J+d*z*J+g*x*K-d*y*K;c.n33=f*t*H-h*m*H+h*i*J-d*t*J-g*i*K+d*m*K;c.n34=h*m*x-g*t*x-h*i*y+d*t*y+g*i*z-d*m*z;c.n41=o*y*H-m*B*H-o*x*J+i*B*J+m*x*Q-i*y*Q;c.n42=g*B*H-f*y*H+f*x*J-d*B*J-g*x*Q+d*y*Q;c.n43=f*m*H-g*o*H-f*i*J+d*o*J+g*i*Q-d*m*Q;c.n44=g*o*x-f*m*x+f*i*y-d*o*y-g*i*B+d*m*B;c.multiplyScalar(1/a.determinant());return c};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,g=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*i+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*h;d[3]=a*i;d[4]=a*m;d[5]=a*o;d[6]=a*t;d[7]=a*x;d[8]=a*y;return c};
|
|
|
|
+THREE.Matrix4.makeFrustum=function(a,c,d,g,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(c-a);i.n12=0;i.n13=(c+a)/(c-a);i.n14=0;i.n21=0;i.n22=2*f/(g-d);i.n23=(g+d)/(g-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,c,d,g){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,g)};
|
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,d,g,f,h){var i,m,o,t;i=new THREE.Matrix4;m=c-a;o=d-g;t=h-f;i.n11=2/m;i.n12=0;i.n13=0;i.n14=-((c+a)/m);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((d+g)/o);i.n31=0;i.n32=0;i.n33=-2/t;i.n34=-((h+f)/t);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
!0;this._vector=new THREE.Vector3};
|
|
!0;this._vector=new THREE.Vector3};
|
|
-THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
|
|
|
|
-undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var 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))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a<f;a++)this.children[a].update(this.matrixWorld,
|
|
|
|
-b,c)}};THREE.Quaternion=function(a,b,c,f){this.set(a||0,b||0,c||0,f!==undefined?f:1)};
|
|
|
|
-THREE.Quaternion.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,f=a.y*b,e=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var j=a*b,p=f*e;this.w=j*h-p*c;this.x=j*c+p*h;this.y=f*b*h+a*e*c;this.z=a*e*h-f*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
|
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var 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,c=this.y,f=this.z,e=this.w,h=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+e*h+c*p-f*j;this.y=c*a+e*j+f*h-b*p;this.z=f*a+e*p+b*j-c*h;this.w=e*a-b*h-c*j-f*p;return this},
|
|
|
|
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,f=a.y,e=a.z,h=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*e-p*f,x=n*f+p*c-h*e,z=n*e+h*f-j*c;c=-h*c-j*f-p*e;b.x=s*n+c*-h+x*-p-z*-j;b.y=x*n+c*-j+z*-h-s*-p;b.z=z*n+c*-p+s*-j-x*-h;return b}};
|
|
|
|
-THREE.Quaternion.slerp=function(a,b,c,f){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),j=Math.sqrt(1-e*e);if(Math.abs(j)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=a.w*e+b.w*f;c.x=a.x*e+b.x*f;c.y=a.y*e+b.y*f;c.z=a.z*e+b.z*f;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
|
-THREE.Face3=function(a,b,c,f,e,h){this.a=a;this.b=b;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
|
-THREE.Face4=function(a,b,c,f,e,h,j){this.a=a;this.b=b;this.c=c;this.d=f;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(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.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
|
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
|
|
|
|
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,f,e,h,j,p=new THREE.Vector3,n=new THREE.Vector3;f=0;for(e=this.faces.length;f<e;f++){h=this.faces[f];if(a&&h.vertexNormals.length){p.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)p.addSelf(h.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
|
|
|
|
-p.normalize();h.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
|
|
|
|
-this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
|
|
|
|
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function a(V,ha,ia,W,S,ta,ka){p=V.vertices[ha].position;n=V.vertices[ia].position;s=V.vertices[W].position;x=j[S];z=j[ta];C=j[ka];y=n.x-p.x;J=s.x-p.x;K=n.y-p.y;P=s.y-p.y;L=n.z-p.z;ja=s.z-p.z;ma=z.u-x.u;sa=C.u-x.u;U=z.v-x.v;A=C.v-x.v;oa=1/(ma*A-sa*
|
|
|
|
-U);Q.set((A*y-U*J)*oa,(A*K-U*P)*oa,(A*L-U*ja)*oa);N.set((ma*J-sa*y)*oa,(ma*P-sa*K)*oa,(ma*ja-sa*L)*oa);Ba[ha].addSelf(Q);Ba[ia].addSelf(Q);Ba[W].addSelf(Q);Ca[ha].addSelf(N);Ca[ia].addSelf(N);Ca[W].addSelf(N)}var b,c,f,e,h,j,p,n,s,x,z,C,y,J,K,P,L,ja,ma,sa,U,A,oa,d,Ba=[],Ca=[],Q=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,ya=new THREE.Vector3,Da=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Ba[b]=new THREE.Vector3;Ca[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=
|
|
|
|
-this.faces[b];j=this.faceVertexUvs[0][b];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var qa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(f=0;f<h.vertexNormals.length;f++){Da.copy(h.vertexNormals[f]);e=h[qa[f]];d=Ba[e];pa.copy(d);pa.subSelf(Da.multiplyScalar(Da.dot(d))).normalize();ya.cross(h.vertexNormals[f],d);e=ya.dot(Ca[e]);e=e<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(pa.x,
|
|
|
|
-pa.y,pa.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,c=this.vertices.length;b<c;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,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere=
|
|
|
|
|
|
+THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
|
|
|
|
+undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
|
|
|
|
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var g=this.children.length;a<g;a++)this.children[a].update(this.matrixWorld,
|
|
|
|
+c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?g:1)};
|
|
|
|
+THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,m=g*f;this.w=i*h-m*d;this.x=i*d+m*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
|
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,m=a.z;a=a.w;this.x=c*a+f*h+d*m-g*i;this.y=d*a+f*i+g*h-c*m;this.z=g*a+f*m+c*i-d*h;this.w=f*a-c*h-d*i-g*m;return this},
|
|
|
|
+multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,m=this.z,o=this.w,t=o*d+i*f-m*g,x=o*g+m*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-m*f;c.x=t*o+d*-h+x*-m-y*-i;c.y=x*o+d*-i+y*-h-t*-m;c.z=y*o+d*-m+t*-i-x*-h;return c}};
|
|
|
|
+THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
|
+THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
|
+THREE.Face4=function(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
|
|
|
|
+THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;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 c,d,g,f,h,i,m=new THREE.Vector3,o=new THREE.Vector3;g=0;for(f=this.faces.length;g<f;g++){h=this.faces[g];if(a&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];m.sub(i.position,d.position);o.sub(c.position,d.position);m.crossSelf(o)}m.isZero()||
|
|
|
|
+m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var a,c,d,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)g[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;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{g=
|
|
|
|
+this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)g[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal);g[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)g[a].normalize();a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(g[d.a]);
|
|
|
|
+d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(g[d.a]);d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c]);d.vertexNormals[3].copy(g[d.d])}}},computeTangents:function(){function a(T,ga,ha,ja,O,ma,ka){m=T.vertices[ga].position;o=T.vertices[ha].position;t=T.vertices[ja].position;x=i[O];y=i[ma];B=i[ka];z=o.x-m.x;H=t.x-m.x;J=o.y-m.y;Q=t.y-m.y;K=o.z-m.z;ia=t.z-m.z;la=y.u-x.u;wa=B.u-x.u;S=y.v-x.v;E=B.v-x.v;fa=1/(la*E-
|
|
|
|
+wa*S);R.set((E*z-S*H)*fa,(E*J-S*Q)*fa,(E*K-S*ia)*fa);N.set((la*H-wa*z)*fa,(la*Q-wa*J)*fa,(la*ia-wa*K)*fa);b[ga].addSelf(R);b[ha].addSelf(R);b[ja].addSelf(R);ra[ga].addSelf(N);ra[ha].addSelf(N);ra[ja].addSelf(N)}var c,d,g,f,h,i,m,o,t,x,y,B,z,H,J,Q,K,ia,la,wa,S,E,fa,Y,b=[],ra=[],R=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,Aa=new THREE.Vector3,Ba=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;ra[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
|
|
|
|
+this.faces[c];i=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var sa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(g=0;g<h.vertexNormals.length;g++){Ba.copy(h.vertexNormals[g]);f=h[sa[g]];Y=b[f];pa.copy(Y);pa.subSelf(Ba.multiplyScalar(Ba.dot(Y))).normalize();Aa.cross(h.vertexNormals[g],Y);f=Aa.dot(ra[f]);f=f<0?-1:1;h.vertexTangents[g]=new THREE.Vector4(pa.x,
|
|
|
|
+pa.y,pa.z,f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
|
|
|
|
+if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
|
|
{radius:a}}};THREE.GeometryIdCounter=0;
|
|
{radius:a}}};THREE.GeometryIdCounter=0;
|
|
-THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var h=0;h<a.length;h++)a[h].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var h=0;h<e.hierarchy.length;h++){for(var j=0;j<e.hierarchy[h].keys.length;j++){if(e.hierarchy[h].keys[j].time<
|
|
|
|
-0)e.hierarchy[h].keys[j].time=0;if(e.hierarchy[h].keys[j].rot!==undefined&&!(e.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var p=e.hierarchy[h].keys[j].rot;e.hierarchy[h].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(e.hierarchy[h].keys[0].morphTargets!==undefined){p={};for(j=0;j<e.hierarchy[h].keys.length;j++)for(var n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++){var s=e.hierarchy[h].keys[j].morphTargets[n];p[s]=-1}e.hierarchy[h].usedMorphTargets=p;for(j=0;j<e.hierarchy[h].keys.length;j++){var x=
|
|
|
|
-{};for(s in p){for(n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++)if(e.hierarchy[h].keys[j].morphTargets[n]===s){x[s]=e.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===e.hierarchy[h].keys[j].morphTargets.length&&(x[s]=0)}e.hierarchy[h].keys[j].morphTargetsInfluences=x}}for(j=1;j<e.hierarchy[h].keys.length;j++)if(e.hierarchy[h].keys[j].time===e.hierarchy[h].keys[j-1].time){e.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<e.hierarchy[h].keys.length;j++)e.hierarchy[h].keys[j].index=j}j=parseInt(e.length*
|
|
|
|
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(h=0;h<e.hierarchy.length;h++)e.JIT.hierarchy.push(Array(j));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var h=[];if(e instanceof THREE.SkinnedMesh)for(var j=0;j<e.bones.length;j++)h.push(e.bones[j]);else f(e,h);return h};var f=function(e,h){h.push(e);for(var j=0;j<e.children.length;j++)f(e.children[j],h)};c.LINEAR=
|
|
|
|
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,f){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
|
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,f=this.hierarchy.length,e;for(c=0;c<f;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
|
|
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
|
|
|
+THREE.AnimationHandler=function(){var a=[],c={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var i=0;i<f.hierarchy[h].keys.length;i++){if(f.hierarchy[h].keys[i].time<
|
|
|
|
+0)f.hierarchy[h].keys[i].time=0;if(f.hierarchy[h].keys[i].rot!==undefined&&!(f.hierarchy[h].keys[i].rot instanceof THREE.Quaternion)){var m=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){m={};for(i=0;i<f.hierarchy[h].keys.length;i++)for(var o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++){var t=f.hierarchy[h].keys[i].morphTargets[o];m[t]=-1}f.hierarchy[h].usedMorphTargets=m;for(i=0;i<f.hierarchy[h].keys.length;i++){var x=
|
|
|
|
+{};for(t in m){for(o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++)if(f.hierarchy[h].keys[i].morphTargets[o]===t){x[t]=f.hierarchy[h].keys[i].morphTargetsInfluences[o];break}o===f.hierarchy[h].keys[i].morphTargets.length&&(x[t]=0)}f.hierarchy[h].keys[i].morphTargetsInfluences=x}}for(i=1;i<f.hierarchy[h].keys.length;i++)if(f.hierarchy[h].keys[i].time===f.hierarchy[h].keys[i-1].time){f.hierarchy[h].keys.splice(i,1);i--}for(i=1;i<f.hierarchy[h].keys.length;i++)f.hierarchy[h].keys[i].index=i}i=parseInt(f.length*
|
|
|
|
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(i));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var i=0;i<f.bones.length;i++)h.push(f.bones[i]);else g(f,h);return h};var g=function(f,h){h.push(f);for(var i=0;i<f.children.length;i++)g(f.children[i],h)};d.LINEAR=
|
|
|
|
+0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,c,d,g){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==undefined?g:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
|
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var d,g=this.hierarchy.length,f;for(d=0;d<g;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
|
|
|
|
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,f,e,h,j,p,n,s,x=this.data.JIT.hierarchy,z,C;this.currentTime+=a*this.timeScale;C=this.currentTime;z=this.currentTime%=this.data.length;s=parseInt(Math.min(z*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,J=this.hierarchy.length;y<J;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&x[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
|
-!1}else{a.matrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var K=0;K<3;K++){c=b[K];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=C){if(z<C)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<z;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
|
|
|
|
-z)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(z-j.time)/(p.time-j.time);e=j[c];h=p[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+y);f=f<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
|
-this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=e;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;f=f*0.33+0.33;e=this.interpolateCatmullRom(this.points,f);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,f,0)}}}else if(c===
|
|
|
|
-"rot")THREE.Quaternion.slerp(e,h,a.quaternion,f);else if(c==="scl"){c=a.scale;c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}}}}if(this.JITCompile&&x[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)x[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],f=[],e,h,j,p,n,s;e=(a.length-1)*b;h=Math.floor(e);e-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=e*e;j=e*c;f[0]=this.interpolate(h[0],p[0],n[0],s[0],e,c,j);f[1]=this.interpolate(h[1],p[1],n[1],s[1],e,c,j);f[2]=this.interpolate(h[2],p[2],n[2],s[2],e,c,j);return f};
|
|
|
|
-THREE.Animation.prototype.interpolate=function(a,b,c,f,e,h,j){a=(c-a)*0.5;f=(f-b)*0.5;return(2*(b-c)+a+f)*j+(-3*(b-c)-2*a-f)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[0]};
|
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[f.length-1]};
|
|
|
|
-THREE.Camera=function(a,b,c,f,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=f||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
-THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
|
|
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
|
-!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,c)};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.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],d,g,f,h,i,m,o,t,x=this.data.JIT.hierarchy,y,B;this.currentTime+=a*this.timeScale;B=this.currentTime;y=this.currentTime%=this.data.length;t=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,H=this.hierarchy.length;z<H;z++){a=this.hierarchy[z];o=a.animationCache;if(this.JITCompile&&x[z][t]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
|
+!1}else{a.matrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var J=0;J<3;J++){d=c[J];i=o.prevKey[d];m=o.nextKey[d];if(m.time<=B){if(y<B)if(this.loop){i=this.data.hierarchy[z].keys[0];for(m=this.getNextKeyWith(d,z,1);m.time<y;){i=m;m=this.getNextKeyWith(d,z,m.index+1)}}else{this.stop();return}else{do{i=m;m=this.getNextKeyWith(d,z,m.index+1)}while(m.time<
|
|
|
|
+y)}o.prevKey[d]=i;o.nextKey[d]=m}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-i.time)/(m.time-i.time);f=i[d];h=m[d];if(g<0||g>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+z);g=g<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
|
+this.getPrevKeyWith("pos",z,i.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",z,m.index+1).pos;g=g*0.33+0.33;f=this.interpolateCatmullRom(this.points,g);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){g=this.interpolateCatmullRom(this.points,g*1.01);this.target.set(g[0],g[1],g[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();g=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,g,0)}}}else if(d===
|
|
|
|
+"rot")THREE.Quaternion.slerp(f,h,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}}}}if(this.JITCompile&&x[0][t]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)x[z][t]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var d=[],g=[],f,h,i,m,o,t;f=(a.length-1)*c;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];m=a[d[1]];o=a[d[2]];t=a[d[3]];d=f*f;i=f*d;g[0]=this.interpolate(h[0],m[0],o[0],t[0],f,d,i);g[1]=this.interpolate(h[1],m[1],o[1],t[1],f,d,i);g[2]=this.interpolate(h[2],m[2],o[2],t[2],f,d,i);return g};
|
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,d,g,f,h,i){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*i+(-3*(c-d)-2*a-g)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<g.length-1?d:g.length-1;else d%=g.length;for(;d<g.length;d++)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[0]};
|
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
|
|
|
|
+THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
|
|
+THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
|
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
|
|
THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.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.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.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.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=
|
|
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=
|
|
@@ -109,48 +109,54 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
|
|
if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
|
|
a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
|
a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
|
-THREE.Texture=function(a,b,c,f,e,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
|
|
|
|
+THREE.ShadowVolumeDynamicMaterial=function(){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.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
|
|
|
|
+!1};THREE.Texture=function(a,c,d,g,f,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=g!==undefined?g:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
|
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
|
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
-THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
|
|
|
-var Uniforms={clone:function(a){var b,c,f,e={};for(b in a){e[b]={};for(c in a[b]){f=a[b][c];e[b][c]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return e},merge:function(a){var b,c,f,e={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(c in f)e[c]=f[c]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
|
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,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,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
|
|
|
+THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
|
|
+var Uniforms={clone:function(a){var c,d,g,f={};for(c in a){f[c]={};for(d in a[c]){g=a[c][d];f[c][d]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return f},merge:function(a){var c,d,g,f={};for(c=0;c<a.length;c++){g=this.clone(a[c]);for(d in g)f[d]=g[d]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
|
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
THREE.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;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
|
|
|
|
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
|
|
|
|
|
|
+THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
|
|
|
|
+this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Bone=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,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(f=0;f<e;f++)this.children[f].update(this.skinMatrix,
|
|
|
|
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
|
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,f,e,h,j,p;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];h=e.pos;j=e.rotq;p=e.scl;f=this.addBone();f.name=e.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;p!==undefined?f.scale.set(p[0],p[1],p[2]):f.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){e=this.geometry.bones[c];
|
|
|
|
-f=this.bones[c];e.parent===-1?this.addChild(f):this.bones[e.parent].addChild(f)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
|
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
|
|
|
|
-b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
|
|
|
|
-f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(f));f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(f));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
|
|
|
|
-THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
|
|
-THREE.Sound=function(a,b,c,f){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,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
|
|
|
|
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
|
|
+THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(g=0;g<f;g++)this.children[g].update(this.skinMatrix,
|
|
|
|
+c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
|
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,g,f,h,i,m;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;i=f.rotq;m=f.scl;g=this.addBone();g.name=f.name;g.position.set(h[0],h[1],h[2]);g.quaternion.set(i[0],i[1],i[2],i[3]);g.useQuaternion=!0;m!==undefined?g.scale.set(m[0],m[1],m[2]):g.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
|
|
|
|
+g=this.bones[d];f.parent===-1?this.addChild(g):this.bones[f.parent].addChild(g)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
|
+THREE.SkinnedMesh.prototype.update=function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,c,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
|
+c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],d=0;d<this.bones.length;d++){a=this.bones[d];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var g;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
|
|
|
|
+g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(g));g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(g));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
|
|
|
|
+THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
|
|
+THREE.Sound=function(a,c,d,g){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=g!==undefined?g:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
|
|
|
|
+"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Sound.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.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.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,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
|
|
-THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
|
|
|
|
-THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(a>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
|
|
|
|
-!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
-THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var 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);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}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,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
|
|
|
|
-THREE.Projector=function(){function a(){var Q=n[p]=n[p]||new THREE.RenderableVertex;p++;return Q}function b(Q,N){return N.z-Q.z}function c(Q,N){var pa=0,ya=1,Da=Q.z+Q.w,qa=N.z+N.w,V=-Q.z+Q.w,ha=-N.z+N.w;if(Da>=0&&qa>=0&&V>=0&&ha>=0)return!0;else if(Da<0&&qa<0||V<0&&ha<0)return!1;else{if(Da<0)pa=Math.max(pa,Da/(Da-qa));else qa<0&&(ya=Math.min(ya,Da/(Da-qa)));if(V<0)pa=Math.max(pa,V/(V-ha));else ha<0&&(ya=Math.min(ya,V/(V-ha)));if(ya<pa)return!1;else{Q.lerpSelf(N,pa);N.lerpSelf(Q,1-ya);return!0}}}var f,
|
|
|
|
-e,h=[],j,p,n=[],s,x,z=[],C,y=[],J,K,P=[],L,ja,ma=[],sa=new THREE.Vector4,U=new THREE.Vector4,A=new THREE.Matrix4,oa=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Vector4,Ca=new THREE.Vector4;this.projectVector=function(Q,N){A.multiply(N.projectionMatrix,N.matrixWorldInverse);A.multiplyVector3(Q);return Q};this.unprojectVector=function(Q,N){A.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
|
|
|
|
-A.multiplyVector3(Q);return Q};this.projectObjects=function(Q,N,pa){N=[];var ya,Da,qa;e=0;Da=Q.objects;Q=0;for(ya=Da.length;Q<ya;Q++){qa=Da[Q];var V;if(!(V=!qa.visible))if(V=qa instanceof THREE.Mesh){a:{V=void 0;for(var ha=qa.matrixWorld,ia=-qa.geometry.boundingSphere.radius*Math.max(qa.scale.x,Math.max(qa.scale.y,qa.scale.z)),W=0;W<6;W++){V=d[W].x*ha.n14+d[W].y*ha.n24+d[W].z*ha.n34+d[W].w;if(V<=ia){V=!1;break a}}V=!0}V=!V}if(!V){V=h[e]=h[e]||new THREE.RenderableObject;e++;f=V;sa.copy(qa.position);
|
|
|
|
-A.multiplyVector3(sa);f.object=qa;f.z=sa.z;N.push(f)}}pa&&N.sort(b);return N};this.projectScene=function(Q,N,pa){var ya=[],Da=N.near,qa=N.far,V,ha,ia,W,S,ta,ka,za,La,la,Na,Wa,g,m,o,i,k;ja=K=C=x=0;N.matrixAutoUpdate&&N.updateMatrix();Q.update(undefined,!1,N);A.multiply(N.projectionMatrix,N.matrixWorldInverse);d[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);d[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);d[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);d[3].set(A.n41-A.n21,
|
|
|
|
-A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);d[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);d[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(V=0;V<6;V++){La=d[V];La.divideScalar(Math.sqrt(La.x*La.x+La.y*La.y+La.z*La.z))}La=this.projectObjects(Q,N,!0);Q=0;for(V=La.length;Q<V;Q++){la=La[Q].object;if(la.visible){Na=la.matrixWorld;Wa=la.matrixRotationWorld;g=la.materials;m=la.overdraw;p=0;if(la instanceof THREE.Mesh){o=la.geometry;W=o.vertices;i=o.faces;o=o.faceVertexUvs;ha=0;for(ia=W.length;ha<
|
|
|
|
-ia;ha++){j=a();j.positionWorld.copy(W[ha].position);Na.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);A.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Da&&j.positionScreen.z<qa}W=0;for(ha=i.length;W<ha;W++){ia=i[W];if(ia instanceof THREE.Face3){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];if(S.visible&&ta.visible&&ka.visible&&(la.doubleSided||la.flipSided!=(ka.positionScreen.x-S.positionScreen.x)*
|
|
|
|
-(ta.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(ta.positionScreen.x-S.positionScreen.x)<0)){za=z[x]=z[x]||new THREE.RenderableFace3;x++;s=za;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka)}else continue}else if(ia instanceof THREE.Face4){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];za=n[ia.d];if(S.visible&&ta.visible&&ka.visible&&za.visible&&(la.doubleSided||la.flipSided!=((za.positionScreen.x-S.positionScreen.x)*(ta.positionScreen.y-S.positionScreen.y)-(za.positionScreen.y-S.positionScreen.y)*
|
|
|
|
-(ta.positionScreen.x-S.positionScreen.x)<0||(ta.positionScreen.x-ka.positionScreen.x)*(za.positionScreen.y-ka.positionScreen.y)-(ta.positionScreen.y-ka.positionScreen.y)*(za.positionScreen.x-ka.positionScreen.x)<0))){k=y[C]=y[C]||new THREE.RenderableFace4;C++;s=k;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka);s.v4.copy(za)}else continue}s.normalWorld.copy(ia.normal);Wa.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ia.centroid);Na.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);
|
|
|
|
-A.multiplyVector3(s.centroidScreen);ka=ia.vertexNormals;S=0;for(ta=ka.length;S<ta;S++){za=s.vertexNormalsWorld[S];za.copy(ka[S]);Wa.multiplyVector3(za)}S=0;for(ta=o.length;S<ta;S++)if(k=o[S][W]){ka=0;for(za=k.length;ka<za;ka++)s.uvs[S][ka]=k[ka]}s.meshMaterials=g;s.faceMaterials=ia.materials;s.overdraw=m;s.z=s.centroidScreen.z;ya.push(s)}}else if(la instanceof THREE.Line){oa.multiply(A,Na);W=la.geometry.vertices;S=a();S.positionScreen.copy(W[0].position);oa.multiplyVector4(S.positionScreen);ha=1;
|
|
|
|
-for(ia=W.length;ha<ia;ha++){S=a();S.positionScreen.copy(W[ha].position);oa.multiplyVector4(S.positionScreen);ta=n[p-2];Ba.copy(S.positionScreen);Ca.copy(ta.positionScreen);if(c(Ba,Ca)){Ba.multiplyScalar(1/Ba.w);Ca.multiplyScalar(1/Ca.w);Na=P[K]=P[K]||new THREE.RenderableLine;K++;J=Na;J.v1.positionScreen.copy(Ba);J.v2.positionScreen.copy(Ca);J.z=Math.max(Ba.z,Ca.z);J.materials=la.materials;ya.push(J)}}}else if(la instanceof THREE.Particle){U.set(la.position.x,la.position.y,la.position.z,1);A.multiplyVector4(U);
|
|
|
|
-U.z/=U.w;if(U.z>0&&U.z<1){Na=ma[ja]=ma[ja]||new THREE.RenderableParticle;ja++;L=Na;L.x=U.x/U.w;L.y=U.y/U.w;L.z=U.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(U.x+N.projectionMatrix.n11)/(U.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(U.y+N.projectionMatrix.n22)/(U.w+N.projectionMatrix.n24));L.materials=la.materials;ya.push(L)}}}}pa&&ya.sort(b);return ya}};
|
|
|
|
-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,c){c&&a.update(undefined,!1,b);c=a.sounds;var f,e=c.length;for(f=0;f<e;f++){a=c[f];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.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g=this.children.length;for(a=0;a<g;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
|
|
|
|
+THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
|
|
|
|
+THREE.LOD.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g<this.LODs.length;g++)if(a>=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible=
|
|
|
|
+!1;this.LODs[g].object3D.visible=!0}else break;for(;g<this.LODs.length;g++)this.LODs[g].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
|
|
|
|
+THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,g=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var h=f.length,i,m,o,t,x,y=["a","b","c","d"];for(o=0;o<h;o++){m=c.length;i=f[o];if(i instanceof THREE.Face4){t=4;m=new THREE.Face4(m,m+1,m+2,m+3)}else{t=3;m=new THREE.Face3(m,m+1,m+2)}m.normal.copy(i.normal);d.push(m);for(m=
|
|
|
|
+0;m<t;m++){x=a[i[y[m]]];c.push(new THREE.Vertex(x.position.clone()))}}for(h=0;h<f.length-1;h++){a=d[h];for(i=h+1;i<f.length;i++){m=d[i];m=this.facesShareEdge(c,a,m);if(m!==undefined){m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]);m.normal.set(1,0,0);g.push(m)}}}};
|
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,h,i,m,o,t,x,y,B,z,H,J,Q=0,K=["a","b","c","d"];g=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(H=0;H<g;H++){h=c[K[H]];m=a[h];for(J=0;J<f;J++){i=d[K[J]];o=a[i];if(Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4){Q++;if(Q===1){t=m;x=o;y=h;B=i;z=K[H]}if(Q===2){z+=K[H];return z==="ad"||z==="ac"?{faces:[c,d],vertices:[t,x,o,m],indices:[y,
|
|
|
|
+B,i,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[t,m,o,x],indices:[y,h,i,B],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
|
|
|
|
+THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
|
|
|
|
+THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
|
|
|
|
+THREE.Projector=function(){function a(){var R=o[m]=o[m]||new THREE.RenderableVertex;m++;return R}function c(R,N){return N.z-R.z}function d(R,N){var pa=0,Aa=1,Ba=R.z+R.w,sa=N.z+N.w,T=-R.z+R.w,ga=-N.z+N.w;if(Ba>=0&&sa>=0&&T>=0&&ga>=0)return!0;else if(Ba<0&&sa<0||T<0&&ga<0)return!1;else{if(Ba<0)pa=Math.max(pa,Ba/(Ba-sa));else sa<0&&(Aa=Math.min(Aa,Ba/(Ba-sa)));if(T<0)pa=Math.max(pa,T/(T-ga));else ga<0&&(Aa=Math.min(Aa,T/(T-ga)));if(Aa<pa)return!1;else{R.lerpSelf(N,pa);N.lerpSelf(R,1-Aa);return!0}}}var g,
|
|
|
|
+f,h=[],i,m,o=[],t,x,y=[],B,z=[],H,J,Q=[],K,ia,la=[],wa=new THREE.Vector4,S=new THREE.Vector4,E=new THREE.Matrix4,fa=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],b=new THREE.Vector4,ra=new THREE.Vector4;this.projectVector=function(R,N){E.multiply(N.projectionMatrix,N.matrixWorldInverse);E.multiplyVector3(R);return R};this.unprojectVector=function(R,N){E.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
|
|
|
|
+E.multiplyVector3(R);return R};this.projectObjects=function(R,N,pa){N=[];var Aa,Ba,sa;f=0;Ba=R.objects;R=0;for(Aa=Ba.length;R<Aa;R++){sa=Ba[R];var T;if(!(T=!sa.visible))if(T=sa instanceof THREE.Mesh){a:{T=void 0;for(var ga=sa.matrixWorld,ha=-sa.geometry.boundingSphere.radius*Math.max(sa.scale.x,Math.max(sa.scale.y,sa.scale.z)),ja=0;ja<6;ja++){T=Y[ja].x*ga.n14+Y[ja].y*ga.n24+Y[ja].z*ga.n34+Y[ja].w;if(T<=ha){T=!1;break a}}T=!0}T=!T}if(!T){T=h[f]=h[f]||new THREE.RenderableObject;f++;g=T;wa.copy(sa.position);
|
|
|
|
+E.multiplyVector3(wa);g.object=sa;g.z=wa.z;N.push(g)}}pa&&N.sort(c);return N};this.projectScene=function(R,N,pa){var Aa=[],Ba=N.near,sa=N.far,T,ga,ha,ja,O,ma,ka,Ca,Fa,na,Ea,Wa,Ya,xa,e,p,n;ia=J=B=x=0;N.matrixAutoUpdate&&N.updateMatrix();R.update(undefined,!1,N);E.multiply(N.projectionMatrix,N.matrixWorldInverse);Y[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);Y[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);Y[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);Y[3].set(E.n41-
|
|
|
|
+E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);Y[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);Y[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(T=0;T<6;T++){Fa=Y[T];Fa.divideScalar(Math.sqrt(Fa.x*Fa.x+Fa.y*Fa.y+Fa.z*Fa.z))}Fa=this.projectObjects(R,N,!0);R=0;for(T=Fa.length;R<T;R++){na=Fa[R].object;if(na.visible){Ea=na.matrixWorld;Wa=na.matrixRotationWorld;Ya=na.materials;xa=na.overdraw;m=0;if(na instanceof THREE.Mesh){e=na.geometry;ja=e.vertices;p=e.faces;e=e.faceVertexUvs;ga=0;
|
|
|
|
+for(ha=ja.length;ga<ha;ga++){i=a();i.positionWorld.copy(ja[ga].position);Ea.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);E.multiplyVector4(i.positionScreen);i.positionScreen.x/=i.positionScreen.w;i.positionScreen.y/=i.positionScreen.w;i.visible=i.positionScreen.z>Ba&&i.positionScreen.z<sa}ja=0;for(ga=p.length;ja<ga;ja++){ha=p[ja];if(ha instanceof THREE.Face3){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];if(O.visible&&ma.visible&&ka.visible&&(na.doubleSided||na.flipSided!=(ka.positionScreen.x-
|
|
|
|
+O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(ka.positionScreen.y-O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0)){Ca=y[x]=y[x]||new THREE.RenderableFace3;x++;t=Ca;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka)}else continue}else if(ha instanceof THREE.Face4){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];Ca=o[ha.d];if(O.visible&&ma.visible&&ka.visible&&Ca.visible&&(na.doubleSided||na.flipSided!=((Ca.positionScreen.x-O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(Ca.positionScreen.y-
|
|
|
|
+O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0||(ma.positionScreen.x-ka.positionScreen.x)*(Ca.positionScreen.y-ka.positionScreen.y)-(ma.positionScreen.y-ka.positionScreen.y)*(Ca.positionScreen.x-ka.positionScreen.x)<0))){n=z[B]=z[B]||new THREE.RenderableFace4;B++;t=n;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka);t.v4.copy(Ca)}else continue}t.normalWorld.copy(ha.normal);Wa.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);Ea.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);
|
|
|
|
+E.multiplyVector3(t.centroidScreen);ka=ha.vertexNormals;O=0;for(ma=ka.length;O<ma;O++){Ca=t.vertexNormalsWorld[O];Ca.copy(ka[O]);Wa.multiplyVector3(Ca)}O=0;for(ma=e.length;O<ma;O++)if(n=e[O][ja]){ka=0;for(Ca=n.length;ka<Ca;ka++)t.uvs[O][ka]=n[ka]}t.meshMaterials=Ya;t.faceMaterials=ha.materials;t.overdraw=xa;t.z=t.centroidScreen.z;Aa.push(t)}}else if(na instanceof THREE.Line){fa.multiply(E,Ea);ja=na.geometry.vertices;O=a();O.positionScreen.copy(ja[0].position);fa.multiplyVector4(O.positionScreen);
|
|
|
|
+ga=1;for(ha=ja.length;ga<ha;ga++){O=a();O.positionScreen.copy(ja[ga].position);fa.multiplyVector4(O.positionScreen);ma=o[m-2];b.copy(O.positionScreen);ra.copy(ma.positionScreen);if(d(b,ra)){b.multiplyScalar(1/b.w);ra.multiplyScalar(1/ra.w);Ea=Q[J]=Q[J]||new THREE.RenderableLine;J++;H=Ea;H.v1.positionScreen.copy(b);H.v2.positionScreen.copy(ra);H.z=Math.max(b.z,ra.z);H.materials=na.materials;Aa.push(H)}}}else if(na instanceof THREE.Particle){S.set(na.position.x,na.position.y,na.position.z,1);E.multiplyVector4(S);
|
|
|
|
+S.z/=S.w;if(S.z>0&&S.z<1){Ea=la[ia]=la[ia]||new THREE.RenderableParticle;ia++;K=Ea;K.x=S.x/S.w;K.y=S.y/S.w;K.z=S.z;K.rotation=na.rotation.z;K.scale.x=na.scale.x*Math.abs(K.x-(S.x+N.projectionMatrix.n11)/(S.w+N.projectionMatrix.n14));K.scale.y=na.scale.y*Math.abs(K.y-(S.y+N.projectionMatrix.n22)/(S.w+N.projectionMatrix.n24));K.materials=na.materials;Aa.push(K)}}}}pa&&Aa.sort(c);return Aa}};
|
|
|
|
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var g,f=d.length;for(g=0;g<f;g++){a=d[g];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
envmap_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",
|
|
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",
|
|
@@ -164,90 +170,98 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
|
|
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)},morphTargetInfluences:{type:"f",
|
|
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)},morphTargetInfluences:{type:"f",
|
|
value:0}},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},scale:{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:0}},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},scale:{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)}}};
|
|
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.ShaderChunk.color_pars_fragment,
|
|
|
|
-THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,
|
|
|
|
-THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),
|
|
|
|
-fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
|
|
|
|
-THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
|
|
-THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_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.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
|
|
|
|
+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.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
|
|
|
|
+THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
|
|
|
|
+THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
|
|
|
|
+THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
|
|
|
|
+THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
|
|
|
|
+THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_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.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
-THREE.WebGLRenderer=function(a){function b(g,m,o){var i,k,t,q=g.vertices,r=q.length,D=g.colors,w=D.length,v=g.__vertexArray,M=g.__colorArray,X=g.__sortArray,G=g.__dirtyVertices,R=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(i=0;i<r;i++){k=q[i].position;za.copy(k);S.multiplyVector3(za);X[i]=[za.z,i]}X.sort(function(H,Z){return Z[0]-H[0]});for(i=0;i<r;i++){k=q[X[i][1]].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(i=0;i<w;i++){t=i*3;color=D[X[i][1]];M[t]=color.r;M[t+1]=
|
|
|
|
-color.g;M[t+2]=color.b}}else{if(G)for(i=0;i<r;i++){k=q[i].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(R)for(i=0;i<w;i++){color=D[i];t=i*3;M[t]=color.r;M[t+1]=color.g;M[t+2]=color.b}}if(G||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(R||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,M,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
|
|
|
|
-function f(g,m,o,i,k){i.program||Q.initMaterial(i,m,o,k);var t=i.program,q=t.uniforms,r=i.uniforms;if(t!=Ba){d.useProgram(t);Ba=t}d.uniformMatrix4fv(q.projectionMatrix,!1,ta);if(o&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
|
|
|
|
-THREE.FogExp2)r.fogDensity.value=o.density}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var D,w,v=0,M=0,X=0,G,R,H,Z=La,Ga=Z.directional.colors,T=Z.directional.positions,$=Z.point.colors,B=Z.point.positions,Aa=0,Y=0;o=w=w=0;for(D=m.length;o<D;o++){w=m[o];G=w.color;R=w.position;H=w.intensity;if(w instanceof THREE.AmbientLight){v+=G.r;M+=G.g;X+=G.b}else if(w instanceof THREE.DirectionalLight){w=Aa*3;Ga[w]=G.r*H;Ga[w+1]=G.g*H;Ga[w+2]=G.b*H;T[w]=R.x;T[w+1]=
|
|
|
|
-R.y;T[w+2]=R.z;Aa+=1}else if(w instanceof THREE.PointLight){w=Y*3;$[w]=G.r*H;$[w+1]=G.g*H;$[w+2]=G.b*H;B[w]=R.x;B[w+1]=R.y;B[w+2]=R.z;Y+=1}}for(o=Aa*3;o<Ga.length;o++)Ga[o]=0;for(o=Y*3;o<$.length;o++)$[o]=0;Z.point.length=Y;Z.directional.length=Aa;Z.ambient[0]=v;Z.ambient[1]=M;Z.ambient[2]=X;m=La;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
|
|
|
|
-r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.map.texture=i.map;r.lightMap.texture=i.lightMap;r.envMap.texture=i.envMap;r.reflectivity.value=i.reflectivity;r.refractionRatio.value=i.refractionRatio;r.combine.value=i.combine;r.useRefract.value=
|
|
|
|
-i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.size.value=i.size;r.scale.value=oa.height/2;r.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(i.ambient.r,
|
|
|
|
-i.ambient.g,i.ambient.b);r.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);r.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)r.opacity.value=i.opacity;for(var Ha in r)if(v=t.uniforms[Ha]){o=r[Ha];D=o.type;m=o.value;if(D=="i")d.uniform1i(v,m);else if(D=="f")d.uniform1f(v,m);else if(D=="fv1")d.uniform1fv(v,m);else if(D=="fv")d.uniform3fv(v,m);else if(D==
|
|
|
|
-"v2")d.uniform2f(v,m.x,m.y);else if(D=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(D=="c")d.uniform3f(v,m.r,m.g,m.b);else if(D=="t"){d.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[D])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
|
|
|
|
-o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[D]);o.__wasSetOnce=!0}ja(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
|
|
|
|
-d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||
|
|
|
|
-i.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,ka);if(i.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,ka);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
|
|
|
|
-function e(g,m,o,i,k,t){if(i.opacity!=0){g=f(g,m,o,i,t).attributes;if(i.morphTargets){m=i.program.attributes;t.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[t.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(m.position,3,d.FLOAT,!1,0,0);if(t.morphTargetForcedOrder.length){o=0;for(var q=t.morphTargetForcedOrder,r=t.morphTargetInfluences;o<i.numSupportedMorphTargets&&o<q.length;){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
|
|
|
|
-d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var D=-1,w=0;r=t.morphTargetInfluences;var v,M=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<i.numSupportedMorphTargets;){for(v=0;v<M;v++)if(!q[v]&&r[v]>D){w=v;D=r[w]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[w]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=D;q[w]=1;D=-1;o++}}d.uniform1fv(i.program.uniforms.morphTargetInfluences,
|
|
|
|
-t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
|
|
|
|
-k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(i.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
|
|
|
|
-4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(i.wireframe){d.lineWidth(i.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES,
|
|
|
|
-k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(i.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
|
|
|
|
-d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,
|
|
|
|
-3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(pa!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);pa=g.flipSided}}function p(g){if(Da!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Da=g}}function n(g){W[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);W[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);W[2].set(g.n41+g.n21,g.n42+g.n22,
|
|
|
|
-g.n43+g.n23,g.n44+g.n24);W[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);W[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);W[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=W[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),i=0;i<6;i++){g=W[i].x*m.n14+W[i].y*m.n24+W[i].z*m.n34+W[i].w;if(g<=o)return!1}return!0}function x(g,
|
|
|
|
-m){g.list[g.count]=m;g.count+=1}function z(g){var m,o,i=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=i.materials.length;g<m;g++){o=i.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?x(t,o):x(k,o)}}function C(g){var m,o,i,k,t=g.object,q=g.buffer,r=g.opaque,D=g.transparent;D.count=0;g=r.count=0;for(i=t.materials.length;g<i;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
|
|
|
|
-1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k)}}}function y(g,m){return m.z-g.z}function J(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(X){var G=[];o=0;for(i=X.length;o<i;o++)X[o]==undefined?G.push("undefined"):G.push(X[o].id);return G.join("_")}var o,
|
|
|
|
-i,k,t,q,r,D,w,v={},M=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;D=m(r);v[D]==undefined&&(v[D]={hash:D,counter:0});w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]={faces:[],materials:r,vertices:0,numMorphTargets:M});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[w].vertices+q>65535){v[D].counter+=1;w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]=
|
|
|
|
-{faces:[],materials:r,vertices:0,numMorphTargets:M})}g.geometryGroups[w].faces.push(k);g.geometryGroups[w].vertices+=q}}function P(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ya){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
|
|
|
|
-break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}ya=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,A(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,A(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,A(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,A(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
|
|
|
|
-d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,U(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,U(m.minFilter))}}function ma(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
|
|
|
|
-g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,A(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,A(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,A(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,A(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,A(g.format),g.width,g.height,0,A(g.format),A(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
|
|
|
|
-d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ha;g=ia}if(m!=Ca){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(qa,V,o,g);Ca=m}}function sa(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
|
|
|
|
-d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function U(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function A(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
|
|
|
|
-case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
|
|
|
|
-case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var oa=document.createElement("canvas"),d,Ba=null,Ca=null,Q=this,N=null,pa=null,ya=null,Da=null,qa=0,V=0,ha=0,ia=0,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
|
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,ta=new Float32Array(16),ka=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Wa=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Wa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=
|
|
|
|
-!0;(function(g,m,o){try{if(!(d=oa.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(i){console.error(i)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(la,Na,Wa);this.context=d;this.setSize=function(g,m){oa.width=g;oa.height=m;this.setViewport(0,0,oa.width,oa.height)};
|
|
|
|
-this.setViewport=function(g,m,o,i){qa=g;V=m;ha=o;ia=i;d.viewport(qa,V,ha,ia)};this.setScissor=function(g,m,o,i){d.scissor(g,m,o,i)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
|
|
|
|
-function(g,m,o,i){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
|
|
|
|
-c(g,THREE.ShaderLib.particle_basic);var r,D,w,v;q=w=v=0;for(r=m.length;q<r;q++){D=m[q];D instanceof THREE.DirectionalLight&&w++;D instanceof THREE.PointLight&&v++}if(v+w<=4)m=w;else{m=Math.ceil(4*w/(v+w));v=4-m}q={directional:m,point:v};r=50;if(i!==undefined&&i instanceof THREE.SkinnedMesh)r=i.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
|
|
|
|
-maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=d.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
|
-r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
|
-d.attachShader(o,sa("fragment",q+v));d.attachShader(o,sa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
|
|
|
|
-k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=d.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(t in g.attributes)o.push(t);t=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];t.attributes[m]=d.getAttribLocation(t,m)}t=g.program.attributes;d.enableVertexAttribArray(t.position);t.color>=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal);
|
|
|
|
-t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1);
|
|
|
|
-g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>=
|
|
|
|
-0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}i.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)i.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,i){var k,t,q,r,D,w,v,M,X=g.lights,G=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(ka);m.projectionMatrix.flattenToArray(ta);S.multiply(m.projectionMatrix,m.matrixWorldInverse);n(S);this.initWebGLObjects(g);
|
|
|
|
-ma(o);(this.autoClear||i)&&this.clear();D=g.__webglObjects.length;for(i=0;i<D;i++){k=g.__webglObjects[i];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);C(k);k.render=!0;if(this.sortObjects){za.copy(v.position);S.multiplyVector3(za);k.z=za.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);w=g.__webglObjectsImmediate.length;for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){v.matrixAutoUpdate&&
|
|
|
|
-v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);z(k)}}L(THREE.NormalBlending);for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;
|
|
|
|
-q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
|
|
|
|
-function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,i=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&K(k);for(i in k.geometryGroups){t=
|
|
|
|
-k.geometryGroups[i];if(!t.__webGLVertexBuffer){var q=t;q.__webGLVertexBuffer=d.createBuffer();q.__webGLNormalBuffer=d.createBuffer();q.__webGLTangentBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q.__webGLUVBuffer=d.createBuffer();q.__webGLUV2Buffer=d.createBuffer();q.__webGLSkinVertexABuffer=d.createBuffer();q.__webGLSkinVertexBBuffer=d.createBuffer();q.__webGLSkinIndicesBuffer=d.createBuffer();q.__webGLSkinWeightsBuffer=d.createBuffer();q.__webGLFaceBuffer=d.createBuffer();q.__webGLLineBuffer=
|
|
|
|
-d.createBuffer();if(q.numMorphTargets){var r=void 0,D=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(D=q.numMorphTargets;r<D;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var w=m,v=void 0,M=void 0,X=D=r=0;v=void 0;M=void 0;var G=void 0;M=void 0;var R=w.geometry;G=R.faces;var H=q.faces;v=0;for(M=H.length;v<M;v++){fi=H[v];face=G[fi];if(face instanceof THREE.Face3){r+=3;D+=1;X+=3}else if(face instanceof THREE.Face4){r+=4;D+=2;X+=4}}v=q;M=w;G=void 0;H=void 0;var Z=void 0,Ga=void 0;Z=void 0;
|
|
|
|
-var T=[];G=0;for(H=M.materials.length;G<H;G++){Z=M.materials[G];if(Z instanceof THREE.MeshFaceMaterial){Z=0;for(l=v.materials.length;Z<l;Z++)(Ga=v.materials[Z])&&T.push(Ga)}else(Ga=Z)&&T.push(Ga)}M=T;a:{v=void 0;G=void 0;H=M.length;for(v=0;v<H;v++){G=M[v];if(G.map||G.lightMap||G instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{G=void 0;H=void 0;T=M.length;for(G=0;G<T;G++){H=M[G];if(!(H instanceof THREE.MeshBasicMaterial&&!H.envMap||H instanceof THREE.MeshDepthMaterial)){G=H&&H.shading!=
|
|
|
|
-undefined&&H.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}G=!1}a:{H=void 0;T=void 0;Z=M.length;for(H=0;H<Z;H++){T=M[H];if(T.vertexColors){M=T.vertexColors;break a}}M=!1}q.__vertexArray=new Float32Array(r*3);if(G)q.__normalArray=new Float32Array(r*3);if(R.hasTangents)q.__tangentArray=new Float32Array(r*4);if(M)q.__colorArray=new Float32Array(r*3);if(v){if(R.faceUvs.length>0||R.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>
|
|
|
|
-1)q.__uv2Array=new Float32Array(r*2)}if(w.geometry.skinWeights.length&&w.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(D*3);q.__lineArray=new Uint16Array(X*2);if(q.numMorphTargets){w=void 0;R=void 0;q.__morphTargetsArrays=[];w=0;for(R=q.numMorphTargets;w<R;w++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
|
|
|
|
-G==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=M;q.__normalType=G;q.__webGLFaceCount=D*3;q.__webGLLineCount=X*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}P(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*
|
|
|
|
-3);i.__colorArray=new Float32Array(t*3);i.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
|
|
|
|
-m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__sortArray=[];i.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,
|
|
|
|
-1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];o=g;k=void 0;i=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){i=o.__webglObjects[k].object;m==i&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){i=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(i instanceof THREE.Mesh){k=i.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
|
|
|
|
-k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;D=void 0;X=void 0;var $=void 0,B=void 0;$=void 0;var Aa=void 0,Y=void 0,Ha=void 0,O=void 0;w=void 0;R=void 0;v=void 0;M=void 0;G=void 0;var E=void 0,F=void 0,I=void 0,na=void 0;Y=void 0;Ha=void 0;B=void 0;O=void 0;B=void 0;E=void 0;F=void 0;Y=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;B=void 0;O=void 0;Aa=void 0;$=void 0;$=void 0;var Ea=void 0,
|
|
|
|
-Xa=void 0,ua=void 0,Oa=Ga=Z=T=H=0,Ia=0,aa=0,Ja=0,ra=0,u=0,va=0,wa=q.__vertexArray,Za=q.__uvArray,$a=q.__uv2Array,Ma=q.__normalArray,ca=q.__tangentArray,xa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,ab=q.__morphTargetsArrays,Pa=q.__faceArray,Ka=q.__lineArray,hb=q.__needsSmoothNormals;R=q.__vertexColorType;w=q.__uvType;v=q.__normalType;var Fa=i.geometry,bb=Fa.__dirtyVertices,cb=Fa.__dirtyElements,Ya=Fa.__dirtyUvs,db=Fa.__dirtyNormals,
|
|
|
|
-eb=Fa.__dirtyTangents,fb=Fa.__dirtyColors,gb=Fa.__dirtyMorphTargets,Sa=Fa.vertices,ib=q.faces,lb=Fa.faces,jb=Fa.faceVertexUvs[0],kb=Fa.faceVertexUvs[1],Ta=Fa.skinVerticesA,Ua=Fa.skinVerticesB,Va=Fa.skinIndices,Ra=Fa.skinWeights,Qa=Fa.morphTargets;D=0;for(X=ib.length;D<X;D++){$=ib[D];B=lb[$];jb&&(M=jb[$]);kb&&(G=kb[$]);$=B.vertexNormals;Aa=B.normal;Y=B.vertexColors;Ha=B.color;O=B.vertexTangents;if(B instanceof THREE.Face3){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;I=Sa[B.c].position;wa[T]=E.x;wa[T+
|
|
|
|
-1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;T+=9}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z}va+=9}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;
|
|
|
|
-ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;
|
|
|
|
-ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;u+=12}if(fb&&R){if(Y.length==3&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2]}else F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;ra+=9}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;aa+=12}if(db&&v)if($.length==
|
|
|
|
-3&&hb)for(O=0;O<3;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<3;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<3;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<3;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+2;Oa+=3;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+2;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ja+=6;H+=3}}else if(B instanceof THREE.Face4){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;
|
|
|
|
-I=Sa[B.c].position;na=Sa[B.d].position;wa[T]=E.x;wa[T+1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;wa[T+9]=na.x;wa[T+10]=na.y;wa[T+11]=na.z;T+=12}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;na=Qa[Ea].vertices[B.d].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z;ua[va+9]=na.x;
|
|
|
|
-ua[va+10]=na.y;ua[va+11]=na.z}va+=12}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];na=Ra[B.d];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;ga[u+12]=na.x;ga[u+13]=na.y;ga[u+14]=na.z;ga[u+15]=na.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];na=Va[B.d];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;fa[u+12]=na.x;fa[u+13]=na.y;
|
|
|
|
-fa[u+14]=na.z;fa[u+15]=na.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];na=Ta[B.d];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;da[u+12]=na.x;da[u+13]=na.y;da[u+14]=na.z;da[u+15]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];B=Ua[B.d];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;ea[u+12]=B.x;ea[u+13]=B.y;ea[u+14]=B.z;ea[u+15]=1;u+=16}if(fb&&
|
|
|
|
-R){if(Y.length==4&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2];Y=Y[3]}else Y=F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;xa[ra+9]=Y.r;xa[ra+10]=Y.g;xa[ra+11]=Y.b;ra+=12}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];O=O[3];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;ca[aa+12]=O.x;ca[aa+13]=O.y;ca[aa+14]=O.z;
|
|
|
|
-ca[aa+15]=O.w;aa+=16}if(db&&v)if($.length==4&&hb)for(O=0;O<4;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<4;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<4;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<4;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+3;Pa[Oa+3]=H+1;Pa[Oa+4]=H+2;Pa[Oa+5]=H+3;Oa+=6;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+3;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ka[Ja+
|
|
|
|
-6]=H+2;Ka[Ja+7]=H+3;Ja+=8;H+=4}}}if(bb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ea]);d.bufferData(d.ARRAY_BUFFER,ab[Ea],r)}}if(fb&&ra>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,xa,r)}if(db){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(eb&&Fa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
|
|
|
|
-q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Ya&&Z>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(Ya&&Ga>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,$a,r)}if(cb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ka,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
|
|
|
|
-d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||
|
|
|
|
-k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
|
|
|
|
-X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Line){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*
|
|
|
|
-3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem){k=i.geometry;(k.__dirtyVertices||k.__dirtyColors||i.sortParticles)&&b(k,d.DYNAMIC_DRAW,i);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):
|
|
|
|
-d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
|
|
|
+THREE.WebGLRenderer=function(a){function c(e,p,n){var j,q,s,v=e.vertices,r=v.length,k=e.colors,A=k.length,u=e.__vertexArray,G=e.__colorArray,F=e.__sortArray,L=e.__dirtyVertices,M=e.__dirtyColors;if(n.sortParticles){ma.multiplySelf(n.matrixWorld);for(j=0;j<r;j++){q=v[j].position;Fa.copy(q);ma.multiplyVector3(Fa);F[j]=[Fa.z,j]}F.sort(function(V,P){return P[0]-V[0]});for(j=0;j<r;j++){q=v[F[j][1]].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}for(j=0;j<A;j++){s=j*3;color=k[F[j][1]];G[s]=color.r;G[s+1]=
|
|
|
|
+color.g;G[s+2]=color.b}}else{if(L)for(j=0;j<r;j++){q=v[j].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}if(M)for(j=0;j<A;j++){color=k[j];s=j*3;G[s]=color.r;G[s+1]=color.g;G[s+2]=color.b}}if(L||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,u,p)}if(M||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,G,p)}}function d(e,p){e.uniforms=Uniforms.clone(p.uniforms);e.vertexShader=p.vertexShader;e.fragmentShader=
|
|
|
|
+p.fragmentShader}function g(e,p,n,j,q){j.__webglProgram||N.initMaterial(j,p,n,q);var s=j.program,v=s.uniforms,r=j.uniforms;if(s!=ra){b.useProgram(s);ra=s}b.uniformMatrix4fv(v.projectionMatrix,!1,ka);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=
|
|
|
|
+n.far}else if(n instanceof THREE.FogExp2)r.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,V,P=na,U=P.directional.colors,C=P.directional.positions,D=P.point.colors,I=P.point.positions,W=0,oa=0;n=A=A=0;for(k=p.length;n<k;n++){A=p[n];L=A.color;M=A.position;V=A.intensity;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){A=W*3;U[A]=L.r*V;U[A+1]=L.g*V;U[A+2]=
|
|
|
|
+L.b*V;C[A]=M.x;C[A+1]=M.y;C[A+2]=M.z;W+=1}else if(A instanceof THREE.PointLight){A=oa*3;D[A]=L.r*V;D[A+1]=L.g*V;D[A+2]=L.b*V;I[A]=M.x;I[A+1]=M.y;I[A+2]=M.z;oa+=1}}for(n=W*3;n<U.length;n++)U[n]=0;for(n=oa*3;n<D.length;n++)D[n]=0;P.point.length=oa;P.directional.length=W;P.ambient[0]=u;P.ambient[1]=G;P.ambient[2]=F;n=na;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(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=
|
|
|
|
+j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Y.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,
|
|
|
|
+j.ambient.g,j.ambient.b);r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var Na in r)if(G=s.uniforms[Na]){k=r[Na];u=k.type;n=k.value;if(u=="i")b.uniform1i(G,n);else if(u=="f")b.uniform1f(G,n);else if(u=="fv1")b.uniform1fv(G,n);else if(u=="fv")b.uniform3fv(G,n);else if(u==
|
|
|
|
+"v2")b.uniform2f(G,n.x,n.y);else if(u=="v3")b.uniform3f(G,n.x,n.y,n.z);else if(u=="c")b.uniform3f(G,n.r,n.g,n.b);else if(u=="t"){b.uniform1i(G,n);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image[u])}else{k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
|
|
|
|
+k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[u]);k.__wasSetOnce=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=
|
|
|
|
+b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);b.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||
|
|
|
|
+j.envMap)&&b.uniform3f(v.cameraPosition,e.position.x,e.position.y,e.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&b.uniformMatrix4fv(v.viewMatrix,!1,Ca);if(j instanceof THREE.ShadowVolumeDynamicMaterial){e=r.directionalLightDirection.value;e[0]=-p.position.x;e[1]=-p.position.y;e[2]=
|
|
|
|
+-p.position.z;b.uniform3fv(v.directionalLightDirection,e);b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);b.uniformMatrix4fv(v.viewMatrix,!1,Ca)}if(j.skinning){b.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return s}function f(e,p,n,j,q,s){if(j.opacity!=0){e=g(e,p,n,j,s).attributes;if(j.morphTargets){p=j.program.attributes;s.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[s.morphTargetBase]):b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
|
+q.__webGLVertexBuffer);b.vertexAttribPointer(p.position,3,b.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[v[n]]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[v[n]];n++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;n=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]=
|
|
|
|
+!0);n<j.numSupportedMorphTargets;){for(u=0;u<G;u++)if(!v[u]&&r[u]>k){A=u;k=r[A]}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=k;v[A]=1;k=-1;n++}}b.uniform1fv(j.program.uniforms.morphTargetInfluences,s.__webGLMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);
|
|
|
|
+b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
|
+q.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(j.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,
|
|
|
|
+4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(b.LINES,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?
|
|
|
|
+b.LINE_STRIP:b.LINES;b.lineWidth(j.linewidth);b.drawArrays(s,0,q.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,q.__webGLParticleCount);else s instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function h(e,p){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,
|
|
|
|
+b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.position);b.vertexAttribPointer(p.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.normal);b.vertexAttribPointer(p.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function i(e){if(pa!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);pa=
|
|
|
|
+e.doubleSided}if(Aa!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);Aa=e.flipSided}}function m(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){O[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);O[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);O[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);O[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);O[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);O[5].set(e.n41+e.n31,
|
|
|
|
+e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var p;for(e=0;e<6;e++){p=O[e];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function t(e){for(var p=e.matrixWorld,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=O[j].x*p.n14+O[j].y*p.n24+O[j].z*p.n34+O[j].w;if(e<=n)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,n,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){n=j.materials[e];
|
|
|
|
+n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?x(s,n):x(q,n)}}function B(e){var p,n,j,q,s=e.object,v=e.buffer,r=e.opaque,k=e.transparent;k.count=0;e=r.count=0;for(j=s.materials.length;e<j;e++){p=s.materials[e];if(p instanceof THREE.MeshFaceMaterial){p=0;for(n=v.materials.length;p<n;p++)(q=v.materials[p])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q))}else{q=p;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q)}}}function z(e,p){return p.z-e.z}
|
|
|
|
+function H(e,p){e._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function J(e){var p,n,j;if(e instanceof THREE.Mesh){n=e.geometry;for(p in n.geometryGroups){j=n.geometryGroups[p];if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){var q=b.DYNAMIC_DRAW,s=void 0,v=void 0,r=void 0,k=void 0;
|
|
|
|
+r=void 0;var A=void 0,u=void 0,G=void 0,F=void 0,L=void 0,M=void 0,V=void 0,P=void 0,U=void 0,C=void 0,D=void 0,I=void 0,W=void 0;u=void 0;G=void 0;k=void 0;F=void 0;k=void 0;C=void 0;D=void 0;u=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;k=void 0;F=void 0;A=void 0;r=void 0;r=void 0;var oa=void 0,Na=void 0,ta=void 0,Z=0,ua=0,Qa=0,Ra=0,Ga=0,Ha=0,X=0,Ia=0,qa=0,w=0,va=0,ya=j.__vertexArray,Za=j.__uvArray,
|
|
|
|
+$a=j.__uv2Array,La=j.__normalArray,$=j.__tangentArray,za=j.__colorArray,aa=j.__skinVertexAArray,ca=j.__skinVertexBArray,da=j.__skinIndexArray,ea=j.__skinWeightArray,ab=j.__morphTargetsArrays,Ja=j.__faceArray,Ka=j.__lineArray,hb=j.__needsSmoothNormals;M=j.__vertexColorType;L=j.__uvType;V=j.__normalType;var Da=e.geometry,bb=Da.__dirtyVertices,cb=Da.__dirtyElements,Xa=Da.__dirtyUvs,db=Da.__dirtyNormals,eb=Da.__dirtyTangents,fb=Da.__dirtyColors,gb=Da.__dirtyMorphTargets,Sa=Da.vertices,ib=j.faces,lb=Da.faces,
|
|
|
|
+jb=Da.faceVertexUvs[0],kb=Da.faceVertexUvs[1],Ta=Da.skinVerticesA,Ua=Da.skinVerticesB,Va=Da.skinIndices,Oa=Da.skinWeights,Pa=Da.edgeFaces,Ma=Da.morphTargets;s=0;for(v=ib.length;s<v;s++){r=ib[s];k=lb[r];jb&&(P=jb[r]);kb&&(U=kb[r]);r=k.vertexNormals;A=k.normal;u=k.vertexColors;G=k.color;F=k.vertexTangents;if(k instanceof THREE.Face3){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+6]=I.x;ya[ua+7]=I.y;ya[ua+
|
|
|
|
+8]=I.z;ua+=9}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z}va+=9}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];ea[w]=C.x;ea[w+1]=C.y;ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];
|
|
|
|
+da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;w+=12}if(fb&&M){if(u.length==
|
|
|
|
+3&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2]}else D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;qa+=9}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;X+=12}if(db&&V)if(r.length==3&&hb)for(F=0;F<3;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<3;F++){La[Ha]=A.x;La[Ha+1]=A.y;
|
|
|
|
+La[Ha+2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<3;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<3;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+2;Ga+=3;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+2;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ia+=6;Z+=3}}else if(k instanceof THREE.Face4){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;W=Sa[k.d].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+
|
|
|
|
+6]=I.x;ya[ua+7]=I.y;ya[ua+8]=I.z;ya[ua+9]=W.x;ya[ua+10]=W.y;ya[ua+11]=W.z;ua+=12}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;W=Ma[oa].vertices[k.d].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z;ta[va+9]=W.x;ta[va+10]=W.y;ta[va+11]=W.z}va+=12}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];W=Oa[k.d];ea[w]=C.x;ea[w+1]=C.y;
|
|
|
|
+ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;ea[w+12]=W.x;ea[w+13]=W.y;ea[w+14]=W.z;ea[w+15]=W.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];W=Va[k.d];da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;da[w+12]=W.x;da[w+13]=W.y;da[w+14]=W.z;da[w+15]=W.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];W=Ta[k.d];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=
|
|
|
|
+D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;aa[w+12]=W.x;aa[w+13]=W.y;aa[w+14]=W.z;aa[w+15]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];k=Ua[k.d];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;ca[w+12]=k.x;ca[w+13]=k.y;ca[w+14]=k.z;ca[w+15]=1;w+=16}if(fb&&M){if(u.length==4&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2];u=u[3]}else u=D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+
|
|
|
|
+3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;za[qa+9]=u.r;za[qa+10]=u.g;za[qa+11]=u.b;qa+=12}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];F=F[3];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;$[X+12]=F.x;$[X+13]=F.y;$[X+14]=F.z;$[X+15]=F.w;X+=16}if(db&&V)if(r.length==4&&hb)for(F=0;F<4;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<4;F++){La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+
|
|
|
|
+2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<4;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<4;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+3;Ja[Ga+3]=Z+1;Ja[Ga+4]=Z+2;Ja[Ga+5]=Z+3;Ga+=6;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+3;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ka[Ia+6]=Z+2;Ka[Ia+7]=Z+3;Ia+=8;Z+=4}}}if(Pa){s=0;for(v=Pa.length;s<v;s++){Ja[Ga]=Pa[s].a;Ja[Ga+1]=Pa[s].b;Ja[Ga+2]=Pa[s].c;Ja[Ga+3]=Pa[s].a;Ja[Ga+4]=Pa[s].c;Ja[Ga+5]=Pa[s].d;
|
|
|
|
+Ga+=6}}if(bb){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ya,q)}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLMorphTargetsBuffers[oa]);b.bufferData(b.ARRAY_BUFFER,ab[oa],q)}}if(fb&&qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,za,q)}if(db){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,La,q)}if(eb&&Da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);
|
|
|
|
+b.bufferData(b.ARRAY_BUFFER,$,q)}if(Xa&&Qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Za,q)}if(Xa&&Ra>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,$a,q)}if(cb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,q)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
+aa,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,ca,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,da,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ea,q)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=
|
|
|
|
+n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof
|
|
|
|
+THREE.Line){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
+v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){n=e.geometry;(n.__dirtyVertices||n.__dirtyColors||e.sortParticles)&&c(n,b.DYNAMIC_DRAW,e);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function Q(e){function p(F){var L=[];n=0;for(j=F.length;n<j;n++)F[n]==undefined?L.push("undefined"):L.push(F[n].id);return L.join("_")}var n,j,q,s,v,r,k,A,u={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};q=0;for(s=e.faces.length;q<s;q++){v=e.faces[q];r=
|
|
|
|
+v.materials;k=p(r);u[k]==undefined&&(u[k]={hash:k,counter:0});A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G});v=v instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+v>65535){u[k].counter+=1;A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(q);e.geometryGroups[A].vertices+=v}}function K(e,p,
|
|
|
|
+n){e.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ia(e){if(e!=Ba){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);
|
|
|
|
+b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}Ba=e}}function la(e,p,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,fa(p.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,fa(p.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,fa(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,fa(p.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_MAG_FILTER,E(p.magFilter));
|
|
|
|
+b.texParameteri(e,b.TEXTURE_MIN_FILTER,E(p.minFilter))}}function wa(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,fa(e.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,
|
|
|
|
+fa(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,fa(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,fa(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,fa(e.format),e.width,e.height,0,fa(e.format),fa(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
|
|
|
|
+null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var p,n;if(e){p=e.__webGLFramebuffer;n=e.width;e=e.height}else{p=null;n=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(T,ga,n,e);R=p}}function S(e,p){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,p);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(n));console.error(p);
|
|
|
|
+return null}return n}function E(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function fa(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
|
|
|
|
+case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
|
|
|
|
+case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var Y=document.createElement("canvas"),b,ra=null,R=null,N=this,pa=null,Aa=null,Ba=null,sa=null,T=0,ga=0,ha=0,ja=0,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Matrix4,ka=new Float32Array(16),Ca=new Float32Array(16),Fa=new THREE.Vector4,na=
|
|
|
|
+{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ea=!0,Wa=new THREE.Color(0),Ya=0;if(a){if(a.antialias!==undefined)Ea=a.antialias;a.clearColor!==undefined&&Wa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ya=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(e,p,n){try{if(!(b=Y.getContext("experimental-webgl",{antialias:e,stencil:!0})))throw"Error creating WebGL context.";}catch(j){console.error(j)}b.clearColor(0,
|
|
|
|
+0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(p.r,p.g,p.b,n)})(Ea,Wa,Ya);this.context=b;var xa={};a=[];Ea=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Ea[0]=0;Ea[1]=1;Ea[2]=2;Ea[3]=0;Ea[4]=2;Ea[5]=3;xa.vertexBuffer=b.createBuffer();xa.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);
|
|
|
|
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ea),b.STATIC_DRAW);xa.program=b.createProgram();b.attachShader(xa.program,S("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(xa.program,S("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(xa.program);xa.vertexLocation=b.getAttribLocation(xa.program,"position");xa.projectionLocation=b.getUniformLocation(xa.program,
|
|
|
|
+"projectionMatrix");this.setSize=function(e,p){Y.width=e;Y.height=p;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(e,p,n,j){T=e;ga=p;ha=n;ja=j;b.viewport(T,ga,ha,ja)};this.setScissor=function(e,p,n,j){b.scissor(e,p,n,j)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)};this.enableDepthBufferWrite=function(e){b.depthMask(e)};this.setClearColorHex=function(e,p){var n=new THREE.Color(e);b.clearColor(n.r,n.g,n.b,p)};this.setClearColor=function(e,
|
|
|
|
+p){b.clearColor(e.r,e.g,e.b,p)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.initMaterial=function(e,p,n,j){var q,s,v,r;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.ShadowVolumeDynamicMaterial)d(e,THREE.ShaderLib.shadowVolumeDynamic);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,
|
|
|
|
+THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);if(!e.program){var k,A,u;k=u=r=0;for(v=p.length;k<v;k++){A=p[k];A instanceof THREE.DirectionalLight&&u++;A instanceof THREE.PointLight&&r++}if(r+u<=4)p=u;else{p=Math.ceil(4*u/(r+u));r=4-p}r={directional:p,point:r};p=50;if(j!==undefined&&j instanceof
|
|
|
|
+THREE.SkinnedMesh)p=j.bones.length;v={fog:n,map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:r.directional,maxPointLights:r.point,maxBones:p};n=e.fragmentShader;r=e.vertexShader;p=b.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?
|
|
|
|
+"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,"#define MAX_BONES "+v.maxBones,v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":
|
|
|
|
+"",v.vertexColors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"",v.morphTargets?"#define USE_MORPHTARGETS":"",v.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
|
+b.attachShader(p,S("fragment",k+n));b.attachShader(p,S("vertex",v+r));b.linkProgram(p);b.getProgramParameter(p,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(p,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");p.uniforms={};p.attributes={};e.program=p;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in e.uniforms)n.push(q);
|
|
|
|
+q=e.program;r=0;for(p=n.length;r<p;r++){k=n[r];q.uniforms[k]=b.getUniformLocation(q,k)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)n.push("morphTarget"+q);for(s in e.attributes)n.push(s);s=e.program;q=n;n=0;for(r=q.length;n<r;n++){p=q[n];s.attributes[p]=b.getAttribLocation(s,p)}s=e.program.attributes;b.enableVertexAttribArray(s.position);s.color>=0&&b.enableVertexAttribArray(s.color);s.normal>=0&&b.enableVertexAttribArray(s.normal);
|
|
|
|
+s.tangent>=0&&b.enableVertexAttribArray(s.tangent);if(e.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){b.enableVertexAttribArray(s.skinVertexA);b.enableVertexAttribArray(s.skinVertexB);b.enableVertexAttribArray(s.skinIndex);b.enableVertexAttribArray(s.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(s.morphTarget0>=0){b.enableVertexAttribArray(s.morphTarget0);e.numSupportedMorphTargets++}if(s.morphTarget1>=0){b.enableVertexAttribArray(s.morphTarget1);
|
|
|
|
+e.numSupportedMorphTargets++}if(s.morphTarget2>=0){b.enableVertexAttribArray(s.morphTarget2);e.numSupportedMorphTargets++}if(s.morphTarget3>=0){b.enableVertexAttribArray(s.morphTarget3);e.numSupportedMorphTargets++}if(s.morphTarget4>=0){b.enableVertexAttribArray(s.morphTarget4);e.numSupportedMorphTargets++}if(s.morphTarget5>=0){b.enableVertexAttribArray(s.morphTarget5);e.numSupportedMorphTargets++}if(s.morphTarget6>=0){b.enableVertexAttribArray(s.morphTarget6);e.numSupportedMorphTargets++}if(s.morphTarget7>=
|
|
|
|
+0){b.enableVertexAttribArray(s.morphTarget7);e.numSupportedMorphTargets++}j.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q<this.maxMorphTargets;q++)j.__webGLMorphTargetInfluences[q]=0}}e.__webglProgram=!0};this.render=function(e,p,n,j){var q,s,v,r,k,A,u,G,F=e.lights,L=e.fog;p.matrixAutoUpdate&&p.updateMatrix();e.update(undefined,!1,p);p.matrixWorldInverse.flattenToArray(Ca);p.projectionMatrix.flattenToArray(ka);ma.multiply(p.projectionMatrix,p.matrixWorldInverse);o(ma);
|
|
|
|
+this.initWebGLObjects(e);wa(n);(this.autoClear||j)&&this.clear();j=e.__webglObjects.length;for(k=0;k<j;k++){r=e.__webglObjects[k];u=r.object;if(u.visible)if(!(u instanceof THREE.Mesh)||t(u)){u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);B(r);r.render=!0;if(this.sortObjects){Fa.copy(u.position);ma.multiplyVector3(Fa);r.z=Fa.z}}else r.render=!1;else r.render=!1}this.sortObjects&&e.__webglObjects.sort(z);A=e.__webglObjectsImmediate.length;for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=
|
|
|
|
+r.object;if(u.visible){u.matrixAutoUpdate&&u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);y(r)}}ia(THREE.NormalBlending);for(k=0;k<j;k++){r=e.__webglObjects[k];if(r.render){u=r.object;G=r.buffer;v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}for(k=0;k<j;k++){r=e.__webglObjects[k];
|
|
|
|
+if(r.render){u=r.object;G=r.buffer;v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}if(e.__webglShadowVolumes.length&&e.lights.length){b.enable(b.POLYGON_OFFSET_FILL);b.polygonOffset(0.1,1);b.enable(b.STENCIL_TEST);b.depthMask(!1);b.colorMask(!1,
|
|
|
|
+!1,!1,!1);b.stencilFunc(b.ALWAYS,1,255);b.stencilOpSeparate(b.BACK,b.KEEP,b.INCR,b.KEEP);b.stencilOpSeparate(b.FRONT,b.KEEP,b.DECR,b.KEEP);A=e.lights.length;G=[];j=e.__webglShadowVolumes.length;for(p=0;p<A;p++){k=e.lights[p];if(k instanceof THREE.DirectionalLight){G[0]=-k.position.x;G[1]=-k.position.y;G[2]=-k.position.z;for(k=0;k<j;k++){u=e.__webglShadowVolumes[k].object;q=e.__webglShadowVolumes[k].buffer;r=u.materials[0];r.program||N.initMaterial(r,F,L,u);s=r.program;r=s.uniforms;v=s.attributes;
|
|
|
|
+if(ra!==s){b.useProgram(s);ra=s;b.uniformMatrix4fv(r.projectionMatrix,!1,ka);b.uniformMatrix4fv(r.viewMatrix,!1,Ca);b.uniform3fv(r.directionalLightDirection,G)}u.matrixWorld.flattenToArray(u._objectMatrixArray);b.uniformMatrix4fv(r.objectMatrix,!1,u._objectMatrixArray);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+q.__webGLFaceBuffer);b.cullFace(b.FRONT);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0);b.cullFace(b.BACK);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}}}b.disable(b.POLYGON_OFFSET_FILL);b.colorMask(!0,!0,!0,!0);b.stencilFunc(b.NOTEQUAL,0,255);b.stencilOp(b.KEEP,b.KEEP,b.KEEP);b.disable(b.DEPTH_TEST);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.blendEquation(b.FUNC_ADD);Ba="";ra=xa.program;b.useProgram(xa.program);b.uniformMatrix4fv(xa.projectionLocation,
|
|
|
|
+!1,ka);b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);b.vertexAttribPointer(xa.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(xa.vertexLocation);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST);b.enable(b.DEPTH_TEST);b.disable(b.BLEND);b.depthMask(!0)}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
|
|
|
|
+null)}};this.initWebGLObjects=function(e){if(!e.__webglObjects){e.__webglObjects=[];e.__webglObjectsImmediate=[];e.__webglShadowVolumes=[]}for(;e.__objectsAdded.length;){var p=e.__objectsAdded[0],n=e,j=void 0,q=void 0,s=void 0;if(p._modelViewMatrix==undefined){p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);p._objectMatrixArray=new Float32Array(16);p.matrixWorld.flattenToArray(p._objectMatrixArray)}if(p instanceof THREE.Mesh){q=
|
|
|
|
+p.geometry;q.geometryGroups==undefined&&Q(q);for(j in q.geometryGroups){s=q.geometryGroups[j];if(!s.__webGLVertexBuffer){var v=s;v.__webGLVertexBuffer=b.createBuffer();v.__webGLNormalBuffer=b.createBuffer();v.__webGLTangentBuffer=b.createBuffer();v.__webGLColorBuffer=b.createBuffer();v.__webGLUVBuffer=b.createBuffer();v.__webGLUV2Buffer=b.createBuffer();v.__webGLSkinVertexABuffer=b.createBuffer();v.__webGLSkinVertexBBuffer=b.createBuffer();v.__webGLSkinIndicesBuffer=b.createBuffer();v.__webGLSkinWeightsBuffer=
|
|
|
|
+b.createBuffer();v.__webGLFaceBuffer=b.createBuffer();v.__webGLLineBuffer=b.createBuffer();if(v.numMorphTargets){var r=void 0,k=void 0;v.__webGLMorphTargetsBuffers=[];r=0;for(k=v.numMorphTargets;r<k;r++)v.__webGLMorphTargetsBuffers.push(b.createBuffer())}v=s;r=p;var A=void 0,u=void 0,G=void 0;G=void 0;var F=k=0,L=0;A=void 0;u=void 0;var M=void 0;u=void 0;var V=r.geometry;M=V.faces;var P=v.faces;A=0;for(u=P.length;A<u;A++){G=P[A];G=M[G];if(G instanceof THREE.Face3){k+=3;F+=1;L+=3}else if(G instanceof
|
|
|
|
+THREE.Face4){k+=4;F+=2;L+=4}}A=v;u=r;M=void 0;P=void 0;var U=void 0,C=void 0;U=void 0;G=[];M=0;for(P=u.materials.length;M<P;M++){U=u.materials[M];if(U instanceof THREE.MeshFaceMaterial){U=0;for(l=A.materials.length;U<l;U++)(C=A.materials[U])&&G.push(C)}else(C=U)&&G.push(C)}u=G;a:{A=void 0;M=void 0;P=u.length;for(A=0;A<P;A++){M=u[A];if(M.map||M.lightMap||M instanceof THREE.MeshShaderMaterial){A=!0;break a}}A=!1}a:{M=void 0;P=void 0;G=u.length;for(M=0;M<G;M++){P=u[M];if(!(P instanceof THREE.MeshBasicMaterial&&
|
|
|
|
+!P.envMap||P instanceof THREE.MeshDepthMaterial)){M=P&&P.shading!=undefined&&P.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}M=!1}a:{P=void 0;G=void 0;U=u.length;for(P=0;P<U;P++){G=u[P];if(G.vertexColors){u=G.vertexColors;break a}}u=!1}v.__vertexArray=new Float32Array(k*3);if(M)v.__normalArray=new Float32Array(k*3);if(V.hasTangents)v.__tangentArray=new Float32Array(k*4);if(u)v.__colorArray=new Float32Array(k*3);if(A){if(V.faceUvs.length>0||V.faceVertexUvs.length>0)v.__uvArray=
|
|
|
|
+new Float32Array(k*2);if(V.faceUvs.length>1||V.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(k*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(k*4);v.__skinVertexBArray=new Float32Array(k*4);v.__skinIndexArray=new Float32Array(k*4);v.__skinWeightArray=new Float32Array(k*4)}v.__faceArray=new Uint16Array(F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(L*2);if(v.numMorphTargets){V=void 0;P=void 0;
|
|
|
|
+v.__morphTargetsArrays=[];V=0;for(P=v.numMorphTargets;V<P;V++)v.__morphTargetsArrays.push(new Float32Array(k*3))}v.__needsSmoothNormals=M==THREE.SmoothShading;v.__uvType=A;v.__vertexColorType=u;v.__normalType=M;v.__webGLFaceCount=F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0);v.__webGLLineCount=L*2;q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}p instanceof THREE.ShadowVolume?K(n.__webglShadowVolumes,
|
|
|
|
+s,p):K(n.__webglObjects,s,p)}}else if(p instanceof THREE.Ribbon){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLVertexCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.Line){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=
|
|
|
|
+b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLLineCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.ParticleSystem){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__sortArray=[];j.__webGLParticleCount=
|
|
|
|
+s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){p=e.__objectsRemoved[0];n=e;q=void 0;j=void 0;for(q=n.__webglObjects.length-1;q>=0;q--){j=n.__webglObjects[q].object;p==j&&n.__webglObjects.splice(q,1)}e.__objectsRemoved.splice(0,1)}p=0;for(n=e.__webglObjects.length;p<
|
|
|
|
+n;p++)J(e.__webglObjects[p].object,e);p=0;for(n=e.__webglShadowVolumes.length;p<n;p++)J(e.__webglShadowVolumes[p].object,e)};this.setFaceCulling=function(e,p){if(e){!p||p=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|