|
@@ -0,0 +1,203 @@
|
|
|
+// ThreeWebGL.js r32 - http://github.com/mrdoob/three.js
|
|
|
+var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
|
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var f,h,k,l,o,j;if(d==0)f=h=k=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-c);j=d*(1-c*o);c=d*(1-c*(1-o));switch(l){case 1:f=j;h=d;k=a;break;case 2:f=a;h=d;k=c;break;case 3:f=a;h=j;k=d;break;case 4:f=c;h=a;k=d;break;case 5:f=d;h=a;k=j;break;case 6:case 0:f=d;h=c;k=a}}this.r=f;this.g=h;this.b=k;if(this.autoUpdate){this.updateHex();
|
|
|
+this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
|
|
|
+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
|
+THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=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.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
+cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
|
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*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.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
|
|
|
+this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
|
|
|
+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1};
|
|
|
+THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
+return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){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)},toString:function(){return"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,f=a.objects,h=[];a=0;for(c=f.length;a<c;a++){d=f[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(k,l){return k.distance-l.distance});return h},intersectObject:function(a){function c(J,I,R,L){L=L.clone().subSelf(I);R=R.clone().subSelf(I);var Q=J.clone().subSelf(I);J=L.dot(L);I=L.dot(R);L=L.dot(Q);var b=R.dot(R);R=R.dot(Q);Q=1/(J*b-I*I);b=(b*L-I*R)*Q;J=(J*R-I*L)*Q;return b>0&&J>0&&b+J<1}var d,f,h,k,l,o,j,r,v,w,
|
|
|
+x,y=a.geometry,F=y.vertices,G=[];d=0;for(f=y.faces.length;d<f;d++){h=y.faces[d];w=this.origin.clone();x=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.matrixRotation);k=j.multiplyVector3(F[h.a].position.clone());l=j.multiplyVector3(F[h.b].position.clone());o=j.multiplyVector3(F[h.c].position.clone());j=h instanceof THREE.Face4?j.multiplyVector3(F[h.d].position.clone()):null;r=a.matrixRotation.multiplyVector3(h.normal.clone());v=x.dot(r);if(v<0){r=r.dot((new THREE.Vector3).sub(k,
|
|
|
+w))/v;w=w.addSelf(x.multiplyScalar(r));if(h instanceof THREE.Face3){if(c(w,k,l,o)){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}else if(h instanceof THREE.Face4&&(c(w,k,l,j)||c(w,l,o,j))){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}}return G}};
|
|
|
+THREE.Rectangle=function(){function a(){k=f-c;l=h-d}var c,d,f,h,k,l,o=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return l};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,r,v,w){o=!1;c=j;d=r;f=v;h=w;a()};this.addPoint=function(j,r){if(o){o=!1;c=j;d=r;f=j;h=r}else{c=c<j?c:j;d=d<r?d:r;f=f>j?f:j;h=h>r?h:r}a()};
|
|
|
+this.add3Points=function(j,r,v,w,x,y){if(o){o=!1;c=j<v?j<x?j:x:v<x?v:x;d=r<w?r<y?r:y:w<y?w:y;f=j>v?j>x?j:x:v>x?v:x;h=r>w?r>y?r:y:w>y?w:y}else{c=j<v?j<x?j<c?j:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c;d=r<w?r<y?r<d?r:d:y<d?y:d:w<y?w<d?w:d:y<d?y:d;f=j>v?j>x?j>f?j:f:x>f?x:f:v>x?v>f?v:f:x>f?x:f;h=r>w?r>y?r>h?r:h:y>h?y:h:w>y?w>h?w:h:y>h?y:h}a()};this.addRectangle=function(j){if(o){o=!1;c=j.getLeft();d=j.getTop();f=j.getRight();h=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();d=d<j.getTop()?d:j.getTop();f=f>j.getRight()?
|
|
|
+f:j.getRight();h=h>j.getBottom()?h:j.getBottom()}a()};this.inflate=function(j){c-=j;d-=j;f+=j;h+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();d=d>j.getTop()?d:j.getTop();f=f<j.getRight()?f:j.getRight();h=h<j.getBottom()?h:j.getBottom();a()};this.instersects=function(j){return Math.min(f,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(h,j.getBottom())-Math.max(d,j.getTop())>=0};this.empty=function(){o=!0;h=f=d=c=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
|
|
|
+c+", right: "+f+", top: "+d+", bottom: "+h+", width: "+k+", height: "+l+" )"}};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,f,h,k,l,o,j,r,v,w,x,y,F,G){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=h||0;this.n22=k||1;this.n23=l||0;this.n24=o||0;this.n31=j||0;this.n32=r||0;this.n33=v||1;this.n34=w||0;this.n41=x||0;this.n42=y||0;this.n43=F||0;this.n44=G||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,f,h,k,l,o,j,r,v,w,x,y,F,G){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=k;this.n23=l;this.n24=o;this.n31=j;this.n32=r;this.n33=v;this.n34=w;this.n41=x;this.n42=y;this.n43=F;this.n44=G;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,c).normalize();f.cross(d,k).normalize();h.cross(k,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);
|
|
|
+this.n31=k.x;this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,h=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*
|
|
|
+a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*f+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*h;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,f=a.n12,h=a.n13,k=a.n14,l=a.n21,o=a.n22,j=a.n23,r=a.n24,v=a.n31,w=a.n32,x=a.n33,y=a.n34,F=a.n41,G=a.n42,J=a.n43,I=a.n44,R=c.n11,L=c.n12,Q=c.n13,b=c.n14,ba=c.n21,ca=c.n22,da=c.n23,ga=c.n24,ea=c.n31,ma=c.n32,ja=c.n33,T=c.n34,aa=c.n41,ka=c.n42,pa=c.n43,ya=c.n44;this.n11=d*R+f*ba+h*ea+k*aa;this.n12=d*L+f*ca+h*ma+k*ka;this.n13=d*Q+f*da+h*ja+k*pa;this.n14=d*b+f*ga+h*T+k*ya;this.n21=l*R+o*ba+j*ea+r*aa;this.n22=l*L+
|
|
|
+o*ca+j*ma+r*ka;this.n23=l*Q+o*da+j*ja+r*pa;this.n24=l*b+o*ga+j*T+r*ya;this.n31=v*R+w*ba+x*ea+y*aa;this.n32=v*L+w*ca+x*ma+y*ka;this.n33=v*Q+w*da+x*ja+y*pa;this.n34=v*b+w*ga+x*T+y*ya;this.n41=F*R+G*ba+J*ea+I*aa;this.n42=F*L+G*ca+J*ma+I*ka;this.n43=F*Q+G*da+J*ja+I*pa;this.n44=F*b+G*ga+J*T+I*ya;return this},multiplyToArray:function(a,c,d){var f=a.n11,h=a.n12,k=a.n13,l=a.n14,o=a.n21,j=a.n22,r=a.n23,v=a.n24,w=a.n31,x=a.n32,y=a.n33,F=a.n34,G=a.n41,J=a.n42,I=a.n43;a=a.n44;var R=c.n11,L=c.n12,Q=c.n13,b=c.n14,
|
|
|
+ba=c.n21,ca=c.n22,da=c.n23,ga=c.n24,ea=c.n31,ma=c.n32,ja=c.n33,T=c.n34,aa=c.n41,ka=c.n42,pa=c.n43;c=c.n44;this.n11=f*R+h*ba+k*ea+l*aa;this.n12=f*L+h*ca+k*ma+l*ka;this.n13=f*Q+h*da+k*ja+l*pa;this.n14=f*b+h*ga+k*T+l*c;this.n21=o*R+j*ba+r*ea+v*aa;this.n22=o*L+j*ca+r*ma+v*ka;this.n23=o*Q+j*da+r*ja+v*pa;this.n24=o*b+j*ga+r*T+v*c;this.n31=w*R+x*ba+y*ea+F*aa;this.n32=w*L+x*ca+y*ma+F*ka;this.n33=w*Q+x*da+y*ja+F*pa;this.n34=w*b+x*ga+y*T+F*c;this.n41=G*R+J*ba+I*ea+a*aa;this.n42=G*L+J*ca+I*ma+a*ka;this.n43=
|
|
|
+G*Q+J*da+I*ja+a*pa;this.n44=G*b+J*ga+I*T+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){var c=this.n11,d=this.n12,f=this.n13,h=this.n14,k=this.n21,l=this.n22,o=this.n23,j=this.n24,r=this.n31,v=this.n32,w=this.n33,x=this.n34,y=this.n41,F=this.n42,G=this.n43,J=this.n44,I=a.n11,
|
|
|
+R=a.n21,L=a.n31,Q=a.n41,b=a.n12,ba=a.n22,ca=a.n32,da=a.n42,ga=a.n13,ea=a.n23,ma=a.n33,ja=a.n43,T=a.n14,aa=a.n24,ka=a.n34;a=a.n44;this.n11=c*I+d*R+f*L+h*Q;this.n12=c*b+d*ba+f*ca+h*da;this.n13=c*ga+d*ea+f*ma+h*ja;this.n14=c*T+d*aa+f*ka+h*a;this.n21=k*I+l*R+o*L+j*Q;this.n22=k*b+l*ba+o*ca+j*da;this.n23=k*ga+l*ea+o*ma+j*ja;this.n24=k*T+l*aa+o*ka+j*a;this.n31=r*I+v*R+w*L+x*Q;this.n32=r*b+v*ba+w*ca+x*da;this.n33=r*ga+v*ea+w*ma+x*ja;this.n34=r*T+v*aa+w*ka+x*a;this.n41=y*I+F*R+G*L+J*Q;this.n42=y*b+F*ba+G*
|
|
|
+ca+J*da;this.n43=y*ga+F*ea+G*ma+J*ja;this.n44=y*T+F*aa+G*ka+J*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,f=this.n14,h=this.n21,k=this.n22,l=this.n23,o=this.n24,j=this.n31,r=this.n32,v=this.n33,w=this.n34,x=this.n41,y=this.n42,F=this.n43,
|
|
|
+G=this.n44;return f*l*r*x-d*o*r*x-f*k*v*x+c*o*v*x+d*k*w*x-c*l*w*x-f*l*j*y+d*o*j*y+f*h*v*y-a*o*v*y-d*h*w*y+a*l*w*y+f*k*j*F-c*o*j*F-f*h*r*F+a*o*r*F+c*h*w*F-a*k*w*F-d*k*j*G+c*l*j*G+d*h*r*G-a*l*r*G-c*h*v*G+a*k*v*G},transpose:function(){function a(c,d,f){var h=c[d];c[d]=c[f];c[f]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=
|
|
|
+this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=
|
|
|
+this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,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},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),h=1-d,k=a.x,l=a.y,o=a.z,j=h*k,r=h*l;this.set(j*k+d,j*l-f*o,j*o+f*l,0,j*l+f*o,r*l+d,r*o-f*k,0,j*o-f*l,r*o+f*k,h*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,f=a.z;a=Math.cos(d);d=Math.sin(d);var h=Math.cos(-f);f=Math.sin(-f);var k=Math.cos(c);c=Math.sin(c);var l=a*f,o=d*f;this.n11=a*h;this.n12=d*c-l*k;this.n13=
|
|
|
+l*c+d*k;this.n21=f;this.n22=h*k;this.n23=-h*c;this.n31=-d*h;this.n32=o*k+a*c;this.n33=-o*c+a*k},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,f=a.z,h=a.w,k=c+c,l=d+d,o=f+f;a=c*k;var j=c*l;c*=o;var r=d*l;d*=o;f*=o;k*=h;l*=h;h*=o;this.n11=1-(r+f);this.n12=j-h;this.n13=c+l;this.n21=j+h;this.n22=1-(a+f);this.n23=d-k;this.n31=c-l;this.n32=d+k;this.n33=1-(a+r)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=c;this.n13*=c;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;
|
|
|
+this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+
|
|
|
+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};
|
|
|
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
|
|
|
+THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,f=a.n12,h=a.n13,k=a.n14,l=a.n21,o=a.n22,j=a.n23,r=a.n24,v=a.n31,w=a.n32,x=a.n33,y=a.n34,F=a.n41,G=a.n42,J=a.n43,I=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*y*G-r*x*G+r*w*J-o*y*J-j*w*I+o*x*I;c.n12=k*x*G-h*y*G-k*w*J+f*y*J+h*w*I-f*x*I;c.n13=h*r*G-k*j*G+k*o*J-f*r*J-h*o*I+f*j*I;c.n14=k*j*w-h*r*w-k*o*x+f*r*x+h*o*y-f*j*y;c.n21=r*x*F-j*y*F-r*v*J+l*y*J+j*v*I-l*x*I;c.n22=h*y*F-k*x*F+k*v*J-d*y*J-h*v*I+d*x*I;c.n23=k*j*F-h*r*F-k*l*J+d*r*J+h*l*I-d*j*I;
|
|
|
+c.n24=h*r*v-k*j*v+k*l*x-d*r*x-h*l*y+d*j*y;c.n31=o*y*F-r*w*F+r*v*G-l*y*G-o*v*I+l*w*I;c.n32=k*w*F-f*y*F-k*v*G+d*y*G+f*v*I-d*w*I;c.n33=h*r*F-k*o*F+k*l*G-d*r*G-f*l*I+d*o*I;c.n34=k*o*v-f*r*v-k*l*w+d*r*w+f*l*y-d*o*y;c.n41=j*w*F-o*x*F-j*v*G+l*x*G+o*v*J-l*w*J;c.n42=f*x*F-h*w*F+h*v*G-d*x*G-f*v*J+d*w*J;c.n43=h*o*F-f*j*F-h*l*G+d*j*G+f*l*J-d*o*J;c.n44=f*j*v-h*o*v+h*l*w-d*j*w-f*l*x+d*o*x;c.multiplyScalar(1/a.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,r=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*l+a.n31*r;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*h;d[2]=a*k;d[3]=a*l;d[4]=a*o;d[5]=a*j;d[6]=a*r;d[7]=a*v;d[8]=a*w;return c};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,c,d,f,h,k){var l;l=new THREE.Matrix4;l.n11=2*h/(c-a);l.n12=0;l.n13=(c+a)/(c-a);l.n14=0;l.n21=0;l.n22=2*h/(f-d);l.n23=(f+d)/(f-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(k+h)/(k-h);l.n34=-2*k*h/(k-h);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,c,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,f)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,d,f,h,k){var l,o,j,r;l=new THREE.Matrix4;o=c-a;j=d-f;r=k-h;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((c+a)/o);l.n21=0;l.n22=2/j;l.n23=0;l.n24=-((d+f)/j);l.n31=0;l.n32=0;l.n33=-2/r;l.n34=-((k+h)/r);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
|
|
|
+1;this.visible=!0};THREE.Object3D.prototype.update=function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.globalMatrix,c,d)}};
|
|
|
+THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
|
|
|
+THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var c=this.children.indexOf(a);if(c!==-1){this.children.splice(c,1);a.parent=undefined}};THREE.Object3DCounter={value:0};
|
|
|
+THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
+THREE.Face3=function(a,c,d,f,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
+THREE.Face4=function(a,c,d,f,h,k){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
|
+THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var a,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,f,h,k,l,o=new THREE.Vector3,j=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){k=this.vertices[f];k.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(a&&k.vertexNormals.length){o.set(0,0,0);c=0;for(d=k.normal.length;c<d;c++)o.addSelf(k.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[k.a];d=this.vertices[k.b];l=this.vertices[k.c];o.sub(l.position,
|
|
|
+d.position);j.sub(c.position,d.position);o.crossSelf(j)}o.isZero()||o.normalize();k.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[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{f=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)f[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)f[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(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(T,aa,ka,pa,ya,Aa,Ha){k=T.vertices[aa].position;l=T.vertices[ka].position;o=T.vertices[pa].position;j=h[ya];r=h[Aa];v=h[Ha];w=l.x-k.x;x=o.x-k.x;y=l.y-k.y;
|
|
|
+F=o.y-k.y;G=l.z-k.z;J=o.z-k.z;I=r.u-j.u;R=v.u-j.u;L=r.v-j.v;Q=v.v-j.v;b=1/(I*Q-R*L);da.set((Q*w-L*x)*b,(Q*y-L*F)*b,(Q*G-L*J)*b);ga.set((I*x-R*w)*b,(I*F-R*y)*b,(I*J-R*G)*b);ba[aa].addSelf(da);ba[ka].addSelf(da);ba[pa].addSelf(da);ca[aa].addSelf(ga);ca[ka].addSelf(ga);ca[pa].addSelf(ga)}var c,d,f,h,k,l,o,j,r,v,w,x,y,F,G,J,I,R,L,Q,b,ba=[],ca=[],da=new THREE.Vector3,ga=new THREE.Vector3,ea=new THREE.Vector3,ma=new THREE.Vector3,ja=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){ba[c]=new THREE.Vector3;
|
|
|
+ca[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];h=this.uvs[c];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
|
|
|
+this.vertices[f.d].normal.copy(f.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){ja.copy(this.vertices[c].normal);f=ba[c];ea.copy(f);ea.subSelf(ja.multiplyScalar(ja.dot(f))).normalize();ma.cross(this.vertices[c].normal,f);f=ma.dot(ca[c]);f=f<0?-1:1;this.vertices[c].tangent.set(ea.x,ea.y,ea.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}},sortFacesByMaterial:function(){function a(v){var w=[];c=0;for(d=v.length;c<d;c++)v[c]==undefined?w.push("undefined"):w.push(v[c].id);return w.join("_")}var c,d,f,h,k,l,o,j,r={};f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];
|
|
|
+l=k.materials;o=a(l);r[o]==undefined&&(r[o]={hash:o,counter:0});j=r[o].hash+"_"+r[o].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:l,vertices:0});k=k instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+k>65535){r[o].counter+=1;j=r[o].hash+"_"+r[o].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:l,vertices:0})}this.geometryChunks[j].faces.push(f);this.geometryChunks[j].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
|
+THREE.Camera=function(a,c,d,f,h,k){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=c||1;this.zNear=d||0.1;this.zFar=f||2E3;this.screenCenterY=this.screenCenterX=0;this.target=k||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
|
|
|
+this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
|
|
|
+THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;c=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
+this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,c,d)};
|
|
|
+THREE.Camera.prototype.frustumContains=function(a){var c=a.globalMatrix.n14,d=a.globalMatrix.n24,f=a.globalMatrix.n34,h=this.inverseMatrix,k=a.boundRadius*a.boundRadiusScale,l=h.n31*c+h.n32*d+h.n33*f+h.n34;if(l-k>-this.zNear)return!1;if(l+k<-this.zFar)return!1;l-=k;var o=this.projectionMatrix,j=1/(o.n43*l),r=j*this.screenCenterX,v=(h.n11*c+h.n12*d+h.n13*f+h.n14)*o.n11*r;k=o.n11*k*r;if(v+k<-this.screenCenterX)return!1;if(v-k>this.screenCenterX)return!1;c=(h.n21*c+h.n22*d+h.n23*f+h.n24)*o.n22*j*this.screenCenterY;
|
|
|
+if(c+k<-this.screenCenterY)return!1;if(c-k>this.screenCenterY)return!1;a.screenPosition.set(v,c,l,k);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
|
+THREE.DirectionalLight=function(a,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.FlatShading=0;THREE.SmoothShading=1;
|
|
|
+THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
|
|
|
+THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
|
+a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
+THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
|
|
+undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
+undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
|
|
|
+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
|
|
+undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
+undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
|
|
|
+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/> )"}};
|
|
|
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
+this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
|
|
+if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
|
|
+if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
|
|
|
+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};
|
|
|
+THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
|
+a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
|
+undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
+THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};
|
|
|
+THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
|
|
+undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
|
+THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
+THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
|
|
|
+THREE.Texture=function(a,c,d,f,h,k){if(a.getContext)a.loaded=!0;this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter};
|
|
|
+THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
|
|
|
+THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
|
+THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
|
+var Uniforms={clone:function(a){var c,d,f,h={};for(c in a){h[c]={};for(d in a[c]){f=a[c][d];h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var c,d,f,h={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)h[d]=f[d]}return h}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.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}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
+THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
|
|
|
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var 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.Camera)){c=this.objects.indexOf(a);c!==-1&&this.objects.splice(c,1)}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||2.5E-4};
|
|
|
+THREE.WebGLRenderer=function(a){function c(e,m,n){var g,i,q,t=e.vertices,u=t.length,H=e.colors,B=H.length,A=e.__vertexArray,z=e.__colorArray,K=e.__sortArray,M=e.__dirtyVertices,Z=e.__dirtyColors;if(n.sortParticles){aa.multiplySelf(n.globalMatrix);for(g=0;g<u;g++){i=t[g].position;Aa.copy(i);aa.multiplyVector3(Aa);K[g]=[Aa.z,g]}K.sort(function($,N){return N[0]-$[0]});for(g=0;g<u;g++){i=t[K[g][1]].position;q=g*3;A[q]=i.x;A[q+1]=i.y;A[q+2]=i.z}for(g=0;g<B;g++){q=g*3;color=H[K[g][1]];z[q]=color.r;z[q+
|
|
|
+1]=color.g;z[q+2]=color.b}}else{if(M)for(g=0;g<u;g++){i=t[g].position;q=g*3;A[q]=i.x;A[q+1]=i.y;A[q+2]=i.z}if(Z)for(g=0;g<B;g++){color=H[g];q=g*3;z[q]=color.r;z[q+1]=color.g;z[q+2]=color.b}}if(M||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,A,m)}if(Z||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,z,m)}}function d(e,m){e.fragment_shader=m.fragment_shader;e.vertex_shader=m.vertex_shader;e.uniforms=Uniforms.clone(m.uniforms)}
|
|
|
+function f(e,m,n,g,i){g.program||da.initMaterial(g,m,n);var q=g.program,t=q.uniforms,u=g.uniforms;if(q!=ba){b.useProgram(q);ba=q;b.uniformMatrix4fv(t.projectionMatrix,!1,ka)}if(n&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){u.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){u.fogNear.value=n.near;u.fogFar.value=n.far}else if(n instanceof
|
|
|
+THREE.FogExp2)u.fogDensity.value=n.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var H,B,A=0,z=0,K=0,M,Z,$,N=da.lights,O=N.directional.colors,P=N.directional.positions,qa=N.point.colors,s=N.point.positions,oa=0,la=0;n=B=B=0;for(H=m.length;n<H;n++){B=m[n];M=B.color;Z=B.position;$=B.intensity;if(B instanceof THREE.AmbientLight){A+=M.r;z+=M.g;K+=M.b}else if(B instanceof THREE.DirectionalLight){B=oa*3;O[B]=M.r*$;O[B+1]=M.g*$;O[B+2]=M.b*$;P[B]=Z.x;P[B+1]=Z.y;
|
|
|
+P[B+2]=Z.z;oa+=1}else if(B instanceof THREE.PointLight){B=la*3;qa[B]=M.r*$;qa[B+1]=M.g*$;qa[B+2]=M.b*$;s[B]=Z.x;s[B+1]=Z.y;s[B+2]=Z.z;la+=1}}for(n=oa*3;n<O.length;n++)O[n]=0;for(n=la*3;n<qa.length;n++)qa[n]=0;N.point.length=la;N.directional.length=oa;N.ambient[0]=A;N.ambient[1]=z;N.ambient[2]=K;m=da.lights;u.enableLighting.value=m.directional.length+m.point.length;u.ambientLightColor.value=m.ambient;u.directionalLightColor.value=m.directional.colors;u.directionalLightDirection.value=m.directional.positions;
|
|
|
+u.pointLightColor.value=m.point.colors;u.pointLightPosition.value=m.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){u.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity;u.map.texture=g.map;u.light_map.texture=g.light_map;u.env_map.texture=g.env_map;u.reflectivity.value=g.reflectivity;u.refraction_ratio.value=g.refraction_ratio;u.combine.value=g.combine;u.useRefract.value=
|
|
|
+g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){u.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){u.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity;u.size.value=g.size;u.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){u.ambient.value.setRGB(g.ambient.r,g.ambient.g,
|
|
|
+g.ambient.b);u.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);u.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){u.mNear.value=e.zNear;u.mFar.value=e.zFar;u.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)u.opacity.value=g.opacity;for(var sa in u)if(A=q.uniforms[sa]){n=u[sa];H=n.type;m=n.value;if(H=="i")b.uniform1i(A,m);else if(H=="f")b.uniform1f(A,m);else if(H=="fv1")b.uniform1fv(A,m);else if(H=="fv")b.uniform3fv(A,m);else if(H=="v2")b.uniform2f(A,
|
|
|
+m.x,m.y);else if(H=="v3")b.uniform3f(A,m.x,m.y,m.z);else if(H=="c")b.uniform3f(A,m.r,m.g,m.b);else if(H=="t"){b.uniform1i(A,m);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(!n.image.__webGLTextureCube&&!n.image.__cubeMapInitialized&&n.image.loadCount==6){n.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,
|
|
|
+b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(H=0;H<6;++H)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,n.image[H]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);n.image.__cubeMapInitialized=!0}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(!n.__webGLTexture&&
|
|
|
+n.image.loaded){n.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,n.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,L(n.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(n.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(n.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(n.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+
|
|
|
+m);b.bindTexture(b.TEXTURE_2D,n.__webGLTexture)}}}b.uniformMatrix4fv(t.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(t.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.env_map)&&b.uniform3f(t.cameraPosition,e.position.x,e.position.y,e.position.z);(g instanceof THREE.MeshShaderMaterial||g.env_map||g.skinning)&&b.uniformMatrix4fv(t.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof
|
|
|
+THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(t.viewMatrix,!1,ya);if(g.skinning){b.uniformMatrix4fv(t.cameraInverseMatrix,!1,pa);b.uniformMatrix4fv(t.boneGlobalMatrices,!1,i.boneMatrices)}return q}function h(e,m,n,g,i,q){e=f(e,m,n,g,q).attributes;b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0);if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,
|
|
|
+!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__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(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
+i.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(g.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,
|
|
|
+4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?
|
|
|
+b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(q,0,i.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else q instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function k(e,m){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(m.attributes.position);b.vertexAttribPointer(m.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(m.attributes.normal);b.vertexAttribPointer(m.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function l(e){if(ga!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ga=
|
|
|
+e.doubleSided}if(ea!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ea=e.flipSided}}function o(e){if(ja!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);ja=e}}function j(e){T[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);T[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);T[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);T[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);T[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);T[5].set(e.n41+e.n31,
|
|
|
+e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var m;for(e=0;e<6;e++){m=T[e];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function r(e){for(var m=e.globalMatrix,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),g=0;g<6;g++){e=T[g].x*m.n14+T[g].y*m.n24+T[g].z*m.n34+T[g].w;if(e<=n)return!1}return!0}function v(e,m){e.list[e.count]=m;e.count+=1}function w(e){var m,n,g=e.object,i=e.opaque,q=e.transparent;q.count=0;e=i.count=0;for(m=g.materials.length;e<m;e++){n=g.materials[e];
|
|
|
+n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?v(q,n):v(i,n)}}function x(e){var m,n,g,i,q=e.object,t=e.buffer,u=e.opaque,H=e.transparent;H.count=0;e=u.count=0;for(g=q.materials.length;e<g;e++){m=q.materials[e];if(m instanceof THREE.MeshFaceMaterial){m=0;for(n=t.materials.length;m<n;m++)(i=t.materials[m])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?v(H,i):v(u,i))}else{i=m;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?v(H,i):v(u,i)}}}function y(e,m){return m.z-e.z}
|
|
|
+function F(e,m,n,g,i){if(m[n]==undefined){e.push({buffer:g,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}});m[n]=1}}function G(e,m){e._modelViewMatrix.multiplyToArray(m.globalMatrix,e.globalMatrix,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function J(e){if(e!=ma){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)}ma=e}}function I(e,m){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,L(e.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,L(e.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,L(e.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,L(e.min_filter));b.texImage2D(b.TEXTURE_2D,0,L(e.format),e.width,e.height,0,L(e.format),L(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 n,g,i;if(e){n=e.__webGLFramebuffer;g=e.width;i=e.height}else{n=null;g=Q.width;i=Q.height}if(n!=ca){b.bindFramebuffer(b.FRAMEBUFFER,n);b.viewport(0,0,g,i);m&&b.clear(b.COLOR_BUFFER_BIT|
|
|
|
+b.DEPTH_BUFFER_BIT);ca=n}}function R(e,m){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,m);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(n));return null}return n}function L(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 Q=document.createElement("canvas"),b,ba=null,ca=null,da=this,ga=null,ea=null,ma=null,ja=null,T=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
|
|
|
+aa=new THREE.Matrix4,ka=new Float32Array(16),pa=new Float32Array(16),ya=new Float32Array(16),Aa=new THREE.Vector4,Ha=!0,Na=new THREE.Color(0),Oa=0;if(a){if(a.antialias!==undefined)Ha=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Oa=a.clearAlpha}this.domElement=Q;this.autoClear=!0;this.sortObjects=!1;(function(e,m,n){try{b=Q.getContext("experimental-webgl",{antialias:e})}catch(g){console.log(g)}if(!b)throw"cannot create webgl context";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(m.r,m.g,m.b,n);_cullEnabled=!0})(Ha,Na,Oa);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,m){Q.width=e;Q.height=m;b.viewport(0,0,Q.width,Q.height)};this.setClearColorHex=function(e,m){var n=new THREE.Color(e);
|
|
|
+b.clearColor(n.r,n.g,n.b,m)};this.setClearColor=function(e,m){b.clearColor(e.r,e.g,e.b,m)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(e,m,n){var g,i;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);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);var q,t,u,H;i=u=H=0;for(q=m.length;i<q;i++){t=m[i];t instanceof THREE.DirectionalLight&&u++;t instanceof THREE.PointLight&&H++}if(H+u<=4)m=u;else{m=Math.ceil(4*u/(H+u));H=4-m}i={directional:m,point:H};H=e.fragment_shader;m=e.vertex_shader;q={fog:n,map:e.map,env_map:e.env_map,light_map:e.light_map,
|
|
|
+vertex_colors:e.vertex_colors,skinning:e.skinning,maxDirLights:i.directional,maxPointLights:i.point};n=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
+q=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+b.attachShader(n,R("fragment",i+H));b.attachShader(n,R("vertex",q+m));b.linkProgram(n);b.getProgramParameter(n,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(n,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");n.uniforms={};n.attributes={};e.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in e.uniforms)n.push(g);g=e.program;H=0;for(m=n.length;H<
|
|
|
+m;H++){i=n[H];g.uniforms[i]=b.getUniformLocation(g,i)}g=e.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];H=0;for(m=n.length;H<m;H++){i=n[H];g.attributes[i]=b.getAttribLocation(g,i)}g=e.program.attributes;b.enableVertexAttribArray(g.position);g.color>=0&&b.enableVertexAttribArray(g.color);g.normal>=0&&b.enableVertexAttribArray(g.normal);g.tangent>=0&&b.enableVertexAttribArray(g.tangent);if(e.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
|
|
|
+0&&g.skinIndex>=0&&g.skinWeight>=0){b.enableVertexAttribArray(g.skinVertexA);b.enableVertexAttribArray(g.skinVertexB);b.enableVertexAttribArray(g.skinIndex);b.enableVertexAttribArray(g.skinWeight)}};this.render=function(e,m,n,g){var i,q,t,u,H,B,A,z,K=e.lights,M=e.fog;m.matrixAutoUpdate&&m.update();m.globalMatrix.flattenToArray(ya);m.projectionMatrix.flattenToArray(ka);m.inverseMatrix.flattenToArray(pa);aa.multiply(m.projectionMatrix,m.globalMatrix);j(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
+e.update(undefined,!1,m);this.initWebGLObjects(e,m);I(n,g!==undefined?g:!0);this.autoClear&&this.clear();H=e.__webGLObjects.length;for(g=0;g<H;g++){i=e.__webGLObjects[g];A=i.object;if(A.visible)if(!(A instanceof THREE.Mesh)||r(A)){A.globalMatrix.flattenToArray(A._objectMatrixArray);G(A,m);x(i);i.render=!0;if(this.sortObjects){Aa.copy(A.position);aa.multiplyVector3(Aa);i.z=Aa.z}}else i.render=!1;else i.render=!1}this.sortObjects&&e.__webGLObjects.sort(y);B=e.__webGLObjectsImmediate.length;for(g=0;g<
|
|
|
+B;g++){i=e.__webGLObjectsImmediate[g];A=i.object;if(A.visible){A.matrixAutoUpdate&&A.globalMatrix.flattenToArray(A._objectMatrixArray);G(A,m);w(i)}}J(THREE.NormalBlending);for(g=0;g<H;g++){i=e.__webGLObjects[g];if(i.render){A=i.object;z=i.buffer;t=i.opaque;l(A);for(i=0;i<t.count;i++){u=t.list[i];o(u.depth_test);h(m,K,M,u,z,A)}}}for(g=0;g<B;g++){i=e.__webGLObjectsImmediate[g];A=i.object;if(A.visible){t=i.opaque;l(A);for(i=0;i<t.count;i++){u=t.list[i];o(u.depth_test);q=f(m,K,M,u,A);A.render(function(Z){k(Z,
|
|
|
+q)})}}}for(g=0;g<H;g++){i=e.__webGLObjects[g];if(i.render){A=i.object;z=i.buffer;t=i.transparent;l(A);for(i=0;i<t.count;i++){u=t.list[i];J(u.blending);o(u.depth_test);h(m,K,M,u,z,A)}}}for(g=0;g<B;g++){i=e.__webGLObjectsImmediate[g];A=i.object;if(A.visible){t=i.transparent;l(A);for(i=0;i<t.count;i++){u=t.list[i];J(u.blending);o(u.depth_test);q=f(m,K,M,u,A);A.render(function(Z){k(Z,q)})}}}if(n&&n.min_filter!==THREE.NearestFilter&&n.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);
|
|
|
+b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(e){var m,n,g;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={};e.__webGLObjectsImmediate=[]}m=0;for(n=e.objects.length;m<n;m++){g=e.objects[m];var i=e,q=void 0,t=void 0,u=void 0,H=void 0;t=g.geometry;if(i.__webGLObjectsMap[g.id]==undefined){i.__webGLObjectsMap[g.id]={};g._modelViewMatrix=new THREE.Matrix4;g._normalMatrixArray=new Float32Array(9);g._modelViewMatrixArray=new Float32Array(16);
|
|
|
+g._objectMatrixArray=new Float32Array(16);g.globalMatrix.flattenToArray(g._objectMatrixArray)}H=i.__webGLObjectsMap[g.id];objlist=i.__webGLObjects;if(g instanceof THREE.Mesh){for(q in t.geometryChunks){u=t.geometryChunks[q];if(!u.__webGLVertexBuffer){i=u;i.__webGLVertexBuffer=b.createBuffer();i.__webGLNormalBuffer=b.createBuffer();i.__webGLTangentBuffer=b.createBuffer();i.__webGLColorBuffer=b.createBuffer();i.__webGLUVBuffer=b.createBuffer();i.__webGLUV2Buffer=b.createBuffer();i.__webGLSkinVertexABuffer=
|
|
|
+b.createBuffer();i.__webGLSkinVertexBBuffer=b.createBuffer();i.__webGLSkinIndicesBuffer=b.createBuffer();i.__webGLSkinWeightsBuffer=b.createBuffer();i.__webGLFaceBuffer=b.createBuffer();i.__webGLLineBuffer=b.createBuffer();i=u;var B=g,A=void 0,z=void 0,K=0,M=0,Z=0,$=B.geometry.faces,N=i.faces;A=0;for(z=N.length;A<z;A++){fi=N[A];face=$[fi];if(face instanceof THREE.Face3){K+=3;M+=1;Z+=3}else if(face instanceof THREE.Face4){K+=4;M+=2;Z+=4}}i.__vertexArray=new Float32Array(K*3);i.__normalArray=new Float32Array(K*
|
|
|
+3);i.__tangentArray=new Float32Array(K*4);i.__colorArray=new Float32Array(K*3);i.__uvArray=new Float32Array(K*2);i.__uv2Array=new Float32Array(K*2);i.__skinVertexAArray=new Float32Array(K*4);i.__skinVertexBArray=new Float32Array(K*4);i.__skinIndexArray=new Float32Array(K*4);i.__skinWeightArray=new Float32Array(K*4);i.__faceArray=new Uint16Array(M*3);i.__lineArray=new Uint16Array(Z*2);z=A=i;K=void 0;$=void 0;var O=void 0,P=void 0;O=void 0;N=!1;K=0;for($=B.materials.length;K<$;K++){O=B.materials[K];
|
|
|
+if(O instanceof THREE.MeshFaceMaterial){O=0;for(P=z.materials.length;O<P;O++)if(z.materials[O]&&z.materials[O].shading!=undefined&&z.materials[O].shading==THREE.SmoothShading){N=!0;break}}else if(O&&O.shading!=undefined&&O.shading==THREE.SmoothShading){N=!0;break}if(N)break}A.__needsSmoothNormals=N;i.__webGLFaceCount=M*3;i.__webGLLineCount=Z*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyElements||
|
|
|
+t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){i=u;M=b.DYNAMIC_DRAW;Z=void 0;A=void 0;var qa=void 0,s=void 0,oa=void 0,la=void 0,sa=void 0;qa=void 0;var C=void 0,D=void 0,E=void 0,S=void 0;C=void 0;D=void 0;E=void 0;s=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;C=void 0;D=void 0;E=void 0;S=void 0;s=void 0;la=void 0;oa=void 0;sa=void 0;var ra=P=O=N=$=K=B=z=0,fa=0,p=0,ha=i.__vertexArray,
|
|
|
+Fa=i.__uvArray,Ga=i.__uv2Array,va=i.__normalArray,U=i.__tangentArray,ia=i.__colorArray,V=i.__skinVertexAArray,W=i.__skinVertexBArray,X=i.__skinIndexArray,Y=i.__skinWeightArray,wa=i.__faceArray,ta=i.__lineArray,Pa=i.__needsSmoothNormals,na=g.geometry,Ia=na.__dirtyVertices,Ja=na.__dirtyElements,Ea=na.__dirtyUvs,Ka=na.__dirtyNormals,La=na.__dirtyTangents,Ma=na.__dirtyColors,ua=na.vertices,Qa=i.faces,Ra=na.faces,Sa=na.uvs,Ta=na.uvs2,xa=na.colors,Ba=na.skinVerticesA,Ca=na.skinVerticesB,Da=na.skinIndices,
|
|
|
+za=na.skinWeights;Z=0;for(A=Qa.length;Z<A;Z++){qa=Qa[Z];s=Ra[qa];sa=Sa[qa];qa=Ta[qa];oa=s.vertexNormals;la=s.normal;if(s instanceof THREE.Face3){if(Ia){C=ua[s.a].position;D=ua[s.b].position;E=ua[s.c].position;ha[B]=C.x;ha[B+1]=C.y;ha[B+2]=C.z;ha[B+3]=D.x;ha[B+4]=D.y;ha[B+5]=D.z;ha[B+6]=E.x;ha[B+7]=E.y;ha[B+8]=E.z;B+=9}if(za.length){C=za[s.a];D=za[s.b];E=za[s.c];Y[p]=C.x;Y[p+1]=C.y;Y[p+2]=C.z;Y[p+3]=C.w;Y[p+4]=D.x;Y[p+5]=D.y;Y[p+6]=D.z;Y[p+7]=D.w;Y[p+8]=E.x;Y[p+9]=E.y;Y[p+10]=E.z;Y[p+11]=E.w;C=Da[s.a];
|
|
|
+D=Da[s.b];E=Da[s.c];X[p]=C.x;X[p+1]=C.y;X[p+2]=C.z;X[p+3]=C.w;X[p+4]=D.x;X[p+5]=D.y;X[p+6]=D.z;X[p+7]=D.w;X[p+8]=E.x;X[p+9]=E.y;X[p+10]=E.z;X[p+11]=E.w;C=Ba[s.a];D=Ba[s.b];E=Ba[s.c];V[p]=C.x;V[p+1]=C.y;V[p+2]=C.z;V[p+3]=1;V[p+4]=D.x;V[p+5]=D.y;V[p+6]=D.z;V[p+7]=1;V[p+8]=E.x;V[p+9]=E.y;V[p+10]=E.z;V[p+11]=1;C=Ca[s.a];D=Ca[s.b];E=Ca[s.c];W[p]=C.x;W[p+1]=C.y;W[p+2]=C.z;W[p+3]=1;W[p+4]=D.x;W[p+5]=D.y;W[p+6]=D.z;W[p+7]=1;W[p+8]=E.x;W[p+9]=E.y;W[p+10]=E.z;W[p+11]=1;p+=12}if(Ma&&xa.length){C=xa[s.a];D=xa[s.b];
|
|
|
+E=xa[s.c];ia[fa]=C.r;ia[fa+1]=C.g;ia[fa+2]=C.b;ia[fa+3]=D.r;ia[fa+4]=D.g;ia[fa+5]=D.b;ia[fa+6]=E.r;ia[fa+7]=E.g;ia[fa+8]=E.b;fa+=9}if(La&&na.hasTangents){C=ua[s.a].tangent;D=ua[s.b].tangent;E=ua[s.c].tangent;U[P]=C.x;U[P+1]=C.y;U[P+2]=C.z;U[P+3]=C.w;U[P+4]=D.x;U[P+5]=D.y;U[P+6]=D.z;U[P+7]=D.w;U[P+8]=E.x;U[P+9]=E.y;U[P+10]=E.z;U[P+11]=E.w;P+=12}if(Ka)if(oa.length==3&&Pa)for(s=0;s<3;s++){la=oa[s];va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=3}else for(s=0;s<3;s++){va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=
|
|
|
+3}if(Ea&&sa)for(s=0;s<3;s++){oa=sa[s];Fa[K]=oa.u;Fa[K+1]=oa.v;K+=2}if(Ea&&qa)for(s=0;s<3;s++){sa=qa[s];Ga[$]=sa.u;Ga[$+1]=sa.v;$+=2}if(Ja){wa[N]=z;wa[N+1]=z+1;wa[N+2]=z+2;N+=3;ta[ra]=z;ta[ra+1]=z+1;ta[ra+2]=z;ta[ra+3]=z+2;ta[ra+4]=z+1;ta[ra+5]=z+2;ra+=6;z+=3}}else if(s instanceof THREE.Face4){if(Ia){C=ua[s.a].position;D=ua[s.b].position;E=ua[s.c].position;S=ua[s.d].position;ha[B]=C.x;ha[B+1]=C.y;ha[B+2]=C.z;ha[B+3]=D.x;ha[B+4]=D.y;ha[B+5]=D.z;ha[B+6]=E.x;ha[B+7]=E.y;ha[B+8]=E.z;ha[B+9]=S.x;ha[B+10]=
|
|
|
+S.y;ha[B+11]=S.z;B+=12}if(za.length){C=za[s.a];D=za[s.b];E=za[s.c];S=za[s.d];Y[p]=C.x;Y[p+1]=C.y;Y[p+2]=C.z;Y[p+3]=C.w;Y[p+4]=D.x;Y[p+5]=D.y;Y[p+6]=D.z;Y[p+7]=D.w;Y[p+8]=E.x;Y[p+9]=E.y;Y[p+10]=E.z;Y[p+11]=E.w;Y[p+12]=S.x;Y[p+13]=S.y;Y[p+14]=S.z;Y[p+15]=S.w;C=Da[s.a];D=Da[s.b];E=Da[s.c];S=Da[s.d];X[p]=C.x;X[p+1]=C.y;X[p+2]=C.z;X[p+3]=C.w;X[p+4]=D.x;X[p+5]=D.y;X[p+6]=D.z;X[p+7]=D.w;X[p+8]=E.x;X[p+9]=E.y;X[p+10]=E.z;X[p+11]=E.w;X[p+12]=S.x;X[p+13]=S.y;X[p+14]=S.z;X[p+15]=S.w;C=Ba[s.a];D=Ba[s.b];E=Ba[s.c];
|
|
|
+S=Ba[s.d];V[p]=C.x;V[p+1]=C.y;V[p+2]=C.z;V[p+3]=1;V[p+4]=D.x;V[p+5]=D.y;V[p+6]=D.z;V[p+7]=1;V[p+8]=E.x;V[p+9]=E.y;V[p+10]=E.z;V[p+11]=1;V[p+12]=S.x;V[p+13]=S.y;V[p+14]=S.z;V[p+15]=1;C=Ca[s.a];D=Ca[s.b];E=Ca[s.c];S=Ca[s.d];W[p]=C.x;W[p+1]=C.y;W[p+2]=C.z;W[p+3]=1;W[p+4]=D.x;W[p+5]=D.y;W[p+6]=D.z;W[p+7]=1;W[p+8]=E.x;W[p+9]=E.y;W[p+10]=E.z;W[p+11]=1;W[p+12]=S.x;W[p+13]=S.y;W[p+14]=S.z;W[p+15]=1;p+=16}if(Ma&&xa.length){C=xa[s.a];D=xa[s.b];E=xa[s.c];S=xa[s.d];ia[fa]=C.r;ia[fa+1]=C.g;ia[fa+2]=C.b;ia[fa+
|
|
|
+3]=D.r;ia[fa+4]=D.g;ia[fa+5]=D.b;ia[fa+6]=E.r;ia[fa+7]=E.g;ia[fa+8]=E.b;ia[fa+9]=S.r;ia[fa+10]=S.g;ia[fa+11]=S.b;fa+=12}if(La&&na.hasTangents){C=ua[s.a].tangent;D=ua[s.b].tangent;E=ua[s.c].tangent;s=ua[s.d].tangent;U[P]=C.x;U[P+1]=C.y;U[P+2]=C.z;U[P+3]=C.w;U[P+4]=D.x;U[P+5]=D.y;U[P+6]=D.z;U[P+7]=D.w;U[P+8]=E.x;U[P+9]=E.y;U[P+10]=E.z;U[P+11]=E.w;U[P+12]=s.x;U[P+13]=s.y;U[P+14]=s.z;U[P+15]=s.w;P+=16}if(Ka)if(oa.length==4&&Pa)for(s=0;s<4;s++){la=oa[s];va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=3}else for(s=
|
|
|
+0;s<4;s++){va[O]=la.x;va[O+1]=la.y;va[O+2]=la.z;O+=3}if(Ea&&sa)for(s=0;s<4;s++){oa=sa[s];Fa[K]=oa.u;Fa[K+1]=oa.v;K+=2}if(Ea&&qa)for(s=0;s<4;s++){sa=qa[s];Ga[$]=sa.u;Ga[$+1]=sa.v;$+=2}if(Ja){wa[N]=z;wa[N+1]=z+1;wa[N+2]=z+2;wa[N+3]=z;wa[N+4]=z+2;wa[N+5]=z+3;N+=6;ta[ra]=z;ta[ra+1]=z+1;ta[ra+2]=z;ta[ra+3]=z+3;ta[ra+4]=z+1;ta[ra+5]=z+2;ta[ra+6]=z+2;ta[ra+7]=z+3;ra+=8;z+=4}}}if(Ia){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ha,M)}if(Ma&&xa.length){b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
+i.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,ia,M)}if(Ka){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,va,M)}if(La&&na.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,U,M)}if(Ea&&K>0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Fa,M)}if(Ea&&$>0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Ga,M)}if(Ja){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);
|
|
|
+b.bufferData(b.ELEMENT_ARRAY_BUFFER,wa,M);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ta,M)}if(p>0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,V,M);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,W,M);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,X,M);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,Y,
|
|
|
+M)}}F(objlist,H,q,u,g)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(g instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;u=q.vertices.length;q.__vertexArray=new Float32Array(u*3);q.__colorArray=new Float32Array(u*3);q.__webGLVertexCount=u;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;u=b.DYNAMIC_DRAW;
|
|
|
+z=void 0;z=void 0;B=void 0;i=void 0;K=q.vertices;M=q.colors;$=K.length;Z=M.length;N=q.__vertexArray;A=q.__colorArray;O=q.__dirtyColors;if(q.__dirtyVertices){for(z=0;z<$;z++){B=K[z].position;i=z*3;N[i]=B.x;N[i+1]=B.y;N[i+2]=B.z}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,N,u)}if(O){for(z=0;z<Z;z++){color=M[z];i=z*3;A[i]=color.r;A[i+1]=color.g;A[i+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,A,u)}}F(objlist,H,0,t,g);t.__dirtyVertices=
|
|
|
+!1;t.__dirtyColors=!1}else if(g instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;u=q.vertices.length;q.__vertexArray=new Float32Array(u*3);q.__colorArray=new Float32Array(u*3);q.__webGLLineCount=u;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;u=b.DYNAMIC_DRAW;z=void 0;z=void 0;B=void 0;i=void 0;K=q.vertices;M=q.colors;$=K.length;Z=M.length;N=q.__vertexArray;A=q.__colorArray;O=
|
|
|
+q.__dirtyColors;if(q.__dirtyVertices){for(z=0;z<$;z++){B=K[z].position;i=z*3;N[i]=B.x;N[i+1]=B.y;N[i+2]=B.z}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,N,u)}if(O){for(z=0;z<Z;z++){color=M[z];i=z*3;A[i]=color.r;A[i+1]=color.g;A[i+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,A,u)}}F(objlist,H,0,t,g);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=
|
|
|
+b.createBuffer();q.__webGLColorBuffer=b.createBuffer();q=t;u=q.vertices.length;q.__vertexArray=new Float32Array(u*3);q.__colorArray=new Float32Array(u*3);q.__sortArray=[];q.__webGLParticleCount=u;t.__dirtyVertices=!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||g.sortParticles)&&c(t,b.DYNAMIC_DRAW,g,camera);F(objlist,H,0,t,g);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(g instanceof THREE.MarchingCubes){t=H;if(t[0]==undefined){i.__webGLObjectsImmediate.push({object:g,opaque:{list:[],
|
|
|
+count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(e,m){var n,g;for(n=e.__webGLObjects.length-1;n>=0;n--){g=e.__webGLObjects[n].object;m==g&&e.__webGLObjects.splice(n,1)}};this.setFaceCulling=function(e,m){if(e){!m||m=="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}};
|
|
|
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
|
+envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
+map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
|
|
+lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
+lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
+lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
|
+color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
|
+THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
|
|
+value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
|
+THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
|
|
+value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
|
|
+THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
|
|
+THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
|
|
+THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
|
|
+THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
|
|
+THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
|
|
+THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
|
+THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
+THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
|
|
+THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
|