|
@@ -1,7 +1,8 @@
|
|
|
// ThreeWebGL.js r42 - http://github.com/mrdoob/three.js
|
|
|
-var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
|
|
|
-THREE.Color.prototype={constructor:THREE.Color,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,g,i,h,j,k;if(e==0)f=g=i=0;else switch(h=Math.floor(b*6),j=b*6-h,b=e*(1-d),k=e*(1-d*j),d=e*(1-d*(1-j)),h){case 1:f=k;g=e;i=b;break;case 2:f=b;g=e;i=d;break;case 3:f=b;g=k;i=e;break;case 4:f=d;g=b;i=e;break;case 5:f=e;g=b;i=k;break;case 6:case 0:f=
|
|
|
-e,g=d,i=b}this.setRGB(f,g,i)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
|
|
|
+var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
|
|
|
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;return this},setHSV:function(b,d,e){var f,h,i;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-d),i=e*(1-d*h),d=e*(1-d*(1-h)),f){case 1:this.r=i;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=d;break;case 3:this.r=b;this.g=i;this.b=e;break;case 4:this.r=d;this.g=b;this.b=e;break;case 5:this.r=
|
|
|
+e;this.g=b;this.b=i;break;case 6:case 0:this.r=e,this.g=d,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
|
|
|
+THREE.Vector2=function(b,d){this.set(b||0,d||0)};
|
|
|
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,d){this.x=b.x+d.x;this.y=b.y+d.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
|
|
|
divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,b=this.y-b.y;return d*d+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
|
|
|
unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)};
|
|
@@ -14,76 +15,76 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,d,e,f){this.x=
|
|
|
subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
|
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,d){this.x+=(b.x-this.x)*d;this.y+=(b.y-this.y)*d;this.z+=(b.z-this.z)*d;this.w+=(b.w-this.w)*d;return this}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d<e;d++)f=f.concat(this.intersectObject(b[d]));f.sort(function(b,d){return b.distance-d.distance});return f},intersectObject:function(b){function d(b,d,e){var f,e=e.matrixWorld.getPosition();f=e.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(f));return e.distanceTo(b)}function e(b,d,e,f){var f=f.clone().subSelf(d),
|
|
|
-e=e.clone().subSelf(d),g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,i,h,j,
|
|
|
-k,n,r,o,s,p,D=b.geometry,F=D.vertices,G=[],f=0;for(g=D.faces.length;f<g;f++)if(i=D.faces[f],s=this.origin.clone(),p=this.direction.clone(),n=b.matrixWorld,h=n.multiplyVector3(F[i.a].position.clone()),j=n.multiplyVector3(F[i.b].position.clone()),k=n.multiplyVector3(F[i.c].position.clone()),n=i instanceof THREE.Face4?n.multiplyVector3(F[i.d].position.clone()):null,r=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),o=p.dot(r),b.doubleSided||(b.flipSided?o>0:o<0))if(r=r.dot((new THREE.Vector3).sub(h,
|
|
|
-s))/o,s=s.addSelf(p.multiplyScalar(r)),i instanceof THREE.Face3)e(s,h,j,k)&&(i={distance:this.origin.distanceTo(s),point:s,face:i,object:b},G.push(i));else if(i instanceof THREE.Face4&&(e(s,h,j,n)||e(s,j,k,n)))i={distance:this.origin.distanceTo(s),point:s,face:i,object:b},G.push(i);return G}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,r,o){j=!1;d=h;e=i;f=r;g=o;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
|
|
|
-function(h,i,r,o,s,p){j?(j=!1,d=h<r?h<s?h:s:r<s?r:s,e=i<o?i<p?i:p:o<p?o:p,f=h>r?h>s?h:s:r>s?r:s,g=i>o?i>p?i:p:o>p?o:p):(d=h<r?h<s?h<d?h:d:s<d?s:d:r<s?r<d?r:d:s<d?s:d,e=i<o?i<p?i<e?i:e:p<e?p:e:o<p?o<e?o:e:p<e?p:e,f=h>r?h>s?h>f?h:f:s>f?s:f:r>s?r>f?r:f:s>f?s:f,g=i>o?i>p?i>g?i:g:p>g?p:g:o>p?o>g?o:g:p>g?p:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
|
-h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,n,r,o,s,p,D,F){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,n||0,r||1,o||0,s||0,p||0,D||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,d,e,f,g,i,h,j,k,n,r,o,s,p,D,F){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=n;this.n33=r;this.n34=o;this.n41=s;this.n42=p;this.n43=D;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
|
|
|
-d,e){var f=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;
|
|
|
-b.y=(this.n21*d+this.n22*e+this.n23*f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+
|
|
|
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,n=b.n24,r=b.n31,o=b.n32,s=b.n33,p=b.n34,D=b.n41,F=b.n42,G=b.n43,B=b.n44,U=d.n11,ta=d.n12,
|
|
|
-fa=d.n13,H=d.n14,u=d.n21,P=d.n22,I=d.n23,M=d.n24,Q=d.n31,ra=d.n32,ka=d.n33,aa=d.n34,va=d.n41,N=d.n42,J=d.n43,c=d.n44;this.n11=e*U+f*u+g*Q+i*va;this.n12=e*ta+f*P+g*ra+i*N;this.n13=e*fa+f*I+g*ka+i*J;this.n14=e*H+f*M+g*aa+i*c;this.n21=h*U+j*u+k*Q+n*va;this.n22=h*ta+j*P+k*ra+n*N;this.n23=h*fa+j*I+k*ka+n*J;this.n24=h*H+j*M+k*aa+n*c;this.n31=r*U+o*u+s*Q+p*va;this.n32=r*ta+o*P+s*ra+p*N;this.n33=r*fa+o*I+s*ka+p*J;this.n34=r*H+o*M+s*aa+p*c;this.n41=D*U+F*u+G*Q+B*va;this.n42=D*ta+F*P+G*ra+B*N;this.n43=D*fa+
|
|
|
-F*I+G*ka+B*J;this.n44=D*H+F*M+G*aa+B*c;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
|
|
|
-b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,n=this.n32,r=this.n33,o=this.n34,s=this.n41,p=this.n42,D=this.n43,F=this.n44;return f*h*n*s-e*j*n*s-f*i*r*s+d*j*r*s+e*i*o*s-d*h*o*s-f*h*k*p+e*j*k*p+f*g*r*p-b*j*r*p-e*g*o*p+b*h*o*p+f*i*k*D-d*j*k*D-f*g*n*D+b*j*n*D+d*g*o*D-b*i*o*D-e*i*k*F+d*h*
|
|
|
-k*F+e*g*n*F-b*h*n*F-d*g*r*F+b*i*r*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
|
|
|
+e=e.clone().subSelf(d),h=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(h),g=e.dot(e),e=e.dot(h),h=1/(b*g-d*d),g=(g*f-d*e)*h,b=(b*e-d*f)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,i,g,j,
|
|
|
+k,q,n,r,t,o,F=b.geometry,x=F.vertices,G=[],f=0;for(h=F.faces.length;f<h;f++)if(i=F.faces[f],t=this.origin.clone(),o=this.direction.clone(),q=b.matrixWorld,g=q.multiplyVector3(x[i.a].position.clone()),j=q.multiplyVector3(x[i.b].position.clone()),k=q.multiplyVector3(x[i.c].position.clone()),q=i instanceof THREE.Face4?q.multiplyVector3(x[i.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),r=o.dot(n),b.doubleSided||(b.flipSided?r>0:r<0))if(n=n.dot((new THREE.Vector3).sub(g,
|
|
|
+t))/r,t=t.addSelf(o.multiplyScalar(n)),i instanceof THREE.Face3)e(t,g,j,k)&&(i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},G.push(i));else if(i instanceof THREE.Face4&&(e(t,g,j,q)||e(t,j,k,q)))i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},G.push(i);return G}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){i=f-d;g=h-e}var d,e,f,h,i,g,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return g};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,i,n,r){j=!1;d=g;e=i;f=n;h=r;b()};this.addPoint=function(g,i){j?(j=!1,d=g,e=i,f=g,h=i):(d=d<g?d:g,e=e<i?e:i,f=f>g?f:g,h=h>i?h:i);b()};this.add3Points=
|
|
|
+function(g,i,n,r,t,o){j?(j=!1,d=g<n?g<t?g:t:n<t?n:t,e=i<r?i<o?i:o:r<o?r:o,f=g>n?g>t?g:t:n>t?n:t,h=i>r?i>o?i:o:r>o?r:o):(d=g<n?g<t?g<d?g:d:t<d?t:d:n<t?n<d?n:d:t<d?t:d,e=i<r?i<o?i<e?i:e:o<e?o:e:r<o?r<e?r:e:o<e?o:e,f=g>n?g>t?g>f?g:f:t>f?t:f:n>t?n>f?n:f:t>f?t:f,h=i>r?i>o?i>h?i:h:o>h?o:h:r>o?r>h?r:h:o>h?o:h);b()};this.addRectangle=function(g){j?(j=!1,d=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(d=d<g.getLeft()?d:g.getLeft(),e=e<g.getTop()?e:g.getTop(),f=f>g.getRight()?f:g.getRight(),h=h>
|
|
|
+g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){d-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){d=d>g.getLeft()?d:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f<g.getRight()?f:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;h=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,h,i,g,j,k,q,n,r,t,o,F,x){this.set(b||1,d||0,e||0,f||0,h||0,i||1,g||0,j||0,k||0,q||0,n||1,r||0,t||0,o||0,F||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,d,e,f,h,i,g,j,k,q,n,r,t,o,F,x){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=k;this.n32=q;this.n33=n;this.n34=r;this.n41=t;this.n42=o;this.n43=F;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
|
|
|
+d,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;
|
|
|
+b.y=(this.n21*d+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+
|
|
|
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,q=b.n24,n=b.n31,r=b.n32,t=b.n33,o=b.n34,F=b.n41,x=b.n42,G=b.n43,E=b.n44,U=d.n11,ta=d.n12,
|
|
|
+fa=d.n13,I=d.n14,w=d.n21,P=d.n22,J=d.n23,M=d.n24,Q=d.n31,ra=d.n32,ka=d.n33,aa=d.n34,va=d.n41,N=d.n42,K=d.n43,c=d.n44;this.n11=e*U+f*w+h*Q+i*va;this.n12=e*ta+f*P+h*ra+i*N;this.n13=e*fa+f*J+h*ka+i*K;this.n14=e*I+f*M+h*aa+i*c;this.n21=g*U+j*w+k*Q+q*va;this.n22=g*ta+j*P+k*ra+q*N;this.n23=g*fa+j*J+k*ka+q*K;this.n24=g*I+j*M+k*aa+q*c;this.n31=n*U+r*w+t*Q+o*va;this.n32=n*ta+r*P+t*ra+o*N;this.n33=n*fa+r*J+t*ka+o*K;this.n34=n*I+r*M+t*aa+o*c;this.n41=F*U+x*w+G*Q+E*va;this.n42=F*ta+x*P+G*ra+E*N;this.n43=F*fa+
|
|
|
+x*J+G*ka+E*K;this.n44=F*I+x*M+G*aa+E*c;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
|
|
|
+b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,k=this.n31,q=this.n32,n=this.n33,r=this.n34,t=this.n41,o=this.n42,F=this.n43,x=this.n44;return f*g*q*t-e*j*q*t-f*i*n*t+d*j*n*t+e*i*r*t-d*g*r*t-f*g*k*o+e*j*k*o+f*h*n*o-b*j*n*o-e*h*r*o+b*g*r*o+f*i*k*F-d*j*k*F-f*h*q*F+b*j*q*F+d*h*r*F-b*i*r*F-e*i*k*x+d*g*
|
|
|
+k*x+e*h*q*x-b*g*q*x-d*h*n*x+b*i*n*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
|
|
|
b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
|
|
|
this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=
|
|
|
this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,
|
|
|
-0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),g=1-e,i=b.x,h=b.y,j=b.z,k=g*i,n=g*h;this.set(k*i+e,k*h-f*j,k*j+f*h,0,k*h+f*j,n*h+e,n*j-f*i,0,k*j-f*h,n*j+f*i,g*j*j+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,d){var e=b.x,f=b.y,g=b.z,i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),j=Math.cos(g),g=Math.sin(g);switch(d){case "YXZ":var k=
|
|
|
-h*j,n=h*g,r=f*j,o=f*g;this.n11=k+o*e;this.n12=r*e-n;this.n13=i*f;this.n21=i*g;this.n22=i*j;this.n23=-e;this.n31=n*e-r;this.n32=o+k*e;this.n33=i*h;break;case "ZXY":k=h*j;n=h*g;r=f*j;o=f*g;this.n11=k-o*e;this.n12=-i*g;this.n13=r+n*e;this.n21=n+r*e;this.n22=i*j;this.n23=o-k*e;this.n31=-i*f;this.n32=e;this.n33=i*h;break;case "ZYX":k=i*j;n=i*g;r=e*j;o=e*g;this.n11=h*j;this.n12=r*f-n;this.n13=k*f+o;this.n21=h*g;this.n22=o*f+k;this.n23=n*f-r;this.n31=-f;this.n32=e*h;this.n33=i*h;break;case "YZX":k=i*h;n=
|
|
|
-i*f;r=e*h;o=e*f;this.n11=h*j;this.n12=o-k*g;this.n13=r*g+n;this.n21=g;this.n22=i*j;this.n23=-e*j;this.n31=-f*j;this.n32=n*g+r;this.n33=k-o*g;break;case "XZY":k=i*h;n=i*f;r=e*h;o=e*f;this.n11=h*j;this.n12=-g;this.n13=f*j;this.n21=k*g+o;this.n22=i*j;this.n23=n*g-r;this.n31=r*g-n;this.n32=e*j;this.n33=o*g+k;break;default:k=i*j,n=i*g,r=e*j,o=e*g,this.n11=h*j,this.n12=-h*g,this.n13=f,this.n21=n+r*f,this.n22=k-o*f,this.n23=-e*h,this.n31=o-k*f,this.n32=r+n*f,this.n33=i*h}return this},setRotationFromQuaternion:function(b){var d=
|
|
|
-b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,k=d*h;d*=j;var n=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(n+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+n);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
-extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,n=b.n24,r=b.n31,o=b.n32,s=b.n33,p=b.n34,D=b.n41,F=b.n42,G=b.n43,B=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*p*F-n*s*F+n*o*G-j*p*G-k*o*B+j*s*B;d.n12=i*s*F-g*p*F-i*o*G+f*p*G+g*o*B-f*s*B;d.n13=g*n*F-i*k*F+i*j*G-f*n*G-g*j*B+f*k*B;d.n14=i*k*o-g*n*o-i*j*s+f*n*s+g*j*p-f*k*p;d.n21=n*s*D-k*p*D-n*r*G+h*p*G+k*r*B-h*s*B;d.n22=g*p*D-i*s*D+i*r*G-e*p*G-g*r*B+e*s*B;d.n23=i*k*D-g*n*D-i*h*G+e*n*G+g*h*B-e*k*B;d.n24=
|
|
|
-g*n*r-i*k*r+i*h*s-e*n*s-g*h*p+e*k*p;d.n31=j*p*D-n*o*D+n*r*F-h*p*F-j*r*B+h*o*B;d.n32=i*o*D-f*p*D-i*r*F+e*p*F+f*r*B-e*o*B;d.n33=g*n*D-i*j*D+i*h*F-e*n*F-f*h*B+e*j*B;d.n34=i*j*r-f*n*r-i*h*o+e*n*o+f*h*p-e*j*p;d.n41=k*o*D-j*s*D-k*r*F+h*s*F+j*r*G-h*o*G;d.n42=f*s*D-g*o*D+g*r*F-e*s*F-f*r*G+e*o*G;d.n43=g*j*D-f*k*D-g*h*F+e*k*F+f*h*G-e*j*G;d.n44=f*k*r-g*j*r+g*h*o-e*k*o-f*h*s+e*j*s;d.multiplyScalar(1/b.determinant());return d};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,o=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*n;e[7]=b*r;e[8]=b*o;return d};
|
|
|
-THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
|
|
|
-THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,k,n;h=new THREE.Matrix4;j=d-b;k=e-f;n=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((i+g)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
+0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),h=1-e,i=b.x,g=b.y,j=b.z,k=h*i,q=h*g;this.set(k*i+e,k*g-f*j,k*j+f*g,0,k*g+f*j,q*g+e,q*j-f*i,0,k*j-f*g,q*j+f*i,h*j*j+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,d){var e=b.x,f=b.y,h=b.z,i=Math.cos(e),e=Math.sin(e),g=Math.cos(f),f=Math.sin(f),j=Math.cos(h),h=Math.sin(h);switch(d){case "YXZ":var k=
|
|
|
+g*j,q=g*h,n=f*j,r=f*h;this.n11=k+r*e;this.n12=n*e-q;this.n13=i*f;this.n21=i*h;this.n22=i*j;this.n23=-e;this.n31=q*e-n;this.n32=r+k*e;this.n33=i*g;break;case "ZXY":k=g*j;q=g*h;n=f*j;r=f*h;this.n11=k-r*e;this.n12=-i*h;this.n13=n+q*e;this.n21=q+n*e;this.n22=i*j;this.n23=r-k*e;this.n31=-i*f;this.n32=e;this.n33=i*g;break;case "ZYX":k=i*j;q=i*h;n=e*j;r=e*h;this.n11=g*j;this.n12=n*f-q;this.n13=k*f+r;this.n21=g*h;this.n22=r*f+k;this.n23=q*f-n;this.n31=-f;this.n32=e*g;this.n33=i*g;break;case "YZX":k=i*g;q=
|
|
|
+i*f;n=e*g;r=e*f;this.n11=g*j;this.n12=r-k*h;this.n13=n*h+q;this.n21=h;this.n22=i*j;this.n23=-e*j;this.n31=-f*j;this.n32=q*h+n;this.n33=k-r*h;break;case "XZY":k=i*g;q=i*f;n=e*g;r=e*f;this.n11=g*j;this.n12=-h;this.n13=f*j;this.n21=k*h+r;this.n22=i*j;this.n23=q*h-n;this.n31=n*h-q;this.n32=e*j;this.n33=r*h+k;break;default:k=i*j,q=i*h,n=e*j,r=e*h,this.n11=g*j,this.n12=-g*h,this.n13=f,this.n21=q+n*f,this.n22=k-r*f,this.n23=-e*g,this.n31=r-k*f,this.n32=n+q*f,this.n33=i*g}return this},setRotationFromQuaternion:function(b){var d=
|
|
|
+b.x,e=b.y,f=b.z,h=b.w,i=d+d,g=e+e,j=f+f,b=d*i,k=d*g;d*=j;var q=e*g;e*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(q+f);this.n12=k-h;this.n13=d+g;this.n21=k+h;this.n22=1-(b+f);this.n23=e-i;this.n31=d-g;this.n32=e+i;this.n33=1-(b+q);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
+extractRotation:function(b,d){var e=1/d.x,f=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
|
|
|
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,q=b.n24,n=b.n31,r=b.n32,t=b.n33,o=b.n34,F=b.n41,x=b.n42,G=b.n43,E=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*o*x-q*t*x+q*r*G-j*o*G-k*r*E+j*t*E;d.n12=i*t*x-h*o*x-i*r*G+f*o*G+h*r*E-f*t*E;d.n13=h*q*x-i*k*x+i*j*G-f*q*G-h*j*E+f*k*E;d.n14=i*k*r-h*q*r-i*j*t+f*q*t+h*j*o-f*k*o;d.n21=q*t*F-k*o*F-q*n*G+g*o*G+k*n*E-g*t*E;d.n22=h*o*F-i*t*F+i*n*G-e*o*G-h*n*E+e*t*E;d.n23=i*k*F-h*q*F-i*g*G+e*q*G+h*g*E-e*k*E;d.n24=
|
|
|
+h*q*n-i*k*n+i*g*t-e*q*t-h*g*o+e*k*o;d.n31=j*o*F-q*r*F+q*n*x-g*o*x-j*n*E+g*r*E;d.n32=i*r*F-f*o*F-i*n*x+e*o*x+f*n*E-e*r*E;d.n33=h*q*F-i*j*F+i*g*x-e*q*x-f*g*E+e*j*E;d.n34=i*j*n-f*q*n-i*g*r+e*q*r+f*g*o-e*j*o;d.n41=k*r*F-j*t*F-k*n*x+g*t*x+j*n*G-g*r*G;d.n42=f*t*F-h*r*F+h*n*x-e*t*x-f*n*G+e*r*G;d.n43=h*j*F-f*k*F-h*g*x+e*k*x+f*g*G-e*j*G;d.n44=f*k*n-h*j*n+h*g*r-e*k*r-f*g*t+e*j*t;d.multiplyScalar(1/b.determinant());return d};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,q=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,r=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*q;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*i;e[3]=b*g;e[4]=b*j;e[5]=b*k;e[6]=b*q;e[7]=b*n;e[8]=b*r;return d};
|
|
|
+THREE.Matrix4.makeFrustum=function(b,d,e,f,h,i){var g;g=new THREE.Matrix4;g.n11=2*h/(d-b);g.n12=0;g.n13=(d+b)/(d-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(i+h)/(i-h);g.n34=-2*i*h/(i-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,d,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,f)};
|
|
|
+THREE.Matrix4.makeOrtho=function(b,d,e,f,h,i){var g,j,k,q;g=new THREE.Matrix4;j=d-b;k=e-f;q=i-h;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((d+b)/j);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((e+f)/k);g.n31=0;g.n32=0;g.n33=-2/q;g.n34=-((i+h)/q);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
|
|
|
this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
|
|
|
--1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d.parent!==void 0;)d=d.parent;d!==void 0&&d instanceof THREE.Scene&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1)b.parent=void 0,this.children.splice(d,1)},getChildByName:function(b,d){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(d&&(g=g.getChildByName(b,d),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
+-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d.parent!==void 0;)d=d.parent;d!==void 0&&d instanceof THREE.Scene&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1)b.parent=void 0,this.children.splice(d,1)},getChildByName:function(b,d){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(d&&(h=h.getChildByName(b,d),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)};
|
|
|
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);
|
|
|
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,h=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-h),h=Math.sin(-h),i=Math.cos(e),e=Math.sin(e),g=b*d,j=f*h;this.w=g*i-j*e;this.x=g*e+j*i;this.y=f*d*i+b*h*e;this.z=b*h*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);
|
|
|
this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
|
|
|
-b,this.w*=b);return this},multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,
|
|
|
-k=this.w,n=k*e+h*g-j*f,r=k*f+j*e-i*g,o=k*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=n*k+e*-i+r*-j-o*-h;d.y=r*k+e*-h+o*-i-n*-j;d.z=o*k+e*-j+n*-h-r*-i;return d}};
|
|
|
-THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
-THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
|
|
|
-THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
+b,this.w*=b);return this},multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,h=this.w,i=b.x,g=b.y,j=b.z,b=b.w;this.x=d*b+h*i+e*j-f*g;this.y=e*b+h*g+f*i-d*j;this.z=f*b+h*j+d*g-e*i;this.w=h*b-d*i-e*g-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,h=b.z,i=this.x,g=this.y,j=this.z,
|
|
|
+k=this.w,q=k*e+g*h-j*f,n=k*f+j*e-i*h,r=k*h+i*f-g*e,e=-i*e-g*f-j*h;d.x=q*k+e*-i+n*-j-r*-g;d.y=n*k+e*-g+r*-i-q*-j;d.z=r*k+e*-j+q*-g-n*-i;return d}};
|
|
|
+THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
+THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
|
|
|
+THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
|
|
|
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()||
|
|
|
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,h,i,g,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],g=this.vertices[i.c],j.sub(g.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()||
|
|
|
j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,g,i,J){j=b.vertices[d].position;k=b.vertices[e].position;n=b.vertices[f].position;r=h[g];o=h[i];s=h[J];p=k.x-j.x;D=n.x-j.x;F=k.y-j.y;G=n.y-j.y;B=k.z-j.z;U=n.z-j.z;ta=o.u-r.u;fa=s.u-r.u;H=o.v-r.v;u=s.v-r.v;P=1/(ta*u-fa*H);ra.set((u*p-
|
|
|
-H*D)*P,(u*F-H*G)*P,(u*B-H*U)*P);ka.set((ta*D-fa*p)*P,(ta*G-fa*F)*P,(ta*U-fa*B)*P);M[d].addSelf(ra);M[e].addSelf(ra);M[f].addSelf(ra);Q[d].addSelf(ka);Q[e].addSelf(ka);Q[f].addSelf(ka)}var d,e,f,g,i,h,j,k,n,r,o,s,p,D,F,G,B,U,ta,fa,H,u,P,I,M=[],Q=[],ra=new THREE.Vector3,ka=new THREE.Vector3,aa=new THREE.Vector3,va=new THREE.Vector3,N=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)M[d]=new THREE.Vector3,Q[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],
|
|
|
-i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var J=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)N.copy(i.vertexNormals[f]),g=i[J[f]],I=M[g],aa.copy(I),aa.subSelf(N.multiplyScalar(N.dot(I))).normalize(),va.cross(i.vertexNormals[f],I),g=va.dot(Q[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(aa.x,aa.y,aa.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,h,i,K){j=b.vertices[d].position;k=b.vertices[e].position;q=b.vertices[f].position;n=g[h];r=g[i];t=g[K];o=k.x-j.x;F=q.x-j.x;x=k.y-j.y;G=q.y-j.y;E=k.z-j.z;U=q.z-j.z;ta=r.u-n.u;fa=t.u-n.u;I=r.v-n.v;w=t.v-n.v;P=1/(ta*w-fa*I);ra.set((w*o-
|
|
|
+I*F)*P,(w*x-I*G)*P,(w*E-I*U)*P);ka.set((ta*F-fa*o)*P,(ta*G-fa*x)*P,(ta*U-fa*E)*P);M[d].addSelf(ra);M[e].addSelf(ra);M[f].addSelf(ra);Q[d].addSelf(ka);Q[e].addSelf(ka);Q[f].addSelf(ka)}var d,e,f,h,i,g,j,k,q,n,r,t,o,F,x,G,E,U,ta,fa,I,w,P,J,M=[],Q=[],ra=new THREE.Vector3,ka=new THREE.Vector3,aa=new THREE.Vector3,va=new THREE.Vector3,N=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)M[d]=new THREE.Vector3,Q[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],g=this.faceVertexUvs[0][d],
|
|
|
+i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var K=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)N.copy(i.vertexNormals[f]),h=i[K[f]],J=M[h],aa.copy(J),aa.subSelf(N.multiplyScalar(N.dot(J))).normalize(),va.cross(i.vertexNormals[f],J),h=va.dot(Q[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(aa.x,aa.y,aa.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
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 d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
|
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===
|
|
|
-void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];
|
|
|
-h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,k,n,r,o,s;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;n=this.points[e[0]];r=this.points[e[1]];
|
|
|
-o=this.points[e[2]];s=this.points[e[3]];j=h*h;k=h*j;f.x=d(n.x,r.x,o.x,s.x,h,j,k);f.y=d(n.y,r.y,o.y,s.y,h,j,k);f.z=d(n.z,r.z,o.z,s.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
|
|
|
-j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],n=new THREE.Vector3,k=this.getLength();j.push(n.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=k.chunks[d]-k.chunks[d-1];i=Math.ceil(b*e/k.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(n.copy(position).clone());
|
|
|
-j.push(n.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
+void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,h,i,g,j={};e=0;for(f=this.faces.length;e<f;e++)g=this.faces[e],g instanceof THREE.Face3?(h=b(g.a,g.b),d(j,h,e),h=b(g.b,g.c),d(j,h,e),h=b(g.a,g.c),d(j,h,e)):g instanceof THREE.Face4&&(h=b(g.b,g.d),d(j,h,e),h=b(g.a,g.b),d(j,h,e),h=b(g.a,g.d),d(j,h,e),h=b(g.b,g.c),d(j,h,e),h=b(g.c,g.d),d(j,h,e));e=0;for(f=this.edges.length;e<f;e++){g=this.edges[e];h=g.vertexIndices[0];i=g.vertexIndices[1];
|
|
|
+g.faceIndices=j[b(h,i)].array;for(h=0;h<g.faceIndices.length;h++)i=g.faceIndices[h],g.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
|
|
|
+THREE.Spline=function(b){function d(b,d,e,f,h,g,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*g+b*h+d}this.points=b;var e=[],f={x:0,y:0,z:0},h,i,g,j,k,q,n,r,t;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;i=Math.floor(h);g=h-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;q=this.points[e[0]];n=this.points[e[1]];
|
|
|
+r=this.points[e[2]];t=this.points[e[3]];j=g*g;k=g*j;f.x=d(q.x,n.x,r.x,t.x,g,j,k);f.y=d(q.y,n.y,r.y,t.y,g,j,k);f.z=d(q.z,n.z,r.z,t.z,g,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,h=new THREE.Vector3,g=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;h.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),g.copy(position),
|
|
|
+j+=g.distanceTo(h),h.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,h,g,i,j=[],q=new THREE.Vector3,k=this.getLength();j.push(q.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=k.chunks[d]-k.chunks[d-1];i=Math.ceil(b*e/k.total);h=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(e=1;e<i-1;e++)f=h+e*(1/i)*(g-h),position=this.getPoint(f),j.push(q.copy(position).clone());
|
|
|
+j.push(q.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);d.multiplyScalar(b);this.position.addSelf(d);this.target.position.addSelf(d)};
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,d=Math.tan(this.fov*Math.PI/360)*this.near,e=-d,f=b*e,b=Math.abs(b*d-f),e=Math.abs(d-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,d-(this.y+this.height)*e/this.fullHeight,d-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
-THREE.Camera.prototype.setViewOffset=function(b,d,e,f,g,i){this.fullWidth=b;this.fullHeight=d;this.x=e;this.y=f;this.width=g;this.height=i;this.updateProjectionMatrix()};
|
|
|
+THREE.Camera.prototype.setViewOffset=function(b,d,e,f,h,i){this.fullWidth=b;this.fullHeight=d;this.x=e;this.y=f;this.width=h;this.height=i;this.updateProjectionMatrix()};
|
|
|
THREE.Camera.prototype.update=function(b,d,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),d=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
|
|
|
!1,d=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=e||0};
|
|
|
THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,d,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=d||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
|
|
|
THREE.LensFlare=function(b,d,e,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=void 0;b!==void 0&&this.add(b,d,e,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.LensFlare.prototype.add=function(b,d,e,f){d===void 0&&(d=-1);e===void 0&&(e=0);if(f===void 0)f=THREE.BillboardBlending;e=Math.min(e,Math.max(0,e));this.lensFlares.push({texture:b,size:d,distance:e,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
|
|
|
-THREE.LensFlare.prototype.updateLensFlares=function(){var b,d=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(b=0;b<d;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+g*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
|
|
|
-THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
|
|
|
-0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
+THREE.LensFlare.prototype.updateLensFlares=function(){var b,d=this.lensFlares.length,e,f=-this.positionScreen.x*2,h=-this.positionScreen.y*2;for(b=0;b<d;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+h*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
|
|
|
+THREE.Material=function(b){this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
|
|
|
+0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};
|
|
|
THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
|
|
|
THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
|
|
@@ -103,33 +104,33 @@ THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this
|
|
|
THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
|
|
|
void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};
|
|
|
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
|
|
|
-THREE.Texture=function(b,d,e,f,g,i){this.image=b;this.mapping=d!==void 0?d:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
-THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};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.Texture=function(b,d,e,f,h,i){this.id=THREE.TextureCount++;this.image=b;this.mapping=d!==void 0?d:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
+THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;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.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,d,e){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
THREE.Mesh=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d&&d.length?d:[d];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
|
|
|
e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
|
|
|
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Bone.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,d,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
|
|
|
+THREE.Bone.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,d,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
|
|
|
d,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
|
|
|
-THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,i,h,j;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],i=g.pos,h=g.rotq,j=g.scl,f=this.addBone(),f.name=g.name,f.position.set(i[0],i[1],i[2]),f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0,j!==void 0?f.scale.set(j[0],j[1],j[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
|
|
|
-f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
-THREE.SkinnedMesh.prototype.update=function(b,d,e){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,d,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<e;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
|
|
|
+THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,h,i,g,j;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],i=h.pos,g=h.rotq,j=h.scl,f=this.addBone(),f.name=h.name,f.position.set(i[0],i[1],i[2]),f.quaternion.set(g[0],g[1],g[2],g[3]),f.useQuaternion=!0,j!==void 0?f.scale.set(j[0],j[1],j[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
|
|
|
+f=this.bones[e],h.parent===-1?this.addChild(f):this.bones[h.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
+THREE.SkinnedMesh.prototype.update=function(b,d,e){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,d,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<e;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
|
|
|
d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
|
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,d=[],e=0;e<this.bones.length;e++)b=this.bones[e],d.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
|
|
|
-e.y,e.z);this.geometry.skinVerticesA.push(d[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[i].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d]};
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,d=[],e=0;e<this.bones.length;e++)b=this.bones[e],d.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
|
|
|
+e.y,e.z);this.geometry.skinVerticesA.push(d[h].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[i].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d]};
|
|
|
THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,d){d===void 0&&(d=0);for(var d=Math.abs(d),e=0;e<this.LODs.length;e++)if(d<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:d,object3D:b});this.addChild(b)};
|
|
|
THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,k,n,r,o,s,p,D=new THREE.Geometry;D.vertices=this.geometry.vertices;f=D.faces=this.geometry.faces;var F=D.egdes=this.geometry.edges,G=D.edgeFaces=[];g=0;var B=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],B.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
-e.normal;b=0;for(d=F.length;b<d;b++)j=F[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(k="a",r=B[g]+0):e.b===h?(k="b",r=B[g]+1):e.c===h?(k="c",r=B[g]+2):e.d===h&&(k="d",r=B[g]+3),e.a===j?(k+="a",o=B[g]+0):e.b===j?(k+="b",o=B[g]+1):e.c===j?(k+="c",o=B[g]+2):e.d===j&&(k+="d",o=B[g]+3),f.a===h?(n="a",s=B[i]+0):f.b===h?(n="b",s=B[i]+1):f.c===h?(n="c",s=B[i]+2):f.d===h&&(n="d",s=B[i]+3),f.a===j?(n+="a",p=B[i]+0):f.b===j?(n+="b",p=B[i]+
|
|
|
-1):f.c===j?(n+="c",p=B[i]+2):f.d===j&&(n+="d",p=B[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?r>o&&(e=r,r=o,o=e):r<o&&(e=r,r=o,o=e),n==="ac"||n==="ad"||n==="ca"||n==="da"?s>p&&(e=s,s=p,p=e):s<p&&(e=s,s=p,p=e),e=new THREE.Face4(r,o,s,p),e.normal.set(1,0,0),G.push(e);this.geometry=D}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,k,n,r,o=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;h=g[k];h instanceof THREE.Face4?(n=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(n=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
|
|
|
-for(j=0;j<n;j++)r=b[h[o[j]]],d.push(new THREE.Vertex(r.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
|
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,k,n,r,o,s,p,D,F,G=0,B=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(D=0;D<f;D++){i=d[B[D]];j=b[i];for(F=0;F<g;F++)if(h=e[B[F]],k=b[h],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(G++,G===1&&(n=j,r=k,o=i,s=h,p=B[D]),G===2))return p+=B[D],p==="ad"||p==="ac"?{faces:[d,e],vertices:[n,r,k,j],indices:[o,s,
|
|
|
-h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[n,j,k,r],indices:[o,i,h,s],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,h,i,g,j,k,q,n,r,t,o,F=new THREE.Geometry;F.vertices=this.geometry.vertices;f=F.faces=this.geometry.faces;var x=F.egdes=this.geometry.edges,G=F.edgeFaces=[];h=0;var E=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],E.push(h),h+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
+e.normal;b=0;for(d=x.length;b<d;b++)j=x[b],e=j.faces[0],f=j.faces[1],h=j.faceIndices[0],i=j.faceIndices[1],g=j.vertexIndices[0],j=j.vertexIndices[1],e.a===g?(k="a",n=E[h]+0):e.b===g?(k="b",n=E[h]+1):e.c===g?(k="c",n=E[h]+2):e.d===g&&(k="d",n=E[h]+3),e.a===j?(k+="a",r=E[h]+0):e.b===j?(k+="b",r=E[h]+1):e.c===j?(k+="c",r=E[h]+2):e.d===j&&(k+="d",r=E[h]+3),f.a===g?(q="a",t=E[i]+0):f.b===g?(q="b",t=E[i]+1):f.c===g?(q="c",t=E[i]+2):f.d===g&&(q="d",t=E[i]+3),f.a===j?(q+="a",o=E[i]+0):f.b===j?(q+="b",o=E[i]+
|
|
|
+1):f.c===j?(q+="c",o=E[i]+2):f.d===j&&(q+="d",o=E[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?n>r&&(e=n,n=r,r=e):n<r&&(e=n,n=r,r=e),q==="ac"||q==="ad"||q==="ca"||q==="da"?t>o&&(e=t,t=o,o=e):t<o&&(e=t,t=o,o=e),e=new THREE.Face4(n,r,t,o),e.normal.set(1,0,0),G.push(e);this.geometry=F}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,h=b.faces,b=b.vertices,i=h.length,g,j,k,q,n,r=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;g=h[k];g instanceof THREE.Face4?(q=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(q=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(g.normal);e.push(j);
|
|
|
+for(j=0;j<q;j++)n=b[g[r[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<h.length-1;i++){b=e[i];for(g=i+1;g<h.length;g++)j=e[g],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,h,i,g,j,k,q,n,r,t,o,F,x,G=0,E=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(F=0;F<f;F++){i=d[E[F]];j=b[i];for(x=0;x<h;x++)if(g=e[E[x]],k=b[g],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(G++,G===1&&(q=j,n=k,r=i,t=g,o=E[F]),G===2))return o+=E[F],o==="ad"||o==="ac"?{faces:[d,e],vertices:[q,n,k,j],indices:[r,t,
|
|
|
+g,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[q,j,k,n],indices:[r,i,g,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
|
|
|
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
|
|
|
THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
|
|
@@ -138,17 +139,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
|
|
|
THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};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(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
|
|
|
-THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var e=0,f=1,g=b.z+b.w,h=d.z+d.w,c=-b.z+b.w,i=-d.z+d.w;return g>=0&&h>=0&&c>=0&&i>=0?!0:g<0&&h<0||c<0&&i<0?!1:(g<0?e=Math.max(e,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),c<0?e=Math.max(e,c/(c-i)):i<0&&(f=Math.min(f,c/(c-i))),f<e?!1:(b.lerpSelf(d,e),d.lerpSelf(b,1-f),!0))}var f,g,i=[],h,j,k=[],n,r,o=[],s,p=[],D,F,G=[],B,U,ta=[],fa=new THREE.Vector4,H=new THREE.Vector4,
|
|
|
-u=new THREE.Matrix4,P=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,d){u.multiply(d.projectionMatrix,d.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,d){u.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],j,n,k;g=0;n=
|
|
|
-b.objects;b=0;for(j=n.length;b<j;b++){k=n[b];var c;if(!(c=!k.visible))if(c=k instanceof THREE.Mesh){a:{c=void 0;for(var r=k.matrixWorld,o=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),s=0;s<6;s++)if(c=I[s].x*r.n14+I[s].y*r.n24+I[s].z*r.n34+I[s].w,c<=o){c=!1;break a}c=!0}c=!c}if(!c)c=i[g]=i[g]||new THREE.RenderableObject,g++,f=c,fa.copy(k.position),u.multiplyVector3(fa),f.object=k,f.z=fa.z,e.push(f)}h&&e.sort(d);return e};this.projectScene=function(f,g,i){var fa=
|
|
|
-[],N=g.near,J=g.far,c,ha,R,pa,K,ca,O,da,T,S,ua,Ha,Ia,Ja,la,qa,ma;U=F=s=r=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);u.multiply(g.projectionMatrix,g.matrixWorldInverse);I[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);I[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);I[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);I[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);I[4].set(u.n41-u.n31,u.n42-u.n32,u.n43-u.n33,u.n44-u.n34);I[5].set(u.n41+u.n31,u.n42+
|
|
|
-u.n32,u.n43+u.n33,u.n44+u.n34);for(c=0;c<6;c++)T=I[c],T.divideScalar(Math.sqrt(T.x*T.x+T.y*T.y+T.z*T.z));T=this.projectObjects(f,g,!0);f=0;for(c=T.length;f<c;f++)if(S=T[f].object,S.visible)if(ua=S.matrixWorld,Ha=S.matrixRotationWorld,Ia=S.materials,Ja=S.overdraw,j=0,S instanceof THREE.Mesh){la=S.geometry;pa=la.vertices;qa=la.faces;la=la.faceVertexUvs;ha=0;for(R=pa.length;ha<R;ha++)h=b(),h.positionWorld.copy(pa[ha].position),ua.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
-u.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>N&&h.positionScreen.z<J;pa=0;for(ha=qa.length;pa<ha;pa++){R=qa[pa];if(R instanceof THREE.Face3)if(K=k[R.a],ca=k[R.b],O=k[R.c],K.visible&&ca.visible&&O.visible&&(S.doubleSided||S.flipSided!=(O.positionScreen.x-K.positionScreen.x)*(ca.positionScreen.y-K.positionScreen.y)-(O.positionScreen.y-K.positionScreen.y)*(ca.positionScreen.x-K.positionScreen.x)<0))da=o[r]=
|
|
|
-o[r]||new THREE.RenderableFace3,r++,n=da,n.v1.copy(K),n.v2.copy(ca),n.v3.copy(O);else continue;else if(R instanceof THREE.Face4)if(K=k[R.a],ca=k[R.b],O=k[R.c],da=k[R.d],K.visible&&ca.visible&&O.visible&&da.visible&&(S.doubleSided||S.flipSided!=((da.positionScreen.x-K.positionScreen.x)*(ca.positionScreen.y-K.positionScreen.y)-(da.positionScreen.y-K.positionScreen.y)*(ca.positionScreen.x-K.positionScreen.x)<0||(ca.positionScreen.x-O.positionScreen.x)*(da.positionScreen.y-O.positionScreen.y)-(ca.positionScreen.y-
|
|
|
-O.positionScreen.y)*(da.positionScreen.x-O.positionScreen.x)<0)))ma=p[s]=p[s]||new THREE.RenderableFace4,s++,n=ma,n.v1.copy(K),n.v2.copy(ca),n.v3.copy(O),n.v4.copy(da);else continue;n.normalWorld.copy(R.normal);Ha.multiplyVector3(n.normalWorld);n.centroidWorld.copy(R.centroid);ua.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);u.multiplyVector3(n.centroidScreen);O=R.vertexNormals;K=0;for(ca=O.length;K<ca;K++)da=n.vertexNormalsWorld[K],da.copy(O[K]),Ha.multiplyVector3(da);K=
|
|
|
-0;for(ca=la.length;K<ca;K++)if(ma=la[K][pa]){O=0;for(da=ma.length;O<da;O++)n.uvs[K][O]=ma[O]}n.meshMaterials=Ia;n.faceMaterials=R.materials;n.overdraw=Ja;n.z=n.centroidScreen.z;fa.push(n)}}else if(S instanceof THREE.Line){P.multiply(u,ua);pa=S.geometry.vertices;K=b();K.positionScreen.copy(pa[0].position);P.multiplyVector4(K.positionScreen);ha=1;for(R=pa.length;ha<R;ha++)if(K=b(),K.positionScreen.copy(pa[ha].position),P.multiplyVector4(K.positionScreen),ca=k[j-2],M.copy(K.positionScreen),Q.copy(ca.positionScreen),
|
|
|
-e(M,Q))M.multiplyScalar(1/M.w),Q.multiplyScalar(1/Q.w),ua=G[F]=G[F]||new THREE.RenderableLine,F++,D=ua,D.v1.positionScreen.copy(M),D.v2.positionScreen.copy(Q),D.z=Math.max(M.z,Q.z),D.materials=S.materials,fa.push(D)}else if(S instanceof THREE.Particle&&(H.set(S.matrixWorld.n14,S.matrixWorld.n24,S.matrixWorld.n34,1),u.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))ua=ta[U]=ta[U]||new THREE.RenderableParticle,U++,B=ua,B.x=H.x/H.w,B.y=H.y/H.w,B.z=H.z,B.rotation=S.rotation.z,B.scale.x=S.scale.x*Math.abs(B.x-
|
|
|
-(H.x+g.projectionMatrix.n11)/(H.w+g.projectionMatrix.n14)),B.scale.y=S.scale.y*Math.abs(B.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),B.materials=S.materials,fa.push(B);i&&fa.sort(d);return fa}};
|
|
|
+THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var e=0,f=1,h=b.z+b.w,g=d.z+d.w,c=-b.z+b.w,i=-d.z+d.w;return h>=0&&g>=0&&c>=0&&i>=0?!0:h<0&&g<0||c<0&&i<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),c<0?e=Math.max(e,c/(c-i)):i<0&&(f=Math.min(f,c/(c-i))),f<e?!1:(b.lerpSelf(d,e),d.lerpSelf(b,1-f),!0))}var f,h,i=[],g,j,k=[],q,n,r=[],t,o=[],F,x,G=[],E,U,ta=[],fa=new THREE.Vector4,I=new THREE.Vector4,
|
|
|
+w=new THREE.Matrix4,P=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,d){w.multiply(d.projectionMatrix,d.matrixWorldInverse);w.multiplyVector3(b);return b};this.unprojectVector=function(b,d){w.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));w.multiplyVector3(b);return b};this.projectObjects=function(b,e,g){var e=[],j,q,k;h=0;q=
|
|
|
+b.objects;b=0;for(j=q.length;b<j;b++){k=q[b];var c;if(!(c=!k.visible))if(c=k instanceof THREE.Mesh){a:{c=void 0;for(var n=k.matrixWorld,r=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),t=0;t<6;t++)if(c=J[t].x*n.n14+J[t].y*n.n24+J[t].z*n.n34+J[t].w,c<=r){c=!1;break a}c=!0}c=!c}if(!c)c=i[h]=i[h]||new THREE.RenderableObject,h++,f=c,fa.copy(k.position),w.multiplyVector3(fa),f.object=k,f.z=fa.z,e.push(f)}g&&e.sort(d);return e};this.projectScene=function(f,h,i){var fa=
|
|
|
+[],N=h.near,K=h.far,c,ha,R,pa,L,ca,O,da,T,S,ua,Ga,Ha,Ia,la,qa,ma;U=x=t=n=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);w.multiply(h.projectionMatrix,h.matrixWorldInverse);J[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);J[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);J[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);J[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);J[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);J[5].set(w.n41+w.n31,w.n42+
|
|
|
+w.n32,w.n43+w.n33,w.n44+w.n34);for(c=0;c<6;c++)T=J[c],T.divideScalar(Math.sqrt(T.x*T.x+T.y*T.y+T.z*T.z));T=this.projectObjects(f,h,!0);f=0;for(c=T.length;f<c;f++)if(S=T[f].object,S.visible)if(ua=S.matrixWorld,Ga=S.matrixRotationWorld,Ha=S.materials,Ia=S.overdraw,j=0,S instanceof THREE.Mesh){la=S.geometry;pa=la.vertices;qa=la.faces;la=la.faceVertexUvs;ha=0;for(R=pa.length;ha<R;ha++)g=b(),g.positionWorld.copy(pa[ha].position),ua.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
|
|
|
+w.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>N&&g.positionScreen.z<K;pa=0;for(ha=qa.length;pa<ha;pa++){R=qa[pa];if(R instanceof THREE.Face3)if(L=k[R.a],ca=k[R.b],O=k[R.c],L.visible&&ca.visible&&O.visible&&(S.doubleSided||S.flipSided!=(O.positionScreen.x-L.positionScreen.x)*(ca.positionScreen.y-L.positionScreen.y)-(O.positionScreen.y-L.positionScreen.y)*(ca.positionScreen.x-L.positionScreen.x)<0))da=r[n]=
|
|
|
+r[n]||new THREE.RenderableFace3,n++,q=da,q.v1.copy(L),q.v2.copy(ca),q.v3.copy(O);else continue;else if(R instanceof THREE.Face4)if(L=k[R.a],ca=k[R.b],O=k[R.c],da=k[R.d],L.visible&&ca.visible&&O.visible&&da.visible&&(S.doubleSided||S.flipSided!=((da.positionScreen.x-L.positionScreen.x)*(ca.positionScreen.y-L.positionScreen.y)-(da.positionScreen.y-L.positionScreen.y)*(ca.positionScreen.x-L.positionScreen.x)<0||(ca.positionScreen.x-O.positionScreen.x)*(da.positionScreen.y-O.positionScreen.y)-(ca.positionScreen.y-
|
|
|
+O.positionScreen.y)*(da.positionScreen.x-O.positionScreen.x)<0)))ma=o[t]=o[t]||new THREE.RenderableFace4,t++,q=ma,q.v1.copy(L),q.v2.copy(ca),q.v3.copy(O),q.v4.copy(da);else continue;q.normalWorld.copy(R.normal);Ga.multiplyVector3(q.normalWorld);q.centroidWorld.copy(R.centroid);ua.multiplyVector3(q.centroidWorld);q.centroidScreen.copy(q.centroidWorld);w.multiplyVector3(q.centroidScreen);O=R.vertexNormals;L=0;for(ca=O.length;L<ca;L++)da=q.vertexNormalsWorld[L],da.copy(O[L]),Ga.multiplyVector3(da);L=
|
|
|
+0;for(ca=la.length;L<ca;L++)if(ma=la[L][pa]){O=0;for(da=ma.length;O<da;O++)q.uvs[L][O]=ma[O]}q.meshMaterials=Ha;q.faceMaterials=R.materials;q.overdraw=Ia;q.z=q.centroidScreen.z;fa.push(q)}}else if(S instanceof THREE.Line){P.multiply(w,ua);pa=S.geometry.vertices;L=b();L.positionScreen.copy(pa[0].position);P.multiplyVector4(L.positionScreen);ha=1;for(R=pa.length;ha<R;ha++)if(L=b(),L.positionScreen.copy(pa[ha].position),P.multiplyVector4(L.positionScreen),ca=k[j-2],M.copy(L.positionScreen),Q.copy(ca.positionScreen),
|
|
|
+e(M,Q))M.multiplyScalar(1/M.w),Q.multiplyScalar(1/Q.w),ua=G[x]=G[x]||new THREE.RenderableLine,x++,F=ua,F.v1.positionScreen.copy(M),F.v2.positionScreen.copy(Q),F.z=Math.max(M.z,Q.z),F.materials=S.materials,fa.push(F)}else if(S instanceof THREE.Particle&&(I.set(S.matrixWorld.n14,S.matrixWorld.n24,S.matrixWorld.n34,1),w.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ua=ta[U]=ta[U]||new THREE.RenderableParticle,U++,E=ua,E.x=I.x/I.w,E.y=I.y/I.w,E.z=I.z,E.rotation=S.rotation.z,E.scale.x=S.scale.x*Math.abs(E.x-
|
|
|
+(I.x+h.projectionMatrix.n11)/(I.w+h.projectionMatrix.n14)),E.scale.y=S.scale.y*Math.abs(E.y-(I.y+h.projectionMatrix.n22)/(I.w+h.projectionMatrix.n24)),E.materials=S.materials,fa.push(E);i&&fa.sort(d);return fa}};
|
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
|
|
@@ -160,7 +161,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
|
|
|
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
|
|
|
shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
|
|
|
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
|
|
|
-THREE.UniformsUtils={merge:function(b){var d,e,f,g={};for(d=0;d<b.length;d++)for(e in f=this.clone(b[d]),f)g[e]=f[e];return g},clone:function(b){var d,e,f,g={};for(d in b)for(e in g[d]={},b[d])f=b[d][e],g[d][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return g}};
|
|
|
+THREE.UniformsUtils={merge:function(b){var d,e,f,h={};for(d=0;d<b.length;d++)for(e in f=this.clone(b[d]),f)h[e]=f[e];return h},clone:function(b){var d,e,f,h={};for(d in b)for(e in h[d]={},b[d])f=b[d][e],h[d][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return h}};
|
|
|
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{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:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
|
|
|
value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:3,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
|
|
@@ -184,130 +185,130 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
|
|
|
"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
|
|
|
"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
|
|
|
-THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,Da=b.colors,C=Da.length,q=b.__vertexArray,k=b.__colorArray,E=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors,o=b.__webglCustomAttributes,s,p;if(o)for(s in o)o[s].offset=0;if(e.sortParticles){wa.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,Ka.copy(g),wa.multiplyVector3(Ka),E[f]=[Ka.z,f];E.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[E[f][1]].position,h=f*3,q[h]=g.x,q[h+1]=g.y,q[h+2]=
|
|
|
-g.z;for(f=0;f<C;f++)h=f*3,color=Da[E[f][1]],k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;if(o)for(s in o){f=o[s];Da=f.value.length;for(h=0;h<Da;h++){index=E[h][1];C=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[C]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")p=f.value[index];f.size===2?(f.array[C]=p.x,f.array[C+1]=p.y):f.size===3?f.type==="c"?(f.array[C]=p.r,f.array[C+1]=p.g,f.array[C+2]=p.b):(f.array[C]=p.x,f.array[C+1]=p.y,f.array[C+2]=p.z):(f.array[C]=
|
|
|
-p.x,f.array[C+1]=p.y,f.array[C+2]=p.z,f.array[C+3]=p.w)}f.offset+=f.size}}}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,q[h]=g.x,q[h+1]=g.y,q[h+2]=g.z;if(r)for(f=0;f<C;f++)color=Da[f],h=f*3,k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;if(o)for(s in o)if(f=o[s],f.__original.needsUpdate){Da=f.value.length;for(h=0;h<Da;h++){C=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[C]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")p=f.value[h];f.size===2?(f.array[C]=
|
|
|
-p.x,f.array[C+1]=p.y):f.size===3?f.type==="c"?(f.array[C]=p.r,f.array[C+1]=p.g,f.array[C+2]=p.b):(f.array[C]=p.x,f.array[C+1]=p.y,f.array[C+2]=p.z):(f.array[C]=p.x,f.array[C+1]=p.y,f.array[C+2]=p.z,f.array[C+3]=p.w)}f.offset+=f.size}}}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,q,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,k,d);if(o)for(s in o)if(f=o[s],f.__original.needsUpdate||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-f.buffer),c.bufferData(c.ARRAY_BUFFER,f.array,d)}function e(b,d,e,f,g){f.program||J.initMaterial(f,d,e,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(J.maxMorphTargets);for(var h=0,i=J.maxMorphTargets;h<i;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,i=h.uniforms,j=f.uniforms;h!=R&&(c.useProgram(h),R=h);c.uniformMatrix4fv(i.projectionMatrix,!1,La);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var k,C,q,n=0,E=0,r=0,o,s,p,y=Sa,u=y.directional.colors,w=y.directional.positions,B=y.point.colors,D=y.point.positions,F=y.point.distances,
|
|
|
-x=0,t=0,e=C=p=0;for(k=d.length;e<k;e++)if(C=d[e],q=C.color,o=C.position,s=C.intensity,p=C.distance,C instanceof THREE.AmbientLight)n+=q.r,E+=q.g,r+=q.b;else if(C instanceof THREE.DirectionalLight)p=x*3,u[p]=q.r*s,u[p+1]=q.g*s,u[p+2]=q.b*s,w[p]=o.x,w[p+1]=o.y,w[p+2]=o.z,x+=1;else if(C instanceof THREE.SpotLight)p=x*3,u[p]=q.r*s,u[p+1]=q.g*s,u[p+2]=q.b*s,q=1/o.length(),w[p]=o.x*q,w[p+1]=o.y*q,w[p+2]=o.z*q,x+=1;else if(C instanceof THREE.PointLight)C=t*3,B[C]=q.r*s,B[C+1]=q.g*s,B[C+2]=q.b*s,D[C]=o.x,
|
|
|
-D[C+1]=o.y,D[C+2]=o.z,F[t]=p,t+=1;for(e=x*3;e<u.length;e++)u[e]=0;for(e=t*3;e<B.length;e++)B[e]=0;y.point.length=t;y.directional.length=x;y.ambient[0]=n;y.ambient[1]=E;y.ambient[2]=r;e=Sa;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
|
|
|
+THREE.WebGLRenderer=function(b){function d(b,d,e){var f,h,g,i=b.vertices,j=i.length,H=b.colors,D=H.length,p=b.__vertexArray,k=b.__colorArray,C=b.__sortArray,q=b.__dirtyVertices,n=b.__dirtyColors,r=b.__webglCustomAttributes,t,o;if(r)for(t in r)r[t].offset=0;if(e.sortParticles){wa.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)h=i[f].position,Ja.copy(h),wa.multiplyVector3(Ja),C[f]=[Ja.z,f];C.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)h=i[C[f][1]].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;
|
|
|
+for(f=0;f<D;f++)g=f*3,color=H[C[f][1]],k[g]=color.r,k[g+1]=color.g,k[g+2]=color.b;if(r)for(t in r){f=r[t];H=f.value.length;for(g=0;g<H;g++){index=C[g][1];D=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[D]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")o=f.value[index];f.size===2?(f.array[D]=o.x,f.array[D+1]=o.y):f.size===3?f.type==="c"?(f.array[D]=o.r,f.array[D+1]=o.g,f.array[D+2]=o.b):(f.array[D]=o.x,f.array[D+1]=o.y,f.array[D+2]=o.z):(f.array[D]=
|
|
|
+o.x,f.array[D+1]=o.y,f.array[D+2]=o.z,f.array[D+3]=o.w)}f.offset+=f.size}}}else{if(q)for(f=0;f<j;f++)h=i[f].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;if(n)for(f=0;f<D;f++)color=H[f],g=f*3,k[g]=color.r,k[g+1]=color.g,k[g+2]=color.b;if(r)for(t in r)if(f=r[t],f.__original.needsUpdate){H=f.value.length;for(g=0;g<H;g++){D=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[D]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")o=f.value[g];f.size===2?(f.array[D]=
|
|
|
+o.x,f.array[D+1]=o.y):f.size===3?f.type==="c"?(f.array[D]=o.r,f.array[D+1]=o.g,f.array[D+2]=o.b):(f.array[D]=o.x,f.array[D+1]=o.y,f.array[D+2]=o.z):(f.array[D]=o.x,f.array[D+1]=o.y,f.array[D+2]=o.z,f.array[D+3]=o.w)}f.offset+=f.size}}}if(q||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,k,d);if(r)for(t in r)if(f=r[t],f.__original.needsUpdate||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+f.buffer),c.bufferData(c.ARRAY_BUFFER,f.array,d)}function e(b,d,e,f,h){f.program||K.initMaterial(f,d,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);for(var g=0,i=K.maxMorphTargets;g<i;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,i=g.uniforms,j=f.uniforms;g!=R&&(c.useProgram(g),R=g);c.uniformMatrix4fv(i.projectionMatrix,!1,Ka);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var H,D,p,k=0,C=0,q=0,n,r,t,o=Ra,A=o.directional.colors,w=o.directional.positions,v=o.point.colors,E=o.point.positions,F=o.point.distances,
|
|
|
+x=0,s=0,e=D=t=0;for(H=d.length;e<H;e++)if(D=d[e],p=D.color,n=D.position,r=D.intensity,t=D.distance,D instanceof THREE.AmbientLight)k+=p.r,C+=p.g,q+=p.b;else if(D instanceof THREE.DirectionalLight)t=x*3,A[t]=p.r*r,A[t+1]=p.g*r,A[t+2]=p.b*r,w[t]=n.x,w[t+1]=n.y,w[t+2]=n.z,x+=1;else if(D instanceof THREE.SpotLight)t=x*3,A[t]=p.r*r,A[t+1]=p.g*r,A[t+2]=p.b*r,p=1/n.length(),w[t]=n.x*p,w[t+1]=n.y*p,w[t+2]=n.z*p,x+=1;else if(D instanceof THREE.PointLight)D=s*3,v[D]=p.r*r,v[D+1]=p.g*r,v[D+2]=p.b*r,E[D]=n.x,
|
|
|
+E[D+1]=n.y,E[D+2]=n.z,F[s]=t,s+=1;for(e=x*3;e<A.length;e++)A[e]=0;for(e=s*3;e<v.length;e++)v[e]=0;o.point.length=s;o.directional.length=x;o.ambient[0]=k;o.ambient[1]=C;o.ambient[2]=q;e=Ra;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
|
|
|
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=xa.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=
|
|
|
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&j.shadowMatrix){for(e=0;e<Oa.length;e++)j.shadowMatrix.value[e]=Oa[e],j.shadowMap.texture[e]=J.shadowMap[e];j.shadowDarkness.value=J.shadowMapDarkness;j.shadowBias.value=J.shadowMapBias}for(var m in j)if(n=h.uniforms[m])if(k=j[m],E=k.type,e=k.value,E=="i")c.uniform1i(n,e);else if(E=="f")c.uniform1f(n,e);else if(E=="fv1")c.uniform1fv(n,e);else if(E=="fv")c.uniform3fv(n,e);else if(E==
|
|
|
-"v2")c.uniform2f(n,e.x,e.y);else if(E=="v3")c.uniform3f(n,e.x,e.y,e.z);else if(E=="v4")c.uniform4f(n,e.x,e.y,e.z,e.w);else if(E=="m4"){if(!k._array)k._array=new Float32Array(16);e.flattenToArray(k._array);c.uniformMatrix4fv(n,!1,k._array)}else if(E=="m4v"){if(!k._array)k._array=new Float32Array(16*e.length);E=0;for(r=e.length;E<r;E++)e[E].flattenToArrayOffset(k._array,E*16);c.uniformMatrix4fv(n,!1,k._array)}else if(E=="c")c.uniform3f(n,e.r,e.g,e.b);else if(E=="t"){if(c.uniform1i(n,e),n=k.texture)if(n.image instanceof
|
|
|
-Array&&n.image.length==6){if(k=n,k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(n=0;n<6;++n)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[n])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(n=0;n<6;++n)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[n]);k.__webglInit=!0}Q(c.TEXTURE_CUBE_MAP,
|
|
|
-k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else ra(n,e)}else if(E=="tv"){if(!k._array){k._array=[];E=0;for(r=k.texture.length;E<r;E++)k._array[E]=e+E}c.uniform1iv(n,k._array);E=0;for(r=k.texture.length;E<r;E++)(n=k.texture[E])&&ra(n,k._array[E])}c.uniformMatrix4fv(i.modelViewMatrix,!1,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._normalMatrixArray);(f instanceof
|
|
|
-THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,
|
|
|
-!1,Ma);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,Ma);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ma),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;
|
|
|
-if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else if(i.morphTargetBase){d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=
|
|
|
-0,k=i.morphTargetForcedOrder,n=i.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=n[k[f]],f++;else{var k=[],C=-1,q=0,n=i.morphTargetInfluences,r,E=n.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(r=0;r<E;r++)!k[r]&&n[r]>C&&(q=r,C=n[q]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);
|
|
|
-c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=C;k[q]=1;C=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(j in h.__webglCustomAttributes)b[j]>=0&&(d=h.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),
|
|
|
-c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,
|
|
|
-4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),J.data.vertices+=h.__webglFaceCount,J.data.faces+=h.__webglFaceCount/
|
|
|
-3,J.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),J.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),J.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),J.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
|
|
|
-c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,g,i,j,k,n,q,r,E,o=b.count*3;for(E=0;E<o;E+=9)e=b.normalArray,f=e[E],h=e[E+1],g=e[E+2],i=e[E+3],k=e[E+4],q=e[E+5],j=e[E+6],n=e[E+7],r=e[E+8],f=(f+i+j)/
|
|
|
-3,h=(h+k+n)/3,g=(g+q+r)/3,e[E]=f,e[E+1]=h,e[E+2]=g,e[E+3]=f,e[E+4]=h,e[E+5]=g,e[E+6]=f,e[E+7]=h,e[E+8]=g}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(ca!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),ca=b.doubleSided;if(O!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),O=b.flipSided}
|
|
|
-function h(b){T!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),T=b)}function j(b,e,d){S!=b&&(b?c.enable(c.POLYGON_OFFSET_FILL):c.disable(c.POLYGON_OFFSET_FILL),S=b);if(b&&(ua!=e||Ha!=d))c.polygonOffset(e,d),ua=e,Ha=d}function k(b){ma[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ma[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ma[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ma[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ma[4].set(b.n41-b.n31,b.n42-
|
|
|
-b.n32,b.n43-b.n33,b.n44-b.n34);ma[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ma[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function n(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ma[d].x*c.n14+ma[d].y*c.n24+ma[d].z*c.n34+ma[d].w,b<=e)return!1;return!0}function r(b,c){b.list[b.count]=c;b.count+=1}function o(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;h.count=0;b=
|
|
|
-f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?r(h,d):r(f,d)}function s(b){var c,d,e,f,h=b.object,g=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=g.materials.length;c<d;c++)(f=g.materials[c])&&(f.transparent?r(j,f):r(i,f))}else(f=c)&&(f.transparent?r(j,f):r(i,f))}function p(b,c){return c.z-b.z}function D(b,d){var j,Ra,Ba,r=0,o,Ca,p,C,q=b.lights;na||(na=new THREE.Camera(J.shadowCameraFov,
|
|
|
-d.aspect,J.shadowCameraNear,J.shadowCameraFar));j=0;for(Ra=q.length;j<Ra;j++)if(Ba=q[j],Ba instanceof THREE.SpotLight&&Ba.castShadow){J.shadowMap[r]||(J.shadowMap[r]=new THREE.WebGLRenderTarget(J.shadowMapWidth,J.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Oa[r]||(Oa[r]=new THREE.Matrix4);o=J.shadowMap[r];Ca=Oa[r];na.position.copy(Ba.position);na.target.position.copy(Ba.target.position);na.update(void 0,!0);b.update(void 0,!1,na);Ca.set(0.5,
|
|
|
-0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);Ca.multiplySelf(na.projectionMatrix);Ca.multiplySelf(na.matrixWorldInverse);na.matrixWorldInverse.flattenToArray(Ma);na.projectionMatrix.flattenToArray(La);wa.multiply(na.projectionMatrix,na.matrixWorldInverse);k(wa);J.initWebGLObjects(b);ka(o);c.clearColor(1,1,1,1);J.clear();c.clearColor(sa.r,sa.g,sa.b,Na);Ca=b.__webglObjects.length;Ba=b.__webglObjectsImmediate.length;for(o=0;o<Ca;o++)p=b.__webglObjects[o],C=p.object,C.visible&&C.castShadow?!(C instanceof
|
|
|
-THREE.Mesh)||n(C)?(C.matrixWorld.flattenToArray(C._objectMatrixArray),U(C,na,!1),p.render=!0):p.render=!1:p.render=!1;h(!0);M(THREE.NormalBlending);for(o=0;o<Ca;o++)if(p=b.__webglObjects[o],p.render)C=p.object,buffer=p.buffer,i(C),p=C.customDepthMaterial?C.customDepthMaterial:C.geometry.morphTargets.length?Ta:Pa,f(na,q,null,p,buffer,C);for(o=0;o<Ba;o++)p=b.__webglObjectsImmediate[o],C=p.object,C.visible&&C.castShadow&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),U(C,na,
|
|
|
-!1),i(C),program=e(na,q,null,Pa,C),C.render(function(b){g(b,program,Pa.shading)}));r++}}function F(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,h=b.lights,g=[],i,j,k,n,q,r=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof
|
|
|
-THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(q=0;q<r;q++)f=b.__webglShadowVolumes[q].object,i=b.__webglShadowVolumes[q].buffer,j=f.materials[0],j.program||J.initMaterial(j,h,void 0,f),j=j.program,k=j.uniforms,n=j.attributes,R!==j&&(c.useProgram(j),R=j,c.uniformMatrix4fv(k.projectionMatrix,!1,La),c.uniformMatrix4fv(k.viewMatrix,!1,Ma),c.uniform3fv(k.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,
|
|
|
-!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(n.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(n.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,
|
|
|
-!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);T=da=-1;R=v.program;c.useProgram(v.program);c.uniformMatrix4fv(v.projectionLocation,!1,La);c.uniform1f(v.darknessLocation,v.darkness);c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.vertexAttribPointer(v.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(v.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);
|
|
|
-c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(K)}function G(b,d){var e,f,h;e=w.attributes;var g=w.uniforms,i=qa/la,j,k=[],n=la*0.5,q=qa*0.5,r=!0;c.useProgram(w.program);R=w.program;T=da=-1;Ua||(c.enableVertexAttribArray(w.attributes.position),c.enableVertexAttribArray(w.attributes.uv),Ua=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,w.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,
|
|
|
-!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.elementBuffer);c.uniformMatrix4fv(g.projectionMatrix,!1,La);c.activeTexture(c.TEXTURE0);c.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(p);e=0;for(f=b.__webglSprites.length;e<f;e++)h=
|
|
|
-b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(c.uniform1i(g.useScreenCoordinates,1),c.uniform3f(g.screenPosition,(h.position.x-n)/n,(q-h.position.y)/q,Math.max(0,Math.min(1,h.position.z)))):(c.uniform1i(g.useScreenCoordinates,0),c.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),c.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),j=h.map.image.width/(h.scaleByViewport?qa:1),k[0]=j*i*h.scale.x,k[1]=j*h.scale.y,c.uniform2f(g.uvScale,
|
|
|
-h.uvScale.x,h.uvScale.y),c.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),c.uniform2f(g.alignment,h.alignment.x,h.alignment.y),c.uniform1f(g.opacity,h.opacity),c.uniform1f(g.rotation,h.rotation),c.uniform2fv(g.scale,k),h.mergeWith3D&&!r?(c.enable(c.DEPTH_TEST),r=!0):!h.mergeWith3D&&r&&(c.disable(c.DEPTH_TEST),r=!1),M(h.blending),ra(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(K)}function B(b,e){var d,f,h=b.__webglLensFlares.length,
|
|
|
-g,i,j,k=new THREE.Vector3,n=qa/la,q=la*0.5,r=qa*0.5,o=16/qa,p=[o*n,o],s=[1,1,0],u=[1,1],w=y.uniforms;d=y.attributes;c.useProgram(y.program);R=y.program;T=da=-1;Va||(c.enableVertexAttribArray(y.attributes.vertex),c.enableVertexAttribArray(y.attributes.uv),Va=!0);c.uniform1i(w.occlusionMap,0);c.uniform1i(w.map,1);c.bindBuffer(c.ARRAY_BUFFER,y.vertexBuffer);c.vertexAttribPointer(d.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(d.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.elementBuffer);
|
|
|
-c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,y.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<h;f++)if(d=b.__webglLensFlares[f].object,k.set(d.matrixWorld.n14,d.matrixWorld.n24,d.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(k),e.projectionMatrix.multiplyVector3(k),s[0]=k.x,s[1]=k.y,s[2]=k.z,u[0]=s[0]*q+q,u[1]=s[1]*r+r,y.hasVertexTexture||u[0]>0&&u[0]<la&&u[1]>0&&u[1]<qa){c.bindTexture(c.TEXTURE_2D,y.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
|
|
|
-0,c.RGB,u[0]-8,u[1]-8,16,16,0);c.uniform1i(w.renderType,0);c.uniform2fv(w.scale,p);c.uniform3fv(w.screenPosition,s);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,y.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,u[0]-8,u[1]-8,16,16,0);c.uniform1i(w.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,y.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);d.positionScreen.x=s[0];d.positionScreen.y=
|
|
|
-s[1];d.positionScreen.z=s[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(w.renderType,2);c.enable(c.BLEND);g=0;for(i=d.lensFlares.length;g<i;g++)if(j=d.lensFlares[g],j.opacity>0.0010&&j.scale>0.0010)s[0]=j.x,s[1]=j.y,s[2]=j.z,o=j.size*j.scale/qa,p[0]=o*n,p[1]=o,c.uniform3fv(w.screenPosition,s),c.uniform2fv(w.scale,p),c.uniform1f(w.rotation,j.rotation),c.uniform1f(w.opacity,j.opacity),M(j.blending),ra(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
|
|
|
-0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(K)}function U(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ta(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function fa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=
|
|
|
-f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function H(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=ta(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var i=b,j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,n=void 0,r=void 0,q=void 0,o=r=void 0,p=void 0,s=void 0,u=void 0,w=void 0,y=void 0,B=void 0,D=void 0,F=void 0,
|
|
|
-x=void 0,v=void 0,L=void 0,G=void 0,t=q=u=q=s=p=void 0,m=void 0,A=m=t=p=void 0,J=void 0,K=A=m=t=r=r=o=u=q=A=m=t=J=A=m=t=J=A=m=t=void 0,H=0,I=0,R=0,S=0,M=0,N=0,V=0,O=0,ea=0,z=0,ga=0,A=t=0,A=void 0,ia=g.__vertexArray,aa=g.__uvArray,ca=g.__uv2Array,Q=g.__normalArray,W=g.__tangentArray,ja=g.__colorArray,X=g.__skinVertexAArray,Y=g.__skinVertexBArray,Z=g.__skinIndexArray,$=g.__skinWeightArray,da=g.__morphTargetsArrays,U=g.__webglCustomAttributes,m=void 0,P=g.__faceArray,T=g.__lineArray,ma=g.__needsSmoothNormals,
|
|
|
-y=g.__vertexColorType,w=g.__uvType,B=g.__normalType,oa=i.geometry,la=oa.__dirtyVertices,na=oa.__dirtyElements,ha=oa.__dirtyUvs,pa=oa.__dirtyNormals,qa=oa.__dirtyTangents,ra=oa.__dirtyColors,sa=oa.__dirtyMorphTargets,ka=oa.vertices,ua=g.faces,va=oa.faces,wa=oa.faceVertexUvs[0],xa=oa.faceVertexUvs[1],Ea=oa.skinVerticesA,Fa=oa.skinVerticesB,Ga=oa.skinIndices,za=oa.skinWeights,Aa=i instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,ya=oa.morphTargets;if(U)for(K in U)U[K].offset=0,U[K].offsetSrc=0;k=0;
|
|
|
-for(n=ua.length;k<n;k++)if(r=ua[k],q=va[r],wa&&(D=wa[r]),xa&&(F=xa[r]),r=q.vertexNormals,o=q.normal,p=q.vertexColors,s=q.color,u=q.vertexTangents,q instanceof THREE.Face3){if(la)x=ka[q.a].position,v=ka[q.b].position,L=ka[q.c].position,ia[I]=x.x,ia[I+1]=x.y,ia[I+2]=x.z,ia[I+3]=v.x,ia[I+4]=v.y,ia[I+5]=v.z,ia[I+6]=L.x,ia[I+7]=L.y,ia[I+8]=L.z,I+=9;if(U)for(K in U)if(m=U[K],m.__original.needsUpdate)t=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[t]=m.value[q.a],
|
|
|
-m.array[t+1]=m.value[q.b],m.array[t+2]=m.value[q.c]):m.boundTo==="faces"?(A=m.value[A],m.array[t]=A,m.array[t+1]=A,m.array[t+2]=A,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[t]=m.value[A],m.array[t+1]=m.value[A+1],m.array[t+2]=m.value[A+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[q.a],v=m.value[q.b],L=m.value[q.c]):m.boundTo==="faces"?(L=v=x=A=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[A],v=m.value[A+1],L=m.value[A+2],m.offsetSrc+=
|
|
|
-3),m.size===2?(m.array[t]=x.x,m.array[t+1]=x.y,m.array[t+2]=v.x,m.array[t+3]=v.y,m.array[t+4]=L.x,m.array[t+5]=L.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[t]=x.r,m.array[t+1]=x.g,m.array[t+2]=x.b,m.array[t+3]=v.r,m.array[t+4]=v.g,m.array[t+5]=v.b,m.array[t+6]=L.r,m.array[t+7]=L.g,m.array[t+8]=L.b):(m.array[t]=x.x,m.array[t+1]=x.y,m.array[t+2]=x.z,m.array[t+3]=v.x,m.array[t+4]=v.y,m.array[t+5]=v.z,m.array[t+6]=L.x,m.array[t+7]=L.y,m.array[t+8]=L.z),m.offset+=9):(m.array[t]=x.x,m.array[t+1]=
|
|
|
-x.y,m.array[t+2]=x.z,m.array[t+3]=x.w,m.array[t+4]=v.x,m.array[t+5]=v.y,m.array[t+6]=v.z,m.array[t+7]=v.w,m.array[t+8]=L.x,m.array[t+9]=L.y,m.array[t+10]=L.z,m.array[t+11]=L.w,m.offset+=12));if(sa){t=0;for(m=ya.length;t<m;t++)x=ya[t].vertices[q.a].position,v=ya[t].vertices[q.b].position,L=ya[t].vertices[q.c].position,A=da[t],A[ga]=x.x,A[ga+1]=x.y,A[ga+2]=x.z,A[ga+3]=v.x,A[ga+4]=v.y,A[ga+5]=v.z,A[ga+6]=L.x,A[ga+7]=L.y,A[ga+8]=L.z;ga+=9}if(za.length)t=za[q.a],m=za[q.b],A=za[q.c],$[z]=t.x,$[z+1]=t.y,
|
|
|
-$[z+2]=t.z,$[z+3]=t.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=A.x,$[z+9]=A.y,$[z+10]=A.z,$[z+11]=A.w,t=Ga[q.a],m=Ga[q.b],A=Ga[q.c],Z[z]=t.x,Z[z+1]=t.y,Z[z+2]=t.z,Z[z+3]=t.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=A.x,Z[z+9]=A.y,Z[z+10]=A.z,Z[z+11]=A.w,t=Ea[q.a],m=Ea[q.b],A=Ea[q.c],X[z]=t.x,X[z+1]=t.y,X[z+2]=t.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=A.x,X[z+9]=A.y,X[z+10]=A.z,X[z+11]=1,t=Fa[q.a],m=Fa[q.b],A=Fa[q.c],Y[z]=t.x,Y[z+1]=t.y,Y[z+2]=t.z,Y[z+3]=1,Y[z+
|
|
|
-4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=A.x,Y[z+9]=A.y,Y[z+10]=A.z,Y[z+11]=1,z+=12;if(ra&&y)p.length==3&&y==THREE.VertexColors?(q=p[0],t=p[1],m=p[2]):m=t=q=s,ja[ea]=q.r,ja[ea+1]=q.g,ja[ea+2]=q.b,ja[ea+3]=t.r,ja[ea+4]=t.g,ja[ea+5]=t.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ea+=9;if(qa&&oa.hasTangents)p=u[0],s=u[1],q=u[2],W[V]=p.x,W[V+1]=p.y,W[V+2]=p.z,W[V+3]=p.w,W[V+4]=s.x,W[V+5]=s.y,W[V+6]=s.z,W[V+7]=s.w,W[V+8]=q.x,W[V+9]=q.y,W[V+10]=q.z,W[V+11]=q.w,V+=12;if(pa&&B)if(r.length==3&&ma)for(u=0;u<
|
|
|
-3;u++)o=r[u],Q[N]=o.x,Q[N+1]=o.y,Q[N+2]=o.z,N+=3;else for(u=0;u<3;u++)Q[N]=o.x,Q[N+1]=o.y,Q[N+2]=o.z,N+=3;if(ha&&D!==void 0&&w)for(u=0;u<3;u++)r=D[u],aa[R]=r.u,aa[R+1]=r.v,R+=2;if(ha&&F!==void 0&&w)for(u=0;u<3;u++)r=F[u],ca[S]=r.u,ca[S+1]=r.v,S+=2;na&&(P[M]=H,P[M+1]=H+1,P[M+2]=H+2,M+=3,T[O]=H,T[O+1]=H+1,T[O+2]=H,T[O+3]=H+2,T[O+4]=H+1,T[O+5]=H+2,O+=6,H+=3)}else if(q instanceof THREE.Face4){if(la)x=ka[q.a].position,v=ka[q.b].position,L=ka[q.c].position,G=ka[q.d].position,ia[I]=x.x,ia[I+1]=x.y,ia[I+
|
|
|
-2]=x.z,ia[I+3]=v.x,ia[I+4]=v.y,ia[I+5]=v.z,ia[I+6]=L.x,ia[I+7]=L.y,ia[I+8]=L.z,ia[I+9]=G.x,ia[I+10]=G.y,ia[I+11]=G.z,I+=12;if(U)for(K in U)if(m=U[K],m.__original.needsUpdate)t=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[t]=m.value[q.a],m.array[t+1]=m.value[q.b],m.array[t+2]=m.value[q.c],m.array[t+3]=m.value[q.d]):m.boundTo==="faces"?(A=m.value[A],m.array[t]=A,m.array[t+1]=A,m.array[t+2]=A,m.array[t+3]=A,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[t]=
|
|
|
-m.value[A],m.array[t+1]=m.value[A+1],m.array[t+2]=m.value[A+2],m.array[t+3]=m.value[A+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[q.a],v=m.value[q.b],L=m.value[q.c],G=m.value[q.d]):m.boundTo==="faces"?(G=L=v=x=A=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[A],v=m.value[A+1],L=m.value[A+2],G=m.value[A+3],m.offsetSrc+=4),m.size===2?(m.array[t]=x.x,m.array[t+1]=x.y,m.array[t+2]=v.x,m.array[t+3]=v.y,m.array[t+4]=L.x,m.array[t+5]=L.y,m.array[t+
|
|
|
-6]=G.x,m.array[t+7]=G.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[t]=x.r,m.array[t+1]=x.g,m.array[t+2]=x.b,m.array[t+3]=v.r,m.array[t+4]=v.g,m.array[t+5]=v.b,m.array[t+6]=L.r,m.array[t+7]=L.g,m.array[t+8]=L.b,m.array[t+9]=G.r,m.array[t+10]=G.g,m.array[t+11]=G.b):(m.array[t]=x.x,m.array[t+1]=x.y,m.array[t+2]=x.z,m.array[t+3]=v.x,m.array[t+4]=v.y,m.array[t+5]=v.z,m.array[t+6]=L.x,m.array[t+7]=L.y,m.array[t+8]=L.z,m.array[t+9]=G.x,m.array[t+10]=G.y,m.array[t+11]=G.z),m.offset+=12):(m.array[t]=x.x,
|
|
|
-m.array[t+1]=x.y,m.array[t+2]=x.z,m.array[t+3]=x.w,m.array[t+4]=v.x,m.array[t+5]=v.y,m.array[t+6]=v.z,m.array[t+7]=v.w,m.array[t+8]=L.x,m.array[t+9]=L.y,m.array[t+10]=L.z,m.array[t+11]=L.w,m.array[t+12]=G.x,m.array[t+13]=G.y,m.array[t+14]=G.z,m.array[t+15]=G.w,m.offset+=16));if(sa){t=0;for(m=ya.length;t<m;t++)x=ya[t].vertices[q.a].position,v=ya[t].vertices[q.b].position,L=ya[t].vertices[q.c].position,G=ya[t].vertices[q.d].position,A=da[t],A[ga]=x.x,A[ga+1]=x.y,A[ga+2]=x.z,A[ga+3]=v.x,A[ga+4]=v.y,
|
|
|
-A[ga+5]=v.z,A[ga+6]=L.x,A[ga+7]=L.y,A[ga+8]=L.z,A[ga+9]=G.x,A[ga+10]=G.y,A[ga+11]=G.z;ga+=12}if(za.length)t=za[q.a],m=za[q.b],A=za[q.c],J=za[q.d],$[z]=t.x,$[z+1]=t.y,$[z+2]=t.z,$[z+3]=t.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=A.x,$[z+9]=A.y,$[z+10]=A.z,$[z+11]=A.w,$[z+12]=J.x,$[z+13]=J.y,$[z+14]=J.z,$[z+15]=J.w,t=Ga[q.a],m=Ga[q.b],A=Ga[q.c],J=Ga[q.d],Z[z]=t.x,Z[z+1]=t.y,Z[z+2]=t.z,Z[z+3]=t.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=A.x,Z[z+9]=A.y,Z[z+10]=A.z,Z[z+11]=A.w,Z[z+
|
|
|
-12]=J.x,Z[z+13]=J.y,Z[z+14]=J.z,Z[z+15]=J.w,t=Ea[q.a],m=Ea[q.b],A=Ea[q.c],J=Ea[q.d],X[z]=t.x,X[z+1]=t.y,X[z+2]=t.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=A.x,X[z+9]=A.y,X[z+10]=A.z,X[z+11]=1,X[z+12]=J.x,X[z+13]=J.y,X[z+14]=J.z,X[z+15]=1,t=Fa[q.a],m=Fa[q.b],A=Fa[q.c],q=Fa[q.d],Y[z]=t.x,Y[z+1]=t.y,Y[z+2]=t.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=A.x,Y[z+9]=A.y,Y[z+10]=A.z,Y[z+11]=1,Y[z+12]=q.x,Y[z+13]=q.y,Y[z+14]=q.z,Y[z+15]=1,z+=16;if(ra&&y)p.length==4&&y==THREE.VertexColors?
|
|
|
-(q=p[0],t=p[1],m=p[2],p=p[3]):p=m=t=q=s,ja[ea]=q.r,ja[ea+1]=q.g,ja[ea+2]=q.b,ja[ea+3]=t.r,ja[ea+4]=t.g,ja[ea+5]=t.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ja[ea+9]=p.r,ja[ea+10]=p.g,ja[ea+11]=p.b,ea+=12;if(qa&&oa.hasTangents)p=u[0],s=u[1],q=u[2],u=u[3],W[V]=p.x,W[V+1]=p.y,W[V+2]=p.z,W[V+3]=p.w,W[V+4]=s.x,W[V+5]=s.y,W[V+6]=s.z,W[V+7]=s.w,W[V+8]=q.x,W[V+9]=q.y,W[V+10]=q.z,W[V+11]=q.w,W[V+12]=u.x,W[V+13]=u.y,W[V+14]=u.z,W[V+15]=u.w,V+=16;if(pa&&B)if(r.length==4&&ma)for(u=0;u<4;u++)o=r[u],Q[N]=o.x,Q[N+
|
|
|
-1]=o.y,Q[N+2]=o.z,N+=3;else for(u=0;u<4;u++)Q[N]=o.x,Q[N+1]=o.y,Q[N+2]=o.z,N+=3;if(ha&&D!==void 0&&w)for(u=0;u<4;u++)r=D[u],aa[R]=r.u,aa[R+1]=r.v,R+=2;if(ha&&F!==void 0&&w)for(u=0;u<4;u++)r=F[u],ca[S]=r.u,ca[S+1]=r.v,S+=2;na&&(P[M]=H,P[M+1]=H+1,P[M+2]=H+3,P[M+3]=H+1,P[M+4]=H+2,P[M+5]=H+3,M+=6,T[O]=H,T[O+1]=H+1,T[O+2]=H,T[O+3]=H+3,T[O+4]=H+1,T[O+5]=H+2,T[O+6]=H+2,T[O+7]=H+3,O+=8,H+=4)}if(Aa){k=0;for(n=Aa.length;k<n;k++)P[M]=Aa[k].a,P[M+1]=Aa[k].b,P[M+2]=Aa[k].c,P[M+3]=Aa[k].a,P[M+4]=Aa[k].c,P[M+5]=
|
|
|
-Aa[k].d,M+=6}la&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,ia,j));if(U)for(K in U)m=U[K],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){t=0;for(m=ya.length;t<m;t++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]),c.bufferData(c.ARRAY_BUFFER,da[t],j)}ra&&ea>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ja,j));pa&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),
|
|
|
-c.bufferData(c.ARRAY_BUFFER,Q,j));qa&&oa.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,W,j));ha&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ha&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,ca,j));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,
|
|
|
-T,j));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,
|
|
|
-delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;fa(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;g=b.colors;y=w.length;i=g.length;B=b.__vertexArray;j=b.__colorArray;
|
|
|
-D=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<y;k++)n=w[k].position,h=k*3,B[h]=n.x,B[h+1]=n.y,B[h+2]=n.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,B,e)}if(D){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;
|
|
|
-w=b.vertices;g=b.colors;y=w.length;i=g.length;B=b.__vertexArray;j=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<y;k++)n=w[k].position,h=k*3,B[h]=n.x,B[h+1]=n.y,B[h+2]=n.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,B,e)}if(D){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
|
|
|
-b.geometry,g=ta(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,fa(f)}function u(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function P(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,q={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,
|
|
|
-j=c(i),q[j]==void 0&&(q[j]={hash:j,counter:0}),k=q[j].hash+"_"+q[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(q[j].counter+=1,k=q[j].hash+"_"+q[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function I(b,c,d){b.push({buffer:c,object:d,
|
|
|
-opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(b){if(b!=da){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}da=
|
|
|
-b}}function Q(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,N(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,N(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,N(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,N(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,va(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,va(d.minFilter)))}
|
|
|
-function ra(b,d){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=c.createTexture(),b.__webglInit=!0;c.bindTexture(c.TEXTURE_2D,b.__webglTexture);b.image.data?c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.image.width,b.image.height,0,N(b.format),c.UNSIGNED_BYTE,b.image.data):c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);Q(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function ka(b){if(b&&
|
|
|
-!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
|
|
|
-N(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.width,b.height,0,N(b.format),N(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):
|
|
|
-b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,e=la,b=qa);d!=pa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),
|
|
|
-c.viewport(Ia,Ja,e,b),pa=d)}function aa(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function va(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;
|
|
|
-case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;
|
|
|
-case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var J=this,c,ha=[],R=null,
|
|
|
-pa=null,K=!0,ca=null,O=null,da=null,T=null,S=null,ua=null,Ha=null,Ia=0,Ja=0,la=0,qa=0,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],wa=new THREE.Matrix4,La=new Float32Array(16),Ma=new Float32Array(16),Ka=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},xa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Qa=b.stencil!==void 0?
|
|
|
-b.stencil:!0,x=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Na=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=
|
|
|
-!0;var na,Oa=[],b=THREE.ShaderLib.depthRGBA,Wa=THREE.UniformsUtils.clone(b.uniforms),Pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa}),Ta=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa,morphTargets:!0});Pa._shadowPass=!0;Ta._shadowPass=!0;try{if(!(c=xa.getContext("experimental-webgl",{antialias:x,stencil:Qa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+
|
|
|
-" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Ya){console.error(Ya)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(sa.r,sa.g,sa.b,Na);this.context=c;var Xa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Qa){var v={};v.vertices=
|
|
|
-new Float32Array(12);v.faces=new Uint16Array(6);v.darkness=0.5;v.vertices[0]=-20;v.vertices[1]=-20;v.vertices[2]=-1;v.vertices[3]=20;v.vertices[4]=-20;v.vertices[5]=-1;v.vertices[6]=20;v.vertices[7]=20;v.vertices[8]=-1;v.vertices[9]=-20;v.vertices[10]=20;v.vertices[11]=-1;v.faces[0]=0;v.faces[1]=1;v.faces[2]=2;v.faces[3]=0;v.faces[4]=2;v.faces[5]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);
|
|
|
-c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,v.faces,c.STATIC_DRAW);v.program=c.createProgram();c.attachShader(v.program,aa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(v.program,aa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(v.program);v.vertexLocation=c.getAttribLocation(v.program,"position");v.projectionLocation=c.getUniformLocation(v.program,"projectionMatrix");v.darknessLocation=c.getUniformLocation(v.program,
|
|
|
-"darkness")}var y={};y.vertices=new Float32Array(16);y.faces=new Uint16Array(6);x=0;y.vertices[x++]=-1;y.vertices[x++]=-1;y.vertices[x++]=0;y.vertices[x++]=0;y.vertices[x++]=1;y.vertices[x++]=-1;y.vertices[x++]=1;y.vertices[x++]=0;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=-1;y.vertices[x++]=1;y.vertices[x++]=0;y.vertices[x++]=1;x=0;y.faces[x++]=0;y.faces[x++]=1;y.faces[x++]=2;y.faces[x++]=0;y.faces[x++]=2;y.faces[x++]=3;y.vertexBuffer=c.createBuffer();
|
|
|
-y.elementBuffer=c.createBuffer();y.tempTexture=c.createTexture();y.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,y.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,y.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,y.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,
|
|
|
-c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,y.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
|
|
|
-c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(y.hasVertexTexture=!1,y.program=c.createProgram(),c.attachShader(y.program,aa("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(y.program,aa("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(y.hasVertexTexture=!0,y.program=c.createProgram(),c.attachShader(y.program,aa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(y.program,aa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));
|
|
|
-c.linkProgram(y.program);y.attributes={};y.uniforms={};y.attributes.vertex=c.getAttribLocation(y.program,"position");y.attributes.uv=c.getAttribLocation(y.program,"UV");y.uniforms.renderType=c.getUniformLocation(y.program,"renderType");y.uniforms.map=c.getUniformLocation(y.program,"map");y.uniforms.occlusionMap=c.getUniformLocation(y.program,"occlusionMap");y.uniforms.opacity=c.getUniformLocation(y.program,"opacity");y.uniforms.scale=c.getUniformLocation(y.program,"scale");y.uniforms.rotation=c.getUniformLocation(y.program,
|
|
|
-"rotation");y.uniforms.screenPosition=c.getUniformLocation(y.program,"screenPosition");var Va=!1,w={};w.vertices=new Float32Array(16);w.faces=new Uint16Array(6);x=0;w.vertices[x++]=-1;w.vertices[x++]=-1;w.vertices[x++]=0;w.vertices[x++]=1;w.vertices[x++]=1;w.vertices[x++]=-1;w.vertices[x++]=1;w.vertices[x++]=1;w.vertices[x++]=1;w.vertices[x++]=1;w.vertices[x++]=1;w.vertices[x++]=0;w.vertices[x++]=-1;w.vertices[x++]=1;w.vertices[x++]=0;x=w.vertices[x++]=0;w.faces[x++]=0;w.faces[x++]=1;w.faces[x++]=
|
|
|
-2;w.faces[x++]=0;w.faces[x++]=2;w.faces[x++]=3;w.vertexBuffer=c.createBuffer();w.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,w.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,w.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,w.faces,c.STATIC_DRAW);w.program=c.createProgram();c.attachShader(w.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(w.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));
|
|
|
-c.linkProgram(w.program);w.attributes={};w.uniforms={};w.attributes.position=c.getAttribLocation(w.program,"position");w.attributes.uv=c.getAttribLocation(w.program,"uv");w.uniforms.uvOffset=c.getUniformLocation(w.program,"uvOffset");w.uniforms.uvScale=c.getUniformLocation(w.program,"uvScale");w.uniforms.rotation=c.getUniformLocation(w.program,"rotation");w.uniforms.scale=c.getUniformLocation(w.program,"scale");w.uniforms.alignment=c.getUniformLocation(w.program,"alignment");w.uniforms.map=c.getUniformLocation(w.program,
|
|
|
-"map");w.uniforms.opacity=c.getUniformLocation(w.program,"opacity");w.uniforms.useScreenCoordinates=c.getUniformLocation(w.program,"useScreenCoordinates");w.uniforms.affectedByDistance=c.getUniformLocation(w.program,"affectedByDistance");w.uniforms.screenPosition=c.getUniformLocation(w.program,"screenPosition");w.uniforms.modelViewMatrix=c.getUniformLocation(w.program,"modelViewMatrix");w.uniforms.projectionMatrix=c.getUniformLocation(w.program,"projectionMatrix");var Ua=!1;this.setSize=function(b,
|
|
|
-c){xa.width=b;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,d,e,f){Ia=b;Ja=d;la=e;qa=f;c.viewport(Ia,Ja,la,qa)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){K=b;c.depthMask(b)};this.setClearColorHex=function(b,d){sa.setHex(b);Na=d;c.clearColor(sa.r,sa.g,sa.b,Na)};this.setClearColor=function(b,d){sa.copy(b);Na=d;c.clearColor(sa.r,
|
|
|
-sa.g,sa.b,Na)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){v.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":
|
|
|
-b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,n,q;k=q=j=0;for(n=d.length;k<n;k++)h=d[k],h instanceof THREE.SpotLight&&q++,h instanceof THREE.DirectionalLight&&q++,h instanceof THREE.PointLight&&j++;j+q<=4?k=q:(k=Math.ceil(4*q/(j+q)),j=4-k);
|
|
|
-h={directional:k,point:j};j=q=0;for(k=d.length;j<k;j++)n=d[j],n instanceof THREE.SpotLight&&n.castShadow&&q++;var r=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)r=f.bones.length;var o;a:{k=b.fragmentShader;n=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,
|
|
|
-maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},p,f=[];i?f.push(i):(f.push(k),f.push(n));for(p in e)f.push(p),f.push(e[p]);i=f.join();p=0;for(f=ha.length;p<f;p++)if(ha[p].code==i){o=ha[p].program;break a}p=c.createProgram();f=[Xa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,
|
|
|
-"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
-"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");c.attachShader(p,aa("fragment",h+k));c.attachShader(p,aa("vertex",f+n));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms=
|
|
|
-{};p.attributes={};var s,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(s in j)f.push(s);s=f;f=0;for(j=s.length;f<j;f++)k=s[f],p.uniforms[k]=c.getUniformLocation(p,k);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<e.maxMorphTargets;s++)f.push("morphTarget"+s);for(o in d)f.push(o);o=f;s=0;for(d=o.length;s<d;s++)e=
|
|
|
-o[s],p.attributes[e]=c.getAttribLocation(p,e);ha.push({program:p,code:i});o=p}b.program=o;o=b.program.attributes;o.position>=0&&c.enableVertexAttribArray(o.position);o.color>=0&&c.enableVertexAttribArray(o.color);o.normal>=0&&c.enableVertexAttribArray(o.normal);o.tangent>=0&&c.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(c.enableVertexAttribArray(o.skinVertexA),c.enableVertexAttribArray(o.skinVertexB),c.enableVertexAttribArray(o.skinIndex),
|
|
|
-c.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(g in b.attributes)o[g]!==void 0&&o[g]>=0&&c.enableVertexAttribArray(o[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)s="morphTarget"+g,o[s]>=0&&(c.enableVertexAttribArray(o[s]),b.numSupportedMorphTargets++)};this.render=function(b,d,r,u){var w,x,y,v,H,C,q,I,E=b.lights,K=b.fog;this.shadowMapEnabled&&D(b,d);J.data.vertices=0;J.data.faces=0;J.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,
|
|
|
-!1,d);d.matrixWorldInverse.flattenToArray(Ma);d.projectionMatrix.flattenToArray(La);wa.multiply(d.projectionMatrix,d.matrixWorldInverse);k(wa);this.initWebGLObjects(b);ka(r);(this.autoClear||u)&&this.clear();H=b.__webglObjects.length;for(u=0;u<H;u++)if(w=b.__webglObjects[u],q=w.object,q.visible)if(!(q instanceof THREE.Mesh)||n(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),U(q,d,!0),s(w),w.render=!0,this.sortObjects)w.object.renderDepth?w.z=w.object.renderDepth:(Ka.copy(q.position),wa.multiplyVector3(Ka),
|
|
|
-w.z=Ka.z)}else w.render=!1;else w.render=!1;this.sortObjects&&b.__webglObjects.sort(p);C=b.__webglObjectsImmediate.length;for(u=0;u<C;u++)w=b.__webglObjectsImmediate[u],q=w.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),U(q,d,!0),o(w));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);M(b.overrideMaterial.blending);for(u=0;u<H;u++)if(w=b.__webglObjects[u],w.render)q=w.object,I=w.buffer,i(q),f(d,E,K,b.overrideMaterial,I,q);for(u=0;u<C;u++)w=b.__webglObjectsImmediate[u],
|
|
|
-q=w.object,q.visible&&(i(q),x=e(d,E,K,b.overrideMaterial,q),q.render(function(c){g(c,x,b.overrideMaterial.shading)}))}else{M(THREE.NormalBlending);for(u=H-1;u>=0;u--)if(w=b.__webglObjects[u],w.render){q=w.object;I=w.buffer;y=w.opaque;i(q);for(w=0;w<y.count;w++)v=y.list[w],h(v.depthTest),j(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),f(d,E,K,v,I,q)}for(u=0;u<C;u++)if(w=b.__webglObjectsImmediate[u],q=w.object,q.visible){y=w.opaque;i(q);for(w=0;w<y.count;w++)v=y.list[w],h(v.depthTest),
|
|
|
-j(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),x=e(d,E,K,v,q),q.render(function(b){g(b,x,v.shading)})}for(u=0;u<H;u++)if(w=b.__webglObjects[u],w.render){q=w.object;I=w.buffer;y=w.transparent;i(q);for(w=0;w<y.count;w++)v=y.list[w],M(v.blending),h(v.depthTest),j(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),f(d,E,K,v,I,q)}for(u=0;u<C;u++)if(w=b.__webglObjectsImmediate[u],q=w.object,q.visible){y=w.transparent;i(q);for(w=0;w<y.count;w++)v=y.list[w],M(v.blending),h(v.depthTest),
|
|
|
-j(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),x=e(d,E,K,v,q),q.render(function(b){g(b,x,v.shading)})}}b.__webglSprites.length&&G(b,d);Qa&&b.__webglShadowVolumes.length&&b.lights.length&&F(b);b.__webglLensFlares.length&&B(b,d);r&&r.minFilter!==THREE.NearestFilter&&r.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,r.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],
|
|
|
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&j.shadowMatrix){for(e=0;e<Na.length;e++)j.shadowMatrix.value[e]=Na[e],j.shadowMap.texture[e]=K.shadowMap[e];j.shadowDarkness.value=K.shadowMapDarkness;j.shadowBias.value=K.shadowMapBias}for(var m in j)if(k=g.uniforms[m])if(H=j[m],C=H.type,e=H.value,C=="i")c.uniform1i(k,e);else if(C=="f")c.uniform1f(k,e);else if(C=="fv1")c.uniform1fv(k,e);else if(C=="fv")c.uniform3fv(k,e);else if(C==
|
|
|
+"v2")c.uniform2f(k,e.x,e.y);else if(C=="v3")c.uniform3f(k,e.x,e.y,e.z);else if(C=="v4")c.uniform4f(k,e.x,e.y,e.z,e.w);else if(C=="m4"){if(!H._array)H._array=new Float32Array(16);e.flattenToArray(H._array);c.uniformMatrix4fv(k,!1,H._array)}else if(C=="m4v"){if(!H._array)H._array=new Float32Array(16*e.length);C=0;for(q=e.length;C<q;C++)e[C].flattenToArrayOffset(H._array,C*16);c.uniformMatrix4fv(k,!1,H._array)}else if(C=="c")c.uniform3f(k,e.r,e.g,e.b);else if(C=="t"){if(c.uniform1i(k,e),k=H.texture)if(k.image instanceof
|
|
|
+Array&&k.image.length==6){if(H=k,H.image.length==6){if(H.needsUpdate){if(H.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,H.image.__webglTextureCube);for(k=0;k<6;++k)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,0,0,c.RGBA,c.UNSIGNED_BYTE,H.image[k])}else{H.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,H.image.__webglTextureCube);for(k=0;k<6;++k)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,H.image[k]);H.__webglInit=!0}Q(c.TEXTURE_CUBE_MAP,
|
|
|
+H,H.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);H.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,H.image.__webglTextureCube)}}else ra(k,e)}else if(C=="tv"){if(!H._array){H._array=[];C=0;for(q=H.texture.length;C<q;C++)H._array[C]=e+C}c.uniform1iv(k,H._array);C=0;for(q=H.texture.length;C<q;C++)(k=H.texture[C])&&ra(k,H._array[C])}c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof
|
|
|
+THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,
|
|
|
+!1,La);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,La);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,La),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;
|
|
|
+if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else if(i.morphTargetBase){d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=
|
|
|
+0,k=i.morphTargetForcedOrder,q=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=q[k[f]],f++;else{var k=[],D=-1,p=0,q=i.morphTargetInfluences,n,C=q.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(n=0;n<C;n++)!k[n]&&q[n]>D&&(p=n,D=q[p]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[p]);
|
|
|
+c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=D;k[p]=1;D=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),
|
|
|
+c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,
|
|
|
+4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),K.data.vertices+=g.__webglFaceCount,K.data.faces+=g.__webglFaceCount/
|
|
|
+3,K.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),K.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),K.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),K.data.drawCalls++)}}function h(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
|
|
|
+c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,q,p,n,C,r=b.count*3;for(C=0;C<r;C+=9)e=b.normalArray,f=e[C],g=e[C+1],h=e[C+2],i=e[C+3],k=e[C+4],p=e[C+5],j=e[C+6],q=e[C+7],n=e[C+8],f=(f+i+j)/
|
|
|
+3,g=(g+k+q)/3,h=(h+p+n)/3,e[C]=f,e[C+1]=g,e[C+2]=h,e[C+3]=f,e[C+4]=g,e[C+5]=h,e[C+6]=f,e[C+7]=g,e[C+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(ca!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),ca=b.doubleSided;if(O!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),O=b.flipSided}
|
|
|
+function g(b){T!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),T=b)}function j(b,e,d){S!=b&&(b?c.enable(c.POLYGON_OFFSET_FILL):c.disable(c.POLYGON_OFFSET_FILL),S=b);if(b&&(ua!=e||Ga!=d))c.polygonOffset(e,d),ua=e,Ga=d}function k(b){ma[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ma[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ma[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ma[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ma[4].set(b.n41-b.n31,b.n42-
|
|
|
+b.n32,b.n43-b.n33,b.n44-b.n34);ma[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ma[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function q(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ma[d].x*c.n14+ma[d].y*c.n24+ma[d].z*c.n34+ma[d].w,b<=e)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function r(b){var c,d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=
|
|
|
+f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?n(g,d):n(f,d)}function t(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?n(j,f):n(i,f))}else(f=c)&&(f.transparent?n(j,f):n(i,f))}function o(b,c){return c.z-b.z}function F(b,d){var j,Qa,Ba,n=0,r,Ca,H,D,p=b.lights;na||(na=new THREE.Camera(K.shadowCameraFov,
|
|
|
+d.aspect,K.shadowCameraNear,K.shadowCameraFar));j=0;for(Qa=p.length;j<Qa;j++)if(Ba=p[j],Ba instanceof THREE.SpotLight&&Ba.castShadow){K.shadowMap[n]||(K.shadowMap[n]=new THREE.WebGLRenderTarget(K.shadowMapWidth,K.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Na[n]||(Na[n]=new THREE.Matrix4);r=K.shadowMap[n];Ca=Na[n];na.position.copy(Ba.position);na.target.position.copy(Ba.target.position);na.update(void 0,!0);b.update(void 0,!1,na);Ca.set(0.5,
|
|
|
+0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);Ca.multiplySelf(na.projectionMatrix);Ca.multiplySelf(na.matrixWorldInverse);na.matrixWorldInverse.flattenToArray(La);na.projectionMatrix.flattenToArray(Ka);wa.multiply(na.projectionMatrix,na.matrixWorldInverse);k(wa);K.initWebGLObjects(b);ka(r);c.clearColor(1,1,1,1);K.clear();c.clearColor(sa.r,sa.g,sa.b,Ma);Ca=b.__webglObjects.length;Ba=b.__webglObjectsImmediate.length;for(r=0;r<Ca;r++)H=b.__webglObjects[r],D=H.object,D.visible&&D.castShadow?!(D instanceof
|
|
|
+THREE.Mesh)||q(D)?(D.matrixWorld.flattenToArray(D._objectMatrixArray),U(D,na,!1),H.render=!0):H.render=!1:H.render=!1;g(!0);M(THREE.NormalBlending);for(r=0;r<Ca;r++)if(H=b.__webglObjects[r],H.render)D=H.object,buffer=H.buffer,i(D),H=D.customDepthMaterial?D.customDepthMaterial:D.geometry.morphTargets.length?Sa:Oa,f(na,p,null,H,buffer,D);for(r=0;r<Ba;r++)H=b.__webglObjectsImmediate[r],D=H.object,D.visible&&D.castShadow&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),U(D,na,
|
|
|
+!1),i(D),program=e(na,p,null,Oa,D),D.render(function(b){h(b,program,Oa.shading)}));n++}}function x(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,q,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof
|
|
|
+THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,i=b.__webglShadowVolumes[p].buffer,j=f.materials[0],j.program||K.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,q=j.attributes,R!==j&&(c.useProgram(j),R=j,c.uniformMatrix4fv(k.projectionMatrix,!1,Ka),c.uniformMatrix4fv(k.viewMatrix,!1,La),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,
|
|
|
+!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(q.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(q.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,
|
|
|
+!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);T=da=-1;R=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation,!1,Ka);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);
|
|
|
+c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(L)}function G(b,d){var e,f,g;e=v.attributes;var h=v.uniforms,i=qa/la,j,k=[],q=la*0.5,p=qa*0.5,n=!0;c.useProgram(v.program);R=v.program;T=da=-1;Ta||(c.enableVertexAttribArray(v.attributes.position),c.enableVertexAttribArray(v.attributes.uv),Ta=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,
|
|
|
+!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,!1,Ka);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(o);e=0;for(f=b.__webglSprites.length;e<f;e++)g=
|
|
|
+b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,(g.position.x-q)/q,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.scaleByViewport?qa:1),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,
|
|
|
+g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),M(g.blending),ra(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(L)}function E(b,e){var d,f,g=b.__webglLensFlares.length,
|
|
|
+h,i,j,k=new THREE.Vector3,q=qa/la,p=la*0.5,n=qa*0.5,r=16/qa,t=[r*q,r],o=[1,1,0],w=[1,1],v=A.uniforms;d=A.attributes;c.useProgram(A.program);R=A.program;T=da=-1;Ua||(c.enableVertexAttribArray(A.attributes.vertex),c.enableVertexAttribArray(A.attributes.uv),Ua=!0);c.uniform1i(v.occlusionMap,0);c.uniform1i(v.map,1);c.bindBuffer(c.ARRAY_BUFFER,A.vertexBuffer);c.vertexAttribPointer(d.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(d.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.elementBuffer);
|
|
|
+c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(d=b.__webglLensFlares[f].object,k.set(d.matrixWorld.n14,d.matrixWorld.n24,d.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(k),e.projectionMatrix.multiplyVector3(k),o[0]=k.x,o[1]=k.y,o[2]=k.z,w[0]=o[0]*p+p,w[1]=o[1]*n+n,A.hasVertexTexture||w[0]>0&&w[0]<la&&w[1]>0&&w[1]<qa){c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
|
|
|
+0,c.RGB,w[0]-8,w[1]-8,16,16,0);c.uniform1i(v.renderType,0);c.uniform2fv(v.scale,t);c.uniform3fv(v.screenPosition,o);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,w[0]-8,w[1]-8,16,16,0);c.uniform1i(v.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);d.positionScreen.x=o[0];d.positionScreen.y=
|
|
|
+o[1];d.positionScreen.z=o[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(v.renderType,2);c.enable(c.BLEND);h=0;for(i=d.lensFlares.length;h<i;h++)if(j=d.lensFlares[h],j.opacity>0.001&&j.scale>0.001)o[0]=j.x,o[1]=j.y,o[2]=j.z,r=j.size*j.scale/qa,t[0]=r*q,t[1]=r,c.uniform3fv(v.screenPosition,o),c.uniform2fv(v.scale,t),c.uniform1f(v.rotation,j.rotation),c.uniform1f(v.opacity,j.opacity),M(j.blending),ra(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);
|
|
|
+c.enable(c.DEPTH_TEST);c.depthMask(L)}function U(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ta(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function fa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=
|
|
|
+!1}function I(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=ta(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var i=b,j=c.DYNAMIC_DRAW;if(h.__inittedArrays){var k=void 0,q=void 0,n=void 0,p=void 0,r=n=void 0,C=void 0,t=void 0,o=void 0,w=void 0,v=void 0,A=void 0,E=void 0,F=void 0,x=void 0,y=void 0,u=void 0,G=void 0,s=p=o=p=t=C=void 0,m=void 0,B=
|
|
|
+m=s=C=void 0,K=void 0,L=B=m=s=n=n=r=o=p=B=m=s=K=B=m=s=K=B=m=s=void 0,I=0,J=0,R=0,S=0,M=0,N=0,V=0,O=0,ea=0,z=0,ga=0,B=s=0,B=void 0,ia=h.__vertexArray,aa=h.__uvArray,ca=h.__uv2Array,Q=h.__normalArray,W=h.__tangentArray,ja=h.__colorArray,X=h.__skinVertexAArray,Y=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,da=h.__morphTargetsArrays,U=h.__webglCustomAttributes,m=void 0,P=h.__faceArray,T=h.__lineArray,ma=h.__needsSmoothNormals,v=h.__vertexColorType,w=h.__uvType,A=h.__normalType,oa=i.geometry,
|
|
|
+la=oa.__dirtyVertices,na=oa.__dirtyElements,ha=oa.__dirtyUvs,pa=oa.__dirtyNormals,qa=oa.__dirtyTangents,ra=oa.__dirtyColors,sa=oa.__dirtyMorphTargets,ka=oa.vertices,ua=h.faces,va=oa.faces,wa=oa.faceVertexUvs[0],xa=oa.faceVertexUvs[1],Da=oa.skinVerticesA,Ea=oa.skinVerticesB,Fa=oa.skinIndices,za=oa.skinWeights,Aa=i instanceof THREE.ShadowVolume?oa.edgeFaces:void 0,ya=oa.morphTargets;if(U)for(L in U)U[L].offset=0,U[L].offsetSrc=0;k=0;for(q=ua.length;k<q;k++)if(n=ua[k],p=va[n],wa&&(E=wa[n]),xa&&(F=xa[n]),
|
|
|
+n=p.vertexNormals,r=p.normal,C=p.vertexColors,t=p.color,o=p.vertexTangents,p instanceof THREE.Face3){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,J+=9;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c]):m.boundTo==="faces"?
|
|
|
+(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c]):m.boundTo==="faces"?(u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],m.offsetSrc+=3),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+
|
|
|
+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z),m.offset+=9):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+5]=y.y,m.array[s+
|
|
|
+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.offset+=12));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z;ga+=9}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+
|
|
|
+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=
|
|
|
+1,z+=12;if(ra&&v)C.length==3&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2]):m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ea+=9;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,V+=12;if(pa&&A)if(n.length==3&&ma)for(o=0;o<3;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<3;o++)Q[N]=r.x,
|
|
|
+Q[N+1]=r.y,Q[N+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<3;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<3;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+2,M+=3,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+2,T[O+4]=I+1,T[O+5]=I+2,O+=6,I+=3)}else if(p instanceof THREE.Face4){if(la)x=ka[p.a].position,y=ka[p.b].position,u=ka[p.c].position,G=ka[p.d].position,ia[J]=x.x,ia[J+1]=x.y,ia[J+2]=x.z,ia[J+3]=y.x,ia[J+4]=y.y,ia[J+5]=y.z,ia[J+6]=u.x,ia[J+7]=u.y,ia[J+8]=u.z,
|
|
|
+ia[J+9]=G.x,ia[J+10]=G.y,ia[J+11]=G.z,J+=12;if(U)for(L in U)if(m=U[L],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.d]):m.boundTo==="faces"?(B=m.value[B],m.array[s]=B,m.array[s+1]=B,m.array[s+2]=B,m.array[s+3]=B,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[B],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.array[s+3]=
|
|
|
+m.value[B+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],y=m.value[p.b],u=m.value[p.c],G=m.value[p.d]):m.boundTo==="faces"?(G=u=y=x=B=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[B],y=m.value[B+1],u=m.value[B+2],G=m.value[B+3],m.offsetSrc+=4),m.size===2?(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=y.x,m.array[s+3]=y.y,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+6]=G.x,m.array[s+7]=G.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=
|
|
|
+x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=y.r,m.array[s+4]=y.g,m.array[s+5]=y.b,m.array[s+6]=u.r,m.array[s+7]=u.g,m.array[s+8]=u.b,m.array[s+9]=G.r,m.array[s+10]=G.g,m.array[s+11]=G.b):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=y.x,m.array[s+4]=y.y,m.array[s+5]=y.z,m.array[s+6]=u.x,m.array[s+7]=u.y,m.array[s+8]=u.z,m.array[s+9]=G.x,m.array[s+10]=G.y,m.array[s+11]=G.z),m.offset+=12):(m.array[s]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=y.x,m.array[s+
|
|
|
+5]=y.y,m.array[s+6]=y.z,m.array[s+7]=y.w,m.array[s+8]=u.x,m.array[s+9]=u.y,m.array[s+10]=u.z,m.array[s+11]=u.w,m.array[s+12]=G.x,m.array[s+13]=G.y,m.array[s+14]=G.z,m.array[s+15]=G.w,m.offset+=16));if(sa){s=0;for(m=ya.length;s<m;s++)x=ya[s].vertices[p.a].position,y=ya[s].vertices[p.b].position,u=ya[s].vertices[p.c].position,G=ya[s].vertices[p.d].position,B=da[s],B[ga]=x.x,B[ga+1]=x.y,B[ga+2]=x.z,B[ga+3]=y.x,B[ga+4]=y.y,B[ga+5]=y.z,B[ga+6]=u.x,B[ga+7]=u.y,B[ga+8]=u.z,B[ga+9]=G.x,B[ga+10]=G.y,B[ga+
|
|
|
+11]=G.z;ga+=12}if(za.length)s=za[p.a],m=za[p.b],B=za[p.c],K=za[p.d],$[z]=s.x,$[z+1]=s.y,$[z+2]=s.z,$[z+3]=s.w,$[z+4]=m.x,$[z+5]=m.y,$[z+6]=m.z,$[z+7]=m.w,$[z+8]=B.x,$[z+9]=B.y,$[z+10]=B.z,$[z+11]=B.w,$[z+12]=K.x,$[z+13]=K.y,$[z+14]=K.z,$[z+15]=K.w,s=Fa[p.a],m=Fa[p.b],B=Fa[p.c],K=Fa[p.d],Z[z]=s.x,Z[z+1]=s.y,Z[z+2]=s.z,Z[z+3]=s.w,Z[z+4]=m.x,Z[z+5]=m.y,Z[z+6]=m.z,Z[z+7]=m.w,Z[z+8]=B.x,Z[z+9]=B.y,Z[z+10]=B.z,Z[z+11]=B.w,Z[z+12]=K.x,Z[z+13]=K.y,Z[z+14]=K.z,Z[z+15]=K.w,s=Da[p.a],m=Da[p.b],B=Da[p.c],K=Da[p.d],
|
|
|
+X[z]=s.x,X[z+1]=s.y,X[z+2]=s.z,X[z+3]=1,X[z+4]=m.x,X[z+5]=m.y,X[z+6]=m.z,X[z+7]=1,X[z+8]=B.x,X[z+9]=B.y,X[z+10]=B.z,X[z+11]=1,X[z+12]=K.x,X[z+13]=K.y,X[z+14]=K.z,X[z+15]=1,s=Ea[p.a],m=Ea[p.b],B=Ea[p.c],p=Ea[p.d],Y[z]=s.x,Y[z+1]=s.y,Y[z+2]=s.z,Y[z+3]=1,Y[z+4]=m.x,Y[z+5]=m.y,Y[z+6]=m.z,Y[z+7]=1,Y[z+8]=B.x,Y[z+9]=B.y,Y[z+10]=B.z,Y[z+11]=1,Y[z+12]=p.x,Y[z+13]=p.y,Y[z+14]=p.z,Y[z+15]=1,z+=16;if(ra&&v)C.length==4&&v==THREE.VertexColors?(p=C[0],s=C[1],m=C[2],C=C[3]):C=m=s=p=t,ja[ea]=p.r,ja[ea+1]=p.g,ja[ea+
|
|
|
+2]=p.b,ja[ea+3]=s.r,ja[ea+4]=s.g,ja[ea+5]=s.b,ja[ea+6]=m.r,ja[ea+7]=m.g,ja[ea+8]=m.b,ja[ea+9]=C.r,ja[ea+10]=C.g,ja[ea+11]=C.b,ea+=12;if(qa&&oa.hasTangents)C=o[0],t=o[1],p=o[2],o=o[3],W[V]=C.x,W[V+1]=C.y,W[V+2]=C.z,W[V+3]=C.w,W[V+4]=t.x,W[V+5]=t.y,W[V+6]=t.z,W[V+7]=t.w,W[V+8]=p.x,W[V+9]=p.y,W[V+10]=p.z,W[V+11]=p.w,W[V+12]=o.x,W[V+13]=o.y,W[V+14]=o.z,W[V+15]=o.w,V+=16;if(pa&&A)if(n.length==4&&ma)for(o=0;o<4;o++)r=n[o],Q[N]=r.x,Q[N+1]=r.y,Q[N+2]=r.z,N+=3;else for(o=0;o<4;o++)Q[N]=r.x,Q[N+1]=r.y,Q[N+
|
|
|
+2]=r.z,N+=3;if(ha&&E!==void 0&&w)for(o=0;o<4;o++)n=E[o],aa[R]=n.u,aa[R+1]=n.v,R+=2;if(ha&&F!==void 0&&w)for(o=0;o<4;o++)n=F[o],ca[S]=n.u,ca[S+1]=n.v,S+=2;na&&(P[M]=I,P[M+1]=I+1,P[M+2]=I+3,P[M+3]=I+1,P[M+4]=I+2,P[M+5]=I+3,M+=6,T[O]=I,T[O+1]=I+1,T[O+2]=I,T[O+3]=I+3,T[O+4]=I+1,T[O+5]=I+2,T[O+6]=I+2,T[O+7]=I+3,O+=8,I+=4)}if(Aa){k=0;for(q=Aa.length;k<q;k++)P[M]=Aa[k].a,P[M+1]=Aa[k].b,P[M+2]=Aa[k].c,P[M+3]=Aa[k].a,P[M+4]=Aa[k].c,P[M+5]=Aa[k].d,M+=6}la&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),
|
|
|
+c.bufferData(c.ARRAY_BUFFER,ia,j));if(U)for(L in U)m=U[L],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){s=0;for(m=ya.length;s<m;s++)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,da[s],j)}ra&&ea>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ja,j));pa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,j));qa&&oa.hasTangents&&
|
|
|
+(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,W,j));ha&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ha&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,ca,j));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,T,j));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));i.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
|
|
|
+delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;fa(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=
|
|
|
+0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;v=w.length;i=h.length;
|
|
|
+A=b.__vertexArray;j=b.__colorArray;E=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<v;k++)q=w[k].position,g=k*3,A[g]=q.x,A[g+1]=q.y,A[g+2]=q.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,e)}if(E){for(k=0;k<i;k++)color=h[k],g=k*3,j[g]=color.r,j[g+1]=color.g,j[g+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,h=ta(f),(f.__dirtyVertices||
|
|
|
+f.__dirtyColors||b.sortParticles||h)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,fa(f)}function w(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function P(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,g,i,j,k,p={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)g=b.faces[f],i=g.materials,j=c(i),p[j]==void 0&&(p[j]={hash:j,
|
|
|
+counter:0}),k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n}),g=g instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+g>65535&&(p[j].counter+=1,k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=g}function J(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
+count:0}})}function M(b){if(b!=da){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}da=b}}function Q(b,d,e){(e.width&
|
|
|
+e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,N(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,N(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,N(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,N(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,va(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,va(d.minFilter)))}function ra(b,d){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
|
|
|
+c.createTexture(),b.__webglInit=!0;c.bindTexture(c.TEXTURE_2D,b.__webglTexture);b.image.data?c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.image.width,b.image.height,0,N(b.format),c.UNSIGNED_BYTE,b.image.data):c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);Q(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function ka(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
|
|
|
+!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,N(b.format),
|
|
|
+b.width,b.height,0,N(b.format),N(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,
|
|
|
+c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,e=la,b=qa);d!=pa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(Ha,Ia,e,b),pa=d)}function aa(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):
|
|
|
+b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function va(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
|
|
|
+case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
|
|
|
+case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var K=this,c,ha=[],R=null,pa=null,L=!0,ca=null,O=null,da=null,T=null,S=null,ua=null,Ga=null,Ha=0,Ia=0,la=0,qa=0,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],wa=new THREE.Matrix4,Ka=new Float32Array(16),La=new Float32Array(16),Ja=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},xa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Pa=b.stencil!==void 0?b.stencil:!0,y=b.antialias!==void 0?b.antialias:!1,sa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ma=b.clearAlpha!==
|
|
|
+void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var na,Na=[],b=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(b.uniforms),Oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
|
|
|
+vertexShader:b.vertexShader,uniforms:Va}),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va,morphTargets:!0});Oa._shadowPass=!0;Sa._shadowPass=!0;try{if(!(c=xa.getContext("experimental-webgl",{antialias:y,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Xa){console.error(Xa)}c.clearColor(0,
|
|
|
+0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(sa.r,sa.g,sa.b,Ma);this.context=c;var Wa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Pa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;
|
|
|
+u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();
|
|
|
+c.attachShader(u.program,aa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,aa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var A={};A.vertices=new Float32Array(16);A.faces=new Uint16Array(6);y=0;A.vertices[y++]=-1;A.vertices[y++]=-1;A.vertices[y++]=
|
|
|
+0;A.vertices[y++]=0;A.vertices[y++]=1;A.vertices[y++]=-1;A.vertices[y++]=1;A.vertices[y++]=0;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=1;A.vertices[y++]=-1;A.vertices[y++]=1;A.vertices[y++]=0;A.vertices[y++]=1;y=0;A.faces[y++]=0;A.faces[y++]=1;A.faces[y++]=2;A.faces[y++]=0;A.faces[y++]=2;A.faces[y++]=3;A.vertexBuffer=c.createBuffer();A.elementBuffer=c.createBuffer();A.tempTexture=c.createTexture();A.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,A.vertexBuffer);
|
|
|
+c.bufferData(c.ARRAY_BUFFER,A.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,A.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,A.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
|
|
|
+c.NEAREST);c.bindTexture(c.TEXTURE_2D,A.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(A.hasVertexTexture=!1,A.program=c.createProgram(),c.attachShader(A.program,
|
|
|
+aa("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(A.program,aa("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(A.hasVertexTexture=!0,A.program=c.createProgram(),c.attachShader(A.program,aa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(A.program,aa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(A.program);A.attributes={};A.uniforms={};A.attributes.vertex=c.getAttribLocation(A.program,"position");A.attributes.uv=
|
|
|
+c.getAttribLocation(A.program,"UV");A.uniforms.renderType=c.getUniformLocation(A.program,"renderType");A.uniforms.map=c.getUniformLocation(A.program,"map");A.uniforms.occlusionMap=c.getUniformLocation(A.program,"occlusionMap");A.uniforms.opacity=c.getUniformLocation(A.program,"opacity");A.uniforms.scale=c.getUniformLocation(A.program,"scale");A.uniforms.rotation=c.getUniformLocation(A.program,"rotation");A.uniforms.screenPosition=c.getUniformLocation(A.program,"screenPosition");var Ua=!1,v={};v.vertices=
|
|
|
+new Float32Array(16);v.faces=new Uint16Array(6);y=0;v.vertices[y++]=-1;v.vertices[y++]=-1;v.vertices[y++]=0;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=-1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=1;v.vertices[y++]=0;v.vertices[y++]=-1;v.vertices[y++]=1;v.vertices[y++]=0;y=v.vertices[y++]=0;v.faces[y++]=0;v.faces[y++]=1;v.faces[y++]=2;v.faces[y++]=0;v.faces[y++]=2;v.faces[y++]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();
|
|
|
+c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,v.faces,c.STATIC_DRAW);v.program=c.createProgram();c.attachShader(v.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(v.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.position=c.getAttribLocation(v.program,"position");
|
|
|
+v.attributes.uv=c.getAttribLocation(v.program,"uv");v.uniforms.uvOffset=c.getUniformLocation(v.program,"uvOffset");v.uniforms.uvScale=c.getUniformLocation(v.program,"uvScale");v.uniforms.rotation=c.getUniformLocation(v.program,"rotation");v.uniforms.scale=c.getUniformLocation(v.program,"scale");v.uniforms.alignment=c.getUniformLocation(v.program,"alignment");v.uniforms.map=c.getUniformLocation(v.program,"map");v.uniforms.opacity=c.getUniformLocation(v.program,"opacity");v.uniforms.useScreenCoordinates=
|
|
|
+c.getUniformLocation(v.program,"useScreenCoordinates");v.uniforms.affectedByDistance=c.getUniformLocation(v.program,"affectedByDistance");v.uniforms.screenPosition=c.getUniformLocation(v.program,"screenPosition");v.uniforms.modelViewMatrix=c.getUniformLocation(v.program,"modelViewMatrix");v.uniforms.projectionMatrix=c.getUniformLocation(v.program,"projectionMatrix");var Ta=!1;this.setSize=function(b,c){xa.width=b;xa.height=c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,d,
|
|
|
+e,f){Ha=b;Ia=d;la=e;qa=f;c.viewport(Ha,Ia,la,qa)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;c.depthMask(b)};this.setClearColorHex=function(b,d){sa.setHex(b);Ma=d;c.clearColor(sa.r,sa.g,sa.b,Ma)};this.setClearColor=function(b,d){sa.copy(b);Ma=d;c.clearColor(sa.r,sa.g,sa.b,Ma)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};
|
|
|
+this.setStencilShadowDarkness=function(b){u.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var h,g,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof
|
|
|
+THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,n,p;k=p=j=0;for(n=d.length;k<n;k++)g=d[k],g instanceof THREE.SpotLight&&p++,g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&j++;j+p<=4?k=p:(k=Math.ceil(4*p/(j+p)),j=4-k);g={directional:k,point:j};j=p=0;for(k=d.length;j<k;j++)n=d[j],n instanceof THREE.SpotLight&&n.castShadow&&p++;
|
|
|
+var q=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)q=f.bones.length;var o;a:{k=b.fragmentShader;n=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:q,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
|
|
|
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},r,f=[];i?f.push(i):(f.push(k),f.push(n));for(r in e)f.push(r),f.push(e[r]);i=f.join();r=0;for(f=ha.length;r<f;r++)if(ha[r].code==i){o=ha[r].program;break a}r=c.createProgram();f=[Wa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?
|
|
|
+"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
+"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");c.attachShader(r,aa("fragment",g+k));c.attachShader(r,aa("vertex",f+n));c.linkProgram(r);c.getProgramParameter(r,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(r,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");r.uniforms=
|
|
|
+{};r.attributes={};var t,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in j)f.push(t);t=f;f=0;for(j=t.length;f<j;f++)k=t[f],r.uniforms[k]=c.getUniformLocation(r,k);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<e.maxMorphTargets;t++)f.push("morphTarget"+t);for(o in d)f.push(o);o=f;t=0;for(d=o.length;t<d;t++)e=
|
|
|
+o[t],r.attributes[e]=c.getAttribLocation(r,e);ha.push({program:r,code:i});o=r}b.program=o;o=b.program.attributes;o.position>=0&&c.enableVertexAttribArray(o.position);o.color>=0&&c.enableVertexAttribArray(o.color);o.normal>=0&&c.enableVertexAttribArray(o.normal);o.tangent>=0&&c.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(c.enableVertexAttribArray(o.skinVertexA),c.enableVertexAttribArray(o.skinVertexB),c.enableVertexAttribArray(o.skinIndex),
|
|
|
+c.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(h in b.attributes)o[h]!==void 0&&o[h]>=0&&c.enableVertexAttribArray(o[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)t="morphTarget"+h,o[t]>=0&&(c.enableVertexAttribArray(o[t]),b.numSupportedMorphTargets++)};this.render=function(b,d,n,w){var v,A,y,u,H,D,p,I,C=b.lights,J=b.fog;this.shadowMapEnabled&&F(b,d);K.data.vertices=0;K.data.faces=0;K.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,
|
|
|
+!1,d);d.matrixWorldInverse.flattenToArray(La);d.projectionMatrix.flattenToArray(Ka);wa.multiply(d.projectionMatrix,d.matrixWorldInverse);k(wa);this.initWebGLObjects(b);ka(n);(this.autoClear||w)&&this.clear();H=b.__webglObjects.length;for(w=0;w<H;w++)if(v=b.__webglObjects[w],p=v.object,p.visible)if(!(p instanceof THREE.Mesh)||q(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),U(p,d,!0),t(v),v.render=!0,this.sortObjects)v.object.renderDepth?v.z=v.object.renderDepth:(Ja.copy(p.position),wa.multiplyVector3(Ja),
|
|
|
+v.z=Ja.z)}else v.render=!1;else v.render=!1;this.sortObjects&&b.__webglObjects.sort(o);D=b.__webglObjectsImmediate.length;for(w=0;w<D;w++)v=b.__webglObjectsImmediate[w],p=v.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),U(p,d,!0),r(v));if(b.overrideMaterial){g(b.overrideMaterial.depthTest);M(b.overrideMaterial.blending);for(w=0;w<H;w++)if(v=b.__webglObjects[w],v.render)p=v.object,I=v.buffer,i(p),f(d,C,J,b.overrideMaterial,I,p);for(w=0;w<D;w++)v=b.__webglObjectsImmediate[w],
|
|
|
+p=v.object,p.visible&&(i(p),A=e(d,C,J,b.overrideMaterial,p),p.render(function(c){h(c,A,b.overrideMaterial.shading)}))}else{M(THREE.NormalBlending);for(w=H-1;w>=0;w--)if(v=b.__webglObjects[w],v.render){p=v.object;I=v.buffer;y=v.opaque;i(p);for(v=0;v<y.count;v++)u=y.list[v],g(u.depthTest),j(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits),f(d,C,J,u,I,p)}for(w=0;w<D;w++)if(v=b.__webglObjectsImmediate[w],p=v.object,p.visible){y=v.opaque;i(p);for(v=0;v<y.count;v++)u=y.list[v],g(u.depthTest),
|
|
|
+j(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits),A=e(d,C,J,u,p),p.render(function(b){h(b,A,u.shading)})}for(w=0;w<H;w++)if(v=b.__webglObjects[w],v.render){p=v.object;I=v.buffer;y=v.transparent;i(p);for(v=0;v<y.count;v++)u=y.list[v],M(u.blending),g(u.depthTest),j(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits),f(d,C,J,u,I,p)}for(w=0;w<D;w++)if(v=b.__webglObjectsImmediate[w],p=v.object,p.visible){y=v.transparent;i(p);for(v=0;v<y.count;v++)u=y.list[v],M(u.blending),g(u.depthTest),
|
|
|
+j(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits),A=e(d,C,J,u,p),p.render(function(b){h(b,A,u.shading)})}}b.__webglSprites.length&&G(b,d);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&E(b,d);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,n.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],
|
|
|
b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&
|
|
|
P(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=
|
|
|
-c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,q=void 0,o=void 0,r=o=void 0,p=void 0,s=void 0,w=s=k=0,v=o=q=void 0,y=v=q=n=void 0,o=void 0,r=j.geometry,p=r.faces,v=i.faces,n=0,q=v.length;n<q;n++)o=v[n],o=p[o],o instanceof THREE.Face3?(k+=3,s+=1,w+=3):o instanceof THREE.Face4&&(k+=4,s+=2,w+=4);for(var n=i,
|
|
|
-q=j,x=v=p=void 0,B=void 0,x=void 0,o=[],p=0,v=q.materials.length;p<v;p++)if(x=q.materials[p],x instanceof THREE.MeshFaceMaterial){x=0;for(l=n.materials.length;x<l;x++)(B=n.materials[x])&&o.push(B)}else(B=x)&&o.push(B);n=o;i.__materials=n;a:{p=q=void 0;v=n.length;for(q=0;q<v;q++)if(p=n[q],p.map||p.lightMap||p instanceof THREE.MeshShaderMaterial){q=!0;break a}q=!1}a:{v=p=void 0;o=n.length;for(p=0;p<o;p++)if(v=n[p],!(v instanceof THREE.MeshBasicMaterial&&!v.envMap||v instanceof THREE.MeshDepthMaterial)){v=
|
|
|
-v&&v.shading!=void 0&&v.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}v=!1}a:{o=p=void 0;x=n.length;for(p=0;p<x;p++)if(o=n[p],o.vertexColors){o=o.vertexColors;break a}o=!1}i.__vertexArray=new Float32Array(k*3);if(v)i.__normalArray=new Float32Array(k*3);if(r.hasTangents)i.__tangentArray=new Float32Array(k*4);if(o)i.__colorArray=new Float32Array(k*3);if(q){if(r.faceUvs.length>0||r.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(r.faceUvs.length>1||r.faceVertexUvs.length>
|
|
|
-1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)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(s*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(w*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];r=0;for(p=i.numMorphTargets;r<p;r++)i.__morphTargetsArrays.push(new Float32Array(k*
|
|
|
-3))}i.__needsSmoothNormals=v==THREE.SmoothShading;i.__uvType=q;i.__vertexColorType=o;i.__normalType=v;i.__webglFaceCount=s*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=w*2;r=0;for(p=n.length;r<p;r++)if(q=n[r],q.attributes){if(i.__webglCustomAttributes===void 0)i.__webglCustomAttributes={};for(a in q.attributes){o=q.attributes[a];v={};for(y in o)v[y]=o[y];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,s=1,v.type==="v2"?s=2:v.type==="v3"?s=3:v.type===
|
|
|
-"v4"?s=4:v.type==="c"&&(s=3),v.size=s,v.array=new Float32Array(k*s),v.buffer=c.createBuffer(),v.buffer.belongsToAttribute=a,o.needsUpdate=!0,v.__original=o;i.__webglCustomAttributes[a]=v}}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?I(e.__webglShadowVolumes,h,d):I(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)I(e.__webglLensFlares,void 0,
|
|
|
-d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,
|
|
|
-h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=c.createBuffer();f.__webglColorBuffer=c.createBuffer();f=g;h=d;i=f.vertices.length;f.__vertexArray=new Float32Array(i*3);f.__colorArray=new Float32Array(i*3);f.__sortArray=[];f.__webglParticleCount=i;f.__materials=
|
|
|
-h.materials;y=k=j=void 0;j=0;for(k=h.materials.length;j<k;j++)if(y=h.materials[j],y.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in y.attributes){originalAttribute=y.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
|
|
|
-4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(i*size),attribute.buffer=c.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}I(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
|
|
|
-d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.ShadowVolume)u(d.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)u(d.__webglObjects,e);else if(e instanceof THREE.Sprite){d=d.__webglSprites;g=void 0;for(g=d.length-1;g>=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof THREE.LensFlare?u(d.__webglLensFlares,
|
|
|
-e):e instanceof THREE.MarchingCubes&&u(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)H(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)H(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)H(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),
|
|
|
-c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Xa}};
|
|
|
+c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,o=void 0,p=void 0,n=void 0,r=n=void 0,q=void 0,t=void 0,v=t=k=0,u=n=p=void 0,x=u=p=o=void 0,n=void 0,r=j.geometry,q=r.faces,u=i.faces,o=0,p=u.length;o<p;o++)n=u[o],n=q[n],n instanceof THREE.Face3?(k+=3,t+=1,v+=3):n instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var o=i,
|
|
|
+p=j,y=u=q=void 0,A=void 0,y=void 0,n=[],q=0,u=p.materials.length;q<u;q++)if(y=p.materials[q],y instanceof THREE.MeshFaceMaterial){y=0;for(l=o.materials.length;y<l;y++)(A=o.materials[y])&&n.push(A)}else(A=y)&&n.push(A);o=n;i.__materials=o;a:{q=p=void 0;u=o.length;for(p=0;p<u;p++)if(q=o[p],q.map||q.lightMap||q instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{u=q=void 0;n=o.length;for(q=0;q<n;q++)if(u=o[q],!(u instanceof THREE.MeshBasicMaterial&&!u.envMap||u instanceof THREE.MeshDepthMaterial)){u=
|
|
|
+u&&u.shading!=void 0&&u.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{n=q=void 0;y=o.length;for(q=0;q<y;q++)if(n=o[q],n.vertexColors){n=n.vertexColors;break a}n=!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=new Float32Array(k*3);if(r.hasTangents)i.__tangentArray=new Float32Array(k*4);if(n)i.__colorArray=new Float32Array(k*3);if(p){if(r.faceUvs.length>0||r.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(r.faceUvs.length>1||r.faceVertexUvs.length>
|
|
|
+1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)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(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];r=0;for(q=i.numMorphTargets;r<q;r++)i.__morphTargetsArrays.push(new Float32Array(k*
|
|
|
+3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=n;i.__normalType=u;i.__webglFaceCount=t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;r=0;for(q=o.length;r<q;r++)if(p=o[r],p.attributes){if(i.__webglCustomAttributes===void 0)i.__webglCustomAttributes={};for(a in p.attributes){n=p.attributes[a];u={};for(x in n)u[x]=n[x];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,t=1,u.type==="v2"?t=2:u.type==="v3"?t=3:u.type===
|
|
|
+"v4"?t=4:u.type==="c"&&(t=3),u.size=t,u.array=new Float32Array(k*t),u.buffer=c.createBuffer(),u.buffer.belongsToAttribute=a,n.needsUpdate=!0,u.__original=n;i.__webglCustomAttributes[a]=u}}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?J(e.__webglShadowVolumes,h,d):J(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)J(e.__webglLensFlares,void 0,
|
|
|
+d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;J(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,
|
|
|
+h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;J(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=c.createBuffer();f.__webglColorBuffer=c.createBuffer();f=g;h=d;i=f.vertices.length;f.__vertexArray=new Float32Array(i*3);f.__colorArray=new Float32Array(i*3);f.__sortArray=[];f.__webglParticleCount=i;f.__materials=
|
|
|
+h.materials;x=k=j=void 0;j=0;for(k=h.materials.length;j<k;j++)if(x=h.materials[j],x.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in x.attributes){originalAttribute=x.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
|
|
|
+4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(i*size),attribute.buffer=c.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}J(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
|
|
|
+d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.ShadowVolume)w(d.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)w(d.__webglObjects,e);else if(e instanceof THREE.Sprite){d=d.__webglSprites;g=void 0;for(g=d.length-1;g>=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof THREE.LensFlare?w(d.__webglLensFlares,
|
|
|
+e):e instanceof THREE.MarchingCubes&&w(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)I(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)I(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)I(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),
|
|
|
+c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Wa}};
|
|
|
THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
|