|
@@ -19,39 +19,39 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
|
|
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
|
|
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,n.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);n.sub(a,b);w=o.dot(o);u=o.dot(q);v=o.dot(n);y=q.dot(q);D=q.dot(n);C=1/(w*y-u*u);B=(y*v-u*D)*C;E=(w*D-u*v)*C;return 0<=B&&0<=E&&1>B+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
|
|
|
|
-c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){for(var b,n=[],o=0,q=a.children.length;o<q;o++)Array.prototype.push.apply(n,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
|
|
|
|
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return n;var r,s,j=a.geometry,t=j.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);
|
|
|
|
-for(o=0,q=j.faces.length;o<q;o++)if(b=j.faces[o],i.copy(this.origin),k.copy(this.direction),u=a.matrixWorld,l=u.multiplyVector3(l.copy(b.centroid)).subSelf(i),p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),r=k.dot(p),!(1.0E-4>Math.abs(r))&&(s=p.dot(l)/r,!(0>s)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(m.add(i,k.multiplyScalar(s)),b instanceof THREE.Face3)e=u.multiplyVector3(e.copy(t[b.a].position)),f=u.multiplyVector3(f.copy(t[b.b].position)),g=u.multiplyVector3(g.copy(t[b.c].position)),
|
|
|
|
-d(m,e,f,g)&&(b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},n.push(b));else if(b instanceof THREE.Face4&&(e=u.multiplyVector3(e.copy(t[b.a].position)),f=u.multiplyVector3(f.copy(t[b.b].position)),g=u.multiplyVector3(g.copy(t[b.c].position)),h=u.multiplyVector3(h.copy(t[b.d].position)),d(m,e,f,h)||d(m,f,g,h)))b={distance:i.distanceTo(m),point:m.clone(),face:b,object:a},n.push(b)}return n};var o=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3,r,s,t,w,u,v,y,D,C,B,E};
|
|
|
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);m.sub(a,b);w=o.dot(o);u=o.dot(q);v=o.dot(m);A=q.dot(q);B=q.dot(m);C=1/(w*A-u*u);D=(A*v-u*B)*C;I=(w*B-u*v)*C;return 0<=D&&0<=I&&1>D+I}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
|
|
|
|
+c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],o=0,q=a.children.length;o<q;o++)Array.prototype.push.apply(m,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
|
|
|
|
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return m;var r,s,j=a.geometry,t=j.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);
|
|
|
|
+for(o=0,q=j.faces.length;o<q;o++)if(b=j.faces[o],i.copy(this.origin),k.copy(this.direction),u=a.matrixWorld,l=u.multiplyVector3(l.copy(b.centroid)).subSelf(i),p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),r=k.dot(p),!(1.0E-4>Math.abs(r))&&(s=p.dot(l)/r,!(0>s)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(n.add(i,k.multiplyScalar(s)),b instanceof THREE.Face3)e=u.multiplyVector3(e.copy(t[b.a].position)),f=u.multiplyVector3(f.copy(t[b.b].position)),g=u.multiplyVector3(g.copy(t[b.c].position)),
|
|
|
|
+d(n,e,f,g)&&(b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b));else if(b instanceof THREE.Face4&&(e=u.multiplyVector3(e.copy(t[b.a].position)),f=u.multiplyVector3(f.copy(t[b.b].position)),g=u.multiplyVector3(g.copy(t[b.c].position)),h=u.multiplyVector3(h.copy(t[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,w,u,v,A,B,C,D,I};
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,p){h=!1;b=f;c=g;d=l;e=p;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,p){h=!1;b=f;c=g;d=l;e=p;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
|
|
-function(f,g,l,p,m,o){h?(h=!1,b=f<l?f<m?f:m:l<m?l:m,c=g<p?g<o?g:o:p<o?p:o,d=f>l?f>m?f:m:l>m?l:m,e=g>p?g>o?g:o:p>o?p:o):(b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
|
|
|
|
|
|
+function(f,g,l,p,n,o){h?(h=!1,b=f<l?f<n?f:n:l<n?l:n,c=g<p?g<o?g:o:p<o?p:o,d=f>l?f>n?f:n:l>n?l:n,e=g>p?g>o?g:o:p>o?p:o):(b=f<l?f<n?f<b?f:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>l?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
|
|
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
|
|
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
-THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,p,m,o,q,n){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,k||0,void 0!==l?l:1,p||0,m||0,o||0,q||0,void 0!==n?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,l,p,m,o,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=p;this.n41=m;this.n42=o;this.n43=q;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
|
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,p=a.n32,m=a.n33,o=a.n34,q=a.n41,n=a.n42,r=a.n43,
|
|
|
|
-s=a.n44,t=b.n11,w=b.n12,u=b.n13,v=b.n14,y=b.n21,D=b.n22,C=b.n23,B=b.n24,E=b.n31,J=b.n32,N=b.n33,S=b.n34,K=b.n41,O=b.n42,M=b.n43,H=b.n44;this.n11=c*t+d*y+e*E+f*K;this.n12=c*w+d*D+e*J+f*O;this.n13=c*u+d*C+e*N+f*M;this.n14=c*v+d*B+e*S+f*H;this.n21=g*t+h*y+i*E+k*K;this.n22=g*w+h*D+i*J+k*O;this.n23=g*u+h*C+i*N+k*M;this.n24=g*v+h*B+i*S+k*H;this.n31=l*t+p*y+m*E+o*K;this.n32=l*w+p*D+m*J+o*O;this.n33=l*u+p*C+m*N+o*M;this.n34=l*v+p*B+m*S+o*H;this.n41=q*t+n*y+r*E+s*K;this.n42=q*w+n*D+r*J+s*O;this.n43=q*u+n*
|
|
|
|
-C+r*N+s*M;this.n44=q*v+n*B+r*S+s*H;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
|
|
|
|
+THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,p,n,o,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,k||0,void 0!==l?l:1,p||0,n||0,o||0,q||0,void 0!==m?m:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,l,p,n,o,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=p;this.n41=n;this.n42=o;this.n43=q;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
|
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,p=a.n32,n=a.n33,o=a.n34,q=a.n41,m=a.n42,r=a.n43,
|
|
|
|
+s=a.n44,t=b.n11,w=b.n12,u=b.n13,v=b.n14,A=b.n21,B=b.n22,C=b.n23,D=b.n24,I=b.n31,K=b.n32,O=b.n33,S=b.n34,L=b.n41,P=b.n42,H=b.n43,G=b.n44;this.n11=c*t+d*A+e*I+f*L;this.n12=c*w+d*B+e*K+f*P;this.n13=c*u+d*C+e*O+f*H;this.n14=c*v+d*D+e*S+f*G;this.n21=g*t+h*A+i*I+k*L;this.n22=g*w+h*B+i*K+k*P;this.n23=g*u+h*C+i*O+k*H;this.n24=g*v+h*D+i*S+k*G;this.n31=l*t+p*A+n*I+o*L;this.n32=l*w+p*B+n*K+o*P;this.n33=l*u+p*C+n*O+o*H;this.n34=l*v+p*D+n*S+o*G;this.n41=q*t+m*A+r*I+s*L;this.n42=q*w+m*B+r*K+s*P;this.n43=q*u+m*
|
|
|
|
+C+r*O+s*H;this.n44=q*v+m*D+r*S+s*G;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
|
|
a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
|
|
c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,p=this.n34,m=this.n41,o=this.n42,q=this.n43,n=this.n44;return d*g*k*m-c*h*k*m-d*f*l*m+b*h*l*m+c*f*p*m-b*g*p*m-d*g*i*o+c*h*i*o+d*e*l*o-a*h*l*o-c*e*p*o+a*g*p*o+d*f*i*q-b*h*i*q-d*e*k*q+a*h*k*q+b*e*p*q-a*f*p*q-c*f*i*n+b*g*i*n+c*e*k*n-a*g*k*n-b*e*l*n+a*f*l*n},transpose:function(){var a;
|
|
|
|
|
|
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,p=this.n34,n=this.n41,o=this.n42,q=this.n43,m=this.n44;return d*g*k*n-c*h*k*n-d*f*l*n+b*h*l*n+c*f*p*n-b*g*p*n-d*g*i*o+c*h*i*o+d*e*l*o-a*h*l*o-c*e*p*o+a*g*p*o+d*f*i*q-b*h*i*q-d*e*k*q+a*h*k*q+b*e*p*q-a*f*p*q-c*f*i*m+b*g*i*m+c*e*k*m-a*g*k*m-b*e*l*m+a*f*l*m},transpose:function(){var a;
|
|
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
|
|
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
|
|
a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
|
|
a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
|
|
a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
|
|
a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
|
|
setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
|
|
setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
|
|
setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,p=a.n33,m=a.n34,o=a.n41,q=a.n42,n=a.n43,r=a.n44;this.n11=h*m*q-i*p*q+i*l*n-g*m*n-h*l*r+g*p*r;this.n12=e*p*q-d*m*q-e*l*n+c*m*n+d*l*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*n-c*i*n-d*g*r+c*h*r;this.n14=e*h*l-d*i*l-e*g*p+c*i*p+d*g*m-c*h*m;this.n21=i*p*o-h*m*o-i*k*n+f*m*n+h*k*r-f*p*r;this.n22=d*m*o-e*p*o+
|
|
|
|
-e*k*n-b*m*n-d*k*r+b*p*r;this.n23=e*h*o-d*i*o-e*f*n+b*i*n+d*f*r-b*h*r;this.n24=d*i*k-e*h*k+e*f*p-b*i*p-d*f*m+b*h*m;this.n31=g*m*o-i*l*o+i*k*q-f*m*q-g*k*r+f*l*r;this.n32=e*l*o-c*m*o-e*k*q+b*m*q+c*k*r-b*l*r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*k-c*i*k-e*f*l+b*i*l+c*f*m-b*g*m;this.n41=h*l*o-g*p*o-h*k*q+f*p*q+g*k*n-f*l*n;this.n42=c*p*o-d*l*o+d*k*q-b*p*q-c*k*n+b*l*n;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*n-b*g*n;this.n44=c*h*k-d*g*k+d*f*l-b*h*l-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());
|
|
|
|
|
|
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,p=a.n33,n=a.n34,o=a.n41,q=a.n42,m=a.n43,r=a.n44;this.n11=h*n*q-i*p*q+i*l*m-g*n*m-h*l*r+g*p*r;this.n12=e*p*q-d*n*q-e*l*m+c*n*m+d*l*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*m-c*i*m-d*g*r+c*h*r;this.n14=e*h*l-d*i*l-e*g*p+c*i*p+d*g*n-c*h*n;this.n21=i*p*o-h*n*o-i*k*m+f*n*m+h*k*r-f*p*r;this.n22=d*n*o-e*p*o+
|
|
|
|
+e*k*m-b*n*m-d*k*r+b*p*r;this.n23=e*h*o-d*i*o-e*f*m+b*i*m+d*f*r-b*h*r;this.n24=d*i*k-e*h*k+e*f*p-b*i*p-d*f*n+b*h*n;this.n31=g*n*o-i*l*o+i*k*q-f*n*q-g*k*r+f*l*r;this.n32=e*l*o-c*n*o-e*k*q+b*n*q+c*k*r-b*l*r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*k-c*i*k-e*f*l+b*i*l+c*f*n-b*g*n;this.n41=h*l*o-g*p*o-h*k*q+f*p*q+g*k*m-f*l*m;this.n42=c*p*o-d*l*o+d*k*q-b*p*q-c*k*m+b*l*m;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*m-b*g*m;this.n44=c*h*k-d*g*k+d*f*l-b*h*l-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());
|
|
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,k=g*e,l=d*h,p=d*e;this.n11=i+p*c;this.n12=l*c-k;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=k*c-l;this.n32=p+i*c;this.n33=f*g;break;case "ZXY":i=g*h;k=g*e;l=d*h;p=d*e;this.n11=i-p*c;this.n12=-f*e;this.n13=l+k*c;this.n21=k+l*c;this.n22=f*h;this.n23=p-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=
|
|
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,k=g*e,l=d*h,p=d*e;this.n11=i+p*c;this.n12=l*c-k;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=k*c-l;this.n32=p+i*c;this.n33=f*g;break;case "ZXY":i=g*h;k=g*e;l=d*h;p=d*e;this.n11=i-p*c;this.n12=-f*e;this.n13=l+k*c;this.n21=k+l*c;this.n22=f*h;this.n23=p-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=
|
|
f*h;k=f*e;l=c*h;p=c*e;this.n11=g*h;this.n12=l*d-k;this.n13=i*d+p;this.n21=g*e;this.n22=p*d+i;this.n23=k*d-l;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;k=f*d;l=c*g;p=c*d;this.n11=g*h;this.n12=p-i*e;this.n13=l*e+k;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*e+l;this.n33=i-p*e;break;case "XZY":i=f*g;k=f*d;l=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=f*h;this.n23=k*e-l;this.n31=l*e-k;this.n32=c*h;this.n33=p*e+i;break;default:i=f*h,k=f*
|
|
f*h;k=f*e;l=c*h;p=c*e;this.n11=g*h;this.n12=l*d-k;this.n13=i*d+p;this.n21=g*e;this.n22=p*d+i;this.n23=k*d-l;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;k=f*d;l=c*g;p=c*d;this.n11=g*h;this.n12=p-i*e;this.n13=l*e+k;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*e+l;this.n33=i-p*e;break;case "XZY":i=f*g;k=f*d;l=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=f*h;this.n23=k*e-l;this.n31=l*e-k;this.n32=c*h;this.n33=p*e+i;break;default:i=f*h,k=f*
|
|
e,l=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=k+l*d,this.n22=i-p*d,this.n23=-c*g,this.n31=p-i*d,this.n32=l+k*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,k=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(k+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
|
|
e,l=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=k+l*d,this.n22=i-p*d,this.n23=-c*g,this.n31=p-i*d,this.n32=l+k*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,k=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(k+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
|
|
a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
|
|
a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
|
|
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
|
|
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),k=Math.sin(b),l=1-i,p=c*d*l,m=c*e*l,l=d*e*l,c=c*k,o=d*k,k=e*k,e=f+(1-f)*i,f=p+k,d=m-o,p=p-k,g=g+(1-g)*i,k=l+c,m=m+o,l=l-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,n=this.n12,r=this.n22,s=this.n32,t=this.n42,w=this.n13,u=this.n23,v=this.n33,y=this.n43;this.n11=e*i+f*n+d*w;this.n21=e*c+f*r+d*u;this.n31=e*o+f*s+d*v;this.n41=e*q+f*t+d*y;this.n12=p*i+g*n+k*w;this.n22=
|
|
|
|
-p*c+g*r+k*u;this.n32=p*o+g*s+k*v;this.n42=p*q+g*t+k*y;this.n13=m*i+l*n+h*w;this.n23=m*c+l*r+h*u;this.n33=m*o+l*s+h*v;this.n43=m*q+l*t+h*y;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*f;this.n22=k*c+a*g;this.n32=k*d+a*h;this.n42=k*e+a*i;this.n13=k*f-a*b;this.n23=k*g-a*c;this.n33=k*h-a*d;this.n43=k*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
|
|
|
|
|
|
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),k=Math.sin(b),l=1-i,p=c*d*l,n=c*e*l,l=d*e*l,c=c*k,o=d*k,k=e*k,e=f+(1-f)*i,f=p+k,d=n-o,p=p-k,g=g+(1-g)*i,k=l+c,n=n+o,l=l-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,w=this.n13,u=this.n23,v=this.n33,A=this.n43;this.n11=e*i+f*m+d*w;this.n21=e*c+f*r+d*u;this.n31=e*o+f*s+d*v;this.n41=e*q+f*t+d*A;this.n12=p*i+g*m+k*w;this.n22=
|
|
|
|
+p*c+g*r+k*u;this.n32=p*o+g*s+k*v;this.n42=p*q+g*t+k*A;this.n13=n*i+l*m+h*w;this.n23=n*c+l*r+h*u;this.n33=n*o+l*s+h*v;this.n43=n*q+l*t+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*f;this.n22=k*c+a*g;this.n32=k*d+a*h;this.n42=k*e+a*i;this.n13=k*f-a*b;this.n23=k*g-a*c;this.n33=k*h-a*d;this.n43=k*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
|
|
f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*f;this.n21=k*c-a*g;this.n31=k*d-a*h;this.n41=k*e-a*i;this.n13=k*f+a*b;this.n23=k*g+a*c;this.n33=k*h+a*d;this.n43=k*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*f;this.n21=k*c+a*g;this.n31=k*d+a*h;this.n41=k*e+a*i;this.n12=k*f-a*b;this.n22=k*g-a*c;this.n32=k*h-a*d;this.n42=k*i-a*e;return this},
|
|
f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*f;this.n21=k*c-a*g;this.n31=k*d-a*h;this.n41=k*e-a*i;this.n13=k*f+a*b;this.n23=k*g+a*c;this.n33=k*h+a*d;this.n43=k*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*f;this.n21=k*c+a*g;this.n31=k*d+a*h;this.n41=k*e+a*i;this.n12=k*f-a*b;this.n22=k*g-a*c;this.n32=k*h-a*d;this.n42=k*i-a*e;return this},
|
|
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
|
|
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
|
|
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b};
|
|
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b};
|
|
@@ -64,16 +64,16 @@ this)console.warn("THREE: Object3D.add(): An object can't be added as a child of
|
|
getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
|
|
getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
|
|
this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
-var e,f,g=[],h,i,k=[],l,p,m=[],o,q=[],n,r,s=[],t,w,u=[],v={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,D=new THREE.Vector4,C=new THREE.Matrix4,B=new THREE.Matrix4,E=new THREE.Frustum,J=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
|
|
|
|
-b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||E.contains(b))?(C.multiplyVector3(y.copy(b.position)),e=a(),e.object=
|
|
|
|
-b,e.z=y.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(C.multiplyVector3(y.copy(b.position)),e=a(),e.object=b,e.z=y.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,H=e.far,j,y,A,F,P,R,ea,ia,ca,V,ba,U,aa,ha,Ta,oa;w=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);E.setFromMatrix(C);v=this.projectGraph(a,!1);for(a=0,j=v.objects.length;a<j;a++)if(ca=v.objects[a].object,V=ca.matrixWorld,U=ca.material,i=0,ca instanceof THREE.Mesh){ba=ca.geometry;aa=ca.geometry.materials;F=ba.vertices;ha=ba.faces;Ta=ba.faceVertexUvs;ba=ca.matrixRotationWorld.extractRotation(V);for(y=0,A=F.length;y<A;y++)h=b(),h.positionWorld.copy(F[y].position),V.multiplyVector3(h.positionWorld),
|
|
|
|
-h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<H;for(F=0,y=ha.length;F<y;F++){A=ha[F];if(A instanceof THREE.Face3)if(P=k[A.a],R=k[A.b],ea=k[A.c],P.visible&&R.visible&&ea.visible&&(ca.doubleSided||ca.flipSided!=0>(ea.positionScreen.x-P.positionScreen.x)*(R.positionScreen.y-P.positionScreen.y)-(ea.positionScreen.y-P.positionScreen.y)*(R.positionScreen.x-
|
|
|
|
-P.positionScreen.x)))ia=m[p]=m[p]||new THREE.RenderableFace3,p++,l=ia,l.v1.copy(P),l.v2.copy(R),l.v3.copy(ea);else continue;else if(A instanceof THREE.Face4)if(P=k[A.a],R=k[A.b],ea=k[A.c],ia=k[A.d],P.visible&&R.visible&&ea.visible&&ia.visible&&(ca.doubleSided||ca.flipSided!=(0>(ia.positionScreen.x-P.positionScreen.x)*(R.positionScreen.y-P.positionScreen.y)-(ia.positionScreen.y-P.positionScreen.y)*(R.positionScreen.x-P.positionScreen.x)||0>(R.positionScreen.x-ea.positionScreen.x)*(ia.positionScreen.y-
|
|
|
|
-ea.positionScreen.y)-(R.positionScreen.y-ea.positionScreen.y)*(ia.positionScreen.x-ea.positionScreen.x))))oa=q[o]=q[o]||new THREE.RenderableFace4,o++,l=oa,l.v1.copy(P),l.v2.copy(R),l.v3.copy(ea),l.v4.copy(ia);else continue;l.normalWorld.copy(A.normal);ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(A.centroid);V.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);C.multiplyVector3(l.centroidScreen);ea=A.vertexNormals;for(P=0,R=ea.length;P<R;P++)ia=l.vertexNormalsWorld[P],
|
|
|
|
-ia.copy(ea[P]),ba.multiplyVector3(ia);for(P=0,R=Ta.length;P<R;P++)if(oa=Ta[P][F])for(ea=0,ia=oa.length;ea<ia;ea++)l.uvs[P][ea]=oa[ea];l.material=U;l.faceMaterial=null!==A.materialIndex?aa[A.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if(ca instanceof THREE.Line){B.multiply(C,V);F=ca.geometry.vertices;P=b();P.positionScreen.copy(F[0].position);B.multiplyVector4(P.positionScreen);for(y=1,A=F.length;y<A;y++)if(P=b(),P.positionScreen.copy(F[y].position),B.multiplyVector4(P.positionScreen),
|
|
|
|
-R=k[i-2],J.copy(P.positionScreen),N.copy(R.positionScreen),d(J,N))J.multiplyScalar(1/J.w),N.multiplyScalar(1/N.w),ca=s[r]=s[r]||new THREE.RenderableLine,r++,n=ca,n.v1.positionScreen.copy(J),n.v2.positionScreen.copy(N),n.z=Math.max(J.z,N.z),n.material=U,v.elements.push(n)}for(a=0,j=v.sprites.length;a<j;a++)if(ca=v.sprites[a].object,V=ca.matrixWorld,ca instanceof THREE.Particle&&(D.set(V.n14,V.n24,V.n34,1),C.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=u[w]=u[w]||new THREE.RenderableParticle,w++,t=g,
|
|
|
|
-t.x=D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=ca.rotation.z,t.scale.x=ca.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=ca.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=ca.material,v.elements.push(t);f&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
|
|
|
+var e,f,g=[],h,i,k=[],l,p,n=[],o,q=[],m,r,s=[],t,w,u=[],v={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,B=new THREE.Vector4,C=new THREE.Matrix4,D=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
|
|
|
|
+b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||I.contains(b))?(C.multiplyVector3(A.copy(b.position)),e=a(),e.object=
|
|
|
|
+b,e.z=A.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(C.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,G=e.far,j,A,z,E,Q,N,ea,ia,$,aa,ba,Y,ca,fa,Ua,Ka;w=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);I.setFromMatrix(C);v=this.projectGraph(a,!1);for(a=0,j=v.objects.length;a<j;a++)if($=v.objects[a].object,aa=$.matrixWorld,Y=$.material,i=0,$ instanceof THREE.Mesh){ba=$.geometry;ca=$.geometry.materials;E=ba.vertices;fa=ba.faces;Ua=ba.faceVertexUvs;ba=$.matrixRotationWorld.extractRotation(aa);for(A=0,z=E.length;A<z;A++)h=b(),h.positionWorld.copy(E[A].position),aa.multiplyVector3(h.positionWorld),
|
|
|
|
+h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<G;for(E=0,A=fa.length;E<A;E++){z=fa[E];if(z instanceof THREE.Face3)if(Q=k[z.a],N=k[z.b],ea=k[z.c],Q.visible&&N.visible&&ea.visible&&($.doubleSided||$.flipSided!=0>(ea.positionScreen.x-Q.positionScreen.x)*(N.positionScreen.y-Q.positionScreen.y)-(ea.positionScreen.y-Q.positionScreen.y)*(N.positionScreen.x-
|
|
|
|
+Q.positionScreen.x)))ia=n[p]=n[p]||new THREE.RenderableFace3,p++,l=ia,l.v1.copy(Q),l.v2.copy(N),l.v3.copy(ea);else continue;else if(z instanceof THREE.Face4)if(Q=k[z.a],N=k[z.b],ea=k[z.c],ia=k[z.d],Q.visible&&N.visible&&ea.visible&&ia.visible&&($.doubleSided||$.flipSided!=(0>(ia.positionScreen.x-Q.positionScreen.x)*(N.positionScreen.y-Q.positionScreen.y)-(ia.positionScreen.y-Q.positionScreen.y)*(N.positionScreen.x-Q.positionScreen.x)||0>(N.positionScreen.x-ea.positionScreen.x)*(ia.positionScreen.y-
|
|
|
|
+ea.positionScreen.y)-(N.positionScreen.y-ea.positionScreen.y)*(ia.positionScreen.x-ea.positionScreen.x))))Ka=q[o]=q[o]||new THREE.RenderableFace4,o++,l=Ka,l.v1.copy(Q),l.v2.copy(N),l.v3.copy(ea),l.v4.copy(ia);else continue;l.normalWorld.copy(z.normal);ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(z.centroid);aa.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);C.multiplyVector3(l.centroidScreen);ea=z.vertexNormals;for(Q=0,N=ea.length;Q<N;Q++)ia=l.vertexNormalsWorld[Q],
|
|
|
|
+ia.copy(ea[Q]),ba.multiplyVector3(ia);for(Q=0,N=Ua.length;Q<N;Q++)if(Ka=Ua[Q][E])for(ea=0,ia=Ka.length;ea<ia;ea++)l.uvs[Q][ea]=Ka[ea];l.material=Y;l.faceMaterial=null!==z.materialIndex?ca[z.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if($ instanceof THREE.Line){D.multiply(C,aa);E=$.geometry.vertices;Q=b();Q.positionScreen.copy(E[0].position);D.multiplyVector4(Q.positionScreen);for(A=1,z=E.length;A<z;A++)if(Q=b(),Q.positionScreen.copy(E[A].position),D.multiplyVector4(Q.positionScreen),
|
|
|
|
+N=k[i-2],K.copy(Q.positionScreen),O.copy(N.positionScreen),d(K,O))K.multiplyScalar(1/K.w),O.multiplyScalar(1/O.w),$=s[r]=s[r]||new THREE.RenderableLine,r++,m=$,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(O),m.z=Math.max(K.z,O.z),m.material=Y,v.elements.push(m)}for(a=0,j=v.sprites.length;a<j;a++)if($=v.sprites[a].object,aa=$.matrixWorld,$ instanceof THREE.Particle&&(B.set(aa.n14,aa.n24,aa.n34,1),C.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z))g=u[w]=u[w]||new THREE.RenderableParticle,w++,t=g,
|
|
|
|
+t.x=B.x/B.w,t.y=B.y/B.w,t.z=B.z,t.rotation=$.rotation.z,t.scale.x=$.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),t.scale.y=$.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),t.material=$.material,v.elements.push(t);f&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*
|
|
f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
|
|
f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
|
|
-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
|
|
-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
|
|
@@ -89,16 +89,17 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
|
|
b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=
|
|
b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=
|
|
this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
|
|
this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
|
|
d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,
|
|
d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,
|
|
-b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){var g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();var h,i;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],i=g.vertexNormals[c],h.copy(e.normal),
|
|
|
|
-e instanceof THREE.Face3?(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])):(i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2]),i.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,C){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=g[e];p=g[f];m=g[C];o=i.x-h.x;q=k.x-h.x;n=i.y-
|
|
|
|
-h.y;r=k.y-h.y;s=i.z-h.z;t=k.z-h.z;w=p.u-l.u;u=m.u-l.u;v=p.v-l.v;y=m.v-l.v;D=1/(w*y-u*v);J.set((y*o-v*q)*D,(y*n-v*r)*D,(y*s-v*t)*D);N.set((w*q-u*o)*D,(w*r-u*n)*D,(w*t-u*s)*D);B[b].addSelf(J);B[c].addSelf(J);B[d].addSelf(J);E[b].addSelf(N);E[c].addSelf(N);E[d].addSelf(N)}var b,c,d,e,f,g,h,i,k,l,p,m,o,q,n,r,s,t,w,u,v,y,D,C,B=[],E=[],J=new THREE.Vector3,N=new THREE.Vector3,S=new THREE.Vector3,K=new THREE.Vector3,O=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)B[b]=new THREE.Vector3,E[b]=new THREE.Vector3;
|
|
|
|
-for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var M=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)O.copy(f.vertexNormals[d]),e=f[M[d]],C=B[e],S.copy(C),S.subSelf(O.multiplyScalar(O.dot(C))).normalize(),K.cross(f.vertexNormals[d],C),e=K.dot(E[e]),e=0>e?-1:1,f.vertexTangents[d]=
|
|
|
|
-new THREE.Vector4(S.x,S.y,S.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=
|
|
|
|
-a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*
|
|
|
|
-e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
|
|
|
|
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,l,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;k=this.points[c[0]];l=this.points[c[1]];
|
|
|
|
-p=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,l.x,p.x,m.x,g,h,i);d.y=b(k.y,l.y,p.y,m.y,g,h,i);d.z=b(k.z,l.z,p.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
|
|
|
|
-f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,m=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];g=Math.ceil(a*c/m.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
|
|
|
|
|
|
+b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
|
|
|
|
+{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
|
|
|
|
+f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
|
|
|
|
+b,c,d,e,f,C){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=g[e];p=g[f];n=g[C];o=i.x-h.x;q=k.x-h.x;m=i.y-h.y;r=k.y-h.y;s=i.z-h.z;t=k.z-h.z;w=p.u-l.u;u=n.u-l.u;v=p.v-l.v;A=n.v-l.v;B=1/(w*A-u*v);K.set((A*o-v*q)*B,(A*m-v*r)*B,(A*s-v*t)*B);O.set((w*q-u*o)*B,(w*r-u*m)*B,(w*t-u*s)*B);D[b].addSelf(K);D[c].addSelf(K);D[d].addSelf(K);I[b].addSelf(O);I[c].addSelf(O);I[d].addSelf(O)}var b,c,d,e,f,g,h,i,k,l,p,n,o,q,m,r,s,t,w,u,v,A,B,C,D=[],I=[],K=new THREE.Vector3,O=new THREE.Vector3,
|
|
|
|
+S=new THREE.Vector3,L=new THREE.Vector3,P=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,I[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var H=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)P.copy(f.vertexNormals[d]),e=f[H[d]],
|
|
|
|
+C=D[e],S.copy(C),S.subSelf(P.multiplyScalar(P.dot(C))).normalize(),L.cross(f.vertexNormals[d],C),e=L.dot(I[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(S.x,S.y,S.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
|
|
|
|
+e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
|
|
|
|
+4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
|
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,l,p,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;k=this.points[c[0]];l=this.points[c[1]];
|
|
|
|
+p=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,l.x,p.x,n.x,g,h,i);d.y=b(k.y,l.y,p.y,n.y,g,h,i);d.z=b(k.z,l.z,p.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
|
|
|
|
+f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,n=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];g=Math.ceil(a*c/n.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
|
|
h}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
|
|
h}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
|
|
THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
|
|
THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
|
|
@@ -159,47 +160,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
-THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var i,k,l,p,m,o,q,n;a=b.projectScene(c,d);for(i=0,k=a.length;i<k;i++)if(m=a[i],m instanceof THREE.RenderableParticle){q=m.x*e+e;n=m.y*f+f;for(l=0,p=m.material.length;l<p;l++)if(o=m.material[l],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=q+"px",o.style.top=n+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}w=a}}function d(a){if(u!=a)n.strokeStyle=u=a}function e(a){if(v!=a)n.fillStyle=v=a}var a=a||{},f=this,g,h,i,k=new THREE.Projector,l=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
|
-p,m,o,q,n=l.getContext("2d"),r=new THREE.Color(0),s=0,t=1,w=0,u=null,v=null,y=null,D=null,C=null,B,E,J,N,S=new THREE.RenderableVertex,K=new THREE.RenderableVertex,O,M,H,j,Z,A,F,P,R,ea,ia,ca,V=new THREE.Color,ba=new THREE.Color,U=new THREE.Color,aa=new THREE.Color,ha=new THREE.Color,Ta=[],oa=[],Ka,Ea,Ba,ka,db,lb,eb,Za,$a,Sa,Fa=new THREE.Rectangle,ya=new THREE.Rectangle,za=new THREE.Rectangle,Qa=!1,Ha=new THREE.Color,Wa=new THREE.Color,mb=new THREE.Color,$=new THREE.Vector3,Q,Fb,Tc,fb,pc,Cc,a=16;Q=
|
|
|
|
-document.createElement("canvas");Q.width=Q.height=2;Fb=Q.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Tc=Fb.getImageData(0,0,2,2);fb=Tc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;m=b;o=Math.floor(p/2);q=Math.floor(m/2);l.width=p;l.height=m;Fa.set(-o,-q,
|
|
|
|
-o,q);ya.set(-o,-q,o,q);t=1;w=0;C=D=y=v=u=null};this.setClearColor=function(a,b){r.copy(a);s=b;ya.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ya.set(-o,-q,o,q)};this.clear=function(){n.setTransform(1,0,0,-1,o,q);ya.isEmpty()||(ya.minSelf(Fa),ya.inflate(2),1>s&&n.clearRect(Math.floor(ya.getX()),Math.floor(ya.getY()),Math.floor(ya.getWidth()),Math.floor(ya.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
|
-r.b)+","+s+")"),n.fillRect(Math.floor(ya.getX()),Math.floor(ya.getY()),Math.floor(ya.getWidth()),Math.floor(ya.getHeight()))),ya.empty())};this.render=function(a,m){function l(a){var b,c,d,e;Ha.setRGB(0,0,0);Wa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Ha.r+=e.r,Ha.g+=e.g,Ha.b+=e.b):d instanceof THREE.DirectionalLight?(Wa.r+=e.r,Wa.g+=e.g,Wa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
|
|
|
|
-f,g,j,h,i;for(e=0,f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),0>=i||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot($.sub(h,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(h)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function r(a,f,g){b(g.opacity);c(g.blending);var $,j,h,i,m,k;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=
|
|
|
|
-g.map.image,m=i.width>>1,k=i.height>>1,g=f.scale.x*o,h=f.scale.y*q,$=g*m,j=h*k,za.set(a.x-$,a.y-j,a.x+$,a.y+j),Fa.intersects(za)&&(n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(g,-h),n.translate(-m,-k),n.drawImage(i,0,0),n.restore())}else g instanceof THREE.ParticleCanvasMaterial&&($=f.scale.x*o,j=f.scale.y*q,za.set(a.x-$,a.y-j,a.x+$,a.y+j),Fa.intersects(za)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale($,j),g.program(n),
|
|
|
|
-n.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(y!=a)n.lineWidth=y=a;a=g.linecap;if(D!=a)n.lineCap=D=a;a=g.linejoin;if(C!=a)n.lineJoin=C=a;d(g.color.getContextStyle());n.stroke();za.inflate(2*g.linewidth)}}function t(a,d,e,g,h,n,k,Q){f.info.render.vertices+=3;f.info.render.faces++;b(Q.opacity);c(Q.blending);
|
|
|
|
-O=a.positionScreen.x;M=a.positionScreen.y;H=d.positionScreen.x;j=d.positionScreen.y;Z=e.positionScreen.x;A=e.positionScreen.y;w(O,M,H,j,Z,A);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.mapping instanceof THREE.UVMapping&&(ka=k.uvs[0],Uc(O,M,H,j,Z,A,ka[g].u,ka[g].v,ka[h].u,ka[h].v,ka[n].u,ka[n].v,Q.map));else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=m.matrixWorldInverse,$.copy(k.vertexNormalsWorld[g]),db=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,lb=0.5*
|
|
|
|
--($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,$.copy(k.vertexNormalsWorld[h]),eb=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,Za=0.5*-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,$.copy(k.vertexNormalsWorld[n]),$a=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,Sa=0.5*-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,Uc(O,M,H,j,Z,A,db,lb,eb,Za,$a,Sa,Q.envMap)}else Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Q.map&&!Q.wireframe&&(Q.map.mapping instanceof
|
|
|
|
-THREE.UVMapping&&(ka=k.uvs[0],Uc(O,M,H,j,Z,A,ka[g].u,ka[g].v,ka[h].u,ka[h].v,ka[n].u,ka[n].v,Q.map)),c(THREE.SubtractiveBlending)),Qa?!Q.wireframe&&Q.shading==THREE.SmoothShading&&3==k.vertexNormalsWorld.length?(ba.r=U.r=aa.r=Ha.r,ba.g=U.g=aa.g=Ha.g,ba.b=U.b=aa.b=Ha.b,p(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ba),p(i,k.v2.positionWorld,k.vertexNormalsWorld[1],U),p(i,k.v3.positionWorld,k.vertexNormalsWorld[2],aa),ba.r=Math.max(0,Math.min(Q.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(Q.color.g*ba.g,
|
|
|
|
-1)),ba.b=Math.max(0,Math.min(Q.color.b*ba.b,1)),U.r=Math.max(0,Math.min(Q.color.r*U.r,1)),U.g=Math.max(0,Math.min(Q.color.g*U.g,1)),U.b=Math.max(0,Math.min(Q.color.b*U.b,1)),aa.r=Math.max(0,Math.min(Q.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(Q.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(Q.color.b*aa.b,1)),ha.r=0.5*(U.r+aa.r),ha.g=0.5*(U.g+aa.g),ha.b=0.5*(U.b+aa.b),Ba=Dc(ba,U,aa,ha),gc(O,M,H,j,Z,A,0,0,1,0,0,1,Ba)):(V.r=Ha.r,V.g=Ha.g,V.b=Ha.b,p(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(Q.color.r*
|
|
|
|
-V.r,1)),V.g=Math.max(0,Math.min(Q.color.g*V.g,1)),V.b=Math.max(0,Math.min(Q.color.b*V.b,1)),Q.wireframe?Mb(V,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(V)):Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color);else if(Q instanceof THREE.MeshDepthMaterial)Ka=m.near,Ea=m.far,ba.r=ba.g=ba.b=1-ac(a.positionScreen.z,Ka,Ea),U.r=U.g=U.b=1-ac(d.positionScreen.z,Ka,Ea),aa.r=aa.g=aa.b=1-ac(e.positionScreen.z,Ka,Ea),ha.r=0.5*(U.r+aa.r),ha.g=0.5*
|
|
|
|
-(U.g+aa.g),ha.b=0.5*(U.b+aa.b),Ba=Dc(ba,U,aa,ha),gc(O,M,H,j,Z,A,0,0,1,0,0,1,Ba);else if(Q instanceof THREE.MeshNormalMaterial)V.r=hc(k.normalWorld.x),V.g=hc(k.normalWorld.y),V.b=hc(k.normalWorld.z),Q.wireframe?Mb(V,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(V)}function u(a,d,e,g,$,h,Q,k,n){f.info.render.vertices+=4;f.info.render.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)t(a,d,g,0,1,3,Q,k,n),t($,e,h,1,2,3,Q,k,n);else if(O=a.positionScreen.x,M=a.positionScreen.y,H=d.positionScreen.x,
|
|
|
|
-j=d.positionScreen.y,Z=e.positionScreen.x,A=e.positionScreen.y,F=g.positionScreen.x,P=g.positionScreen.y,R=$.positionScreen.x,ea=$.positionScreen.y,ia=h.positionScreen.x,ca=h.positionScreen.y,k instanceof THREE.MeshBasicMaterial)v(O,M,H,j,Z,A,F,P),k.wireframe?Mb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color);else if(k instanceof THREE.MeshLambertMaterial)Qa?!k.wireframe&&k.shading==THREE.SmoothShading&&4==Q.vertexNormalsWorld.length?(ba.r=U.r=aa.r=ha.r=Ha.r,ba.g=
|
|
|
|
-U.g=aa.g=ha.g=Ha.g,ba.b=U.b=aa.b=ha.b=Ha.b,p(i,Q.v1.positionWorld,Q.vertexNormalsWorld[0],ba),p(i,Q.v2.positionWorld,Q.vertexNormalsWorld[1],U),p(i,Q.v4.positionWorld,Q.vertexNormalsWorld[3],aa),p(i,Q.v3.positionWorld,Q.vertexNormalsWorld[2],ha),ba.r=Math.max(0,Math.min(k.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(k.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(k.color.b*ba.b,1)),U.r=Math.max(0,Math.min(k.color.r*U.r,1)),U.g=Math.max(0,Math.min(k.color.g*U.g,1)),U.b=Math.max(0,Math.min(k.color.b*U.b,1)),
|
|
|
|
-aa.r=Math.max(0,Math.min(k.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(k.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(k.color.b*aa.b,1)),ha.r=Math.max(0,Math.min(k.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(k.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(k.color.b*ha.b,1)),Ba=Dc(ba,U,aa,ha),w(O,M,H,j,F,P),gc(O,M,H,j,F,P,0,0,1,0,0,1,Ba),w(R,ea,Z,A,ia,ca),gc(R,ea,Z,A,ia,ca,1,0,1,1,0,1,Ba)):(V.r=Ha.r,V.g=Ha.g,V.b=Ha.b,p(i,Q.centroidWorld,Q.normalWorld,V),V.r=Math.max(0,Math.min(k.color.r*V.r,1)),V.g=Math.max(0,
|
|
|
|
-Math.min(k.color.g*V.g,1)),V.b=Math.max(0,Math.min(k.color.b*V.b,1)),v(O,M,H,j,Z,A,F,P),k.wireframe?Mb(V,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(V)):(v(O,M,H,j,Z,A,F,P),k.wireframe?Mb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color));else if(k instanceof THREE.MeshNormalMaterial)V.r=hc(Q.normalWorld.x),V.g=hc(Q.normalWorld.y),V.b=hc(Q.normalWorld.z),v(O,M,H,j,Z,A,F,P),k.wireframe?Mb(V,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):
|
|
|
|
-Gb(V);else if(k instanceof THREE.MeshDepthMaterial)Ka=m.near,Ea=m.far,ba.r=ba.g=ba.b=1-ac(a.positionScreen.z,Ka,Ea),U.r=U.g=U.b=1-ac(d.positionScreen.z,Ka,Ea),aa.r=aa.g=aa.b=1-ac(g.positionScreen.z,Ka,Ea),ha.r=ha.g=ha.b=1-ac(e.positionScreen.z,Ka,Ea),Ba=Dc(ba,U,aa,ha),w(O,M,H,j,F,P),gc(O,M,H,j,F,P,0,0,1,0,0,1,Ba),w(R,ea,Z,A,ia,ca),gc(R,ea,Z,A,ia,ca,1,0,1,1,0,1,Ba)}function w(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function v(a,b,c,d,e,g,f,$){n.beginPath();
|
|
|
|
-n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,$);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(y!=b)n.lineWidth=y=b;if(D!=c)n.lineCap=D=c;if(C!=e)n.lineJoin=C=e;d(a.getContextStyle());n.stroke();za.inflate(2*b)}function Gb(a){e(a.getContextStyle());n.fill()}function Uc(a,b,c,d,g,f,$,j,h,i,k,Q,m){if(0!=m.image.width){if(!0==m.needsUpdate||void 0==Ta[m.id]){var l=m.wrapS==THREE.RepeatWrapping,o=m.wrapT==THREE.RepeatWrapping;Ta[m.id]=n.createPattern(m.image,l&&o?"repeat":l&&!o?"repeat-x":
|
|
|
|
-!l&&o?"repeat-y":"no-repeat");m.needsUpdate=!1}e(Ta[m.id]);var l=m.offset.x/m.repeat.x,o=m.offset.y/m.repeat.y,Fb=m.image.width*m.repeat.x,p=m.image.height*m.repeat.y,$=($+l)*Fb,j=(j+o)*p,c=c-a,d=d-b,g=g-a,f=f-b,h=(h+l)*Fb-$,i=(i+o)*p-j,k=(k+l)*Fb-$,Q=(Q+o)*p-j,l=h*Q-k*i;if(0==l){if(void 0===oa[m.id])b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),oa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data;b=oa[m.id];
|
|
|
|
-$=4*(Math.floor($)+Math.floor(j)*m.image.width);V.setRGB(b[$]/255,b[$+1]/255,b[$+2]/255);Gb(V)}else l=1/l,m=(Q*c-i*g)*l,i=(Q*d-i*f)*l,c=(h*g-k*c)*l,d=(h*f-k*d)*l,a=a-m*$-c*j,$=b-i*$-d*j,n.save(),n.transform(m,i,c,d,a,$),n.fill(),n.restore()}}function gc(a,b,c,d,e,g,f,$,j,h,i,k,Q){var m,l;m=Q.width-1;l=Q.height-1;f*=m;$*=l;c-=a;d-=b;e-=a;g-=b;j=j*m-f;h=h*l-$;i=i*m-f;k=k*l-$;l=1/(j*k-i*h);m=(k*c-h*e)*l;h=(k*d-h*g)*l;c=(j*e-i*c)*l;d=(j*g-i*d)*l;a=a-m*f-c*$;b=b-h*f-d*$;n.save();n.transform(m,h,c,d,a,
|
|
|
|
-b);n.clip();n.drawImage(Q,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),g=~~(255*a.g),a=~~(255*a.b),f=~~(255*b.r),$=~~(255*b.g),b=~~(255*b.b),j=~~(255*c.r),h=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),k=~~(255*d.g),d=~~(255*d.b);fb[0]=0>e?0:255<e?255:e;fb[1]=0>g?0:255<g?255:g;fb[2]=0>a?0:255<a?255:a;fb[4]=0>f?0:255<f?255:f;fb[5]=0>$?0:255<$?255:$;fb[6]=0>b?0:255<b?255:b;fb[8]=0>j?0:255<j?255:j;fb[9]=0>h?0:255<h?255:h;fb[10]=0>c?0:255<c?255:c;fb[12]=0>i?0:255<i?255:i;fb[13]=0>k?0:255<k?255:
|
|
|
|
-k;fb[14]=0>d?0:255<d?255:d;Fb.putImageData(Tc,0,0);Cc.drawImage(Q,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,ed,Oa,jb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,m,this.sortElements);h=g.elements;i=g.lights;(Qa=0<i.length)&&l(i);
|
|
|
|
-for(Ec=0,ed=h.length;Ec<ed;Ec++)if(Oa=h[Ec],jb=Oa.material,jb=jb instanceof THREE.MeshFaceMaterial?Oa.faceMaterial:jb,!(null==jb||0==jb.opacity)){za.empty();if(Oa instanceof THREE.RenderableParticle)B=Oa,B.x*=o,B.y*=q,r(B,Oa,jb,a);else if(Oa instanceof THREE.RenderableLine)B=Oa.v1,E=Oa.v2,B.positionScreen.x*=o,B.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,za.addPoint(B.positionScreen.x,B.positionScreen.y),za.addPoint(E.positionScreen.x,E.positionScreen.y),Fa.intersects(za)&&s(B,
|
|
|
|
-E,Oa,jb,a);else if(Oa instanceof THREE.RenderableFace3)B=Oa.v1,E=Oa.v2,J=Oa.v3,B.positionScreen.x*=o,B.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,jb.overdraw&&(Nb(B.positionScreen,E.positionScreen),Nb(E.positionScreen,J.positionScreen),Nb(J.positionScreen,B.positionScreen)),za.add3Points(B.positionScreen.x,B.positionScreen.y,E.positionScreen.x,E.positionScreen.y,J.positionScreen.x,J.positionScreen.y),Fa.intersects(za)&&t(B,E,J,0,1,2,
|
|
|
|
-Oa,jb,a);else if(Oa instanceof THREE.RenderableFace4)B=Oa.v1,E=Oa.v2,J=Oa.v3,N=Oa.v4,B.positionScreen.x*=o,B.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,N.positionScreen.x*=o,N.positionScreen.y*=q,S.positionScreen.copy(E.positionScreen),K.positionScreen.copy(N.positionScreen),jb.overdraw&&(Nb(B.positionScreen,E.positionScreen),Nb(E.positionScreen,N.positionScreen),Nb(N.positionScreen,B.positionScreen),Nb(J.positionScreen,S.positionScreen),
|
|
|
|
-Nb(J.positionScreen,K.positionScreen)),za.addPoint(B.positionScreen.x,B.positionScreen.y),za.addPoint(E.positionScreen.x,E.positionScreen.y),za.addPoint(J.positionScreen.x,J.positionScreen.y),za.addPoint(N.positionScreen.x,N.positionScreen.y),Fa.intersects(za)&&u(B,E,J,N,S,K,Oa,jb,a);ya.addRectangle(za)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,k;for(e=0,g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),k=c.dot(i),0>=k||(k*=f.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),k=c.dot(B.sub(i,b).normalize()),0>=k||(k*=0==f.distance?1:1-Math.min(b.distanceTo(i)/f.distance,1),0!=k&&(k*=f.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){null==E[a]&&(E[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"path"),0==O&&E[a].setAttribute("shape-rendering","crispEdges"));return E[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,p,m,o,q,n,r,s=new THREE.Rectangle,t=new THREE.Rectangle,w=!1,u=new THREE.Color,v=new THREE.Color,y=new THREE.Color,D=new THREE.Color,C,B=new THREE.Vector3,E=[],J=[],N,S,K,O=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){k=a;l=b;p=k/2;m=l/2;i.setAttribute("viewBox",-p+" "+-m+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);s.set(-p,-m,p,m)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var j,B,A,F;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);f=e.elements;
|
|
|
|
-g=e.lights;K=S=0;if(w=0<g.length){v.setRGB(0,0,0);y.setRGB(0,0,0);D.setRGB(0,0,0);for(j=0,B=g.length;j<B;j++)F=g[j],A=F.color,F instanceof THREE.AmbientLight?(v.r+=A.r,v.g+=A.g,v.b+=A.b):F instanceof THREE.DirectionalLight?(y.r+=A.r,y.g+=A.g,y.b+=A.b):F instanceof THREE.PointLight&&(D.r+=A.r,D.g+=A.g,D.b+=A.b)}for(j=0,B=f.length;j<B;j++)if(A=f[j],F=A.material,F=F instanceof THREE.MeshFaceMaterial?A.faceMaterial:F,!(null==F||0==F.opacity))if(t.empty(),A instanceof THREE.RenderableParticle)o=A,o.x*=
|
|
|
|
-p,o.y*=-m;else if(A instanceof THREE.RenderableLine){if(o=A.v1,q=A.v2,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){A=o;var P=q,R=K++;null==J[R]&&(J[R]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==O&&J[R].setAttribute("shape-rendering","crispEdges"));N=J[R];N.setAttribute("x1",A.positionScreen.x);N.setAttribute("y1",A.positionScreen.y);
|
|
|
|
-N.setAttribute("x2",P.positionScreen.x);N.setAttribute("y2",P.positionScreen.y);F instanceof THREE.LineBasicMaterial&&(N.setAttribute("style","fill: none; stroke: "+F.color.getContextStyle()+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin),i.appendChild(N))}}else if(A instanceof THREE.RenderableFace3){if(o=A.v1,q=A.v2,n=A.v3,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,n.positionScreen.x*=
|
|
|
|
-p,n.positionScreen.y*=-m,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(t)){var P=o,R=q,E=n;d.info.render.vertices+=3;d.info.render.faces++;N=b(S++);N.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+"z");F instanceof THREE.MeshBasicMaterial?u.copy(F.color):F instanceof THREE.MeshLambertMaterial?
|
|
|
|
-w?(u.r=v.r,u.g=v.g,u.b=v.b,a(g,A.centroidWorld,A.normalWorld,u),u.r=Math.max(0,Math.min(F.color.r*u.r,1)),u.g=Math.max(0,Math.min(F.color.g*u.g,1)),u.b=Math.max(0,Math.min(F.color.b*u.b,1))):u.copy(F.color):F instanceof THREE.MeshDepthMaterial?(C=1-F.__2near/(F.__farPlusNear-A.z*F.__farMinusNear),u.setRGB(C,C,C)):F instanceof THREE.MeshNormalMaterial&&u.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));F.wireframe?N.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
|
|
|
|
-F.wireframeLinewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframeLinecap+"; stroke-linejoin: "+F.wireframeLinejoin):N.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+F.opacity);i.appendChild(N)}}else if(A instanceof THREE.RenderableFace4&&(o=A.v1,q=A.v2,n=A.v3,r=A.v4,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,n.positionScreen.x*=p,n.positionScreen.y*=-m,r.positionScreen.x*=p,r.positionScreen.y*=-m,t.addPoint(o.positionScreen.x,
|
|
|
|
-o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var P=o,R=q,E=n,ia=r;d.info.render.vertices+=4;d.info.render.faces++;N=b(S++);N.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+"z");F instanceof THREE.MeshBasicMaterial?
|
|
|
|
-u.copy(F.color):F instanceof THREE.MeshLambertMaterial?w?(u.r=v.r,u.g=v.g,u.b=v.b,a(g,A.centroidWorld,A.normalWorld,u),u.r=Math.max(0,Math.min(F.color.r*u.r,1)),u.g=Math.max(0,Math.min(F.color.g*u.g,1)),u.b=Math.max(0,Math.min(F.color.b*u.b,1))):u.copy(F.color):F instanceof THREE.MeshDepthMaterial?(C=1-F.__2near/(F.__farPlusNear-A.z*F.__farMinusNear),u.setRGB(C,C,C)):F instanceof THREE.MeshNormalMaterial&&u.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));F.wireframe?N.setAttribute("style",
|
|
|
|
-"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+F.wireframeLinewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframeLinecap+"; stroke-linejoin: "+F.wireframeLinejoin):N.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+F.opacity);i.appendChild(N)}}};
|
|
|
|
|
|
+THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var i,k,l,p,n,o,q,m;a=b.projectScene(c,d);for(i=0,k=a.length;i<k;i++)if(n=a[i],n instanceof THREE.RenderableParticle){q=n.x*e+e;m=n.y*f+f;for(l=0,p=n.material.length;l<p;l++)if(o=n.material[l],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=q+"px",o.style.top=m+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}w=a}}function d(a){if(u!=a)m.strokeStyle=u=a}function e(a){if(v!=a)m.fillStyle=v=a}var a=a||{},f=this,g,h,i,k=new THREE.Projector,l=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
|
+p,n,o,q,m=l.getContext("2d"),r=new THREE.Color(0),s=0,t=1,w=0,u=null,v=null,A=null,B=null,C=null,D,I,K,O,S=new THREE.RenderableVertex,L=new THREE.RenderableVertex,P,H,G,j,X,z,E,Q,N,ea,ia,$,aa=new THREE.Color,ba=new THREE.Color,Y=new THREE.Color,ca=new THREE.Color,fa=new THREE.Color,Ua=[],Ka=[],na,Ha,ra,qa,ib,Va,lb,db,Wa,$a,La=new THREE.Rectangle,ta=new THREE.Rectangle,Aa=new THREE.Rectangle,Fa=!1,Ga=new THREE.Color,Xa=new THREE.Color,mb=new THREE.Color,Z=new THREE.Vector3,R,Fb,Uc,eb,pc,Cc,a=16;R=
|
|
|
|
+document.createElement("canvas");R.width=R.height=2;Fb=R.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Uc=Fb.getImageData(0,0,2,2);eb=Uc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);l.width=p;l.height=n;La.set(-o,-q,
|
|
|
|
+o,q);ta.set(-o,-q,o,q);t=1;w=0;C=B=A=v=u=null};this.setClearColor=function(a,b){r.copy(a);s=b;ta.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ta.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);ta.isEmpty()||(ta.minSelf(La),ta.inflate(2),1>s&&m.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
|
+r.b)+","+s+")"),m.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(a,n){function l(a){var b,c,d,e;Ga.setRGB(0,0,0);Xa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Ga.r+=e.r,Ga.g+=e.g,Ga.b+=e.b):d instanceof THREE.DirectionalLight?(Xa.r+=e.r,Xa.g+=e.g,Xa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
|
|
|
|
+f,g,j,h,i;for(e=0,f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),0>=i||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(Z.sub(h,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(h)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function r(a,f,g){b(g.opacity);c(g.blending);var Z,j,h,i,n,k;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=
|
|
|
|
+g.map.image,n=i.width>>1,k=i.height>>1,g=f.scale.x*o,h=f.scale.y*q,Z=g*n,j=h*k,Aa.set(a.x-Z,a.y-j,a.x+Z,a.y+j),La.intersects(Aa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-h),m.translate(-n,-k),m.drawImage(i,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(Z=f.scale.x*o,j=f.scale.y*q,Aa.set(a.x-Z,a.y-j,a.x+Z,a.y+j),La.intersects(Aa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(Z,j),g.program(m),
|
|
|
|
+m.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!=a)m.lineWidth=A=a;a=g.linecap;if(B!=a)m.lineCap=B=a;a=g.linejoin;if(C!=a)m.lineJoin=C=a;d(g.color.getContextStyle());m.stroke();Aa.inflate(2*g.linewidth)}}function t(a,d,e,g,h,k,m,R){f.info.render.vertices+=3;f.info.render.faces++;b(R.opacity);c(R.blending);
|
|
|
|
+P=a.positionScreen.x;H=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;X=e.positionScreen.x;z=e.positionScreen.y;w(P,H,G,j,X,z);if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.mapping instanceof THREE.UVMapping&&(qa=m.uvs[0],Vc(P,H,G,j,X,z,qa[g].u,qa[g].v,qa[h].u,qa[h].v,qa[k].u,qa[k].v,R.map));else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,Z.copy(m.vertexNormalsWorld[g]),ib=0.5*(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)+0.5,Va=0.5*
|
|
|
|
+-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)+0.5,Z.copy(m.vertexNormalsWorld[h]),lb=0.5*(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)+0.5,db=0.5*-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)+0.5,Z.copy(m.vertexNormalsWorld[k]),Wa=0.5*(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)+0.5,$a=0.5*-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)+0.5,Vc(P,H,G,j,X,z,ib,Va,lb,db,Wa,$a,R.envMap)}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshLambertMaterial)R.map&&!R.wireframe&&(R.map.mapping instanceof
|
|
|
|
+THREE.UVMapping&&(qa=m.uvs[0],Vc(P,H,G,j,X,z,qa[g].u,qa[g].v,qa[h].u,qa[h].v,qa[k].u,qa[k].v,R.map)),c(THREE.SubtractiveBlending)),Fa?!R.wireframe&&R.shading==THREE.SmoothShading&&3==m.vertexNormalsWorld.length?(ba.r=Y.r=ca.r=Ga.r,ba.g=Y.g=ca.g=Ga.g,ba.b=Y.b=ca.b=Ga.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ba),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],Y),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ca),ba.r=Math.max(0,Math.min(R.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(R.color.g*ba.g,
|
|
|
|
+1)),ba.b=Math.max(0,Math.min(R.color.b*ba.b,1)),Y.r=Math.max(0,Math.min(R.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(R.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(R.color.b*Y.b,1)),ca.r=Math.max(0,Math.min(R.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(R.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(R.color.b*ca.b,1)),fa.r=0.5*(Y.r+ca.r),fa.g=0.5*(Y.g+ca.g),fa.b=0.5*(Y.b+ca.b),ra=Dc(ba,Y,ca,fa),gc(P,H,G,j,X,z,0,0,1,0,0,1,ra)):(aa.r=Ga.r,aa.g=Ga.g,aa.b=Ga.b,p(i,m.centroidWorld,m.normalWorld,aa),aa.r=Math.max(0,
|
|
|
|
+Math.min(R.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(R.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(R.color.b*aa.b,1)),R.wireframe?Mb(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(aa)):R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshDepthMaterial)na=n.near,Ha=n.far,ba.r=ba.g=ba.b=1-ac(a.positionScreen.z,na,Ha),Y.r=Y.g=Y.b=1-ac(d.positionScreen.z,na,Ha),ca.r=ca.g=ca.b=1-ac(e.positionScreen.z,na,Ha),fa.r=
|
|
|
|
+0.5*(Y.r+ca.r),fa.g=0.5*(Y.g+ca.g),fa.b=0.5*(Y.b+ca.b),ra=Dc(ba,Y,ca,fa),gc(P,H,G,j,X,z,0,0,1,0,0,1,ra);else if(R instanceof THREE.MeshNormalMaterial)aa.r=hc(m.normalWorld.x),aa.g=hc(m.normalWorld.y),aa.b=hc(m.normalWorld.z),R.wireframe?Mb(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(aa)}function u(a,d,e,g,Z,h,R,m,k){f.info.render.vertices+=4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap)t(a,d,g,0,1,3,R,m,k),t(Z,e,h,1,2,3,R,m,k);else if(P=a.positionScreen.x,
|
|
|
|
+H=a.positionScreen.y,G=d.positionScreen.x,j=d.positionScreen.y,X=e.positionScreen.x,z=e.positionScreen.y,E=g.positionScreen.x,Q=g.positionScreen.y,N=Z.positionScreen.x,ea=Z.positionScreen.y,ia=h.positionScreen.x,$=h.positionScreen.y,m instanceof THREE.MeshBasicMaterial)v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)Fa?!m.wireframe&&m.shading==THREE.SmoothShading&&4==R.vertexNormalsWorld.length?
|
|
|
|
+(ba.r=Y.r=ca.r=fa.r=Ga.r,ba.g=Y.g=ca.g=fa.g=Ga.g,ba.b=Y.b=ca.b=fa.b=Ga.b,p(i,R.v1.positionWorld,R.vertexNormalsWorld[0],ba),p(i,R.v2.positionWorld,R.vertexNormalsWorld[1],Y),p(i,R.v4.positionWorld,R.vertexNormalsWorld[3],ca),p(i,R.v3.positionWorld,R.vertexNormalsWorld[2],fa),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),Y.r=Math.max(0,Math.min(m.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(m.color.g*Y.g,1)),Y.b=Math.max(0,
|
|
|
|
+Math.min(m.color.b*Y.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),fa.r=Math.max(0,Math.min(m.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(m.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(m.color.b*fa.b,1)),ra=Dc(ba,Y,ca,fa),w(P,H,G,j,E,Q),gc(P,H,G,j,E,Q,0,0,1,0,0,1,ra),w(N,ea,X,z,ia,$),gc(N,ea,X,z,ia,$,1,0,1,1,0,1,ra)):(aa.r=Ga.r,aa.g=Ga.g,aa.b=Ga.b,p(i,R.centroidWorld,R.normalWorld,aa),aa.r=Math.max(0,Math.min(m.color.r*
|
|
|
|
+aa.r,1)),aa.g=Math.max(0,Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(aa,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(aa)):(v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color));else if(m instanceof THREE.MeshNormalMaterial)aa.r=hc(R.normalWorld.x),aa.g=hc(R.normalWorld.y),aa.b=hc(R.normalWorld.z),v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(aa,m.wireframeLinewidth,m.wireframeLinecap,
|
|
|
|
+m.wireframeLinejoin):Gb(aa);else if(m instanceof THREE.MeshDepthMaterial)na=n.near,Ha=n.far,ba.r=ba.g=ba.b=1-ac(a.positionScreen.z,na,Ha),Y.r=Y.g=Y.b=1-ac(d.positionScreen.z,na,Ha),ca.r=ca.g=ca.b=1-ac(g.positionScreen.z,na,Ha),fa.r=fa.g=fa.b=1-ac(e.positionScreen.z,na,Ha),ra=Dc(ba,Y,ca,fa),w(P,H,G,j,E,Q),gc(P,H,G,j,E,Q,0,0,1,0,0,1,ra),w(N,ea,X,z,ia,$),gc(N,ea,X,z,ia,$,1,0,1,1,0,1,ra)}function w(a,b,c,d,e,g){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,g);m.lineTo(a,b);m.closePath()}function v(a,
|
|
|
|
+b,c,d,e,g,f,Z){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,g);m.lineTo(f,Z);m.lineTo(a,b);m.closePath()}function Mb(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(B!=c)m.lineCap=B=c;if(C!=e)m.lineJoin=C=e;d(a.getContextStyle());m.stroke();Aa.inflate(2*b)}function Gb(a){e(a.getContextStyle());m.fill()}function Vc(a,b,c,d,g,f,Z,j,h,i,R,n,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Ua[k.id]){var l=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Ua[k.id]=m.createPattern(k.image,
|
|
|
|
+l&&o?"repeat":l&&!o?"repeat-x":!l&&o?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Ua[k.id]);var l=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,Fb=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,Z=(Z+l)*Fb,j=(j+o)*p,c=c-a,d=d-b,g=g-a,f=f-b,h=(h+l)*Fb-Z,i=(i+o)*p-j,R=(R+l)*Fb-Z,n=(n+o)*p-j,l=h*n-R*i;if(0==l){if(void 0===Ka[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),Ka[k.id]=b.getImageData(0,0,k.image.width,
|
|
|
|
+k.image.height).data;b=Ka[k.id];Z=4*(Math.floor(Z)+Math.floor(j)*k.image.width);aa.setRGB(b[Z]/255,b[Z+1]/255,b[Z+2]/255);Gb(aa)}else l=1/l,k=(n*c-i*g)*l,i=(n*d-i*f)*l,c=(h*g-R*c)*l,d=(h*f-R*d)*l,a=a-k*Z-c*j,Z=b-i*Z-d*j,m.save(),m.transform(k,i,c,d,a,Z),m.fill(),m.restore()}}function gc(a,b,c,d,e,g,f,Z,j,h,i,R,k){var n,l;n=k.width-1;l=k.height-1;f*=n;Z*=l;c-=a;d-=b;e-=a;g-=b;j=j*n-f;h=h*l-Z;i=i*n-f;R=R*l-Z;l=1/(j*R-i*h);n=(R*c-h*e)*l;h=(R*d-h*g)*l;c=(j*e-i*c)*l;d=(j*g-i*d)*l;a=a-n*f-c*Z;b=b-h*f-d*
|
|
|
|
+Z;m.save();m.transform(n,h,c,d,a,b);m.clip();m.drawImage(k,0,0);m.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),g=~~(255*a.g),a=~~(255*a.b),f=~~(255*b.r),Z=~~(255*b.g),b=~~(255*b.b),j=~~(255*c.r),h=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),m=~~(255*d.g),d=~~(255*d.b);eb[0]=0>e?0:255<e?255:e;eb[1]=0>g?0:255<g?255:g;eb[2]=0>a?0:255<a?255:a;eb[4]=0>f?0:255<f?255:f;eb[5]=0>Z?0:255<Z?255:Z;eb[6]=0>b?0:255<b?255:b;eb[8]=0>j?0:255<j?255:j;eb[9]=0>h?0:255<h?255:h;eb[10]=0>c?0:255<c?255:c;eb[12]=0>i?0:255<
|
|
|
|
+i?255:i;eb[13]=0>m?0:255<m?255:m;eb[14]=0>d?0:255<d?255:d;Fb.putImageData(Uc,0,0);Cc.drawImage(R,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,fd,Pa,jb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,n,this.sortElements);h=g.elements;i=
|
|
|
|
+g.lights;(Fa=0<i.length)&&l(i);for(Ec=0,fd=h.length;Ec<fd;Ec++)if(Pa=h[Ec],jb=Pa.material,jb=jb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:jb,!(null==jb||0==jb.opacity)){Aa.empty();if(Pa instanceof THREE.RenderableParticle)D=Pa,D.x*=o,D.y*=q,r(D,Pa,jb,a);else if(Pa instanceof THREE.RenderableLine)D=Pa.v1,I=Pa.v2,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,Aa.addPoint(D.positionScreen.x,D.positionScreen.y),Aa.addPoint(I.positionScreen.x,I.positionScreen.y),
|
|
|
|
+La.intersects(Aa)&&s(D,I,Pa,jb,a);else if(Pa instanceof THREE.RenderableFace3)D=Pa.v1,I=Pa.v2,K=Pa.v3,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,jb.overdraw&&(Nb(D.positionScreen,I.positionScreen),Nb(I.positionScreen,K.positionScreen),Nb(K.positionScreen,D.positionScreen)),Aa.add3Points(D.positionScreen.x,D.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),La.intersects(Aa)&&
|
|
|
|
+t(D,I,K,0,1,2,Pa,jb,a);else if(Pa instanceof THREE.RenderableFace4)D=Pa.v1,I=Pa.v2,K=Pa.v3,O=Pa.v4,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,S.positionScreen.copy(I.positionScreen),L.positionScreen.copy(O.positionScreen),jb.overdraw&&(Nb(D.positionScreen,I.positionScreen),Nb(I.positionScreen,O.positionScreen),Nb(O.positionScreen,D.positionScreen),Nb(K.positionScreen,
|
|
|
|
+S.positionScreen),Nb(K.positionScreen,L.positionScreen)),Aa.addPoint(D.positionScreen.x,D.positionScreen.y),Aa.addPoint(I.positionScreen.x,I.positionScreen.y),Aa.addPoint(K.positionScreen.x,K.positionScreen.y),Aa.addPoint(O.positionScreen.x,O.positionScreen.y),La.intersects(Aa)&&u(D,I,K,O,S,L,Pa,jb,a);ta.addRectangle(Aa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,m;for(e=0,g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),m=c.dot(i),0>=m||(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),m=c.dot(D.sub(i,b).normalize()),0>=m||(m*=0==f.distance?1:1-Math.min(b.distanceTo(i)/f.distance,1),0!=m&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){null==I[a]&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"path"),0==P&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,p,n,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,w=!1,u=new THREE.Color,v=new THREE.Color,A=new THREE.Color,B=new THREE.Color,C,D=new THREE.Vector3,I=[],K=[],O,S,L,P=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":P=1;break;case "low":P=0}};this.setSize=function(a,b){k=a;l=b;p=k/2;n=l/2;i.setAttribute("viewBox",-p+" "+-n+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var j,D,z,E;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);f=e.elements;
|
|
|
|
+g=e.lights;L=S=0;if(w=0<g.length){v.setRGB(0,0,0);A.setRGB(0,0,0);B.setRGB(0,0,0);for(j=0,D=g.length;j<D;j++)E=g[j],z=E.color,E instanceof THREE.AmbientLight?(v.r+=z.r,v.g+=z.g,v.b+=z.b):E instanceof THREE.DirectionalLight?(A.r+=z.r,A.g+=z.g,A.b+=z.b):E instanceof THREE.PointLight&&(B.r+=z.r,B.g+=z.g,B.b+=z.b)}for(j=0,D=f.length;j<D;j++)if(z=f[j],E=z.material,E=E instanceof THREE.MeshFaceMaterial?z.faceMaterial:E,!(null==E||0==E.opacity))if(t.empty(),z instanceof THREE.RenderableParticle)o=z,o.x*=
|
|
|
|
+p,o.y*=-n;else if(z instanceof THREE.RenderableLine){if(o=z.v1,q=z.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){z=o;var Q=q,N=L++;null==K[N]&&(K[N]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==P&&K[N].setAttribute("shape-rendering","crispEdges"));O=K[N];O.setAttribute("x1",z.positionScreen.x);O.setAttribute("y1",z.positionScreen.y);
|
|
|
|
+O.setAttribute("x2",Q.positionScreen.x);O.setAttribute("y2",Q.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+E.color.getContextStyle()+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin),i.appendChild(O))}}else if(z instanceof THREE.RenderableFace3){if(o=z.v1,q=z.v2,m=z.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
|
|
|
|
+p,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var Q=o,N=q,I=m;d.info.render.vertices+=3;d.info.render.faces++;O=b(S++);O.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?u.copy(E.color):E instanceof THREE.MeshLambertMaterial?
|
|
|
|
+w?(u.r=v.r,u.g=v.g,u.b=v.b,a(g,z.centroidWorld,z.normalWorld,u),u.r=Math.max(0,Math.min(E.color.r*u.r,1)),u.g=Math.max(0,Math.min(E.color.g*u.g,1)),u.b=Math.max(0,Math.min(E.color.b*u.b,1))):u.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-z.z*E.__farMinusNear),u.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&u.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));E.wireframe?O.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
|
|
|
|
+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(O)}}else if(z instanceof THREE.RenderableFace4&&(o=z.v1,q=z.v2,m=z.v3,r=z.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=p,m.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
|
|
|
|
+o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var Q=o,N=q,I=m,ia=r;d.info.render.vertices+=4;d.info.render.faces++;O=b(S++);O.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?
|
|
|
|
+u.copy(E.color):E instanceof THREE.MeshLambertMaterial?w?(u.r=v.r,u.g=v.g,u.b=v.b,a(g,z.centroidWorld,z.normalWorld,u),u.r=Math.max(0,Math.min(E.color.r*u.r,1)),u.g=Math.max(0,Math.min(E.color.g*u.g,1)),u.b=Math.max(0,Math.min(E.color.b*u.b,1))):u.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-z.z*E.__farMinusNear),u.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&u.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));E.wireframe?O.setAttribute("style",
|
|
|
|
+"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(O)}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
@@ -235,125 +236,126 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragme
|
|
THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
|
|
-var i=a.colors,k=i.length,m=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){$a.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Sa.copy(e),$a.multiplyVector3(Sa),l[d]=[Sa.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[l[d][1]].position,f=3*d,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;for(d=0;d<k;d++)f=3*d,e=i[l[d][1]],n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],
|
|
|
|
|
|
+var i=a.colors,m=i.length,k=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){Wa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,$a.copy(e),Wa.multiplyVector3($a),l[d]=[$a.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[l[d][1]].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<m;d++)f=3*d,e=i[l[d][1]],n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(q)for(i=0,m=q.length;i<m;i++)if(h=q[i],
|
|
void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=l[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],
|
|
void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=l[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],
|
|
-h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=3*d,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;if(p)for(d=0;d<k;d++)e=i[d],f=3*d,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
|
|
|
|
-h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,m,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
-n,b);if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ea=A=null,P=R=aa=U=ba=-1,a[d].render(b,c,lb,eb),ea=A=null,P=R=aa=U=ba=-1}function i(a,b,c,d,e,f,g,h){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var n=i;n!==b;n+=m)if(j=a[n],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;
|
|
|
|
-g&&H.setBlending(j.blending);H.setDepthTest(j.depthTest);H.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}H.setObjectFaces(i);k instanceof THREE.BufferGeometry?H.renderBufferDirect(d,e,f,j,k,i):H.renderBuffer(d,e,f,j,k,i)}}function k(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&H.setBlending(h.blending);H.setDepthTest(h.depthTest);H.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
|
-h.polygonOffsetUnits)}H.renderImmediateObject(c,d,e,h,j)}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){d.program||H.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
|
-!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets);for(var f=0,g=H.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==A&&(j.useProgram(f),A=f,h=!0);if(d.id!==P)P=d.id,h=!0;if(h||a!==ea)j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==ea&&(ea=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
|
|
|
|
-THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var k,m=0,n=0,l=0,o,p,q,r=ya,s=r.directional.colors,t=r.directional.positions,F=r.point.colors,u=r.point.positions,v=r.point.distances,B=0,C=0,R=q=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],!k.onlyShadow)if(o=k.color,p=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)H.gammaInput?(m+=o.r*o.r,n+=o.g*o.g,l+=o.b*o.b):(m+=o.r,n+=o.g,l+=o.b);else if(k instanceof THREE.DirectionalLight)q=
|
|
|
|
-3*B,H.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),Fa.copy(k.matrixWorld.getPosition()),Fa.subSelf(k.target.matrixWorld.getPosition()),Fa.normalize(),t[q]=Fa.x,t[q+1]=Fa.y,t[q+2]=Fa.z,B+=1;else if(k instanceof THREE.PointLight||k instanceof THREE.SpotLight)R=3*C,H.gammaInput?(F[R]=o.r*o.r*p*p,F[R+1]=o.g*o.g*p*p,F[R+2]=o.b*o.b*p*p):(F[R]=o.r*p,F[R+1]=o.g*p,F[R+2]=o.b*p),k=k.matrixWorld.getPosition(),u[R]=k.x,u[R+1]=k.y,u[R+2]=k.z,v[C]=q,
|
|
|
|
-C+=1;for(c=3*B,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=F.length;c<h;c++)F[c]=0;r.point.length=C;r.directional.length=B;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=l;c=ya;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
|
-d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,H.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
|
|
|
|
-d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=D.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,H.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
|
|
|
|
-(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)H.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=
|
|
|
|
-c=0;for(m=b.length;h<m;h++)if(n=b[h],n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&!n.shadowCascade))i.shadowMap.texture[c]=n.shadowMap,i.shadowMapSize.value[c]=n.shadowMapSize,i.shadowMatrix.value[c]=n.shadowMatrix,i.shadowDarkness.value[c]=n.shadowDarkness,i.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],l=h.type,m=h.value,"i"===l)j.uniform1i(n,m);else if("f"===l)j.uniform1f(n,m);else if("v2"===
|
|
|
|
-l)j.uniform2f(n,m.x,m.y);else if("v3"===l)j.uniform3f(n,m.x,m.y,m.z);else if("v4"===l)j.uniform4f(n,m.x,m.y,m.z,m.w);else if("c"===l)j.uniform3f(n,m.r,m.g,m.b);else if("fv1"===l)j.uniform1fv(n,m);else if("fv"===l)j.uniform3fv(n,m);else if("v2v"===l){if(!h._array)h._array=new Float32Array(2*m.length);for(l=0,r=m.length;l<r;l++)s=2*l,h._array[s]=m[l].x,h._array[s+1]=m[l].y;j.uniform2fv(n,h._array)}else if("v3v"===l){if(!h._array)h._array=new Float32Array(3*m.length);for(l=0,r=m.length;l<r;l++)s=3*l,
|
|
|
|
-h._array[s]=m[l].x,h._array[s+1]=m[l].y,h._array[s+2]=m[l].z;j.uniform3fv(n,h._array)}else if("v4v"==l){if(!h._array)h._array=new Float32Array(4*m.length);for(l=0,r=m.length;l<r;l++)s=4*l,h._array[s]=m[l].x,h._array[s+1]=m[l].y,h._array[s+2]=m[l].z,h._array[s+3]=m[l].w;j.uniform4fv(n,h._array)}else if("m4"===l){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===l){if(!h._array)h._array=new Float32Array(16*m.length);for(l=0,r=m.length;l<
|
|
|
|
-r;l++)m[l].flattenToArrayOffset(h._array,16*l);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===l){if(j.uniform1i(n,m),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+m);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(n=0;6>n;n++){l=m;r=n;if(H.autoScaleCubemaps){if(s=h.image[n],F=Qa,!(s.width<=F&&s.height<=F))u=Math.max(s.width,
|
|
|
|
-s.height),t=Math.floor(s.width*F/u),F=Math.floor(s.height*F/u),u=document.createElement("canvas"),u.width=t,u.height=F,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,F),s=u}else s=h.image[n];l[r]=s}n=m[0];l=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=y(h.format);s=y(h.type);w(j.TEXTURE_CUBE_MAP,h,l);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,m[n]);h.generateMipmaps&&l&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
|
|
|
|
-m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):H.setTexture(n,m)}else if("tv"===l){if(!h._array){h._array=[];for(l=0,r=h.texture.length;l<r;l++)h._array[l]=m+l}j.uniform1iv(n,h._array);for(l=0,r=h.texture.length;l<r;l++)(n=h.texture[l])&&H.setTexture(n,h._array[l])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
|
|
|
|
|
|
+h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(p)for(d=0;d<m;d++)e=i[d],f=3*d,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(q)for(i=0,m=q.length;i<m;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
|
|
|
|
+h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
+n,b);if(q)for(i=0,m=q.length;i<m;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ea=z=null,Q=N=ca=Y=ba=-1,a[d].render(b,c,Va,lb),ea=z=null,Q=N=ca=Y=ba=-1}function i(a,b,c,d,e,f,g,h){var j,i,m,k;b?(i=a.length-1,k=b=-1):(i=0,b=a.length,k=1);for(var n=i;n!==b;n+=k)if(j=a[n],j.render){i=j.object;m=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;
|
|
|
|
+g&&G.setBlending(j.blending);G.setDepthTest(j.depthTest);G.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}G.setObjectFaces(i);m instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,j,m,i):G.renderBuffer(d,e,f,j,m,i)}}function k(a,b,c,d,e,f,g){for(var h,j,i=0,m=a.length;i<m;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
|
+h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,j)}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||G.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
|
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,g=G.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==z&&(j.useProgram(f),z=f,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h||a!==ea)j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==ea&&(ea=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
|
|
|
|
+THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var m,k=0,n=0,l=0,o,p,q,r=ta,s=r.directional.colors,t=r.directional.positions,E=r.point.colors,u=r.point.positions,v=r.point.distances,D=0,C=0,N=q=0;for(c=0,h=b.length;c<h;c++)if(m=b[c],!m.onlyShadow)if(o=m.color,p=m.intensity,q=m.distance,m instanceof THREE.AmbientLight)G.gammaInput?(k+=o.r*o.r,n+=o.g*o.g,l+=o.b*o.b):(k+=o.r,n+=o.g,l+=o.b);else if(m instanceof THREE.DirectionalLight)q=
|
|
|
|
+3*D,G.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),La.copy(m.matrixWorld.getPosition()),La.subSelf(m.target.matrixWorld.getPosition()),La.normalize(),t[q]=La.x,t[q+1]=La.y,t[q+2]=La.z,D+=1;else if(m instanceof THREE.PointLight||m instanceof THREE.SpotLight)N=3*C,G.gammaInput?(E[N]=o.r*o.r*p*p,E[N+1]=o.g*o.g*p*p,E[N+2]=o.b*o.b*p*p):(E[N]=o.r*p,E[N+1]=o.g*p,E[N+2]=o.b*p),m=m.matrixWorld.getPosition(),u[N]=m.x,u[N+1]=m.y,u[N+2]=m.z,v[C]=q,
|
|
|
|
+C+=1;for(c=3*D,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=E.length;c<h;c++)E[c]=0;r.point.length=C;r.directional.length=D;r.ambient[0]=k;r.ambient[1]=n;r.ambient[2]=l;c=ta;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
|
+d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,G.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
|
|
|
|
+d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=B.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,G.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
|
|
|
|
+(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)G.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=
|
|
|
|
+c=0;for(k=b.length;h<k;h++)if(n=b[h],n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&!n.shadowCascade))i.shadowMap.texture[c]=n.shadowMap,i.shadowMapSize.value[c]=n.shadowMapSize,i.shadowMatrix.value[c]=n.shadowMatrix,i.shadowDarkness.value[c]=n.shadowDarkness,i.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],l=h.type,k=h.value,"i"===l)j.uniform1i(n,k);else if("f"===l)j.uniform1f(n,k);else if("v2"===
|
|
|
|
+l)j.uniform2f(n,k.x,k.y);else if("v3"===l)j.uniform3f(n,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(n,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(n,k.r,k.g,k.b);else if("fv1"===l)j.uniform1fv(n,k);else if("fv"===l)j.uniform3fv(n,k);else if("v2v"===l){if(!h._array)h._array=new Float32Array(2*k.length);for(l=0,r=k.length;l<r;l++)s=2*l,h._array[s]=k[l].x,h._array[s+1]=k[l].y;j.uniform2fv(n,h._array)}else if("v3v"===l){if(!h._array)h._array=new Float32Array(3*k.length);for(l=0,r=k.length;l<r;l++)s=3*l,
|
|
|
|
+h._array[s]=k[l].x,h._array[s+1]=k[l].y,h._array[s+2]=k[l].z;j.uniform3fv(n,h._array)}else if("v4v"==l){if(!h._array)h._array=new Float32Array(4*k.length);for(l=0,r=k.length;l<r;l++)s=4*l,h._array[s]=k[l].x,h._array[s+1]=k[l].y,h._array[s+2]=k[l].z,h._array[s+3]=k[l].w;j.uniform4fv(n,h._array)}else if("m4"===l){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===l){if(!h._array)h._array=new Float32Array(16*k.length);for(l=0,r=k.length;l<
|
|
|
|
+r;l++)k[l].flattenToArrayOffset(h._array,16*l);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===l){if(j.uniform1i(n,k),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(n=0;6>n;n++){l=k;r=n;if(G.autoScaleCubemaps){if(s=h.image[n],E=Fa,!(s.width<=E&&s.height<=E))u=Math.max(s.width,
|
|
|
|
+s.height),t=Math.floor(s.width*E/u),E=Math.floor(s.height*E/u),u=document.createElement("canvas"),u.width=t,u.height=E,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,E),s=u}else s=h.image[n];l[r]=s}n=k[0];l=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=A(h.format);s=A(h.type);w(j.TEXTURE_CUBE_MAP,h,l);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,k[n]);h.generateMipmaps&&l&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
|
|
|
|
+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):G.setTexture(n,k)}else if("tv"===l){if(!h._array){h._array=[];for(l=0,r=h.texture.length;l<r;l++)h._array[l]=k+l}j.uniform1iv(n,h._array);for(l=0,r=h.texture.length;l<r;l++)(n=h.texture[l])&&G.setTexture(n,h._array[l])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
|
|
null!==g.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);
|
|
null!==g.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);
|
|
-(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){ha!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ha=a);if(a&&(Ta!==b||oa!==c))j.polygonOffset(b,
|
|
|
|
-c),Ta=b,oa=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function w(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,y(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,y(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,y(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,y(b.minFilter))):
|
|
|
|
|
|
+(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){fa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),fa=a);if(a&&(Ua!==b||Ka!==c))j.polygonOffset(b,
|
|
|
|
+c),Ua=b,Ka=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function w(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):
|
|
(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)))}function u(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)))}function u(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
-j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function y(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
|
|
|
|
|
|
+j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
|
|
case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
|
|
case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
|
|
-case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",B=void 0!==a.alpha?a.alpha:!0,E=void 0!==a.premultipliedAlpha?
|
|
|
|
-a.premultipliedAlpha:!0,J=void 0!==a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,S=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,K=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),O=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
|
|
|
|
-this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var H=this,j,Z=[],A=null,F=null,P=-1,R=null,ea=null,ia=0,ca=null,V=null,ba=null,U=null,aa=null,
|
|
|
|
-ha=null,Ta=null,oa=null,Ka=null,Ea=0,Ba=0,ka=0,db=0,lb=0,eb=0,Za=new THREE.Frustum,$a=new THREE.Matrix4,Sa=new THREE.Vector4,Fa=new THREE.Vector3,ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{alpha:B,premultipliedAlpha:E,antialias:J,stencil:N,preserveDrawingBuffer:S})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+
|
|
|
|
-" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(K.r,K.g,K.b,O);this.context=j;var za=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
|
-j.getParameter(j.MAX_TEXTURE_SIZE);var Qa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<za};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,0,D.width,D.height)};this.setViewport=function(a,b,c,d){Ea=a;Ba=b;ka=c;db=d;j.viewport(Ea,Ba,ka,db)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
|
-function(a,b){K.setHex(a);O=b;j.clearColor(K.r,K.g,K.b,O)};this.setClearColor=function(a,b){K.copy(a);O=b;j.clearColor(K.r,K.g,K.b,O)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
|
|
|
|
|
|
+case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",D=void 0!==a.alpha?a.alpha:!0,I=void 0!==a.premultipliedAlpha?
|
|
|
|
+a.premultipliedAlpha:!0,K=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,S=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),P=void 0!==a.clearAlpha?a.clearAlpha:0,H=void 0!==a.maxLights?a.maxLights:4;this.domElement=B;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
|
|
|
|
+this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,j,X=[],z=null,E=null,Q=-1,N=null,ea=null,ia=0,$=null,aa=null,ba=null,Y=null,ca=null,
|
|
|
|
+fa=null,Ua=null,Ka=null,na=null,Ha=0,ra=0,qa=0,ib=0,Va=0,lb=0,db=new THREE.Frustum,Wa=new THREE.Matrix4,$a=new THREE.Vector4,La=new THREE.Vector3,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=B.getContext("experimental-webgl",{alpha:D,premultipliedAlpha:I,antialias:K,stencil:O,preserveDrawingBuffer:S})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+
|
|
|
|
+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,P);this.context=j;var Aa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
|
+j.getParameter(j.MAX_TEXTURE_SIZE);var Fa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Aa};this.setSize=function(a,b){B.width=a;B.height=b;this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,b,c,d){Ha=a;ra=b;qa=c;ib=d;j.viewport(Ha,ra,qa,ib)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
|
+function(a,b){L.setHex(a);P=b;j.clearColor(L.r,L.g,L.b,P)};this.setClearColor=function(a,b){L.copy(a);P=b;j.clearColor(L.r,L.g,L.b,P)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return P};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
|
|
this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);
|
|
this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);
|
|
-j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]),j.deleteBuffer(c.__webglMorphNormalsBuffers[d]);
|
|
|
|
-if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
|
-a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),H.info.memory.textures--};this.updateShadowMap=function(a,b){A=null;P=R=aa=U=ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
|
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,m,n,l,o=3*a.count;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=c[l+2],g=c[l+3],i=c[l+4],m=c[l+5],h=c[l+6],k=c[l+7],n=c[l+8],d=(d+g+h)/3,e=(e+i+k)/3,f=
|
|
|
|
-(f+m+n)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,c[l+6]=d,c[l+7]=e,c[l+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=n(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==R&&(R=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;
|
|
|
|
-for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,
|
|
|
|
-!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),H.info.render.calls++,H.info.render.vertices+=f[d].count,H.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,
|
|
|
|
-b,c,d,e,f){if(0!==d.opacity){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==R&&(R=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
-e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]),j.vertexAttribPointer(c["morphNormal"+g],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=
|
|
|
|
-h[i[g]],g++}else{var i=[],k=-1,m=0;h=f.morphTargetInfluences;var l,o=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(l=0;l<o;l++)!i[l]&&h[l]>k&&(m=l,k=h[m]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m]),j.vertexAttribPointer(c["morphNormal"+g],3,j.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=
|
|
|
|
-k;i[m]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
|
|
|
|
-3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
|
|
|
|
-j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
|
|
|
|
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Ka&&(j.lineWidth(d),Ka=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),H.info.render.calls++,H.info.render.vertices+=
|
|
|
|
-e.__webglFaceCount,H.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==Ka&&(j.lineWidth(d),Ka=d),j.drawArrays(f,0,e.__webglLineCount),H.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),H.info.render.calls++,H.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),H.info.render.calls++)}};this.render=
|
|
|
|
-function(a,b,c,d){var e,f,m,l,n=a.lights,o=a.fog;P=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
|
|
|
|
-if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);$a.multiply(b.projectionMatrix,b.matrixWorldInverse);Za.setFromMatrix($a);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;for(d=0,e=l.length;d<e;d++)if(f=l[d],m=f.object,f.render=!1,m.visible&&(!(m instanceof THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||Za.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);
|
|
|
|
-r(m,b);var p=f,q=p.object,t=p.buffer,F=void 0,F=F=void 0,F=q.material;if(F instanceof THREE.MeshFaceMaterial){if(F=t.materialIndex,0<=F)F=q.geometry.materials[F],F.transparent?(p.transparent=F,p.opaque=null):(p.opaque=F,p.transparent=null)}else if(F)F.transparent?(p.transparent=F,p.opaque=null):(p.opaque=F,p.transparent=null);f.render=!0;if(this.sortObjects)m.renderDepth?f.z=m.renderDepth:(Sa.copy(m.position),$a.multiplyVector3(Sa),f.z=Sa.z)}this.sortObjects&&l.sort(g);l=a.__webglObjectsImmediate;
|
|
|
|
-for(d=0,e=l.length;d<e;d++)if(f=l[d],m=f.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=f.object.material,m.transparent?(f.transparent=m,f.opaque=null):(f.opaque=m,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),
|
|
|
|
-i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,"transparent",b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?
|
|
|
|
-(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=n(a,b,c,d,e);R=-1;H.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Za):e.render(function(a){H.renderBufferImmediate(a,f,d.shading)})};
|
|
|
|
-this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,k=void 0,n=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(k=
|
|
|
|
-g.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var r=k,s=void 0,t=void 0,F=void 0,u=void 0,w=void 0,v=void 0,A=void 0,P={},C=r.morphTargets.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)F=r.faces[s],u=F.materialIndex,v=void 0!==u?u:-1,void 0===P[v]&&(P[v]={hash:v,counter:0}),A=P[v].hash+"_"+P[v].counter,void 0===r.geometryGroups[A]&&(r.geometryGroups[A]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C}),w=F instanceof THREE.Face3?3:4,65535<r.geometryGroups[A].vertices+
|
|
|
|
-w&&(P[v].counter+=1,A=P[v].hash+"_"+P[v].counter,void 0===r.geometryGroups[A]&&(r.geometryGroups[A]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C})),F instanceof THREE.Face3?r.geometryGroups[A].faces3.push(s):r.geometryGroups[A].faces4.push(s),r.geometryGroups[A].vertices+=w;r.geometryGroupsList=[];var B=void 0;for(B in r.geometryGroups)r.geometryGroups[B].id=ia++,r.geometryGroupsList.push(r.geometryGroups[B])}for(i in k.geometryGroups)if(n=k.geometryGroups[i],!n.__webglVertexBuffer){var y=
|
|
|
|
-n;y.__webglVertexBuffer=j.createBuffer();y.__webglNormalBuffer=j.createBuffer();y.__webglTangentBuffer=j.createBuffer();y.__webglColorBuffer=j.createBuffer();y.__webglUVBuffer=j.createBuffer();y.__webglUV2Buffer=j.createBuffer();y.__webglSkinVertexABuffer=j.createBuffer();y.__webglSkinVertexBBuffer=j.createBuffer();y.__webglSkinIndicesBuffer=j.createBuffer();y.__webglSkinWeightsBuffer=j.createBuffer();y.__webglFaceBuffer=j.createBuffer();y.__webglLineBuffer=j.createBuffer();if(y.numMorphTargets){var R=
|
|
|
|
-void 0,D=void 0;y.__webglMorphTargetsBuffers=[];y.__webglMorphNormalsBuffers=[];for(R=0,D=y.numMorphTargets;R<D;R++)y.__webglMorphTargetsBuffers.push(j.createBuffer()),y.__webglMorphNormalsBuffers.push(j.createBuffer())}H.info.memory.geometries++;var E=n,M=g,K=M.geometry,J=E.faces3,ea=E.faces4,V=3*J.length+4*ea.length,ca=1*J.length+2*ea.length,N=3*J.length+4*ea.length,U=c(M,E),ba=e(U),aa=d(U),O=U.vertexColors?U.vertexColors:!1;E.__vertexArray=new Float32Array(3*V);if(aa)E.__normalArray=new Float32Array(3*
|
|
|
|
-V);if(K.hasTangents)E.__tangentArray=new Float32Array(4*V);if(O)E.__colorArray=new Float32Array(3*V);if(ba){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)E.__uvArray=new Float32Array(2*V);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)E.__uv2Array=new Float32Array(2*V)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length)E.__skinVertexAArray=new Float32Array(4*V),E.__skinVertexBArray=new Float32Array(4*V),E.__skinIndexArray=new Float32Array(4*V),E.__skinWeightArray=new Float32Array(4*
|
|
|
|
-V);E.__faceArray=new Uint16Array(3*ca);E.__lineArray=new Uint16Array(2*N);if(E.numMorphTargets){E.__morphTargetsArrays=[];E.__morphNormalsArrays=[];for(var S=0,ha=E.numMorphTargets;S<ha;S++)E.__morphTargetsArrays.push(new Float32Array(3*V)),E.__morphNormalsArrays.push(new Float32Array(3*V))}E.__webglFaceCount=3*ca;E.__webglLineCount=2*N;if(U.attributes){if(void 0===E.__webglCustomAttributesList)E.__webglCustomAttributesList=[];var Z=void 0;for(Z in U.attributes){var Ta=U.attributes[Z],oa={},Ka;for(Ka in Ta)oa[Ka]=
|
|
|
|
-Ta[Ka];if(!oa.__webglInitialized||oa.createUniqueBuffers){oa.__webglInitialized=!0;var ka=1;"v2"===oa.type?ka=2:"v3"===oa.type?ka=3:"v4"===oa.type?ka=4:"c"===oa.type&&(ka=3);oa.size=ka;oa.array=new Float32Array(V*ka);oa.buffer=j.createBuffer();oa.buffer.belongsToAttribute=Z;Ta.needsUpdate=!0;oa.__original=Ta}E.__webglCustomAttributesList.push(oa)}}E.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=
|
|
|
|
-!0}}}else if(g instanceof THREE.Ribbon){if(k=g.geometry,!k.__webglVertexBuffer){var Ba=k;Ba.__webglVertexBuffer=j.createBuffer();Ba.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Ea=k,ya=Ea.vertices.length;Ea.__vertexArray=new Float32Array(3*ya);Ea.__colorArray=new Float32Array(3*ya);Ea.__webglVertexCount=ya;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(k=g.geometry,!k.__webglVertexBuffer){var za=k;za.__webglVertexBuffer=j.createBuffer();za.__webglColorBuffer=
|
|
|
|
-j.createBuffer();H.info.memory.geometries++;var Fa=k,Qa=g,db=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*db);Fa.__colorArray=new Float32Array(3*db);Fa.__webglLineCount=db;b(Fa,Qa);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(k=g.geometry,!k.__webglVertexBuffer)){var $a=k;$a.__webglVertexBuffer=j.createBuffer();$a.__webglColorBuffer=j.createBuffer();H.info.geometries++;var Sa=k,lb=g,eb=Sa.vertices.length;Sa.__vertexArray=new Float32Array(3*eb);Sa.__colorArray=
|
|
|
|
-new Float32Array(3*eb);Sa.__sortArray=[];Sa.__webglParticleCount=eb;b(Sa,lb);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(k=g.geometry,k instanceof THREE.BufferGeometry)l(h.__webglObjects,k,g);else for(i in k.geometryGroups)n=k.geometryGroups[i],l(h.__webglObjects,n,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(k=g.geometry,l(h.__webglObjects,k,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||
|
|
|
|
-g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var gb=a.__objectsRemoved[0],Za=a;gb instanceof THREE.Mesh||gb instanceof THREE.ParticleSystem||gb instanceof THREE.Ribbon||gb instanceof THREE.Line?o(Za.__webglObjects,gb):gb instanceof THREE.Sprite?q(Za.__webglSprites,
|
|
|
|
-gb):gb instanceof THREE.LensFlare?q(Za.__webglFlares,gb):(gb instanceof THREE.MarchingCubes||gb.immediateRenderCallback)&&o(Za.__webglObjectsImmediate,gb);gb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Vc=0,qd=a.__webglObjects.length;Vc<qd;Vc++){var nb=a.__webglObjects[Vc].object,ja=nb.geometry,qc=void 0,ic=void 0,Xa=void 0;if(nb instanceof THREE.Mesh)if(ja instanceof THREE.BufferGeometry)ja.__dirtyVertices=!1,ja.__dirtyElements=!1,ja.__dirtyUvs=!1,ja.__dirtyNormals=!1,ja.__dirtyColors=
|
|
|
|
-!1;else{for(var Wc=0,rd=ja.geometryGroupsList.length;Wc<rd;Wc++)if(qc=ja.geometryGroupsList[Wc],Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),ja.__dirtyVertices||ja.__dirtyMorphTargets||ja.__dirtyElements||ja.__dirtyUvs||ja.__dirtyNormals||ja.__dirtyColors||ja.__dirtyTangents||ic){var fa=qc,sd=nb,ab=j.DYNAMIC_DRAW,td=!ja.dynamic,bc=Xa;if(fa.__inittedArrays){var fd=d(bc),Xc=bc.vertexColors?bc.vertexColors:!1,gd=e(bc),Fc=fd===THREE.SmoothShading,G=void 0,T=void 0,kb=void 0,L=void 0,jc=void 0,Ob=void 0,ob=void 0,
|
|
|
|
-Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,W=void 0,X=void 0,Y=void 0,pa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,la=void 0,hd=void 0,Vb=void 0,mc=void 0,nc=void 0,La=void 0,id=void 0,Ia=void 0,Ja=void 0,Wb=void 0,Ib=void 0,Aa=0,Ga=0,Jb=0,Kb=0,hb=0,Ra=0,qa=0,
|
|
|
|
-Ua=0,Ca=0,I=0,da=0,z=0,bb=void 0,Ma=fa.__vertexArray,wc=fa.__uvArray,xc=fa.__uv2Array,ib=fa.__normalArray,sa=fa.__tangentArray,Na=fa.__colorArray,ta=fa.__skinVertexAArray,ua=fa.__skinVertexBArray,va=fa.__skinIndexArray,wa=fa.__skinWeightArray,Yc=fa.__morphTargetsArrays,Zc=fa.__morphNormalsArrays,$c=fa.__webglCustomAttributesList,x=void 0,Eb=fa.__faceArray,cb=fa.__lineArray,Va=sd.geometry,ud=Va.__dirtyElements,jd=Va.__dirtyUvs,vd=Va.__dirtyNormals,wd=Va.__dirtyTangents,xd=Va.__dirtyColors,yd=Va.__dirtyMorphTargets,
|
|
|
|
-cc=Va.vertices,ma=fa.faces3,na=fa.faces4,Da=Va.faces,ad=Va.faceVertexUvs[0],bd=Va.faceVertexUvs[1],dc=Va.skinVerticesA,ec=Va.skinVerticesB,fc=Va.skinIndices,Xb=Va.skinWeights,Yb=Va.morphTargets,Jc=Va.morphNormals;if(Va.__dirtyVertices){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],W=cc[L.a].position,X=cc[L.b].position,Y=cc[L.c].position,Ma[Ga]=W.x,Ma[Ga+1]=W.y,Ma[Ga+2]=W.z,Ma[Ga+3]=X.x,Ma[Ga+4]=X.y,Ma[Ga+5]=X.z,Ma[Ga+6]=Y.x,Ma[Ga+7]=Y.y,Ma[Ga+8]=Y.z,Ga+=9;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],W=cc[L.a].position,
|
|
|
|
-X=cc[L.b].position,Y=cc[L.c].position,pa=cc[L.d].position,Ma[Ga]=W.x,Ma[Ga+1]=W.y,Ma[Ga+2]=W.z,Ma[Ga+3]=X.x,Ma[Ga+4]=X.y,Ma[Ga+5]=X.z,Ma[Ga+6]=Y.x,Ma[Ga+7]=Y.y,Ma[Ga+8]=Y.z,Ma[Ga+9]=pa.x,Ma[Ga+10]=pa.y,Ma[Ga+11]=pa.z,Ga+=12;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,ab)}if(yd)for(La=0,id=Yb.length;La<id;La++){da=0;for(G=0,T=ma.length;G<T;G++){Wb=ma[G];L=Da[Wb];W=Yb[La].vertices[L.a].position;X=Yb[La].vertices[L.b].position;Y=Yb[La].vertices[L.c].position;Ia=
|
|
|
|
-Yc[La];Ia[da]=W.x;Ia[da+1]=W.y;Ia[da+2]=W.z;Ia[da+3]=X.x;Ia[da+4]=X.y;Ia[da+5]=X.z;Ia[da+6]=Y.x;Ia[da+7]=Y.y;Ia[da+8]=Y.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=tb=sb=Jc[La].faceNormals[Wb],Ja=Zc[La],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z;da+=9}for(G=0,T=na.length;G<T;G++){Wb=na[G];L=Da[Wb];W=Yb[La].vertices[L.a].position;X=Yb[La].vertices[L.b].position;Y=Yb[La].vertices[L.c].position;
|
|
|
|
-pa=Yb[La].vertices[L.d].position;Ia=Yc[La];Ia[da]=W.x;Ia[da+1]=W.y;Ia[da+2]=W.z;Ia[da+3]=X.x;Ia[da+4]=X.y;Ia[da+5]=X.z;Ia[da+6]=Y.x;Ia[da+7]=Y.y;Ia[da+8]=Y.z;Ia[da+9]=pa.x;Ia[da+10]=pa.y;Ia[da+11]=pa.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Jc[La].faceNormals[Wb],Ja=Zc[La],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z,Ja[da+9]=sc.x,Ja[da+10]=sc.y,Ja[da+11]=sc.z;da+=
|
|
|
|
-12}j.bindBuffer(j.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[La]);j.bufferData(j.ARRAY_BUFFER,Yc[La],ab);bc.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[La]),j.bufferData(j.ARRAY_BUFFER,Zc[La],ab))}if(Xb.length){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],yb=Xb[L.a],zb=Xb[L.b],Ab=Xb[L.c],wa[I]=yb.x,wa[I+1]=yb.y,wa[I+2]=yb.z,wa[I+3]=yb.w,wa[I+4]=zb.x,wa[I+5]=zb.y,wa[I+6]=zb.z,wa[I+7]=zb.w,wa[I+8]=Ab.x,wa[I+9]=Ab.y,wa[I+10]=Ab.z,wa[I+11]=Ab.w,Bb=fc[L.a],Cb=fc[L.b],Db=fc[L.c],
|
|
|
|
-va[I]=Bb.x,va[I+1]=Bb.y,va[I+2]=Bb.z,va[I+3]=Bb.w,va[I+4]=Cb.x,va[I+5]=Cb.y,va[I+6]=Cb.z,va[I+7]=Cb.w,va[I+8]=Db.x,va[I+9]=Db.y,va[I+10]=Db.z,va[I+11]=Db.w,Pb=dc[L.a],Qb=dc[L.b],Rb=dc[L.c],ta[I]=Pb.x,ta[I+1]=Pb.y,ta[I+2]=Pb.z,ta[I+3]=1,ta[I+4]=Qb.x,ta[I+5]=Qb.y,ta[I+6]=Qb.z,ta[I+7]=1,ta[I+8]=Rb.x,ta[I+9]=Rb.y,ta[I+10]=Rb.z,ta[I+11]=1,Sb=ec[L.a],Tb=ec[L.b],Ub=ec[L.c],ua[I]=Sb.x,ua[I+1]=Sb.y,ua[I+2]=Sb.z,ua[I+3]=1,ua[I+4]=Tb.x,ua[I+5]=Tb.y,ua[I+6]=Tb.z,ua[I+7]=1,ua[I+8]=Ub.x,ua[I+9]=Ub.y,ua[I+10]=Ub.z,
|
|
|
|
-ua[I+11]=1,I+=12;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],yb=Xb[L.a],zb=Xb[L.b],Ab=Xb[L.c],uc=Xb[L.d],wa[I]=yb.x,wa[I+1]=yb.y,wa[I+2]=yb.z,wa[I+3]=yb.w,wa[I+4]=zb.x,wa[I+5]=zb.y,wa[I+6]=zb.z,wa[I+7]=zb.w,wa[I+8]=Ab.x,wa[I+9]=Ab.y,wa[I+10]=Ab.z,wa[I+11]=Ab.w,wa[I+12]=uc.x,wa[I+13]=uc.y,wa[I+14]=uc.z,wa[I+15]=uc.w,Bb=fc[L.a],Cb=fc[L.b],Db=fc[L.c],vc=fc[L.d],va[I]=Bb.x,va[I+1]=Bb.y,va[I+2]=Bb.z,va[I+3]=Bb.w,va[I+4]=Cb.x,va[I+5]=Cb.y,va[I+6]=Cb.z,va[I+7]=Cb.w,va[I+8]=Db.x,va[I+9]=Db.y,va[I+10]=Db.z,va[I+
|
|
|
|
-11]=Db.w,va[I+12]=vc.x,va[I+13]=vc.y,va[I+14]=vc.z,va[I+15]=vc.w,Pb=dc[L.a],Qb=dc[L.b],Rb=dc[L.c],Hc=dc[L.d],ta[I]=Pb.x,ta[I+1]=Pb.y,ta[I+2]=Pb.z,ta[I+3]=1,ta[I+4]=Qb.x,ta[I+5]=Qb.y,ta[I+6]=Qb.z,ta[I+7]=1,ta[I+8]=Rb.x,ta[I+9]=Rb.y,ta[I+10]=Rb.z,ta[I+11]=1,ta[I+12]=Hc.x,ta[I+13]=Hc.y,ta[I+14]=Hc.z,ta[I+15]=1,Sb=ec[L.a],Tb=ec[L.b],Ub=ec[L.c],Ic=ec[L.d],ua[I]=Sb.x,ua[I+1]=Sb.y,ua[I+2]=Sb.z,ua[I+3]=1,ua[I+4]=Tb.x,ua[I+5]=Tb.y,ua[I+6]=Tb.z,ua[I+7]=1,ua[I+8]=Ub.x,ua[I+9]=Ub.y,ua[I+10]=Ub.z,ua[I+11]=1,ua[I+
|
|
|
|
-12]=Ic.x,ua[I+13]=Ic.y,ua[I+14]=Ic.z,ua[I+15]=1,I+=16;0<I&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ta,ab),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ua,ab),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,va,ab),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,wa,ab))}if(xd&&Xc){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],ob=L.vertexColors,Gc=
|
|
|
|
-L.color,3===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Gc,Na[Ca]=vb.r,Na[Ca+1]=vb.g,Na[Ca+2]=vb.b,Na[Ca+3]=wb.r,Na[Ca+4]=wb.g,Na[Ca+5]=wb.b,Na[Ca+6]=xb.r,Na[Ca+7]=xb.g,Na[Ca+8]=xb.b,Ca+=9;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],ob=L.vertexColors,Gc=L.color,4===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Gc,Na[Ca]=vb.r,Na[Ca+1]=vb.g,Na[Ca+2]=vb.b,Na[Ca+3]=wb.r,Na[Ca+4]=wb.g,Na[Ca+5]=wb.b,Na[Ca+6]=xb.r,Na[Ca+7]=xb.g,Na[Ca+8]=xb.b,
|
|
|
|
-Na[Ca+9]=tc.r,Na[Ca+10]=tc.g,Na[Ca+11]=tc.b,Ca+=12;0<Ca&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Na,ab))}if(wd&&Va.hasTangents){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],Hb=L.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],sa[qa]=pb.x,sa[qa+1]=pb.y,sa[qa+2]=pb.z,sa[qa+3]=pb.w,sa[qa+4]=qb.x,sa[qa+5]=qb.y,sa[qa+6]=qb.z,sa[qa+7]=qb.w,sa[qa+8]=rb.x,sa[qa+9]=rb.y,sa[qa+10]=rb.z,sa[qa+11]=rb.w,qa+=12;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],Hb=L.vertexTangents,pb=Hb[0],qb=
|
|
|
|
-Hb[1],rb=Hb[2],rc=Hb[3],sa[qa]=pb.x,sa[qa+1]=pb.y,sa[qa+2]=pb.z,sa[qa+3]=pb.w,sa[qa+4]=qb.x,sa[qa+5]=qb.y,sa[qa+6]=qb.z,sa[qa+7]=qb.w,sa[qa+8]=rb.x,sa[qa+9]=rb.y,sa[qa+10]=rb.z,sa[qa+11]=rb.w,sa[qa+12]=rc.x,sa[qa+13]=rc.y,sa[qa+14]=rc.z,sa[qa+15]=rc.w,qa+=16;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,sa,ab)}if(vd&&fd){for(G=0,T=ma.length;G<T;G++)if(L=Da[ma[G]],jc=L.vertexNormals,Ob=L.normal,3===jc.length&&Fc)for(la=0;3>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,
|
|
|
|
-ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;3>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;for(G=0,T=na.length;G<T;G++)if(L=Da[na[G]],jc=L.vertexNormals,Ob=L.normal,4===jc.length&&Fc)for(la=0;4>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;4>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,ib,ab)}if(jd&&ad&&gd){for(G=0,T=ma.length;G<T;G++)if(kb=ma[G],L=Da[kb],kc=ad[kb],void 0!==kc)for(la=
|
|
|
|
-0;3>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(G=0,T=na.length;G<T;G++)if(kb=na[G],L=Da[kb],kc=ad[kb],void 0!==kc)for(la=0;4>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,wc,ab))}if(jd&&bd&&gd){for(G=0,T=ma.length;G<T;G++)if(kb=ma[G],L=Da[kb],lc=bd[kb],void 0!==lc)for(la=0;3>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(G=0,T=na.length;G<T;G++)if(kb=na[G],L=Da[kb],lc=bd[kb],void 0!==lc)for(la=
|
|
|
|
-0;4>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,xc,ab))}if(ud){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],Eb[hb]=Aa,Eb[hb+1]=Aa+1,Eb[hb+2]=Aa+2,hb+=3,cb[Ua]=Aa,cb[Ua+1]=Aa+1,cb[Ua+2]=Aa,cb[Ua+3]=Aa+2,cb[Ua+4]=Aa+1,cb[Ua+5]=Aa+2,Ua+=6,Aa+=3;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],Eb[hb]=Aa,Eb[hb+1]=Aa+1,Eb[hb+2]=Aa+3,Eb[hb+3]=Aa+1,Eb[hb+4]=Aa+2,Eb[hb+5]=Aa+3,hb+=6,cb[Ua]=Aa,cb[Ua+1]=Aa+1,cb[Ua+2]=Aa,cb[Ua+3]=Aa+
|
|
|
|
-3,cb[Ua+4]=Aa+1,cb[Ua+5]=Aa+2,cb[Ua+6]=Aa+2,cb[Ua+7]=Aa+3,Ua+=8,Aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,ab);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,cb,ab)}if($c)for(la=0,hd=$c.length;la<hd;la++)if(x=$c[la],x.__original.needsUpdate){z=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],x.array[z]=x.value[L.a],x.array[z+1]=x.value[L.b],
|
|
|
|
-x.array[z+2]=x.value[L.c],z+=3;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],x.array[z]=x.value[L.a],x.array[z+1]=x.value[L.b],x.array[z+2]=x.value[L.c],x.array[z+3]=x.value[L.d],z+=4}else{if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)bb=x.value[ma[G]],x.array[z]=bb,x.array[z+1]=bb,x.array[z+2]=bb,z+=3;for(G=0,T=na.length;G<T;G++)bb=x.value[na[G]],x.array[z]=bb,x.array[z+1]=bb,x.array[z+2]=bb,x.array[z+3]=bb,z+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<
|
|
|
|
-T;G++)L=Da[ma[G]],W=x.value[L.a],X=x.value[L.b],Y=x.value[L.c],x.array[z]=W.x,x.array[z+1]=W.y,x.array[z+2]=X.x,x.array[z+3]=X.y,x.array[z+4]=Y.x,x.array[z+5]=Y.y,z+=6;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],W=x.value[L.a],X=x.value[L.b],Y=x.value[L.c],pa=x.value[L.d],x.array[z]=W.x,x.array[z+1]=W.y,x.array[z+2]=X.x,x.array[z+3]=X.y,x.array[z+4]=Y.x,x.array[z+5]=Y.y,x.array[z+6]=pa.x,x.array[z+7]=pa.y,z+=8}else{if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)Y=X=W=bb=x.value[ma[G]],x.array[z]=
|
|
|
|
-W.x,x.array[z+1]=W.y,x.array[z+2]=X.x,x.array[z+3]=X.y,x.array[z+4]=Y.x,x.array[z+5]=Y.y,z+=6;for(G=0,T=na.length;G<T;G++)pa=Y=X=W=bb=x.value[na[G]],x.array[z]=W.x,x.array[z+1]=W.y,x.array[z+2]=X.x,x.array[z+3]=X.y,x.array[z+4]=Y.x,x.array[z+5]=Y.y,x.array[z+6]=pa.x,x.array[z+7]=pa.y,z+=8}}else if(3===x.size){var ga;ga="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],W=x.value[L.a],X=x.value[L.b],Y=x.value[L.c],x.array[z]=
|
|
|
|
-W[ga[0]],x.array[z+1]=W[ga[1]],x.array[z+2]=W[ga[2]],x.array[z+3]=X[ga[0]],x.array[z+4]=X[ga[1]],x.array[z+5]=X[ga[2]],x.array[z+6]=Y[ga[0]],x.array[z+7]=Y[ga[1]],x.array[z+8]=Y[ga[2]],z+=9;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],W=x.value[L.a],X=x.value[L.b],Y=x.value[L.c],pa=x.value[L.d],x.array[z]=W[ga[0]],x.array[z+1]=W[ga[1]],x.array[z+2]=W[ga[2]],x.array[z+3]=X[ga[0]],x.array[z+4]=X[ga[1]],x.array[z+5]=X[ga[2]],x.array[z+6]=Y[ga[0]],x.array[z+7]=Y[ga[1]],x.array[z+8]=Y[ga[2]],x.array[z+9]=pa[ga[0]],
|
|
|
|
-x.array[z+10]=pa[ga[1]],x.array[z+11]=pa[ga[2]],z+=12}else if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)Y=X=W=bb=x.value[ma[G]],x.array[z]=W[ga[0]],x.array[z+1]=W[ga[1]],x.array[z+2]=W[ga[2]],x.array[z+3]=X[ga[0]],x.array[z+4]=X[ga[1]],x.array[z+5]=X[ga[2]],x.array[z+6]=Y[ga[0]],x.array[z+7]=Y[ga[1]],x.array[z+8]=Y[ga[2]],z+=9;for(G=0,T=na.length;G<T;G++)pa=Y=X=W=bb=x.value[na[G]],x.array[z]=W[ga[0]],x.array[z+1]=W[ga[1]],x.array[z+2]=W[ga[2]],x.array[z+3]=X[ga[0]],x.array[z+4]=X[ga[1]],x.array[z+
|
|
|
|
-5]=X[ga[2]],x.array[z+6]=Y[ga[0]],x.array[z+7]=Y[ga[1]],x.array[z+8]=Y[ga[2]],x.array[z+9]=pa[ga[0]],x.array[z+10]=pa[ga[1]],x.array[z+11]=pa[ga[2]],z+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<T;G++)L=Da[ma[G]],W=x.value[L.a],X=x.value[L.b],Y=x.value[L.c],x.array[z]=W.x,x.array[z+1]=W.y,x.array[z+2]=W.z,x.array[z+3]=W.w,x.array[z+4]=X.x,x.array[z+5]=X.y,x.array[z+6]=X.z,x.array[z+7]=X.w,x.array[z+8]=Y.x,x.array[z+9]=Y.y,x.array[z+10]=Y.z,x.array[z+
|
|
|
|
-11]=Y.w,z+=12;for(G=0,T=na.length;G<T;G++)L=Da[na[G]],W=x.value[L.a],X=x.value[L.b],Y=x.value[L.c],pa=x.value[L.d],x.array[z]=W.x,x.array[z+1]=W.y,x.array[z+2]=W.z,x.array[z+3]=W.w,x.array[z+4]=X.x,x.array[z+5]=X.y,x.array[z+6]=X.z,x.array[z+7]=X.w,x.array[z+8]=Y.x,x.array[z+9]=Y.y,x.array[z+10]=Y.z,x.array[z+11]=Y.w,x.array[z+12]=pa.x,x.array[z+13]=pa.y,x.array[z+14]=pa.z,x.array[z+15]=pa.w,z+=16}else if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)Y=X=W=bb=x.value[ma[G]],x.array[z]=W.x,x.array[z+
|
|
|
|
-1]=W.y,x.array[z+2]=W.z,x.array[z+3]=W.w,x.array[z+4]=X.x,x.array[z+5]=X.y,x.array[z+6]=X.z,x.array[z+7]=X.w,x.array[z+8]=Y.x,x.array[z+9]=Y.y,x.array[z+10]=Y.z,x.array[z+11]=Y.w,z+=12;for(G=0,T=na.length;G<T;G++)pa=Y=X=W=bb=x.value[na[G]],x.array[z]=W.x,x.array[z+1]=W.y,x.array[z+2]=W.z,x.array[z+3]=W.w,x.array[z+4]=X.x,x.array[z+5]=X.y,x.array[z+6]=X.z,x.array[z+7]=X.w,x.array[z+8]=Y.x,x.array[z+9]=Y.y,x.array[z+10]=Y.z,x.array[z+11]=Y.w,x.array[z+12]=pa.x,x.array[z+13]=pa.y,x.array[z+14]=pa.z,
|
|
|
|
-x.array[z+15]=pa.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,ab)}td&&(delete fa.__inittedArrays,delete fa.__colorArray,delete fa.__normalArray,delete fa.__tangentArray,delete fa.__uvArray,delete fa.__uv2Array,delete fa.__faceArray,delete fa.__vertexArray,delete fa.__lineArray,delete fa.__skinVertexAArray,delete fa.__skinVertexBArray,delete fa.__skinIndexArray,delete fa.__skinWeightArray)}}ja.__dirtyVertices=!1;ja.__dirtyMorphTargets=!1;ja.__dirtyElements=!1;ja.__dirtyUvs=
|
|
|
|
-!1;ja.__dirtyNormals=!1;ja.__dirtyColors=!1;ja.__dirtyTangents=!1;Xa.attributes&&m(Xa)}else if(nb instanceof THREE.Ribbon){if(ja.__dirtyVertices||ja.__dirtyColors){var Zb=ja,kd=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=void 0,$b=void 0,Lc=void 0,ld=Zb.vertices,md=Zb.colors,zd=ld.length,Ad=md.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,Bd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<zd;yc++)Kc=ld[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);
|
|
|
|
-j.bufferData(j.ARRAY_BUFFER,Mc,kd)}if(Bd){for(zc=0;zc<Ad;zc++)Lc=md[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Nc,kd)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1}else if(nb instanceof THREE.Line){Xa=c(nb,qc);ic=Xa.attributes&&p(Xa);if(ja.__dirtyVertices||ja.__dirtyColors||ic){var Lb=ja,cd=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,xa=void 0,Pc=void 0,nd=Lb.vertices,od=Lb.colors,Cd=nd.length,Dd=od.length,Qc=Lb.__vertexArray,
|
|
|
|
-Rc=Lb.__colorArray,Ed=Lb.__dirtyColors,dd=Lb.__webglCustomAttributesList,Sc=void 0,pd=void 0,Pa=void 0,oc=void 0,Ya=void 0,ra=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Cd;Ac++)Oc=nd[Ac].position,xa=3*Ac,Qc[xa]=Oc.x,Qc[xa+1]=Oc.y,Qc[xa+2]=Oc.z;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,cd)}if(Ed){for(Bc=0;Bc<Dd;Bc++)Pc=od[Bc],xa=3*Bc,Rc[xa]=Pc.r,Rc[xa+1]=Pc.g,Rc[xa+2]=Pc.b;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,cd)}if(dd)for(Sc=
|
|
|
|
-0,pd=dd.length;Sc<pd;Sc++)if(ra=dd[Sc],ra.needsUpdate&&(void 0===ra.boundTo||"vertices"===ra.boundTo)){xa=0;oc=ra.value.length;if(1===ra.size)for(Pa=0;Pa<oc;Pa++)ra.array[Pa]=ra.value[Pa];else if(2===ra.size)for(Pa=0;Pa<oc;Pa++)Ya=ra.value[Pa],ra.array[xa]=Ya.x,ra.array[xa+1]=Ya.y,xa+=2;else if(3===ra.size)if("c"===ra.type)for(Pa=0;Pa<oc;Pa++)Ya=ra.value[Pa],ra.array[xa]=Ya.r,ra.array[xa+1]=Ya.g,ra.array[xa+2]=Ya.b,xa+=3;else for(Pa=0;Pa<oc;Pa++)Ya=ra.value[Pa],ra.array[xa]=Ya.x,ra.array[xa+1]=Ya.y,
|
|
|
|
-ra.array[xa+2]=Ya.z,xa+=3;else if(4===ra.size)for(Pa=0;Pa<oc;Pa++)Ya=ra.value[Pa],ra.array[xa]=Ya.x,ra.array[xa+1]=Ya.y,ra.array[xa+2]=Ya.z,ra.array[xa+3]=Ya.w,xa+=4;j.bindBuffer(j.ARRAY_BUFFER,ra.buffer);j.bufferData(j.ARRAY_BUFFER,ra.array,cd)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1;Xa.attributes&&m(Xa)}else if(nb instanceof THREE.ParticleSystem)Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),(ja.__dirtyVertices||ja.__dirtyColors||nb.sortParticles||ic)&&f(ja,j.DYNAMIC_DRAW,nb),ja.__dirtyVertices=!1,ja.__dirtyColors=
|
|
|
|
-!1,Xa.attributes&&m(Xa)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var k=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);
|
|
|
|
-a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var m,l;f=k=0;for(m=0,l=b.length;m<l;m++)e=b[m],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++,e instanceof THREE.SpotLight&&k++);k+f<=M?m=f:(m=Math.ceil(M*f/(k+f)),k=M-m);e=m;f=k;var n=0;for(k=0,m=b.length;k<m;k++)l=b[k],l.castShadow&&(l instanceof THREE.SpotLight&&n++,l instanceof THREE.DirectionalLight&&!l.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;
|
|
|
|
-var p;a:{m=a.fragmentShader;l=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,
|
|
|
|
-shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):(d.push(m),d.push(l));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Z.length;q<d;q++)if(Z[q].code===i){p=Z[q].program;break a}q=j.createProgram();d=[0<za?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+
|
|
|
|
-c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":
|
|
|
|
-"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
-e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
|
|
|
|
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",e+m));j.attachShader(q,t("vertex",d+l));j.linkProgram(q);
|
|
|
|
-j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in k)d.push(r);r=d;for(d=0,k=r.length;d<k;d++)m=r[d],q.uniforms[m]=j.getUniformLocation(q,m);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");
|
|
|
|
-for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=Z.length;Z.push({program:q,code:i});H.info.memory.programs=Z.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);
|
|
|
|
|
|
+j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=
|
|
|
|
+0,e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
|
|
|
|
+G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.updateShadowMap=function(a,b){z=null;Q=N=ca=Y=ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();
|
|
|
|
+if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,k,n,l,o=3*a.count;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=c[l+2],g=c[l+3],i=c[l+
|
|
|
|
+4],k=c[l+5],h=c[l+6],m=c[l+7],n=c[l+8],d=(d+g+h)/3,e=(e+i+m)/3,f=(f+k+n)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,c[l+6]=d,c[l+7]=e,c[l+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?
|
|
|
|
+1:0),d!==N&&(N=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),
|
|
|
|
+j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),G.info.render.calls++,G.info.render.vertices+=f[d].count,
|
|
|
|
+G.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,
|
|
|
|
+3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]),j.vertexAttribPointer(c["morphNormal"+
|
|
|
|
+g],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,l=0;h=f.morphTargetInfluences;var n,o=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)!i[n]&&h[n]>k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]),j.vertexAttribPointer(c["morphNormal"+
|
|
|
|
+g],3,j.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&
|
|
|
|
+(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));
|
|
|
|
+0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==na&&(j.lineWidth(d),na=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,
|
|
|
|
+j.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=e.__webglFaceCount,G.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==na&&(j.lineWidth(d),na=d),j.drawArrays(f,0,e.__webglLineCount),G.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),G.info.render.calls++,G.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,
|
|
|
|
+0,e.__webglVertexCount),G.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,m,n,l=a.lights,o=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=
|
|
|
|
+new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wa.multiply(b.projectionMatrix,b.matrixWorldInverse);db.setFromMatrix(Wa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,e=n.length;d<e;d++)if(f=n[d],m=f.object,f.render=!1,m.visible&&(!(m instanceof
|
|
|
|
+THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||db.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=f,q=p.object,t=p.buffer,E=void 0,E=E=void 0,E=q.material;if(E instanceof THREE.MeshFaceMaterial){if(E=t.materialIndex,0<=E)E=q.geometry.materials[E],E.transparent?(p.transparent=E,p.opaque=null):(p.opaque=E,p.transparent=null)}else if(E)E.transparent?(p.transparent=E,p.opaque=null):(p.opaque=E,p.transparent=null);f.render=!0;if(this.sortObjects)m.renderDepth?
|
|
|
|
+f.z=m.renderDepth:($a.copy(m.position),Wa.multiplyVector3($a),f.z=$a.z)}this.sortObjects&&n.sort(g);n=a.__webglObjectsImmediate;for(d=0,e=n.length;d<e;d++)if(f=n[d],m=f.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=f.object.material,m.transparent?(f.transparent=m,f.opaque=null):(f.opaque=m,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),
|
|
|
|
+s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,l,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,l,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,l,o,!1),k(a.__webglObjectsImmediate,"opaque",b,l,o,!1),i(a.__webglObjects,!1,"transparent",b,l,o,!0),k(a.__webglObjectsImmediate,"transparent",b,l,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&
|
|
|
|
+c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);N=-1;G.setObjectFaces(e);e.immediateRenderCallback?
|
|
|
|
+e.immediateRenderCallback(f,j,db):e.render(function(a){G.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,m=void 0,k=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=
|
|
|
|
+new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(m=g.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=m,s=void 0,t=void 0,E=void 0,u=void 0,w=void 0,v=void 0,z=void 0,Q={},C=r.morphTargets.length,D=r.morphNormals.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)E=r.faces[s],u=E.materialIndex,v=void 0!==u?u:-1,void 0===Q[v]&&(Q[v]={hash:v,counter:0}),z=Q[v].hash+"_"+Q[v].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]=
|
|
|
|
+{faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:D}),w=E instanceof THREE.Face3?3:4,65535<r.geometryGroups[z].vertices+w&&(Q[v].counter+=1,z=Q[v].hash+"_"+Q[v].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:D})),E instanceof THREE.Face3?r.geometryGroups[z].faces3.push(s):r.geometryGroups[z].faces4.push(s),r.geometryGroups[z].vertices+=w;r.geometryGroupsList=[];var A=void 0;
|
|
|
|
+for(A in r.geometryGroups)r.geometryGroups[A].id=ia++,r.geometryGroupsList.push(r.geometryGroups[A])}for(i in m.geometryGroups)if(k=m.geometryGroups[i],!k.__webglVertexBuffer){var N=k;N.__webglVertexBuffer=j.createBuffer();N.__webglNormalBuffer=j.createBuffer();N.__webglTangentBuffer=j.createBuffer();N.__webglColorBuffer=j.createBuffer();N.__webglUVBuffer=j.createBuffer();N.__webglUV2Buffer=j.createBuffer();N.__webglSkinVertexABuffer=j.createBuffer();N.__webglSkinVertexBBuffer=j.createBuffer();N.__webglSkinIndicesBuffer=
|
|
|
|
+j.createBuffer();N.__webglSkinWeightsBuffer=j.createBuffer();N.__webglFaceBuffer=j.createBuffer();N.__webglLineBuffer=j.createBuffer();var B=void 0,I=void 0;if(N.numMorphTargets){N.__webglMorphTargetsBuffers=[];for(B=0,I=N.numMorphTargets;B<I;B++)N.__webglMorphTargetsBuffers.push(j.createBuffer())}if(N.numMorphNormals){N.__webglMorphNormalsBuffers=[];for(B=0,I=N.numMorphNormals;B<I;B++)N.__webglMorphNormalsBuffers.push(j.createBuffer())}G.info.memory.geometries++;var H=k,L=g,K=L.geometry,ea=H.faces3,
|
|
|
|
+aa=H.faces4,$=3*ea.length+4*aa.length,O=1*ea.length+2*aa.length,Y=3*ea.length+4*aa.length,ba=c(L,H),ca=e(ba),P=d(ba),S=ba.vertexColors?ba.vertexColors:!1;H.__vertexArray=new Float32Array(3*$);if(P)H.__normalArray=new Float32Array(3*$);if(K.hasTangents)H.__tangentArray=new Float32Array(4*$);if(S)H.__colorArray=new Float32Array(3*$);if(ca){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)H.__uvArray=new Float32Array(2*$);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)H.__uv2Array=new Float32Array(2*
|
|
|
|
+$)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length)H.__skinVertexAArray=new Float32Array(4*$),H.__skinVertexBArray=new Float32Array(4*$),H.__skinIndexArray=new Float32Array(4*$),H.__skinWeightArray=new Float32Array(4*$);H.__faceArray=new Uint16Array(3*O);H.__lineArray=new Uint16Array(2*Y);var fa=void 0,X=void 0;if(H.numMorphTargets){H.__morphTargetsArrays=[];for(fa=0,X=H.numMorphTargets;fa<X;fa++)H.__morphTargetsArrays.push(new Float32Array(3*$))}if(H.numMorphNormals){H.__morphNormalsArrays=
|
|
|
|
+[];for(fa=0,X=H.numMorphNormals;fa<X;fa++)H.__morphNormalsArrays.push(new Float32Array(3*$))}H.__webglFaceCount=3*O;H.__webglLineCount=2*Y;if(ba.attributes){if(void 0===H.__webglCustomAttributesList)H.__webglCustomAttributesList=[];var Ua=void 0;for(Ua in ba.attributes){var Ka=ba.attributes[Ua],na={},qa;for(qa in Ka)na[qa]=Ka[qa];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=!0;var ra=1;"v2"===na.type?ra=2:"v3"===na.type?ra=3:"v4"===na.type?ra=4:"c"===na.type&&(ra=3);na.size=
|
|
|
|
+ra;na.array=new Float32Array($*ra);na.buffer=j.createBuffer();na.buffer.belongsToAttribute=Ua;Ka.needsUpdate=!0;na.__original=Ka}H.__webglCustomAttributesList.push(na)}}H.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(m=g.geometry,!m.__webglVertexBuffer){var Ha=m;Ha.__webglVertexBuffer=j.createBuffer();Ha.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;
|
|
|
|
+var ta=m,Aa=ta.vertices.length;ta.__vertexArray=new Float32Array(3*Aa);ta.__colorArray=new Float32Array(3*Aa);ta.__webglVertexCount=Aa;m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(m=g.geometry,!m.__webglVertexBuffer){var La=m;La.__webglVertexBuffer=j.createBuffer();La.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Fa=m,ib=g,Wa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*Wa);Fa.__colorArray=new Float32Array(3*Wa);Fa.__webglLineCount=Wa;
|
|
|
|
+b(Fa,ib);m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(m=g.geometry,!m.__webglVertexBuffer)){var $a=m;$a.__webglVertexBuffer=j.createBuffer();$a.__webglColorBuffer=j.createBuffer();G.info.geometries++;var Va=m,lb=g,db=Va.vertices.length;Va.__vertexArray=new Float32Array(3*db);Va.__colorArray=new Float32Array(3*db);Va.__sortArray=[];Va.__webglParticleCount=db;b(Va,lb);m.__dirtyVertices=!0;m.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(m=
|
|
|
|
+g.geometry,m instanceof THREE.BufferGeometry)l(h.__webglObjects,m,g);else for(i in m.geometryGroups)k=m.geometryGroups[i],l(h.__webglObjects,k,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(m=g.geometry,l(h.__webglObjects,m,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof
|
|
|
|
+THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fb=a.__objectsRemoved[0],Fc=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof THREE.Line?o(Fc.__webglObjects,fb):fb instanceof THREE.Sprite?q(Fc.__webglSprites,fb):fb instanceof THREE.LensFlare?q(Fc.__webglFlares,fb):(fb instanceof THREE.MarchingCubes||fb.immediateRenderCallback)&&o(Fc.__webglObjectsImmediate,fb);fb.__webglActive=
|
|
|
|
+!1;a.__objectsRemoved.splice(0,1)}for(var Wc=0,rd=a.__webglObjects.length;Wc<rd;Wc++){var nb=a.__webglObjects[Wc].object,ja=nb.geometry,qc=void 0,ic=void 0,Ya=void 0;if(nb instanceof THREE.Mesh)if(ja instanceof THREE.BufferGeometry)ja.__dirtyVertices=!1,ja.__dirtyElements=!1,ja.__dirtyUvs=!1,ja.__dirtyNormals=!1,ja.__dirtyColors=!1;else{for(var Xc=0,sd=ja.geometryGroupsList.length;Xc<sd;Xc++)if(qc=ja.geometryGroupsList[Xc],Ya=c(nb,qc),ic=Ya.attributes&&p(Ya),ja.__dirtyVertices||ja.__dirtyMorphTargets||
|
|
|
|
+ja.__dirtyElements||ja.__dirtyUvs||ja.__dirtyNormals||ja.__dirtyColors||ja.__dirtyTangents||ic){var ga=qc,td=nb,ab=j.DYNAMIC_DRAW,ud=!ja.dynamic,bc=Ya;if(ga.__inittedArrays){var gd=d(bc),Yc=bc.vertexColors?bc.vertexColors:!1,hd=e(bc),Gc=gd===THREE.SmoothShading,F=void 0,T=void 0,kb=void 0,M=void 0,jc=void 0,Ob=void 0,ob=void 0,Hc=void 0,Hb=void 0,kc=void 0,lc=void 0,U=void 0,V=void 0,W=void 0,oa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,
|
|
|
|
+xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Ic=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Jc=void 0,ka=void 0,id=void 0,Vb=void 0,mc=void 0,nc=void 0,Ma=void 0,jd=void 0,Ia=void 0,Ja=void 0,Wb=void 0,Ib=void 0,Ba=0,Ea=0,Jb=0,Kb=0,gb=0,Ra=0,pa=0,Sa=0,Ca=0,J=0,da=0,y=0,bb=void 0,Na=ga.__vertexArray,wc=ga.__uvArray,xc=ga.__uv2Array,hb=ga.__normalArray,ua=ga.__tangentArray,Oa=ga.__colorArray,va=ga.__skinVertexAArray,wa=ga.__skinVertexBArray,
|
|
|
|
+xa=ga.__skinIndexArray,ya=ga.__skinWeightArray,Zc=ga.__morphTargetsArrays,$c=ga.__morphNormalsArrays,ad=ga.__webglCustomAttributesList,x=void 0,Eb=ga.__faceArray,cb=ga.__lineArray,Ta=td.geometry,vd=Ta.__dirtyElements,kd=Ta.__dirtyUvs,wd=Ta.__dirtyNormals,xd=Ta.__dirtyTangents,yd=Ta.__dirtyColors,zd=Ta.__dirtyMorphTargets,cc=Ta.vertices,la=ga.faces3,ma=ga.faces4,Da=Ta.faces,bd=Ta.faceVertexUvs[0],cd=Ta.faceVertexUvs[1],dc=Ta.skinVerticesA,ec=Ta.skinVerticesB,fc=Ta.skinIndices,Xb=Ta.skinWeights,Yb=
|
|
|
|
+Ta.morphTargets,Kc=Ta.morphNormals;if(Ta.__dirtyVertices){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=cc[M.a].position,V=cc[M.b].position,W=cc[M.c].position,Na[Ea]=U.x,Na[Ea+1]=U.y,Na[Ea+2]=U.z,Na[Ea+3]=V.x,Na[Ea+4]=V.y,Na[Ea+5]=V.z,Na[Ea+6]=W.x,Na[Ea+7]=W.y,Na[Ea+8]=W.z,Ea+=9;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],U=cc[M.a].position,V=cc[M.b].position,W=cc[M.c].position,oa=cc[M.d].position,Na[Ea]=U.x,Na[Ea+1]=U.y,Na[Ea+2]=U.z,Na[Ea+3]=V.x,Na[Ea+4]=V.y,Na[Ea+5]=V.z,Na[Ea+6]=W.x,Na[Ea+7]=W.y,Na[Ea+
|
|
|
|
+8]=W.z,Na[Ea+9]=oa.x,Na[Ea+10]=oa.y,Na[Ea+11]=oa.z,Ea+=12;j.bindBuffer(j.ARRAY_BUFFER,ga.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Na,ab)}if(zd)for(Ma=0,jd=Yb.length;Ma<jd;Ma++){da=0;for(F=0,T=la.length;F<T;F++){Wb=la[F];M=Da[Wb];U=Yb[Ma].vertices[M.a].position;V=Yb[Ma].vertices[M.b].position;W=Yb[Ma].vertices[M.c].position;Ia=Zc[Ma];Ia[da]=U.x;Ia[da+1]=U.y;Ia[da+2]=U.z;Ia[da+3]=V.x;Ia[da+4]=V.y;Ia[da+5]=V.z;Ia[da+6]=W.x;Ia[da+7]=W.y;Ia[da+8]=W.z;if(bc.morphNormals)Gc?(Ib=Kc[Ma].vertexNormals[Wb],
|
|
|
|
+sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=tb=sb=Kc[Ma].faceNormals[Wb],Ja=$c[Ma],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z;da+=9}for(F=0,T=ma.length;F<T;F++){Wb=ma[F];M=Da[Wb];U=Yb[Ma].vertices[M.a].position;V=Yb[Ma].vertices[M.b].position;W=Yb[Ma].vertices[M.c].position;oa=Yb[Ma].vertices[M.d].position;Ia=Zc[Ma];Ia[da]=U.x;Ia[da+1]=U.y;Ia[da+2]=U.z;Ia[da+3]=V.x;Ia[da+4]=V.y;Ia[da+5]=V.z;Ia[da+6]=W.x;Ia[da+7]=W.y;Ia[da+8]=W.z;Ia[da+
|
|
|
|
+9]=oa.x;Ia[da+10]=oa.y;Ia[da+11]=oa.z;if(bc.morphNormals)Gc?(Ib=Kc[Ma].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Kc[Ma].faceNormals[Wb],Ja=$c[Ma],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z,Ja[da+9]=sc.x,Ja[da+10]=sc.y,Ja[da+11]=sc.z;da+=12}j.bindBuffer(j.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Ma]);j.bufferData(j.ARRAY_BUFFER,Zc[Ma],ab);bc.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Ma]),
|
|
|
|
+j.bufferData(j.ARRAY_BUFFER,$c[Ma],ab))}if(Xb.length){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],
|
|
|
|
+va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,J+=12;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],uc=Xb[M.d],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=
|
|
|
|
+zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,ya[J+12]=uc.x,ya[J+13]=uc.y,ya[J+14]=uc.z,ya[J+15]=uc.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],vc=fc[M.d],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,xa[J+12]=vc.x,xa[J+13]=vc.y,xa[J+14]=vc.z,xa[J+15]=vc.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],Ic=dc[M.d],va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,
|
|
|
|
+va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,va[J+12]=Ic.x,va[J+13]=Ic.y,va[J+14]=Ic.z,va[J+15]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],Jc=ec[M.d],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,wa[J+12]=Jc.x,wa[J+13]=Jc.y,wa[J+14]=Jc.z,wa[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,va,ab),j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+ga.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,wa,ab),j.bindBuffer(j.ARRAY_BUFFER,ga.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,xa,ab),j.bindBuffer(j.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ya,ab))}if(yd&&Yc){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],ob=M.vertexColors,Hc=M.color,3===ob.length&&Yc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Hc,Oa[Ca]=vb.r,Oa[Ca+1]=vb.g,Oa[Ca+2]=vb.b,Oa[Ca+3]=wb.r,Oa[Ca+4]=wb.g,Oa[Ca+5]=wb.b,Oa[Ca+6]=xb.r,
|
|
|
|
+Oa[Ca+7]=xb.g,Oa[Ca+8]=xb.b,Ca+=9;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],ob=M.vertexColors,Hc=M.color,4===ob.length&&Yc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Hc,Oa[Ca]=vb.r,Oa[Ca+1]=vb.g,Oa[Ca+2]=vb.b,Oa[Ca+3]=wb.r,Oa[Ca+4]=wb.g,Oa[Ca+5]=wb.b,Oa[Ca+6]=xb.r,Oa[Ca+7]=xb.g,Oa[Ca+8]=xb.b,Oa[Ca+9]=tc.r,Oa[Ca+10]=tc.g,Oa[Ca+11]=tc.b,Ca+=12;0<Ca&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Oa,ab))}if(xd&&Ta.hasTangents){for(F=0,T=la.length;F<
|
|
|
|
+T;F++)M=Da[la[F]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[pa]=pb.x,ua[pa+1]=pb.y,ua[pa+2]=pb.z,ua[pa+3]=pb.w,ua[pa+4]=qb.x,ua[pa+5]=qb.y,ua[pa+6]=qb.z,ua[pa+7]=qb.w,ua[pa+8]=rb.x,ua[pa+9]=rb.y,ua[pa+10]=rb.z,ua[pa+11]=rb.w,pa+=12;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[pa]=pb.x,ua[pa+1]=pb.y,ua[pa+2]=pb.z,ua[pa+3]=pb.w,ua[pa+4]=qb.x,ua[pa+5]=qb.y,ua[pa+6]=qb.z,ua[pa+7]=qb.w,ua[pa+8]=rb.x,ua[pa+9]=rb.y,ua[pa+10]=rb.z,ua[pa+11]=rb.w,
|
|
|
|
+ua[pa+12]=rc.x,ua[pa+13]=rc.y,ua[pa+14]=rc.z,ua[pa+15]=rc.w,pa+=16;j.bindBuffer(j.ARRAY_BUFFER,ga.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ua,ab)}if(wd&&gd){for(F=0,T=la.length;F<T;F++)if(M=Da[la[F]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Gc)for(ka=0;3>ka;ka++)Vb=jc[ka],hb[Ra]=Vb.x,hb[Ra+1]=Vb.y,hb[Ra+2]=Vb.z,Ra+=3;else for(ka=0;3>ka;ka++)hb[Ra]=Ob.x,hb[Ra+1]=Ob.y,hb[Ra+2]=Ob.z,Ra+=3;for(F=0,T=ma.length;F<T;F++)if(M=Da[ma[F]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Gc)for(ka=
|
|
|
|
+0;4>ka;ka++)Vb=jc[ka],hb[Ra]=Vb.x,hb[Ra+1]=Vb.y,hb[Ra+2]=Vb.z,Ra+=3;else for(ka=0;4>ka;ka++)hb[Ra]=Ob.x,hb[Ra+1]=Ob.y,hb[Ra+2]=Ob.z,Ra+=3;j.bindBuffer(j.ARRAY_BUFFER,ga.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hb,ab)}if(kd&&bd&&hd){for(F=0,T=la.length;F<T;F++)if(kb=la[F],M=Da[kb],kc=bd[kb],void 0!==kc)for(ka=0;3>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(F=0,T=ma.length;F<T;F++)if(kb=ma[F],M=Da[kb],kc=bd[kb],void 0!==kc)for(ka=0;4>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=
|
|
|
|
+2;0<Jb&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,wc,ab))}if(kd&&cd&&hd){for(F=0,T=la.length;F<T;F++)if(kb=la[F],M=Da[kb],lc=cd[kb],void 0!==lc)for(ka=0;3>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(F=0,T=ma.length;F<T;F++)if(kb=ma[F],M=Da[kb],lc=cd[kb],void 0!==lc)for(ka=0;4>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,xc,ab))}if(vd){for(F=0,T=la.length;F<T;F++)M=
|
|
|
|
+Da[la[F]],Eb[gb]=Ba,Eb[gb+1]=Ba+1,Eb[gb+2]=Ba+2,gb+=3,cb[Sa]=Ba,cb[Sa+1]=Ba+1,cb[Sa+2]=Ba,cb[Sa+3]=Ba+2,cb[Sa+4]=Ba+1,cb[Sa+5]=Ba+2,Sa+=6,Ba+=3;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],Eb[gb]=Ba,Eb[gb+1]=Ba+1,Eb[gb+2]=Ba+3,Eb[gb+3]=Ba+1,Eb[gb+4]=Ba+2,Eb[gb+5]=Ba+3,gb+=6,cb[Sa]=Ba,cb[Sa+1]=Ba+1,cb[Sa+2]=Ba,cb[Sa+3]=Ba+3,cb[Sa+4]=Ba+1,cb[Sa+5]=Ba+2,cb[Sa+6]=Ba+2,cb[Sa+7]=Ba+3,Sa+=8,Ba+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ga.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,ab);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+ga.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,cb,ab)}if(ad)for(ka=0,id=ad.length;ka<id;ka++)if(x=ad[ka],x.__original.needsUpdate){y=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],x.array[y]=x.value[M.a],x.array[y+1]=x.value[M.b],x.array[y+2]=x.value[M.c],y+=3;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],x.array[y]=x.value[M.a],x.array[y+1]=x.value[M.b],x.array[y+2]=x.value[M.c],x.array[y+3]=x.value[M.d],y+=4}else{if("faces"===x.boundTo){for(F=
|
|
|
|
+0,T=la.length;F<T;F++)bb=x.value[la[F]],x.array[y]=bb,x.array[y+1]=bb,x.array[y+2]=bb,y+=3;for(F=0,T=ma.length;F<T;F++)bb=x.value[ma[F]],x.array[y]=bb,x.array[y+1]=bb,x.array[y+2]=bb,x.array[y+3]=bb,y+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,y+=6;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],
|
|
|
|
+U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],oa=x.value[M.d],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=oa.x,x.array[y+7]=oa.y,y+=8}else{if("faces"===x.boundTo){for(F=0,T=la.length;F<T;F++)W=V=U=bb=x.value[la[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,y+=6;for(F=0,T=ma.length;F<T;F++)oa=W=V=U=bb=x.value[ma[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+
|
|
|
|
+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=oa.x,x.array[y+7]=oa.y,y+=8}}else if(3===x.size){var ha;ha="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],y+=9;for(F=0,T=ma.length;F<
|
|
|
|
+T;F++)M=Da[ma[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],oa=x.value[M.d],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],x.array[y+9]=oa[ha[0]],x.array[y+10]=oa[ha[1]],x.array[y+11]=oa[ha[2]],y+=12}else if("faces"===x.boundTo){for(F=0,T=la.length;F<T;F++)W=V=U=bb=x.value[la[F]],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+
|
|
|
|
+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],y+=9;for(F=0,T=ma.length;F<T;F++)oa=W=V=U=bb=x.value[ma[F]],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],x.array[y+9]=oa[ha[0]],x.array[y+10]=oa[ha[1]],x.array[y+11]=oa[ha[2]],y+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===
|
|
|
|
+x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,y+=12;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],oa=x.value[M.d],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=
|
|
|
|
+V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,x.array[y+12]=oa.x,x.array[y+13]=oa.y,x.array[y+14]=oa.z,x.array[y+15]=oa.w,y+=16}else if("faces"===x.boundTo){for(F=0,T=la.length;F<T;F++)W=V=U=bb=x.value[la[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,y+=12;for(F=0,T=ma.length;F<
|
|
|
|
+T;F++)oa=W=V=U=bb=x.value[ma[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,x.array[y+12]=oa.x,x.array[y+13]=oa.y,x.array[y+14]=oa.z,x.array[y+15]=oa.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,ab)}ud&&(delete ga.__inittedArrays,delete ga.__colorArray,delete ga.__normalArray,delete ga.__tangentArray,delete ga.__uvArray,
|
|
|
|
+delete ga.__uv2Array,delete ga.__faceArray,delete ga.__vertexArray,delete ga.__lineArray,delete ga.__skinVertexAArray,delete ga.__skinVertexBArray,delete ga.__skinIndexArray,delete ga.__skinWeightArray)}}ja.__dirtyVertices=!1;ja.__dirtyMorphTargets=!1;ja.__dirtyElements=!1;ja.__dirtyUvs=!1;ja.__dirtyNormals=!1;ja.__dirtyColors=!1;ja.__dirtyTangents=!1;Ya.attributes&&n(Ya)}else if(nb instanceof THREE.Ribbon){if(ja.__dirtyVertices||ja.__dirtyColors){var Zb=ja,ld=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Lc=
|
|
|
|
+void 0,$b=void 0,Mc=void 0,md=Zb.vertices,nd=Zb.colors,Ad=md.length,Bd=nd.length,Nc=Zb.__vertexArray,Oc=Zb.__colorArray,Cd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<Ad;yc++)Lc=md[yc].position,$b=3*yc,Nc[$b]=Lc.x,Nc[$b+1]=Lc.y,Nc[$b+2]=Lc.z;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Nc,ld)}if(Cd){for(zc=0;zc<Bd;zc++)Mc=nd[zc],$b=3*zc,Oc[$b]=Mc.r,Oc[$b+1]=Mc.g,Oc[$b+2]=Mc.b;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
+Oc,ld)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1}else if(nb instanceof THREE.Line){Ya=c(nb,qc);ic=Ya.attributes&&p(Ya);if(ja.__dirtyVertices||ja.__dirtyColors||ic){var Lb=ja,dd=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Pc=void 0,za=void 0,Qc=void 0,od=Lb.vertices,pd=Lb.colors,Dd=od.length,Ed=pd.length,Rc=Lb.__vertexArray,Sc=Lb.__colorArray,Fd=Lb.__dirtyColors,ed=Lb.__webglCustomAttributesList,Tc=void 0,qd=void 0,Qa=void 0,oc=void 0,Za=void 0,sa=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Dd;Ac++)Pc=od[Ac].position,
|
|
|
|
+za=3*Ac,Rc[za]=Pc.x,Rc[za+1]=Pc.y,Rc[za+2]=Pc.z;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,dd)}if(Fd){for(Bc=0;Bc<Ed;Bc++)Qc=pd[Bc],za=3*Bc,Sc[za]=Qc.r,Sc[za+1]=Qc.g,Sc[za+2]=Qc.b;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,dd)}if(ed)for(Tc=0,qd=ed.length;Tc<qd;Tc++)if(sa=ed[Tc],sa.needsUpdate&&(void 0===sa.boundTo||"vertices"===sa.boundTo)){za=0;oc=sa.value.length;if(1===sa.size)for(Qa=0;Qa<oc;Qa++)sa.array[Qa]=sa.value[Qa];
|
|
|
|
+else if(2===sa.size)for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.x,sa.array[za+1]=Za.y,za+=2;else if(3===sa.size)if("c"===sa.type)for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.r,sa.array[za+1]=Za.g,sa.array[za+2]=Za.b,za+=3;else for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.x,sa.array[za+1]=Za.y,sa.array[za+2]=Za.z,za+=3;else if(4===sa.size)for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.x,sa.array[za+1]=Za.y,sa.array[za+2]=Za.z,sa.array[za+3]=Za.w,za+=4;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+sa.buffer);j.bufferData(j.ARRAY_BUFFER,sa.array,dd)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1;Ya.attributes&&n(Ya)}else if(nb instanceof THREE.ParticleSystem)Ya=c(nb,qc),ic=Ya.attributes&&p(Ya),(ja.__dirtyVertices||ja.__dirtyColors||nb.sortParticles||ic)&&f(ja,j.DYNAMIC_DRAW,nb),ja.__dirtyVertices=!1,ja.__dirtyColors=!1,Ya.attributes&&n(Ya)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof
|
|
|
|
+THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var m=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var k,n;f=m=0;for(k=0,n=b.length;k<n;k++)e=b[k],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof
|
|
|
|
+THREE.PointLight&&m++,e instanceof THREE.SpotLight&&m++);m+f<=H?k=f:(k=Math.ceil(H*f/(m+f)),m=H-k);e=k;f=m;var l=0;for(m=0,k=b.length;m<k;m++)n=b[m],n.castShadow&&(n instanceof THREE.SpotLight&&l++,n instanceof THREE.DirectionalLight&&!n.shadowCascade&&l++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;n=a.vertexShader;var m=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
|
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):
|
|
|
|
+(d.push(k),d.push(n));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=X.length;q<d;q++)if(X[q].code===i){p=X[q].program;break a}q=j.createProgram();d=[0<Aa?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
|
|
|
|
+"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",
|
|
|
|
+c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
+e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
|
|
|
|
+"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",e+k));j.attachShader(q,t("vertex",d+n));j.linkProgram(q);
|
|
|
|
+j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in m)d.push(r);r=d;for(d=0,m=r.length;d<m;d++)k=r[d],q.uniforms[k]=j.getUniformLocation(q,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");
|
|
|
|
+for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=X.length;X.push({program:q,code:i});G.info.memory.programs=X.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);
|
|
a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&j.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&j.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
-0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(ca!==a.doubleSided)a.doubleSided?
|
|
|
|
-j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ca=a.doubleSided;if(V!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),V=a.flipSided};this.setDepthTest=function(a){U!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),U=a)};this.setDepthWrite=function(a){aa!==a&&(j.depthMask(a),aa=a)};this.setBlending=function(a){if(a!==ba){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);
|
|
|
|
-j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}ba=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),H.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);
|
|
|
|
-var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=y(a.format),f=y(a.type);w(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
|
-if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=y(a.format),e=y(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
|
|
|
+0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if($!==a.doubleSided)a.doubleSided?
|
|
|
|
+j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),$=a.doubleSided;if(aa!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),aa=a.flipSided};this.setDepthTest=function(a){Y!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Y=a)};this.setDepthWrite=function(a){ca!==a&&(j.depthMask(a),ca=a)};this.setBlending=function(a){if(a!==ba){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);
|
|
|
|
+j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}ba=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),G.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);
|
|
|
|
+var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=A(a.format),f=A(a.type);w(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
|
+if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,
|
|
c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,
|
|
-a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=ka,a=db,e=Ea,c=Ba);b!==F&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),F=b);lb=d;eb=a};this.shadowMapPlugin=
|
|
|
|
|
|
+a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=qa,a=ib,e=Ha,c=ra);b!==E&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),E=b);Va=d;lb=a};this.shadowMapPlugin=
|
|
new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
|
|
@@ -364,19 +366,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,q=h.length;o<q;o++){var n=new THREE.Vertex(h[o].position.clone());c&&c.multiplyVector3(n.position);g.push(n)}for(o=
|
|
|
|
-0,q=k.length;o<q;o++){var g=k[o],r,s,t=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=t.length;h<n;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(n=w.length;h<n;h++)s=w[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];n=h.id;
|
|
|
|
-w=m[n];if(void 0===w)w=a.materials.length,m[n]=w,a.materials.push(h);r.materialIndex=w}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
|
|
|
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],p=f.faceVertexUvs[0],n={},o=0;o<a.materials.length;o++)n[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,q=h.length;o<q;o++){var m=new THREE.Vertex(h[o].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}for(o=
|
|
|
|
+0,q=k.length;o<q;o++){var g=k[o],r,s,t=g.vertexNormals,w=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=t.length;h<m;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(m=w.length;h<m;h++)s=w[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;
|
|
|
|
+w=n[m];if(void 0===w)w=a.materials.length,n[m]=w,a.materials.push(h);r.materialIndex=w}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
|
|
0,c=e.length;a<c;a++){var h=e[a],i,k,l=h.vertexNormals,p=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(g=l.length;d<g;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(g=p.length;d<g;d++)k=p[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
|
|
0,c=e.length;a<c;a++){var h=e[a],i,k,l=h.vertexNormals,p=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(g=l.length;d<g;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(g=p.length;d<g;d++)k=p[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
|
|
g;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
g;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?
|
|
f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?
|
|
-THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)l=g[d.a].position,p=g[d.b].position,m=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,p,m);else if(d instanceof
|
|
|
|
-THREE.Face4)l=g[d.a].position,p=g[d.b].position,m=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,m,o),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
|
|
|
|
+THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,p,n,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)l=g[d.a].position,p=g[d.b].position,n=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,p,n);else if(d instanceof
|
|
|
|
+THREE.Face4)l=g[d.a].position,p=g[d.b].position,n=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,n,o),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
|
|
(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},getNormalMap:function(a,
|
|
-b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var p=1;p<e;p++){var m=0>p-1?e-1:p-1,o=(p+1)%e,q=0>l-1?d-1:l-1,n=(l+1)%d,r=[],s=[0,0,h[4*(p*d+l)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(m*d+q)]/255*b]);r.push([0,-1,
|
|
|
|
-h[4*(m*d+l)]/255*b]);r.push([1,-1,h[4*(m*d+n)]/255*b]);r.push([1,0,h[4*(p*d+n)]/255*b]);r.push([1,1,h[4*(o*d+n)]/255*b]);r.push([0,1,h[4*(o*d+l)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);m=[];q=r.length;for(o=0;o<q;o++){var n=r[o],t=r[(o+1)%q],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];m.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}r=[0,0,0];for(o=0;o<m.length;o++)r[0]+=m[o][0],r[1]+=m[o][1],r[2]+=m[o][2];r[0]/=m.length;r[1]/=m.length;r[2]/=m.length;
|
|
|
|
|
|
+b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var p=1;p<e;p++){var n=0>p-1?e-1:p-1,o=(p+1)%e,q=0>l-1?d-1:l-1,m=(l+1)%d,r=[],s=[0,0,h[4*(p*d+l)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(n*d+q)]/255*b]);r.push([0,-1,
|
|
|
|
+h[4*(n*d+l)]/255*b]);r.push([1,-1,h[4*(n*d+m)]/255*b]);r.push([1,0,h[4*(p*d+m)]/255*b]);r.push([1,1,h[4*(o*d+m)]/255*b]);r.push([0,1,h[4*(o*d+l)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);n=[];q=r.length;for(o=0;o<q;o++){var m=r[o],t=r[(o+1)%q],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];n.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}r=[0,0,0];for(o=0;o<n.length;o++)r[0]+=n[o][0],r[1]+=n[o][1],r[2]+=n[o][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;
|
|
s=4*(p*d+l);k[s]=255*((r[0]+1)/2)|0;k[s+1]=255*(r[1]+0.5)|0;k[s+2]=255*r[2]|0;k[s+3]=255}g.putImageData(i,0,0);return f}};
|
|
s=4*(p*d+l);k[s]=255*((r[0]+1)/2)|0;k[s+1]=255*(r[1]+0.5)|0;k[s+2]=255*r[2]|0;k[s+3]=255}g.putImageData(i,0,0);return f}};
|
|
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
|
|
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
|
|
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
|
|
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
|
|
@@ -426,9 +428,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
|
|
THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,f));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,f));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,k,l,p,m,o,q,n;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];m=f[1];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)n=g/a,f=THREE.Shape.Utils.b2(n,o,p,h),n=THREE.Shape.Utils.b2(n,q,m,
|
|
|
|
-i),c.push(new THREE.Vector2(f,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];m=f[1];k=f[2];l=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)n=g/a,f=THREE.Shape.Utils.b3(n,o,p,k,h),n=THREE.Shape.Utils.b3(n,q,m,l,i),c.push(new THREE.Vector2(f,n));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];n=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
|
|
|
|
-for(g=1;g<=n;g++)c.push(f.getPointAt(g/n));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];p=f[3];n=f[4];m=!!f[5];l=g[g.length-2];o=g[g.length-1];0==g.length&&(l=o=0);q=n-p;var r=2*a;for(g=1;g<=r;g++)n=g/r,m||(n=1-n),n=p+n*q,f=l+h+k*Math.cos(n),n=o+i+k*Math.sin(n),c.push(new THREE.Vector2(f,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
|
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,k,l,p,n,o,q,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];n=f[1];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,o,p,h),m=THREE.Shape.Utils.b2(m,q,n,
|
|
|
|
+i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];n=f[1];k=f[2];l=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,o,p,k,h),m=THREE.Shape.Utils.b3(m,q,n,l,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
|
|
|
|
+for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];p=f[3];m=f[4];n=!!f[5];l=g[g.length-2];o=g[g.length-1];0==g.length&&(l=o=0);q=m-p;var r=2*a;for(g=1;g<=r;g++)m=g/r,n||(m=1-m),m=p+m*q,f=l+h+k*Math.cos(m),m=o+i+k*Math.sin(m),c.push(new THREE.Vector2(f,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
|
|
THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,k,l,p;for(h=0,i=g.length;h<i;h++)k=g[h],l=k.x,p=k.y,k.x=a*l+b*p+c,k.y=d*p+e*l+f;return g};
|
|
THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,k,l,p;for(h=0,i=g.length;h<i;h++)k=g[h],l=k.x,p=k.y,k.x=a*l+b*p+c,k.y=d*p+e*l+f;return g};
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
|
|
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
|
|
this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
|
|
this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
|
|
@@ -436,8 +438,8 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a
|
|
b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
|
|
b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
|
|
THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
|
|
THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
|
|
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,p,m,o,q=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];o=[];for(p=0;p<c.length;p++)l=c[p],l=m.distanceToSquared(l),o.push(l),l<f&&(f=l,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var n=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var r=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(r);o=h;l=g;h+=1;g+=-1;0>
|
|
|
|
-h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[k[g],k[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+m>n+r&&(h=o,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);p=c.slice(0,h);m=c.slice(h);o=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];q.push([k[g],c[h],c[e]]);q.push(f);c=p.concat(o).concat(l).concat(m)}return{shape:c,
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,p,n,o,q=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];o=[];for(p=0;p<c.length;p++)l=c[p],l=n.distanceToSquared(l),o.push(l),l<f&&(f=l,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var m=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(m);var r=[k[g],k[f],c[h]];n=THREE.FontUtils.Triangulate.area(r);o=h;l=g;h+=1;g+=-1;0>
|
|
|
|
+h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;m=[k[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[k[g],k[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+n>m+r&&(h=o,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);p=c.slice(0,h);n=c.slice(h);o=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];q.push([k[g],c[h],c[e]]);q.push(f);c=p.concat(o).concat(l).concat(n)}return{shape:c,
|
|
isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
|
|
this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
|
|
@@ -451,8 +453,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
|
|
THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,l=this.data.JIT.hierarchy,p,m;m=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==l[o][k])a instanceof THREE.Bone?(a.skinMatrix=l[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
|
-l[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;3>n;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(p<m)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,l=this.data.JIT.hierarchy,p,n;n=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==l[o][k])a instanceof THREE.Bone?(a.skinMatrix=l[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
|
|
|
|
+l[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(p<n)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
|
|
g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
|
|
this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
|
|
c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===l[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)l[o][k]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===l[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)l[o][k]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
|
|
@@ -466,7 +468,7 @@ e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0]
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(void 0!==b.animationCache){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(void 0!==b.animationCache){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
|
|
THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=this.hierarchy[a];if(l.length){for(l=
|
|
THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=this.hierarchy[a];if(l.length){for(l=
|
|
0;l<f.length;l++)g=f[l],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(l.length){if(this.JITCompile&&p)d instanceof
|
|
0;l<f.length;l++)g=f[l],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(l.length){if(this.JITCompile&&p)d instanceof
|
|
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;)b=c,c=l[b.index+1]}else if(!i)for(var m=l.length-1;c.time<g&&c.index!==m;)b=c,c=l[b.index+1];p.prevKey=b;p.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof
|
|
|
|
|
|
+THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;)b=c,c=l[b.index+1]}else if(!i)for(var n=l.length-1;c.time<g&&c.index!==n;)b=c,c=l[b.index+1];p.prevKey=b;p.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof
|
|
THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
@@ -505,12 +507,12 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
-THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,k=0,l=0,p=0,m=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
|
-this.rotateHorizontally(b*p);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*k);this.object.translateY(b*l);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
|
|
|
|
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,k=0,l=0,p=0,n=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
|
+this.rotateHorizontally(b*p);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*k);this.object.translateY(b*l);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
|
|
e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;m=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;n=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
|
|
THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
0,0);var d=!1,e=-1,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
|
|
0,0);var d=!1,e=-1,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
|
|
@@ -520,39 +522,39 @@ c.target.addSelf(b);c.staticMoving?l=p:l.addSelf(a.sub(p,l).multiplyScalar(c.dyn
|
|
c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),l=p=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
|
|
c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),l=p=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
|
|
a.clientY):2===e&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
|
|
a.clientY):2===e&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
|
|
e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
|
|
e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,m,l){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=f||1;var j=o+1,t=p+1,w=h/o,F=i/p,P=new THREE.Vector3;P[n]=0<m?1:-1;for(h=0;h<t;h++)for(i=0;i<j;i++){var R=new THREE.Vector3;R[a]=(i*w-q)*c;R[b]=(h*F-r)*g;R[n]=m;k.vertices.push(new THREE.Vertex(R))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
|
-new THREE.Face4(i+j*h+s,i+j*(h+1)+s,i+1+j*(h+1)+s,i+1+j*h+s),a.normal.copy(P),a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,m=c/2,o,q,n,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
|
|
|
|
-3;n=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var w in h)void 0!==this.sides[w]&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,o);this.sides.nx&&i("z","y",1,-1,c,b,-l,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,m,l){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=f||1;var j=o+1,t=p+1,w=h/o,E=i/p,Q=new THREE.Vector3;Q[n]=0<m?1:-1;for(h=0;h<t;h++)for(i=0;i<j;i++){var N=new THREE.Vector3;N[a]=(i*w-q)*c;N[b]=(h*E-r)*g;N[n]=m;k.vertices.push(new THREE.Vertex(N))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
|
+new THREE.Face4(i+j*h+s,i+j*(h+1)+s,i+1+j*(h+1)+s,i+1+j*h+s),a.normal.copy(Q),a.vertexNormals.push(Q.clone(),Q.clone(),Q.clone(),Q.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,n=c/2,o,q,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
|
|
|
|
+3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var w in h)void 0!==this.sides[w]&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,o);this.sides.nx&&i("z","y",1,-1,c,b,-l,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var p=[],m=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=q*Math.sin(2*n*Math.PI),s=-o*c+g,t=q*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);l.push(m)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],p=k[i+1][h],
|
|
|
|
-m=k[i+1][h+1],o=k[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[m].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=l[i][h].clone(),w=l[i+1][h].clone(),u=l[i+1][h+1].clone(),v=l[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[q,n,r,s]));this.faceVertexUvs[0].push([t,w,u,v])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
|
-0;h<d;h++)c=k[0][h],p=k[0][h+1],m=this.vertices.length-1,q=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=l[0][h].clone(),w=l[0][h+1].clone(),u=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(c,p,m,[q,n,r])),this.faceVertexUvs[0].push([t,w,u])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=k[i][h+1],p=k[i][h],m=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
|
|
|
|
-0),t=l[i][h+1].clone(),w=l[i][h].clone(),u=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,p,m,[q,n,r])),this.faceVertexUvs[0].push([t,w,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var p=[],n=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-o*c+g,t=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);n.push(new THREE.UV(m,o))}k.push(p);l.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],p=k[i+1][h],
|
|
|
|
+n=k[i+1][h+1],o=k[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=l[i][h].clone(),w=l[i+1][h].clone(),u=l[i+1][h+1].clone(),v=l[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,n,o,[q,m,r,s]));this.faceVertexUvs[0].push([t,w,u,v])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
|
|
|
|
+0;h<d;h++)c=k[0][h],p=k[0][h+1],n=this.vertices.length-1,q=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=l[0][h].clone(),w=l[0][h+1].clone(),u=new THREE.UV(w.u,0),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([t,w,u])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=k[i][h+1],p=k[i][h],n=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
|
|
|
|
+0),t=l[i][h+1].clone(),w=l[i][h].clone(),u=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([t,w,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,e=a.length;this.shapebb=a[e-1].getBoundingBox();for(d=0;d<e;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,e=a.length;this.shapebb=a[e-1].getBoundingBox();for(d=0;d<e;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,j=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,j=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
|
|
-h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(j=a.length;0<=--j;){A=j;F=j-1;0>F&&(F=a.length-1);for(var b=
|
|
|
|
-0,c=o+2*l,b=0;b<c;b++){var d=O*b,e=O*(b+1),f=ia+A+d,g=ia+A+e,k=f,d=ia+F+d,e=ia+F+e,m=g,k=k+E,d=d+E,e=e+E,m=m+E;B.faces.push(new THREE.Face4(k,d,e,m,null,null,u));void 0!==u&&(k=b/c,d=(b+1)/c,e=h+2*i,f=(B.vertices[f].position.z+i)/e,g=(B.vertices[g].position.z+i)/e,B.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=E;b+=E;c+=E;B.faces.push(new THREE.Face3(a,
|
|
|
|
-b,c,null,null,w));if(void 0!==w){var d=v.minX,e=v.minY,f=v.maxY,g=v.maxX,h=B.vertices[b].position.x-d,b=B.vertices[b].position.y-e,j=B.vertices[c].position.x-d,c=B.vertices[c].position.y-e;B.faceVertexUvs[0].push([new THREE.UV((B.vertices[a].position.x-d)/g,(B.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(j/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
|
-3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,n=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,w=b.material,u=b.extrudeMaterial,v=this.shapebb;if(n)r=n.getPoints(m),o=r.length,s=!0,p=!1;p||(k=i=l=0);var y,D,C,B=this,E=this.vertices.length;q&&a.addWrapPath(q);m=t?a.extractAllSpacedPoints(m):a.extractAllPoints(m);q=m.shape;m=m.holes;if(n=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(D=
|
|
|
|
-0,C=m.length;D<C;D++)y=m[D],THREE.Shape.Utils.isClockWise(y)&&(m[D]=y.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,m);t=q;for(D=0,C=m.length;D<C;D++)y=m[D],q=q.concat(y);for(var J,N,S,K,O=q.length,M=n.length,H=[],j=0,Z=t.length,A=Z-1,F=j+1;j<Z;j++,A++,F++)A===Z&&(A=0),F===Z&&(F=0),H[j]=d(t[j],t[A],t[F]);var P=[],R,ea=H.concat();for(D=0,C=m.length;D<C;D++){y=m[D];R=[];for(j=0,Z=y.length,A=Z-1,F=j+1;j<Z;j++,A++,F++)A===Z&&(A=0),F===Z&&(F=0),R[j]=d(y[j],y[A],y[F]);P.push(R);ea=ea.concat(R)}for(J=
|
|
|
|
-0;J<l;J++){N=J/l;S=i*(1-N);N=k*Math.sin(N*Math.PI/2);for(j=0,Z=t.length;j<Z;j++)K=c(t[j],H[j],N),f(K.x,K.y,-S);for(D=0,C=m.length;D<C;D++){y=m[D];R=P[D];for(j=0,Z=y.length;j<Z;j++)K=c(y[j],R[j],N),f(K.x,K.y,-S)}}N=k;for(j=0;j<O;j++)K=p?c(q[j],ea[j],N):q[j],s?f(K.x,K.y+r[0].y,r[0].x):f(K.x,K.y,0);for(J=1;J<=o;J++)for(j=0;j<O;j++)K=p?c(q[j],ea[j],N):q[j],s?f(K.x,K.y+r[J-1].y,r[J-1].x):f(K.x,K.y,h/o*J);for(J=l-1;0<=J;J--){N=J/l;S=i*(1-N);N=k*Math.sin(N*Math.PI/2);for(j=0,Z=t.length;j<Z;j++)K=c(t[j],
|
|
|
|
-H[j],N),f(K.x,K.y,h+S);for(D=0,C=m.length;D<C;D++){y=m[D];R=P[D];for(j=0,Z=y.length;j<Z;j++)K=c(y[j],R[j],N),s?f(K.x,K.y+r[o-1].y,r[o-1].x+S):f(K.x,K.y,h+S)}}if(p){p=0*O;for(j=0;j<M;j++)k=n[j],g(k[2]+p,k[1]+p,k[0]+p);p=O*(o+2*l);for(j=0;j<M;j++)k=n[j],g(k[0]+p,k[1]+p,k[2]+p)}else{for(j=0;j<M;j++)k=n[j],g(k[2],k[1],k[0]);for(j=0;j<M;j++)k=n[j],g(k[0]+O*o,k[1]+O*o,k[2]+O*o)}var ia=0;e(t);ia+=t.length;for(D=0,C=m.length;D<C;D++)y=m[D],e(y),ia+=y.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
|
|
|
+h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(j=a.length;0<=--j;){z=j;E=j-1;0>E&&(E=a.length-1);for(var b=
|
|
|
|
+0,c=o+2*l,b=0;b<c;b++){var d=P*b,e=P*(b+1),f=ia+z+d,g=ia+z+e,m=f,d=ia+E+d,e=ia+E+e,k=g,m=m+I,d=d+I,e=e+I,k=k+I;D.faces.push(new THREE.Face4(m,d,e,k,null,null,u));void 0!==u&&(m=b/c,d=(b+1)/c,e=h+2*i,f=(D.vertices[f].position.z+i)/e,g=(D.vertices[g].position.z+i)/e,D.faceVertexUvs[0].push([new THREE.UV(f,m),new THREE.UV(g,m),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){D.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=I;b+=I;c+=I;D.faces.push(new THREE.Face3(a,
|
|
|
|
+b,c,null,null,w));if(void 0!==w){var d=v.minX,e=v.minY,f=v.maxY,g=v.maxX,h=D.vertices[b].position.x-d,b=D.vertices[b].position.y-e,j=D.vertices[c].position.x-d,c=D.vertices[c].position.y-e;D.faceVertexUvs[0].push([new THREE.UV((D.vertices[a].position.x-d)/g,(D.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(j/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
|
+3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,w=b.material,u=b.extrudeMaterial,v=this.shapebb;if(m)r=m.getPoints(n),o=r.length,s=!0,p=!1;p||(k=i=l=0);var A,B,C,D=this,I=this.vertices.length;q&&a.addWrapPath(q);n=t?a.extractAllSpacedPoints(n):a.extractAllPoints(n);q=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(B=
|
|
|
|
+0,C=n.length;B<C;B++)A=n[B],THREE.Shape.Utils.isClockWise(A)&&(n[B]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,n);t=q;for(B=0,C=n.length;B<C;B++)A=n[B],q=q.concat(A);for(var K,O,S,L,P=q.length,H=m.length,G=[],j=0,X=t.length,z=X-1,E=j+1;j<X;j++,z++,E++)z===X&&(z=0),E===X&&(E=0),G[j]=d(t[j],t[z],t[E]);var Q=[],N,ea=G.concat();for(B=0,C=n.length;B<C;B++){A=n[B];N=[];for(j=0,X=A.length,z=X-1,E=j+1;j<X;j++,z++,E++)z===X&&(z=0),E===X&&(E=0),N[j]=d(A[j],A[z],A[E]);Q.push(N);ea=ea.concat(N)}for(K=
|
|
|
|
+0;K<l;K++){O=K/l;S=i*(1-O);O=k*Math.sin(O*Math.PI/2);for(j=0,X=t.length;j<X;j++)L=c(t[j],G[j],O),f(L.x,L.y,-S);for(B=0,C=n.length;B<C;B++){A=n[B];N=Q[B];for(j=0,X=A.length;j<X;j++)L=c(A[j],N[j],O),f(L.x,L.y,-S)}}O=k;for(j=0;j<P;j++)L=p?c(q[j],ea[j],O):q[j],s?f(L.x,L.y+r[0].y,r[0].x):f(L.x,L.y,0);for(K=1;K<=o;K++)for(j=0;j<P;j++)L=p?c(q[j],ea[j],O):q[j],s?f(L.x,L.y+r[K-1].y,r[K-1].x):f(L.x,L.y,h/o*K);for(K=l-1;0<=K;K--){O=K/l;S=i*(1-O);O=k*Math.sin(O*Math.PI/2);for(j=0,X=t.length;j<X;j++)L=c(t[j],
|
|
|
|
+G[j],O),f(L.x,L.y,h+S);for(B=0,C=n.length;B<C;B++){A=n[B];N=Q[B];for(j=0,X=A.length;j<X;j++)L=c(A[j],N[j],O),s?f(L.x,L.y+r[o-1].y,r[o-1].x+S):f(L.x,L.y,h+S)}}if(p){p=0*P;for(j=0;j<H;j++)k=m[j],g(k[2]+p,k[1]+p,k[0]+p);p=P*(o+2*l);for(j=0;j<H;j++)k=m[j],g(k[0]+p,k[1]+p,k[2]+p)}else{for(j=0;j<H;j++)k=m[j],g(k[2],k[1],k[0]);for(j=0;j<H;j++)k=m[j],g(k[0]+P*o,k[1]+P*o,k[2]+P*o)}var ia=0;e(t);ia+=t.length;for(B=0,C=n.length;B<C;B++)A=n[B],e(A),ia+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
|
|
THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,l=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(l),e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,l=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(l),e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
|
|
c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],l=[];for(i=0;i<=c;i++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,n=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,r,s)));p.push(this.vertices.length-1);m.push(new THREE.UV(o,
|
|
|
|
-q))}k.push(p);l.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],p=this.vertices[d].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),n=l[i][h+1].clone(),r=l[i][h].clone(),s=l[i+1][h].clone(),t=l[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,q])),this.faceVertexUvs[0].push([n,
|
|
|
|
-s,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,m,o])),this.faceVertexUvs[0].push([n,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,q])),this.faceVertexUvs[0].push([n,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],l=[];for(i=0;i<=c;i++){var p=[],n=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,m=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,s)));p.push(this.vertices.length-1);n.push(new THREE.UV(o,
|
|
|
|
+q))}k.push(p);l.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],p=this.vertices[d].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),m=l[i][h+1].clone(),r=l[i][h].clone(),s=l[i+1][h].clone(),t=l[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,q])),this.faceVertexUvs[0].push([m,
|
|
|
|
+s,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,n,o])),this.faceVertexUvs[0].push([m,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,n,o,q])),this.faceVertexUvs[0].push([m,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,p,m,o,q,n,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,l));e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,
|
|
|
|
-l));e.lineTo(i,l);break;case "q":i=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,l);if(g=f[f.length-1]){p=g.x;m=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,w=THREE.Shape.Utils.b2(t,p,o,i),t=THREE.Shape.Utils.b2(t,m,q,l);f.push(new THREE.Vector2(w,t))}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,n=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,l,o,q,n,r),g=f[f.length-1]){p=g.x;m=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,w=THREE.Shape.Utils.b3(t,p,o,
|
|
|
|
-n,i),t=THREE.Shape.Utils.b3(t,m,q,r,l),f.push(new THREE.Vector2(w,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
|
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var o=i,q=k,n=l,r=e,s=g,t=void 0,w=void 0,u=void 0,v=void 0,y=void 0,
|
|
|
|
-D=void 0,C=void 0,B=void 0,E=void 0,w=m[s[o]].x,u=m[s[o]].y,v=m[s[q]].x,y=m[s[q]].y,D=m[s[n]].x,C=m[s[n]].y;if(1.0E-10>(v-w)*(C-u)-(y-u)*(D-w))m=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==n)){var B=m[s[t]].x,E=m[s[t]].y,J=void 0,N=void 0,S=void 0,K=void 0,O=void 0,M=void 0,H=void 0,j=void 0,Z=void 0,A=void 0,F=void 0,P=void 0,J=S=O=void 0,J=D-v,N=C-y,S=w-D,K=u-C,O=v-w,M=y-u,H=B-w,j=E-u,Z=B-v,A=E-y,F=B-D,P=E-C,J=J*A-N*Z,O=O*j-M*H,S=S*P-K*F;if(0<=J&&0<=S&&0<=O){m=!1;break a}}m=!0}}if(m){f.push([a[g[i]],
|
|
|
|
|
|
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,p,n,o,q,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,l));e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,
|
|
|
|
+l));e.lineTo(i,l);break;case "q":i=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,l);if(g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,w=THREE.Shape.Utils.b2(t,p,o,i),t=THREE.Shape.Utils.b2(t,n,q,l);f.push(new THREE.Vector2(w,t))}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,l,o,q,m,r),g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,w=THREE.Shape.Utils.b3(t,p,o,
|
|
|
|
+m,i),t=THREE.Shape.Utils.b3(t,n,q,r,l),f.push(new THREE.Vector2(w,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
|
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{n=a;var o=i,q=k,m=l,r=e,s=g,t=void 0,w=void 0,u=void 0,v=void 0,A=void 0,
|
|
|
|
+B=void 0,C=void 0,D=void 0,I=void 0,w=n[s[o]].x,u=n[s[o]].y,v=n[s[q]].x,A=n[s[q]].y,B=n[s[m]].x,C=n[s[m]].y;if(1.0E-10>(v-w)*(C-u)-(A-u)*(B-w))n=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var D=n[s[t]].x,I=n[s[t]].y,K=void 0,O=void 0,S=void 0,L=void 0,P=void 0,H=void 0,G=void 0,j=void 0,X=void 0,z=void 0,E=void 0,Q=void 0,K=S=P=void 0,K=B-v,O=C-A,S=w-B,L=u-C,P=v-w,H=A-u,G=D-w,j=I-u,X=D-v,z=I-A,E=D-B,Q=I-C,K=K*z-O*X,P=P*j-H*G,S=S*Q-L*E;if(0<=K&&0<=S&&0<=P){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
|
|
a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);for(i=k,l=k+1;l<e;i++,l++)g[i]=g[l];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);for(i=k,l=k+1;l<e;i++,l++)g[i]=g[l];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
@@ -575,13 +577,13 @@ this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THR
|
|
THREE.CameraHelper.prototype.update=function(a){function b(a,b,f,g){THREE.CameraHelper.__v.set(b,f,g);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(f=a.length;b<f;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
|
|
THREE.CameraHelper.prototype.update=function(a){function b(a,b,f,g){THREE.CameraHelper.__v.set(b,f,g);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(f=a.length;b<f;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
|
|
1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var l,n,p,o=0;4>o;o++){p=i[o];l=new THREE.Color;l.setRGB(0,0,0);for(var q=0;q<p.length;q++)n=h.vertexColors[p[q]-1],l.r+=n.r,l.g+=n.g,l.b+=n.b;l.r/=p.length;l.g/=p.length;l.b/=p.length;k.vertexColors[o]=l}}e.push(k);(!g.supportUVs||0!=m.length)&&f.push([m[a],m[b],m[c],m[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
-b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},p={},m=[],o,q,n,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(n=0,r=t[o].length;n<r;n++)s=d[o]["abcd".charAt(n)],m[s]||(m[s]=t[o][n]);var w;for(o=0,q=d.length;o<q;o++)if(s=d[o],k.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=m.length){w=new THREE.UV;if(s instanceof THREE.Face3)w.u=m[s.a].u+m[s.b].u+m[s.c].u,w.v=m[s.a].v+m[s.b].v+m[s.c].v,w.u/=3,w.v/=3;else if(s instanceof THREE.Face4)w.u=
|
|
|
|
-m[s.a].u+m[s.b].u+m[s.c].u+m[s.d].u,w.v=m[s.a].v+m[s.b].v+m[s.c].v+m[s.d].v,w.u/=4,w.v/=4;m.push(w)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var u=0,t=h.length,v,y,D={},C={},B=function(a,
|
|
|
|
-b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},E=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in q){w=q[o];v=o.split("_");y=v[0];v=v[1];B(y,[y,v]);B(v,[y,v]);for(n=0,r=w.length;n<r;n++)s=w[n],E(y,s,o),E(v,s,o);2>w.length&&(p[o]=!0)}for(o in q)if(w=q[o],s=w[0],w=w[1],v=o.split("_"),y=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[s]),r.addSelf(k[w]),r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
|
-l[o]=t+d.length+u,i.push(new THREE.Vertex(r)),u++,g.supportUVs&&0!=m.length)w=new THREE.UV,w.u=m[y].u+m[v].u,w.v=m[y].v+m[v].v,w.u/=2,w.v/=2,m.push(w);var J,N;v=["123","12","2","23"];r=["123","23","3","31"];var B=["123","31","1","12"],E=["1234","12","2","23"],S=["1234","23","3","34"],K=["1234","34","4","41"],O=["1234","41","1","12"];for(o=0,q=k.length;o<q;o++)s=d[o],w=t+o,s instanceof THREE.Face3?(u=c(s.a,s.b),y=c(s.b,s.c),J=c(s.c,s.a),b(w,l[u],s.b,l[y],s,v),b(w,l[y],s.c,l[J],s,r),b(w,l[J],s.a,l[u],
|
|
|
|
-s,B)):s instanceof THREE.Face4?(u=c(s.a,s.b),y=c(s.b,s.c),J=c(s.c,s.d),N=c(s.d,s.a),b(w,l[u],s.b,l[y],s,E),b(w,l[y],s.c,l[J],s,S),b(w,l[J],s.d,l[N],s,K),b(w,l[N],s.a,l[u],s,O)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;l=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==D[o]){i.set(0,0,0);l.set(0,0,0);s=new THREE.Vector3(0,0,0);w=0;for(n in C[o])i.addSelf(k[n]),w++;u=0;t=D[o].length;for(n=0;n<t;n++)p[c(D[o][n][0],D[o][n][1])]&&u++;if(2!=u){i.divideScalar(w);for(n=0;n<
|
|
|
|
-t;n++)w=D[o][n],w=h[w[0]].position.clone().addSelf(h[w[1]].position).divideScalar(2),l.addSelf(w);l.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(l.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var m=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){m.vertexColors=[];for(var k,l,p,o=0;4>o;o++){p=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++)l=h.vertexColors[p[q]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=p.length;k.g/=p.length;k.b/=p.length;m.vertexColors[o]=k}}e.push(m);(!g.supportUVs||0!=n.length)&&f.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},p={},n=[],o,q,m,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(m=0,r=t[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],n[s]||(n[s]=t[o][m]);var w;for(o=0,q=d.length;o<q;o++)if(s=d[o],k.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=n.length){w=new THREE.UV;if(s instanceof THREE.Face3)w.u=n[s.a].u+n[s.b].u+n[s.c].u,w.v=n[s.a].v+n[s.b].v+n[s.c].v,w.u/=3,w.v/=3;else if(s instanceof THREE.Face4)w.u=
|
|
|
|
+n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,w.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,w.u/=4,w.v/=4;n.push(w)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var u=0,t=h.length,v,A,B={},C={},D=function(a,
|
|
|
|
+b){void 0===B[a]&&(B[a]=[]);B[a].push(b)},I=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in q){w=q[o];v=o.split("_");A=v[0];v=v[1];D(A,[A,v]);D(v,[A,v]);for(m=0,r=w.length;m<r;m++)s=w[m],I(A,s,o),I(v,s,o);2>w.length&&(p[o]=!0)}for(o in q)if(w=q[o],s=w[0],w=w[1],v=o.split("_"),A=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[s]),r.addSelf(k[w]),r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
|
+l[o]=t+d.length+u,i.push(new THREE.Vertex(r)),u++,g.supportUVs&&0!=n.length)w=new THREE.UV,w.u=n[A].u+n[v].u,w.v=n[A].v+n[v].v,w.u/=2,w.v/=2,n.push(w);var K,O;v=["123","12","2","23"];r=["123","23","3","31"];var D=["123","31","1","12"],I=["1234","12","2","23"],S=["1234","23","3","34"],L=["1234","34","4","41"],P=["1234","41","1","12"];for(o=0,q=k.length;o<q;o++)s=d[o],w=t+o,s instanceof THREE.Face3?(u=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(w,l[u],s.b,l[A],s,v),b(w,l[A],s.c,l[K],s,r),b(w,l[K],s.a,l[u],
|
|
|
|
+s,D)):s instanceof THREE.Face4?(u=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),O=c(s.d,s.a),b(w,l[u],s.b,l[A],s,I),b(w,l[A],s.c,l[K],s,S),b(w,l[K],s.d,l[O],s,L),b(w,l[O],s.a,l[u],s,P)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;l=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==B[o]){i.set(0,0,0);l.set(0,0,0);s=new THREE.Vector3(0,0,0);w=0;for(m in C[o])i.addSelf(k[m]),w++;u=0;t=B[o].length;for(m=0;m<t;m++)p[c(B[o][m][0],B[o][m][1])]&&u++;if(2!=u){i.divideScalar(w);for(m=0;m<
|
|
|
|
+t;m++)w=B[o][m],w=h[w[0]].position.clone().addSelf(h[w[1]].position).divideScalar(2),l.addSelf(w);l.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(l.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
|
|
@@ -597,127 +599,126 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHtt
|
|
g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
|
|
f.responseType="arraybuffer";f.send(null)};
|
|
f.responseType="arraybuffer";f.send(null)};
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,p,m,o,q,n,r,s,t,w,u,v;function y(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function B(b,c){var d,e,f,g,h,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=j[2*e];e=j[2*e+1];i=j[2*f];k=j[2*f+1];f=j[2*g];l=j[2*g+1];g=O.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,k));
|
|
|
|
-n.push(new THREE.UV(f,l));g.push(n)}}function E(b,c){var d,e,f,g,h,i,k,l,m,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=j[2*e];e=j[2*e+1];k=j[2*f];m=j[2*f+1];l=j[2*g];n=j[2*g+1];g=j[2*h];f=j[2*h+1];h=O.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,m));p.push(new THREE.UV(l,n));p.push(new THREE.UV(g,f));h.push(p)}}function J(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
|
|
|
|
-d+1],g=c[3*d+2],h=j[d],O.faces.push(new THREE.Face3(e,f,g,null,null,h))}function N(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],j=i[d],O.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}function S(b,c,d,e){for(var f,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];i=d[3*e];k=d[3*e+1];l=d[3*e+2];j=m[e];var n=H[3*k],o=H[3*k+1];k=
|
|
|
|
-H[3*k+2];var p=H[3*l],q=H[3*l+1];l=H[3*l+2];O.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(H[3*i],H[3*i+1],H[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,j))}}function K(b,c,d,e){for(var f,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];j=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];i=o[e];var p=H[3*l],q=H[3*l+1];l=H[3*l+2];var r=H[3*m],s=H[3*m+1];m=H[3*m+2];var t=H[3*n],u=H[3*
|
|
|
|
-n+1];n=H[3*n+2];O.faces.push(new THREE.Face4(f,g,h,j,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,i))}}var O=this,M=0,H=[],j=[],Z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(O,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,M,12);e=D(a,M+12);D(a,M+13);D(a,M+14);D(a,M+15);i=D(a,M+16);k=D(a,M+17);l=D(a,M+18);p=D(a,M+19);m=C(a,M+20);
|
|
|
|
-o=C(a,M+20+4);q=C(a,M+20+8);b=C(a,M+20+12);n=C(a,M+20+16);r=C(a,M+20+20);s=C(a,M+20+24);t=C(a,M+20+28);w=C(a,M+20+32);u=C(a,M+20+36);v=C(a,M+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");M+=e;c=3*i+p;A=4*i+p;e=b*c;Z=n*(c+3*k);i=r*(c+3*l);p=s*(c+3*k+3*l);c=t*A;k=w*(A+4*k);l=u*(A+4*l);M+=function(b){var b=new Float32Array(a,b,3*m),c,d,e,f;for(c=0;c<m;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],O.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
|
|
|
|
-m*Float32Array.BYTES_PER_ELEMENT}(M);M+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(M);M+=y(3*o);M+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],j.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(M);e=M+e+y(2*b);Z=e+Z+y(2*n);i=Z+i+y(2*r);p=i+p+y(2*s);c=p+c+y(2*t);k=c+k+y(2*w);l=k+l+y(2*u);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
|
-J(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);B(r,b)}})(Z);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;S(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);B(s,c)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;N(u,a,b+4*u*Uint32Array.BYTES_PER_ELEMENT);E(u,b)}})(k);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;K(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);E(v,c)}})(l);b&&J(b,M,M+3*b*
|
|
|
|
-Uint32Array.BYTES_PER_ELEMENT);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;S(n,a,b,b+3*n*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&N(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT;K(w,a,b,b+4*w*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
|
-THREE.ColladaLoader=function(){function a(a,d,e){U=a;d=d||Ta;void 0!==e&&(a=e.split("/"),a.pop(),Sa=1>a.length?"":a.join("/")+"/");if((a=U.evaluate("//dae:asset",U,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var j=a.childNodes[e];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":Ha=j.textContent.charAt(0)}}if(!Qa.convertUpAxis||Ha===Qa.upAxis)Wa=null;else switch(Ha){case "X":Wa="Y"===Qa.upAxis?
|
|
|
|
-"XtoY":"XtoZ";break;case "Y":Wa="X"===Qa.upAxis?"YtoX":"YtoZ";break;case "Z":Wa="X"===Qa.upAxis?"ZtoX":"ZtoY"}Ka=b("//dae:library_images/dae:image",g,"image");db=b("//dae:library_materials/dae:material",C,"material");lb=b("//dae:library_effects/dae:effect",S,"effect");ka=b("//dae:library_geometries/dae:geometry",r,"geometry");eb=b(".//dae:library_cameras/dae:camera",Z,"camera");Ba=b("//dae:library_controllers/dae:controller",h,"controller");Ea=b("//dae:library_animations/dae:animation",O,"animation");
|
|
|
|
-$a=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");Fa=[];ya=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ha=$a[a]):ha=null;aa=new THREE.Object3D;for(a=0;a<ha.nodes.length;a++)aa.add(f(ha.nodes[a]));Za=[];c(aa);a={scene:aa,morphs:Fa,skins:ya,animations:Za,dae:{images:Ka,materials:db,cameras:eb,effects:lb,geometries:ka,controllers:Ba,animations:Ea,visualScenes:$a,
|
|
|
|
-scene:ha}};d&&d(a);return a}function b(a,b,c){for(var a=U.evaluate(a,U,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ha.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};Za.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
|
|
|
|
-{hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,f=Ba[b.url];if(!f||
|
|
|
|
-!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in Ea)for(var j=Ea[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=ha.getChildById(b.skeleton[0],!0)||ha.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);
|
|
|
|
-for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++)if(l=i[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
|
-l.sid+"'.";}for(i=0;i<h.length;i++)if("JOINT"==h[i].type)for(k=0;k<h[i].weights.length;k++)l=h[i].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=j[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[i].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:j})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=Ba[a.controllers[g].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
|
|
|
|
-new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Ba[i.skin.source]&&(d=i=Ba[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
|
|
|
|
-0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=ka[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=lb[db[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=m;l.push(q.material);p=q.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<m){j=new THREE.MeshFaceMaterial;i.materials=
|
|
|
|
-l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Ba[c.url],j.skinInstanceController=c,j.name="skin_"+ya.length,ya.push(j);else if(void 0!==d){h=i;k=d instanceof o?Ba[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(m=ka[k.targets[l]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,
|
|
|
|
-m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Fa.length;Fa.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++)b=eb[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=
|
|
|
|
-g[1];b.useQuaternion=!0;b.scale=g[2];Qa.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];
|
|
|
|
-this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function r(){this.id=
|
|
|
|
-"";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function y(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}
|
|
|
|
-function B(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function N(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function S(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function K(){this.url=""}
|
|
|
|
-function O(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function M(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function H(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function Z(){this.name=this.id=""}function A(){this.url=""}function F(a){return"dae"==
|
|
|
|
-a?"http://www.collada.org/2005/11/COLLADASchema":null}function P(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ea(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ia(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ca(a,b){if(Qa.convertUpAxis&&Ha!==Qa.upAxis)switch(Wa){case "XtoY":var c=a[0];a[0]=b*a[1];
|
|
|
|
-a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function V(a,b){var c=[a[b],a[b+1],a[b+2]];ca(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Qa.convertUpAxis){var b=[a[0],a[4],a[8]];ca(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ca(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],
|
|
|
|
-a[6],a[10]];ca(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ca(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ca(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ca(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];ca(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var U=null,aa=null,ha,Ta=null,oa={},Ka={},Ea={},Ba={},ka={},db={},lb={},eb={},Za,$a,Sa,Fa,ya,za=THREE.SmoothShading,
|
|
|
|
-Qa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ha="Y",Wa=null,mb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);
|
|
|
|
-this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new D).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],
|
|
|
|
-a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new y).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];
|
|
|
|
-if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=P(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new D).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new y).parse(d),e=b[d.source];if("JOINT"==
|
|
|
|
-d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new y).parse(g));break;case "v":c=R(g.textContent);break;case "vcount":d=R(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=
|
|
|
|
-n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}j.push(k);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,p,n,o,q,m,r,s,t,w,u,v;function A(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function D(b,c){var d,e,f,g,h,i,k,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=j[2*e];e=j[2*e+1];i=j[2*f];k=j[2*f+1];f=j[2*g];m=j[2*g+1];g=P.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,k));
|
|
|
|
+n.push(new THREE.UV(f,m));g.push(n)}}function I(b,c){var d,e,f,g,h,i,k,m,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=j[2*e];e=j[2*e+1];k=j[2*f];l=j[2*f+1];m=j[2*g];n=j[2*g+1];g=j[2*h];f=j[2*h+1];h=P.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,l));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,f));h.push(p)}}function K(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
|
|
|
|
+d+1],g=c[3*d+2],h=j[d],P.faces.push(new THREE.Face3(e,f,g,null,null,h))}function O(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],j=i[d],P.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}function S(b,c,d,e){for(var f,g,h,j,i,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];i=d[3*e];k=d[3*e+1];m=d[3*e+2];j=l[e];var n=G[3*k],o=G[3*k+1];k=
|
|
|
|
+G[3*k+2];var p=G[3*m],q=G[3*m+1];m=G[3*m+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(G[3*i],G[3*i+1],G[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,m)],null,j))}}function L(b,c,d,e){for(var f,g,h,j,i,k,m,l,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];j=c[4*e+3];k=d[4*e];m=d[4*e+1];l=d[4*e+2];n=d[4*e+3];i=o[e];var p=G[3*m],q=G[3*m+1];m=G[3*m+2];var r=G[3*l],s=G[3*l+1];l=G[3*l+2];var t=G[3*n],u=G[3*
|
|
|
|
+n+1];n=G[3*n+2];P.faces.push(new THREE.Face4(f,g,h,j,[new THREE.Vector3(G[3*k],G[3*k+1],G[3*k+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,l),new THREE.Vector3(t,u,n)],null,i))}}var P=this,H=0,G=[],j=[],X,z;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,H,12);e=B(a,H+12);B(a,H+13);B(a,H+14);B(a,H+15);i=B(a,H+16);k=B(a,H+17);l=B(a,H+18);p=B(a,H+19);n=C(a,H+20);
|
|
|
|
+o=C(a,H+20+4);q=C(a,H+20+8);b=C(a,H+20+12);m=C(a,H+20+16);r=C(a,H+20+20);s=C(a,H+20+24);t=C(a,H+20+28);w=C(a,H+20+32);u=C(a,H+20+36);v=C(a,H+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");H+=e;c=3*i+p;z=4*i+p;e=b*c;X=m*(c+3*k);i=r*(c+3*l);p=s*(c+3*k+3*l);c=t*z;k=w*(z+4*k);l=u*(z+4*l);H+=function(b){var b=new Float32Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
|
|
|
|
+n*Float32Array.BYTES_PER_ELEMENT}(H);H+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(H);H+=A(3*o);H+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],j.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(H);e=H+e+A(2*b);X=e+X+A(2*m);i=X+i+A(2*r);p=i+p+A(2*s);c=p+c+A(2*t);k=c+k+A(2*w);l=k+l+A(2*u);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
|
+K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);D(r,b)}})(X);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;S(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);D(s,c)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;O(u,a,b+4*u*Uint32Array.BYTES_PER_ELEMENT);I(u,b)}})(k);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;L(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);I(v,c)}})(l);b&&K(b,H,H+3*b*
|
|
|
|
+Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;S(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&O(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT;L(w,a,b,b+4*w*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,e){Y=a;d=d||Ua;void 0!==e&&(a=e.split("/"),a.pop(),$a=1>a.length?"":a.join("/")+"/");if((a=Y.evaluate("//dae:asset",Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var j=a.childNodes[e];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":Ga=j.textContent.charAt(0)}}if(!Fa.convertUpAxis||Ga===Fa.upAxis)Xa=null;else switch(Ga){case "X":Xa="Y"===Fa.upAxis?
|
|
|
|
+"XtoY":"XtoZ";break;case "Y":Xa="X"===Fa.upAxis?"YtoX":"YtoZ";break;case "Z":Xa="X"===Fa.upAxis?"ZtoX":"ZtoY"}na=b("//dae:library_images/dae:image",g,"image");ib=b("//dae:library_materials/dae:material",C,"material");Va=b("//dae:library_effects/dae:effect",S,"effect");qa=b("//dae:library_geometries/dae:geometry",r,"geometry");lb=b(".//dae:library_cameras/dae:camera",X,"camera");ra=b("//dae:library_controllers/dae:controller",h,"controller");Ha=b("//dae:library_animations/dae:animation",P,"animation");
|
|
|
|
+Wa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");La=[];ta=[];(a=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),fa=Wa[a]):fa=null;ca=new THREE.Object3D;for(a=0;a<fa.nodes.length;a++)ca.add(f(fa.nodes[a]));db=[];c(ca);a={scene:ca,morphs:La,skins:ta,animations:db,dae:{images:na,materials:ib,cameras:lb,effects:Va,geometries:qa,controllers:ra,animations:Ha,visualScenes:Wa,
|
|
|
|
+scene:fa}};d&&d(a);return a}function b(a,b,c){for(var a=Y.evaluate(a,Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=fa.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};db.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
|
|
|
|
+{hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,f=ra[b.url];if(!f||
|
|
|
|
+!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in Ha)for(var j=Ha[e],i=0;i<j.sampler.length;i++){var m=j.sampler[i];m.create();c=Math.min(c,m.startTime);g=Math.max(g,m.endTime);h=Math.max(h,m.input.length)}e=h;for(var b=fa.getChildById(b.skeleton[0],!0)||fa.getChildBySid(b.skeleton[0],!0),k,l,g=new THREE.Vector3,n,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);
|
|
|
|
+for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;m=f.skin;for(l=0;l<i.length;l++)if(k=i[l],n=-1,"JOINT"==k.type){for(var o=0;o<m.joints.length;o++)if(k.sid==m.joints[o]){n=o;break}if(0<=n){o=m.invBindMatrices[n];k.invBindMatrix=o;k.skinningMatrix=new THREE.Matrix4;k.skinningMatrix.multiply(k.world,o);k.weights=[];for(o=0;o<m.weights.length;o++)for(var p=0;p<m.weights[o].length;p++){var q=m.weights[o][p];q.joint==n&&k.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
|
+k.sid+"'.";}for(i=0;i<h.length;i++)if("JOINT"==h[i].type)for(m=0;m<h[i].weights.length;m++)k=h[i].weights[m],l=k.index,k=k.weight,n=a.vertices[l],l=j[l],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[i].skinningMatrix.multiplyVector3(g),l.position.x+=g.x*k,l.position.y+=g.y*k,l.position.z+=g.z*k;a.morphTargets.push({name:"target_"+c,vertices:j})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=ra[a.controllers[g].url];switch(j.type){case "skin":if(qa[j.skin.source]){var i=
|
|
|
|
+new m;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(ra[j.skin.source]&&(d=j=ra[j.skin.source],j.morph&&qa[j.morph.source]))i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i);break;case "morph":if(qa[j.morph.source])i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
|
|
|
|
+0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=qa[j.url],k={},l=[],n=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var q=Va[ib[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=n;l.push(q.material);p=q.material;n++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<n){i=new THREE.MeshFaceMaterial;j.materials=
|
|
|
|
+l;for(h=0;h<j.faces.length;h++)l=j.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=ra[c.url],i.skinInstanceController=c,i.name="skin_"+ta.length,ta.push(i);else if(void 0!==d){h=j;k=d instanceof o?ra[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(n=qa[k.targets[l]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,
|
|
|
|
+n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+La.length;La.push(i)}else i=new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}for(g=0;g<a.cameras.length;g++)b=lb[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=
|
|
|
|
+g[1];b.useQuaternion=!0;b.scale=g[2];Fa.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];
|
|
|
|
+this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id=
|
|
|
|
+"";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}
|
|
|
|
+function D(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function I(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function S(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}
|
|
|
|
+function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function H(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function G(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function X(){this.name=this.id=""}function z(){this.url=""}function E(a){return"dae"==
|
|
|
|
+a?"http://www.collada.org/2005/11/COLLADASchema":null}function Q(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function N(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ea(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ia(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function $(a,b){if(Fa.convertUpAxis&&Ga!==Fa.upAxis)switch(Xa){case "XtoY":var c=a[0];a[0]=b*a[1];
|
|
|
|
+a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function aa(a,b){var c=[a[b],a[b+1],a[b+2]];$(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Fa.convertUpAxis){var b=[a[0],a[4],a[8]];$(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];$(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],
|
|
|
|
+a[10]];$(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];$(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];$(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];$(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];$(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Y=null,ca=null,fa,Ua=null,Ka={},na={},Ha={},ra={},qa={},ib={},Va={},lb={},db,Wa,$a,La,ta,Aa=THREE.SmoothShading,
|
|
|
|
+Fa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ga="Y",Xa=null,mb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);
|
|
|
|
+this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new B).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],
|
|
|
|
+a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new A).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];
|
|
|
|
+if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=Q(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new B).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new A).parse(d),e=b[d.source];if("JOINT"==
|
|
|
|
+d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new A).parse(g));break;case "v":c=N(g.textContent);break;case "vcount":d=N(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=
|
|
|
|
+n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}j.push(k);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,
|
|
this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,
|
|
""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==
|
|
""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==
|
|
a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));
|
|
a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));
|
|
-break;case "instance_camera":this.cameras.push((new A).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));
|
|
|
|
-break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Ea)for(var e=Ea[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Qa.convertUpAxis)switch(g){case "X":switch(Wa){case "XtoY":case "XtoZ":case "YtoX":g=
|
|
|
|
-"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Wa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Wa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,k=this.getTransformBySid(b.sid);if(k){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=i.length;b<l;b++){var q=i[b],r=h.getData(k.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=
|
|
|
|
|
|
+break;case "instance_camera":this.cameras.push((new z).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Y.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));
|
|
|
|
+break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Ha)for(var e=Ha[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Fa.convertUpAxis)switch(g){case "X":switch(Xa){case "XtoY":case "XtoZ":case "YtoX":g=
|
|
|
|
+"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Xa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Xa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,k=this.getTransformBySid(b.sid);if(k){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=i.length;b<l;b++){var q=i[b],r=h.getData(k.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=
|
|
new j(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:q,0,s)}s.addTarget(f,k,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(l=h[i],l.hasTarget(g)){i=l;break a}i=null}l=void 0;a:{for(k+=1;k<h.length;k++)if(l=h[k],l.hasTarget(g))break a;l=null}if(i&&l){h=(f.time-i.time)/(l.time-
|
|
new j(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:q,0,s)}s.addTarget(f,k,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(l=h[i],l.hasTarget(g)){i=l;break a}i=null}l=void 0;a:{for(k+=1;k<h.length;k++)if(l=h[k],l.hasTarget(g))break a;l=null}if(i&&l){h=(f.time-i.time)/(l.time-
|
|
-i.time);i=i.getTarget(g);k=l.getTarget(g).data;l=i.data;r=void 0;if(l.length){r=[];for(q=0;q<l.length;++q)r[q]=l[q]+(k[q]-l[q])*h}else r=l+(k-l)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=P(a.textContent);this.convert();
|
|
|
|
-return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*mb;case "translate":ca(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ca(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
|
|
|
|
-break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
|
|
|
|
-a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",
|
|
|
|
-c,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
|
|
|
|
-U.evaluate(".//dae:instance_material",c,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
-switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==oa[d]&&(oa[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new w).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=oa[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(V(a,
|
|
|
|
-b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<
|
|
|
|
-f.length;){var q=[],r=[],p={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=oa[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(V(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(q[0],
|
|
|
|
-q[1],q[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));else if(4<m&&Qa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){q=0;for(r=d.length;q<r;q++){e=d[q];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)s=p[o[e]],s=4<m?[s[0],s[q+1],s[q+2]]:4===m?[s[0],s[1],s[2],s[3]]:[s[0],s[1],s[2]],b.faceVertexUvs[e]||
|
|
|
|
-(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(s)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};t.prototype=new w;t.prototype.constructor=t;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ia(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
-switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ia(a,"count",0);this.stride=ia(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};
|
|
|
|
-v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ia(a,"set",-1);this.offset=ia(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
-for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=ea(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ea(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<
|
|
|
|
-c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=
|
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new K).parse(a.childNodes[b]);break}return this};B.prototype.isColor=function(){return null==this.texture};B.prototype.isTexture=function(){return null!=this.texture};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=P(c.textContent);this.color=new THREE.Color(0);
|
|
|
|
-this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};B.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
|
-a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
|
|
|
|
-(new B).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=U.evaluate(".//dae:float",c,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
|
|
|
|
-if(d instanceof B)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Ka[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(Sa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==
|
|
|
|
-c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=za;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
|
-c.nodeName)}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
|
|
|
|
+i.time);i=i.getTarget(g);k=l.getTarget(g).data;l=i.data;r=void 0;if(l.length){r=[];for(q=0;q<l.length;++q)r[q]=l[q]+(k[q]-l[q])*h}else r=l+(k-l)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=Q(a.textContent);this.convert();
|
|
|
|
+return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*mb;case "translate":$(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":$(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
|
|
|
|
+break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
|
|
|
|
+a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Y.evaluate(".//dae:instance_material",
|
|
|
|
+c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
|
|
|
|
+Y.evaluate(".//dae:instance_material",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
+switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Ka[d]&&(Ka[d]=(new B(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new w).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ka[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(aa(a,
|
|
|
|
+b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<
|
|
|
|
+f.length;){var q=[],r=[],p={},s=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Ka[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(aa(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===l)d.push(new THREE.Face3(q[0],
|
|
|
|
+q[1],q[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color));else if(4===l)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));else if(4<l&&Fa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<l-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){q=0;for(r=d.length;q<r;q++){e=d[q];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)s=p[o[e]],s=4<l?[s[0],s[q+1],s[q+2]]:4===l?[s[0],s[1],s[2],s[3]]:[s[0],s[1],s[2]],b.faceVertexUvs[e]||
|
|
|
|
+(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(s)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=n*l}};t.prototype=new w;t.prototype.constructor=t;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ia(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
+switch(c.nodeName){case "input":this.inputs.push((new A).parse(a.childNodes[b]));break;case "vcount":this.vcount=N(c.textContent);break;case "p":this.p=N(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ia(a,"count",0);this.stride=ia(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};
|
|
|
|
+v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new A).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};A.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ia(a,"set",-1);this.offset=ia(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
+for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=ea(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=Q(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=N(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ea(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<
|
|
|
|
+c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};B.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=
|
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new L).parse(a.childNodes[b]);break}return this};D.prototype.isColor=function(){return null==this.texture};D.prototype.isTexture=function(){return null!=this.texture};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=Q(c.textContent);this.color=new THREE.Color(0);
|
|
|
|
+this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};D.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
|
+a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
|
|
|
|
+(new D).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Y.evaluate(".//dae:float",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};I.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
|
|
|
|
+if(d instanceof D)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=na[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture($a+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==
|
|
|
|
+c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
|
+c.nodeName)}}return this};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
S.prototype.create=function(){if(null==this.shader)return null};S.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};S.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=
|
|
S.prototype.create=function(){if(null==this.shader)return null};S.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};S.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=
|
|
-(new J(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new N(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};S.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
|
|
|
|
-S.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};K.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
-if(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new H(this)).parse(c));break;case "channel":this.channel.push((new M(this)).parse(c))}}return this};M.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
|
|
|
|
-else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new y).parse(c))}}return this};H.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=
|
|
|
|
|
|
+(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};S.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
|
|
|
|
+S.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new I(c.nodeName,this)).parse(c)}}};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
+if(1==c.nodeType)switch(c.nodeName){case "source":c=(new B).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new G(this)).parse(c));break;case "channel":this.channel.push((new H(this)).parse(c))}}return this};H.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
|
|
|
|
+else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new A).parse(c))}}return this};G.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=
|
|
this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),
|
|
this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),
|
|
-this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};H.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ca(c,-1);break;case "scale":ca(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=
|
|
|
|
-0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
|
|
|
|
-(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};Z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};Z.prototype.parseOptics=
|
|
|
|
-function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};A.prototype.parse=function(a){this.url=
|
|
|
|
-a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Ta=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
|
|
|
|
-d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){za=a},applySkin:e,geometries:ka,options:Qa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
|
|
+this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};G.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":$(c,-1);break;case "scale":$(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=0;b<
|
|
|
|
+this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
|
|
|
|
+(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};X.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};X.prototype.parseOptics=
|
|
|
|
+function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};z.prototype.parse=function(a){this.url=
|
|
|
|
+a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Ua=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
|
|
|
|
+d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Aa=a},applySkin:e,geometries:qa,options:Fa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
|
|
2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,k,l,p,m,o,q,n,r,s,t,w,u=a.faces;p=a.vertices;var v=a.normals,y=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=p.length;k<
|
|
|
|
-l;)m=new THREE.Vertex,m.position.x=p[k++]*b,m.position.y=p[k++]*b,m.position.z=p[k++]*b,d.vertices.push(m);k=0;for(l=u.length;k<l;){b=u[k++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;m=b&32;n=b&64;b&=128;p?(r=new THREE.Face4,r.a=u[k++],r.b=u[k++],r.c=u[k++],r.d=u[k++],p=4):(r=new THREE.Face3,r.a=u[k++],r.b=u[k++],r.c=u[k++],p=3);if(i)i=u[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],q=u[k++],w=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(w,q);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
|
|
|
|
-for(e=0;e<p;e++)q=u[k++],w=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(w,q);d.faceVertexUvs[c][i]=t}if(o)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.normal=e;if(m)for(c=0;c<p;c++)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(n)m=u[k++],m=new THREE.Color(y[m]),r.color=m;if(b)for(c=0;c<p;c++)m=u[k++],m=new THREE.Color(y[m]),r.vertexColors.push(m);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
|
|
|
|
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,k,l,p,m,o,q,n,r;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];d.morphNormals[c]={};
|
|
|
|
-d.morphNormals[c].faceNormals=[];d.morphNormals[c].vertexNormals=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;n=d.morphNormals[c].faceNormals;r=d.morphNormals[c].vertexNormals;for(i=0,k=q.length;i<k;i+=3)l=q[i]*b,p=q[i+1]*b,m=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(l,p,m)));for(i=0,k=d.faces.length;i<k;i++)p=d.faces[i],l=new THREE.Vector3,p=p instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,
|
|
|
|
-d:new THREE.Vector3},n.push(l),r.push(p)}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];r=d.morphColors[c].colors;i=a.morphColors[c].colors;for(b=0,n=i.length;b<n;b+=3)k=new THREE.Color(16755200),k.setRGB(i[b],i[b+1],i[b+2]),r.push(k)}})(e);d.computeCentroids();d.computeMorphNormals();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
|
|
|
|
-THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,k,l,p,n,o,q,m,r,s,t,w,u=a.faces;p=a.vertices;var v=a.normals,A=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=p.length;k<
|
|
|
|
+l;)n=new THREE.Vertex,n.position.x=p[k++]*b,n.position.y=p[k++]*b,n.position.z=p[k++]*b,d.vertices.push(n);k=0;for(l=u.length;k<l;){b=u[k++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;n=b&32;m=b&64;b&=128;p?(r=new THREE.Face4,r.a=u[k++],r.b=u[k++],r.c=u[k++],r.d=u[k++],p=4):(r=new THREE.Face3,r.a=u[k++],r.b=u[k++],r.c=u[k++],p=3);if(i)i=u[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<B;c++)s=a.uvs[c],q=u[k++],w=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(w,q);if(e)for(c=0;c<B;c++){s=a.uvs[c];t=[];
|
|
|
|
+for(e=0;e<p;e++)q=u[k++],w=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(w,q);d.faceVertexUvs[c][i]=t}if(o)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.normal=e;if(n)for(c=0;c<p;c++)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(m)n=u[k++],n=new THREE.Color(A[n]),r.color=n;if(b)for(c=0;c<p;c++)n=u[k++],n=new THREE.Color(A[n]),r.vertexColors.push(n);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
|
|
|
|
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,k,l,p,n,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;
|
|
|
|
+q=a.morphTargets[c].vertices;for(i=0,k=q.length;i<k;i+=3)l=q[i]*b,p=q[i+1]*b,n=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(l,p,n)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;for(b=0,i=l.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(l[b],l[b+1],l[b+2]),k.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
|
|
|
|
+d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){try{var e=JSON.parse(d.responseText)}catch(f){console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}c.createScene(e,b,a)}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){try{var e=JSON.parse(d.responseText)}catch(f){console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}c.createScene(e,b,a)}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");
|
|
d.send(null)};
|
|
d.send(null)};
|
|
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(m in K.objects)if(!A.objects[m])if(s=K.objects[m],void 0!==s.geometry){if(E=A.geometries[s.geometry]){a=!1;J=A.materials[s.materials[0]];(a=J instanceof THREE.ShaderMaterial)&&E.computeTangents();u=s.position;v=s.rotation;y=s.quaternion;D=s.scale;y=0;0==s.materials.length&&(J=new THREE.MeshFaceMaterial);1<s.materials.length&&(J=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,
|
|
|
|
-J);a.name=m;a.position.set(u[0],u[1],u[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;A.scene.add(a);A.objects[m]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);A.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(E),A.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},
|
|
|
|
-A.triggers[a.name]=b)}}else u=s.position,v=s.rotation,y=s.quaternion,D=s.scale,y=0,a=new THREE.Object3D,a.name=m,a.position.set(u[0],u[1],u[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,A.scene.add(a),A.objects[m]=a,A.empties[m]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},A.triggers[a.name]=b)}function f(a){return function(b){A.geometries[a]=b;e();
|
|
|
|
-M-=1;i.onLoadComplete();h()}}function g(a){return function(b){A.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:Z,loadedModels:j-M,loadedTextures:Z-H},A);i.onLoadProgress();0==M&&0==H&&b(A)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),l,p,m,o,q,n,r,s,t,w,u,v,y,D,C,B,E,J,N,S,K,O,M,H,j,Z,A;K=a;c=new THREE.BinaryLoader;O=new THREE.JSONLoader;H=M=0;A={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
|
-empties:{}};a=!1;for(m in K.objects)if(s=K.objects[m],s.meshCollider){a=!0;break}if(a)A.scene.collisions=new THREE.CollisionSystem;if(K.transform)a=K.transform.position,t=K.transform.rotation,C=K.transform.scale,a&&A.scene.position.set(a[0],a[1],a[2]),t&&A.scene.rotation.set(t[0],t[1],t[2]),C&&A.scene.scale.set(C[0],C[1],C[2]),(a||t||C)&&A.scene.updateMatrix();a=function(){H-=1;h();i.onLoadComplete()};for(q in K.cameras)C=K.cameras[q],"perspective"==C.type?N=new THREE.PerspectiveCamera(C.fov,C.aspect,
|
|
|
|
-C.near,C.far):"ortho"==C.type&&(N=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),u=C.position,t=C.target,C=C.up,N.position.set(u[0],u[1],u[2]),N.target=new THREE.Vector3(t[0],t[1],t[2]),C&&N.up.set(C[0],C[1],C[2]),A.cameras[q]=N;for(o in K.lights)t=K.lights[o],q=void 0!==t.color?t.color:16777215,N=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,w=new THREE.DirectionalLight(q,N),w.position.set(u[0],u[1],u[2]),w.position.normalize()):"point"==t.type?
|
|
|
|
-(u=t.position,w=t.distance,w=new THREE.PointLight(q,N,w),w.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(w=new THREE.AmbientLight(q)),A.scene.add(w),A.lights[o]=w;for(n in K.fogs)o=K.fogs[n],"linear"==o.type?S=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(S=new THREE.FogExp2(0,o.density)),C=o.color,S.color.setRGB(C[0],C[1],C[2]),A.fogs[n]=S;if(A.cameras&&K.defaults.camera)A.currentCamera=A.cameras[K.defaults.camera];if(A.fogs&&K.defaults.fog)A.scene.fog=A.fogs[K.defaults.fog];C=K.defaults.bgcolor;
|
|
|
|
-A.bgColor=new THREE.Color;A.bgColor.setRGB(C[0],C[1],C[2]);A.bgColorAlpha=K.defaults.bgalpha;for(l in K.geometries)if(n=K.geometries[l],"bin_mesh"==n.type||"ascii_mesh"==n.type)M+=1,i.onLoadStart();j=M;for(l in K.geometries)if(n=K.geometries[l],"cube"==n.type)E=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),A.geometries[l]=E;else if("plane"==n.type)E=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),
|
|
|
|
-A.geometries[l]=E;else if("sphere"==n.type)E=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),A.geometries[l]=E;else if("cylinder"==n.type)E=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),A.geometries[l]=E;else if("torus"==n.type)E=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),A.geometries[l]=E;else if("icosahedron"==n.type)E=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),A.geometries[l]=E;else if("bin_mesh"==n.type)c.load(d(n.url,
|
|
|
|
-K.urlBaseType),f(l));else if("ascii_mesh"==n.type)O.load(d(n.url,K.urlBaseType),f(l));else if("embedded_mesh"==n.type)n=K.embeds[n.id],n.metadata=K.metadata,n&&O.createModel(n,g(l),"");for(r in K.textures)if(l=K.textures[r],l.url instanceof Array){H+=l.url.length;for(n=0;n<l.url.length;n++)i.onLoadStart()}else H+=1,i.onLoadStart();Z=H;for(r in K.textures){l=K.textures[r];if(void 0!=l.mapping&&void 0!=THREE[l.mapping])l.mapping=new THREE[l.mapping];if(l.url instanceof Array){n=[];for(S=0;S<l.url.length;S++)n[S]=
|
|
|
|
-d(l.url[S],K.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,l.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(l.url,K.urlBaseType),l.mapping,a);if(void 0!=THREE[l.minFilter])n.minFilter=THREE[l.minFilter];if(void 0!=THREE[l.magFilter])n.magFilter=THREE[l.magFilter];if(l.repeat){n.repeat.set(l.repeat[0],l.repeat[1]);if(1!=l.repeat[0])n.wrapS=THREE.RepeatWrapping;if(1!=l.repeat[1])n.wrapT=THREE.RepeatWrapping}l.offset&&n.offset.set(l.offset[0],l.offset[1]);if(l.wrap){S={repeat:THREE.RepeatWrapping,
|
|
|
|
-mirror:THREE.MirroredRepeatWrapping};if(void 0!==S[l.wrap[0]])n.wrapS=S[l.wrap[0]];if(void 0!==S[l.wrap[1]])n.wrapT=S[l.wrap[1]]}}A.textures[r]=n}for(p in K.materials){r=K.materials[p];for(B in r.parameters)if("envMap"==B||"map"==B||"lightMap"==B)r.parameters[B]=A.textures[r.parameters[B]];else if("shading"==B)r.parameters[B]="flat"==r.parameters[B]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==B)r.parameters[B]=THREE[r.parameters[B]]?THREE[r.parameters[B]]:THREE.NormalBlending;else if("combine"==
|
|
|
|
-B)r.parameters[B]="MixOperation"==r.parameters[B]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==B)if("face"==r.parameters[B])r.parameters[B]=THREE.FaceColors;else if(r.parameters[B])r.parameters[B]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);n=r.parameters.color;S=r.parameters.specular;c=r.parameters.ambient;O=r.parameters.shininess;
|
|
|
|
-a.tNormal.texture=A.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=A.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(S);a.uAmbientColor.value.setHex(c);
|
|
|
|
-a.uShininess.value=O;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;J=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else J=new THREE[r.type](r.parameters);A.materials[p]=J}e();i.callbackSync(A);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(n in L.objects)if(!z.objects[n])if(s=L.objects[n],void 0!==s.geometry){if(I=z.geometries[s.geometry]){a=!1;K=z.materials[s.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&I.computeTangents();u=s.position;v=s.rotation;A=s.quaternion;B=s.scale;A=0;0==s.materials.length&&(K=new THREE.MeshFaceMaterial);1<s.materials.length&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(I,
|
|
|
|
+K);a.name=n;a.position.set(u[0],u[1],u[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(B[0],B[1],B[2]);a.visible=s.visible;z.scene.add(a);z.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);z.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(I),z.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},
|
|
|
|
+z.triggers[a.name]=b)}}else u=s.position,v=s.rotation,A=s.quaternion,B=s.scale,A=0,a=new THREE.Object3D,a.name=n,a.position.set(u[0],u[1],u[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(B[0],B[1],B[2]),a.visible=void 0!==s.visible?s.visible:!1,z.scene.add(a),z.objects[n]=a,z.empties[n]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function f(a){return function(b){z.geometries[a]=b;e();
|
|
|
|
+H-=1;i.onLoadComplete();h()}}function g(a){return function(b){z.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:X,loadedModels:j-H,loadedTextures:X-G},z);i.onLoadProgress();0==H&&0==G&&b(z)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),l,p,n,o,q,m,r,s,t,w,u,v,A,B,C,D,I,K,O,S,L,P,H,G,j,X,z;L=a;c=new THREE.BinaryLoader;P=new THREE.JSONLoader;G=H=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
|
+empties:{}};a=!1;for(n in L.objects)if(s=L.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(L.transform)a=L.transform.position,t=L.transform.rotation,C=L.transform.scale,a&&z.scene.position.set(a[0],a[1],a[2]),t&&z.scene.rotation.set(t[0],t[1],t[2]),C&&z.scene.scale.set(C[0],C[1],C[2]),(a||t||C)&&z.scene.updateMatrix();a=function(){G-=1;h();i.onLoadComplete()};for(q in L.cameras)C=L.cameras[q],"perspective"==C.type?O=new THREE.PerspectiveCamera(C.fov,C.aspect,
|
|
|
|
+C.near,C.far):"ortho"==C.type&&(O=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),u=C.position,t=C.target,C=C.up,O.position.set(u[0],u[1],u[2]),O.target=new THREE.Vector3(t[0],t[1],t[2]),C&&O.up.set(C[0],C[1],C[2]),z.cameras[q]=O;for(o in L.lights)t=L.lights[o],q=void 0!==t.color?t.color:16777215,O=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,w=new THREE.DirectionalLight(q,O),w.position.set(u[0],u[1],u[2]),w.position.normalize()):"point"==t.type?
|
|
|
|
+(u=t.position,w=t.distance,w=new THREE.PointLight(q,O,w),w.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(w=new THREE.AmbientLight(q)),z.scene.add(w),z.lights[o]=w;for(m in L.fogs)o=L.fogs[m],"linear"==o.type?S=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(S=new THREE.FogExp2(0,o.density)),C=o.color,S.color.setRGB(C[0],C[1],C[2]),z.fogs[m]=S;if(z.cameras&&L.defaults.camera)z.currentCamera=z.cameras[L.defaults.camera];if(z.fogs&&L.defaults.fog)z.scene.fog=z.fogs[L.defaults.fog];C=L.defaults.bgcolor;
|
|
|
|
+z.bgColor=new THREE.Color;z.bgColor.setRGB(C[0],C[1],C[2]);z.bgColorAlpha=L.defaults.bgalpha;for(l in L.geometries)if(m=L.geometries[l],"bin_mesh"==m.type||"ascii_mesh"==m.type)H+=1,i.onLoadStart();j=H;for(l in L.geometries)if(m=L.geometries[l],"cube"==m.type)I=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),z.geometries[l]=I;else if("plane"==m.type)I=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),
|
|
|
|
+z.geometries[l]=I;else if("sphere"==m.type)I=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),z.geometries[l]=I;else if("cylinder"==m.type)I=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),z.geometries[l]=I;else if("torus"==m.type)I=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),z.geometries[l]=I;else if("icosahedron"==m.type)I=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),z.geometries[l]=I;else if("bin_mesh"==m.type)c.load(d(m.url,
|
|
|
|
+L.urlBaseType),f(l));else if("ascii_mesh"==m.type)P.load(d(m.url,L.urlBaseType),f(l));else if("embedded_mesh"==m.type)m=L.embeds[m.id],m.metadata=L.metadata,m&&P.createModel(m,g(l),"");for(r in L.textures)if(l=L.textures[r],l.url instanceof Array){G+=l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else G+=1,i.onLoadStart();X=G;for(r in L.textures){l=L.textures[r];if(void 0!=l.mapping&&void 0!=THREE[l.mapping])l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(S=0;S<l.url.length;S++)m[S]=
|
|
|
|
+d(l.url[S],L.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,L.urlBaseType),l.mapping,a);if(void 0!=THREE[l.minFilter])m.minFilter=THREE[l.minFilter];if(void 0!=THREE[l.magFilter])m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(1!=l.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=l.repeat[1])m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){S={repeat:THREE.RepeatWrapping,
|
|
|
|
+mirror:THREE.MirroredRepeatWrapping};if(void 0!==S[l.wrap[0]])m.wrapS=S[l.wrap[0]];if(void 0!==S[l.wrap[1]])m.wrapT=S[l.wrap[1]]}}z.textures[r]=m}for(p in L.materials){r=L.materials[p];for(D in r.parameters)if("envMap"==D||"map"==D||"lightMap"==D)r.parameters[D]=z.textures[r.parameters[D]];else if("shading"==D)r.parameters[D]="flat"==r.parameters[D]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==D)r.parameters[D]=THREE[r.parameters[D]]?THREE[r.parameters[D]]:THREE.NormalBlending;else if("combine"==
|
|
|
|
+D)r.parameters[D]="MixOperation"==r.parameters[D]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==D)if("face"==r.parameters[D])r.parameters[D]=THREE.FaceColors;else if(r.parameters[D])r.parameters[D]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);m=r.parameters.color;S=r.parameters.specular;c=r.parameters.ambient;P=r.parameters.shininess;
|
|
|
|
+a.tNormal.texture=z.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=z.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(S);a.uAmbientColor.value.setHex(c);
|
|
|
|
+a.uShininess.value=P;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else K=new THREE[r.type](r.parameters);z.materials[p]=K}e();i.callbackSync(z);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
b,e,f,g,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
|
|
b,e,f,g,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
|
|
THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,g,i){for(var k,l,r,s=a.length;i<s;i+=g)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(g[0],8,3);(function(a,
|
|
THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,g,i){for(var k,l,r,s=a.length;i<s;i+=g)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(g[0],8,3);(function(a,
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,w,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;u=e;i=f;var y=k[3*e],D=k[3*e+1],C=k[3*e+2],B=k[3*f],E=k[3*f+1],J=k[3*f+2];t=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);y=new THREE.Vector3(y,D,C);B=new THREE.Vector3(B,E,J);g.faces.push(new THREE.Face3(w,u,i,[t,y,B],null,0));g=l[2*d];d=l[2*d+1];i=l[2*e];t=l[2*e+1];w=l[2*
|
|
|
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,w,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;u=e;i=f;var A=k[3*e],B=k[3*e+1],C=k[3*e+2],D=k[3*f],I=k[3*f+1],K=k[3*f+2];t=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);A=new THREE.Vector3(A,B,C);D=new THREE.Vector3(D,I,K);g.faces.push(new THREE.Face3(w,u,i,[t,A,D],null,0));g=l[2*d];d=l[2*d+1];i=l[2*e];t=l[2*e+1];w=l[2*
|
|
f];u=l[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(w,u));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
|
|
f];u=l[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(w,u));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
|
|
this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,k,l,p){g=(g-l)/(p-l);l=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=k;e[f]=this.lerp(l[a],l[a+3],g);e[f+1]=this.lerp(l[a+1],l[a+4],g);e[f+2]=this.lerp(l[a+2],l[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,k,l,p){g=(g-l)/(p-l);l=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=k;b=a+3*this.yd;
|
|
this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,k,l,p){g=(g-l)/(p-l);l=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=k;e[f]=this.lerp(l[a],l[a+3],g);e[f+1]=this.lerp(l[a+1],l[a+4],g);e[f+2]=this.lerp(l[a+2],l[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,k,l,p){g=(g-l)/(p-l);l=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=k;b=a+3*this.yd;
|
|
e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,k,l,p){g=(g-l)/(p-l);l=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=k+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,k,l,p){g=(g-l)/(p-l);l=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=k+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,k=f+this.yd,l=f+this.zd,p=i+this.yd,m=i+this.zd,o=f+this.yd+this.zd,q=i+this.yd+this.zd,n=0,r=this.field[f],s=this.field[i],t=this.field[k],w=this.field[p],u=this.field[l],v=this.field[m],y=this.field[o],D=this.field[q];r<g&&(n|=1);s<g&&(n|=2);t<g&&(n|=8);w<g&&(n|=4);u<g&&(n|=16);v<g&&(n|=32);y<g&&(n|=128);D<g&&(n|=64);var C=THREE.edgeTable[n];if(0===C)return 0;var B=this.delta,E=a+
|
|
|
|
-B,J=b+B,B=e+B;C&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));C&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,g,E,b,e,s,w));C&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(3*k,this.vlist,this.nlist,6,g,a,J,e,t,w));C&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));C&16&&(this.compNorm(l),this.compNorm(m),this.VIntX(3*l,this.vlist,this.nlist,12,g,a,b,B,u,v));C&32&&(this.compNorm(m),
|
|
|
|
-this.compNorm(q),this.VIntY(3*m,this.vlist,this.nlist,15,g,E,b,B,v,D));C&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,J,B,y,D));C&128&&(this.compNorm(l),this.compNorm(o),this.VIntY(3*l,this.vlist,this.nlist,21,g,a,b,B,u,y));C&256&&(this.compNorm(f),this.compNorm(l),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,u));C&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(3*i,this.vlist,this.nlist,27,g,E,b,e,s,v));C&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
|
-p,this.vlist,this.nlist,30,g,E,J,e,w,D));C&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(3*k,this.vlist,this.nlist,33,g,a,J,e,t,y));n<<=4;for(g=f=0;-1!=THREE.triTable[n+g];)a=n+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
|
|
|
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,k=f+this.yd,l=f+this.zd,p=i+this.yd,n=i+this.zd,o=f+this.yd+this.zd,q=i+this.yd+this.zd,m=0,r=this.field[f],s=this.field[i],t=this.field[k],w=this.field[p],u=this.field[l],v=this.field[n],A=this.field[o],B=this.field[q];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);w<g&&(m|=4);u<g&&(m|=16);v<g&&(m|=32);A<g&&(m|=128);B<g&&(m|=64);var C=THREE.edgeTable[m];if(0===C)return 0;var D=this.delta,I=a+
|
|
|
|
+D,K=b+D,D=e+D;C&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));C&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,g,I,b,e,s,w));C&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(3*k,this.vlist,this.nlist,6,g,a,K,e,t,w));C&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));C&16&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,12,g,a,b,D,u,v));C&32&&(this.compNorm(n),
|
|
|
|
+this.compNorm(q),this.VIntY(3*n,this.vlist,this.nlist,15,g,I,b,D,v,B));C&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,K,D,A,B));C&128&&(this.compNorm(l),this.compNorm(o),this.VIntY(3*l,this.vlist,this.nlist,21,g,a,b,D,u,A));C&256&&(this.compNorm(f),this.compNorm(l),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,u));C&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(3*i,this.vlist,this.nlist,27,g,I,b,e,s,v));C&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
|
+p,this.vlist,this.nlist,30,g,I,K,e,w,B));C&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(3*k,this.vlist,this.nlist,33,g,a,K,e,t,A));m<<=4;for(g=f=0;-1!=THREE.triTable[m+g];)a=m+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
|
|
4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,k=b*this.size,l=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var m=Math.floor(k-h);1>m&&(m=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-h);1>o&&(o=1);h=Math.floor(l+h);h>this.size-1&&(h=this.size-
|
|
|
|
-1);for(var q,n,r,s,t,w,u,l=p;l<i;l++){r=this.size2*l;t=l/this.size-e;w=t*t;for(p=m;p<k;p++){n=r+this.size*p;q=p/this.size-b;u=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=f/(1.0E-6+s*s+u+w)-g,0<s&&(this.field[n+q]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,k=this.size,l=this.yd,p=this.zd,m=this.field,o=k*Math.sqrt(a/b);o>k&&(o=k);for(e=0;e<o;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<k;f++){i=e+f*l;for(g=0;g<k;g++)m[p*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,k,l=this.size,p=this.yd,
|
|
|
|
-m=this.zd,o=this.field,q=l*Math.sqrt(a/b);q>l&&(q=l);for(f=0;f<q;f++)if(e=f/l,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*p;for(e=0;e<l;e++){k=i+e;for(g=0;g<l;g++)o[m*g+k]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,k,l=this.size,p=this.yd,m=this.zd,o=this.field,q=l*Math.sqrt(a/b);q>l&&(q=l);for(g=0;g<q;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-b,0<h){i=m*g;for(f=0;f<l;f++){k=i+f*p;for(e=0;e<l;e++)o[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
|
-function(a){this.begin();var b,e,f,g,h,i,k,l,p,m=this.size-2;for(g=1;g<m;g++){p=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<m;f++){l=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<m;e++)h=(e-this.halfsize)/this.halfsize,b=l+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,k,l,p,m,o;for(g=0;g<f.count;g++)m=3*g,l=m+1,o=m+2,h=f.positionArray[m],i=f.positionArray[l],k=
|
|
|
|
-f.positionArray[o],p=new THREE.Vector3(h,i,k),h=f.normalArray[m],i=f.normalArray[l],k=f.normalArray[o],m=new THREE.Vector3(h,i,k),m.normalize(),l=new THREE.Vertex(p),b.vertices.push(l),e.push(m);p=f.count/3;for(g=0;g<p;g++)m=3*(a+g),l=m+1,o=m+2,h=e[m],i=e[l],k=e[o],m=new THREE.Face3(m,l,o,[h,i,k]),b.faces.push(m);a+=p;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,k=b*this.size,l=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var n=Math.floor(k-h);1>n&&(n=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-h);1>o&&(o=1);h=Math.floor(l+h);h>this.size-1&&(h=this.size-
|
|
|
|
+1);for(var q,m,r,s,t,w,u,l=p;l<i;l++){r=this.size2*l;t=l/this.size-e;w=t*t;for(p=n;p<k;p++){m=r+this.size*p;q=p/this.size-b;u=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=f/(1.0E-6+s*s+u+w)-g,0<s&&(this.field[m+q]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,k=this.size,l=this.yd,p=this.zd,n=this.field,o=k*Math.sqrt(a/b);o>k&&(o=k);for(e=0;e<o;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<k;f++){i=e+f*l;for(g=0;g<k;g++)n[p*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,k,l=this.size,p=this.yd,
|
|
|
|
+n=this.zd,o=this.field,q=l*Math.sqrt(a/b);q>l&&(q=l);for(f=0;f<q;f++)if(e=f/l,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*p;for(e=0;e<l;e++){k=i+e;for(g=0;g<l;g++)o[n*g+k]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,k,l=this.size,p=this.yd,n=this.zd,o=this.field,q=l*Math.sqrt(a/b);q>l&&(q=l);for(g=0;g<q;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-b,0<h){i=n*g;for(f=0;f<l;f++){k=i+f*p;for(e=0;e<l;e++)o[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
|
|
|
|
+function(a){this.begin();var b,e,f,g,h,i,k,l,p,n=this.size-2;for(g=1;g<n;g++){p=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<n;f++){l=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<n;e++)h=(e-this.halfsize)/this.halfsize,b=l+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,k,l,p,n,o;for(g=0;g<f.count;g++)n=3*g,l=n+1,o=n+2,h=f.positionArray[n],i=f.positionArray[l],k=
|
|
|
|
+f.positionArray[o],p=new THREE.Vector3(h,i,k),h=f.normalArray[n],i=f.normalArray[l],k=f.normalArray[o],n=new THREE.Vector3(h,i,k),n.normalize(),l=new THREE.Vertex(p),b.vertices.push(l),e.push(n);p=f.count/3;for(g=0;g<p;g++)n=3*(a+g),l=n+1,o=n+2,h=e[n],i=e[l],k=e[o],n=new THREE.Face3(n,l,o,[h,i,k]),b.faces.push(n);a+=p;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -744,38 +745,38 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
|
|
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
|
|
THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
|
|
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,l,p,m,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
|
|
|
|
|
|
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,l,p,n,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
|
|
0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,l=a(THREE.ShaderFlares.lensFlare)):(k=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};m={};p.vertex=b.getAttribLocation(l,"position");p.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
|
|
|
|
-"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,u=s/e,v=0.5*e,y=0.5*s,D=16/s,C=new THREE.Vector2(D*u,D),B=new THREE.Vector3(1,1,0),E=new THREE.Vector2(1,1),J=m,D=p;b.useProgram(l);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
|
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var N,S,K,O,M;for(N=0;N<t;N++)if(D=16/s,C.set(D*u,D),O=a[N],w.set(O.matrixWorld.n14,O.matrixWorld.n24,O.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),B.copy(w),E.x=B.x*v+v,E.y=B.y*y+y,k||0<E.x&&E.x<e&&0<E.y&&E.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
|
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,C.x,C.y);b.uniform3f(J.screenPosition,B.x,B.y,B.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,E.x-8,E.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
|
-6,b.UNSIGNED_SHORT,0);O.positionScreen.copy(B);O.customUpdateCallback?O.customUpdateCallback(O):O.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);for(S=0,K=O.lensFlares.length;S<K;S++)if(M=O.lensFlares[S],0.0010<M.opacity&&0.0010<M.scale)B.x=M.x,B.y=M.y,B.z=M.z,D=M.size*M.scale/s,C.x=D*u,C.y=D,b.uniform3f(J.screenPosition,B.x,B.y,B.z),b.uniform2f(J.scale,C.x,C.y),b.uniform1f(J.rotation,M.rotation),b.uniform1f(J.opacity,M.opacity),b.uniform3f(J.color,M.color.r,M.color.g,M.color.b),
|
|
|
|
-c.setBlending(M.blending),c.setTexture(M.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,l=a(THREE.ShaderFlares.lensFlare)):(k=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};n={};p.vertex=b.getAttribLocation(l,"position");p.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
|
|
|
|
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,u=s/e,v=0.5*e,A=0.5*s,B=16/s,C=new THREE.Vector2(B*u,B),D=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),K=n,B=p;b.useProgram(l);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var O,S,L,P,H;for(O=0;O<t;O++)if(B=16/s,C.set(B*u,B),P=a[O],w.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),D.copy(w),I.x=D.x*v+v,I.y=D.y*A+A,k||0<I.x&&I.x<e&&0<I.y&&I.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
|
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,C.x,C.y);b.uniform3f(K.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
|
+6,b.UNSIGNED_SHORT,0);P.positionScreen.copy(D);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(S=0,L=P.lensFlares.length;S<L;S++)if(H=P.lensFlares[S],0.0010<H.opacity&&0.0010<H.scale)D.x=H.x,D.y=H.y,D.z=H.z,B=H.size*H.scale/s,C.x=B*u,C.y=B,b.uniform3f(K.screenPosition,D.x,D.y,D.z),b.uniform2f(K.scale,C.x,C.y),b.uniform1f(K.rotation,H.rotation),b.uniform1f(K.opacity,H.opacity),b.uniform3f(K.color,H.color.r,H.color.g,H.color.b),
|
|
|
|
+c.setBlending(H.blending),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var l,p,m,o,q,n,r,s,t,w=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(l=0,p=i.lights.length;l<p;l++)if(m=i.lights[l],m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(q=0;q<m.shadowCascadeCount;q++){var u;if(m.shadowCascadeArray[q])u=m.shadowCascadeArray[q];else{t=m;r=q;u=new THREE.DirectionalLight;u.isVirtual=!0;u.onlyShadow=
|
|
|
|
-!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[r];u.shadowMapWidth=t.shadowCascadeWidth[r];u.shadowMapHeight=t.shadowCascadeHeight[r];u.pointsWorld=[];u.pointsFrustum=[];s=u.pointsWorld;n=
|
|
|
|
-u.pointsFrustum;for(var v=0;8>v;v++)s[v]=new THREE.Vector3,n[v]=new THREE.Vector3;s=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);u.originalCamera=k;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(u);n.add(u.target);k.add(n);m.shadowCascadeArray[q]=u;console.log("Created virtualLight",u)}r=m;s=q;t=r.shadowCascadeArray[s];t.position.copy(r.position);
|
|
|
|
-t.target.position.copy(r.target.position);t.lookAt(t.target);t.shadowCameraVisible=r.shadowCameraVisible;t.shadowDarkness=r.shadowDarkness;t.shadowBias=r.shadowCascadeBias[s];n=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=r;t[5].z=r;t[6].z=r;t[7].z=r;w[o]=u;o++}else w[o]=m,o++;for(l=0,p=w.length;l<p;l++){m=w[l];if(!m.shadowMap)m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
|
-format:THREE.RGBAFormat}),m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight),m.shadowMatrix=new THREE.Matrix4;if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);
|
|
|
|
-else{console.error("Unsupported light type for shadow");continue}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper)m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper);if(m.isVirtual&&u.originalCamera==k){q=k;o=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=t[r];s.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
|
|
|
|
-q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=m.shadowMap;n=m.shadowMatrix;q=m.shadowCamera;q.position.copy(m.matrixWorld.getPosition());q.lookAt(m.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;
|
|
|
|
-m.shadowCameraVisible&&m.cameraHelper.update(m.shadowCamera);n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(q.projectionMatrix);n.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);
|
|
|
|
-b.setRenderTarget(o);b.clear();t=i.__webglObjects;for(m=0,o=t.length;m<o;m++)if(r=t[m],n=r.object,r.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),r.render=!0;for(m=0,o=t.length;m<o;m++)if(r=t[m],r.render)n=r.object,r=r.buffer,b.setObjectFaces(n),s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
|
|
|
|
-d:c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.lights,null,s,r,n):b.renderBuffer(q,i.lights,null,s,r,n);t=i.__webglObjectsImmediate;for(m=0,o=t.length;m<o;m++)r=t[m],n=r.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(q,i.lights,null,c,n))}l=b.getClearColor();p=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,p);a.enable(a.BLEND);
|
|
|
|
|
|
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var l,p,n,o,q,m,r,s,t,w=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(l=0,p=i.lights.length;l<p;l++)if(n=i.lights[l],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(q=0;q<n.shadowCascadeCount;q++){var u;if(n.shadowCascadeArray[q])u=n.shadowCascadeArray[q];else{t=n;r=q;u=new THREE.DirectionalLight;u.isVirtual=!0;u.onlyShadow=
|
|
|
|
+!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[r];u.shadowMapWidth=t.shadowCascadeWidth[r];u.shadowMapHeight=t.shadowCascadeHeight[r];u.pointsWorld=[];u.pointsFrustum=[];s=u.pointsWorld;m=
|
|
|
|
+u.pointsFrustum;for(var v=0;8>v;v++)s[v]=new THREE.Vector3,m[v]=new THREE.Vector3;s=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];m[0].set(-1,-1,s);m[1].set(1,-1,s);m[2].set(-1,1,s);m[3].set(1,1,s);m[4].set(-1,-1,t);m[5].set(1,-1,t);m[6].set(-1,1,t);m[7].set(1,1,t);u.originalCamera=k;m=new THREE.Gyroscope;m.position=n.shadowCascadeOffset;m.add(u);m.add(u.target);k.add(m);n.shadowCascadeArray[q]=u;console.log("Created virtualLight",u)}r=n;s=q;t=r.shadowCascadeArray[s];t.position.copy(r.position);
|
|
|
|
+t.target.position.copy(r.target.position);t.lookAt(t.target);t.shadowCameraVisible=r.shadowCameraVisible;t.shadowDarkness=r.shadowDarkness;t.shadowBias=r.shadowCascadeBias[s];m=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];t=t.pointsFrustum;t[0].z=m;t[1].z=m;t[2].z=m;t[3].z=m;t[4].z=r;t[5].z=r;t[6].z=r;t[7].z=r;w[o]=u;o++}else w[o]=n,o++;for(l=0,p=w.length;l<p;l++){n=w[l];if(!n.shadowMap)n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
|
+format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4;if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);
|
|
|
|
+else{console.error("Unsupported light type for shadow");continue}i.add(n.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper)n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper);if(n.isVirtual&&u.originalCamera==k){q=k;o=n.shadowCamera;m=n.pointsFrustum;t=n.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=t[r];s.copy(m[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
|
|
|
|
+q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=n.shadowMap;m=n.shadowMatrix;q=n.shadowCamera;q.position.copy(n.matrixWorld.getPosition());q.lookAt(n.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(n.cameraHelper)n.cameraHelper.lines.visible=n.shadowCameraVisible;
|
|
|
|
+n.shadowCameraVisible&&n.cameraHelper.update(n.shadowCamera);m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(q.projectionMatrix);m.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);
|
|
|
|
+b.setRenderTarget(o);b.clear();t=i.__webglObjects;for(n=0,o=t.length;n<o;n++)if(r=t[n],m=r.object,r.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),r.render=!0;for(n=0,o=t.length;n<o;n++)if(r=t[n],r.render)m=r.object,r=r.buffer,b.setObjectFaces(m),s=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|
|
|
|
+d:c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.lights,null,s,r,m):b.renderBuffer(q,i.lights,null,s,r,m);t=i.__webglObjectsImmediate;for(n=0,o=t.length;n<o;n++)r=t[n],m=r.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(q,i.lights,null,c,m))}l=b.getClearColor();p=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,p);a.enable(a.BLEND);
|
|
b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(m,o);b.attachShader(m,q);b.linkProgram(m);h=m;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
|
|
|
|
|
|
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(n,o);b.attachShader(n,q);b.linkProgram(n);h=n;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
|
|
"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,n=d.length;if(n){var r=i,s=k,t=q/o,o=0.5*o,w=0.5*q,u=!0;b.useProgram(h);l||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),l=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
|
-!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var v,y=[],r=0;r<n;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<n;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(v.position.x-
|
|
|
|
-o)/o,(w-v.position.y)/w,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),y[0]=e*t*v.scale.x,y[1]=e*v.scale.y,b.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(s.alignment,v.alignment.x,v.alignment.y),b.uniform1f(s.opacity,v.opacity),b.uniform3f(s.color,
|
|
|
|
-v.color.r,v.color.g,v.color.b),b.uniform1f(s.rotation,v.rotation),b.uniform2fv(s.scale,y),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
|
|
|
|
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
|
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(q);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||l!==c.far||p!==c.fov){i=c.aspect;k=c.near;l=c.far;p=c.fov;var t=c.projectionMatrix.clone(),w=0.5*(125/30),u=w*k/125,v=k*Math.tan(p*Math.PI/360),y;g.n14=w;h.n14=-w;w=-v*i+u;y=v*i+u;t.n11=2*k/(y-w);t.n13=(y+w)/(y-w);e.projectionMatrix.copy(t);w=-v*i-u;y=v*i-u;t.n11=
|
|
|
|
-2*k/(y-w);t.n13=(y+w)/(y-w);f.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,m,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);n.updateMatrixWorld();d.call(b,n,q)}};
|
|
|
|
|
|
+k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=k,t=q/o,o=0.5*o,w=0.5*q,u=!0;b.useProgram(h);l||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),l=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
|
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var v,A=[],r=0;r<m;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(v.position.x-
|
|
|
|
+o)/o,(w-v.position.y)/w,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),A[0]=e*t*v.scale.x,A[1]=e*v.scale.y,b.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(s.alignment,v.alignment.x,v.alignment.y),b.uniform1f(s.opacity,v.opacity),b.uniform3f(s.color,
|
|
|
|
+v.color.r,v.color.g,v.color.b),b.uniform1f(s.rotation,v.rotation),b.uniform2fv(s.scale,A),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
|
|
|
|
+1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
|
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(q);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||l!==c.far||p!==c.fov){i=c.aspect;k=c.near;l=c.far;p=c.fov;var t=c.projectionMatrix.clone(),w=0.5*(125/30),u=w*k/125,v=k*Math.tan(p*Math.PI/360),A;g.n14=w;h.n14=-w;w=-v*i+u;A=v*i+u;t.n11=2*k/(A-w);t.n13=(A+w)/(A-w);e.projectionMatrix.copy(t);w=-v*i-u;A=v*i-u;t.n11=
|
|
|
|
+2*k/(A-w);t.n13=(A+w)/(A-w);f.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);m.updateMatrixWorld();d.call(b,m,q)}};
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
|
|
c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
|
|
c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|