|
@@ -1,7 +1,7 @@
|
|
|
// ThreeWebGL.js r43 - http://github.com/mrdoob/three.js
|
|
|
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,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var e,h,j;if(d==0)this.r=this.g=this.b=0;else switch(e=Math.floor(b*6),h=b*6-e,b=d*(1-c),j=d*(1-c*h),c=d*(1-c*(1-h)),e){case 1:this.r=j;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=j;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
|
|
|
-d;this.g=b;this.b=j;break;case 6:case 0:this.r=d,this.g=c,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.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,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var e,h,g;if(d==0)this.r=this.g=this.b=0;else switch(e=Math.floor(b*6),h=b*6-e,b=d*(1-c),g=d*(1-c*h),c=d*(1-c*(1-h)),e){case 1:this.r=g;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=g;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
|
|
|
+d;this.g=b;this.b=g;break;case 6:case 0:this.r=d,this.g=c,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,c){this.set(b||0,c||0)};
|
|
|
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;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,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.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 c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
|
|
@@ -15,67 +15,68 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,e){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,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,c){return b.distance-c.distance});return e},intersectObject:function(b){function c(b,c,d){var e,d=d.matrixWorld.getPosition();e=d.clone().subSelf(b).dot(c);b=b.clone().addSelf(c.clone().multiplyScalar(e));return d.distanceTo(b)}function d(b,c,d,e){var e=e.clone().subSelf(c),
|
|
|
-d=d.clone().subSelf(c),h=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(h),g=d.dot(d),d=d.dot(h),h=1/(b*g-c*c),g=(g*e-c*d)*h,b=(b*d-c*e)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,j,g,k,
|
|
|
-q,m,o,p,r,v,C=b.geometry,x=C.vertices,E=[],e=0;for(h=C.faces.length;e<h;e++)if(j=C.faces[e],r=this.origin.clone(),v=this.direction.clone(),m=b.matrixWorld,g=m.multiplyVector3(x[j.a].position.clone()),k=m.multiplyVector3(x[j.b].position.clone()),q=m.multiplyVector3(x[j.c].position.clone()),m=j instanceof THREE.Face4?m.multiplyVector3(x[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),p=v.dot(o),b.doubleSided||(b.flipSided?p>0:p<0))if(o=o.dot((new THREE.Vector3).sub(g,
|
|
|
-r))/p,r=r.addSelf(v.multiplyScalar(o)),j instanceof THREE.Face3)d(r,g,k,q)&&(j={distance:this.origin.distanceTo(r),point:r,face:j,object:b},E.push(j));else if(j instanceof THREE.Face4&&(d(r,g,k,m)||d(r,k,q,m)))j={distance:this.origin.distanceTo(r),point:r,face:j,object:b},E.push(j);return E}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){j=e-c;g=h-d}var c,d,e,h,j,g,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return j};this.getHeight=function(){return g};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(g,j,o,p){k=!1;c=g;d=j;e=o;h=p;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,h=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,h=h>j?h:j);b()};this.add3Points=
|
|
|
+d=d.clone().subSelf(c),h=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(h),g=d.dot(d),d=d.dot(h),h=1/(b*g-c*c),g=(g*e-c*d)*h,b=(b*d-c*e)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,g,j,k,
|
|
|
+q,m,o,p,r,v,C=b.geometry,x=C.vertices,E=[],e=0;for(h=C.faces.length;e<h;e++)if(g=C.faces[e],r=this.origin.clone(),v=this.direction.clone(),m=b.matrixWorld,j=m.multiplyVector3(x[g.a].position.clone()),k=m.multiplyVector3(x[g.b].position.clone()),q=m.multiplyVector3(x[g.c].position.clone()),m=g instanceof THREE.Face4?m.multiplyVector3(x[g.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),p=v.dot(o),b.doubleSided||(b.flipSided?p>0:p<0))if(o=o.dot((new THREE.Vector3).sub(j,
|
|
|
+r))/p,r=r.addSelf(v.multiplyScalar(o)),g instanceof THREE.Face3)d(r,j,k,q)&&(g={distance:this.origin.distanceTo(r),point:r,face:g,object:b},E.push(g));else if(g instanceof THREE.Face4&&(d(r,j,k,m)||d(r,k,q,m)))g={distance:this.origin.distanceTo(r),point:r,face:g,object:b},E.push(g);return E}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){g=e-c;j=h-d}var c,d,e,h,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(g,j,o,p){k=!1;c=g;d=j;e=o;h=p;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,h=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,h=h>j?h:j);b()};this.add3Points=
|
|
|
function(g,j,o,p,r,v){k?(k=!1,c=g<o?g<r?g:r:o<r?o:r,d=j<p?j<v?j:v:p<v?p:v,e=g>o?g>r?g:r:o>r?o:r,h=j>p?j>v?j:v:p>v?p:v):(c=g<o?g<r?g<c?g:c:r<c?r:c:o<r?o<c?o:c:r<c?r:c,d=j<p?j<v?j<d?j:d:v<d?v:d:p<v?p<d?p:d:v<d?v:d,e=g>o?g>r?g>e?g:e:r>e?r:e:o>r?o>e?o:e:r>e?r:e,h=j>p?j>v?j>h?j:h:v>h?v:h:p>v?p>h?p:h:v>h?v:h);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),h=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?e:g.getRight(),h=h>
|
|
|
g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){c-=g;d-=g;e+=g;h+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;h=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,h,j,g,k,q,m,o,p,r,v,C,x){this.set(b||1,c||0,d||0,e||0,h||0,j||1,g||0,k||0,q||0,m||0,o||1,p||0,r||0,v||0,C||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,j,g,k,q,m,o,p,r,v,C,x){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=j;this.n23=g;this.n24=k;this.n31=q;this.n32=m;this.n33=o;this.n34=p;this.n41=r;this.n42=v;this.n43=C;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,
|
|
|
-c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;e.cross(d,j).normalize();e.length()===0&&(j.x+=1.0E-4,e.cross(d,j).normalize());h.cross(j,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=j.x;this.n21=e.y;this.n22=h.y;this.n23=j.y;this.n31=e.z;this.n32=h.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,h,g,j,k,q,m,o,p,r,v,C,x){this.set(b||1,c||0,d||0,e||0,h||0,g||1,j||0,k||0,q||0,m||0,o||1,p||0,r||0,v||0,C||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,g,j,k,q,m,o,p,r,v,C,x){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=g;this.n23=j;this.n24=k;this.n31=q;this.n32=m;this.n33=o;this.n34=p;this.n41=r;this.n42=v;this.n43=C;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,
|
|
|
+c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());h.cross(g,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=g.x;this.n21=e.y;this.n22=h.y;this.n23=g.y;this.n31=e.z;this.n32=h.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;
|
|
|
b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,h=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+
|
|
|
-d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,j=b.n14,g=b.n21,k=b.n22,q=b.n23,m=b.n24,o=b.n31,p=b.n32,r=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,J=b.n44,ya=c.n11,za=
|
|
|
-c.n12,sa=c.n13,V=c.n14,u=c.n21,Q=c.n22,O=c.n23,T=c.n24,U=c.n31,qa=c.n32,N=c.n33,L=c.n34,f=c.n41,ua=c.n42,Aa=c.n43,ta=c.n44;this.n11=d*ya+e*u+h*U+j*f;this.n12=d*za+e*Q+h*qa+j*ua;this.n13=d*sa+e*O+h*N+j*Aa;this.n14=d*V+e*T+h*L+j*ta;this.n21=g*ya+k*u+q*U+m*f;this.n22=g*za+k*Q+q*qa+m*ua;this.n23=g*sa+k*O+q*N+m*Aa;this.n24=g*V+k*T+q*L+m*ta;this.n31=o*ya+p*u+r*U+v*f;this.n32=o*za+p*Q+r*qa+v*ua;this.n33=o*sa+p*O+r*N+v*Aa;this.n34=o*V+p*T+r*L+v*ta;this.n41=C*ya+x*u+E*U+J*f;this.n42=C*za+x*Q+E*qa+J*ua;this.n43=
|
|
|
+d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,g=b.n14,j=b.n21,k=b.n22,q=b.n23,m=b.n24,o=b.n31,p=b.n32,r=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,J=b.n44,ya=c.n11,za=
|
|
|
+c.n12,sa=c.n13,V=c.n14,u=c.n21,Q=c.n22,O=c.n23,T=c.n24,U=c.n31,qa=c.n32,N=c.n33,L=c.n34,f=c.n41,ua=c.n42,Aa=c.n43,ta=c.n44;this.n11=d*ya+e*u+h*U+g*f;this.n12=d*za+e*Q+h*qa+g*ua;this.n13=d*sa+e*O+h*N+g*Aa;this.n14=d*V+e*T+h*L+g*ta;this.n21=j*ya+k*u+q*U+m*f;this.n22=j*za+k*Q+q*qa+m*ua;this.n23=j*sa+k*O+q*N+m*Aa;this.n24=j*V+k*T+q*L+m*ta;this.n31=o*ya+p*u+r*U+v*f;this.n32=o*za+p*Q+r*qa+v*ua;this.n33=o*sa+p*O+r*N+v*Aa;this.n34=o*V+p*T+r*L+v*ta;this.n41=C*ya+x*u+E*U+J*f;this.n42=C*za+x*Q+E*qa+J*ua;this.n43=
|
|
|
C*sa+x*O+E*N+J*Aa;this.n44=C*V+x*T+E*L+J*ta;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(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,c=this.n12,d=this.n13,e=this.n14,h=this.n21,j=this.n22,g=this.n23,k=this.n24,q=this.n31,m=this.n32,o=this.n33,p=this.n34,r=this.n41,v=this.n42,C=this.n43,x=this.n44;return e*g*m*r-d*k*m*r-e*j*o*r+c*k*o*r+d*j*p*r-c*g*p*r-e*g*q*v+d*k*q*v+e*h*o*v-b*k*o*v-d*h*p*v+b*g*p*v+e*j*q*C-c*k*q*C-e*h*m*C+b*k*m*C+c*h*p*C-b*j*p*C-d*j*q*x+c*g*
|
|
|
-q*x+d*h*m*x-b*g*m*x-c*h*o*x+b*j*o*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;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,c=this.n12,d=this.n13,e=this.n14,h=this.n21,g=this.n22,j=this.n23,k=this.n24,q=this.n31,m=this.n32,o=this.n33,p=this.n34,r=this.n41,v=this.n42,C=this.n43,x=this.n44;return e*j*m*r-d*k*m*r-e*g*o*r+c*k*o*r+d*g*p*r-c*j*p*r-e*j*q*v+d*k*q*v+e*h*o*v-b*k*o*v-d*h*p*v+b*j*p*v+e*g*q*C-c*k*q*C-e*h*m*C+b*k*m*C+c*h*p*C-b*g*p*C-d*g*q*x+c*j*
|
|
|
+q*x+d*h*m*x-b*j*m*x-c*h*o*x+b*g*o*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,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
|
|
|
this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
|
|
|
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,j=b.x,g=b.y,k=b.z,q=h*j,m=h*g;this.set(q*j+d,q*g-e*k,q*k+e*g,0,q*g+e*k,m*g+d,m*k-e*j,0,q*k-e*g,m*k+e*j,h*k*k+d,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,c){var d=b.x,e=b.y,h=b.z,j=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var q=
|
|
|
-g*k,m=g*h,o=e*k,p=e*h;this.n11=q+p*d;this.n12=o*d-m;this.n13=j*e;this.n21=j*h;this.n22=j*k;this.n23=-d;this.n31=m*d-o;this.n32=p+q*d;this.n33=j*g;break;case "ZXY":q=g*k;m=g*h;o=e*k;p=e*h;this.n11=q-p*d;this.n12=-j*h;this.n13=o+m*d;this.n21=m+o*d;this.n22=j*k;this.n23=p-q*d;this.n31=-j*e;this.n32=d;this.n33=j*g;break;case "ZYX":q=j*k;m=j*h;o=d*k;p=d*h;this.n11=g*k;this.n12=o*e-m;this.n13=q*e+p;this.n21=g*h;this.n22=p*e+q;this.n23=m*e-o;this.n31=-e;this.n32=d*g;this.n33=j*g;break;case "YZX":q=j*g;m=
|
|
|
-j*e;o=d*g;p=d*e;this.n11=g*k;this.n12=p-q*h;this.n13=o*h+m;this.n21=h;this.n22=j*k;this.n23=-d*k;this.n31=-e*k;this.n32=m*h+o;this.n33=q-p*h;break;case "XZY":q=j*g;m=j*e;o=d*g;p=d*e;this.n11=g*k;this.n12=-h;this.n13=e*k;this.n21=q*h+p;this.n22=j*k;this.n23=m*h-o;this.n31=o*h-m;this.n32=d*k;this.n33=p*h+q;break;default:q=j*k,m=j*h,o=d*k,p=d*h,this.n11=g*k,this.n12=-g*h,this.n13=e,this.n21=m+o*e,this.n22=q-p*e,this.n23=-d*g,this.n31=p-q*e,this.n32=o+m*e,this.n33=j*g}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
-b.x,d=b.y,e=b.z,h=b.w,j=c+c,g=d+d,k=e+e,b=c*j,q=c*g;c*=k;var m=d*g;d*=k;e*=k;j*=h;g*=h;h*=k;this.n11=1-(m+e);this.n12=q-h;this.n13=c+g;this.n21=q+h;this.n22=1-(b+e);this.n23=d-j;this.n31=c-g;this.n32=d+j;this.n33=1-(b+m);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
-extractRotation:function(b,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,h=b.n13,j=b.n14,g=b.n21,k=b.n22,q=b.n23,m=b.n24,o=b.n31,p=b.n32,r=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,J=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*v*x-m*r*x+m*p*E-k*v*E-q*p*J+k*r*J;c.n12=j*r*x-h*v*x-j*p*E+e*v*E+h*p*J-e*r*J;c.n13=h*m*x-j*q*x+j*k*E-e*m*E-h*k*J+e*q*J;c.n14=j*q*p-h*m*p-j*k*r+e*m*r+h*k*v-e*q*v;c.n21=m*r*C-q*v*C-m*o*E+g*v*E+q*o*J-g*r*J;c.n22=h*v*C-j*r*C+j*o*E-d*v*E-h*o*J+d*r*J;c.n23=j*q*C-h*m*C-j*g*E+d*m*E+h*g*J-d*q*J;c.n24=
|
|
|
-h*m*o-j*q*o+j*g*r-d*m*r-h*g*v+d*q*v;c.n31=k*v*C-m*p*C+m*o*x-g*v*x-k*o*J+g*p*J;c.n32=j*p*C-e*v*C-j*o*x+d*v*x+e*o*J-d*p*J;c.n33=h*m*C-j*k*C+j*g*x-d*m*x-e*g*J+d*k*J;c.n34=j*k*o-e*m*o-j*g*p+d*m*p+e*g*v-d*k*v;c.n41=q*p*C-k*r*C-q*o*x+g*r*x+k*o*E-g*p*E;c.n42=e*r*C-h*p*C+h*o*x-d*r*x-e*o*E+d*p*E;c.n43=h*k*C-e*q*C-h*g*x+d*q*x+e*g*E-d*k*E;c.n44=e*q*o-h*k*o+h*g*p-d*q*p-e*g*r+d*k*r;c.multiplyScalar(1/b.determinant());return c};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,m=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*g+b.n31*m;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*j;d[3]=b*g;d[4]=b*k;d[5]=b*q;d[6]=b*m;d[7]=b*o;d[8]=b*p;return c};
|
|
|
-THREE.Matrix4.makeFrustum=function(b,c,d,e,h,j){var g;g=new THREE.Matrix4;g.n11=2*h/(c-b);g.n12=0;g.n13=(c+b)/(c-b);g.n14=0;g.n21=0;g.n22=2*h/(e-d);g.n23=(e+d)/(e-d);g.n24=0;g.n31=0;g.n32=0;g.n33=-(j+h)/(j-h);g.n34=-2*j*h/(j-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,c,d,e){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,e)};
|
|
|
-THREE.Matrix4.makeOrtho=function(b,c,d,e,h,j){var g,k,q,m;g=new THREE.Matrix4;k=c-b;q=d-e;m=j-h;g.n11=2/k;g.n12=0;g.n13=0;g.n14=-((c+b)/k);g.n21=0;g.n22=2/q;g.n23=0;g.n24=-((d+e)/q);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((j+h)/m);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;
|
|
|
+0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,g=b.x,j=b.y,k=b.z,q=h*g,m=h*j;this.set(q*g+d,q*j-e*k,q*k+e*j,0,q*j+e*k,m*j+d,m*k-e*g,0,q*k-e*j,m*k+e*g,h*k*k+d,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,c){var d=b.x,e=b.y,h=b.z,g=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var q=
|
|
|
+j*k,m=j*h,o=e*k,p=e*h;this.n11=q+p*d;this.n12=o*d-m;this.n13=g*e;this.n21=g*h;this.n22=g*k;this.n23=-d;this.n31=m*d-o;this.n32=p+q*d;this.n33=g*j;break;case "ZXY":q=j*k;m=j*h;o=e*k;p=e*h;this.n11=q-p*d;this.n12=-g*h;this.n13=o+m*d;this.n21=m+o*d;this.n22=g*k;this.n23=p-q*d;this.n31=-g*e;this.n32=d;this.n33=g*j;break;case "ZYX":q=g*k;m=g*h;o=d*k;p=d*h;this.n11=j*k;this.n12=o*e-m;this.n13=q*e+p;this.n21=j*h;this.n22=p*e+q;this.n23=m*e-o;this.n31=-e;this.n32=d*j;this.n33=g*j;break;case "YZX":q=g*j;m=
|
|
|
+g*e;o=d*j;p=d*e;this.n11=j*k;this.n12=p-q*h;this.n13=o*h+m;this.n21=h;this.n22=g*k;this.n23=-d*k;this.n31=-e*k;this.n32=m*h+o;this.n33=q-p*h;break;case "XZY":q=g*j;m=g*e;o=d*j;p=d*e;this.n11=j*k;this.n12=-h;this.n13=e*k;this.n21=q*h+p;this.n22=g*k;this.n23=m*h-o;this.n31=o*h-m;this.n32=d*k;this.n33=p*h+q;break;default:q=g*k,m=g*h,o=d*k,p=d*h,this.n11=j*k,this.n12=-j*h,this.n13=e,this.n21=m+o*e,this.n22=q-p*e,this.n23=-d*j,this.n31=p-q*e,this.n32=o+m*e,this.n33=g*j}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
+b.x,d=b.y,e=b.z,h=b.w,g=c+c,j=d+d,k=e+e,b=c*g,q=c*j;c*=k;var m=d*j;d*=k;e*=k;g*=h;j*=h;h*=k;this.n11=1-(m+e);this.n12=q-h;this.n13=c+j;this.n21=q+h;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+m);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=new THREE.Matrix4,h=new THREE.Matrix4;e.setRotationFromQuaternion(c);
|
|
|
+h.setScale(d.x,d.y,d.z);this.multiply(e,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=new THREE.Vector3(this.n11,this.n21,this.n31),h=new THREE.Vector3(this.n12,this.n22,this.n32),g=new THREE.Vector3(this.n13,this.n23,this.n33),b=b instanceof THREE.Vector3?b:new THREE.Vector3,c=c instanceof THREE.Quaternion?c:new THREE.Quaternion,d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length();d.y=h.length();d.z=g.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;
|
|
|
+e=this.clone();e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,h=b.n13,g=b.n14,j=b.n21,k=b.n22,q=b.n23,m=b.n24,o=b.n31,p=b.n32,r=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,J=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*v*x-m*r*x+m*p*E-k*v*E-q*p*J+k*r*J;c.n12=g*r*x-h*v*x-g*p*E+e*v*E+h*p*J-e*r*J;c.n13=h*m*x-g*q*x+g*k*E-e*m*E-h*k*J+e*q*J;c.n14=g*q*p-h*m*p-g*k*r+e*m*r+h*k*v-e*q*v;c.n21=m*r*C-q*v*C-m*o*E+j*v*E+q*o*J-j*r*J;c.n22=h*v*C-g*r*C+g*o*E-d*v*E-h*o*J+d*r*J;c.n23=g*q*C-h*m*C-g*j*E+d*m*E+h*j*J-d*q*J;c.n24=
|
|
|
+h*m*o-g*q*o+g*j*r-d*m*r-h*j*v+d*q*v;c.n31=k*v*C-m*p*C+m*o*x-j*v*x-k*o*J+j*p*J;c.n32=g*p*C-e*v*C-g*o*x+d*v*x+e*o*J-d*p*J;c.n33=h*m*C-g*k*C+g*j*x-d*m*x-e*j*J+d*k*J;c.n34=g*k*o-e*m*o-g*j*p+d*m*p+e*j*v-d*k*v;c.n41=q*p*C-k*r*C-q*o*x+j*r*x+k*o*E-j*p*E;c.n42=e*r*C-h*p*C+h*o*x-d*r*x-e*o*E+d*p*E;c.n43=h*k*C-e*q*C-h*j*x+d*q*x+e*j*E-d*k*E;c.n44=e*q*o-h*k*o+h*j*p-d*q*p-e*j*r+d*k*r;c.multiplyScalar(1/b.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,m=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*m;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*q;d[6]=b*m;d[7]=b*o;d[8]=b*p;return c};
|
|
|
+THREE.Matrix4.makeFrustum=function(b,c,d,e,h,g){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+h)/(g-h);j.n34=-2*g*h/(g-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,e)};
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,d,e,h,g){var j,k,q,m;j=new THREE.Matrix4;k=c-b;q=d-e;m=g-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/q;j.n23=0;j.n24=-((d+e)/q);j.n31=0;j.n32=0;j.n33=-2/m;j.n34=-((g+h)/m);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
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,c){this.matrix.rotateAxis(c);this.position.addSelf(c.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 c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var d,e,h;d=0;for(e=this.children.length;d<e;d++){h=this.children[d];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),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,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,e=this.children.length;b<e;b++)this.children[b].update(this.matrixWorld,c,d)}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
|
|
|
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;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 c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,h=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-h),h=Math.sin(-h),j=Math.cos(d),d=Math.sin(d),g=b*c,k=e*h;this.w=g*j-k*d;this.x=g*d+k*j;this.y=e*c*j+b*h*d;this.z=b*h*j-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
|
|
|
-this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var 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 c=this.x,d=this.y,e=this.z,h=this.w,j=b.x,g=b.y,k=b.z,b=b.w;this.x=c*b+h*j+d*k-e*g;this.y=d*b+h*g+e*j-c*k;this.z=e*b+h*k+c*g-d*j;this.w=h*b-c*j-d*g-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,h=b.z,j=this.x,g=this.y,k=this.z,
|
|
|
-q=this.w,m=q*d+g*h-k*e,o=q*e+k*d-j*h,p=q*h+j*e-g*d,d=-j*d-g*e-k*h;c.x=m*q+d*-j+o*-k-p*-g;c.y=o*q+d*-g+p*-j-m*-k;c.z=p*q+d*-k+m*-g-o*-j;return c}};
|
|
|
-THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*j)/g;e=Math.sin(e*j)/g;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
-THREE.Face3=function(b,c,d,e,h,j){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
|
-THREE.Face4=function(b,c,d,e,h,j,g){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;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 c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,h=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-h),h=Math.sin(-h),g=Math.cos(d),d=Math.sin(d),j=b*c,k=e*h;this.w=j*g-k*d;this.x=j*d+k*g;this.y=e*c*g+b*h*d;this.z=b*h*g-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
|
|
|
+this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
+this.normalize();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 c=
|
|
|
+this.x,d=this.y,e=this.z,h=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*g+d*k-e*j;this.y=d*b+h*j+e*g-c*k;this.z=e*b+h*k+c*j-d*g;this.w=h*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,h=b.z,g=this.x,j=this.y,k=this.z,q=this.w,m=q*d+j*h-k*e,o=q*e+k*d-g*h,p=q*h+g*e-j*d,d=-g*
|
|
|
+d-j*e-k*h;c.x=m*q+d*-g+o*-k-p*-j;c.y=o*q+d*-j+p*-g-m*-k;c.z=p*q+d*-k+m*-j-o*-g;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var g=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d};
|
|
|
+THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,h,g){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
|
|
|
+THREE.Face4=function(b,c,d,e,h,g,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;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.dynamic=this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),
|
|
|
-d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,h,j,g,k=new THREE.Vector3,q=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){j=this.faces[e];if(b&&j.vertexNormals.length){k.set(0,0,0);c=0;for(d=j.vertexNormals.length;c<d;c++)k.addSelf(j.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[j.a],d=this.vertices[j.b],g=this.vertices[j.c],k.sub(g.position,d.position),q.sub(c.position,d.position),k.crossSelf(q);k.isZero()||
|
|
|
-k.normalize();j.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
|
|
|
+d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,h,g,j,k=new THREE.Vector3,q=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){g=this.faces[e];if(b&&g.vertexNormals.length){k.set(0,0,0);c=0;for(d=g.vertexNormals.length;c<d;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[g.a],d=this.vertices[g.b],j=this.vertices[g.c],k.sub(j.position,d.position),q.sub(c.position,d.position),k.crossSelf(q);k.isZero()||
|
|
|
+k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
|
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
|
|
|
-d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,f,c,d,e,h,j){k=b.vertices[f].position;q=b.vertices[c].position;m=b.vertices[d].position;o=g[e];p=g[h];r=g[j];v=q.x-k.x;C=m.x-k.x;x=q.y-k.y;E=m.y-k.y;J=q.z-k.z;ya=m.z-k.z;za=p.u-o.u;sa=r.u-o.u;V=p.v-o.v;u=r.v-o.v;Q=1/(za*u-sa*V);qa.set((u*v-
|
|
|
-V*C)*Q,(u*x-V*E)*Q,(u*J-V*ya)*Q);N.set((za*C-sa*v)*Q,(za*E-sa*x)*Q,(za*ya-sa*J)*Q);T[f].addSelf(qa);T[c].addSelf(qa);T[d].addSelf(qa);U[f].addSelf(N);U[c].addSelf(N);U[d].addSelf(N)}var c,d,e,h,j,g,k,q,m,o,p,r,v,C,x,E,J,ya,za,sa,V,u,Q,O,T=[],U=[],qa=new THREE.Vector3,N=new THREE.Vector3,L=new THREE.Vector3,f=new THREE.Vector3,ua=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)T[c]=new THREE.Vector3,U[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)j=this.faces[c],g=this.faceVertexUvs[0][c],
|
|
|
-j instanceof THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var Aa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){j=this.faces[c];for(e=0;e<j.vertexNormals.length;e++)ua.copy(j.vertexNormals[e]),h=j[Aa[e]],O=T[h],L.copy(O),L.subSelf(ua.multiplyScalar(ua.dot(O))).normalize(),f.cross(j.vertexNormals[e],O),h=f.dot(U[h]),h=h<0?-1:1,j.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
+d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,f,c,d,e,h,g){k=b.vertices[f].position;q=b.vertices[c].position;m=b.vertices[d].position;o=j[e];p=j[h];r=j[g];v=q.x-k.x;C=m.x-k.x;x=q.y-k.y;E=m.y-k.y;J=q.z-k.z;ya=m.z-k.z;za=p.u-o.u;sa=r.u-o.u;V=p.v-o.v;u=r.v-o.v;Q=1/(za*u-sa*V);qa.set((u*v-
|
|
|
+V*C)*Q,(u*x-V*E)*Q,(u*J-V*ya)*Q);N.set((za*C-sa*v)*Q,(za*E-sa*x)*Q,(za*ya-sa*J)*Q);T[f].addSelf(qa);T[c].addSelf(qa);T[d].addSelf(qa);U[f].addSelf(N);U[c].addSelf(N);U[d].addSelf(N)}var c,d,e,h,g,j,k,q,m,o,p,r,v,C,x,E,J,ya,za,sa,V,u,Q,O,T=[],U=[],qa=new THREE.Vector3,N=new THREE.Vector3,L=new THREE.Vector3,f=new THREE.Vector3,ua=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)T[c]=new THREE.Vector3,U[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],
|
|
|
+g instanceof THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var Aa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)ua.copy(g.vertexNormals[e]),h=g[Aa[e]],O=T[h],L.copy(O),L.subSelf(ua.multiplyScalar(ua.dot(O))).normalize(),f.cross(g.vertexNormals[e],O),h=f.dot(U[h]),h=h<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.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 c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];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,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===
|
|
|
-void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=1,b[c].array.push(d))}var d,e,h,j,g,k={};d=0;for(e=this.faces.length;d<e;d++)g=this.faces[d],g instanceof THREE.Face3?(h=b(g.a,g.b),c(k,h,d),h=b(g.b,g.c),c(k,h,d),h=b(g.a,g.c),c(k,h,d)):g instanceof THREE.Face4&&(h=b(g.b,g.d),c(k,h,d),h=b(g.a,g.b),c(k,h,d),h=b(g.a,g.d),c(k,h,d),h=b(g.b,g.c),c(k,h,d),h=b(g.c,g.d),c(k,h,d));d=0;for(e=this.edges.length;d<e;d++){g=this.edges[d];h=g.vertexIndices[0];j=g.vertexIndices[1];
|
|
|
-g.faceIndices=k[b(h,j)].array;for(h=0;h<g.faceIndices.length;h++)j=g.faceIndices[h],g.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(b){function c(b,c,d,e,h,g,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*g+b*h+c}this.points=b;var d=[],e={x:0,y:0,z:0},h,j,g,k,q,m,o,p,r;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;j=Math.floor(h);g=h-j;d[0]=j==0?j:j-1;d[1]=j;d[2]=j>this.points.length-2?j:j+1;d[3]=j>this.points.length-3?j:j+2;m=this.points[d[0]];o=this.points[d[1]];
|
|
|
-p=this.points[d[2]];r=this.points[d[3]];k=g*g;q=g*k;e.x=c(m.x,o.x,p.x,r.x,g,k,q);e.y=c(m.y,o.y,p.y,r.y,g,k,q);e.z=c(m.z,o.z,p.z,r.z,g,k,q);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;h.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),g.copy(position),
|
|
|
+void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=1,b[c].array.push(d))}var d,e,h,g,j,k={};d=0;for(e=this.faces.length;d<e;d++)j=this.faces[d],j instanceof THREE.Face3?(h=b(j.a,j.b),c(k,h,d),h=b(j.b,j.c),c(k,h,d),h=b(j.a,j.c),c(k,h,d)):j instanceof THREE.Face4&&(h=b(j.b,j.d),c(k,h,d),h=b(j.a,j.b),c(k,h,d),h=b(j.a,j.d),c(k,h,d),h=b(j.b,j.c),c(k,h,d),h=b(j.c,j.d),c(k,h,d));d=0;for(e=this.edges.length;d<e;d++){j=this.edges[d];h=j.vertexIndices[0];g=j.vertexIndices[1];
|
|
|
+j.faceIndices=k[b(h,g)].array;for(h=0;h<j.faceIndices.length;h++)g=j.faceIndices[h],j.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;
|
|
|
+THREE.Spline=function(b){function c(b,c,d,e,h,g,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*g+b*h+c}this.points=b;var d=[],e={x:0,y:0,z:0},h,g,j,k,q,m,o,p,r;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;g=Math.floor(h);j=h-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;m=this.points[d[0]];o=this.points[d[1]];
|
|
|
+p=this.points[d[2]];r=this.points[d[3]];k=j*j;q=j*k;e.x=c(m.x,o.x,p.x,r.x,j,k,q);e.y=c(m.y,o.y,p.y,r.y,j,k,q);e.z=c(m.z,o.z,p.z,r.z,j,k,q);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;h.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),g.copy(position),
|
|
|
k+=g.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(j[c]=k,e=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,e,h,g,j,k=[],m=new THREE.Vector3,q=this.getLength();k.push(m.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=q.chunks[c]-q.chunks[c-1];j=Math.ceil(b*d/q.total);h=(c-1)/(this.points.length-1);g=c/(this.points.length-1);for(d=1;d<j-1;d++)e=h+d*(1/j)*(g-h),position=this.getPoint(e),k.push(m.copy(position).clone());
|
|
|
k.push(m.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||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,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/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,c,d,e,h,j){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=h;this.height=j;this.updateProjectionMatrix()};
|
|
|
+THREE.Camera.prototype.setViewOffset=function(b,c,d,e,h,g){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=h;this.height=g;this.updateProjectionMatrix()};
|
|
|
THREE.Camera.prototype.update=function(b,c,d){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),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
|
|
|
!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};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,c,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0;this.castShadow=e!==void 0?e:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};
|
|
@@ -98,7 +99,7 @@ THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.sh
|
|
|
THREE.MeshShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;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.fog=
|
|
|
b.fog!==void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;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.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
|
|
|
THREE.ParticleBasicMaterial=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.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
|
-THREE.Texture=function(b,c,d,e,h,j){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
+THREE.Texture=function(b,c,d,e,h,g){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=g!==void 0?g: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,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
@@ -108,12 +109,12 @@ d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THR
|
|
|
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,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
|
|
|
c,d)};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,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,h,j,g,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],j=h.pos,g=h.rotq,k=h.scl,e=this.addBone(),e.name=h.name,e.position.set(j[0],j[1],j[2]),e.quaternion.set(g[0],g[1],g[2],g[3]),e.useQuaternion=!0,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
|
|
|
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,h,g,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],g=h.pos,j=h.rotq,k=h.scl,e=this.addBone(),e.name=h.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(j[0],j[1],j[2],j[3]),e.useQuaternion=!0,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
|
|
|
e=this.bones[d],h.parent===-1?this.addChild(e):this.bones[h.parent].addChild(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(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,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;e=new THREE.Vector3(d.x,
|
|
|
-d.y,d.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[j].multiplyVector3(e));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,g=this.geometry.skinIndices[b].y;e=new THREE.Vector3(d.x,
|
|
|
+d.y,d.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(e));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
|
|
|
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,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
|
|
|
THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.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 e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
|
|
|
this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
|
|
@@ -125,17 +126,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 c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};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 c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
|
THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
|
-THREE.Projector=function(){function b(){var b=q[k]=q[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,f=1,e=b.z+b.w,h=c.z+c.w,g=-b.z+b.w,j=-c.z+c.w;return e>=0&&h>=0&&g>=0&&j>=0?!0:e<0&&h<0||g<0&&j<0?!1:(e<0?d=Math.max(d,e/(e-h)):h<0&&(f=Math.min(f,e/(e-h))),g<0?d=Math.max(d,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),f<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-f),!0))}var e,h,j=[],g,k,q=[],m,o,p=[],r,v=[],C,x,E=[],J,ya,za=[],sa=new THREE.Vector4,V=new THREE.Vector4,
|
|
|
-u=new THREE.Matrix4,Q=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,g){var d=[],f,k,m;h=0;k=
|
|
|
-b.objects;b=0;for(f=k.length;b<f;b++){m=k[b];var q;if(!(q=!m.visible))if(q=m instanceof THREE.Mesh){a:{q=void 0;for(var o=m.matrixWorld,p=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),r=0;r<6;r++)if(q=O[r].x*o.n14+O[r].y*o.n24+O[r].z*o.n34+O[r].w,q<=p){q=!1;break a}q=!0}q=!q}if(!q)q=j[h]=j[h]||new THREE.RenderableObject,h++,e=q,sa.copy(m.position),u.multiplyVector3(sa),e.object=m,e.z=sa.z,d.push(e)}g&&d.sort(c);return d};this.projectScene=function(e,h,j){var f=
|
|
|
+THREE.Projector=function(){function b(){var b=q[k]=q[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,f=1,e=b.z+b.w,h=c.z+c.w,g=-b.z+b.w,j=-c.z+c.w;return e>=0&&h>=0&&g>=0&&j>=0?!0:e<0&&h<0||g<0&&j<0?!1:(e<0?d=Math.max(d,e/(e-h)):h<0&&(f=Math.min(f,e/(e-h))),g<0?d=Math.max(d,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),f<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-f),!0))}var e,h,g=[],j,k,q=[],m,o,p=[],r,v=[],C,x,E=[],J,ya,za=[],sa=new THREE.Vector4,V=new THREE.Vector4,
|
|
|
+u=new THREE.Matrix4,Q=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var d=[],f,k,m;h=0;k=
|
|
|
+b.objects;b=0;for(f=k.length;b<f;b++){m=k[b];var q;if(!(q=!m.visible))if(q=m instanceof THREE.Mesh){a:{q=void 0;for(var o=m.matrixWorld,p=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),r=0;r<6;r++)if(q=O[r].x*o.n14+O[r].y*o.n24+O[r].z*o.n34+O[r].w,q<=p){q=!1;break a}q=!0}q=!q}if(!q)q=g[h]=g[h]||new THREE.RenderableObject,h++,e=q,sa.copy(m.position),u.multiplyVector3(sa),e.object=m,e.z=sa.z,d.push(e)}j&&d.sort(c);return d};this.projectScene=function(e,h,g){var f=
|
|
|
[],sa=h.near,Aa=h.far,ta,va,Y,pa,D,W,P,S,fa,K,Ba,Ea,wa,ha,Z,Fa,Da;ya=x=r=o=0;h.matrixAutoUpdate&&h.update(void 0,!0);e.update(void 0,!1,h);u.multiply(h.projectionMatrix,h.matrixWorldInverse);O[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);O[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);O[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);O[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);O[4].set(u.n41-u.n31,u.n42-u.n32,u.n43-u.n33,u.n44-u.n34);O[5].set(u.n41+u.n31,
|
|
|
-u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ta=0;ta<6;ta++)fa=O[ta],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(e,h,!0);e=0;for(ta=fa.length;e<ta;e++)if(K=fa[e].object,K.visible)if(Ba=K.matrixWorld,Ea=K.matrixRotationWorld,wa=K.materials,ha=K.overdraw,k=0,K instanceof THREE.Mesh){Z=K.geometry;pa=Z.vertices;Fa=Z.faces;Z=Z.faceVertexUvs;va=0;for(Y=pa.length;va<Y;va++)g=b(),g.positionWorld.copy(pa[va].position),Ba.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
|
|
|
-u.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>sa&&g.positionScreen.z<Aa;pa=0;for(va=Fa.length;pa<va;pa++){Y=Fa[pa];if(Y instanceof THREE.Face3)if(D=q[Y.a],W=q[Y.b],P=q[Y.c],D.visible&&W.visible&&P.visible&&(K.doubleSided||K.flipSided!=(P.positionScreen.x-D.positionScreen.x)*(W.positionScreen.y-D.positionScreen.y)-(P.positionScreen.y-D.positionScreen.y)*(W.positionScreen.x-D.positionScreen.x)<0))S=p[o]=
|
|
|
+u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ta=0;ta<6;ta++)fa=O[ta],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(e,h,!0);e=0;for(ta=fa.length;e<ta;e++)if(K=fa[e].object,K.visible)if(Ba=K.matrixWorld,Ea=K.matrixRotationWorld,wa=K.materials,ha=K.overdraw,k=0,K instanceof THREE.Mesh){Z=K.geometry;pa=Z.vertices;Fa=Z.faces;Z=Z.faceVertexUvs;va=0;for(Y=pa.length;va<Y;va++)j=b(),j.positionWorld.copy(pa[va].position),Ba.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
|
|
|
+u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>sa&&j.positionScreen.z<Aa;pa=0;for(va=Fa.length;pa<va;pa++){Y=Fa[pa];if(Y instanceof THREE.Face3)if(D=q[Y.a],W=q[Y.b],P=q[Y.c],D.visible&&W.visible&&P.visible&&(K.doubleSided||K.flipSided!=(P.positionScreen.x-D.positionScreen.x)*(W.positionScreen.y-D.positionScreen.y)-(P.positionScreen.y-D.positionScreen.y)*(W.positionScreen.x-D.positionScreen.x)<0))S=p[o]=
|
|
|
p[o]||new THREE.RenderableFace3,o++,m=S,m.v1.copy(D),m.v2.copy(W),m.v3.copy(P);else continue;else if(Y instanceof THREE.Face4)if(D=q[Y.a],W=q[Y.b],P=q[Y.c],S=q[Y.d],D.visible&&W.visible&&P.visible&&S.visible&&(K.doubleSided||K.flipSided!=((S.positionScreen.x-D.positionScreen.x)*(W.positionScreen.y-D.positionScreen.y)-(S.positionScreen.y-D.positionScreen.y)*(W.positionScreen.x-D.positionScreen.x)<0||(W.positionScreen.x-P.positionScreen.x)*(S.positionScreen.y-P.positionScreen.y)-(W.positionScreen.y-
|
|
|
P.positionScreen.y)*(S.positionScreen.x-P.positionScreen.x)<0)))Da=v[r]=v[r]||new THREE.RenderableFace4,r++,m=Da,m.v1.copy(D),m.v2.copy(W),m.v3.copy(P),m.v4.copy(S);else continue;m.normalWorld.copy(Y.normal);Ea.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Y.centroid);Ba.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);u.multiplyVector3(m.centroidScreen);P=Y.vertexNormals;D=0;for(W=P.length;D<W;D++)S=m.vertexNormalsWorld[D],S.copy(P[D]),Ea.multiplyVector3(S);D=0;for(W=
|
|
|
Z.length;D<W;D++)if(Da=Z[D][pa]){P=0;for(S=Da.length;P<S;P++)m.uvs[D][P]=Da[P]}m.meshMaterials=wa;m.faceMaterials=Y.materials;m.overdraw=ha;m.z=m.centroidScreen.z;f.push(m)}}else if(K instanceof THREE.Line){Q.multiply(u,Ba);pa=K.geometry.vertices;D=b();D.positionScreen.copy(pa[0].position);Q.multiplyVector4(D.positionScreen);va=1;for(Y=pa.length;va<Y;va++)if(D=b(),D.positionScreen.copy(pa[va].position),Q.multiplyVector4(D.positionScreen),W=q[k-2],T.copy(D.positionScreen),U.copy(W.positionScreen),
|
|
|
d(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),Ba=E[x]=E[x]||new THREE.RenderableLine,x++,C=Ba,C.v1.positionScreen.copy(T),C.v2.positionScreen.copy(U),C.z=Math.max(T.z,U.z),C.materials=K.materials,f.push(C)}else if(K instanceof THREE.Particle&&(V.set(K.matrixWorld.n14,K.matrixWorld.n24,K.matrixWorld.n34,1),u.multiplyVector4(V),V.z/=V.w,V.z>0&&V.z<1))Ba=za[ya]=za[ya]||new THREE.RenderableParticle,ya++,J=Ba,J.x=V.x/V.w,J.y=V.y/V.w,J.z=V.z,J.rotation=K.rotation.z,J.scale.x=K.scale.x*Math.abs(J.x-
|
|
|
-(V.x+h.projectionMatrix.n11)/(V.w+h.projectionMatrix.n14)),J.scale.y=K.scale.y*Math.abs(J.y-(V.y+h.projectionMatrix.n22)/(V.w+h.projectionMatrix.n24)),J.materials=K.materials,f.push(J);j&&f.sort(c);return f}};
|
|
|
+(V.x+h.projectionMatrix.n11)/(V.w+h.projectionMatrix.n14)),J.scale.y=K.scale.y*Math.abs(J.y-(V.y+h.projectionMatrix.n22)/(V.w+h.projectionMatrix.n24)),J.materials=K.materials,f.push(J);g&&f.sort(c);return f}};
|
|
|
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",
|
|
@@ -195,13 +196,13 @@ f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),f.vertex
|
|
|
f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),f.drawElements(f.TRIANGLES,g.__webglFaceCount,f.UNSIGNED_SHORT,0)),L.data.vertices+=g.__webglFaceCount,L.data.faces+=g.__webglFaceCount/3,L.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(h.linewidth),f.drawArrays(j,0,g.__webglLineCount),L.data.drawCalls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,g.__webglParticleCount),L.data.drawCalls++):j instanceof
|
|
|
THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,g.__webglVertexCount),L.data.drawCalls++)}}function h(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,g,h,j,k,m,q,B,F,p,r=b.count*3;for(p=0;p<r;p+=9)d=b.normalArray,e=d[p],g=d[p+1],h=d[p+2],j=d[p+3],m=d[p+4],B=d[p+5],k=d[p+6],q=d[p+7],F=d[p+8],e=(e+j+k)/3,g=(g+m+q)/3,h=(h+B+F)/3,d[p]=e,d[p+1]=g,d[p+2]=h,d[p+3]=e,d[p+4]=g,d[p+5]=h,d[p+6]=e,d[p+7]=g,d[p+8]=h}f.bufferData(f.ARRAY_BUFFER,b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,
|
|
|
-0,b.count);b.count=0}function j(b){if(Y!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),Y=b.doubleSided;if(pa!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),pa=b.flipSided}function g(b){W!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),W=b)}function k(b,c,d){P!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),P=b);if(b&&(S!=c||fa!=d))f.polygonOffset(c,d),S=c,fa=d}function q(b){ha[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
|
-b.n14);ha[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ha[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ha[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ha[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ha[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=ha[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
|
|
|
-d=0;d<6;d++)if(b=ha[d].x*c.n14+ha[d].y*c.n24+ha[d].z*c.n34+ha[d].w,b<=f)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function p(b){var c,d,f=b.object,e=b.opaque,g=b.transparent;g.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?o(g,d):o(e,d)}function r(b){var c,d,f,e,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(f=g.materials.length;b<f;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<
|
|
|
+0,b.count);b.count=0}function g(b){if(Y!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),Y=b.doubleSided;if(pa!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),pa=b.flipSided}function j(b){W!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),W=b)}function k(b,c,d){P!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),P=b);if(b&&(S!=c||fa!=d))f.polygonOffset(c,d),S=c,fa=d}function q(b){ha[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
|
+b.n14);ha[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ha[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ha[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ha[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ha[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=ha[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
|
|
|
+f=0;f<6;f++)if(b=ha[f].x*c.n14+ha[f].y*c.n24+ha[f].z*c.n34+ha[f].w,b<=d)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function p(b){var c,d,f=b.object,e=b.opaque,g=b.transparent;g.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?o(g,d):o(e,d)}function r(b){var c,d,f,e,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(f=g.materials.length;b<f;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<
|
|
|
d;c++)(e=h.materials[c])&&(e.transparent?o(k,e):o(j,e))}else(e=c)&&(e.transparent?o(k,e):o(j,e))}function v(b,c){return c.z-b.z}function C(b,c){var k,Sa,G,p=0,ga,A,r,o,B=b.lights;ma||(ma=new THREE.Camera(L.shadowCameraFov,c.aspect,L.shadowCameraNear,L.shadowCameraFar));k=0;for(Sa=B.length;k<Sa;k++)if(G=B[k],G instanceof THREE.SpotLight&&G.castShadow){L.shadowMap[p]||(L.shadowMap[p]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
format:THREE.RGBAFormat}));Qa[p]||(Qa[p]=new THREE.Matrix4);ga=L.shadowMap[p];A=Qa[p];ma.position.copy(G.position);ma.target.position.copy(G.target.position);ma.update(void 0,!0);b.update(void 0,!1,ma);A.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);A.multiplySelf(ma.projectionMatrix);A.multiplySelf(ma.matrixWorldInverse);ma.matrixWorldInverse.flattenToArray(Da);ma.projectionMatrix.flattenToArray(Fa);Z.multiply(ma.projectionMatrix,ma.matrixWorldInverse);q(Z);L.initWebGLObjects(b);T(ga);f.clearColor(1,
|
|
|
-1,1,1);L.clear();f.clearColor(xa.r,xa.g,xa.b,Ja);A=b.__webglObjects.length;G=b.__webglObjectsImmediate.length;for(ga=0;ga<A;ga++)r=b.__webglObjects[ga],o=r.object,o.visible&&o.castShadow?!(o instanceof THREE.Mesh)||m(o)?(o.matrixWorld.flattenToArray(o._objectMatrixArray),E(o,ma,!1),r.render=!0):r.render=!1:r.render=!1;g(!0);u(THREE.NormalBlending);for(ga=0;ga<A;ga++)if(r=b.__webglObjects[ga],r.render)o=r.object,buffer=r.buffer,j(o),r=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?
|
|
|
-Ua:Ra,e(ma,B,null,r,buffer,o);for(ga=0;ga<G;ga++)r=b.__webglObjectsImmediate[ga],o=r.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),E(o,ma,!1),j(o),program=d(ma,B,null,Ra,o),o.render(function(b){h(b,program,Ra.shading)}));p++}}function x(b,c){var d,e,g;d=t.attributes;var h=t.uniforms,j=wa/Ea,k,m=[],p=Ea*0.5,q=wa*0.5,F=!0;f.useProgram(t.program);Aa=t.program;W=D=-1;Va||(f.enableVertexAttribArray(t.attributes.position),f.enableVertexAttribArray(t.attributes.uv),
|
|
|
+1,1,1);L.clear();f.clearColor(xa.r,xa.g,xa.b,Ja);A=b.__webglObjects.length;G=b.__webglObjectsImmediate.length;for(ga=0;ga<A;ga++)r=b.__webglObjects[ga],o=r.object,o.visible&&o.castShadow?!(o instanceof THREE.Mesh)||m(o)?(o.matrixWorld.flattenToArray(o._objectMatrixArray),E(o,ma,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);u(THREE.NormalBlending);for(ga=0;ga<A;ga++)if(r=b.__webglObjects[ga],r.render)o=r.object,buffer=r.buffer,g(o),r=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?
|
|
|
+Ua:Ra,e(ma,B,null,r,buffer,o);for(ga=0;ga<G;ga++)r=b.__webglObjectsImmediate[ga],o=r.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),E(o,ma,!1),g(o),program=d(ma,B,null,Ra,o),o.render(function(b){h(b,program,Ra.shading)}));p++}}function x(b,c){var d,e,g;d=t.attributes;var h=t.uniforms,j=wa/Ea,k,m=[],p=Ea*0.5,q=wa*0.5,F=!0;f.useProgram(t.program);Aa=t.program;W=D=-1;Va||(f.enableVertexAttribArray(t.attributes.position),f.enableVertexAttribArray(t.attributes.uv),
|
|
|
Va=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,t.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,t.elementBuffer);f.uniformMatrix4fv(h.projectionMatrix,!1,Fa);f.activeTexture(f.TEXTURE0);f.uniform1i(h.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)g=b.__webglSprites[d],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);d=0;for(e=b.__webglSprites.length;d<e;d++)g=b.__webglSprites[d],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(f.uniform1i(h.useScreenCoordinates,1),f.uniform3f(h.screenPosition,(g.position.x-p)/p,(q-g.position.y)/q,Math.max(0,Math.min(1,g.position.z)))):(f.uniform1i(h.useScreenCoordinates,0),f.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),f.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?wa:1),m[0]=k*j*g.scale.x,m[1]=k*g.scale.y,f.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),f.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),f.uniform2f(h.alignment,g.alignment.x,g.alignment.y),f.uniform1f(h.opacity,g.opacity),f.uniform1f(h.rotation,g.rotation),f.uniform2fv(h.scale,m),g.mergeWith3D&&!F?(f.enable(f.DEPTH_TEST),F=!0):!g.mergeWith3D&&F&&(f.disable(f.DEPTH_TEST),F=!1),u(g.blending),O(g.map,0),f.drawElements(f.TRIANGLES,
|
|
@@ -218,28 +219,29 @@ b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER));f.shaderSource(d,c);f.compileSh
|
|
|
case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;
|
|
|
case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var L=this,f,ua=[],Aa=null,ta=null,va=!0,Y=null,pa=null,D=null,W=null,P=null,S=null,fa=null,K=0,Ba=0,Ea=0,wa=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Matrix4,Fa=new Float32Array(16),Da=new Float32Array(16),Ha=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ia=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ya=b.stencil!==void 0?b.stencil:!0,Za=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,$a=b.antialias!==void 0?b.antialias:!1,xa=b.clearColor!==void 0?new THREE.Color(b.clearColor):
|
|
|
-new THREE.Color(0),Ja=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ia;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 ma,Qa=[],b=THREE.ShaderLib.depthRGBA,Wa=THREE.UniformsUtils.clone(b.uniforms),Ra=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
|
|
|
-vertexShader:b.vertexShader,uniforms:Wa}),Ua=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa,morphTargets:!0});Ra._shadowPass=!0;Ua._shadowPass=!0;try{if(!(f=Ia.getContext("experimental-webgl",{antialias:$a,stencil:Ya,preserveDrawingBuffer:Za})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(ab){console.error(ab)}f.clearColor(0,
|
|
|
-0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(xa.r,xa.g,xa.b,Ja);this.context=f;var Xa=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);i=0;t.vertices[i++]=-1;t.vertices[i++]=-1;t.vertices[i++]=0;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=
|
|
|
--1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=0;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=0;i=t.vertices[i++]=0;t.faces[i++]=0;t.faces[i++]=1;t.faces[i++]=2;t.faces[i++]=0;t.faces[i++]=2;t.faces[i++]=3;t.vertexBuffer=f.createBuffer();t.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,t.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,t.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,t.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,
|
|
|
-t.faces,f.STATIC_DRAW);t.program=f.createProgram();f.attachShader(t.program,U("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(t.program,U("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=f.getAttribLocation(t.program,"position");t.attributes.uv=f.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=f.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=f.getUniformLocation(t.program,"uvScale");t.uniforms.rotation=
|
|
|
-f.getUniformLocation(t.program,"rotation");t.uniforms.scale=f.getUniformLocation(t.program,"scale");t.uniforms.alignment=f.getUniformLocation(t.program,"alignment");t.uniforms.map=f.getUniformLocation(t.program,"map");t.uniforms.opacity=f.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=f.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=f.getUniformLocation(t.program,"affectedByDistance");t.uniforms.screenPosition=f.getUniformLocation(t.program,
|
|
|
-"screenPosition");t.uniforms.modelViewMatrix=f.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=f.getUniformLocation(t.program,"projectionMatrix");var Va=!1;this.setSize=function(b,c){Ia.width=b;Ia.height=c;this.setViewport(0,0,Ia.width,Ia.height)};this.setViewport=function(b,c,d,e){K=b;Ba=c;Ea=d;wa=e;f.viewport(K,Ba,Ea,wa)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=
|
|
|
-function(b){va=b;f.depthMask(b)};this.setClearColorHex=function(b,c){xa.setHex(b);Ja=c;f.clearColor(xa.r,xa.g,xa.b,Ja)};this.setClearColor=function(b,c){xa.copy(b);Ja=c;f.clearColor(xa.r,xa.g,xa.b,Ja)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.getContext=function(){return f};this.initMaterial=function(b,c,d,e){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
|
|
|
-j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,p,q;m=q=k=0;for(p=c.length;m<p;m++)h=c[m],h instanceof THREE.SpotLight&&q++,h instanceof THREE.DirectionalLight&&q++,h instanceof THREE.PointLight&&
|
|
|
-k++;k+q<=4?m=q:(m=Math.ceil(4*q/(k+q)),k=4-m);h={directional:m,point:k};k=q=0;for(m=c.length;k<m;k++)p=c[k],p instanceof THREE.SpotLight&&p.castShadow&&q++;var o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var r;a:{m=b.fragmentShader;p=b.vertexShader;var k=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:h.directional,maxPointLights:h.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},u,e=[];j?e.push(j):(e.push(m),e.push(p));for(u in d)e.push(u),e.push(d[u]);j=e.join();u=0;for(e=ua.length;u<e;u++)if(ua[u].code==j){r=ua[u].program;break a}u=f.createProgram();e=[Xa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,
|
|
|
-"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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");
|
|
|
+new THREE.Color(0),Ja=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ia;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 ma,Qa=[],b=THREE.ShaderLib.depthRGBA,
|
|
|
+Wa=THREE.UniformsUtils.clone(b.uniforms),Ra=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa}),Ua=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa,morphTargets:!0});Ra._shadowPass=!0;Ua._shadowPass=!0;try{if(!(f=Ia.getContext("experimental-webgl",{antialias:$a,stencil:Ya,preserveDrawingBuffer:Za})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+
|
|
|
+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(ab){console.error(ab)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(xa.r,xa.g,xa.b,Ja);this.context=f;var Xa=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);
|
|
|
+t.faces=new Uint16Array(6);i=0;t.vertices[i++]=-1;t.vertices[i++]=-1;t.vertices[i++]=0;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=0;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=0;i=t.vertices[i++]=0;t.faces[i++]=0;t.faces[i++]=1;t.faces[i++]=2;t.faces[i++]=0;t.faces[i++]=2;t.faces[i++]=3;t.vertexBuffer=f.createBuffer();t.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
+t.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,t.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,t.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,t.faces,f.STATIC_DRAW);t.program=f.createProgram();f.attachShader(t.program,U("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(t.program,U("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=f.getAttribLocation(t.program,"position");t.attributes.uv=f.getAttribLocation(t.program,
|
|
|
+"uv");t.uniforms.uvOffset=f.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=f.getUniformLocation(t.program,"uvScale");t.uniforms.rotation=f.getUniformLocation(t.program,"rotation");t.uniforms.scale=f.getUniformLocation(t.program,"scale");t.uniforms.alignment=f.getUniformLocation(t.program,"alignment");t.uniforms.map=f.getUniformLocation(t.program,"map");t.uniforms.opacity=f.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=f.getUniformLocation(t.program,"useScreenCoordinates");
|
|
|
+t.uniforms.affectedByDistance=f.getUniformLocation(t.program,"affectedByDistance");t.uniforms.screenPosition=f.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=f.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=f.getUniformLocation(t.program,"projectionMatrix");var Va=!1;this.setSize=function(b,c){Ia.width=b;Ia.height=c;this.setViewport(0,0,Ia.width,Ia.height)};this.setViewport=function(b,c,d,e){K=b;Ba=c;Ea=d;wa=e;f.viewport(K,Ba,Ea,wa)};this.setScissor=
|
|
|
+function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){va=b;f.depthMask(b)};this.setClearColorHex=function(b,c){xa.setHex(b);Ja=c;f.clearColor(xa.r,xa.g,xa.b,Ja)};this.setClearColor=function(b,c){xa.copy(b);Ja=c;f.clearColor(xa.r,xa.g,xa.b,Ja)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.getContext=function(){return f};this.initMaterial=
|
|
|
+function(b,c,d,e){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=
|
|
|
+k.fragmentShader}var m,p,q;m=q=k=0;for(p=c.length;m<p;m++)h=c[m],h instanceof THREE.SpotLight&&q++,h instanceof THREE.DirectionalLight&&q++,h instanceof THREE.PointLight&&k++;k+q<=_maxLights?m=q:(m=Math.ceil(_maxLights*q/(k+q)),k=_maxLights-m);h={directional:m,point:k};k=q=0;for(m=c.length;k<m;k++)p=c[k],p instanceof THREE.SpotLight&&p.castShadow&&q++;var o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var r;a:{m=b.fragmentShader;p=b.vertexShader;var k=b.uniforms,c=b.attributes,
|
|
|
+d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},u,e=[];j?e.push(j):(e.push(m),e.push(p));
|
|
|
+for(u in d)e.push(u),e.push(d[u]);j=e.join();u=0;for(e=ua.length;u<e;u++)if(ua[u].code==j){r=ua[u].program;break a}u=f.createProgram();e=[Xa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?
|
|
|
+"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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 "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(u,U("fragment",h+m));f.attachShader(u,U("vertex",e+p));f.linkProgram(u);f.getProgramParameter(u,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(u,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");u.uniforms=
|
|
|
{};u.attributes={};var t,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in k)e.push(t);t=e;e=0;for(k=t.length;e<k;e++)m=t[e],u.uniforms[m]=f.getUniformLocation(u,m);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<d.maxMorphTargets;t++)e.push("morphTarget"+t);for(r in c)e.push(r);r=e;t=0;for(c=r.length;t<c;t++)d=
|
|
|
r[t],u.attributes[d]=f.getAttribLocation(u,d);ua.push({program:u,code:j});r=u}b.program=r;r=b.program.attributes;r.position>=0&&f.enableVertexAttribArray(r.position);r.color>=0&&f.enableVertexAttribArray(r.color);r.normal>=0&&f.enableVertexAttribArray(r.normal);r.tangent>=0&&f.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(f.enableVertexAttribArray(r.skinVertexA),f.enableVertexAttribArray(r.skinVertexB),f.enableVertexAttribArray(r.skinIndex),
|
|
|
f.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(g in b.attributes)r[g]!==void 0&&r[g]>=0&&f.enableVertexAttribArray(r[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)t="morphTarget"+g,r[t]>=0&&(f.enableVertexAttribArray(r[t]),b.numSupportedMorphTargets++)};this.render=function(b,c,o,t){var G,J,ga,A,Pa,R,B,F,D=b.lights,Oa=b.fog;this.shadowMapEnabled&&C(b,c);L.data.vertices=0;L.data.faces=0;L.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
!1,c);c.matrixWorldInverse.flattenToArray(Da);c.projectionMatrix.flattenToArray(Fa);Z.multiply(c.projectionMatrix,c.matrixWorldInverse);q(Z);this.initWebGLObjects(b);T(o);(this.autoClear||t)&&this.clear();Pa=b.__webglObjects.length;for(t=0;t<Pa;t++)if(G=b.__webglObjects[t],B=G.object,B.visible)if(!(B instanceof THREE.Mesh)||m(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),r(G),G.render=!0,this.sortObjects)G.object.renderDepth?G.z=G.object.renderDepth:(Ha.copy(B.position),Z.multiplyVector3(Ha),
|
|
|
-G.z=Ha.z)}else G.render=!1;else G.render=!1;this.sortObjects&&b.__webglObjects.sort(v);R=b.__webglObjectsImmediate.length;for(t=0;t<R;t++)G=b.__webglObjectsImmediate[t],B=G.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),p(G));if(b.overrideMaterial){g(b.overrideMaterial.depthTest);u(b.overrideMaterial.blending);for(t=0;t<Pa;t++)if(G=b.__webglObjects[t],G.render)B=G.object,F=G.buffer,j(B),e(c,D,Oa,b.overrideMaterial,F,B);for(t=0;t<R;t++)G=b.__webglObjectsImmediate[t],
|
|
|
-B=G.object,B.visible&&(j(B),J=d(c,D,Oa,b.overrideMaterial,B),B.render(function(c){h(c,J,b.overrideMaterial.shading)}))}else{u(THREE.NormalBlending);for(t=Pa-1;t>=0;t--)if(G=b.__webglObjects[t],G.render){B=G.object;F=G.buffer;ga=G.opaque;j(B);for(G=0;G<ga.count;G++)A=ga.list[G],g(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),e(c,D,Oa,A,F,B)}for(t=0;t<R;t++)if(G=b.__webglObjectsImmediate[t],B=G.object,B.visible){ga=G.opaque;j(B);for(G=0;G<ga.count;G++)A=ga.list[G],g(A.depthTest),
|
|
|
-k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),J=d(c,D,Oa,A,B),B.render(function(b){h(b,J,A.shading)})}for(t=0;t<Pa;t++)if(G=b.__webglObjects[t],G.render){B=G.object;F=G.buffer;ga=G.transparent;j(B);for(G=0;G<ga.count;G++)A=ga.list[G],u(A.blending),g(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),e(c,D,Oa,A,F,B)}for(t=0;t<R;t++)if(G=b.__webglObjectsImmediate[t],B=G.object,B.visible){ga=G.transparent;j(B);for(G=0;G<ga.count;G++)A=ga.list[G],u(A.blending),
|
|
|
-g(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),J=d(c,D,Oa,A,B),B.render(function(b){h(b,J,A.shading)})}}b.__webglSprites.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(f.bindTexture(f.TEXTURE_2D,o.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
|
|
|
+G.z=Ha.z)}else G.render=!1;else G.render=!1;this.sortObjects&&b.__webglObjects.sort(v);R=b.__webglObjectsImmediate.length;for(t=0;t<R;t++)G=b.__webglObjectsImmediate[t],B=G.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),p(G));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);u(b.overrideMaterial.blending);for(t=0;t<Pa;t++)if(G=b.__webglObjects[t],G.render)B=G.object,F=G.buffer,g(B),e(c,D,Oa,b.overrideMaterial,F,B);for(t=0;t<R;t++)G=b.__webglObjectsImmediate[t],
|
|
|
+B=G.object,B.visible&&(g(B),J=d(c,D,Oa,b.overrideMaterial,B),B.render(function(c){h(c,J,b.overrideMaterial.shading)}))}else{u(THREE.NormalBlending);for(t=Pa-1;t>=0;t--)if(G=b.__webglObjects[t],G.render){B=G.object;F=G.buffer;ga=G.opaque;g(B);for(G=0;G<ga.count;G++)A=ga.list[G],j(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),e(c,D,Oa,A,F,B)}for(t=0;t<R;t++)if(G=b.__webglObjectsImmediate[t],B=G.object,B.visible){ga=G.opaque;g(B);for(G=0;G<ga.count;G++)A=ga.list[G],j(A.depthTest),
|
|
|
+k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),J=d(c,D,Oa,A,B),B.render(function(b){h(b,J,A.shading)})}for(t=0;t<Pa;t++)if(G=b.__webglObjects[t],G.render){B=G.object;F=G.buffer;ga=G.transparent;g(B);for(G=0;G<ga.count;G++)A=ga.list[G],u(A.blending),j(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),e(c,D,Oa,A,F,B)}for(t=0;t<R;t++)if(G=b.__webglObjectsImmediate[t],B=G.object,B.visible){ga=G.transparent;g(B);for(G=0;G<ga.count;G++)A=ga.list[G],u(A.blending),
|
|
|
+j(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),J=d(c,D,Oa,A,B),B.render(function(b){h(b,J,A.shading)})}}b.__webglSprites.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(f.bindTexture(f.TEXTURE_2D,o.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
|
|
|
b.__objectsAdded[0],e=b,g=void 0,h=void 0,j=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(g in h=d.geometry,h.geometryGroups==void 0&&sa(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=f.createBuffer();k.__webglNormalBuffer=
|
|
|
f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=
|
|
|
k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}for(var k=j,m=d,r=void 0,q=void 0,o=void 0,u=o=void 0,t=void 0,v=void 0,C=v=p=0,x=o=q=void 0,E=x=q=r=void 0,o=void 0,u=m.geometry,t=u.faces,x=k.faces,r=0,q=x.length;r<q;r++)o=x[r],o=t[o],o instanceof THREE.Face3?(p+=3,v+=1,C+=3):o instanceof THREE.Face4&&(p+=4,v+=2,C+=4);for(var r=k,q=m,I=x=t=void 0,H=void 0,I=void 0,o=[],t=0,x=q.materials.length;t<x;t++)if(I=q.materials[t],I instanceof THREE.MeshFaceMaterial){I=0;for(l=
|