|
@@ -11,20 +11,21 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
|
|
Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,f){this.set(b||0,d||0,e||0,f||1)};
|
|
Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,f){this.set(b||0,d||0,e||0,f||1)};
|
|
THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
|
|
b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
-THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f,g=[];d=0;for(e=b.length;d<e;d++)f=b[d],f instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(f)));g.sort(function(b,d){return b.distance-d.distance});return g},intersectObject:function(b){function d(b,d,e,f){var f=f.clone().subSelf(d),e=e.clone().subSelf(d),g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*
|
|
|
|
-e-d*f)*g;return h>0&&b>0&&h+b<1}var e,f,g,i,h,j,k,o,r,n,v,q=b.geometry,z=q.vertices,C=[];e=0;for(f=q.faces.length;e<f;e++)if(g=q.faces[e],n=this.origin.clone(),v=this.direction.clone(),k=b.matrixWorld,i=k.multiplyVector3(z[g.a].position.clone()),h=k.multiplyVector3(z[g.b].position.clone()),j=k.multiplyVector3(z[g.c].position.clone()),k=g instanceof THREE.Face4?k.multiplyVector3(z[g.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),r=v.dot(o),b.doubleSided||(b.flipSided?
|
|
|
|
-r>0:r<0))if(o=o.dot((new THREE.Vector3).sub(i,n))/r,n=n.addSelf(v.multiplyScalar(o)),g instanceof THREE.Face3)d(n,i,h,j)&&(g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},C.push(g));else if(g instanceof THREE.Face4&&(d(n,i,h,k)||d(n,h,j,k)))g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},C.push(g);return C}};
|
|
|
|
-THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,r,n){j=!1;d=h;e=i;f=r;g=n;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
|
|
|
|
-function(h,i,r,n,v,q){j?(j=!1,d=h<r?h<v?h:v:r<v?r:v,e=i<n?i<q?i:q:n<q?n:q,f=h>r?h>v?h:v:r>v?r:v,g=i>n?i>q?i:q:n>q?n:q):(d=h<r?h<v?h<d?h:d:v<d?v:d:r<v?r<d?r:d:v<d?v:d,e=i<n?i<q?i<e?i:e:q<e?q:e:n<q?n<e?n:e:q<e?q:e,f=h>r?h>v?h>f?h:f:v>f?v:f:r>v?r>f?r:f:v>f?v:f,g=i>n?i>q?i>g?i:g:q>g?q:g:n>q?n>g?n:g:q>g?q:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d<e;d++)f=f.concat(this.intersectObject(b[d]));f.sort(function(b,d){return b.distance-d.distance});return f},intersectObject:function(b){function d(b,d,e){var f;f=e.position.clone().subSelf(b).dot(d);if(f<0)return!1;b=b.clone().addSelf(d.clone().multiplyScalar(f));return e.position.distanceTo(b)}function e(b,d,e,f){var f=f.clone().subSelf(d),e=e.clone().subSelf(d),
|
|
|
|
+g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=[],g=d(this.origin,this.direction,b);g&&g<b.scale.x&&f.push({distance:g,point:b.position,object:b});return f}else if(b instanceof THREE.Mesh){var i,h,j,k,o,n,q,r,v,z,C=b.geometry,D=C.vertices,f=[],g=0;for(i=C.faces.length;g<i;g++)if(h=C.faces[g],v=this.origin.clone(),z=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(D[h.a].position.clone()),
|
|
|
|
+k=n.multiplyVector3(D[h.b].position.clone()),o=n.multiplyVector3(D[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(D[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),r=z.dot(q),b.doubleSided||(b.flipSided?r>0:r<0))if(q=q.dot((new THREE.Vector3).sub(j,v))/r,v=v.addSelf(z.multiplyScalar(q)),h instanceof THREE.Face3)e(v,j,k,o)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},f.push(h));else if(h instanceof THREE.Face4&&(e(v,j,k,
|
|
|
|
+n)||e(v,k,o,n)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},f.push(h);return f}}};
|
|
|
|
+THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,q){j=!1;d=h;e=i;f=n;g=q;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
|
|
|
|
+function(h,i,n,q,r,v){j?(j=!1,d=h<n?h<r?h:r:n<r?n:r,e=i<q?i<v?i:v:q<v?q:v,f=h>n?h>r?h:r:n>r?n:r,g=i>q?i>v?i:v:q>v?q:v):(d=h<n?h<r?h<d?h:d:r<d?r:d:n<r?n<d?n:d:r<d?r:d,e=i<q?i<v?i<e?i:e:v<e?v:e:q<v?q<e?q:e:v<e?v:e,f=h>n?h>r?h>f?h:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,g=i>q?i>v?i>g?i:g:v>g?v:g:q>v?q>g?q:g:v>g?v:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
|
|
-THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,o,r,n,v,q,z,C){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,r||1,n||0,v||0,q||0,z||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,r,n,v,q,z,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=r;this.n34=n;this.n41=v;this.n42=q;this.n43=z;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
|
|
|
|
|
|
+THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,o,n,q,r,v,z,C){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,n||1,q||0,r||0,v||0,z||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,n,q,r,v,z,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=n;this.n34=q;this.n41=r;this.n42=v;this.n43=z;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
|
|
g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
|
|
g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
|
|
f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize();
|
|
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,r=b.n31,n=b.n32,v=b.n33,q=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44,S=d.n11,Q=d.n12,L=d.n13,B=d.n14,x=d.n21,R=d.n22,
|
|
|
|
-J=d.n23,aa=d.n24,E=d.n31,$=d.n32,c=d.n33,ja=d.n34;this.n11=e*S+f*x+g*E;this.n12=e*Q+f*R+g*$;this.n13=e*L+f*J+g*c;this.n14=e*B+f*aa+g*ja+i;this.n21=h*S+j*x+k*E;this.n22=h*Q+j*R+k*$;this.n23=h*L+j*J+k*c;this.n24=h*B+j*aa+k*ja+o;this.n31=r*S+n*x+v*E;this.n32=r*Q+n*R+v*$;this.n33=r*L+n*J+v*c;this.n34=r*B+n*aa+v*ja+q;this.n41=z*S+C*x+D*E;this.n42=z*Q+C*R+D*$;this.n43=z*L+C*J+D*c;this.n44=z*B+C*aa+D*ja+y;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;
|
|
|
|
|
|
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,n=b.n31,q=b.n32,r=b.n33,v=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44,S=d.n11,Q=d.n12,L=d.n13,B=d.n14,x=d.n21,R=d.n22,
|
|
|
|
+J=d.n23,aa=d.n24,E=d.n31,$=d.n32,c=d.n33,ja=d.n34;this.n11=e*S+f*x+g*E;this.n12=e*Q+f*R+g*$;this.n13=e*L+f*J+g*c;this.n14=e*B+f*aa+g*ja+i;this.n21=h*S+j*x+k*E;this.n22=h*Q+j*R+k*$;this.n23=h*L+j*J+k*c;this.n24=h*B+j*aa+k*ja+o;this.n31=n*S+q*x+r*E;this.n32=n*Q+q*R+r*$;this.n33=n*L+q*J+r*c;this.n34=n*B+q*aa+r*ja+v;this.n41=z*S+C*x+D*E;this.n42=z*Q+C*R+D*$;this.n43=z*L+C*J+D*c;this.n44=z*B+C*aa+D*ja+y;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;
|
|
e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
|
|
e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
|
|
-this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,r=this.n33,n=this.n34,v=this.n41,q=this.n42,z=this.n43,C=this.n44;return f*h*o*v-e*j*o*v-f*i*r*v+d*j*r*v+e*i*n*v-d*h*n*v-f*h*k*q+e*j*k*q+f*g*r*q-b*j*r*q-e*g*n*q+b*h*n*q+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*n*z-b*i*n*z-e*i*k*C+d*h*k*C+e*g*o*C-b*h*o*C-d*g*r*C+b*i*r*C},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.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,n=this.n33,q=this.n34,r=this.n41,v=this.n42,z=this.n43,C=this.n44;return f*h*o*r-e*j*o*r-f*i*n*r+d*j*n*r+e*i*q*r-d*h*q*r-f*h*k*v+e*j*k*v+f*g*n*v-b*j*n*v-e*g*q*v+b*h*q*v+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*q*z-b*i*q*z-e*i*k*C+d*h*k*C+e*g*o*C-b*h*o*C-d*g*n*C+b*i*n*C},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.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.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
|
|
this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,
|
|
this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,
|
|
@@ -33,9 +34,9 @@ i+e,k*h-f*j,k*j+f*h,0,k*h+f*j,o*h+e,o*j-f*i,0,k*j-f*h,o*j+f*i,g*j*j+e,0,0,0,0,1)
|
|
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){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this},
|
|
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){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this},
|
|
setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,k=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,k=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
|
|
b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,r=b.n31,n=b.n32,v=b.n33,q=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*q*C-o*v*C+o*n*D-j*q*D-k*n*y+j*v*y;d.n12=i*v*C-g*q*C-i*n*D+f*q*D+g*n*y-f*v*y;d.n13=g*o*C-i*k*C+i*j*D-f*o*D-g*j*y+f*k*y;d.n14=i*k*n-g*o*n-i*j*v+f*o*v+g*j*q-f*k*q;d.n21=o*v*z-k*q*z-o*r*D+h*q*D+k*r*y-h*v*y;d.n22=g*q*z-i*v*z+i*r*D-e*q*D-g*r*y+e*v*y;d.n23=i*k*z-g*o*z-i*h*D+e*o*D+g*h*y-e*k*y;d.n24=
|
|
|
|
-g*o*r-i*k*r+i*h*v-e*o*v-g*h*q+e*k*q;d.n31=j*q*z-o*n*z+o*r*C-h*q*C-j*r*y+h*n*y;d.n32=i*n*z-f*q*z-i*r*C+e*q*C+f*r*y-e*n*y;d.n33=g*o*z-i*j*z+i*h*C-e*o*C-f*h*y+e*j*y;d.n34=i*j*r-f*o*r-i*h*n+e*o*n+f*h*q-e*j*q;d.n41=k*n*z-j*v*z-k*r*C+h*v*C+j*r*D-h*n*D;d.n42=f*v*z-g*n*z+g*r*C-e*v*C-f*r*D+e*n*D;d.n43=g*j*z-f*k*z-g*h*C+e*k*C+f*h*D-e*j*D;d.n44=f*k*r-g*j*r+g*h*n-e*k*n-f*h*v+e*j*v;d.multiplyScalar(1/b.determinant());return d};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*r;e[8]=b*n;return d};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,n=b.n31,q=b.n32,r=b.n33,v=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*v*C-o*r*C+o*q*D-j*v*D-k*q*y+j*r*y;d.n12=i*r*C-g*v*C-i*q*D+f*v*D+g*q*y-f*r*y;d.n13=g*o*C-i*k*C+i*j*D-f*o*D-g*j*y+f*k*y;d.n14=i*k*q-g*o*q-i*j*r+f*o*r+g*j*v-f*k*v;d.n21=o*r*z-k*v*z-o*n*D+h*v*D+k*n*y-h*r*y;d.n22=g*v*z-i*r*z+i*n*D-e*v*D-g*n*y+e*r*y;d.n23=i*k*z-g*o*z-i*h*D+e*o*D+g*h*y-e*k*y;d.n24=
|
|
|
|
+g*o*n-i*k*n+i*h*r-e*o*r-g*h*v+e*k*v;d.n31=j*v*z-o*q*z+o*n*C-h*v*C-j*n*y+h*q*y;d.n32=i*q*z-f*v*z-i*n*C+e*v*C+f*n*y-e*q*y;d.n33=g*o*z-i*j*z+i*h*C-e*o*C-f*h*y+e*j*y;d.n34=i*j*n-f*o*n-i*h*q+e*o*q+f*h*v-e*j*v;d.n41=k*q*z-j*r*z-k*n*C+h*r*C+j*n*D-h*q*D;d.n42=f*r*z-g*q*z+g*n*C-e*r*C-f*n*D+e*q*D;d.n43=g*j*z-f*k*z-g*h*C+e*k*C+f*h*D-e*j*D;d.n44=f*k*n-g*j*n+g*h*q-e*k*q-f*h*r+e*j*r;d.multiplyScalar(1/b.determinant());return d};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*n;e[8]=b*q;return d};
|
|
THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
|
|
THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
|
|
THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,k,o;h=new THREE.Matrix4;j=d-b;k=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+g)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,k,o;h=new THREE.Matrix4;j=d-b;k=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+g)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
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.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;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;
|
|
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.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;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;
|
|
@@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
|
|
this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)};
|
|
this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)};
|
|
THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
|
|
THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
|
|
f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
|
|
f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
|
|
-multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,k=this.w,o=k*e+h*g-j*f,r=
|
|
|
|
-k*f+j*e-i*g,n=k*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=o*k+e*-i+r*-j-n*-h;d.y=r*k+e*-h+n*-i-o*-j;d.z=n*k+e*-j+o*-h-r*-i;return d}};
|
|
|
|
|
|
+multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,k=this.w,o=k*e+h*g-j*f,n=
|
|
|
|
+k*f+j*e-i*g,q=k*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=o*k+e*-i+n*-j-q*-h;d.y=n*k+e*-h+q*-i-o*-j;d.z=q*k+e*-j+o*-h-n*-i;return d}};
|
|
THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
|
|
THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
|
|
THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
|
|
@@ -56,15 +57,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.f
|
|
e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()||
|
|
e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()||
|
|
j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,g,i,J){j=b.vertices[d].position;k=b.vertices[e].position;o=b.vertices[f].position;r=h[g];n=h[i];v=h[J];q=k.x-j.x;z=o.x-j.x;C=k.y-j.y;D=o.y-j.y;y=k.z-j.z;S=o.z-j.z;Q=n.u-r.u;L=v.u-r.u;B=n.v-r.v;x=v.v-r.v;R=1/(Q*x-L*B);$.set((x*q-B*z)*
|
|
|
|
-R,(x*C-B*D)*R,(x*y-B*S)*R);c.set((Q*z-L*q)*R,(Q*D-L*C)*R,(Q*S-L*y)*R);aa[d].addSelf($);aa[e].addSelf($);aa[f].addSelf($);E[d].addSelf(c);E[e].addSelf(c);E[f].addSelf(c)}var d,e,f,g,i,h,j,k,o,r,n,v,q,z,C,D,y,S,Q,L,B,x,R,J,aa=[],E=[],$=new THREE.Vector3,c=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)aa[d]=new THREE.Vector3,E[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],i instanceof
|
|
|
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,g,i,J){j=b.vertices[d].position;k=b.vertices[e].position;o=b.vertices[f].position;n=h[g];q=h[i];r=h[J];v=k.x-j.x;z=o.x-j.x;C=k.y-j.y;D=o.y-j.y;y=k.z-j.z;S=o.z-j.z;Q=q.u-n.u;L=r.u-n.u;B=q.v-n.v;x=r.v-n.v;R=1/(Q*x-L*B);$.set((x*v-B*z)*
|
|
|
|
+R,(x*C-B*D)*R,(x*y-B*S)*R);c.set((Q*z-L*v)*R,(Q*D-L*C)*R,(Q*S-L*y)*R);aa[d].addSelf($);aa[e].addSelf($);aa[f].addSelf($);E[d].addSelf(c);E[e].addSelf(c);E[f].addSelf(c)}var d,e,f,g,i,h,j,k,o,n,q,r,v,z,C,D,y,S,Q,L,B,x,R,J,aa=[],E=[],$=new THREE.Vector3,c=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)aa[d]=new THREE.Vector3,E[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],i instanceof
|
|
THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ra=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)Aa.copy(i.vertexNormals[f]),g=i[ra[f]],J=aa[g],ja.copy(J),ja.subSelf(Aa.multiplyScalar(Aa.dot(J))).normalize(),oa.cross(i.vertexNormals[f],J),g=oa.dot(E[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ra=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)Aa.copy(i.vertexNormals[f]),g=i[ra[f]],J=aa[g],ja.copy(J),ja.subSelf(Aa.multiplyScalar(Aa.dot(J))).normalize(),oa.cross(i.vertexNormals[f],J),g=oa.dot(E[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,
|
|
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=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,
|
|
d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=
|
|
d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=
|
|
this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
|
|
this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
|
|
-THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,k,o,r,n,v;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];r=this.points[e[1]];
|
|
|
|
-n=this.points[e[2]];v=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,r.x,n.x,v.x,h,j,k);f.y=d(o.y,r.y,n.y,v.y,h,j,k);f.z=d(o.z,r.z,n.z,v.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
|
|
|
|
|
|
+THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,k,o,n,q,r;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];n=this.points[e[1]];
|
|
|
|
+q=this.points[e[2]];r=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,n.x,q.x,r.x,h,j,k);f.y=d(o.y,n.y,q.y,r.y,h,j,k);f.z=d(o.z,n.z,q.z,r.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
|
|
j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=o.chunks[d]-o.chunks[d-1];i=Math.ceil(b*e/o.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(k.copy(position).clone());
|
|
j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=o.chunks[d]-o.chunks[d-1];i=Math.ceil(b*e/o.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(k.copy(position).clone());
|
|
j.push(k.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
j.push(k.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
@@ -118,13 +119,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
|
|
THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,k,o,r,n,v,q,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var C=z.egdes=this.geometry.edges,D=z.edgeFaces=[];g=0;var y=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
|
-e.normal;b=0;for(d=C.length;b<d;b++)j=C[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(k="a",r=y[g]+0):e.b===h?(k="b",r=y[g]+1):e.c===h?(k="c",r=y[g]+2):e.d===h&&(k="d",r=y[g]+3),e.a===j?(k+="a",n=y[g]+0):e.b===j?(k+="b",n=y[g]+1):e.c===j?(k+="c",n=y[g]+2):e.d===j&&(k+="d",n=y[g]+3),f.a===h?(o="a",v=y[i]+0):f.b===h?(o="b",v=y[i]+1):f.c===h?(o="c",v=y[i]+2):f.d===h&&(o="d",v=y[i]+3),f.a===j?(o+="a",q=y[i]+0):f.b===j?(o+="b",q=y[i]+
|
|
|
|
-1):f.c===j?(o+="c",q=y[i]+2):f.d===j&&(o+="d",q=y[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?r>n&&(e=r,r=n,n=e):r<n&&(e=r,r=n,n=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?v>q&&(e=v,v=q,q=e):v<q&&(e=v,v=q,q=e),e=new THREE.Face4(r,n,v,q),e.normal.set(1,0,0),D.push(e);this.geometry=z}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
|
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,k,o,r,n=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;h=g[k];h instanceof THREE.Face4?(o=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(o=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
|
|
|
|
-for(j=0;j<o;j++)r=b[h[n[j]]],d.push(new THREE.Vertex(r.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
|
|
|
|
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,k,o,r,n,v,q,z,C,D=0,y=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(z=0;z<f;z++){i=d[y[z]];j=b[i];for(C=0;C<g;C++)if(h=e[y[C]],k=b[h],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(D++,D===1&&(o=j,r=k,n=i,v=h,q=y[z]),D===2))return q+=y[z],q==="ad"||q==="ac"?{faces:[d,e],vertices:[o,r,k,j],indices:[n,v,
|
|
|
|
-h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[o,j,k,r],indices:[n,i,h,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,k,o,n,q,r,v,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var C=z.egdes=this.geometry.edges,D=z.edgeFaces=[];g=0;var y=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
|
|
|
|
+e.normal;b=0;for(d=C.length;b<d;b++)j=C[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(k="a",n=y[g]+0):e.b===h?(k="b",n=y[g]+1):e.c===h?(k="c",n=y[g]+2):e.d===h&&(k="d",n=y[g]+3),e.a===j?(k+="a",q=y[g]+0):e.b===j?(k+="b",q=y[g]+1):e.c===j?(k+="c",q=y[g]+2):e.d===j&&(k+="d",q=y[g]+3),f.a===h?(o="a",r=y[i]+0):f.b===h?(o="b",r=y[i]+1):f.c===h?(o="c",r=y[i]+2):f.d===h&&(o="d",r=y[i]+3),f.a===j?(o+="a",v=y[i]+0):f.b===j?(o+="b",v=y[i]+
|
|
|
|
+1):f.c===j?(o+="c",v=y[i]+2):f.d===j&&(o+="d",v=y[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?n>q&&(e=n,n=q,q=e):n<q&&(e=n,n=q,q=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?r>v&&(e=r,r=v,v=e):r<v&&(e=r,r=v,v=e),e=new THREE.Face4(n,q,r,v),e.normal.set(1,0,0),D.push(e);this.geometry=z}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
|
|
|
|
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,k,o,n,q=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;h=g[k];h instanceof THREE.Face4?(o=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(o=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
|
|
|
|
+for(j=0;j<o;j++)n=b[h[q[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
|
|
|
|
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,k,o,n,q,r,v,z,C,D=0,y=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(z=0;z<f;z++){i=d[y[z]];j=b[i];for(C=0;C<g;C++)if(h=e[y[C]],k=b[h],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(D++,D===1&&(o=j,n=k,q=i,r=h,v=y[z]),D===2))return v+=y[z],v==="ad"||v==="ac"?{faces:[d,e],vertices:[o,n,k,j],indices:[q,r,
|
|
|
|
+h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[o,j,k,n],indices:[q,i,h,r],vertexTypes:[1,1,2,2],extrudable:!0}}};
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=
|
|
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=
|
|
b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
|
|
b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
|
|
THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
|
|
@@ -133,14 +134,14 @@ 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.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Sound?(d=this.sounds.indexOf(b),d!==-1&&this.sounds.splice(d,1)):b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Sound?(d=this.sounds.indexOf(b),d!==-1&&this.sounds.splice(d,1)):b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
|
|
-THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,c){return c.z-b.z}function e(b,c){var d=0,e=1,f=b.z+b.w,g=c.z+c.w,h=-b.z+b.w,i=-c.z+c.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?d=Math.max(d,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,g,i=[],h,j,k=[],o,r,n=[],v,q=[],z,C,D=[],y,S,Q=[],L=new THREE.Vector4,B=new THREE.Vector4,
|
|
|
|
|
|
+THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,c){return c.z-b.z}function e(b,c){var d=0,e=1,f=b.z+b.w,g=c.z+c.w,h=-b.z+b.w,i=-c.z+c.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?d=Math.max(d,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,g,i=[],h,j,k=[],o,n,q=[],r,v=[],z,C,D=[],y,S,Q=[],L=new THREE.Vector4,B=new THREE.Vector4,
|
|
x=new THREE.Matrix4,R=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){x.multiply(c.projectionMatrix,c.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,c){x.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,c,e){var c=[],h,j,k;g=0;
|
|
x=new THREE.Matrix4,R=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){x.multiply(c.projectionMatrix,c.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,c){x.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,c,e){var c=[],h,j,k;g=0;
|
|
-j=b.objects;b=0;for(h=j.length;b<h;b++){k=j[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh){a:{o=void 0;for(var n=k.matrixWorld,r=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(o=J[v].x*n.n14+J[v].y*n.n24+J[v].z*n.n34+J[v].w,o<=r){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,L.copy(k.position),x.multiplyVector3(L),f.object=k,f.z=L.z,c.push(f)}e&&c.sort(d);return c};this.projectScene=function(f,c,g){var i=
|
|
|
|
-[],L=c.near,ra=c.far,pa,ka,M,ha,F,Z,O,H,N,P,fa,la,qa,Ba,ia,sa,ta;S=C=v=r=0;c.matrixAutoUpdate&&c.update(void 0,!0);f.update(void 0,!1,c);x.multiply(c.projectionMatrix,c.matrixWorldInverse);J[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);J[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);J[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);J[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);J[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);J[5].set(x.n41+x.n31,x.n42+
|
|
|
|
|
|
+j=b.objects;b=0;for(h=j.length;b<h;b++){k=j[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh){a:{o=void 0;for(var n=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),r=0;r<6;r++)if(o=J[r].x*n.n14+J[r].y*n.n24+J[r].z*n.n34+J[r].w,o<=q){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,L.copy(k.position),x.multiplyVector3(L),f.object=k,f.z=L.z,c.push(f)}e&&c.sort(d);return c};this.projectScene=function(f,c,g){var i=
|
|
|
|
+[],L=c.near,ra=c.far,pa,ka,M,ha,F,Z,O,H,N,P,fa,la,qa,Ba,ia,sa,ta;S=C=r=n=0;c.matrixAutoUpdate&&c.update(void 0,!0);f.update(void 0,!1,c);x.multiply(c.projectionMatrix,c.matrixWorldInverse);J[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);J[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);J[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);J[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);J[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);J[5].set(x.n41+x.n31,x.n42+
|
|
x.n32,x.n43+x.n33,x.n44+x.n34);for(pa=0;pa<6;pa++)N=J[pa],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,c,!0);f=0;for(pa=N.length;f<pa;f++)if(P=N[f].object,P.visible)if(fa=P.matrixWorld,la=P.matrixRotationWorld,qa=P.materials,Ba=P.overdraw,j=0,P instanceof THREE.Mesh){ia=P.geometry;ha=ia.vertices;sa=ia.faces;ia=ia.faceVertexUvs;ka=0;for(M=ha.length;ka<M;ka++)h=b(),h.positionWorld.copy(ha[ka].position),fa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
x.n32,x.n43+x.n33,x.n44+x.n34);for(pa=0;pa<6;pa++)N=J[pa],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,c,!0);f=0;for(pa=N.length;f<pa;f++)if(P=N[f].object,P.visible)if(fa=P.matrixWorld,la=P.matrixRotationWorld,qa=P.materials,Ba=P.overdraw,j=0,P instanceof THREE.Mesh){ia=P.geometry;ha=ia.vertices;sa=ia.faces;ia=ia.faceVertexUvs;ka=0;for(M=ha.length;ka<M;ka++)h=b(),h.positionWorld.copy(ha[ka].position),fa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
-x.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>L&&h.positionScreen.z<ra;ha=0;for(ka=sa.length;ha<ka;ha++){M=sa[ha];if(M instanceof THREE.Face3)if(F=k[M.a],Z=k[M.b],O=k[M.c],F.visible&&Z.visible&&O.visible&&(P.doubleSided||P.flipSided!=(O.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(O.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0))H=n[r]=
|
|
|
|
-n[r]||new THREE.RenderableFace3,r++,o=H,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O);else continue;else if(M instanceof THREE.Face4)if(F=k[M.a],Z=k[M.b],O=k[M.c],H=k[M.d],F.visible&&Z.visible&&O.visible&&H.visible&&(P.doubleSided||P.flipSided!=((H.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(H.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0||(Z.positionScreen.x-O.positionScreen.x)*(H.positionScreen.y-O.positionScreen.y)-(Z.positionScreen.y-
|
|
|
|
-O.positionScreen.y)*(H.positionScreen.x-O.positionScreen.x)<0)))ta=q[v]=q[v]||new THREE.RenderableFace4,v++,o=ta,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O),o.v4.copy(H);else continue;o.normalWorld.copy(M.normal);la.multiplyVector3(o.normalWorld);o.centroidWorld.copy(M.centroid);fa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);x.multiplyVector3(o.centroidScreen);O=M.vertexNormals;F=0;for(Z=O.length;F<Z;F++)H=o.vertexNormalsWorld[F],H.copy(O[F]),la.multiplyVector3(H);F=0;for(Z=
|
|
|
|
|
|
+x.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>L&&h.positionScreen.z<ra;ha=0;for(ka=sa.length;ha<ka;ha++){M=sa[ha];if(M instanceof THREE.Face3)if(F=k[M.a],Z=k[M.b],O=k[M.c],F.visible&&Z.visible&&O.visible&&(P.doubleSided||P.flipSided!=(O.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(O.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0))H=q[n]=
|
|
|
|
+q[n]||new THREE.RenderableFace3,n++,o=H,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O);else continue;else if(M instanceof THREE.Face4)if(F=k[M.a],Z=k[M.b],O=k[M.c],H=k[M.d],F.visible&&Z.visible&&O.visible&&H.visible&&(P.doubleSided||P.flipSided!=((H.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(H.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0||(Z.positionScreen.x-O.positionScreen.x)*(H.positionScreen.y-O.positionScreen.y)-(Z.positionScreen.y-
|
|
|
|
+O.positionScreen.y)*(H.positionScreen.x-O.positionScreen.x)<0)))ta=v[r]=v[r]||new THREE.RenderableFace4,r++,o=ta,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O),o.v4.copy(H);else continue;o.normalWorld.copy(M.normal);la.multiplyVector3(o.normalWorld);o.centroidWorld.copy(M.centroid);fa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);x.multiplyVector3(o.centroidScreen);O=M.vertexNormals;F=0;for(Z=O.length;F<Z;F++)H=o.vertexNormalsWorld[F],H.copy(O[F]),la.multiplyVector3(H);F=0;for(Z=
|
|
ia.length;F<Z;F++)if(ta=ia[F][ha]){O=0;for(H=ta.length;O<H;O++)o.uvs[F][O]=ta[O]}o.meshMaterials=qa;o.faceMaterials=M.materials;o.overdraw=Ba;o.z=o.centroidScreen.z;i.push(o)}}else if(P instanceof THREE.Line){R.multiply(x,fa);ha=P.geometry.vertices;F=b();F.positionScreen.copy(ha[0].position);R.multiplyVector4(F.positionScreen);ka=1;for(M=ha.length;ka<M;ka++)if(F=b(),F.positionScreen.copy(ha[ka].position),R.multiplyVector4(F.positionScreen),Z=k[j-2],aa.copy(F.positionScreen),E.copy(Z.positionScreen),
|
|
ia.length;F<Z;F++)if(ta=ia[F][ha]){O=0;for(H=ta.length;O<H;O++)o.uvs[F][O]=ta[O]}o.meshMaterials=qa;o.faceMaterials=M.materials;o.overdraw=Ba;o.z=o.centroidScreen.z;i.push(o)}}else if(P instanceof THREE.Line){R.multiply(x,fa);ha=P.geometry.vertices;F=b();F.positionScreen.copy(ha[0].position);R.multiplyVector4(F.positionScreen);ka=1;for(M=ha.length;ka<M;ka++)if(F=b(),F.positionScreen.copy(ha[ka].position),R.multiplyVector4(F.positionScreen),Z=k[j-2],aa.copy(F.positionScreen),E.copy(Z.positionScreen),
|
|
e(aa,E))aa.multiplyScalar(1/aa.w),E.multiplyScalar(1/E.w),fa=D[C]=D[C]||new THREE.RenderableLine,C++,z=fa,z.v1.positionScreen.copy(aa),z.v2.positionScreen.copy(E),z.z=Math.max(aa.z,E.z),z.materials=P.materials,i.push(z)}else if(P instanceof THREE.Particle&&(B.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),x.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))fa=Q[S]=Q[S]||new THREE.RenderableParticle,S++,y=fa,y.x=B.x/B.w,y.y=B.y/B.w,y.z=B.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x-
|
|
e(aa,E))aa.multiplyScalar(1/aa.w),E.multiplyScalar(1/E.w),fa=D[C]=D[C]||new THREE.RenderableLine,C++,z=fa,z.v1.positionScreen.copy(aa),z.v2.positionScreen.copy(E),z.z=Math.max(aa.z,E.z),z.materials=P.materials,i.push(z)}else if(P instanceof THREE.Particle&&(B.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),x.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))fa=Q[S]=Q[S]||new THREE.RenderableParticle,S++,y=fa,y.x=B.x/B.w,y.y=B.y/B.w,y.z=B.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x-
|
|
(B.x+c.projectionMatrix.n11)/(B.w+c.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(B.y+c.projectionMatrix.n22)/(B.w+c.projectionMatrix.n24)),y.materials=P.materials,i.push(y);g&&i.sort(d);return i}};
|
|
(B.x+c.projectionMatrix.n11)/(B.w+c.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(B.y+c.projectionMatrix.n22)/(B.w+c.projectionMatrix.n24)),y.materials=P.materials,i.push(y);g&&i.sort(d);return i}};
|
|
@@ -177,40 +178,40 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,G=b.__colorArray,ua=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,qa.copy(g),P.multiplyVector3(qa),ua[f]=[qa.z,f];ua.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[ua[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=k[ua[f][1]],G[h]=color.r,G[h+1]=
|
|
THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,G=b.__colorArray,ua=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,qa.copy(g),P.multiplyVector3(qa),ua[f]=[qa.z,f];ua.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[ua[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=k[ua[f][1]],G[h]=color.r,G[h+1]=
|
|
-color.g,G[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(r)for(f=0;f<o;f++)color=k[f],h=f*3,G[h]=color.r,G[h+1]=color.g,G[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,G,d)}function e(b,d,e,f,g){f.program||$.initMaterial(f,d,e,g);var h=f.program,i=h.uniforms,j=f.uniforms;h!=oa&&(c.useProgram(h),
|
|
|
|
-oa=h);c.uniformMatrix4fv(i.projectionMatrix,!1,fa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
|
-f.lights){var k,o,p=0,G=0,ua=0,n,r,v,q,t=Ba,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=o=q=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,r=o.position,v=o.intensity,q=o.distance,o instanceof THREE.AmbientLight)p+=n.r,G+=n.g,ua+=n.b;else if(o instanceof THREE.DirectionalLight)q=u*3,z[q]=n.r*v,z[q+1]=n.g*v,z[q+2]=n.b*v,y[q]=r.x,y[q+1]=r.y,y[q+2]=r.z,u+=1;else if(o instanceof THREE.PointLight)o=s*3,C[o]=n.r*v,C[o+1]=n.g*v,C[o+2]=
|
|
|
|
-n.b*v,I[o]=r.x,I[o+1]=r.y,I[o+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=p;t.ambient[1]=G;t.ambient[2]=ua;e=Ba;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
|
|
|
|
|
|
+color.g,G[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(r)for(f=0;f<o;f++)color=k[f],h=f*3,G[h]=color.r,G[h+1]=color.g,G[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,G,d)}function e(b,d,e,f,h){f.program||$.initMaterial(f,d,e,h);var g=f.program,i=g.uniforms,j=f.uniforms;g!=oa&&(c.useProgram(g),
|
|
|
|
+oa=g);c.uniformMatrix4fv(i.projectionMatrix,!1,fa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
|
+f.lights){var k,o,p=0,G=0,ua=0,n,r,q,v,t=Ba,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=o=v=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,r=o.position,q=o.intensity,v=o.distance,o instanceof THREE.AmbientLight)p+=n.r,G+=n.g,ua+=n.b;else if(o instanceof THREE.DirectionalLight)v=u*3,z[v]=n.r*q,z[v+1]=n.g*q,z[v+2]=n.b*q,y[v]=r.x,y[v+1]=r.y,y[v+2]=r.z,u+=1;else if(o instanceof THREE.PointLight)o=s*3,C[o]=n.r*q,C[o+1]=n.g*q,C[o+2]=
|
|
|
|
+n.b*q,I[o]=r.x,I[o+1]=r.y,I[o+2]=r.z,K[s]=v,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=p;t.ambient[1]=G;t.ambient[2]=ua;e=Ba;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
|
|
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,j.map.texture=f.map,j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=
|
|
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,j.map.texture=f.map,j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=
|
|
f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=
|
|
f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=
|
|
-f.opacity;for(var A in j)if(G=h.uniforms[A])if(k=j[A],p=k.type,e=k.value,p=="i")c.uniform1i(G,e);else if(p=="f")c.uniform1f(G,e);else if(p=="fv1")c.uniform1fv(G,e);else if(p=="fv")c.uniform3fv(G,e);else if(p=="v2")c.uniform2f(G,e.x,e.y);else if(p=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(G,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
|
|
|
|
|
|
+f.opacity;for(var A in j)if(G=g.uniforms[A])if(k=j[A],p=k.type,e=k.value,p=="i")c.uniform1i(G,e);else if(p=="f")c.uniform1f(G,e);else if(p=="fv1")c.uniform1fv(G,e);else if(p=="fv")c.uniform3fv(G,e);else if(p=="v2")c.uniform2f(G,e.x,e.y);else if(p=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(G,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
|
|
k.image.__webglTextureCube);for(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}B(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,
|
|
k.image.__webglTextureCube);for(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}B(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,
|
|
-k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray);(f instanceof
|
|
|
|
-THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,
|
|
|
|
-!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
|
-h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=o[k[f]],f++;else{var k=[],n=-1,p=0,o=i.morphTargetInfluences,G,ua=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=
|
|
|
|
-!0);f<g.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&o[G]>n&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.attributes)for(j in g.attributes)b[j]!==void 0&&b[j]>=0&&(d=g.attributes[j],d.buffer&&(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
|
-d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0)));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.vertexAttribPointer(b.uv,
|
|
|
|
-2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),
|
|
|
|
-c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=h.__webglFaceCount,$.data.faces+=h.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),
|
|
|
|
|
|
+k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof
|
|
|
|
+THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,
|
|
|
|
+!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
|
+g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=o[k[f]],f++;else{var k=[],n=-1,p=0,o=i.morphTargetInfluences,G,ua=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=
|
|
|
|
+!0);f<h.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&o[G]>n&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.attributes)for(j in h.attributes)b[j]!==void 0&&b[j]>=0&&(d=h.attributes[j],d.buffer&&(c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
|
+d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0)));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv,
|
|
|
|
+2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),
|
|
|
|
+c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=g.__webglFaceCount,$.data.faces+=g.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),
|
|
$.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,
|
|
$.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,
|
|
g,h,i,j,k,o,p,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+o)/3,h=(h+p+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(pa!=b.doubleSided)b.doubleSided?
|
|
g,h,i,j,k,o,p,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+o)/3,h=(h+p+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(pa!=b.doubleSided)b.doubleSided?
|
|
c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),pa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function h(b){ha!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),ha=b)}function j(b){N[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);N[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);N[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);N[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);N[4].set(b.n41-b.n31,b.n42-b.n32,
|
|
c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),pa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function h(b){ha!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),ha=b)}function j(b){N[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);N[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);N[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);N[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);N[4].set(b.n41-b.n31,b.n42-b.n32,
|
|
-b.n43-b.n33,b.n44-b.n34);N[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=N[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function k(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=N[e].x*c.n14+N[e].y*c.n24+N[e].z*c.n34+N[e].w,b<=d)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function r(b){var c,d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c=
|
|
|
|
-e.materials.length;b<c;b++)d=e.materials[b],d.transparent?o(g,d):o(f,d)}function n(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?o(j,f):o(i,f))}else(f=c)&&(f.transparent?o(j,f):o(i,f))}function v(b,c){return c.z-b.z}function q(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);
|
|
|
|
|
|
+b.n43-b.n33,b.n44-b.n34);N[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=N[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function k(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=N[e].x*c.n14+N[e].y*c.n24+N[e].z*c.n34+N[e].w,b<=d)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function n(b){var c,d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c=
|
|
|
|
+e.materials.length;b<c;b++)d=e.materials[b],d.transparent?o(g,d):o(f,d)}function q(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?o(j,f):o(i,f))}else(f=c)&&(f.transparent?o(j,f):o(i,f))}function r(b,c){return c.z-b.z}function v(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);
|
|
c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,i=b.__webglShadowVolumes[p].buffer,
|
|
c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,i=b.__webglShadowVolumes[p].buffer,
|
|
j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),
|
|
j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),
|
|
c.vertexAttribPointer(o.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);M=-1;oa=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation,
|
|
c.vertexAttribPointer(o.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);M=-1;oa=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation,
|
|
!1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;var h=_sprite.uniforms,
|
|
!1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;var h=_sprite.uniforms,
|
|
i=H/O,j,k=[],o=O*0.5,p=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
|
|
i=H/O,j,k=[],o=O*0.5,p=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
|
|
-!1,fa);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,
|
|
|
|
|
|
+!1,fa);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,
|
|
(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:H),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),
|
|
(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:H),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),
|
|
-c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,o=H/O,p=O*0.5,n=H*0.5,r=16/H,v=[r*o,r],q=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Ea||
|
|
|
|
|
|
+c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,o=H/O,p=O*0.5,n=H*0.5,r=16/H,q=[r*o,r],v=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Ea||
|
|
(c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
|
|
(c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
|
|
-b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,z[0]=q[0]*p+p,z[1]=q[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
|
|
|
|
-c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=q[0];e.positionScreen.y=q[1];e.positionScreen.z=q[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
|
|
|
|
-i;h++)if(j=e.lensFlares[h],j.opacity>0.001&&j.scale>0.001)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*o,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
|
|
|
+b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),v[0]=k.x,v[1]=k.y,v[2]=k.z,z[0]=v[0]*p+p,z[1]=v[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,q);c.uniform3fv(y.screenPosition,v);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
|
|
|
|
+c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=v[0];e.positionScreen.y=v[1];e.positionScreen.z=v[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
|
|
|
|
+i;h++)if(j=e.lensFlares[h],j.opacity>0.001&&j.scale>0.001)v[0]=j.x,v[1]=j.y,v[2]=j.z,r=j.size*j.scale/H,q[0]=r*o,q[1]=r,c.uniform3fv(y.screenPosition,v),c.uniform2fv(y.scale,q),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,o=void 0,n=void 0,p=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0,
|
|
function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,o=void 0,n=void 0,p=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0,
|
|
x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=p=q=p=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=p=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals,
|
|
x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=p=q=p=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=p=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals,
|
|
z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=
|
|
z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=
|
|
@@ -272,10 +273,10 @@ r=k;j=0;for(k=r.length;j<k;j++)o=r[j],q.uniforms[o]=c.getUniformLocation(q,o);k=
|
|
n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=
|
|
n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=
|
|
0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),
|
|
0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),
|
|
b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,o,u){var t,y,x,B,E,F,p,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&&
|
|
b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,o,u){var t,y,x,B,E,F,p,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&&
|
|
-d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(o);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],p=t.object,p.visible)if(!(p instanceof THREE.Mesh)||k(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),n(t),t.render=!0,this.sortObjects)qa.copy(p.position),P.multiplyVector3(qa),
|
|
|
|
-t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(v);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],p=t.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),r(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],
|
|
|
|
|
|
+d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(o);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],p=t.object,p.visible)if(!(p instanceof THREE.Mesh)||k(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),q(t),t.render=!0,this.sortObjects)qa.copy(p.position),P.multiplyVector3(qa),
|
|
|
|
+t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(r);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],p=t.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),n(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],
|
|
p=t.object,p.visible){x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],p=t.object,p.visible){x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,
|
|
p=t.object,p.visible){x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],p=t.object,p.visible){x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,
|
|
-y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,o.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null));c.finish()};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=
|
|
|
|
|
|
+y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&C(b,d);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,o.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null));c.finish()};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=
|
|
[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=
|
|
[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=
|
|
c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=
|
|
c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=
|
|
[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,p=void 0,o=void 0,q=o=void 0,r=void 0,t=void 0,v=t=k=0,u=o=p=void 0,p=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,p=r.length;n<p;n++)o=r[n],o=u[o],o instanceof THREE.Face3?(k+=3,t+=1,v+=3):o instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,p=j,x=r=u=void 0,z=void 0,x=void 0,o=[],u=0,r=p.materials.length;u<r;u++)if(x=p.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=
|
|
[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,p=void 0,o=void 0,q=o=void 0,r=void 0,t=void 0,v=t=k=0,u=o=p=void 0,p=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,p=r.length;n<p;n++)o=r[n],o=u[o],o instanceof THREE.Face3?(k+=3,t+=1,v+=3):o instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,p=j,x=r=u=void 0,z=void 0,x=void 0,o=[],u=0,r=p.materials.length;u<r;u++)if(x=p.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=
|