|
@@ -17,31 +17,31 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
|
|
b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
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}};
|
|
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.Ray=function(a,b){function c(a,b,c){o.sub(c,a);p=o.dot(b);if(p<=0)return null;n=r.add(a,m.copy(b).multiplyScalar(p));return q=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);r.sub(c,b);m.sub(a,b);s=o.dot(o);t=o.dot(r);u=o.dot(m);v=r.dot(r);B=r.dot(m);x=1/(s*v-t*t);C=(v*u-t*B)*x;E=(s*B-t*u)*x;return C>=0&&E>=0&&C+E<1}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=[];b=0;for(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,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var n,p=[],o=0,r=m.children.length;o<r;o++)Array.prototype.push.apply(p,this.intersectObject(m.children[o]));if(m instanceof THREE.Particle){o=
|
|
|
|
-c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.scale.x)return[];n={distance:o,point:m.position,face:null,object:m};p.push(n)}else if(m instanceof THREE.Mesh){o=c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return p;var q,s=m.geometry,t=s.vertices,u;m.matrixRotationWorld.extractRotation(m.matrixWorld);o=0;for(r=s.faces.length;o<r;o++)if(n=s.faces[o],a.copy(this.origin),
|
|
|
|
-b.copy(this.direction),u=m.matrixWorld,i=u.multiplyVector3(i.copy(n.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=u.multiplyVector3(e.copy(t[n.a].position)),g=u.multiplyVector3(g.copy(t[n.b].position)),f=u.multiplyVector3(f.copy(t[n.c].position)),n instanceof THREE.Face4&&(h=u.multiplyVector3(h.copy(t[n.d].position))),l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),q=b.dot(l),m.doubleSided||(m.flipSided?q>0:q<0)))if(q=l.dot(i.sub(e,a))/q,j.add(a,b.multiplyScalar(q)),n instanceof THREE.Face3)d(j,
|
|
|
|
-e,g,f)&&(n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},p.push(n));else if(n instanceof THREE.Face4&&(d(j,e,g,h)||d(j,g,f,h)))n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},p.push(n)}return p};var o=new THREE.Vector3,r=new THREE.Vector3,m=new THREE.Vector3,p,n,q,s,t,u,v,B,x,C,E};
|
|
|
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);if(r<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(r));return q=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);s=o.dot(o);u=o.dot(p);t=o.dot(m);y=p.dot(p);A=p.dot(m);D=1/(s*y-u*u);F=(y*t-u*A)*D;H=(s*A-u*t)*D;return F>=0&&H>=0&&F+H<1}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=[];b=0;for(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,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var n,r=[],o=0,p=m.children.length;o<p;o++)Array.prototype.push.apply(r,this.intersectObject(m.children[o]));if(m instanceof THREE.Particle){o=
|
|
|
|
+c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.scale.x)return[];n={distance:o,point:m.position,face:null,object:m};r.push(n)}else if(m instanceof THREE.Mesh){o=c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return r;var q,s=m.geometry,u=s.vertices,t;m.matrixRotationWorld.extractRotation(m.matrixWorld);o=0;for(p=s.faces.length;o<p;o++)if(n=s.faces[o],a.copy(this.origin),
|
|
|
|
+b.copy(this.direction),t=m.matrixWorld,i=t.multiplyVector3(i.copy(n.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=t.multiplyVector3(e.copy(u[n.a].position)),g=t.multiplyVector3(g.copy(u[n.b].position)),f=t.multiplyVector3(f.copy(u[n.c].position)),n instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(u[n.d].position))),l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),q=b.dot(l),m.doubleSided||(m.flipSided?q>0:q<0)))if(q=l.dot(i.sub(e,a))/q,j.add(a,b.multiplyScalar(q)),n instanceof THREE.Face3)d(j,
|
|
|
|
+e,g,f)&&(n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},r.push(n));else if(n instanceof THREE.Face4&&(d(j,e,g,h)||d(j,g,f,h)))n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},r.push(n)}return r};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,r,n,q,s,u,t,y,A,D,F,H};
|
|
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,j,o){h=!1;b=g;c=f;d=j;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
|
|
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,j,o){h=!1;b=g;c=f;d=j;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
|
|
-function(g,f,j,o,r,m){h?(h=!1,b=g<j?g<r?g:r:j<r?j:r,c=f<o?f<m?f:m:o<m?o:m,d=g>j?g>r?g:r:j>r?j:r,e=f>o?f>m?f:m:o>m?o:m):(b=g<j?g<r?g<b?g:b:r<b?r:b:j<r?j<b?j:b:r<b?r:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>j?g>r?g>d?g:d:r>d?r:d:j>r?j>d?j:d:r>d?r:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
|
|
|
|
|
|
+function(g,f,j,o,p,m){h?(h=!1,b=g<j?g<p?g:p:j<p?j:p,c=f<o?f<m?f:m:o<m?o:m,d=g>j?g>p?g:p:j>p?j:p,e=f>o?f>m?f:m:o>m?o:m):(b=g<j?g<p?g<b?g:b:p<b?p:b:j<p?j<b?j:b:p<b?p:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>j?g>p?g>d?g:d:p>d?p:d:j>p?j>d?j:d:p>d?p:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
|
|
g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=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}};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}};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,g,f,h,i,l,j,o,r,m,p,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,l||0,j!==void 0?j:1,o||0,r||0,m||0,p||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,l,j,o,r,m,p,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=j;this.n34=o;this.n41=r;this.n42=m;this.n43=p;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,j=a.n31,o=a.n32,r=a.n33,m=a.n34,p=a.n41,n=a.n42,q=a.n43,
|
|
|
|
-s=a.n44,t=b.n11,u=b.n12,v=b.n13,B=b.n14,x=b.n21,C=b.n22,E=b.n23,G=b.n24,R=b.n31,z=b.n32,J=b.n33,K=b.n34,U=b.n41,V=b.n42,Y=b.n43,T=b.n44;this.n11=c*t+d*x+e*R+g*U;this.n12=c*u+d*C+e*z+g*V;this.n13=c*v+d*E+e*J+g*Y;this.n14=c*B+d*G+e*K+g*T;this.n21=f*t+h*x+i*R+l*U;this.n22=f*u+h*C+i*z+l*V;this.n23=f*v+h*E+i*J+l*Y;this.n24=f*B+h*G+i*K+l*T;this.n31=j*t+o*x+r*R+m*U;this.n32=j*u+o*C+r*z+m*V;this.n33=j*v+o*E+r*J+m*Y;this.n34=j*B+o*G+r*K+m*T;this.n41=p*t+n*x+q*R+s*U;this.n42=p*u+n*C+q*z+s*V;this.n43=p*v+n*
|
|
|
|
-E+q*J+s*Y;this.n44=p*B+n*G+q*K+s*T;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,g,f,h,i,l,j,o,p,m,r,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,l||0,j!==void 0?j:1,o||0,p||0,m||0,r||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,l,j,o,p,m,r,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=j;this.n34=o;this.n41=p;this.n42=m;this.n43=r;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,j=a.n31,o=a.n32,p=a.n33,m=a.n34,r=a.n41,n=a.n42,q=a.n43,
|
|
|
|
+s=a.n44,u=b.n11,t=b.n12,y=b.n13,A=b.n14,D=b.n21,F=b.n22,H=b.n23,B=b.n24,J=b.n31,x=b.n32,z=b.n33,G=b.n34,W=b.n41,S=b.n42,T=b.n43,V=b.n44;this.n11=c*u+d*D+e*J+g*W;this.n12=c*t+d*F+e*x+g*S;this.n13=c*y+d*H+e*z+g*T;this.n14=c*A+d*B+e*G+g*V;this.n21=f*u+h*D+i*J+l*W;this.n22=f*t+h*F+i*x+l*S;this.n23=f*y+h*H+i*z+l*T;this.n24=f*A+h*B+i*G+l*V;this.n31=j*u+o*D+p*J+m*W;this.n32=j*t+o*F+p*x+m*S;this.n33=j*y+o*H+p*z+m*T;this.n34=j*A+o*B+p*G+m*V;this.n41=r*u+n*D+q*J+s*W;this.n42=r*t+n*F+q*x+s*S;this.n43=r*y+n*
|
|
|
|
+H+q*z+s*T;this.n44=r*A+n*B+q*G+s*V;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,g=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,j=this.n33,o=this.n34,r=this.n41,m=this.n42,p=this.n43,n=this.n44;return d*f*l*r-c*h*l*r-d*g*j*r+b*h*j*r+c*g*o*r-b*f*o*r-d*f*i*m+c*h*i*m+d*e*j*m-a*h*j*m-c*e*o*m+a*f*o*m+d*g*i*p-b*h*i*p-d*e*l*p+a*h*l*p+b*e*o*p-a*g*o*p-c*g*i*n+b*f*i*n+c*e*l*n-a*f*l*n-b*e*j*n+a*g*j*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,g=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,j=this.n33,o=this.n34,p=this.n41,m=this.n42,r=this.n43,n=this.n44;return d*f*l*p-c*h*l*p-d*g*j*p+b*h*j*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*j*m-a*h*j*m-c*e*o*m+a*f*o*m+d*g*i*r-b*h*i*r-d*e*l*r+a*h*l*r+b*e*o*r-a*g*o*r-c*g*i*n+b*f*i*n+c*e*l*n-a*f*l*n-b*e*j*n+a*g*j*n},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,g=a.x,f=a.y,h=a.z,i=e*g,l=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*h-d*f,l*h+d*g,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,g=a.x,f=a.y,h=a.z,i=e*g,l=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*h-d*f,l*h+d*g,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,g=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,j=a.n32,o=a.n33,r=a.n34,m=a.n41,p=a.n42,n=a.n43,q=a.n44;this.n11=h*r*p-i*o*p+i*j*n-f*r*n-h*j*q+f*o*q;this.n12=e*o*p-d*r*p-e*j*n+c*r*n+d*j*q-c*o*q;this.n13=d*i*p-e*h*p+e*f*n-c*i*n-d*f*q+c*h*q;this.n14=e*h*j-d*i*j-e*f*o+c*i*o+d*f*r-c*h*r;this.n21=i*o*m-h*r*m-i*l*n+g*r*n+h*l*q-g*o*q;this.n22=d*r*m-e*o*m+
|
|
|
|
-e*l*n-b*r*n-d*l*q+b*o*q;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*q-b*h*q;this.n24=d*i*l-e*h*l+e*g*o-b*i*o-d*g*r+b*h*r;this.n31=f*r*m-i*j*m+i*l*p-g*r*p-f*l*q+g*j*q;this.n32=e*j*m-c*r*m-e*l*p+b*r*p+c*l*q-b*j*q;this.n33=c*i*m-e*f*m+e*g*p-b*i*p-c*g*q+b*f*q;this.n34=e*f*l-c*i*l-e*g*j+b*i*j+c*g*r-b*f*r;this.n41=h*j*m-f*o*m-h*l*p+g*o*p+f*l*n-g*j*n;this.n42=c*o*m-d*j*m+d*l*p-b*o*p-c*l*n+b*j*n;this.n43=d*f*m-c*h*m-d*g*p+b*h*p+c*g*n-b*f*n;this.n44=c*h*l-d*f*l+d*g*j-b*h*j-c*g*o+b*f*o;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,g=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,j=a.n32,o=a.n33,p=a.n34,m=a.n41,r=a.n42,n=a.n43,q=a.n44;this.n11=h*p*r-i*o*r+i*j*n-f*p*n-h*j*q+f*o*q;this.n12=e*o*r-d*p*r-e*j*n+c*p*n+d*j*q-c*o*q;this.n13=d*i*r-e*h*r+e*f*n-c*i*n-d*f*q+c*h*q;this.n14=e*h*j-d*i*j-e*f*o+c*i*o+d*f*p-c*h*p;this.n21=i*o*m-h*p*m-i*l*n+g*p*n+h*l*q-g*o*q;this.n22=d*p*m-e*o*m+
|
|
|
|
+e*l*n-b*p*n-d*l*q+b*o*q;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*q-b*h*q;this.n24=d*i*l-e*h*l+e*g*o-b*i*o-d*g*p+b*h*p;this.n31=f*p*m-i*j*m+i*l*r-g*p*r-f*l*q+g*j*q;this.n32=e*j*m-c*p*m-e*l*r+b*p*r+c*l*q-b*j*q;this.n33=c*i*m-e*f*m+e*g*r-b*i*r-c*g*q+b*f*q;this.n34=e*f*l-c*i*l-e*g*j+b*i*j+c*g*p-b*f*p;this.n41=h*j*m-f*o*m-h*l*r+g*o*r+f*l*n-g*j*n;this.n42=c*o*m-d*j*m+d*l*r-b*o*r-c*l*n+b*j*n;this.n43=d*f*m-c*h*m-d*g*r+b*h*r+c*g*n-b*f*n;this.n44=c*h*l-d*f*l+d*g*j-b*h*j-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
|
|
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,l=f*e,j=d*h,o=d*e;this.n11=i+o*c;this.n12=j*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-j;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;l=f*e;j=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=j+l*c;this.n21=l+j*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
|
|
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,l=f*e,j=d*h,o=d*e;this.n11=i+o*c;this.n12=j*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-j;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;l=f*e;j=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=j+l*c;this.n21=l+j*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
|
|
g*h;l=g*e;j=c*h;o=c*e;this.n11=f*h;this.n12=j*d-l;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=l*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=j*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+j;this.n33=i-o*e;break;case "XZY":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=l*e-j;this.n31=j*e-l;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,l=g*
|
|
g*h;l=g*e;j=c*h;o=c*e;this.n11=f*h;this.n12=j*d-l;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=l*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=j*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+j;this.n33=i-o*e;break;case "XZY":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=l*e-j;this.n31=j*e-l;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,l=g*
|
|
e,j=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+j*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=j+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
|
|
e,j=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+j*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=j+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
|
|
@@ -58,16 +58,16 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
|
|
if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},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.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=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=l[i]=l[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,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,g,f=[],h,i,l=[],
|
|
THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=l[i]=l[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,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,g,f=[],h,i,l=[],
|
|
-j,o,r=[],m,p=[],n,q,s=[],t,u,v=[],B={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,C=new THREE.Vector4,E=new THREE.Matrix4,G=new THREE.Matrix4,R=new THREE.Frustum,z=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);E.multiply(b.matrixWorld,
|
|
|
|
-b.projectionMatrixInverse);E.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){g=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;var f=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||R.contains(b))?(E.multiplyVector3(x.copy(b.position)),e=a(),e.object=
|
|
|
|
-b,e.z=x.z,B.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(x.copy(b.position)),e=a(),e.object=b,e.z=x.z,B.sprites.push(e)):b instanceof THREE.Light&&B.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&B.objects.sort(c);return B};this.projectScene=function(a,e,g){var f=e.near,x=e.far,k,M,L,I,w,W,da,fa,X,S,$,O,ba,aa,pa,ca;u=q=m=o=0;B.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);E.multiply(e.projectionMatrix,e.matrixWorldInverse);R.setFromMatrix(E);B=this.projectGraph(a,!1);a=0;for(k=B.objects.length;a<k;a++)if(X=B.objects[a].object,S=X.matrixWorld,O=X.material,i=0,X instanceof THREE.Mesh){$=X.geometry;ba=X.geometry.materials;I=$.vertices;aa=$.faces;pa=$.faceVertexUvs;$=X.matrixRotationWorld.extractRotation(S);M=0;for(L=I.length;M<L;M++)h=b(),h.positionWorld.copy(I[M].position),S.multiplyVector3(h.positionWorld),
|
|
|
|
-h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<x;I=0;for(M=aa.length;I<M;I++){L=aa[I];if(L instanceof THREE.Face3)if(w=l[L.a],W=l[L.b],da=l[L.c],w.visible&&W.visible&&da.visible&&(X.doubleSided||X.flipSided!=(da.positionScreen.x-w.positionScreen.x)*(W.positionScreen.y-w.positionScreen.y)-(da.positionScreen.y-w.positionScreen.y)*(W.positionScreen.x-
|
|
|
|
-w.positionScreen.x)<0))fa=r[o]=r[o]||new THREE.RenderableFace3,o++,j=fa,j.v1.copy(w),j.v2.copy(W),j.v3.copy(da);else continue;else if(L instanceof THREE.Face4)if(w=l[L.a],W=l[L.b],da=l[L.c],fa=l[L.d],w.visible&&W.visible&&da.visible&&fa.visible&&(X.doubleSided||X.flipSided!=((fa.positionScreen.x-w.positionScreen.x)*(W.positionScreen.y-w.positionScreen.y)-(fa.positionScreen.y-w.positionScreen.y)*(W.positionScreen.x-w.positionScreen.x)<0||(W.positionScreen.x-da.positionScreen.x)*(fa.positionScreen.y-
|
|
|
|
-da.positionScreen.y)-(W.positionScreen.y-da.positionScreen.y)*(fa.positionScreen.x-da.positionScreen.x)<0)))ca=p[m]=p[m]||new THREE.RenderableFace4,m++,j=ca,j.v1.copy(w),j.v2.copy(W),j.v3.copy(da),j.v4.copy(fa);else continue;j.normalWorld.copy(L.normal);$.multiplyVector3(j.normalWorld);j.centroidWorld.copy(L.centroid);S.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);E.multiplyVector3(j.centroidScreen);da=L.vertexNormals;w=0;for(W=da.length;w<W;w++)fa=j.vertexNormalsWorld[w],
|
|
|
|
-fa.copy(da[w]),$.multiplyVector3(fa);w=0;for(W=pa.length;w<W;w++)if(ca=pa[w][I]){da=0;for(fa=ca.length;da<fa;da++)j.uvs[w][da]=ca[da]}j.material=O;j.faceMaterial=L.materialIndex!==null?ba[L.materialIndex]:null;j.z=j.centroidScreen.z;B.elements.push(j)}}else if(X instanceof THREE.Line){G.multiply(E,S);I=X.geometry.vertices;w=b();w.positionScreen.copy(I[0].position);G.multiplyVector4(w.positionScreen);M=1;for(L=I.length;M<L;M++)if(w=b(),w.positionScreen.copy(I[M].position),G.multiplyVector4(w.positionScreen),
|
|
|
|
-W=l[i-2],z.copy(w.positionScreen),J.copy(W.positionScreen),d(z,J))z.multiplyScalar(1/z.w),J.multiplyScalar(1/J.w),X=s[q]=s[q]||new THREE.RenderableLine,q++,n=X,n.v1.positionScreen.copy(z),n.v2.positionScreen.copy(J),n.z=Math.max(z.z,J.z),n.material=O,B.elements.push(n)}a=0;for(k=B.sprites.length;a<k;a++)if(X=B.sprites[a].object,S=X.matrixWorld,X instanceof THREE.Particle&&(C.set(S.n14,S.n24,S.n34,1),E.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))f=v[u]=v[u]||new THREE.RenderableParticle,u++,t=f,t.x=
|
|
|
|
-C.x/C.w,t.y=C.y/C.w,t.z=C.z,t.rotation=X.rotation.z,t.scale.x=X.scale.x*Math.abs(t.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),t.scale.y=X.scale.y*Math.abs(t.y-(C.y+e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),t.material=X.material,B.elements.push(t);g&&B.elements.sort(c);return B}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
|
|
|
|
|
|
+j,o,p=[],m,r=[],n,q,s=[],u,t,y=[],A={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,F=new THREE.Vector4,H=new THREE.Matrix4,B=new THREE.Matrix4,J=new THREE.Frustum,x=new THREE.Vector4,z=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);H.multiply(b.matrixWorld,
|
|
|
|
+b.projectionMatrixInverse);H.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){g=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var f=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||J.contains(b))?(H.multiplyVector3(D.copy(b.position)),e=a(),e.object=
|
|
|
|
+b,e.z=D.z,A.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(H.multiplyVector3(D.copy(b.position)),e=a(),e.object=b,e.z=D.z,A.sprites.push(e)):b instanceof THREE.Light&&A.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&A.objects.sort(c);return A};this.projectScene=function(a,e,g){var f=e.near,D=e.far,k,L,K,v,M,X,ca,ea,aa,U,I,P,$,Z,oa,ba;t=q=m=o=0;A.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);H.multiply(e.projectionMatrix,e.matrixWorldInverse);J.setFromMatrix(H);A=this.projectGraph(a,!1);a=0;for(k=A.objects.length;a<k;a++)if(aa=A.objects[a].object,U=aa.matrixWorld,P=aa.material,i=0,aa instanceof THREE.Mesh){I=aa.geometry;$=aa.geometry.materials;v=I.vertices;Z=I.faces;oa=I.faceVertexUvs;I=aa.matrixRotationWorld.extractRotation(U);L=0;for(K=v.length;L<K;L++)h=b(),h.positionWorld.copy(v[L].position),U.multiplyVector3(h.positionWorld),
|
|
|
|
+h.positionScreen.copy(h.positionWorld),H.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<D;v=0;for(L=Z.length;v<L;v++){K=Z[v];if(K instanceof THREE.Face3)if(M=l[K.a],X=l[K.b],ca=l[K.c],M.visible&&X.visible&&ca.visible&&(aa.doubleSided||aa.flipSided!=(ca.positionScreen.x-M.positionScreen.x)*(X.positionScreen.y-M.positionScreen.y)-(ca.positionScreen.y-M.positionScreen.y)*(X.positionScreen.x-
|
|
|
|
+M.positionScreen.x)<0))ea=p[o]=p[o]||new THREE.RenderableFace3,o++,j=ea,j.v1.copy(M),j.v2.copy(X),j.v3.copy(ca);else continue;else if(K instanceof THREE.Face4)if(M=l[K.a],X=l[K.b],ca=l[K.c],ea=l[K.d],M.visible&&X.visible&&ca.visible&&ea.visible&&(aa.doubleSided||aa.flipSided!=((ea.positionScreen.x-M.positionScreen.x)*(X.positionScreen.y-M.positionScreen.y)-(ea.positionScreen.y-M.positionScreen.y)*(X.positionScreen.x-M.positionScreen.x)<0||(X.positionScreen.x-ca.positionScreen.x)*(ea.positionScreen.y-
|
|
|
|
+ca.positionScreen.y)-(X.positionScreen.y-ca.positionScreen.y)*(ea.positionScreen.x-ca.positionScreen.x)<0)))ba=r[m]=r[m]||new THREE.RenderableFace4,m++,j=ba,j.v1.copy(M),j.v2.copy(X),j.v3.copy(ca),j.v4.copy(ea);else continue;j.normalWorld.copy(K.normal);I.multiplyVector3(j.normalWorld);j.centroidWorld.copy(K.centroid);U.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);H.multiplyVector3(j.centroidScreen);ca=K.vertexNormals;M=0;for(X=ca.length;M<X;M++)ea=j.vertexNormalsWorld[M],
|
|
|
|
+ea.copy(ca[M]),I.multiplyVector3(ea);M=0;for(X=oa.length;M<X;M++)if(ba=oa[M][v]){ca=0;for(ea=ba.length;ca<ea;ca++)j.uvs[M][ca]=ba[ca]}j.material=P;j.faceMaterial=K.materialIndex!==null?$[K.materialIndex]:null;j.z=j.centroidScreen.z;A.elements.push(j)}}else if(aa instanceof THREE.Line){B.multiply(H,U);v=aa.geometry.vertices;M=b();M.positionScreen.copy(v[0].position);B.multiplyVector4(M.positionScreen);L=1;for(K=v.length;L<K;L++)if(M=b(),M.positionScreen.copy(v[L].position),B.multiplyVector4(M.positionScreen),
|
|
|
|
+X=l[i-2],x.copy(M.positionScreen),z.copy(X.positionScreen),d(x,z))x.multiplyScalar(1/x.w),z.multiplyScalar(1/z.w),aa=s[q]=s[q]||new THREE.RenderableLine,q++,n=aa,n.v1.positionScreen.copy(x),n.v2.positionScreen.copy(z),n.z=Math.max(x.z,z.z),n.material=P,A.elements.push(n)}a=0;for(k=A.sprites.length;a<k;a++)if(aa=A.sprites[a].object,U=aa.matrixWorld,aa instanceof THREE.Particle&&(F.set(U.n14,U.n24,U.n34,1),H.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))f=y[t]=y[t]||new THREE.RenderableParticle,t++,u=f,
|
|
|
|
+u.x=F.x/F.w,u.y=F.y/F.w,u.z=F.z,u.rotation=aa.rotation.z,u.scale.x=aa.scale.x*Math.abs(u.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14)),u.scale.y=aa.scale.y*Math.abs(u.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24)),u.material=aa.material,A.elements.push(u);g&&A.elements.sort(c);return A}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?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},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),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
|
|
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},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),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-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=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
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=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
|
|
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);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
|
|
@@ -83,14 +83,14 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
|
|
b,c,d,e,g,f=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
|
|
b,c,d,e,g,f=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(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;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(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;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(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));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(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]))},computeTangents:function(){function a(a,
|
|
d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(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]))},computeTangents:function(){function a(a,
|
|
-b,c,d,e,g,K){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;j=f[e];o=f[g];r=f[K];m=i.x-h.x;p=l.x-h.x;n=i.y-h.y;q=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=o.u-j.u;v=r.u-j.u;B=o.v-j.v;x=r.v-j.v;C=1/(u*x-v*B);z.set((x*m-B*p)*C,(x*n-B*q)*C,(x*s-B*t)*C);J.set((u*p-v*m)*C,(u*q-v*n)*C,(u*t-v*s)*C);G[b].addSelf(z);G[c].addSelf(z);G[d].addSelf(z);R[b].addSelf(J);R[c].addSelf(J);R[d].addSelf(J)}var b,c,d,e,g,f,h,i,l,j,o,r,m,p,n,q,s,t,u,v,B,x,C,E,G=[],R=[],z=new THREE.Vector3,J=new THREE.Vector3,
|
|
|
|
-K=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,R[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var Y=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)V.copy(g.vertexNormals[d]),e=g[Y[d]],
|
|
|
|
-E=G[e],K.copy(E),K.subSelf(V.multiplyScalar(V.dot(E))).normalize(),U.cross(g.vertexNormals[d],E),e=U.dot(R[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
|
|
|
|
|
|
+b,c,d,e,g,G){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;j=f[e];o=f[g];p=f[G];m=i.x-h.x;r=l.x-h.x;n=i.y-h.y;q=l.y-h.y;s=i.z-h.z;u=l.z-h.z;t=o.u-j.u;y=p.u-j.u;A=o.v-j.v;D=p.v-j.v;F=1/(t*D-y*A);x.set((D*m-A*r)*F,(D*n-A*q)*F,(D*s-A*u)*F);z.set((t*r-y*m)*F,(t*q-y*n)*F,(t*u-y*s)*F);B[b].addSelf(x);B[c].addSelf(x);B[d].addSelf(x);J[b].addSelf(z);J[c].addSelf(z);J[d].addSelf(z)}var b,c,d,e,g,f,h,i,l,j,o,p,m,r,n,q,s,u,t,y,A,D,F,H,B=[],J=[],x=new THREE.Vector3,z=new THREE.Vector3,
|
|
|
|
+G=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)B[b]=new THREE.Vector3,J[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var T=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)S.copy(g.vertexNormals[d]),e=g[T[d]],
|
|
|
|
+H=B[e],G.copy(H),G.subSelf(S.multiplyScalar(S.dot(H))).normalize(),W.cross(g.vertexNormals[d],H),e=W.dot(J[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(G.x,G.y,G.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
|
|
this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
|
|
this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
|
|
0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
|
|
0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],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;
|
|
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,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,l,j,o,r;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;g=Math.floor(e);f=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;l=this.points[c[0]];j=this.points[c[1]];
|
|
|
|
-o=this.points[c[2]];r=this.points[c[3]];h=f*f;i=f*h;d.x=b(l.x,j.x,o.x,r.x,f,h,i);d.y=b(l.y,j.y,o.y,r.y,f,h,i);d.z=b(l.z,j.z,o.z,r.z,f,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,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
|
|
|
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,l,j,o,p;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;g=Math.floor(e);f=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;l=this.points[c[0]];j=this.points[c[1]];
|
|
|
|
+o=this.points[c[2]];p=this.points[c[3]];h=f*f;i=f*h;d.x=b(l.x,j.x,o.x,p.x,f,h,i);d.y=b(l.y,j.y,o.y,p.y,f,h,i);d.z=b(l.z,j.z,o.z,p.z,f,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,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
|
|
g.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,g,f,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];f=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
|
|
g.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,g,f,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];f=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-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,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g: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,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
|
|
@@ -148,47 +148,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&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)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&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);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&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);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&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=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,l,j,o,r,m,p,n;a=b.projectScene(c,d);i=0;for(l=a.length;i<l;i++)if(r=a[i],r instanceof THREE.RenderableParticle){p=r.x*e+e;n=r.y*g+g;j=0;for(o=r.material.length;j<o;j++)if(m=r.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=n+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}u=a}}function d(a){if(v!=a)n.strokeStyle=v=a}function e(a){if(B!=a)n.fillStyle=B=a}var g=this,f,h,i,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
-o,r,m,p,n=j.getContext("2d"),q=new THREE.Color(0),s=0,t=1,u=0,v=null,B=null,x=null,C=null,E=null,G,R,z,J,K=new THREE.RenderableVertex,U=new THREE.RenderableVertex,V,Y,T,k,M,L,I,w,W,da,fa,X,S=new THREE.Color,$=new THREE.Color,O=new THREE.Color,ba=new THREE.Color,aa=new THREE.Color,pa=[],ca=[],na,sa,ka,la,ya,xa,ua,za,H,ga,ea=new THREE.Rectangle,va=new THREE.Rectangle,ta=new THREE.Rectangle,Ra=!1,wa=new THREE.Color,Na=new THREE.Color,Oa=new THREE.Color,qa=new THREE.Vector3,Ka,La,Sa,A,Ma,Pa,a=16;Ka=document.createElement("canvas");
|
|
|
|
-Ka.width=Ka.height=2;La=Ka.getContext("2d");La.fillStyle="rgba(0,0,0,1)";La.fillRect(0,0,2,2);Sa=La.getImageData(0,0,2,2);A=Sa.data;Ma=document.createElement("canvas");Ma.width=Ma.height=a;Pa=Ma.getContext("2d");Pa.translate(-a/2,-a/2);Pa.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;r=b;m=Math.floor(o/2);p=Math.floor(r/2);j.width=o;j.height=r;ea.set(-m,-p,m,p);va.set(-m,-p,m,p);t=1;u=0;
|
|
|
|
-E=C=x=B=v=null};this.setClearColor=function(a,b){q.copy(a);s=b;va.set(-m,-p,m,p)};this.setClearColorHex=function(a,b){q.setHex(a);s=b;va.set(-m,-p,m,p)};this.clear=function(){n.setTransform(1,0,0,-1,m,p);va.isEmpty()||(va.minSelf(ea),va.inflate(2),s<1&&n.clearRect(Math.floor(va.getX()),Math.floor(va.getY()),Math.floor(va.getWidth()),Math.floor(va.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")"),n.fillRect(Math.floor(va.getX()),
|
|
|
|
-Math.floor(va.getY()),Math.floor(va.getWidth()),Math.floor(va.getHeight()))),va.empty())};this.render=function(a,j){function o(a){var b,c,d,e;wa.setRGB(0,0,0);Na.setRGB(0,0,0);Oa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(wa.r+=e.r,wa.g+=e.g,wa.b+=e.b):d instanceof THREE.DirectionalLight?(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b):d instanceof THREE.PointLight&&(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b)}function r(a,b,c,d){var e,g,f,h,k,ga;e=0;for(g=a.length;e<g;e++)f=a[e],
|
|
|
|
-h=f.color,f instanceof THREE.DirectionalLight?(k=f.matrixWorld.getPosition(),ga=c.dot(k),ga<=0||(ga*=f.intensity,d.r+=h.r*ga,d.g+=h.g*ga,d.b+=h.b*ga)):f instanceof THREE.PointLight&&(k=f.matrixWorld.getPosition(),ga=c.dot(qa.sub(k,b).normalize()),ga<=0||(ga*=f.distance==0?1:1-Math.min(b.distanceTo(k)/f.distance,1),ga!=0&&(ga*=f.intensity,d.r+=h.r*ga,d.g+=h.g*ga,d.b+=h.b*ga)))}function q(a,g,f){b(f.opacity);c(f.blending);var h,ga,k,i,j,l;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=f.map.image,
|
|
|
|
-j=i.width>>1,l=i.height>>1,f=g.scale.x*m,k=g.scale.y*p,h=f*j,ga=k*l,ta.set(a.x-h,a.y-ga,a.x+h,a.y+ga),ea.intersects(ta)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-k),n.translate(-j,-l),n.drawImage(i,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,ga=g.scale.y*p,ta.set(a.x-h,a.y-ga,a.x+h,a.y+ga),ea.intersects(ta)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,ga),f.program(n),
|
|
|
|
-n.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(x!=a)n.lineWidth=x=a;a=f.linecap;if(C!=a)n.lineCap=C=a;a=f.linejoin;if(E!=a)n.lineJoin=E=a;d(f.color.getContextStyle());n.stroke();ta.inflate(f.linewidth*2)}}function t(a,d,e,f,h,ea,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);
|
|
|
|
-V=a.positionScreen.x;Y=a.positionScreen.y;T=d.positionScreen.x;k=d.positionScreen.y;M=e.positionScreen.x;L=e.positionScreen.y;v(V,Y,T,k,M,L);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],Q(V,Y,T,k,M,L,la[f].u,la[f].v,la[h].u,la[h].v,la[ea].u,la[ea].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,qa.copy(m.vertexNormalsWorld[f]),ya=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,
|
|
|
|
-xa=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(m.vertexNormalsWorld[h]),ua=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,za=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(m.vertexNormalsWorld[ea]),H=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,ga=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,Q(V,Y,T,k,M,L,ya,xa,ua,za,H,ga,n.envMap)}else n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&
|
|
|
|
-(n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],Q(V,Y,T,k,M,L,la[f].u,la[f].v,la[h].u,la[h].v,la[ea].u,la[ea].v,n.map)),c(THREE.SubtractiveBlending)),Ra?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?($.r=O.r=ba.r=wa.r,$.g=O.g=ba.g=wa.g,$.b=O.b=ba.b=wa.b,r(i,m.v1.positionWorld,m.vertexNormalsWorld[0],$),r(i,m.v2.positionWorld,m.vertexNormalsWorld[1],O),r(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ba),$.r=Math.max(0,Math.min(n.color.r*$.r,1)),$.g=Math.max(0,
|
|
|
|
-Math.min(n.color.g*$.g,1)),$.b=Math.max(0,Math.min(n.color.b*$.b,1)),O.r=Math.max(0,Math.min(n.color.r*O.r,1)),O.g=Math.max(0,Math.min(n.color.g*O.g,1)),O.b=Math.max(0,Math.min(n.color.b*O.b,1)),ba.r=Math.max(0,Math.min(n.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(n.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(n.color.b*ba.b,1)),aa.r=(O.r+ba.r)*0.5,aa.g=(O.g+ba.g)*0.5,aa.b=(O.b+ba.b)*0.5,ka=P($,O,ba,aa),N(V,Y,T,k,M,L,0,0,1,0,0,1,ka)):(S.r=wa.r,S.g=wa.g,S.b=wa.b,r(i,m.centroidWorld,m.normalWorld,S),S.r=
|
|
|
|
-Math.max(0,Math.min(n.color.r*S.r,1)),S.g=Math.max(0,Math.min(n.color.g*S.g,1)),S.b=Math.max(0,Math.min(n.color.b*S.b,1)),n.wireframe?Ba(S,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(S)):n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)na=j.near,sa=j.far,$.r=$.g=$.b=1-Fa(a.positionScreen.z,na,sa),O.r=O.g=O.b=1-Fa(d.positionScreen.z,na,sa),ba.r=ba.g=ba.b=1-Fa(e.positionScreen.z,na,sa),aa.r=
|
|
|
|
-(O.r+ba.r)*0.5,aa.g=(O.g+ba.g)*0.5,aa.b=(O.b+ba.b)*0.5,ka=P($,O,ba,aa),N(V,Y,T,k,M,L,0,0,1,0,0,1,ka);else if(n instanceof THREE.MeshNormalMaterial)S.r=Ja(m.normalWorld.x),S.g=Ja(m.normalWorld.y),S.b=Ja(m.normalWorld.z),n.wireframe?Ba(S,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(S)}function u(a,d,e,f,h,ga,n,m,ea){g.info.render.vertices+=4;g.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap)t(a,d,f,0,1,3,n,m,ea),t(h,e,ga,1,2,3,n,m,ea);else if(V=a.positionScreen.x,
|
|
|
|
-Y=a.positionScreen.y,T=d.positionScreen.x,k=d.positionScreen.y,M=e.positionScreen.x,L=e.positionScreen.y,I=f.positionScreen.x,w=f.positionScreen.y,W=h.positionScreen.x,da=h.positionScreen.y,fa=ga.positionScreen.x,X=ga.positionScreen.y,m instanceof THREE.MeshBasicMaterial)B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ra?!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==
|
|
|
|
-4?($.r=O.r=ba.r=aa.r=wa.r,$.g=O.g=ba.g=aa.g=wa.g,$.b=O.b=ba.b=aa.b=wa.b,r(i,n.v1.positionWorld,n.vertexNormalsWorld[0],$),r(i,n.v2.positionWorld,n.vertexNormalsWorld[1],O),r(i,n.v4.positionWorld,n.vertexNormalsWorld[3],ba),r(i,n.v3.positionWorld,n.vertexNormalsWorld[2],aa),$.r=Math.max(0,Math.min(m.color.r*$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),O.r=Math.max(0,Math.min(m.color.r*O.r,1)),O.g=Math.max(0,Math.min(m.color.g*O.g,1)),O.b=Math.max(0,Math.min(m.color.b*
|
|
|
|
-O.b,1)),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)),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)),ka=P($,O,ba,aa),v(V,Y,T,k,I,w),N(V,Y,T,k,I,w,0,0,1,0,0,1,ka),v(W,da,M,L,fa,X),N(W,da,M,L,fa,X,1,0,1,1,0,1,ka)):(S.r=wa.r,S.g=wa.g,S.b=wa.b,r(i,n.centroidWorld,n.normalWorld,S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,
|
|
|
|
-Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(S)):(B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color));else if(m instanceof THREE.MeshNormalMaterial)S.r=Ja(n.normalWorld.x),S.g=Ja(n.normalWorld.y),S.b=Ja(n.normalWorld.z),B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):
|
|
|
|
-Aa(S);else if(m instanceof THREE.MeshDepthMaterial)na=j.near,sa=j.far,$.r=$.g=$.b=1-Fa(a.positionScreen.z,na,sa),O.r=O.g=O.b=1-Fa(d.positionScreen.z,na,sa),ba.r=ba.g=ba.b=1-Fa(f.positionScreen.z,na,sa),aa.r=aa.g=aa.b=1-Fa(e.positionScreen.z,na,sa),ka=P($,O,ba,aa),v(V,Y,T,k,I,w),N(V,Y,T,k,I,w,0,0,1,0,0,1,ka),v(W,da,M,L,fa,X),N(W,da,M,L,fa,X,1,0,1,1,0,1,ka)}function v(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 B(a,b,c,d,e,g,f,h){n.beginPath();
|
|
|
|
-n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,h);n.lineTo(a,b);n.closePath()}function Ba(a,b,c,e){if(x!=b)n.lineWidth=x=b;if(C!=c)n.lineCap=C=c;if(E!=e)n.lineJoin=E=e;d(a.getContextStyle());n.stroke();ta.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function Q(a,b,c,d,g,f,h,ga,k,i,m,j,ea){if(ea.image.width!=0){if(ea.needsUpdate==!0||pa[ea.id]==void 0){var l=ea.wrapS==THREE.RepeatWrapping,o=ea.wrapT==THREE.RepeatWrapping;pa[ea.id]=n.createPattern(ea.image,l&&o?"repeat":l&&!o?"repeat-x":
|
|
|
|
-!l&&o?"repeat-y":"no-repeat");ea.needsUpdate=!1}e(pa[ea.id]);var l=ea.offset.x/ea.repeat.x,o=ea.offset.y/ea.repeat.y,r=ea.image.width*ea.repeat.x,p=ea.image.height*ea.repeat.y,h=(h+l)*r,ga=(ga+o)*p,k=(k+l)*r,i=(i+o)*p,m=(m+l)*r,j=(j+o)*p;c-=a;d-=b;g-=a;f-=b;k-=h;i-=ga;m-=h;j-=ga;l=k*j-m*i;if(l==0){if(ca[ea.id]==void 0)b=document.createElement("canvas"),b.width=ea.image.width,b.height=ea.image.height,a=b.getContext("2d"),a.drawImage(ea.image,0,0),ca[ea.id]=a.getImageData(0,0,ea.image.width,ea.image.height).data,
|
|
|
|
-delete b;b=ca[ea.id];h=(Math.floor(h)+Math.floor(ga)*ea.image.width)*4;S.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(S)}else l=1/l,ea=(j*c-i*g)*l,i=(j*d-i*f)*l,c=(k*g-m*c)*l,d=(k*f-m*d)*l,a=a-ea*h-c*ga,h=b-i*h-d*ga,n.save(),n.transform(ea,i,c,d,a,h),n.fill(),n.restore()}}function N(a,b,c,d,e,g,f,h,ga,k,i,m,j){var ea,l;ea=j.width-1;l=j.height-1;f*=ea;h*=l;ga*=ea;k*=l;i*=ea;m*=l;c-=a;d-=b;e-=a;g-=b;ga-=f;k-=h;i-=f;m-=h;l=1/(ga*m-i*k);ea=(m*c-k*e)*l;k=(m*d-k*g)*l;c=(ga*e-i*c)*l;d=(ga*g-i*d)*l;a=a-ea*f-
|
|
|
|
-c*h;b=b-k*f-d*h;n.save();n.transform(ea,k,c,d,a,b);n.clip();n.drawImage(j,0,0);n.restore()}function P(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),ga=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);A[0]=e<0?0:e>255?255:e;A[1]=g<0?0:g>255?255:g;A[2]=a<0?0:a>255?255:a;A[4]=f<0?0:f>255?255:f;A[5]=h<0?0:h>255?255:h;A[6]=b<0?0:b>255?255:b;A[8]=ga<0?0:ga>255?255:ga;A[9]=k<0?0:k>255?255:k;A[10]=c<0?0:c>255?255:c;A[12]=
|
|
|
|
-i<0?0:i>255?255:i;A[13]=m<0?0:m>255?255:m;A[14]=d<0?0:d>255?255:d;La.putImageData(Sa,0,0);Pa.drawImage(Ka,0,0);return Ma}function Fa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ja(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Qa,Ta,ra,Z;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,p);g.info.render.vertices=0;g.info.render.faces=0;f=l.projectScene(a,j,this.sortElements);h=f.elements;
|
|
|
|
-i=f.lights;(Ra=i.length>0)&&o(i);Qa=0;for(Ta=h.length;Qa<Ta;Qa++)if(ra=h[Qa],Z=ra.material,Z=Z instanceof THREE.MeshFaceMaterial?ra.faceMaterial:Z,!(Z==null||Z.opacity==0)){ta.empty();if(ra instanceof THREE.RenderableParticle)G=ra,G.x*=m,G.y*=p,q(G,ra,Z,a);else if(ra instanceof THREE.RenderableLine)G=ra.v1,R=ra.v2,G.positionScreen.x*=m,G.positionScreen.y*=p,R.positionScreen.x*=m,R.positionScreen.y*=p,ta.addPoint(G.positionScreen.x,G.positionScreen.y),ta.addPoint(R.positionScreen.x,R.positionScreen.y),
|
|
|
|
-ea.intersects(ta)&&s(G,R,ra,Z,a);else if(ra instanceof THREE.RenderableFace3)G=ra.v1,R=ra.v2,z=ra.v3,G.positionScreen.x*=m,G.positionScreen.y*=p,R.positionScreen.x*=m,R.positionScreen.y*=p,z.positionScreen.x*=m,z.positionScreen.y*=p,Z.overdraw&&(Ca(G.positionScreen,R.positionScreen),Ca(R.positionScreen,z.positionScreen),Ca(z.positionScreen,G.positionScreen)),ta.add3Points(G.positionScreen.x,G.positionScreen.y,R.positionScreen.x,R.positionScreen.y,z.positionScreen.x,z.positionScreen.y),ea.intersects(ta)&&
|
|
|
|
-t(G,R,z,0,1,2,ra,Z,a);else if(ra instanceof THREE.RenderableFace4)G=ra.v1,R=ra.v2,z=ra.v3,J=ra.v4,G.positionScreen.x*=m,G.positionScreen.y*=p,R.positionScreen.x*=m,R.positionScreen.y*=p,z.positionScreen.x*=m,z.positionScreen.y*=p,J.positionScreen.x*=m,J.positionScreen.y*=p,K.positionScreen.copy(R.positionScreen),U.positionScreen.copy(J.positionScreen),Z.overdraw&&(Ca(G.positionScreen,R.positionScreen),Ca(R.positionScreen,J.positionScreen),Ca(J.positionScreen,G.positionScreen),Ca(z.positionScreen,
|
|
|
|
-K.positionScreen),Ca(z.positionScreen,U.positionScreen)),ta.addPoint(G.positionScreen.x,G.positionScreen.y),ta.addPoint(R.positionScreen.x,R.positionScreen.y),ta.addPoint(z.positionScreen.x,z.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),ea.intersects(ta)&&u(G,R,z,J,K,U,ra,Z,a);va.addRectangle(ta)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,m;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),m=c.dot(i),m<=0||(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(G.sub(i,b).normalize()),m<=0||(m*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),m!=0&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){R[a]==null&&(R[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"path"),V==0&&R[a].setAttribute("shape-rendering","crispEdges"));return R[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,j,o,r,m,p,n,q,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,v=new THREE.Color,B=new THREE.Color,x=new THREE.Color,C=new THREE.Color,E,G=new THREE.Vector3,R=[],z=[],J,K,U,V=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":V=1;break;case "low":V=0}};this.setSize=function(a,b){l=a;j=b;o=l/2;r=j/2;i.setAttribute("viewBox",-o+" "+-r+" "+l+" "+j);i.setAttribute("width",l);i.setAttribute("height",j);s.set(-o,-r,o,r)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,l){var k,R,L,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);g=e.elements;
|
|
|
|
-f=e.lights;U=K=0;if(u=f.length>0){B.setRGB(0,0,0);x.setRGB(0,0,0);C.setRGB(0,0,0);k=0;for(R=f.length;k<R;k++)I=f[k],L=I.color,I instanceof THREE.AmbientLight?(B.r+=L.r,B.g+=L.g,B.b+=L.b):I instanceof THREE.DirectionalLight?(x.r+=L.r,x.g+=L.g,x.b+=L.b):I instanceof THREE.PointLight&&(C.r+=L.r,C.g+=L.g,C.b+=L.b)}k=0;for(R=g.length;k<R;k++)if(L=g[k],I=L.material,I=I instanceof THREE.MeshFaceMaterial?L.faceMaterial:I,!(I==null||I.opacity==0))if(t.empty(),L instanceof THREE.RenderableParticle)m=L,m.x*=
|
|
|
|
-o,m.y*=-r;else if(L instanceof THREE.RenderableLine){if(m=L.v1,p=L.v2,m.positionScreen.x*=o,m.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),s.intersects(t)){L=m;var w=p,G=U++;z[G]==null&&(z[G]=document.createElementNS("http://www.w3.org/2000/svg","line"),V==0&&z[G].setAttribute("shape-rendering","crispEdges"));J=z[G];J.setAttribute("x1",L.positionScreen.x);J.setAttribute("y1",L.positionScreen.y);
|
|
|
|
-J.setAttribute("x2",w.positionScreen.x);J.setAttribute("y2",w.positionScreen.y);I instanceof THREE.LineBasicMaterial&&(J.setAttribute("style","fill: none; stroke: "+I.color.getContextStyle()+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin),i.appendChild(J))}}else if(L instanceof THREE.RenderableFace3){if(m=L.v1,p=L.v2,n=L.v3,m.positionScreen.x*=o,m.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,n.positionScreen.x*=
|
|
|
|
-o,n.positionScreen.y*=-r,t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(t)){var w=m,G=p,da=n;d.info.render.vertices+=3;d.info.render.faces++;J=b(K++);J.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?v.copy(I.color):I instanceof THREE.MeshLambertMaterial?
|
|
|
|
-u?(v.r=B.r,v.g=B.g,v.b=B.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(I.color.r*v.r,1)),v.g=Math.max(0,Math.min(I.color.g*v.g,1)),v.b=Math.max(0,Math.min(I.color.b*v.b,1))):v.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-L.z*I.__farMinusNear),v.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));I.wireframe?J.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
|
|
|
|
-I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):J.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(J)}}else if(L instanceof THREE.RenderableFace4&&(m=L.v1,p=L.v2,n=L.v3,q=L.v4,m.positionScreen.x*=o,m.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,n.positionScreen.x*=o,n.positionScreen.y*=-r,q.positionScreen.x*=o,q.positionScreen.y*=-r,t.addPoint(m.positionScreen.x,
|
|
|
|
-m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t))){var w=m,G=p,da=n,fa=q;d.info.render.vertices+=4;d.info.render.faces++;J=b(K++);J.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?
|
|
|
|
-v.copy(I.color):I instanceof THREE.MeshLambertMaterial?u?(v.r=B.r,v.g=B.g,v.b=B.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(I.color.r*v.r,1)),v.g=Math.max(0,Math.min(I.color.g*v.g,1)),v.b=Math.max(0,Math.min(I.color.b*v.b,1))):v.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-L.z*I.__farMinusNear),v.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));I.wireframe?J.setAttribute("style",
|
|
|
|
-"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):J.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(J)}}};
|
|
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,l,j,o,p,m,r,n;a=b.projectScene(c,d);i=0;for(l=a.length;i<l;i++)if(p=a[i],p instanceof THREE.RenderableParticle){r=p.x*e+e;n=p.y*g+g;j=0;for(o=p.material.length;j<o;j++)if(m=p.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=r+"px",m.style.top=n+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(t!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=a}}function d(a){if(y!=a)n.strokeStyle=y=a}function e(a){if(A!=a)n.fillStyle=A=a}var g=this,f,h,i,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
+o,p,m,r,n=j.getContext("2d"),q=new THREE.Color(0),s=0,u=1,t=0,y=null,A=null,D=null,F=null,H=null,B,J,x,z,G=new THREE.RenderableVertex,W=new THREE.RenderableVertex,S,T,V,k,L,K,v,M,X,ca,ea,aa,U=new THREE.Color,I=new THREE.Color,P=new THREE.Color,$=new THREE.Color,Z=new THREE.Color,oa=[],ba=[],ma,sa,ja,ka,ya,ua,va,wa,R,ga,Y=new THREE.Rectangle,da=new THREE.Rectangle,ta=new THREE.Rectangle,Qa=!1,ra=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,pa=new THREE.Vector3,Ja,Ka,Ra,xa,La,Oa,a=16;Ja=document.createElement("canvas");
|
|
|
|
+Ja.width=Ja.height=2;Ka=Ja.getContext("2d");Ka.fillStyle="rgba(0,0,0,1)";Ka.fillRect(0,0,2,2);Ra=Ka.getImageData(0,0,2,2);xa=Ra.data;La=document.createElement("canvas");La.width=La.height=a;Oa=La.getContext("2d");Oa.translate(-a/2,-a/2);Oa.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);r=Math.floor(p/2);j.width=o;j.height=p;Y.set(-m,-r,m,r);da.set(-m,-r,m,r);u=1;t=0;
|
|
|
|
+H=F=D=A=y=null};this.setClearColor=function(a,b){q.copy(a);s=b;da.set(-m,-r,m,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b;da.set(-m,-r,m,r)};this.clear=function(){n.setTransform(1,0,0,-1,m,r);da.isEmpty()||(da.minSelf(Y),da.inflate(2),s<1&&n.clearRect(Math.floor(da.getX()),Math.floor(da.getY()),Math.floor(da.getWidth()),Math.floor(da.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")"),n.fillRect(Math.floor(da.getX()),
|
|
|
|
+Math.floor(da.getY()),Math.floor(da.getWidth()),Math.floor(da.getHeight()))),da.empty())};this.render=function(a,j){function o(a){var b,c,d,e;ra.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ra.r+=e.r,ra.g+=e.g,ra.b+=e.b):d instanceof THREE.DirectionalLight?(Ma.r+=e.r,Ma.g+=e.g,Ma.b+=e.b):d instanceof THREE.PointLight&&(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b)}function p(a,b,c,d){var e,g,f,h,k,i;e=0;for(g=a.length;e<g;e++)f=a[e],
|
|
|
|
+h=f.color,f instanceof THREE.DirectionalLight?(k=f.matrixWorld.getPosition(),i=c.dot(k),i<=0||(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):f instanceof THREE.PointLight&&(k=f.matrixWorld.getPosition(),i=c.dot(pa.sub(k,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(k)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function q(a,g,f){b(f.opacity);c(f.blending);var h,k,i,j,da,l;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)j=f.map.image,da=j.width>>
|
|
|
|
+1,l=j.height>>1,f=g.scale.x*m,i=g.scale.y*r,h=f*da,k=i*l,ta.set(a.x-h,a.y-k,a.x+h,a.y+k),Y.intersects(ta)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-i),n.translate(-da,-l),n.drawImage(j,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,k=g.scale.y*r,ta.set(a.x-h,a.y-k,a.x+h,a.y+k),Y.intersects(ta)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,k),f.program(n),n.restore()))}
|
|
|
|
+function s(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(D!=a)n.lineWidth=D=a;a=f.linecap;if(F!=a)n.lineCap=F=a;a=f.linejoin;if(H!=a)n.lineJoin=H=a;d(f.color.getContextStyle());n.stroke();ta.inflate(f.linewidth*2)}}function u(a,d,e,f,h,da,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);S=a.positionScreen.x;
|
|
|
|
+T=a.positionScreen.y;V=d.positionScreen.x;k=d.positionScreen.y;L=e.positionScreen.x;K=e.positionScreen.y;y(S,T,V,k,L,K);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ka=m.uvs[0],Sa(S,T,V,k,L,K,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[da].u,ka[da].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,pa.copy(m.vertexNormalsWorld[f]),ya=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,ua=-(pa.x*a.n21+pa.y*
|
|
|
|
+a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(m.vertexNormalsWorld[h]),va=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,wa=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(m.vertexNormalsWorld[da]),R=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,ga=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,Sa(S,T,V,k,L,K,ya,ua,va,wa,R,ga,n.envMap)}else n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof
|
|
|
|
+THREE.UVMapping&&(ka=m.uvs[0],Sa(S,T,V,k,L,K,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[da].u,ka[da].v,n.map)),c(THREE.SubtractiveBlending)),Qa?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(I.r=P.r=$.r=ra.r,I.g=P.g=$.g=ra.g,I.b=P.b=$.b=ra.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],I),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],P),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],$),I.r=Math.max(0,Math.min(n.color.r*I.r,1)),I.g=Math.max(0,Math.min(n.color.g*I.g,1)),I.b=
|
|
|
|
+Math.max(0,Math.min(n.color.b*I.b,1)),P.r=Math.max(0,Math.min(n.color.r*P.r,1)),P.g=Math.max(0,Math.min(n.color.g*P.g,1)),P.b=Math.max(0,Math.min(n.color.b*P.b,1)),$.r=Math.max(0,Math.min(n.color.r*$.r,1)),$.g=Math.max(0,Math.min(n.color.g*$.g,1)),$.b=Math.max(0,Math.min(n.color.b*$.b,1)),Z.r=(P.r+$.r)*0.5,Z.g=(P.g+$.g)*0.5,Z.b=(P.b+$.b)*0.5,ja=Q(I,P,$,Z),Ia(S,T,V,k,L,K,0,0,1,0,0,1,ja)):(U.r=ra.r,U.g=ra.g,U.b=ra.b,p(i,m.centroidWorld,m.normalWorld,U),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=
|
|
|
|
+Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),n.wireframe?Ba(U,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(U)):n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)ma=j.near,sa=j.far,I.r=I.g=I.b=1-N(a.positionScreen.z,ma,sa),P.r=P.g=P.b=1-N(d.positionScreen.z,ma,sa),$.r=$.g=$.b=1-N(e.positionScreen.z,ma,sa),Z.r=(P.r+$.r)*0.5,Z.g=(P.g+$.g)*0.5,Z.b=(P.b+$.b)*
|
|
|
|
+0.5,ja=Q(I,P,$,Z),Ia(S,T,V,k,L,K,0,0,1,0,0,1,ja);else if(n instanceof THREE.MeshNormalMaterial)U.r=O(m.normalWorld.x),U.g=O(m.normalWorld.y),U.b=O(m.normalWorld.z),n.wireframe?Ba(U,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(U)}function t(a,d,e,f,h,n,da,m,l){g.info.render.vertices+=4;g.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap)u(a,d,f,0,1,3,da,m,l),u(h,e,n,1,2,3,da,m,l);else if(S=a.positionScreen.x,T=a.positionScreen.y,V=d.positionScreen.x,k=d.positionScreen.y,
|
|
|
|
+L=e.positionScreen.x,K=e.positionScreen.y,v=f.positionScreen.x,M=f.positionScreen.y,X=h.positionScreen.x,ca=h.positionScreen.y,ea=n.positionScreen.x,aa=n.positionScreen.y,m instanceof THREE.MeshBasicMaterial)A(S,T,V,k,L,K,v,M),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color);else if(m instanceof THREE.MeshLambertMaterial)Qa?!m.wireframe&&m.shading==THREE.SmoothShading&&da.vertexNormalsWorld.length==4?(I.r=P.r=$.r=Z.r=ra.r,I.g=P.g=$.g=Z.g=ra.g,I.b=P.b=
|
|
|
|
+$.b=Z.b=ra.b,p(i,da.v1.positionWorld,da.vertexNormalsWorld[0],I),p(i,da.v2.positionWorld,da.vertexNormalsWorld[1],P),p(i,da.v4.positionWorld,da.vertexNormalsWorld[3],$),p(i,da.v3.positionWorld,da.vertexNormalsWorld[2],Z),I.r=Math.max(0,Math.min(m.color.r*I.r,1)),I.g=Math.max(0,Math.min(m.color.g*I.g,1)),I.b=Math.max(0,Math.min(m.color.b*I.b,1)),P.r=Math.max(0,Math.min(m.color.r*P.r,1)),P.g=Math.max(0,Math.min(m.color.g*P.g,1)),P.b=Math.max(0,Math.min(m.color.b*P.b,1)),$.r=Math.max(0,Math.min(m.color.r*
|
|
|
|
+$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),Z.r=Math.max(0,Math.min(m.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(m.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(m.color.b*Z.b,1)),ja=Q(I,P,$,Z),y(S,T,V,k,v,M),Ia(S,T,V,k,v,M,0,0,1,0,0,1,ja),y(X,ca,L,K,ea,aa),Ia(X,ca,L,K,ea,aa,1,0,1,1,0,1,ja)):(U.r=ra.r,U.g=ra.g,U.b=ra.b,p(i,da.centroidWorld,da.normalWorld,U),U.r=Math.max(0,Math.min(m.color.r*U.r,1)),U.g=Math.max(0,Math.min(m.color.g*U.g,1)),U.b=Math.max(0,Math.min(m.color.b*
|
|
|
|
+U.b,1)),A(S,T,V,k,L,K,v,M),m.wireframe?Ba(U,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(U)):(A(S,T,V,k,L,K,v,M),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color));else if(m instanceof THREE.MeshNormalMaterial)U.r=O(da.normalWorld.x),U.g=O(da.normalWorld.y),U.b=O(da.normalWorld.z),A(S,T,V,k,L,K,v,M),m.wireframe?Ba(U,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(U);else if(m instanceof THREE.MeshDepthMaterial)ma=j.near,
|
|
|
|
+sa=j.far,I.r=I.g=I.b=1-N(a.positionScreen.z,ma,sa),P.r=P.g=P.b=1-N(d.positionScreen.z,ma,sa),$.r=$.g=$.b=1-N(f.positionScreen.z,ma,sa),Z.r=Z.g=Z.b=1-N(e.positionScreen.z,ma,sa),ja=Q(I,P,$,Z),y(S,T,V,k,v,M),Ia(S,T,V,k,v,M,0,0,1,0,0,1,ja),y(X,ca,L,K,ea,aa),Ia(X,ca,L,K,ea,aa,1,0,1,1,0,1,ja)}function y(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 A(a,b,c,d,e,g,f,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,h);n.lineTo(a,
|
|
|
|
+b);n.closePath()}function Ba(a,b,c,e){if(D!=b)n.lineWidth=D=b;if(F!=c)n.lineCap=F=c;if(H!=e)n.lineJoin=H=e;d(a.getContextStyle());n.stroke();ta.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function Sa(a,b,c,d,g,f,h,k,i,m,j,da,l){if(l.image.width!=0){if(l.needsUpdate==!0||oa[l.id]==void 0){var o=l.wrapS==THREE.RepeatWrapping,p=l.wrapT==THREE.RepeatWrapping;oa[l.id]=n.createPattern(l.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");l.needsUpdate=!1}e(oa[l.id]);var o=
|
|
|
|
+l.offset.x/l.repeat.x,p=l.offset.y/l.repeat.y,r=l.image.width*l.repeat.x,ra=l.image.height*l.repeat.y,h=(h+o)*r,k=(k+p)*ra,i=(i+o)*r,m=(m+p)*ra,j=(j+o)*r,da=(da+p)*ra;c-=a;d-=b;g-=a;f-=b;i-=h;m-=k;j-=h;da-=k;o=i*da-j*m;if(o==0){if(ba[l.id]==void 0)b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,a=b.getContext("2d"),a.drawImage(l.image,0,0),ba[l.id]=a.getImageData(0,0,l.image.width,l.image.height).data,delete b;b=ba[l.id];h=(Math.floor(h)+Math.floor(k)*l.image.width)*
|
|
|
|
+4;U.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(U)}else o=1/o,l=(da*c-m*g)*o,m=(da*d-m*f)*o,c=(i*g-j*c)*o,d=(i*f-j*d)*o,a=a-l*h-c*k,h=b-m*h-d*k,n.save(),n.transform(l,m,c,d,a,h),n.fill(),n.restore()}}function Ia(a,b,c,d,e,g,f,h,k,i,m,j,da){var l,o;l=da.width-1;o=da.height-1;f*=l;h*=o;k*=l;i*=o;m*=l;j*=o;c-=a;d-=b;e-=a;g-=b;k-=f;i-=h;m-=f;j-=h;o=1/(k*j-m*i);l=(j*c-i*e)*o;i=(j*d-i*g)*o;c=(k*e-m*c)*o;d=(k*g-m*d)*o;a=a-l*f-c*h;b=b-i*f-d*h;n.save();n.transform(l,i,c,d,a,b);n.clip();n.drawImage(da,0,0);n.restore()}
|
|
|
|
+function Q(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255);xa[0]=e<0?0:e>255?255:e;xa[1]=g<0?0:g>255?255:g;xa[2]=a<0?0:a>255?255:a;xa[4]=f<0?0:f>255?255:f;xa[5]=h<0?0:h>255?255:h;xa[6]=b<0?0:b>255?255:b;xa[8]=k<0?0:k>255?255:k;xa[9]=i<0?0:i>255?255:i;xa[10]=c<0?0:c>255?255:c;xa[12]=m<0?0:m>255?255:m;xa[13]=j<0?0:j>255?255:j;xa[14]=d<0?0:d>255?255:d;Ka.putImageData(Ra,
|
|
|
|
+0,0);Oa.drawImage(Ja,0,0);return La}function N(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function O(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Pa,Ta,qa,za;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,r);g.info.render.vertices=0;g.info.render.faces=0;f=l.projectScene(a,j,this.sortElements);h=f.elements;i=f.lights;(Qa=i.length>0)&&o(i);Pa=0;for(Ta=h.length;Pa<Ta;Pa++)if(qa=h[Pa],za=
|
|
|
|
+qa.material,za=za instanceof THREE.MeshFaceMaterial?qa.faceMaterial:za,!(za==null||za.opacity==0)){ta.empty();if(qa instanceof THREE.RenderableParticle)B=qa,B.x*=m,B.y*=r,q(B,qa,za,a);else if(qa instanceof THREE.RenderableLine)B=qa.v1,J=qa.v2,B.positionScreen.x*=m,B.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,ta.addPoint(B.positionScreen.x,B.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),Y.intersects(ta)&&s(B,J,qa,za,a);else if(qa instanceof THREE.RenderableFace3)B=
|
|
|
|
+qa.v1,J=qa.v2,x=qa.v3,B.positionScreen.x*=m,B.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,x.positionScreen.x*=m,x.positionScreen.y*=r,za.overdraw&&(Ca(B.positionScreen,J.positionScreen),Ca(J.positionScreen,x.positionScreen),Ca(x.positionScreen,B.positionScreen)),ta.add3Points(B.positionScreen.x,B.positionScreen.y,J.positionScreen.x,J.positionScreen.y,x.positionScreen.x,x.positionScreen.y),Y.intersects(ta)&&u(B,J,x,0,1,2,qa,za,a);else if(qa instanceof THREE.RenderableFace4)B=qa.v1,
|
|
|
|
+J=qa.v2,x=qa.v3,z=qa.v4,B.positionScreen.x*=m,B.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,x.positionScreen.x*=m,x.positionScreen.y*=r,z.positionScreen.x*=m,z.positionScreen.y*=r,G.positionScreen.copy(J.positionScreen),W.positionScreen.copy(z.positionScreen),za.overdraw&&(Ca(B.positionScreen,J.positionScreen),Ca(J.positionScreen,z.positionScreen),Ca(z.positionScreen,B.positionScreen),Ca(x.positionScreen,G.positionScreen),Ca(x.positionScreen,W.positionScreen)),ta.addPoint(B.positionScreen.x,
|
|
|
|
+B.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),ta.addPoint(x.positionScreen.x,x.positionScreen.y),ta.addPoint(z.positionScreen.x,z.positionScreen.y),Y.intersects(ta)&&t(B,J,x,z,G,W,qa,za,a);da.addRectangle(ta)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,m;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),m=c.dot(i),m<=0||(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(B.sub(i,b).normalize()),m<=0||(m*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),m!=0&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){J[a]==null&&(J[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"path"),S==0&&J[a].setAttribute("shape-rendering","crispEdges"));return J[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,j,o,p,m,r,n,q,s=new THREE.Rectangle,u=new THREE.Rectangle,t=!1,y=new THREE.Color,A=new THREE.Color,D=new THREE.Color,F=new THREE.Color,H,B=new THREE.Vector3,J=[],x=[],z,G,W,S=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":S=1;break;case "low":S=0}};this.setSize=function(a,b){l=a;j=b;o=l/2;p=j/2;i.setAttribute("viewBox",-o+" "+-p+" "+l+" "+j);i.setAttribute("width",l);i.setAttribute("height",j);s.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,l){var k,J,K,v;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);g=e.elements;
|
|
|
|
+f=e.lights;W=G=0;if(t=f.length>0){A.setRGB(0,0,0);D.setRGB(0,0,0);F.setRGB(0,0,0);k=0;for(J=f.length;k<J;k++)v=f[k],K=v.color,v instanceof THREE.AmbientLight?(A.r+=K.r,A.g+=K.g,A.b+=K.b):v instanceof THREE.DirectionalLight?(D.r+=K.r,D.g+=K.g,D.b+=K.b):v instanceof THREE.PointLight&&(F.r+=K.r,F.g+=K.g,F.b+=K.b)}k=0;for(J=g.length;k<J;k++)if(K=g[k],v=K.material,v=v instanceof THREE.MeshFaceMaterial?K.faceMaterial:v,!(v==null||v.opacity==0))if(u.empty(),K instanceof THREE.RenderableParticle)m=K,m.x*=
|
|
|
|
+o,m.y*=-p;else if(K instanceof THREE.RenderableLine){if(m=K.v1,r=K.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(u)){K=m;var M=r,B=W++;x[B]==null&&(x[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),S==0&&x[B].setAttribute("shape-rendering","crispEdges"));z=x[B];z.setAttribute("x1",K.positionScreen.x);z.setAttribute("y1",K.positionScreen.y);
|
|
|
|
+z.setAttribute("x2",M.positionScreen.x);z.setAttribute("y2",M.positionScreen.y);v instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+v.color.getContextStyle()+"; stroke-width: "+v.linewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.linecap+"; stroke-linejoin: "+v.linejoin),i.appendChild(z))}}else if(K instanceof THREE.RenderableFace3){if(m=K.v1,r=K.v2,n=K.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,n.positionScreen.x*=
|
|
|
|
+o,n.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,B=r,ca=n;d.info.render.vertices+=3;d.info.render.faces++;z=b(G++);z.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?y.copy(v.color):v instanceof THREE.MeshLambertMaterial?
|
|
|
|
+t?(y.r=A.r,y.g=A.g,y.b=A.b,a(f,K.centroidWorld,K.normalWorld,y),y.r=Math.max(0,Math.min(v.color.r*y.r,1)),y.g=Math.max(0,Math.min(v.color.g*y.g,1)),y.b=Math.max(0,Math.min(v.color.b*y.b,1))):y.copy(v.color):v instanceof THREE.MeshDepthMaterial?(H=1-v.__2near/(v.__farPlusNear-K.z*v.__farMinusNear),y.setRGB(H,H,H)):v instanceof THREE.MeshNormalMaterial&&y.setRGB(c(K.normalWorld.x),c(K.normalWorld.y),c(K.normalWorld.z));v.wireframe?z.setAttribute("style","fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+
|
|
|
|
+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):z.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+v.opacity);i.appendChild(z)}}else if(K instanceof THREE.RenderableFace4&&(m=K.v1,r=K.v2,n=K.v3,q=K.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,
|
|
|
|
+m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(u))){var M=m,B=r,ca=n,ea=q;d.info.render.vertices+=4;d.info.render.faces++;z=b(G++);z.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?
|
|
|
|
+y.copy(v.color):v instanceof THREE.MeshLambertMaterial?t?(y.r=A.r,y.g=A.g,y.b=A.b,a(f,K.centroidWorld,K.normalWorld,y),y.r=Math.max(0,Math.min(v.color.r*y.r,1)),y.g=Math.max(0,Math.min(v.color.g*y.g,1)),y.b=Math.max(0,Math.min(v.color.b*y.b,1))):y.copy(v.color):v instanceof THREE.MeshDepthMaterial?(H=1-v.__2near/(v.__farPlusNear-K.z*v.__farMinusNear),y.setRGB(H,H,H)):v instanceof THREE.MeshNormalMaterial&&y.setRGB(c(K.normalWorld.x),c(K.normalWorld.y),c(K.normalWorld.z));v.wireframe?z.setAttribute("style",
|
|
|
|
+"fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):z.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+v.opacity);i.appendChild(z)}}};
|
|
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",
|
|
@@ -223,113 +223,113 @@ THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"v
|
|
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.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(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.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(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.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;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
|
|
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
|
|
-return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,j=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,r=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){xa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,ua.copy(e),xa.multiplyVector3(ua),l[d]=[ua.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=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[l[d][1]],n[f]=e.r,n[f+
|
|
|
|
-1]=e.g,n[f+2]=e.b;if(p){i=0;for(m=p.length;i<m;i++)if(h=p[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=l[d][1],h.array[d]=h.value[g];else if(h.size===2)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(h.size===3)if(h.type==="c")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(h.size===4)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=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(r)for(d=0;d<m;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(p){i=0;for(m=p.length;i<m;i++)if(h=p[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)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(h.size===3)if(h.type==="c")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(h.size===4)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)k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,j,b);if(r||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
|
-a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,b);if(p){i=0;for(m=p.length;i<m;i++)if(h=p[i],h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)L=null,w=W=O=$=S=-1,a[d].render(b,c,ka,la),L=null,w=W=O=$=S=-1}function l(a,b,c,d,e,f,g,h){var k,i,m,j;b?(i=a.length-1,j=b=-1):(i=0,b=a.length,j=1);for(var n=i;n!==b;n+=j)if(k=a[n],k.render){i=k.object;
|
|
|
|
-m=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&T.setBlending(k.blending);T.setDepthTest(k.depthTest);t(k.depthWrite);u(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}T.setObjectFaces(i);T.renderBuffer(d,e,f,k,m,i)}}function j(a,b,c,d,e,f,g){for(var h,k,i=0,m=a.length;i<m;i++)if(h=a[i],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&T.setBlending(h.blending);T.setDepthTest(h.depthTest);t(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}T.renderImmediateObject(c,
|
|
|
|
-d,e,h,k)}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function r(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 p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){d.program||T.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
|
|
|
|
-new Float32Array(T.maxMorphTargets);for(var f=0,g=T.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==L&&(k.useProgram(f),L=f,h=!0);if(d.id!==w)w=d.id,h=!0;if(h){k.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);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){for(var m,j,n=0,l=0,o=0,r,p,q,H=za,s=H.directional.colors,t=H.directional.positions,z=H.point.colors,u=H.point.positions,J=H.point.distances,v=0,R=0,c=m=q=0,h=b.length;c<h;c++)if(m=b[c],j=m.color,r=m.position,p=m.intensity,q=m.distance,m instanceof THREE.AmbientLight)T.gammaInput?(n+=j.r*j.r,l+=j.g*j.g,o+=j.b*j.b):(n+=j.r,l+=j.g,o+=j.b);else if(m instanceof THREE.DirectionalLight)q=v*3,T.gammaInput?(s[q]=j.r*j.r*p*p,s[q+1]=j.g*j.g*p*p,s[q+2]=j.b*j.b*
|
|
|
|
-p*p):(s[q]=j.r*p,s[q+1]=j.g*p,s[q+2]=j.b*p),t[q]=r.x,t[q+1]=r.y,t[q+2]=r.z,v+=1;else if(m instanceof THREE.SpotLight)q=v*3,T.gammaInput?(s[q]=j.r*j.r*p*p,s[q+1]=j.g*j.g*p*p,s[q+2]=j.b*j.b*p*p):(s[q]=j.r*p,s[q+1]=j.g*p,s[q+2]=j.b*p),j=1/r.length(),t[q]=r.x*j,t[q+1]=r.y*j,t[q+2]=r.z*j,v+=1;else if(m instanceof THREE.PointLight)m=R*3,T.gammaInput?(z[m]=j.r*j.r*p*p,z[m+1]=j.g*j.g*p*p,z[m+2]=j.b*j.b*p*p):(z[m]=j.r*p,z[m+1]=j.g*p,z[m+2]=j.b*p),u[m]=r.x,u[m+1]=r.y,u[m+2]=r.z,J[R]=q,R+=1;c=v*3;for(h=s.length;c<
|
|
|
|
-h;c++)s[c]=0;c=R*3;for(h=z.length;c<h;c++)z[c]=0;H.point.length=R;H.directional.length=v;H.ambient[0]=n;H.ambient[1]=l;H.ambient[2]=o;b=za;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof
|
|
|
|
-THREE.MeshPhongMaterial)i.opacity.value=d.opacity,T.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=G.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,T.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=
|
|
|
|
-d.specular);else if(d instanceof THREE.MeshLambertMaterial)T.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;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){for(b=0;b<T.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=T.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=
|
|
|
|
-T.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=T.shadowMapDarkness;i.shadowBias.value=T.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=f.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")k.uniform1i(l,h);else if(o==="f")k.uniform1f(l,h);else if(o==="v2")k.uniform2f(l,h.x,h.y);else if(o==="v3")k.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")k.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")k.uniform3f(l,h.r,h.g,h.b);else if(o==="fv1")k.uniform1fv(l,h);else if(o==="fv")k.uniform3fv(l,
|
|
|
|
-h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(r=h.length;o<r;o++)H=o*3,n._array[H]=h[o].x,n._array[H+1]=h[o].y,n._array[H+2]=h[o].z;k.uniform3fv(l,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(r=h.length;o<r;o++)h[o].flattenToArrayOffset(n._array,o*16);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="t"){if(k.uniform1i(l,
|
|
|
|
-h),l=n.texture)if(l.image instanceof Array&&l.image.length===6){if(n=l,n.image.length===6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+h);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);h=B(k.TEXTURE_CUBE_MAP,n,n.image[0]);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[l]);h&&k.generateMipmap(k.TEXTURE_CUBE_MAP);n.needsUpdate=!1}else k.activeTexture(k.TEXTURE0+
|
|
|
|
-h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(n=l,k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.__webglTexture)):T.setTexture(l,h)}else if(o==="tv"){if(!n._array){n._array=[];o=0;for(r=n.texture.length;o<r;o++)n._array[o]=h+o}k.uniform1iv(l,n._array);o=0;for(r=n.texture.length;o<r;o++)(l=n.texture[o])&&T.setTexture(l,n._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
|
|
|
|
-g.cameraPosition!==null&&k.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&k.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(k.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),k.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}k.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&
|
|
|
|
-k.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&k.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function s(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function t(a){O!==a&&(k.depthMask(a),O=a)}function u(a,b,c){ba!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):
|
|
|
|
-k.disable(k.POLYGON_OFFSET_FILL),ba=a);if(a&&(aa!==b||pa!==c))k.polygonOffset(b,c),aa=b,pa=c}function v(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(b),null;return c}function B(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(k.texParameteri(a,k.TEXTURE_WRAP_S,E(b.wrapS)),k.texParameteri(a,
|
|
|
|
-k.TEXTURE_WRAP_T,E(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,E(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,E(b.minFilter)),!0):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,C(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter)),!1)}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
|
|
|
|
-b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function C(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}
|
|
|
|
-function E(a){switch(a){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
|
|
|
|
+return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,j=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){wa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,R.copy(e),wa.multiplyVector3(R),l[d]=[R.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=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[l[d][1]],n[f]=e.r,n[f+
|
|
|
|
+1]=e.g,n[f+2]=e.b;if(r){i=0;for(m=r.length;i<m;i++)if(h=r[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=l[d][1],h.array[d]=h.value[g];else if(h.size===2)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(h.size===3)if(h.type==="c")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(h.size===4)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=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(p)for(d=0;d<m;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(r){i=0;for(m=r.length;i<m;i++)if(h=r[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)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(h.size===3)if(h.type==="c")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(h.size===4)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)k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,j,b);if(p||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
|
+a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,b);if(r){i=0;for(m=r.length;i<m;i++)if(h=r[i],h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)K=null,M=X=P=I=U=-1,a[d].render(b,c,ya,ua),K=null,M=X=P=I=U=-1}function l(a,b,c,d,e,f,g,h){var i,k,m,j;b?(k=a.length-1,j=b=-1):(k=0,b=a.length,j=1);for(var n=k;n!==b;n+=j)if(i=a[n],i.render){k=i.object;
|
|
|
|
+m=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&V.setBlending(i.blending);V.setDepthTest(i.depthTest);u(i.depthWrite);t(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}V.setObjectFaces(k);V.renderBuffer(d,e,f,i,m,k)}}function j(a,b,c,d,e,f,g){for(var h,i,k=0,m=a.length;k<m;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&V.setBlending(h.blending);V.setDepthTest(h.depthTest);u(h.depthWrite);t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}V.renderImmediateObject(c,
|
|
|
|
+d,e,h,i)}}function o(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 r(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){d.program||V.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
|
|
|
|
+new Float32Array(V.maxMorphTargets);for(var f=0,g=V.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==K&&(k.useProgram(f),K=f,h=!0);if(d.id!==M)M=d.id,h=!0;if(h){k.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);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){for(var m,j,n=0,l=0,o=0,p,r,R=ga,q=R.directional.colors,s=R.directional.positions,Y=R.point.colors,u=R.point.positions,x=R.point.distances,t=0,z=0,y=r=0,c=0,h=b.length;c<h;c++)if(m=b[c],j=m.color,p=m.intensity,r=m.distance,m instanceof THREE.AmbientLight)V.gammaInput?(n+=j.r*j.r,l+=j.g*j.g,o+=j.b*j.b):(n+=j.r,l+=j.g,o+=j.b);else if(m instanceof THREE.DirectionalLight)r=t*3,V.gammaInput?(q[r]=j.r*j.r*p*p,q[r+1]=j.g*j.g*p*p,q[r+2]=j.b*j.b*p*p):(q[r]=
|
|
|
|
+j.r*p,q[r+1]=j.g*p,q[r+2]=j.b*p),m=m.matrixWorld.getPosition(),j=1/m.length(),s[r]=m.x*j,s[r+1]=m.y*j,s[r+2]=m.z*j,t+=1;else if(m instanceof THREE.SpotLight)r=t*3,V.gammaInput?(q[r]=j.r*j.r*p*p,q[r+1]=j.g*j.g*p*p,q[r+2]=j.b*j.b*p*p):(q[r]=j.r*p,q[r+1]=j.g*p,q[r+2]=j.b*p),m=m.matrixWorld.getPosition(),j=1/m.length(),s[r]=m.x*j,s[r+1]=m.y*j,s[r+2]=m.z*j,t+=1;else if(m instanceof THREE.PointLight)y=z*3,V.gammaInput?(Y[y]=j.r*j.r*p*p,Y[y+1]=j.g*j.g*p*p,Y[y+2]=j.b*j.b*p*p):(Y[y]=j.r*p,Y[y+1]=j.g*p,Y[y+
|
|
|
|
+2]=j.b*p),m=m.matrixWorld.getPosition(),u[y]=m.x,u[y+1]=m.y,u[y+2]=m.z,x[z]=r,z+=1;c=t*3;for(h=q.length;c<h;c++)q[c]=0;c=z*3;for(h=Y.length;c<h;c++)Y[c]=0;R.point.length=z;R.directional.length=t;R.ambient[0]=n;R.ambient[1]=l;R.ambient[2]=o;b=ga;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=
|
|
|
|
+b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,V.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,V.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
|
|
|
|
+i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)V.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;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){for(b=0;b<V.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=
|
|
|
|
+V.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=V.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=V.shadowMapDarkness;i.shadowBias.value=V.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=f.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")k.uniform1i(l,h);else if(o==="f")k.uniform1f(l,h);else if(o==="v2")k.uniform2f(l,h.x,h.y);else if(o==="v3")k.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")k.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")k.uniform3f(l,h.r,h.g,h.b);else if(o===
|
|
|
|
+"fv1")k.uniform1fv(l,h);else if(o==="fv")k.uniform3fv(l,h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(R=h.length;o<R;o++)q=o*3,n._array[q]=h[o].x,n._array[q+1]=h[o].y,n._array[q+2]=h[o].z;k.uniform3fv(l,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(R=h.length;o<R;o++)h[o].flattenToArrayOffset(n._array,
|
|
|
|
+o*16);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="t"){if(k.uniform1i(l,h),l=n.texture)if(l.image instanceof Array&&l.image.length===6){if(n=l,n.image.length===6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+h);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);h=A(k.TEXTURE_CUBE_MAP,n,n.image[0]);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[l]);h&&k.generateMipmap(k.TEXTURE_CUBE_MAP);
|
|
|
|
+n.needsUpdate=!1}else k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(n=l,k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.__webglTexture)):V.setTexture(l,h)}else if(o==="tv"){if(!n._array){n._array=[];o=0;for(R=n.texture.length;o<R;o++)n._array[o]=h+o}k.uniform1iv(l,n._array);o=0;for(R=n.texture.length;o<R;o++)(l=n.texture[o])&&V.setTexture(l,n._array[o])}(d instanceof THREE.ShaderMaterial||
|
|
|
|
+d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&k.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&k.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(k.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),k.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}k.uniformMatrix4fv(g.modelViewMatrix,
|
|
|
|
+!1,e._modelViewMatrixArray);g.normalMatrix&&k.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&k.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function s(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){P!==a&&(k.depthMask(a),
|
|
|
|
+P=a)}function t(a,b,c){$!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),$=a);if(a&&(Z!==b||oa!==c))k.polygonOffset(b,c),Z=b,oa=c}function y(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(b),null;return c}function A(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-
|
|
|
|
+1)===0?(k.texParameteri(a,k.TEXTURE_WRAP_S,H(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,H(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,H(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,H(b.minFilter)),!0):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,F(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,F(b.minFilter)),!1)}function D(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&
|
|
|
|
+!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function F(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;
|
|
|
|
+default:return k.LINEAR}}function H(a){switch(a){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
|
|
case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
|
|
case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
|
|
-var a=a||{},G=a.canvas!==void 0?a.canvas:document.createElement("canvas"),R=a.precision!==void 0?a.precision:"highp",z=a.antialias!==void 0?a.antialias:!1,J=a.stencil!==void 0?a.stencil:!0,K=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,U=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),V=a.clearAlpha!==void 0?a.clearAlpha:0,Y=a.maxLights!==void 0?a.maxLights:4;this.domElement=G;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
|
|
|
+var a=a||{},B=a.canvas!==void 0?a.canvas:document.createElement("canvas"),J=a.precision!==void 0?a.precision:"highp",x=a.antialias!==void 0?a.antialias:!1,z=a.stencil!==void 0?a.stencil:!0,G=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,W=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),S=a.clearAlpha!==void 0?a.clearAlpha:0,T=a.maxLights!==void 0?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.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,
|
|
this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,
|
|
-vertices:0,faces:0}};var T=this,k,M=[],L=null,I=null,w=-1,W=null,da=0,fa=null,X=null,S=null,$=null,O=null,ba=null,aa=null,pa=null,ca=null,na=0,sa=0,ka=0,la=0,ya=new THREE.Frustum,xa=new THREE.Matrix4,ua=new THREE.Vector4,za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};k=function(){var a;try{if(!(a=G.getContext("experimental-webgl",{antialias:z,stencil:J,preserveDrawingBuffer:K})))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}();k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(U.r,U.g,U.b,V);this.context=k;var H=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
-0;this.getContext=function(){return k};this.supportsVertexTextures=function(){return H};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){na=a;sa=b;ka=c;la=d;k.viewport(na,sa,ka,la)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){U.setHex(a);V=b;k.clearColor(U.r,U.g,U.b,V)};this.setClearColor=function(a,
|
|
|
|
-b){U.copy(a);V=b;k.clearColor(U.r,U.g,U.b,V)};this.getClearColor=function(){return U};this.getClearAlpha=function(){return V};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=k.COLOR_BUFFER_BIT;if(b===void 0||b)d|=k.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=k.STENCIL_BUFFER_BIT;k.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)};
|
|
|
|
|
|
+vertices:0,faces:0}};var V=this,k,L=[],K=null,v=null,M=-1,X=null,ca=0,ea=null,aa=null,U=null,I=null,P=null,$=null,Z=null,oa=null,ba=null,ma=0,sa=0,ja=0,ka=0,ya=0,ua=0,va=new THREE.Frustum,wa=new THREE.Matrix4,R=new THREE.Vector4,ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};k=function(){var a;try{if(!(a=B.getContext("experimental-webgl",{antialias:x,stencil:z,preserveDrawingBuffer:G})))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}();k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(W.r,W.g,W.b,S);this.context=k;var Y=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
+0;this.getContext=function(){return k};this.supportsVertexTextures=function(){return Y};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){ma=a;sa=b;ja=c;ka=d;k.viewport(ma,sa,ja,ka)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){W.setHex(a);S=b;k.clearColor(W.r,W.g,W.b,S)};this.setClearColor=function(a,
|
|
|
|
+b){W.copy(a);S=b;k.clearColor(W.r,W.g,W.b,S)};this.getClearColor=function(){return W};this.getClearAlpha=function(){return S};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=k.COLOR_BUFFER_BIT;if(b===void 0||b)d|=k.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=k.STENCIL_BUFFER_BIT;k.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];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);
|
|
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];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);
|
|
-k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer);T.info.memory.geometries--}else if(a instanceof
|
|
|
|
-THREE.Ribbon)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
|
|
|
|
-k.deleteTexture(a.__webglTexture),T.info.memory.textures--};this.updateShadowMap=function(a,b){L=null;w=W=O=$=S=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();a.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,
|
|
|
|
|
|
+k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer);V.info.memory.geometries--}else if(a instanceof
|
|
|
|
+THREE.Ribbon)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
|
|
|
|
+k.deleteTexture(a.__webglTexture),V.info.memory.textures--};this.updateShadowMap=function(a,b){K=null;M=X=P=I=U=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();a.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,
|
|
3,k.FLOAT,!1,0,0));if(a.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,j,n,l,o=a.count*3;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],j=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+j+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}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,
|
|
3,k.FLOAT,!1,0,0));if(a.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,j,n,l,o=a.count*3;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],j=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+j+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}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,
|
|
-3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=q(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==W&&(W=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
|
|
|
|
+3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=q(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==X&&(X=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,
|
|
k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,
|
|
j=0;h=f.morphTargetInfluences;var n,l=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<l;n++)!i[n]&&h[n]>m&&(j=n,m=h[j]);k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=m;i[j]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
|
|
j=0;h=f.morphTargetInfluences;var n,l=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<l;n++)!i[n]&&h[n]>m&&(j=n,m=h[j]);k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=m;i[j]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
|
|
0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
e.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
|
|
e.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
|
|
0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
|
|
0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
|
|
-(d=d.wireframeLinewidth,d!==ca&&(k.lineWidth(d),ca=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),T.info.render.calls++,T.info.render.vertices+=e.__webglFaceCount,T.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==
|
|
|
|
-ca&&(k.lineWidth(d),ca=d),k.drawArrays(f,0,e.__webglLineCount),T.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),T.info.render.calls++):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),T.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,m,n=a.lights,o=a.fog;w=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);T.info.render.calls=0;T.info.render.vertices=0;T.info.render.faces=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);xa.multiply(b.projectionMatrix,b.matrixWorldInverse);
|
|
|
|
-ya.setFromMatrix(xa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||ya.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);s(g,b);var p=f,r=p.object,q=p.buffer,H=void 0,H=H=void 0,H=r.material;if(H instanceof THREE.MeshFaceMaterial){if(H=q.materialIndex,H>=0)H=r.geometry.materials[H],
|
|
|
|
-H.transparent?(p.transparent=H,p.opaque=null):(p.opaque=H,p.transparent=null)}else if(H)H.transparent?(p.transparent=H,p.opaque=null):(p.opaque=H,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(ua.copy(g.position),xa.multiplyVector3(ua),f.z=ua.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),s(g,b),g=f.object.material,g.transparent?
|
|
|
|
-(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),t(a.overrideMaterial.depthWrite),u(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,
|
|
|
|
|
|
+(d=d.wireframeLinewidth,d!==ba&&(k.lineWidth(d),ba=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=e.__webglFaceCount,V.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==
|
|
|
|
+ba&&(k.lineWidth(d),ba=d),k.drawArrays(f,0,e.__webglLineCount),V.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),V.info.render.calls++):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),V.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,m,n=a.lights,o=a.fog;M=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=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);
|
|
|
|
+va.setFromMatrix(wa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||va.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);s(g,b);var p=f,r=p.object,q=p.buffer,Y=void 0,Y=Y=void 0,Y=r.material;if(Y instanceof THREE.MeshFaceMaterial){if(Y=q.materialIndex,Y>=0)Y=r.geometry.materials[Y],
|
|
|
|
+Y.transparent?(p.transparent=Y,p.opaque=null):(p.opaque=Y,p.transparent=null)}else if(Y)Y.transparent?(p.transparent=Y,p.opaque=null):(p.opaque=Y,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(R.copy(g.position),wa.multiplyVector3(R),f.z=R.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),s(g,b),g=f.object.material,g.transparent?
|
|
|
|
+(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),u(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,
|
|
"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),l(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),
|
|
"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),l(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),
|
|
-k.bindTexture(k.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);W=-1;T.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ya):e.render(function(a){T.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 h=a.__objectsAdded[0],i=a,j=void 0,l=void 0,H=void 0;if(!h.__webglInit)if(h.__webglInit=
|
|
|
|
-!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){l=h.geometry;if(l.geometryGroups===void 0){var H=l,q=void 0,s=void 0,t=void 0,z=void 0,u=void 0,J=void 0,A=void 0,v={},R=H.morphTargets.length;H.geometryGroups={};q=0;for(s=H.faces.length;q<s;q++)t=H.faces[q],z=t.materialIndex,J=z!==void 0?z:-1,v[J]===void 0&&
|
|
|
|
-(v[J]={hash:J,counter:0}),A=v[J].hash+"_"+v[J].counter,H.geometryGroups[A]===void 0&&(H.geometryGroups[A]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:R}),u=t instanceof THREE.Face3?3:4,H.geometryGroups[A].vertices+u>65535&&(v[J].counter+=1,A=v[J].hash+"_"+v[J].counter,H.geometryGroups[A]===void 0&&(H.geometryGroups[A]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:R})),t instanceof THREE.Face3?H.geometryGroups[A].faces3.push(q):H.geometryGroups[A].faces4.push(q),
|
|
|
|
-H.geometryGroups[A].vertices+=u;H.geometryGroupsList=[];q=void 0;for(q in H.geometryGroups)H.geometryGroups[q].id=da++,H.geometryGroupsList.push(H.geometryGroups[q])}for(j in l.geometryGroups)if(H=l.geometryGroups[j],!H.__webglVertexBuffer){q=H;q.__webglVertexBuffer=k.createBuffer();q.__webglNormalBuffer=k.createBuffer();q.__webglTangentBuffer=k.createBuffer();q.__webglColorBuffer=k.createBuffer();q.__webglUVBuffer=k.createBuffer();q.__webglUV2Buffer=k.createBuffer();q.__webglSkinVertexABuffer=k.createBuffer();
|
|
|
|
-q.__webglSkinVertexBBuffer=k.createBuffer();q.__webglSkinIndicesBuffer=k.createBuffer();q.__webglSkinWeightsBuffer=k.createBuffer();q.__webglFaceBuffer=k.createBuffer();q.__webglLineBuffer=k.createBuffer();if(q.numMorphTargets){t=s=void 0;q.__webglMorphTargetsBuffers=[];s=0;for(t=q.numMorphTargets;s<t;s++)q.__webglMorphTargetsBuffers.push(k.createBuffer())}T.info.memory.geometries++;z=h;u=z.geometry;s=H.faces3;J=H.faces4;q=s.length*3+J.length*4;t=s.length*1+J.length*2;J=s.length*3+J.length*4;s=c(z,
|
|
|
|
-H);A=g(s);v=d(s);R=e(s);H.__vertexArray=new Float32Array(q*3);if(v)H.__normalArray=new Float32Array(q*3);if(u.hasTangents)H.__tangentArray=new Float32Array(q*4);if(R)H.__colorArray=new Float32Array(q*3);if(A){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)H.__uvArray=new Float32Array(q*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(q*2)}if(z.geometry.skinWeights.length&&z.geometry.skinIndices.length)H.__skinVertexAArray=new Float32Array(q*4),H.__skinVertexBArray=
|
|
|
|
-new Float32Array(q*4),H.__skinIndexArray=new Float32Array(q*4),H.__skinWeightArray=new Float32Array(q*4);H.__faceArray=new Uint16Array(t*3);H.__lineArray=new Uint16Array(J*2);if(H.numMorphTargets){H.__morphTargetsArrays=[];z=0;for(u=H.numMorphTargets;z<u;z++)H.__morphTargetsArrays.push(new Float32Array(q*3))}H.__webglFaceCount=t*3;H.__webglLineCount=J*2;if(s.attributes){if(H.__webglCustomAttributesList===void 0)H.__webglCustomAttributesList=[];t=void 0;for(t in s.attributes){var z=s.attributes[t],
|
|
|
|
-u={},K;for(K in z)u[K]=z[K];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,J=1,u.type==="v2"?J=2:u.type==="v3"?J=3:u.type==="v4"?J=4:u.type==="c"&&(J=3),u.size=J,u.array=new Float32Array(q*J),u.buffer=k.createBuffer(),u.buffer.belongsToAttribute=t,z.needsUpdate=!0,u.__original=z;H.__webglCustomAttributesList.push(u)}}H.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=
|
|
|
|
-!0}}else if(h instanceof THREE.Ribbon){if(l=h.geometry,!l.__webglVertexBuffer)H=l,H.__webglVertexBuffer=k.createBuffer(),H.__webglColorBuffer=k.createBuffer(),T.info.memory.geometries++,H=l,q=H.vertices.length,H.__vertexArray=new Float32Array(q*3),H.__colorArray=new Float32Array(q*3),H.__webglVertexCount=q,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.Line){if(l=h.geometry,!l.__webglVertexBuffer)H=l,H.__webglVertexBuffer=k.createBuffer(),H.__webglColorBuffer=k.createBuffer(),
|
|
|
|
-T.info.memory.geometries++,H=l,q=h,s=H.vertices.length,H.__vertexArray=new Float32Array(s*3),H.__colorArray=new Float32Array(s*3),H.__webglLineCount=s,b(H,q),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(l=h.geometry,!l.__webglVertexBuffer))H=l,H.__webglVertexBuffer=k.createBuffer(),H.__webglColorBuffer=k.createBuffer(),T.info.geometries++,H=l,q=h,s=H.vertices.length,H.__vertexArray=new Float32Array(s*3),H.__colorArray=new Float32Array(s*3),H.__sortArray=[],H.__webglParticleCount=
|
|
|
|
-s,b(H,q),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(j in l=h.geometry,l.geometryGroups)H=l.geometryGroups[j],o(i.__webglObjects,H,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(l=h.geometry,o(i.__webglObjects,l,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
|
|
|
|
-h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?p(i.__webglObjects,h):h instanceof THREE.Sprite?n(i.__webglSprites,h):h instanceof THREE.LensFlare?n(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&p(i.__webglObjectsImmediate,h),h.__webglActive=
|
|
|
|
-!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(K=a.__webglObjects[h].object,j=K.geometry,l=t=s=void 0,K instanceof THREE.Mesh){H=0;for(q=j.geometryGroupsList.length;H<q;H++)if(s=j.geometryGroupsList[H],l=c(K,s),t=l.attributes&&r(l),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||t){var x=K,t=k.DYNAMIC_DRAW,z=!j.dynamic,A=l;if(s.__inittedArrays){var u=d(A),J=e(A),L=g(A),G=u===THREE.SmoothShading,
|
|
|
|
-B=v=A=void 0,F=void 0,E=void 0,I=void 0,w=void 0,C=void 0,M=void 0,Y=B=void 0,Q=void 0,N=void 0,P=void 0,U=F=void 0,W=void 0,V=void 0,S=F=M=void 0,X=void 0,$=P=N=Q=w=void 0,Z=F=P=N=Q=$=P=N=Q=$=P=N=Q=void 0,O=void 0,ba=I=void 0,fa=void 0,aa=void 0,pa=void 0,ca=void 0,na=Y=aa=O=0,la=0,ka=Z=B=0,ha=w=U=0,D=0,ma=void 0,ha=s.__vertexArray,fa=s.__uvArray,D=s.__uv2Array,ba=s.__normalArray,E=s.__tangentArray,W=s.__colorArray,S=s.__skinVertexAArray,X=s.__skinVertexBArray,C=s.__skinIndexArray,oa=s.__skinWeightArray,
|
|
|
|
-$=s.__morphTargetsArrays,R=s.__webglCustomAttributesList,y=void 0,y=s.__faceArray,ma=s.__lineArray,V=x.geometry,sa=V.__dirtyElements,ua=V.__dirtyUvs,I=V.__dirtyNormals,M=V.__dirtyTangents,xa=V.__dirtyColors,pa=V.__dirtyMorphTargets,ca=V.vertices,x=s.faces3,ia=s.faces4,ja=V.faces,ya=V.faceVertexUvs[0],za=V.faceVertexUvs[1],Ga=V.skinVerticesA,Ha=V.skinVerticesB,Ia=V.skinIndices,Da=V.skinWeights,Ea=V.morphTargets;if(V.__dirtyVertices){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=ca[F.a].position,N=ca[F.b].position,
|
|
|
|
-P=ca[F.c].position,ha[aa]=Q.x,ha[aa+1]=Q.y,ha[aa+2]=Q.z,ha[aa+3]=N.x,ha[aa+4]=N.y,ha[aa+5]=N.z,ha[aa+6]=P.x,ha[aa+7]=P.y,ha[aa+8]=P.z,aa+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=ca[F.a].position,N=ca[F.b].position,P=ca[F.c].position,F=ca[F.d].position,ha[aa]=Q.x,ha[aa+1]=Q.y,ha[aa+2]=Q.z,ha[aa+3]=N.x,ha[aa+4]=N.y,ha[aa+5]=N.z,ha[aa+6]=P.x,ha[aa+7]=P.y,ha[aa+8]=P.z,ha[aa+9]=F.x,ha[aa+10]=F.y,ha[aa+11]=F.z,aa+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,ha,
|
|
|
|
-t)}if(pa){aa=0;for(pa=Ea.length;aa<pa;aa++){A=ha=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=Ea[aa].vertices[F.a].position,N=Ea[aa].vertices[F.b].position,P=Ea[aa].vertices[F.c].position,ca=$[aa],ca[ha]=Q.x,ca[ha+1]=Q.y,ca[ha+2]=Q.z,ca[ha+3]=N.x,ca[ha+4]=N.y,ca[ha+5]=N.z,ca[ha+6]=P.x,ca[ha+7]=P.y,ca[ha+8]=P.z,ha+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=Ea[aa].vertices[F.a].position,N=Ea[aa].vertices[F.b].position,P=Ea[aa].vertices[F.c].position,F=Ea[aa].vertices[F.d].position,ca=$[aa],ca[ha]=Q.x,ca[ha+
|
|
|
|
-1]=Q.y,ca[ha+2]=Q.z,ca[ha+3]=N.x,ca[ha+4]=N.y,ca[ha+5]=N.z,ca[ha+6]=P.x,ca[ha+7]=P.y,ca[ha+8]=P.z,ca[ha+9]=F.x,ca[ha+10]=F.y,ca[ha+11]=F.z,ha+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglMorphTargetsBuffers[aa]);k.bufferData(k.ARRAY_BUFFER,$[aa],t)}}if(Da.length){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=Da[F.a],N=Da[F.b],P=Da[F.c],oa[w]=Q.x,oa[w+1]=Q.y,oa[w+2]=Q.z,oa[w+3]=Q.w,oa[w+4]=N.x,oa[w+5]=N.y,oa[w+6]=N.z,oa[w+7]=N.w,oa[w+8]=P.x,oa[w+9]=P.y,oa[w+10]=P.z,oa[w+11]=P.w,Q=Ia[F.a],N=Ia[F.b],P=Ia[F.c],
|
|
|
|
-C[w]=Q.x,C[w+1]=Q.y,C[w+2]=Q.z,C[w+3]=Q.w,C[w+4]=N.x,C[w+5]=N.y,C[w+6]=N.z,C[w+7]=N.w,C[w+8]=P.x,C[w+9]=P.y,C[w+10]=P.z,C[w+11]=P.w,Q=Ga[F.a],N=Ga[F.b],P=Ga[F.c],S[w]=Q.x,S[w+1]=Q.y,S[w+2]=Q.z,S[w+3]=1,S[w+4]=N.x,S[w+5]=N.y,S[w+6]=N.z,S[w+7]=1,S[w+8]=P.x,S[w+9]=P.y,S[w+10]=P.z,S[w+11]=1,Q=Ha[F.a],N=Ha[F.b],P=Ha[F.c],X[w]=Q.x,X[w+1]=Q.y,X[w+2]=Q.z,X[w+3]=1,X[w+4]=N.x,X[w+5]=N.y,X[w+6]=N.z,X[w+7]=1,X[w+8]=P.x,X[w+9]=P.y,X[w+10]=P.z,X[w+11]=1,w+=12;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=Da[F.a],N=
|
|
|
|
-Da[F.b],P=Da[F.c],$=Da[F.d],oa[w]=Q.x,oa[w+1]=Q.y,oa[w+2]=Q.z,oa[w+3]=Q.w,oa[w+4]=N.x,oa[w+5]=N.y,oa[w+6]=N.z,oa[w+7]=N.w,oa[w+8]=P.x,oa[w+9]=P.y,oa[w+10]=P.z,oa[w+11]=P.w,oa[w+12]=$.x,oa[w+13]=$.y,oa[w+14]=$.z,oa[w+15]=$.w,Q=Ia[F.a],N=Ia[F.b],P=Ia[F.c],$=Ia[F.d],C[w]=Q.x,C[w+1]=Q.y,C[w+2]=Q.z,C[w+3]=Q.w,C[w+4]=N.x,C[w+5]=N.y,C[w+6]=N.z,C[w+7]=N.w,C[w+8]=P.x,C[w+9]=P.y,C[w+10]=P.z,C[w+11]=P.w,C[w+12]=$.x,C[w+13]=$.y,C[w+14]=$.z,C[w+15]=$.w,Q=Ga[F.a],N=Ga[F.b],P=Ga[F.c],$=Ga[F.d],S[w]=Q.x,S[w+1]=Q.y,
|
|
|
|
-S[w+2]=Q.z,S[w+3]=1,S[w+4]=N.x,S[w+5]=N.y,S[w+6]=N.z,S[w+7]=1,S[w+8]=P.x,S[w+9]=P.y,S[w+10]=P.z,S[w+11]=1,S[w+12]=$.x,S[w+13]=$.y,S[w+14]=$.z,S[w+15]=1,Q=Ha[F.a],N=Ha[F.b],P=Ha[F.c],F=Ha[F.d],X[w]=Q.x,X[w+1]=Q.y,X[w+2]=Q.z,X[w+3]=1,X[w+4]=N.x,X[w+5]=N.y,X[w+6]=N.z,X[w+7]=1,X[w+8]=P.x,X[w+9]=P.y,X[w+10]=P.z,X[w+11]=1,X[w+12]=F.x,X[w+13]=F.y,X[w+14]=F.z,X[w+15]=1,w+=16;w>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,S,t),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexBBuffer),
|
|
|
|
-k.bufferData(k.ARRAY_BUFFER,X,t),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,C,t),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,oa,t))}if(xa&&J){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],w=F.vertexColors,C=F.color,w.length===3&&J===THREE.VertexColors?(F=w[0],S=w[1],X=w[2]):X=S=F=C,W[U]=F.r,W[U+1]=F.g,W[U+2]=F.b,W[U+3]=S.r,W[U+4]=S.g,W[U+5]=S.b,W[U+6]=X.r,W[U+7]=X.g,W[U+8]=X.b,U+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],w=F.vertexColors,
|
|
|
|
-C=F.color,w.length===4&&J===THREE.VertexColors?(F=w[0],S=w[1],X=w[2],w=w[3]):w=X=S=F=C,W[U]=F.r,W[U+1]=F.g,W[U+2]=F.b,W[U+3]=S.r,W[U+4]=S.g,W[U+5]=S.b,W[U+6]=X.r,W[U+7]=X.g,W[U+8]=X.b,W[U+9]=w.r,W[U+10]=w.g,W[U+11]=w.b,U+=12;U>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,W,t))}if(M&&V.hasTangents){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],M=F.vertexTangents,U=M[0],W=M[1],V=M[2],E[Z]=U.x,E[Z+1]=U.y,E[Z+2]=U.z,E[Z+3]=U.w,E[Z+4]=W.x,E[Z+5]=W.y,E[Z+6]=W.z,E[Z+7]=W.w,E[Z+
|
|
|
|
-8]=V.x,E[Z+9]=V.y,E[Z+10]=V.z,E[Z+11]=V.w,Z+=12;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],M=F.vertexTangents,U=M[0],W=M[1],V=M[2],M=M[3],E[Z]=U.x,E[Z+1]=U.y,E[Z+2]=U.z,E[Z+3]=U.w,E[Z+4]=W.x,E[Z+5]=W.y,E[Z+6]=W.z,E[Z+7]=W.w,E[Z+8]=V.x,E[Z+9]=V.y,E[Z+10]=V.z,E[Z+11]=V.w,E[Z+12]=M.x,E[Z+13]=M.y,E[Z+14]=M.z,E[Z+15]=M.w,Z+=16;k.bindBuffer(k.ARRAY_BUFFER,s.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,E,t)}if(I&&u){A=0;for(v=x.length;A<v;A++)if(F=ja[x[A]],E=F.vertexNormals,I=F.normal,E.length===3&&G)for(Z=
|
|
|
|
-0;Z<3;Z++)I=E[Z],ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;else for(Z=0;Z<3;Z++)ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;A=0;for(v=ia.length;A<v;A++)if(F=ja[ia[A]],E=F.vertexNormals,I=F.normal,E.length===4&&G)for(Z=0;Z<4;Z++)I=E[Z],ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;else for(Z=0;Z<4;Z++)ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;k.bindBuffer(k.ARRAY_BUFFER,s.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,ba,t)}if(ua&&ya&&L){A=0;for(v=x.length;A<v;A++)if(B=x[A],B=ya[B],B!==void 0)for(Z=0;Z<3;Z++)ba=B[Z],
|
|
|
|
-fa[Y]=ba.u,fa[Y+1]=ba.v,Y+=2;A=0;for(v=ia.length;A<v;A++)if(B=ia[A],B=ya[B],B!==void 0)for(Z=0;Z<4;Z++)ba=B[Z],fa[Y]=ba.u,fa[Y+1]=ba.v,Y+=2;Y>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fa,t))}if(ua&&za&&L){A=0;for(v=x.length;A<v;A++)if(B=x[A],Y=za[B],Y!==void 0)for(Z=0;Z<3;Z++)fa=Y[Z],D[na]=fa.u,D[na+1]=fa.v,na+=2;A=0;for(v=ia.length;A<v;A++)if(B=ia[A],Y=za[B],Y!==void 0)for(Z=0;Z<4;Z++)fa=Y[Z],D[na]=fa.u,D[na+1]=fa.v,na+=2;na>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUV2Buffer),
|
|
|
|
-k.bufferData(k.ARRAY_BUFFER,D,t))}if(sa){A=0;for(v=x.length;A<v;A++)y[la]=O,y[la+1]=O+1,y[la+2]=O+2,la+=3,ma[ka]=O,ma[ka+1]=O+1,ma[ka+2]=O,ma[ka+3]=O+2,ma[ka+4]=O+1,ma[ka+5]=O+2,ka+=6,O+=3;A=0;for(v=ia.length;A<v;A++)y[la]=O,y[la+1]=O+1,y[la+2]=O+3,y[la+3]=O+1,y[la+4]=O+2,y[la+5]=O+3,la+=6,ma[ka]=O,ma[ka+1]=O+1,ma[ka+2]=O,ma[ka+3]=O+3,ma[ka+4]=O+1,ma[ka+5]=O+2,ma[ka+6]=O+2,ma[ka+7]=O+3,ka+=8,O+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,s.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,y,t);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-s.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ma,t)}if(R){Z=0;for(O=R.length;Z<O;Z++)if(y=R[Z],y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],y.array[D]=y.value[F.a],y.array[D+1]=y.value[F.b],y.array[D+2]=y.value[F.c],D+=3;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],y.array[D]=y.value[F.a],y.array[D+1]=y.value[F.b],y.array[D+2]=y.value[F.c],y.array[D+3]=y.value[F.d],D+=4}else{if(y.boundTo==="faces"){A=0;for(v=
|
|
|
|
-x.length;A<v;A++)ma=y.value[x[A]],y.array[D]=ma,y.array[D+1]=ma,y.array[D+2]=ma,D+=3;A=0;for(v=ia.length;A<v;A++)ma=y.value[ia[A]],y.array[D]=ma,y.array[D+1]=ma,y.array[D+2]=ma,y.array[D+3]=ma,D+=4}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=y.value[F.a],N=y.value[F.b],P=y.value[F.c],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=P.x,y.array[D+5]=P.y,D+=6;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=y.value[F.a],
|
|
|
|
-N=y.value[F.b],P=y.value[F.c],F=y.value[F.d],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=P.x,y.array[D+5]=P.y,y.array[D+6]=F.x,y.array[D+7]=F.y,D+=8}else{if(y.boundTo==="faces"){A=0;for(v=x.length;A<v;A++)P=N=Q=ma=y.value[x[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=P.x,y.array[D+5]=P.y,D+=6;A=0;for(v=ia.length;A<v;A++)F=P=N=Q=ma=y.value[ia[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=
|
|
|
|
-P.x,y.array[D+5]=P.y,y.array[D+6]=F.x,y.array[D+7]=F.y,D+=8}}else if(y.size===3)if(u=y.type==="c"?["r","g","b"]:["x","y","z"],y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=y.value[F.a],N=y.value[F.b],P=y.value[F.c],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],D+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=y.value[F.a],N=
|
|
|
|
-y.value[F.b],P=y.value[F.c],F=y.value[F.d],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],y.array[D+9]=F[u[0]],y.array[D+10]=F[u[1]],y.array[D+11]=F[u[2]],D+=12}else{if(y.boundTo==="faces"){A=0;for(v=x.length;A<v;A++)P=N=Q=ma=y.value[x[A]],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],
|
|
|
|
-y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],D+=9;A=0;for(v=ia.length;A<v;A++)F=P=N=Q=ma=y.value[ia[A]],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],y.array[D+9]=F[u[0]],y.array[D+10]=F[u[1]],y.array[D+11]=F[u[2]],D+=12}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=y.value[F.a],N=
|
|
|
|
-y.value[F.b],P=y.value[F.c],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,D+=12;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=y.value[F.a],N=y.value[F.b],P=y.value[F.c],F=y.value[F.d],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=
|
|
|
|
-P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,y.array[D+12]=F.x,y.array[D+13]=F.y,y.array[D+14]=F.z,y.array[D+15]=F.w,D+=16}else if(y.boundTo==="faces"){A=0;for(v=x.length;A<v;A++)P=N=Q=ma=y.value[x[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,D+=12;A=0;for(v=ia.length;A<v;A++)F=P=N=Q=ma=y.value[ia[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+
|
|
|
|
-2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,y.array[D+12]=F.x,y.array[D+13]=F.y,y.array[D+14]=F.z,y.array[D+15]=F.w,D+=16}k.bindBuffer(k.ARRAY_BUFFER,y.buffer);k.bufferData(k.ARRAY_BUFFER,y.array,t)}}z&&(delete s.__inittedArrays,delete s.__colorArray,delete s.__normalArray,delete s.__tangentArray,delete s.__uvArray,delete s.__uv2Array,delete s.__faceArray,delete s.__vertexArray,delete s.__lineArray,
|
|
|
|
-delete s.__skinVertexAArray,delete s.__skinVertexBArray,delete s.__skinIndexArray,delete s.__skinWeightArray)}}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=!1;l.attributes&&m(l)}else if(K instanceof THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){l=j;K=k.DYNAMIC_DRAW;u=H=u=z=z=void 0;J=l.vertices;q=l.colors;A=J.length;s=q.length;v=l.__vertexArray;t=l.__colorArray;R=l.__dirtyColors;if(l.__dirtyVertices){for(z=
|
|
|
|
-0;z<A;z++)u=J[z].position,H=z*3,v[H]=u.x,v[H+1]=u.y,v[H+2]=u.z;k.bindBuffer(k.ARRAY_BUFFER,l.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,v,K)}if(R){for(z=0;z<s;z++)u=q[z],H=z*3,t[H]=u.r,t[H+1]=u.g,t[H+2]=u.b;k.bindBuffer(k.ARRAY_BUFFER,l.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,t,K)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(K instanceof THREE.Line){l=c(K,s);t=l.attributes&&r(l);if(j.__dirtyVertices||j.__dirtyColors||t){K=j;H=k.DYNAMIC_DRAW;A=q=G=J=L=void 0;J=K.vertices;s=K.colors;
|
|
|
|
-A=J.length;t=s.length;v=K.__vertexArray;z=K.__colorArray;R=K.__dirtyColors;u=K.__webglCustomAttributesList;O=ja=ia=x=G=L=void 0;if(K.__dirtyVertices){for(L=0;L<A;L++)G=J[L].position,q=L*3,v[q]=G.x,v[q+1]=G.y,v[q+2]=G.z;k.bindBuffer(k.ARRAY_BUFFER,K.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,v,H)}if(R){for(J=0;J<t;J++)A=s[J],q=J*3,z[q]=A.r,z[q+1]=A.g,z[q+2]=A.b;k.bindBuffer(k.ARRAY_BUFFER,K.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,z,H)}if(u){L=0;for(G=u.length;L<G;L++)if(O=u[L],O.needsUpdate&&
|
|
|
|
-(O.boundTo===void 0||O.boundTo==="vertices")){q=0;ia=O.value.length;if(O.size===1)for(x=0;x<ia;x++)O.array[x]=O.value[x];else if(O.size===2)for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.x,O.array[q+1]=ja.y,q+=2;else if(O.size===3)if(O.type==="c")for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.r,O.array[q+1]=ja.g,O.array[q+2]=ja.b,q+=3;else for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.x,O.array[q+1]=ja.y,O.array[q+2]=ja.z,q+=3;else if(O.size===4)for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.x,O.array[q+
|
|
|
|
-1]=ja.y,O.array[q+2]=ja.z,O.array[q+3]=ja.w,q+=4;k.bindBuffer(k.ARRAY_BUFFER,O.buffer);k.bufferData(k.ARRAY_BUFFER,O.array,H)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;l.attributes&&m(l)}else if(K instanceof THREE.ParticleSystem)l=c(K,s),t=l.attributes&&r(l),(j.__dirtyVertices||j.__dirtyColors||K.sortParticles||t)&&f(j,k.DYNAMIC_DRAW,K),j.__dirtyVertices=!1,j.__dirtyColors=!1,l.attributes&&m(l)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof
|
|
|
|
-THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,m,l;j=l=i=0;for(m=b.length;j<m;j++)g=b[j],g instanceof THREE.SpotLight&&
|
|
|
|
-l++,g instanceof THREE.DirectionalLight&&l++,g instanceof THREE.PointLight&&i++;i+l<=Y?j=l:(j=Math.ceil(Y*l/(i+l)),i=Y-j);g={directional:j,point:i};i=l=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&l++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=a.vertexShader;var i=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,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=M.length;p<d;p++)if(M[p].code===
|
|
|
|
-h){o=M[p].program;break a}p=k.createProgram();d=[H?"#define VERTEX_TEXTURES":"",T.gammaInput?"#define GAMMA_INPUT":"",T.gammaOutput?"#define GAMMA_OUTPUT":"",T.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.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
-g=["#ifdef GL_ES","precision "+R+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",T.gammaInput?"#define GAMMA_INPUT":"",T.gammaOutput?"#define GAMMA_OUTPUT":"",T.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.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(p,v("fragment",g+j));k.attachShader(p,
|
|
|
|
-v("vertex",d+m));k.linkProgram(p);k.getProgramParameter(p,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(p,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)j=q[d],p.uniforms[j]=k.getUniformLocation(p,
|
|
|
|
-j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=k.getAttribLocation(p,c);p.id=M.length;M.push({program:p,code:h});T.info.memory.programs=M.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&k.enableVertexAttribArray(o.position);o.color>=0&&k.enableVertexAttribArray(o.color);o.normal>=0&&k.enableVertexAttribArray(o.normal);
|
|
|
|
|
|
+k.bindTexture(k.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);X=-1;V.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,va):e.render(function(a){V.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 h=a.__objectsAdded[0],i=a,j=void 0,l=void 0,q=void 0;if(!h.__webglInit)if(h.__webglInit=
|
|
|
|
+!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){l=h.geometry;if(l.geometryGroups===void 0){var q=l,R=void 0,s=void 0,Y=void 0,ga=void 0,u=void 0,x=void 0,t=void 0,z={},y=q.morphTargets.length;q.geometryGroups={};R=0;for(s=q.faces.length;R<s;R++)Y=q.faces[R],ga=Y.materialIndex,x=ga!==void 0?ga:-1,z[x]===void 0&&
|
|
|
|
+(z[x]={hash:x,counter:0}),t=z[x].hash+"_"+z[x].counter,q.geometryGroups[t]===void 0&&(q.geometryGroups[t]={faces3:[],faces4:[],materialIndex:ga,vertices:0,numMorphTargets:y}),u=Y instanceof THREE.Face3?3:4,q.geometryGroups[t].vertices+u>65535&&(z[x].counter+=1,t=z[x].hash+"_"+z[x].counter,q.geometryGroups[t]===void 0&&(q.geometryGroups[t]={faces3:[],faces4:[],materialIndex:ga,vertices:0,numMorphTargets:y})),Y instanceof THREE.Face3?q.geometryGroups[t].faces3.push(R):q.geometryGroups[t].faces4.push(R),
|
|
|
|
+q.geometryGroups[t].vertices+=u;q.geometryGroupsList=[];R=void 0;for(R in q.geometryGroups)q.geometryGroups[R].id=ca++,q.geometryGroupsList.push(q.geometryGroups[R])}for(j in l.geometryGroups)if(q=l.geometryGroups[j],!q.__webglVertexBuffer){R=q;R.__webglVertexBuffer=k.createBuffer();R.__webglNormalBuffer=k.createBuffer();R.__webglTangentBuffer=k.createBuffer();R.__webglColorBuffer=k.createBuffer();R.__webglUVBuffer=k.createBuffer();R.__webglUV2Buffer=k.createBuffer();R.__webglSkinVertexABuffer=k.createBuffer();
|
|
|
|
+R.__webglSkinVertexBBuffer=k.createBuffer();R.__webglSkinIndicesBuffer=k.createBuffer();R.__webglSkinWeightsBuffer=k.createBuffer();R.__webglFaceBuffer=k.createBuffer();R.__webglLineBuffer=k.createBuffer();if(R.numMorphTargets){Y=s=void 0;R.__webglMorphTargetsBuffers=[];s=0;for(Y=R.numMorphTargets;s<Y;s++)R.__webglMorphTargetsBuffers.push(k.createBuffer())}V.info.memory.geometries++;ga=h;u=ga.geometry;s=q.faces3;x=q.faces4;R=s.length*3+x.length*4;Y=s.length*1+x.length*2;x=s.length*3+x.length*4;s=
|
|
|
|
+c(ga,q);t=g(s);z=d(s);y=e(s);q.__vertexArray=new Float32Array(R*3);if(z)q.__normalArray=new Float32Array(R*3);if(u.hasTangents)q.__tangentArray=new Float32Array(R*4);if(y)q.__colorArray=new Float32Array(R*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)q.__uvArray=new Float32Array(R*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(R*2)}if(ga.geometry.skinWeights.length&&ga.geometry.skinIndices.length)q.__skinVertexAArray=new Float32Array(R*4),q.__skinVertexBArray=
|
|
|
|
+new Float32Array(R*4),q.__skinIndexArray=new Float32Array(R*4),q.__skinWeightArray=new Float32Array(R*4);q.__faceArray=new Uint16Array(Y*3);q.__lineArray=new Uint16Array(x*2);if(q.numMorphTargets){q.__morphTargetsArrays=[];ga=0;for(u=q.numMorphTargets;ga<u;ga++)q.__morphTargetsArrays.push(new Float32Array(R*3))}q.__webglFaceCount=Y*3;q.__webglLineCount=x*2;if(s.attributes){if(q.__webglCustomAttributesList===void 0)q.__webglCustomAttributesList=[];Y=void 0;for(Y in s.attributes){var ga=s.attributes[Y],
|
|
|
|
+u={},J;for(J in ga)u[J]=ga[J];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,x=1,u.type==="v2"?x=2:u.type==="v3"?x=3:u.type==="v4"?x=4:u.type==="c"&&(x=3),u.size=x,u.array=new Float32Array(R*x),u.buffer=k.createBuffer(),u.buffer.belongsToAttribute=Y,ga.needsUpdate=!0,u.__original=ga;q.__webglCustomAttributesList.push(u)}}q.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=
|
|
|
|
+!0}}else if(h instanceof THREE.Ribbon){if(l=h.geometry,!l.__webglVertexBuffer)q=l,q.__webglVertexBuffer=k.createBuffer(),q.__webglColorBuffer=k.createBuffer(),V.info.memory.geometries++,q=l,R=q.vertices.length,q.__vertexArray=new Float32Array(R*3),q.__colorArray=new Float32Array(R*3),q.__webglVertexCount=R,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.Line){if(l=h.geometry,!l.__webglVertexBuffer)q=l,q.__webglVertexBuffer=k.createBuffer(),q.__webglColorBuffer=k.createBuffer(),
|
|
|
|
+V.info.memory.geometries++,q=l,R=h,s=q.vertices.length,q.__vertexArray=new Float32Array(s*3),q.__colorArray=new Float32Array(s*3),q.__webglLineCount=s,b(q,R),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(l=h.geometry,!l.__webglVertexBuffer))q=l,q.__webglVertexBuffer=k.createBuffer(),q.__webglColorBuffer=k.createBuffer(),V.info.geometries++,q=l,R=h,s=q.vertices.length,q.__vertexArray=new Float32Array(s*3),q.__colorArray=new Float32Array(s*3),q.__sortArray=[],q.__webglParticleCount=
|
|
|
|
+s,b(q,R),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(j in l=h.geometry,l.geometryGroups)q=l.geometryGroups[j],o(i.__webglObjects,q,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(l=h.geometry,o(i.__webglObjects,l,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
|
|
|
|
+h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?r(i.__webglObjects,h):h instanceof THREE.Sprite?n(i.__webglSprites,h):h instanceof THREE.LensFlare?n(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&r(i.__webglObjectsImmediate,h),h.__webglActive=
|
|
|
|
+!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(J=a.__webglObjects[h].object,j=J.geometry,l=Y=s=void 0,J instanceof THREE.Mesh){q=0;for(R=j.geometryGroupsList.length;q<R;q++)if(s=j.geometryGroupsList[q],l=c(J,s),Y=l.attributes&&p(l),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||Y){var G=J,Y=k.DYNAMIC_DRAW,ga=!j.dynamic,t=l;if(s.__inittedArrays){var u=d(t),x=e(t),D=g(t),K=u===THREE.SmoothShading,
|
|
|
|
+B=z=t=void 0,E=void 0,A=void 0,H=void 0,v=void 0,M=void 0,F=void 0,L=B=void 0,Q=void 0,N=void 0,O=void 0,T=E=void 0,W=void 0,X=void 0,S=E=F=void 0,U=void 0,aa=O=N=Q=v=void 0,I=E=O=N=Q=aa=O=N=Q=aa=O=N=Q=void 0,P=void 0,$=H=void 0,ea=void 0,Z=void 0,oa=void 0,ba=void 0,ma=L=Z=P=0,ka=0,ja=I=B=0,fa=v=T=0,C=0,la=void 0,fa=s.__vertexArray,ea=s.__uvArray,C=s.__uv2Array,$=s.__normalArray,A=s.__tangentArray,W=s.__colorArray,S=s.__skinVertexAArray,U=s.__skinVertexBArray,M=s.__skinIndexArray,na=s.__skinWeightArray,
|
|
|
|
+aa=s.__morphTargetsArrays,y=s.__webglCustomAttributesList,w=void 0,w=s.__faceArray,la=s.__lineArray,X=G.geometry,sa=X.__dirtyElements,va=X.__dirtyUvs,H=X.__dirtyNormals,F=X.__dirtyTangents,wa=X.__dirtyColors,oa=X.__dirtyMorphTargets,ba=X.vertices,G=s.faces3,ha=s.faces4,ia=X.faces,ua=X.faceVertexUvs[0],ya=X.faceVertexUvs[1],Fa=X.skinVerticesA,Ga=X.skinVerticesB,Ha=X.skinIndices,Da=X.skinWeights,Ea=X.morphTargets;if(X.__dirtyVertices){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=ba[E.a].position,N=ba[E.b].position,
|
|
|
|
+O=ba[E.c].position,fa[Z]=Q.x,fa[Z+1]=Q.y,fa[Z+2]=Q.z,fa[Z+3]=N.x,fa[Z+4]=N.y,fa[Z+5]=N.z,fa[Z+6]=O.x,fa[Z+7]=O.y,fa[Z+8]=O.z,Z+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=ba[E.a].position,N=ba[E.b].position,O=ba[E.c].position,E=ba[E.d].position,fa[Z]=Q.x,fa[Z+1]=Q.y,fa[Z+2]=Q.z,fa[Z+3]=N.x,fa[Z+4]=N.y,fa[Z+5]=N.z,fa[Z+6]=O.x,fa[Z+7]=O.y,fa[Z+8]=O.z,fa[Z+9]=E.x,fa[Z+10]=E.y,fa[Z+11]=E.z,Z+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,fa,Y)}if(oa){Z=0;for(oa=Ea.length;Z<
|
|
|
|
+oa;Z++){t=fa=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=Ea[Z].vertices[E.a].position,N=Ea[Z].vertices[E.b].position,O=Ea[Z].vertices[E.c].position,ba=aa[Z],ba[fa]=Q.x,ba[fa+1]=Q.y,ba[fa+2]=Q.z,ba[fa+3]=N.x,ba[fa+4]=N.y,ba[fa+5]=N.z,ba[fa+6]=O.x,ba[fa+7]=O.y,ba[fa+8]=O.z,fa+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=Ea[Z].vertices[E.a].position,N=Ea[Z].vertices[E.b].position,O=Ea[Z].vertices[E.c].position,E=Ea[Z].vertices[E.d].position,ba=aa[Z],ba[fa]=Q.x,ba[fa+1]=Q.y,ba[fa+2]=Q.z,ba[fa+3]=N.x,ba[fa+
|
|
|
|
+4]=N.y,ba[fa+5]=N.z,ba[fa+6]=O.x,ba[fa+7]=O.y,ba[fa+8]=O.z,ba[fa+9]=E.x,ba[fa+10]=E.y,ba[fa+11]=E.z,fa+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglMorphTargetsBuffers[Z]);k.bufferData(k.ARRAY_BUFFER,aa[Z],Y)}}if(Da.length){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=Da[E.a],N=Da[E.b],O=Da[E.c],na[v]=Q.x,na[v+1]=Q.y,na[v+2]=Q.z,na[v+3]=Q.w,na[v+4]=N.x,na[v+5]=N.y,na[v+6]=N.z,na[v+7]=N.w,na[v+8]=O.x,na[v+9]=O.y,na[v+10]=O.z,na[v+11]=O.w,Q=Ha[E.a],N=Ha[E.b],O=Ha[E.c],M[v]=Q.x,M[v+1]=Q.y,M[v+2]=Q.z,M[v+3]=Q.w,
|
|
|
|
+M[v+4]=N.x,M[v+5]=N.y,M[v+6]=N.z,M[v+7]=N.w,M[v+8]=O.x,M[v+9]=O.y,M[v+10]=O.z,M[v+11]=O.w,Q=Fa[E.a],N=Fa[E.b],O=Fa[E.c],S[v]=Q.x,S[v+1]=Q.y,S[v+2]=Q.z,S[v+3]=1,S[v+4]=N.x,S[v+5]=N.y,S[v+6]=N.z,S[v+7]=1,S[v+8]=O.x,S[v+9]=O.y,S[v+10]=O.z,S[v+11]=1,Q=Ga[E.a],N=Ga[E.b],O=Ga[E.c],U[v]=Q.x,U[v+1]=Q.y,U[v+2]=Q.z,U[v+3]=1,U[v+4]=N.x,U[v+5]=N.y,U[v+6]=N.z,U[v+7]=1,U[v+8]=O.x,U[v+9]=O.y,U[v+10]=O.z,U[v+11]=1,v+=12;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=Da[E.a],N=Da[E.b],O=Da[E.c],aa=Da[E.d],na[v]=Q.x,na[v+
|
|
|
|
+1]=Q.y,na[v+2]=Q.z,na[v+3]=Q.w,na[v+4]=N.x,na[v+5]=N.y,na[v+6]=N.z,na[v+7]=N.w,na[v+8]=O.x,na[v+9]=O.y,na[v+10]=O.z,na[v+11]=O.w,na[v+12]=aa.x,na[v+13]=aa.y,na[v+14]=aa.z,na[v+15]=aa.w,Q=Ha[E.a],N=Ha[E.b],O=Ha[E.c],aa=Ha[E.d],M[v]=Q.x,M[v+1]=Q.y,M[v+2]=Q.z,M[v+3]=Q.w,M[v+4]=N.x,M[v+5]=N.y,M[v+6]=N.z,M[v+7]=N.w,M[v+8]=O.x,M[v+9]=O.y,M[v+10]=O.z,M[v+11]=O.w,M[v+12]=aa.x,M[v+13]=aa.y,M[v+14]=aa.z,M[v+15]=aa.w,Q=Fa[E.a],N=Fa[E.b],O=Fa[E.c],aa=Fa[E.d],S[v]=Q.x,S[v+1]=Q.y,S[v+2]=Q.z,S[v+3]=1,S[v+4]=N.x,
|
|
|
|
+S[v+5]=N.y,S[v+6]=N.z,S[v+7]=1,S[v+8]=O.x,S[v+9]=O.y,S[v+10]=O.z,S[v+11]=1,S[v+12]=aa.x,S[v+13]=aa.y,S[v+14]=aa.z,S[v+15]=1,Q=Ga[E.a],N=Ga[E.b],O=Ga[E.c],E=Ga[E.d],U[v]=Q.x,U[v+1]=Q.y,U[v+2]=Q.z,U[v+3]=1,U[v+4]=N.x,U[v+5]=N.y,U[v+6]=N.z,U[v+7]=1,U[v+8]=O.x,U[v+9]=O.y,U[v+10]=O.z,U[v+11]=1,U[v+12]=E.x,U[v+13]=E.y,U[v+14]=E.z,U[v+15]=1,v+=16;v>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,S,Y),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,
|
|
|
|
+U,Y),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,M,Y),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,na,Y))}if(wa&&x){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],v=E.vertexColors,M=E.color,v.length===3&&x===THREE.VertexColors?(E=v[0],S=v[1],U=v[2]):U=S=E=M,W[T]=E.r,W[T+1]=E.g,W[T+2]=E.b,W[T+3]=S.r,W[T+4]=S.g,W[T+5]=S.b,W[T+6]=U.r,W[T+7]=U.g,W[T+8]=U.b,T+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],v=E.vertexColors,M=E.color,v.length===
|
|
|
|
+4&&x===THREE.VertexColors?(E=v[0],S=v[1],U=v[2],v=v[3]):v=U=S=E=M,W[T]=E.r,W[T+1]=E.g,W[T+2]=E.b,W[T+3]=S.r,W[T+4]=S.g,W[T+5]=S.b,W[T+6]=U.r,W[T+7]=U.g,W[T+8]=U.b,W[T+9]=v.r,W[T+10]=v.g,W[T+11]=v.b,T+=12;T>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,W,Y))}if(F&&X.hasTangents){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],F=E.vertexTangents,T=F[0],W=F[1],X=F[2],A[I]=T.x,A[I+1]=T.y,A[I+2]=T.z,A[I+3]=T.w,A[I+4]=W.x,A[I+5]=W.y,A[I+6]=W.z,A[I+7]=W.w,A[I+8]=X.x,A[I+9]=X.y,
|
|
|
|
+A[I+10]=X.z,A[I+11]=X.w,I+=12;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],F=E.vertexTangents,T=F[0],W=F[1],X=F[2],F=F[3],A[I]=T.x,A[I+1]=T.y,A[I+2]=T.z,A[I+3]=T.w,A[I+4]=W.x,A[I+5]=W.y,A[I+6]=W.z,A[I+7]=W.w,A[I+8]=X.x,A[I+9]=X.y,A[I+10]=X.z,A[I+11]=X.w,A[I+12]=F.x,A[I+13]=F.y,A[I+14]=F.z,A[I+15]=F.w,I+=16;k.bindBuffer(k.ARRAY_BUFFER,s.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,A,Y)}if(H&&u){t=0;for(z=G.length;t<z;t++)if(E=ia[G[t]],A=E.vertexNormals,H=E.normal,A.length===3&&K)for(I=0;I<3;I++)H=
|
|
|
|
+A[I],$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;else for(I=0;I<3;I++)$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;t=0;for(z=ha.length;t<z;t++)if(E=ia[ha[t]],A=E.vertexNormals,H=E.normal,A.length===4&&K)for(I=0;I<4;I++)H=A[I],$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;else for(I=0;I<4;I++)$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;k.bindBuffer(k.ARRAY_BUFFER,s.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,$,Y)}if(va&&ua&&D){t=0;for(z=G.length;t<z;t++)if(B=G[t],B=ua[B],B!==void 0)for(I=0;I<3;I++)$=B[I],ea[L]=$.u,ea[L+1]=$.v,
|
|
|
|
+L+=2;t=0;for(z=ha.length;t<z;t++)if(B=ha[t],B=ua[B],B!==void 0)for(I=0;I<4;I++)$=B[I],ea[L]=$.u,ea[L+1]=$.v,L+=2;L>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ea,Y))}if(va&&ya&&D){t=0;for(z=G.length;t<z;t++)if(B=G[t],L=ya[B],L!==void 0)for(I=0;I<3;I++)ea=L[I],C[ma]=ea.u,C[ma+1]=ea.v,ma+=2;t=0;for(z=ha.length;t<z;t++)if(B=ha[t],L=ya[B],L!==void 0)for(I=0;I<4;I++)ea=L[I],C[ma]=ea.u,C[ma+1]=ea.v,ma+=2;ma>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,
|
|
|
|
+C,Y))}if(sa){t=0;for(z=G.length;t<z;t++)w[ka]=P,w[ka+1]=P+1,w[ka+2]=P+2,ka+=3,la[ja]=P,la[ja+1]=P+1,la[ja+2]=P,la[ja+3]=P+2,la[ja+4]=P+1,la[ja+5]=P+2,ja+=6,P+=3;t=0;for(z=ha.length;t<z;t++)w[ka]=P,w[ka+1]=P+1,w[ka+2]=P+3,w[ka+3]=P+1,w[ka+4]=P+2,w[ka+5]=P+3,ka+=6,la[ja]=P,la[ja+1]=P+1,la[ja+2]=P,la[ja+3]=P+3,la[ja+4]=P+1,la[ja+5]=P+2,la[ja+6]=P+2,la[ja+7]=P+3,ja+=8,P+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,s.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,w,Y);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+s.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,la,Y)}if(y){I=0;for(P=y.length;I<P;I++)if(w=y[I],w.__original.needsUpdate){C=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],w.array[C]=w.value[E.a],w.array[C+1]=w.value[E.b],w.array[C+2]=w.value[E.c],C+=3;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],w.array[C]=w.value[E.a],w.array[C+1]=w.value[E.b],w.array[C+2]=w.value[E.c],w.array[C+3]=w.value[E.d],C+=4}else{if(w.boundTo==="faces"){t=0;for(z=
|
|
|
|
+G.length;t<z;t++)la=w.value[G[t]],w.array[C]=la,w.array[C+1]=la,w.array[C+2]=la,C+=3;t=0;for(z=ha.length;t<z;t++)la=w.value[ha[t]],w.array[C]=la,w.array[C+1]=la,w.array[C+2]=la,w.array[C+3]=la,C+=4}}else if(w.size===2)if(w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=w.value[E.a],N=w.value[E.b],O=w.value[E.c],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=O.x,w.array[C+5]=O.y,C+=6;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=w.value[E.a],
|
|
|
|
+N=w.value[E.b],O=w.value[E.c],E=w.value[E.d],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=O.x,w.array[C+5]=O.y,w.array[C+6]=E.x,w.array[C+7]=E.y,C+=8}else{if(w.boundTo==="faces"){t=0;for(z=G.length;t<z;t++)O=N=Q=la=w.value[G[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=O.x,w.array[C+5]=O.y,C+=6;t=0;for(z=ha.length;t<z;t++)E=O=N=Q=la=w.value[ha[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=
|
|
|
|
+O.x,w.array[C+5]=O.y,w.array[C+6]=E.x,w.array[C+7]=E.y,C+=8}}else if(w.size===3)if(u=w.type==="c"?["r","g","b"]:["x","y","z"],w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=w.value[E.a],N=w.value[E.b],O=w.value[E.c],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],C+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=w.value[E.a],N=
|
|
|
|
+w.value[E.b],O=w.value[E.c],E=w.value[E.d],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],w.array[C+9]=E[u[0]],w.array[C+10]=E[u[1]],w.array[C+11]=E[u[2]],C+=12}else{if(w.boundTo==="faces"){t=0;for(z=G.length;t<z;t++)O=N=Q=la=w.value[G[t]],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],
|
|
|
|
+w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],C+=9;t=0;for(z=ha.length;t<z;t++)E=O=N=Q=la=w.value[ha[t]],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],w.array[C+9]=E[u[0]],w.array[C+10]=E[u[1]],w.array[C+11]=E[u[2]],C+=12}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=w.value[E.a],N=
|
|
|
|
+w.value[E.b],O=w.value[E.c],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,C+=12;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=w.value[E.a],N=w.value[E.b],O=w.value[E.c],E=w.value[E.d],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=
|
|
|
|
+O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,w.array[C+12]=E.x,w.array[C+13]=E.y,w.array[C+14]=E.z,w.array[C+15]=E.w,C+=16}else if(w.boundTo==="faces"){t=0;for(z=G.length;t<z;t++)O=N=Q=la=w.value[G[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,C+=12;t=0;for(z=ha.length;t<z;t++)E=O=N=Q=la=w.value[ha[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+
|
|
|
|
+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,w.array[C+12]=E.x,w.array[C+13]=E.y,w.array[C+14]=E.z,w.array[C+15]=E.w,C+=16}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.ARRAY_BUFFER,w.array,Y)}}ga&&(delete s.__inittedArrays,delete s.__colorArray,delete s.__normalArray,delete s.__tangentArray,delete s.__uvArray,delete s.__uv2Array,delete s.__faceArray,delete s.__vertexArray,delete s.__lineArray,
|
|
|
|
+delete s.__skinVertexAArray,delete s.__skinVertexBArray,delete s.__skinIndexArray,delete s.__skinWeightArray)}}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=!1;l.attributes&&m(l)}else if(J instanceof THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){l=j;J=k.DYNAMIC_DRAW;u=q=u=ga=ga=void 0;x=l.vertices;R=l.colors;t=x.length;s=R.length;z=l.__vertexArray;Y=l.__colorArray;y=l.__dirtyColors;if(l.__dirtyVertices){for(ga=
|
|
|
|
+0;ga<t;ga++)u=x[ga].position,q=ga*3,z[q]=u.x,z[q+1]=u.y,z[q+2]=u.z;k.bindBuffer(k.ARRAY_BUFFER,l.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,z,J)}if(y){for(ga=0;ga<s;ga++)u=R[ga],q=ga*3,Y[q]=u.r,Y[q+1]=u.g,Y[q+2]=u.b;k.bindBuffer(k.ARRAY_BUFFER,l.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Y,J)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(J instanceof THREE.Line){l=c(J,s);Y=l.attributes&&p(l);if(j.__dirtyVertices||j.__dirtyColors||Y){J=j;q=k.DYNAMIC_DRAW;t=R=K=x=D=void 0;x=J.vertices;
|
|
|
|
+s=J.colors;t=x.length;Y=s.length;z=J.__vertexArray;ga=J.__colorArray;y=J.__dirtyColors;u=J.__webglCustomAttributesList;P=ia=ha=G=K=D=void 0;if(J.__dirtyVertices){for(D=0;D<t;D++)K=x[D].position,R=D*3,z[R]=K.x,z[R+1]=K.y,z[R+2]=K.z;k.bindBuffer(k.ARRAY_BUFFER,J.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,z,q)}if(y){for(x=0;x<Y;x++)t=s[x],R=x*3,ga[R]=t.r,ga[R+1]=t.g,ga[R+2]=t.b;k.bindBuffer(k.ARRAY_BUFFER,J.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,ga,q)}if(u){D=0;for(K=u.length;D<K;D++)if(P=
|
|
|
|
+u[D],P.needsUpdate&&(P.boundTo===void 0||P.boundTo==="vertices")){R=0;ha=P.value.length;if(P.size===1)for(G=0;G<ha;G++)P.array[G]=P.value[G];else if(P.size===2)for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=ia.x,P.array[R+1]=ia.y,R+=2;else if(P.size===3)if(P.type==="c")for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=ia.r,P.array[R+1]=ia.g,P.array[R+2]=ia.b,R+=3;else for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=ia.x,P.array[R+1]=ia.y,P.array[R+2]=ia.z,R+=3;else if(P.size===4)for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=
|
|
|
|
+ia.x,P.array[R+1]=ia.y,P.array[R+2]=ia.z,P.array[R+3]=ia.w,R+=4;k.bindBuffer(k.ARRAY_BUFFER,P.buffer);k.bufferData(k.ARRAY_BUFFER,P.array,q)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;l.attributes&&m(l)}else if(J instanceof THREE.ParticleSystem)l=c(J,s),Y=l.attributes&&p(l),(j.__dirtyVertices||j.__dirtyColors||J.sortParticles||Y)&&f(j,k.DYNAMIC_DRAW,J),j.__dirtyVertices=!1,j.__dirtyColors=!1,l.attributes&&m(l)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h=
|
|
|
|
+"depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,m,l;j=l=i=0;for(m=b.length;j<m;j++)g=b[j],
|
|
|
|
+g instanceof THREE.SpotLight&&l++,g instanceof THREE.DirectionalLight&&l++,g instanceof THREE.PointLight&&i++;i+l<=T?j=l:(j=Math.ceil(T*l/(i+l)),i=T-j);g={directional:j,point:i};i=l=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&l++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=a.vertexShader;var i=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,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;
|
|
|
|
+for(d=L.length;p<d;p++)if(L[p].code===h){o=L[p].program;break a}p=k.createProgram();d=[Y?"#define VERTEX_TEXTURES":"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.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.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
+g=["#ifdef GL_ES","precision "+J+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.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.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(p,y("fragment",g+j));k.attachShader(p,
|
|
|
|
+y("vertex",d+m));k.linkProgram(p);k.getProgramParameter(p,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(p,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)j=q[d],p.uniforms[j]=k.getUniformLocation(p,
|
|
|
|
+j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=k.getAttribLocation(p,c);p.id=L.length;L.push({program:p,code:h});V.info.memory.programs=L.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&k.enableVertexAttribArray(o.position);o.color>=0&&k.enableVertexAttribArray(o.color);o.normal>=0&&k.enableVertexAttribArray(o.normal);
|
|
o.tangent>=0&&k.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(k.enableVertexAttribArray(o.skinVertexA),k.enableVertexAttribArray(o.skinVertexB),k.enableVertexAttribArray(o.skinIndex),k.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&k.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(k.enableVertexAttribArray(o[q]),
|
|
o.tangent>=0&&k.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(k.enableVertexAttribArray(o.skinVertexA),k.enableVertexAttribArray(o.skinVertexB),k.enableVertexAttribArray(o.skinIndex),k.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&k.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(k.enableVertexAttribArray(o[q]),
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(fa!==a.doubleSided)a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),fa=a.doubleSided;if(X!==a.flipSided)a.flipSided?k.frontFace(k.CW):
|
|
|
|
-k.frontFace(k.CCW),X=a.flipSided};this.setDepthTest=function(a){$!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),$=a)};this.setBlending=function(a){if(a!==S){switch(a){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
|
|
|
|
-k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}S=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=k.createTexture(),T.info.memory.textures++;k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);var c=B(k.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,E(a.format),a.image.width,a.image.height,0,E(a.format),k.UNSIGNED_BYTE,a.image.data):k.texImage2D(k.TEXTURE_2D,
|
|
|
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(ea!==a.doubleSided)a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ea=a.doubleSided;if(aa!==a.flipSided)a.flipSided?k.frontFace(k.CW):
|
|
|
|
+k.frontFace(k.CCW),aa=a.flipSided};this.setDepthTest=function(a){I!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),I=a)};this.setBlending=function(a){if(a!==U){switch(a){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
|
|
|
|
+k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}U=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=k.createTexture(),V.info.memory.textures++;k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);var c=A(k.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,H(a.format),a.image.width,a.image.height,0,H(a.format),k.UNSIGNED_BYTE,a.image.data):k.texImage2D(k.TEXTURE_2D,
|
|
0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,a.image);c&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=k.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,
|
|
0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,a.image);c&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=k.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,
|
|
-a.__webglTexture);B(k.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=k.createFramebuffer();a.__webglRenderbuffer[c]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,E(a.format),a.width,a.height,0,E(a.format),E(a.type),null);var d=a,e=k.TEXTURE_CUBE_MAP_POSITIVE_X+c;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[c]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,e,d.__webglTexture,0);x(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=k.createFramebuffer(),
|
|
|
|
-a.__webglRenderbuffer=k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),B(k.TEXTURE_2D,a,a),k.texImage2D(k.TEXTURE_2D,0,E(a.format),a.width,a.height,0,E(a.format),E(a.type),null),c=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,c,a.__webglTexture,0),x(a.__webglRenderbuffer,a);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
|
-null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ka,a=la,d=na,e=sa);b!==I&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),I=b)};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
|
|
|
+a.__webglTexture);A(k.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=k.createFramebuffer();a.__webglRenderbuffer[c]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null);var d=a,e=k.TEXTURE_CUBE_MAP_POSITIVE_X+c;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[c]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,e,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=k.createFramebuffer(),
|
|
|
|
+a.__webglRenderbuffer=k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),A(k.TEXTURE_2D,a,a),k.texImage2D(k.TEXTURE_2D,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null),c=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,c,a.__webglTexture,0),D(a.__webglRenderbuffer,a);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
|
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ja,a=ka,d=ma,e=sa);b!==v&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),v=b);ya=c;ua=a};this.shadowMapPlugin=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=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
@@ -339,18 +339,18 @@ 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,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;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,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;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,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,l=g.faces,j=a.faceVertexUvs[0],o=g.faceVertexUvs[0],r={},m=0;m<a.materials.length;m++)r[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,p=h.length;m<p;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
|
|
|
|
-0;for(p=l.length;m<p;m++){var f=l[m],q,s,t=f.vertexNormals,u=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=t.length;h<n;h++)s=t[h].clone(),d&&d.multiplyVector3(s),q.vertexNormals.push(s);q.color.copy(f.color);h=0;for(n=u.length;h<n;h++)s=u[h],q.vertexColors.push(s.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
|
|
|
|
-n=r[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(p=o.length;m<p;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
|
|
|
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,l=g.faces,j=a.faceVertexUvs[0],o=g.faceVertexUvs[0],p={},m=0;m<a.materials.length;m++)p[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,r=h.length;m<r;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
|
|
|
|
+0;for(r=l.length;m<r;m++){var f=l[m],q,s,u=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=u.length;h<n;h++)s=u[h].clone(),d&&d.multiplyVector3(s),q.vertexNormals.push(s);q.color.copy(f.color);h=0;for(n=t.length;h<n;h++)s=t[h],q.vertexColors.push(s.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
|
|
|
|
+n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(r=o.length;m<r;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
|
|
for(c=e.length;a<c;a++){var h=e[a],i,l,j=h.vertexNormals,o=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(f=j.length;d<f;d++)l=j[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)l=o[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
|
|
for(c=e.length;a<c;a++){var h=e[a],i,l,j=h.vertexNormals,o=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(f=j.length;d<f;d++)l=j[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)l=o[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
|
|
f;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,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
f;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,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
|
|
g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
|
|
g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
|
|
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,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 l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,l=[],j,o,r,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,o=f[d.b].position,r=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,r);else if(d instanceof
|
|
|
|
-THREE.Face4)j=f[d.a].position,o=f[d.b].position,r=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,r,m),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;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();
|
|
|
|
|
|
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,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 l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,l=[],j,o,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,p);else if(d instanceof
|
|
|
|
+THREE.Face4)j=f[d.a].position,o=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;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=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={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="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
THREE.ImageUtils={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="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},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|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),l=i.data,j=0;j<d;j++)for(var o=1;o<e;o++){var r=o-1<0?e-1:o-1,m=(o+1)%e,p=j-1<0?d-1:j-1,n=(j+1)%d,q=[],s=[0,0,h[(o*d+j)*4]/255*b];q.push([-1,0,h[(o*d+p)*4]/255*b]);q.push([-1,-1,h[(r*d+p)*4]/255*b]);q.push([0,-1,h[(r*d+j)*4]/255*b]);q.push([1,-1,h[(r*d+n)*4]/255*b]);
|
|
|
|
-q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+j)*4]/255*b]);q.push([-1,1,h[(m*d+p)*4]/255*b]);r=[];p=q.length;for(m=0;m<p;m++){var n=q[m],t=q[(m+1)%p],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]];r.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]]))}q=[0,0,0];for(m=0;m<r.length;m++)q[0]+=r[m][0],q[1]+=r[m][1],q[2]+=r[m][2];q[0]/=r.length;q[1]/=r.length;q[2]/=r.length;s=(o*d+j)*4;l[s]=(q[0]+1)/2*255|0;l[s+1]=(q[1]+0.5)*
|
|
|
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),l=i.data,j=0;j<d;j++)for(var o=1;o<e;o++){var p=o-1<0?e-1:o-1,m=(o+1)%e,r=j-1<0?d-1:j-1,n=(j+1)%d,q=[],s=[0,0,h[(o*d+j)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(p*d+r)*4]/255*b]);q.push([0,-1,h[(p*d+j)*4]/255*b]);q.push([1,-1,h[(p*d+n)*4]/255*b]);
|
|
|
|
+q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+j)*4]/255*b]);q.push([-1,1,h[(m*d+r)*4]/255*b]);p=[];r=q.length;for(m=0;m<r;m++){var n=q[m],u=q[(m+1)%r],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];p.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(m=0;m<p.length;m++)q[0]+=p[m][0],q[1]+=p[m][1],q[2]+=p[m][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;s=(o*d+j)*4;l[s]=(q[0]+1)/2*255|0;l[s+1]=(q[1]+0.5)*
|
|
255|0;l[s+2]=q[2]*255|0;l[s+3]=255}f.putImageData(i,0,0);return g}};
|
|
255|0;l[s+2]=q[2]*255|0;l[s+3]=255}f.putImageData(i,0,0);return g}};
|
|
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 g=new THREE.Mesh(a,b[c]);e.add(g)}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 g=new THREE.Mesh(a,b[c]);e.add(g)}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?
|
|
@@ -396,9 +396,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,g){var f=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,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=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,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
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,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};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,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};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,g,f,h,i,l,j,o,r,m,p,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];r=g[1];c.length>0?(f=c[c.length-1],m=f.x,p=f.y):(f=this.actions[d-1].args,m=f[f.length-2],p=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,p,r,
|
|
|
|
-i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];r=g[1];l=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,p=f.y):(f=this.actions[d-1].args,m=f[f.length-2],p=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,l,h),n=THREE.Shape.Utils.b3(n,p,r,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
|
|
|
|
-for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];l=g[2];o=g[3];n=g[4];r=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);p=n-o;var q=a*2;for(f=1;f<=q;f++)n=f/q,r||(n=1-n),n=o+n*p,g=j+h+l*Math.cos(n),n=m+i+l*Math.sin(n),c.push(new THREE.Vector2(g,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,g,f,h,i,l,j,o,p,m,r,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];p=g[1];c.length>0?(f=c[c.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,r,p,
|
|
|
|
+i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];p=g[1];l=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,l,h),n=THREE.Shape.Utils.b3(n,r,p,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
|
|
|
|
+for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];l=g[2];o=g[3];n=g[4];p=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);r=n-o;var q=a*2;for(f=1;f<=q;f++)n=f/q,p||(n=1-n),n=o+n*r,g=j+h+l*Math.cos(n),n=m+i+l*Math.sin(n),c.push(new THREE.Vector2(g,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.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,l,j,o;h=0;for(i=f.length;h<i;h++)l=f[h],j=l.x,o=l.y,l.x=a*j+b*o+c,l.y=d*o+e*j+g;return f};
|
|
THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,l,j,o;h=0;for(i=f.length;h<i;h++)l=f[h],j=l.x,o=l.y,l.x=a*j+b*o+c,l.y=d*o+e*j+g;return f};
|
|
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,a=0;for(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,a=0;for(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();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
|
|
@@ -406,9 +406,9 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;f
|
|
d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};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)};
|
|
d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};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.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(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.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,g,f,h,i,l,j,o,r,m,p=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){r=l[e];m=[];for(o=0;o<c.length;o++)j=c[o],j=r.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;var n=[l[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[l[f],l[g],c[h]];r=THREE.FontUtils.Triangulate.area(q);m=h;j=f;h+=1;f+=-1;h<
|
|
|
|
-0&&(h+=c.length);h%=c.length;f<0&&(f+=l.length);f%=l.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;n=[l[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[l[f],l[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+r>n+q&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=l.length),f%=l.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:l.length-1);o=c.slice(0,h);r=c.slice(h);m=l.slice(f);j=l.slice(0,f);g=[l[f],l[g],c[h]];p.push([l[f],c[h],c[e]]);p.push(g);c=o.concat(m).concat(j).concat(r)}return{shape:c,
|
|
|
|
-isolatedPts:p,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),g,f,h,i,l={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,l,j,o,p,m,r=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){p=l[e];m=[];for(o=0;o<c.length;o++)j=c[o],j=p.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;var n=[l[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[l[f],l[g],c[h]];p=THREE.FontUtils.Triangulate.area(q);m=h;j=f;h+=1;f+=-1;h<
|
|
|
|
+0&&(h+=c.length);h%=c.length;f<0&&(f+=l.length);f%=l.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;n=[l[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[l[f],l[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+p>n+q&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=l.length),f%=l.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:l.length-1);o=c.slice(0,h);p=c.slice(h);m=l.slice(f);j=l.slice(0,f);g=[l[f],l[g],c[h]];r.push([l[f],c[h],c[e]]);r.push(g);c=o.concat(m).concat(j).concat(p)}return{shape:c,
|
|
|
|
+isolatedPts:r,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),g,f,h,i,l={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},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 THREE.FontUtils.Triangulate.area(a)<0},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){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
|
|
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){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
|
|
@@ -421,8 +421,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
|
|
THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.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 g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.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(this.hierarchy[a].animationCache!==void 0)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(this.hierarchy[a].animationCache!==void 0)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,g,f,h,i,l,j=this.data.JIT.hierarchy,o,r;this.currentTime+=a*this.timeScale;r=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,p=this.hierarchy.length;m<p;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
-!1):(a.matrix=j[m][l],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;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=r){if(o<r)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,l,j=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,r=this.hierarchy.length;m<r;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
+!1):(a.matrix=j[m][l],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;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
|
|
o)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
o)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+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,d*1.01),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(c===
|
|
this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+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,d*1.01),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(c===
|
|
"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][l]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)j[m][l]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
|
|
"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][l]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)j[m][l]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
|
|
@@ -466,38 +466,38 @@ 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=b!==void 0?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,g=new THREE.Matrix4,f=!1,h=1,i=0,l=0,j=0,o=0,r=0,m=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
|
-this.rotateHorizontally(b*o);this.rotateVertically(b*r)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);f&&(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=b!==void 0?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,g=new THREE.Matrix4,f=!1,h=1,i=0,l=0,j=0,o=0,p=0,m=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
|
|
|
|
+this.rotateHorizontally(b*o);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);f&&(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;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);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;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);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){o=(a.clientX-m)/window.innerWidth;r=(a.clientY-p)/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){o=(a.clientX-m)/window.innerWidth;p=(a.clientY-r)/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:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
|
|
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
|
|
THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?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];
|
|
THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?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 e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,r=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
|
|
|
|
|
|
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
|
|
c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
|
|
c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
|
|
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-l.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?l=j:l.y+=(j.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=r.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
|
|
|
|
-c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=r:o.addSelf(a.sub(r,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
|
|
|
|
-c.noPan||c.panCamera();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&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),l=j=c.getMouseOnScreen(a.clientX,a.clientY),o=r=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
|
|
|
|
-!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(r=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=r=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
|
|
|
|
|
|
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-l.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?l=j:l.y+=(j.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
|
|
|
|
+c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
|
|
|
|
+c.noPan||c.panCamera();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&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),l=j=c.getMouseOnScreen(a.clientX,a.clientY),o=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
|
|
|
|
+!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
|
|
function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
|
|
function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var k=o+1,t=p+1,u=h/o,I=i/p,w=new THREE.Vector3;w[n]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<k;i++){var W=new THREE.Vector3;W[a]=(i*u-q)*c;W[b]=(h*I-r)*f;W[n]=j;l.vertices.push(new THREE.Vertex(W))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
|
-new THREE.Face4(i+k*h+s,i+k*(h+1)+s,i+1+k*(h+1)+s,i+1+k*h+s),a.normal.copy(w),a.vertexNormals.push(w.clone(),w.clone(),w.clone(),w.clone()),a.materialIndex=m,l.faces.push(a),l.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 l=this,j=a/2,o=b/2,r=c/2,m,p,n,q,s,t;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;p=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(h!=void 0)for(var u in h)this.sides[u]!=void 0&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,o,p);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,r,n);this.sides.nz&&i("x","y",-1,-1,a,b,-r,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var k=o+1,t=p+1,u=h/o,v=i/p,M=new THREE.Vector3;M[n]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<k;i++){var X=new THREE.Vector3;X[a]=(i*u-q)*c;X[b]=(h*v-r)*f;X[n]=j;l.vertices.push(new THREE.Vertex(X))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
|
+new THREE.Face4(i+k*h+s,i+k*(h+1)+s,i+1+k*(h+1)+s,i+1+k*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,l.faces.push(a),l.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 l=this,j=a/2,o=b/2,p=c/2,m,r,n,q,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;r=2;s=
|
|
|
|
+3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,u);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,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,l=[],j=[];for(i=0;i<=e;i++){var o=[],r=[],m=i/e,p=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(p*Math.sin(n*Math.PI*2),-m*c+f,p*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);r.push(new THREE.UV(n,m))}l.push(o);j.push(r)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],o=l[i+1][h],r=l[i+1][h+1],m=l[i][h+1],p=
|
|
|
|
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[r].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),t=j[i][h].clone(),u=j[i+1][h].clone(),v=j[i+1][h+1].clone(),B=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,r,m,[p,n,q,s]));this.faceVertexUvs[0].push([t,u,v,B])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=l[0][h],o=l[0][h+
|
|
|
|
-1],r=this.vertices.length-1,p=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),t=j[0][h].clone(),u=j[0][h+1].clone(),v=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,o,r,[p,n,q])),this.faceVertexUvs[0].push([t,u,v])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=l[i][h+1],o=l[i][h],r=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),t=j[i][h+1].clone(),u=j[i][h].clone(),
|
|
|
|
-v=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,o,r,[p,n,q])),this.faceVertexUvs[0].push([t,u,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,l=[],j=[];for(i=0;i<=e;i++){var o=[],p=[],m=i/e,r=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(n*Math.PI*2),-m*c+f,r*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}l.push(o);j.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],o=l[i+1][h],p=l[i+1][h+1],m=l[i][h+1],r=
|
|
|
|
+this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[p].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=j[i][h].clone(),t=j[i+1][h].clone(),y=j[i+1][h+1].clone(),A=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[r,n,q,s]));this.faceVertexUvs[0].push([u,t,y,A])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=l[0][h],o=l[0][h+
|
|
|
|
+1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),u=j[0][h].clone(),t=j[0][h+1].clone(),y=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,o,p,[r,n,q])),this.faceVertexUvs[0].push([u,t,y])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=l[i][h+1],o=l[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),u=j[i][h+1].clone(),t=j[i][h].clone(),
|
|
|
|
+y=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,o,p,[r,n,q])),this.faceVertexUvs[0].push([u,t,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,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,i=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);i.copy(a).addSelf(g);if(h.equals(i))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,i=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);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return 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+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(z=a.length;--z>=0;){W=z;da=z-1;da<0&&(da=a.length-1);for(var b=
|
|
|
|
-0,c=m+j*2,b=0;b<c;b++){var d=T*b,e=T*(b+1),f=fa+W+d,g=fa+W+e,k=f,d=fa+da+d,e=fa+da+e,l=g;k+=R;d+=R;e+=R;l+=R;G.faces.push(new THREE.Face4(k,d,e,l,null,null,v));v&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(G.vertices[f].position.z+i)/e,g=(G.vertices[g].position.z+i)/e,G.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=R;b+=R;c+=R;G.faces.push(new THREE.Face3(a,b,c,
|
|
|
|
-null,null,u));if(u){var d=B.maxY,e=B.maxX,f=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/e,G.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
|
|
|
|
-r=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,p=b.bendPath,n=b.extrudePath,q,s=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,u=b.material,v=b.extrudeMaterial,B=this.shapebb;if(n)q=n.getPoints(r),m=q.length,s=!0,o=!1;o||(l=i=j=0);var x,C,E,G=this,R=this.vertices.length;p&&a.addWrapPath(p);r=t?a.extractAllSpacedPoints(r):a.extractAllPoints(r);p=r.shape;r=r.holes;if(n=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();C=0;for(E=r.length;C<E;C++)x=r[C],THREE.Shape.Utils.isClockWise(x)&&
|
|
|
|
-(r[C]=x.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(p,r);t=p;C=0;for(E=r.length;C<E;C++)x=r[C],p=p.concat(x);var z,J,K,U,V,Y,T=p.length,k=n.length,M=[];z=0;J=t.length;W=J-1;for(da=z+1;z<J;z++,W++,da++)W===J&&(W=0),da===J&&(da=0),M[z]=d(t[z],t[W],t[da]);var L=[],I,w=M.concat();C=0;for(E=r.length;C<E;C++){x=r[C];I=[];z=0;J=x.length;W=J-1;for(da=z+1;z<J;z++,W++,da++)W===J&&(W=0),da===J&&(da=0),I[z]=d(x[z],x[W],x[da]);L.push(I);w=w.concat(I)}for(K=0;K<j;K++){U=K/j;V=i*(1-U);U=l*Math.sin(U*Math.PI/
|
|
|
|
-2);z=0;for(J=t.length;z<J;z++)Y=c(t[z],M[z],U),g(Y.x,Y.y,-V);C=0;for(E=r.length;C<E;C++){x=r[C];I=L[C];z=0;for(J=x.length;z<J;z++)Y=c(x[z],I[z],U),g(Y.x,Y.y,-V)}}U=l;for(z=0;z<T;z++)Y=o?c(p[z],w[z],U):p[z],s?g(Y.x,Y.y+q[0].y,q[0].x):g(Y.x,Y.y,0);for(K=1;K<=m;K++)for(z=0;z<T;z++)Y=o?c(p[z],w[z],U):p[z],s?g(Y.x,Y.y+q[K-1].y,q[K-1].x):g(Y.x,Y.y,h/m*K);for(K=j-1;K>=0;K--){U=K/j;V=i*(1-U);U=l*Math.sin(U*Math.PI/2);z=0;for(J=t.length;z<J;z++)Y=c(t[z],M[z],U),g(Y.x,Y.y,h+V);C=0;for(E=r.length;C<E;C++){x=
|
|
|
|
-r[C];I=L[C];z=0;for(J=x.length;z<J;z++)Y=c(x[z],I[z],U),s?g(Y.x,Y.y+q[m-1].y,q[m-1].x+V):g(Y.x,Y.y,h+V)}}if(o){o=T*0;for(z=0;z<k;z++)l=n[z],f(l[2]+o,l[1]+o,l[0]+o);o=T*(m+j*2);for(z=0;z<k;z++)l=n[z],f(l[0]+o,l[1]+o,l[2]+o)}else{for(z=0;z<k;z++)l=n[z],f(l[2],l[1],l[0]);for(z=0;z<k;z++)l=n[z],f(l[0]+T*m,l[1]+T*m,l[2]+T*m)}var W,da,fa=0;e(t);fa+=t.length;C=0;for(E=r.length;C<E;C++)x=r[C],e(x),fa+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
|
|
|
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return 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+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(x=a.length;--x>=0;){X=x;ca=x-1;ca<0&&(ca=a.length-1);for(var b=
|
|
|
|
+0,c=m+j*2,b=0;b<c;b++){var d=V*b,e=V*(b+1),f=ea+X+d,g=ea+X+e,k=f,d=ea+ca+d,e=ea+ca+e,l=g;k+=J;d+=J;e+=J;l+=J;B.faces.push(new THREE.Face4(k,d,e,l,null,null,y));y&&(k=b/c,d=(b+1)/c,e=h+i*2,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 g(a,b,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=J;b+=J;c+=J;B.faces.push(new THREE.Face3(a,b,c,
|
|
|
|
+null,null,t));if(t){var d=A.maxY,e=A.maxX,f=B.vertices[b].position.x,b=B.vertices[b].position.y,g=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[a].position.x/e,B.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
|
|
|
|
+p=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,r=b.bendPath,n=b.extrudePath,q,s=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,y=b.extrudeMaterial,A=this.shapebb;if(n)q=n.getPoints(p),m=q.length,s=!0,o=!1;o||(l=i=j=0);var D,F,H,B=this,J=this.vertices.length;r&&a.addWrapPath(r);p=u?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();F=0;for(H=p.length;F<H;F++)D=p[F],THREE.Shape.Utils.isClockWise(D)&&
|
|
|
|
+(p[F]=D.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(r,p);u=r;F=0;for(H=p.length;F<H;F++)D=p[F],r=r.concat(D);var x,z,G,W,S,T,V=r.length,k=n.length,L=[];x=0;z=u.length;X=z-1;for(ca=x+1;x<z;x++,X++,ca++)X===z&&(X=0),ca===z&&(ca=0),L[x]=d(u[x],u[X],u[ca]);var K=[],v,M=L.concat();F=0;for(H=p.length;F<H;F++){D=p[F];v=[];x=0;z=D.length;X=z-1;for(ca=x+1;x<z;x++,X++,ca++)X===z&&(X=0),ca===z&&(ca=0),v[x]=d(D[x],D[X],D[ca]);K.push(v);M=M.concat(v)}for(G=0;G<j;G++){W=G/j;S=i*(1-W);W=l*Math.sin(W*Math.PI/
|
|
|
|
+2);x=0;for(z=u.length;x<z;x++)T=c(u[x],L[x],W),g(T.x,T.y,-S);F=0;for(H=p.length;F<H;F++){D=p[F];v=K[F];x=0;for(z=D.length;x<z;x++)T=c(D[x],v[x],W),g(T.x,T.y,-S)}}W=l;for(x=0;x<V;x++)T=o?c(r[x],M[x],W):r[x],s?g(T.x,T.y+q[0].y,q[0].x):g(T.x,T.y,0);for(G=1;G<=m;G++)for(x=0;x<V;x++)T=o?c(r[x],M[x],W):r[x],s?g(T.x,T.y+q[G-1].y,q[G-1].x):g(T.x,T.y,h/m*G);for(G=j-1;G>=0;G--){W=G/j;S=i*(1-W);W=l*Math.sin(W*Math.PI/2);x=0;for(z=u.length;x<z;x++)T=c(u[x],L[x],W),g(T.x,T.y,h+S);F=0;for(H=p.length;F<H;F++){D=
|
|
|
|
+p[F];v=K[F];x=0;for(z=D.length;x<z;x++)T=c(D[x],v[x],W),s?g(T.x,T.y+q[m-1].y,q[m-1].x+S):g(T.x,T.y,h+S)}}if(o){o=V*0;for(x=0;x<k;x++)l=n[x],f(l[2]+o,l[1]+o,l[0]+o);o=V*(m+j*2);for(x=0;x<k;x++)l=n[x],f(l[0]+o,l[1]+o,l[2]+o)}else{for(x=0;x<k;x++)l=n[x],f(l[2],l[1],l[0]);for(x=0;x<k;x++)l=n[x],f(l[0]+V*m,l[1]+V*m,l[2]+V*m)}var X,ca,ea=0;e(u);ea+=u.length;F=0;for(H=p.length;F<H;F++)D=p[F],e(D),ea+=D.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.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
|
|
THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
|
|
(Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
|
|
(Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
|
|
@@ -511,17 +511,17 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,l=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.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,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,l=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.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,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,l=[],j=[];for(i=0;i<=c;i++){var o=[],r=[];for(h=0;h<=b;h++){var m=h/b,p=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+p*f),a*Math.cos(g+p*f),a*Math.sin(d+m*e)*Math.sin(g+p*f))));o.push(this.vertices.length-1);r.push(new THREE.UV(m,p))}l.push(o);
|
|
|
|
-j.push(r)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],g=l[i+1][h],f=l[i+1][h+1],o=this.vertices[d].position.clone().normalize(),r=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),p=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),q=j[i][h].clone(),s=j[i+1][h].clone(),t=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[o,m,p])),this.faceVertexUvs[0].push([n,s,t])):Math.abs(this.vertices[g].position.y)==
|
|
|
|
-a?(this.faces.push(new THREE.Face3(d,e,g,[o,r,m])),this.faceVertexUvs[0].push([n,q,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,r,m,p])),this.faceVertexUvs[0].push([n,q,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,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,l=[],j=[];for(i=0;i<=c;i++){var o=[],p=[];for(h=0;h<=b;h++){var m=h/b,r=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+r*f),a*Math.cos(g+r*f),a*Math.sin(d+m*e)*Math.sin(g+r*f))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,r))}l.push(o);
|
|
|
|
+j.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],g=l[i+1][h],f=l[i+1][h+1],o=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),r=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),q=j[i][h].clone(),s=j[i+1][h].clone(),u=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[o,m,r])),this.faceVertexUvs[0].push([n,s,u])):Math.abs(this.vertices[g].position.y)==
|
|
|
|
+a?(this.faces.push(new THREE.Face3(d,e,g,[o,p,m])),this.faceVertexUvs[0].push([n,q,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,p,m,r])),this.faceVertexUvs[0].push([n,q,s,u]))}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=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)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=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)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=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,l,j,o,r,m,p,n,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
|
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(m,p,i,j);if(f=g[g.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++){var t=f/h,u=THREE.Shape.Utils.b2(t,o,m,i),t=THREE.Shape.Utils.b2(t,r,p,j);g.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,p=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,m,p,n,q),f=g[g.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++)t=f/h,u=THREE.Shape.Utils.b3(t,o,m,
|
|
|
|
-n,i),t=THREE.Shape.Utils.b3(t,r,p,q,j),g.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:g,path:e}}}};
|
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);j=l+1;e<=j&&(j=0);var r;a:{r=a;var m=i,p=l,n=j,q=e,s=f,t=void 0,u=void 0,v=void 0,
|
|
|
|
-B=void 0,x=void 0,C=void 0,E=void 0,G=void 0,R=void 0,u=r[s[m]].x,v=r[s[m]].y,B=r[s[p]].x,x=r[s[p]].y,C=r[s[n]].x,E=r[s[n]].y;if(1.0E-10>(B-u)*(E-v)-(x-v)*(C-u))r=!1;else{for(t=0;t<q;t++)if(!(t==m||t==p||t==n)){var G=r[s[t]].x,R=r[s[t]].y,z=void 0,J=void 0,K=void 0,U=void 0,V=void 0,Y=void 0,T=void 0,k=void 0,M=void 0,L=void 0,I=void 0,w=void 0,z=K=V=void 0,z=C-B,J=E-x,K=u-C,U=v-E,V=B-u,Y=x-v,T=G-u,k=R-v,M=G-B,L=R-x,I=G-C,w=R-E,z=z*L-J*M,V=V*k-Y*T,K=K*w-U*I;if(z>=0&&K>=0&&V>=0){r=!1;break a}}r=!0}}if(r){g.push([a[f[i]],
|
|
|
|
|
|
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,l,j,o,p,m,r,n,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
|
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(m,r,i,j);if(f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,t=THREE.Shape.Utils.b2(u,o,m,i),u=THREE.Shape.Utils.b2(u,p,r,j);g.push(new THREE.Vector2(t,u))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,r=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,m,r,n,q),f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,t=THREE.Shape.Utils.b3(u,o,m,
|
|
|
|
+n,i),u=THREE.Shape.Utils.b3(u,p,r,q,j),g.push(new THREE.Vector2(t,u))}}}return{offset:s.ha*c,points:g,path:e}}}};
|
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);j=l+1;e<=j&&(j=0);var p;a:{p=a;var m=i,r=l,n=j,q=e,s=f,u=void 0,t=void 0,y=void 0,
|
|
|
|
+A=void 0,D=void 0,F=void 0,H=void 0,B=void 0,J=void 0,t=p[s[m]].x,y=p[s[m]].y,A=p[s[r]].x,D=p[s[r]].y,F=p[s[n]].x,H=p[s[n]].y;if(1.0E-10>(A-t)*(H-y)-(D-y)*(F-t))p=!1;else{for(u=0;u<q;u++)if(!(u==m||u==r||u==n)){var B=p[s[u]].x,J=p[s[u]].y,x=void 0,z=void 0,G=void 0,W=void 0,S=void 0,T=void 0,V=void 0,k=void 0,L=void 0,K=void 0,v=void 0,M=void 0,x=G=S=void 0,x=F-A,z=H-D,G=t-F,W=y-H,S=A-t,T=D-y,V=B-t,k=J-y,L=B-A,K=J-D,v=B-F,M=J-H,x=x*K-z*L,S=S*k-T*V,G=G*M-W*v;if(x>=0&&G>=0&&S>=0){p=!1;break a}}p=!0}}if(p){g.push([a[f[i]],
|
|
a[f[l]],a[f[j]]]);h.push([f[i],f[l],f[j]]);i=l;for(j=l+1;j<e;i++,j++)f[i]=f[j];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
a[f[l]],a[f[j]]]);h.push([f[i],f[l],f[j]]);i=l;for(j=l+1;j<e;i++,j++)f[i]=f[j];e--;o=2*e}}if(d)return h;return g};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||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);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||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
|
|
this.tube*Math.sin(f);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,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
this.tube*Math.sin(f);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,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
@@ -530,13 +530,13 @@ THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,f){b=c/d*a;
|
|
this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
|
|
this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
|
|
e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,l,j])}this.computeCentroids();
|
|
e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,l,j])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?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;b-- >0;)this.smooth(a)};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?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;b-- >0;)this.smooth(a)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var m,l,n,o=0;o<4;o++){n=i[o];m=new THREE.Color;m.setRGB(0,0,0);for(var p=0;p<n.length;p++)l=h.vertexColors[n[p]-1],m.r+=l.r,m.g+=l.g,m.b+=l.b;m.r/=n.length;m.g/=n.length;m.b/=n.length;j.vertexColors[o]=m}}e.push(j);(!f.supportUVs||r.length!=0)&&g.push([r[a],r[b],r[c],r[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],j={},o={},r=[],m,p,n,q,s,t=a.faceVertexUvs[0];m=0;for(p=t.length;m<p;m++){n=0;for(q=t[m].length;n<q;n++)s=d[m]["abcd".charAt(n)],r[s]||(r[s]=t[m][n])}var u;m=0;for(p=d.length;m<p;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&r.length!=0){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=r[s.a].u+r[s.b].u+r[s.c].u,u.v=r[s.a].v+r[s.b].v+r[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
|
|
|
|
-r[s.a].u+r[s.b].u+r[s.c].u+r[s.d].u,u.v=r[s.a].v+r[s.b].v+r[s.c].v+r[s.d].v,u.u/=4,u.v/=4;r.push(u)}p=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(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 v=0,t=h.length,B,x,C={},E={},G=function(a,
|
|
|
|
-b){C[a]===void 0&&(C[a]=[]);C[a].push(b)},R=function(a,b){E[a]===void 0&&(E[a]={});E[a][b]=null};for(m in p){u=p[m];B=m.split("_");x=B[0];B=B[1];G(x,[x,B]);G(B,[x,B]);n=0;for(q=u.length;n<q;n++)s=u[n],R(x,s,m),R(B,s,m);u.length<2&&(o[m]=!0)}for(m in p)if(u=p[m],s=u[0],u=u[1],B=m.split("_"),x=B[0],B=B[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[x].position),q.addSelf(h[B].position),q.multiplyScalar(0.5)):(q.addSelf(l[s]),q.addSelf(l[u]),q.addSelf(h[x].position),q.addSelf(h[B].position),q.multiplyScalar(0.25)),
|
|
|
|
-j[m]=t+d.length+v,i.push(new THREE.Vertex(q)),v++,f.supportUVs&&r.length!=0)u=new THREE.UV,u.u=r[x].u+r[B].u,u.v=r[x].v+r[B].v,u.u/=2,u.v/=2,r.push(u);var z,J;B=["123","12","2","23"];q=["123","23","3","31"];var G=["123","31","1","12"],R=["1234","12","2","23"],K=["1234","23","3","34"],U=["1234","34","4","41"],V=["1234","41","1","12"];m=0;for(p=l.length;m<p;m++)s=d[m],u=t+m,s instanceof THREE.Face3?(v=c(s.a,s.b),x=c(s.b,s.c),z=c(s.c,s.a),b(u,j[v],s.b,j[x],s,B),b(u,j[x],s.c,j[z],s,q),b(u,j[z],s.a,j[v],
|
|
|
|
-s,G)):s instanceof THREE.Face4?(v=c(s.a,s.b),x=c(s.b,s.c),z=c(s.c,s.d),J=c(s.d,s.a),b(u,j[v],s.b,j[x],s,R),b(u,j[x],s.c,j[z],s,K),b(u,j[z],s.d,j[J],s,U),b(u,j[J],s.a,j[v],s,V)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(p=h.length;m<p;m++)if(C[m]!==void 0){i.set(0,0,0);j.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(n in E[m])i.addSelf(l[n]),u++;v=0;t=C[m].length;for(n=0;n<t;n++)o[c(C[m][n][0],C[m][n][1])]&&v++;if(v!=2){i.divideScalar(u);for(n=0;n<
|
|
|
|
-t;n++)u=C[m][n],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),j.addSelf(u);j.divideScalar(t);s.addSelf(h[m].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(j.multiplyScalar(2));s.divideScalar(t);d[m].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var m,l,n,o=0;o<4;o++){n=i[o];m=new THREE.Color;m.setRGB(0,0,0);for(var q=0;q<n.length;q++)l=h.vertexColors[n[q]-1],m.r+=l.r,m.g+=l.g,m.b+=l.b;m.r/=n.length;m.g/=n.length;m.b/=n.length;j.vertexColors[o]=m}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],j={},o={},p=[],m,r,n,q,s,u=a.faceVertexUvs[0];m=0;for(r=u.length;m<r;m++){n=0;for(q=u[m].length;n<q;n++)s=d[m]["abcd".charAt(n)],p[s]||(p[s]=u[m][n])}var t;m=0;for(r=d.length;m<r;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&p.length!=0){t=new THREE.UV;if(s instanceof THREE.Face3)t.u=p[s.a].u+p[s.b].u+p[s.c].u,t.v=p[s.a].v+p[s.b].v+p[s.c].v,t.u/=3,t.v/=3;else if(s instanceof THREE.Face4)t.u=
|
|
|
|
+p[s.a].u+p[s.b].u+p[s.c].u+p[s.d].u,t.v=p[s.a].v+p[s.b].v+p[s.c].v+p[s.d].v,t.u/=4,t.v/=4;p.push(t)}r=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(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 y=0,u=h.length,A,D,F={},H={},B=function(a,
|
|
|
|
+b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},J=function(a,b){H[a]===void 0&&(H[a]={});H[a][b]=null};for(m in r){t=r[m];A=m.split("_");D=A[0];A=A[1];B(D,[D,A]);B(A,[D,A]);n=0;for(q=t.length;n<q;n++)s=t[n],J(D,s,m),J(A,s,m);t.length<2&&(o[m]=!0)}for(m in r)if(t=r[m],s=t[0],t=t[1],A=m.split("_"),D=A[0],A=A[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[D].position),q.addSelf(h[A].position),q.multiplyScalar(0.5)):(q.addSelf(l[s]),q.addSelf(l[t]),q.addSelf(h[D].position),q.addSelf(h[A].position),q.multiplyScalar(0.25)),
|
|
|
|
+j[m]=u+d.length+y,i.push(new THREE.Vertex(q)),y++,f.supportUVs&&p.length!=0)t=new THREE.UV,t.u=p[D].u+p[A].u,t.v=p[D].v+p[A].v,t.u/=2,t.v/=2,p.push(t);var x,z;A=["123","12","2","23"];q=["123","23","3","31"];var B=["123","31","1","12"],J=["1234","12","2","23"],G=["1234","23","3","34"],W=["1234","34","4","41"],S=["1234","41","1","12"];m=0;for(r=l.length;m<r;m++)s=d[m],t=u+m,s instanceof THREE.Face3?(y=c(s.a,s.b),D=c(s.b,s.c),x=c(s.c,s.a),b(t,j[y],s.b,j[D],s,A),b(t,j[D],s.c,j[x],s,q),b(t,j[x],s.a,j[y],
|
|
|
|
+s,B)):s instanceof THREE.Face4?(y=c(s.a,s.b),D=c(s.b,s.c),x=c(s.c,s.d),z=c(s.d,s.a),b(t,j[y],s.b,j[D],s,J),b(t,j[D],s.c,j[x],s,G),b(t,j[x],s.d,j[z],s,W),b(t,j[z],s.a,j[y],s,S)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(r=h.length;m<r;m++)if(F[m]!==void 0){i.set(0,0,0);j.set(0,0,0);s=new THREE.Vector3(0,0,0);t=0;for(n in H[m])i.addSelf(l[n]),t++;y=0;u=F[m].length;for(n=0;n<u;n++)o[c(F[m][n][0],F[m][n][1])]&&y++;if(y!=2){i.divideScalar(t);for(n=0;n<
|
|
|
|
+u;n++)t=F[m][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(j.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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,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?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,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?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":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=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":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=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -544,124 +544,125 @@ a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this
|
|
if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
|
|
if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
|
|
if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=g(a.colorDiffuse);
|
|
if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=g(a.colorDiffuse);
|
|
else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(l.uniforms),o=f.color;h=f.specular;i=f.ambient;var r=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
|
|
|
|
-f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(o);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=r;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
|
|
|
+a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(l.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
|
|
|
|
+f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(o);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=p;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
|
|
f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
|
|
g.responseType="arraybuffer";g.send(null)};
|
|
g.responseType="arraybuffer";g.send(null)};
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,k,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=u[e*2];e=u[e*2+1];i=u[f*2];k=u[f*2+1];f=u[g*2];j=u[g*2+1];g=n.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,k));m.push(new THREE.UV(f,j));g.push(m)}}
|
|
|
|
-function j(b,c){var d,e,f,g,h,i,k,j,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=u[e*2];e=u[e*2+1];k=u[f*2];l=u[f*2+1];j=u[g*2];m=u[g*2+1];g=u[h*2];f=u[h*2+1];h=n.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,l));p.push(new THREE.UV(j,m));p.push(new THREE.UV(g,f));h.push(p)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
|
|
|
|
-f,g,null,null,h))}function r(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=k[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,k,j,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[e*3];g=c[e*3+1];h=c[e*3+2];k=d[e*3];j=d[e*3+1];l=d[e*3+2];i=m[e];var o=t[j*3],p=t[j*3+1];j=t[j*3+2];var q=t[l*3],r=t[l*3+1];l=t[l*3+2];n.faces.push(new THREE.Face3(f,
|
|
|
|
-g,h,[new THREE.Vector3(t[k*3],t[k*3+1],t[k*3+2]),new THREE.Vector3(o,p,j),new THREE.Vector3(q,r,l)],null,i))}}function p(b,c,d,e){for(var f,g,h,i,k,j,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];j=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];k=p[e];var q=t[l*3],r=t[l*3+1];l=t[l*3+2];var s=t[m*3],u=t[m*3+1];m=t[m*3+2];var v=t[o*3],x=t[o*3+1];o=t[o*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(t[j*
|
|
|
|
-3],t[j*3+1],t[j*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(s,u,m),new THREE.Vector3(v,x,o)],null,k))}}var n=this,q=0,s,t=[],u=[],v,B,x,C,E,G;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature: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,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
|
|
|
|
-q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;G=s.vertex_index_bytes*
|
|
|
|
-4+s.material_index_bytes;v=s.ntri_flat*b;B=s.ntri_smooth*(b+s.normal_index_bytes*3);x=s.ntri_flat_uv*(b+s.uv_index_bytes*3);C=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);E=s.nquad_flat*G;b=s.nquad_smooth*(G+s.normal_index_bytes*4);G=s.nquad_flat_uv*(G+s.uv_index_bytes*4);q+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
|
|
|
|
-q+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],t.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(s.nnormals*3);q+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],u.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);v=q+v+c(s.ntri_flat*2);B=v+B+c(s.ntri_smooth*2);x=B+x+c(s.ntri_flat_uv*2);C=x+C+c(s.ntri_smooth_uv*2);E=C+E+c(s.nquad_flat*2);
|
|
|
|
-b=E+b+c(s.nquad_smooth*2);G=b+G+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(B);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(x);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
|
|
|
|
-c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(G);(function(a){var b=s.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=s.nquad_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(C);(function(a){var b=
|
|
|
|
-s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(E);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){X=a;d=d||O;e!==void 0&&(a=e.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");aa=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",E,"material");ka=b("//dae:library_effects/dae:effect",K,"effect");na=b("//dae:library_geometries/dae:geometry",q,"geometry");ca=b("//dae:library_controllers/dae:controller",h,"controller");pa=b("//dae:library_animations/dae:animation",V,"animation");la=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
-j,"visual_scene");xa=[];ua=[];(a=X.evaluate(".//dae:scene/dae:instance_visual_scene",X,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),$=la[a]):$=null;S=new THREE.Object3D;for(a=0;a<$.nodes.length;a++)S.add(g($.nodes[a]));c();for(var i in pa);i={scene:S,morphs:xa,skins:ua,dae:{images:aa,materials:sa,effects:ka,geometries:na,controllers:ca,animations:pa,visualScenes:la,scene:$}};d&&d(i);return i}function b(a,b,c){for(var a=X.evaluate(a,X,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
-null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(){var a=1E6,b=-a,c=0,d;for(d in pa)for(var e=pa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}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,e){var f=ca[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 g=c(),b=$.getChildById(b.skeleton[0],!0)||$.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
|
|
|
|
-for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
|
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ca[a.controllers[f].url];switch(i.type){case "skin":if(na[i.skin.source]){var j=
|
|
|
|
-new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ca[i.skin.source]&&(d=i=ca[i.skin.source],i.morph&&na[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(na[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
|
|
|
|
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=na[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=ka[sa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
|
|
|
|
-i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ca[c.url],j.skinInstanceController=c,j.name="skin_"+ua.length,ua.push(j);else if(d!==void 0){h=i;k=d instanceof m?ca[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(p=na[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
|
|
|
|
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+xa.length;xa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){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 l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function r(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
|
|
|
|
-"";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function B(){this.input={}}function x(){this.semantic=
|
|
|
|
-"";this.offset=0;this.source="";this.set=0}function C(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function R(a,b){this.type=a;this.effect=b;this.material=null}function z(a){this.effect=a;this.format=this.init_from=null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
|
|
|
|
-this.source=null}function K(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function U(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Y(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function T(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function k(a){var b=a.getAttribute("id");
|
|
|
|
-if(ba[b]!=void 0)return ba[b];ba[b]=(new C(b)).parse(a);return ba[b]}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=w(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function I(a){for(var a=w(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function w(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function da(a,b){if(a===
|
|
|
|
-void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function fa(a,b){var c="";c+=da(a.x,b)+",";c+=da(a.y,b)+",";c+=da(a.z,b);return c}var X=null,S=null,$,O=null,ba={},aa={},pa={},ca={},na={},sa={},ka={},la,ya,xa,ua,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")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 l).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(e.nodeType==1)switch(e.nodeName){case "source":e=(new C).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(d.nodeType==1)switch(d.nodeName){case "input":b.push((new x).parse(d))}}return b};
|
|
|
|
-l.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(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=L(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new C).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};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
|
|
|
|
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new x).parse(g));break;case "v":c=I(g.textContent);break;case "vcount":d=I(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){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]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.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};j.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};j.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(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.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=e.indexOf(".")>=0,g=e.indexOf("(")>=0,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};o.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};o.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};o.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};o.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=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).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=X.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",X,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new r).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in pa)for(var e=pa[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=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
|
|
|
|
-this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
|
|
|
|
-this.transforms[a].matrix)};r.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};r.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
|
|
|
|
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.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(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=X.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};p.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(c.nodeType==1&&c.nodeName=="bind_material"){if(a=X.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).parse(b)),b=a.iterateNext();break}}return this};q.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){function b(a,c){var d=fa(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":k(d);break;case "vertices":this.vertices=(new B).parse(d);break;case "triangles":this.primitives.push((new u).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(d))}}var e=
|
|
|
|
-{};this.geometry3js=new THREE.Geometry;d=ba[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
|
|
|
|
-return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=ba[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=fa(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
|
|
|
|
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
|
|
|
|
-e[1],e[2]]);d+=h.length*n}};t.prototype=new u;t.prototype.constructor=t;u.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};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=W(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 x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
|
|
|
|
-I(c.textContent);break;case "p":this.p=I(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=W(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
|
|
|
|
-"input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=W(a,"set",-1);this.offset=W(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};C.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=w(c.textContent),
|
|
|
|
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=w(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};
|
|
|
|
-C.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),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new U).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=L(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")}}return this};R.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=X.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};R.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof G)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=aa[this.effect.surface.init_from]))a.map=
|
|
|
|
-THREE.ImageUtils.loadTexture(ya+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?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)};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
|
-if(c.nodeType==1)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};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)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};K.prototype.create=function(){if(this.shader==null)return null};K.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(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
|
-K.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new z(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new J(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};K.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)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};K.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new R(c.nodeName,this)).parse(c)}}};U.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};V.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(c.nodeType==1)switch(c.nodeName){case "source":c=(new C).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new T(this)).parse(c));break;case "channel":this.channel.push((new Y(this)).parse(c))}}return this};Y.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=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};T.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(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
|
|
|
|
-T.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();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}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
|
|
|
|
-200))O=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){za=a},applySkin:e,geometries:na}};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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,j,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];l=t[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,l));g.push(o)}}
|
|
|
|
+function j(b,c){var d,e,f,g,h,i,j,l,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];m=t[f*2+1];l=t[g*2];o=t[g*2+1];g=t[h*2];f=t[h*2+1];h=n.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(l,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
|
|
|
|
+f,g,null,null,h))}function p(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,j,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[l*3],q=u[l*3+1];l=u[l*3+2];var r=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
|
|
|
|
+g,h,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m)],null,i))}}function r(b,c,d,e){for(var f,g,h,i,j,l,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];j=q[e];var r=u[m*3],s=u[m*3+1];m=u[m*3+2];var t=u[o*3],y=u[o*3+1];o=u[o*3+2];var A=u[p*3],B=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[l*
|
|
|
|
+3],u[l*3+1],u[l*3+2]),new THREE.Vector3(r,s,m),new THREE.Vector3(t,y,o),new THREE.Vector3(A,B,p)],null,j))}}var n=this,q=0,s,u=[],t=[],y,A,D,F,H,B;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature: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,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
|
|
|
|
+q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;B=s.vertex_index_bytes*
|
|
|
|
+4+s.material_index_bytes;y=s.ntri_flat*b;A=s.ntri_smooth*(b+s.normal_index_bytes*3);D=s.ntri_flat_uv*(b+s.uv_index_bytes*3);F=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);H=s.nquad_flat*B;b=s.nquad_smooth*(B+s.normal_index_bytes*4);B=s.nquad_flat_uv*(B+s.uv_index_bytes*4);q+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
|
|
|
|
+q+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(s.nnormals*3);q+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);y=q+y+c(s.ntri_flat*2);A=y+A+c(s.ntri_smooth*2);D=A+D+c(s.ntri_flat_uv*2);F=D+F+c(s.ntri_smooth_uv*2);H=F+H+c(s.nquad_flat*2);
|
|
|
|
+b=H+b+c(s.nquad_smooth*2);B=b+B+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(A);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(D);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
|
|
|
|
+c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(B);(function(a){var b=s.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(y);(function(a){var b=s.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(F);(function(a){var b=
|
|
|
|
+s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(H);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){aa=a;d=d||P;e!==void 0&&(a=e.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",H,"material");ja=b("//dae:library_effects/dae:effect",G,"effect");ma=b("//dae:library_geometries/dae:geometry",q,"geometry");ba=b("//dae:library_controllers/dae:controller",h,"controller");oa=b("//dae:library_animations/dae:animation",S,"animation");ka=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
+j,"visual_scene");ua=[];va=[];(a=aa.evaluate(".//dae:scene/dae:instance_visual_scene",aa,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),I=ka[a]):I=null;U=new THREE.Object3D;for(a=0;a<I.nodes.length;a++)U.add(g(I.nodes[a]));c();for(var i in oa);i={scene:U,morphs:ua,skins:va,dae:{images:Z,materials:sa,effects:ja,geometries:ma,controllers:ba,animations:oa,visualScenes:ka,scene:I}};d&&d(i);return i}function b(a,b,c){for(var a=aa.evaluate(a,aa,L,
|
|
|
|
+XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(){var a=1E6,b=-a,c=0,d;for(d in oa)for(var e=oa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}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,e){var 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 g=c(),b=I.getChildById(b.skeleton[0],!0)||I.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
|
|
|
|
+m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
|
|
|
|
+0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=
|
|
|
|
+new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ba[a.controllers[f].url];switch(i.type){case "skin":if(ma[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ba[i.skin.source]&&(d=i=ba[i.skin.source],i.morph&&ma[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ma[i.morph.source])j=new n,
|
|
|
|
+j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ma[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=ja[sa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=
|
|
|
|
+p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)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_"+va.length,va.push(j);else if(d!==void 0){h=i;k=d instanceof m?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(p=ma[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ua.length;ua.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
|
+b.scale);for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){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 l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
|
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function t(){this.material="";this.count=
|
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function D(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function H(){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.texcoord=this.texture=null}function J(a,
|
|
|
|
+b){this.type=a;this.effect=b;this.material=null}function x(a){this.effect=a;this.format=this.init_from=null}function z(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function G(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function W(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
|
+this.dotSyntax=this.sid=null}function V(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function k(a){var b=a.getAttribute("id");if($[b]!=void 0)return $[b];$[b]=(new F(b)).parse(a);return $[b]}function L(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function K(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function v(a){for(var a=M(a),b=[],c=0;c<
|
|
|
|
+a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function X(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ca(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ea(a,b){var c="";c+=ca(a.x,b)+",";c+=ca(a.y,b)+",";c+=ca(a.z,b);return c}var aa=null,U=null,I,P=null,
|
|
|
|
+$={},Z={},oa={},ba={},ma={},sa={},ja={},ka,ya,ua,va,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")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 l).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(e.nodeType==1)switch(e.nodeName){case "source":e=(new F).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(d.nodeType==1)switch(d.nodeName){case "input":b.push((new D).parse(d))}}return b};l.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(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
|
+K(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new F).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};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
|
+(new D).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new D).parse(g));break;case "v":c=v(g.textContent);break;case "vcount":d=v(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){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]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.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};j.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};j.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(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.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=e.indexOf(".")>=0,g=e.indexOf("(")>=0,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};o.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};o.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};o.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};o.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=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
|
+1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).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=aa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",aa,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
|
|
|
|
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in oa)for(var e=oa[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=
|
|
|
|
+1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?
|
|
|
|
+g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=K(a.textContent);this.updateMatrix();return this};
|
|
|
|
+p.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
|
|
|
|
+this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.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(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=aa.evaluate(".//dae:instance_material",c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
+null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.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(c.nodeType==1&&c.nodeName=="bind_material"){if(a=aa.evaluate(".//dae:instance_material",
|
|
|
|
+c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};q.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){function b(a,c){var d=ea(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=
|
|
|
|
+0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":k(d);break;case "vertices":this.vertices=(new A).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=$[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+
|
|
|
|
+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<
|
|
|
|
+g.length;){var p=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=$[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ea(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],
|
|
|
|
+l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};u.prototype=new t;u.prototype.constructor=u;t.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};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=X(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 D).parse(a.childNodes[b]));break;case "vcount":this.vcount=v(c.textContent);break;case "p":this.p=v(c.textContent)}}return this};y.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=X(a,"count",0);this.stride=
|
|
|
|
+X(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new D).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};D.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
|
+"");this.set=X(a,"set",-1);this.offset=X(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.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=M(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=K(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
|
+v(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new y).parse(c.childNodes[d]);break}}}return this};F.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),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new W).parse(a.childNodes[b]);break}return this};B.prototype.isColor=
|
|
|
|
+function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=K(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")}}return this};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
|
+a.childNodes[b];if(c.nodeType==1)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=aa.evaluate(".//dae:float",c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};J.prototype.create=function(){var a=
|
|
|
|
+{},b=this.transparency!==void 0&&this.transparency<1,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&&(d=Z[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ya+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?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=wa;return this.material=new THREE.MeshLambertMaterial(a)};x.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)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};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)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};
|
|
|
|
+G.prototype.create=function(){if(this.shader==null)return null};G.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(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};G.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=
|
|
|
|
+(new x(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new z(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};G.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)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};
|
|
|
|
+G.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};W.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.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(c.nodeType==1)switch(c.nodeName){case "source":c=
|
|
|
|
+(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new V(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.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=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=
|
|
|
|
+parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};V.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(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new D).parse(c))}}return this};V.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();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}};return{load:function(b,c){if(document.implementation&&
|
|
|
|
+document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))P=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:e,geometries:ma}};
|
|
|
|
+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 g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
|
|
g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,l,j,o,r,m,p,n,q,s,t,u,v=a.faces;o=a.vertices;var B=a.normals,x=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(j=o.length;l<
|
|
|
|
-j;)r=new THREE.Vertex,r.position.x=o[l++]*b,r.position.y=o[l++]*b,r.position.z=o[l++]*b,d.vertices.push(r);l=0;for(j=v.length;l<j;){b=v[l++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;r=b&32;n=b&64;b&=128;o?(q=new THREE.Face4,q.a=v[l++],q.b=v[l++],q.c=v[l++],q.d=v[l++],o=4):(q=new THREE.Face3,q.a=v[l++],q.b=v[l++],q.c=v[l++],o=3);if(i)i=v[l++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<C;c++)s=a.uvs[c],p=v[l++],u=s[p*2],p=s[p*2+1],d.faceUvs[c][i]=new THREE.UV(u,p);if(e)for(c=0;c<C;c++){s=a.uvs[c];t=[];
|
|
|
|
-for(e=0;e<o;e++)p=v[l++],u=s[p*2],p=s[p*2+1],t[e]=new THREE.UV(u,p);d.faceVertexUvs[c][i]=t}if(m)m=v[l++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],q.normal=e;if(r)for(c=0;c<o;c++)m=v[l++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],q.vertexNormals.push(e);if(n)r=v[l++],r=new THREE.Color(x[r]),q.color=r;if(b)for(c=0;c<o;c++)r=v[l++],r=new THREE.Color(x[r]),q.vertexColors.push(r);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(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){b=0;for(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(a.morphTargets!==void 0){var c,e,i,l,j,o,r,m,p;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
|
|
|
|
-p=a.morphTargets[c].vertices;i=0;for(l=p.length;i<l;i+=3)j=p[i]*b,o=p[i+1]*b,r=p[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,o,r)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(j[b],j[b+1],j[b+2]),l.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,l,j,o,p,m,r,n,q,s,u,t,y=a.faces;o=a.vertices;var A=a.normals,D=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(j=o.length;l<
|
|
|
|
+j;)p=new THREE.Vertex,p.position.x=o[l++]*b,p.position.y=o[l++]*b,p.position.z=o[l++]*b,d.vertices.push(p);l=0;for(j=y.length;l<j;){b=y[l++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(q=new THREE.Face4,q.a=y[l++],q.b=y[l++],q.c=y[l++],q.d=y[l++],o=4):(q=new THREE.Face3,q.a=y[l++],q.b=y[l++],q.c=y[l++],o=3);if(i)i=y[l++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<F;c++)s=a.uvs[c],r=y[l++],t=s[r*2],r=s[r*2+1],d.faceUvs[c][i]=new THREE.UV(t,r);if(e)for(c=0;c<F;c++){s=a.uvs[c];u=[];
|
|
|
|
+for(e=0;e<o;e++)r=y[l++],t=s[r*2],r=s[r*2+1],u[e]=new THREE.UV(t,r);d.faceVertexUvs[c][i]=u}if(m)m=y[l++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],q.normal=e;if(p)for(c=0;c<o;c++)m=y[l++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],q.vertexNormals.push(e);if(n)p=y[l++],p=new THREE.Color(D[p]),q.color=p;if(b)for(c=0;c<o;c++)p=y[l++],p=new THREE.Color(D[p]),q.vertexColors.push(p);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(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){b=0;for(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(a.morphTargets!==void 0){var c,e,i,l,j,o,p,m,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
|
|
|
|
+r=a.morphTargets[c].vertices;i=0;for(l=r.length;i<l;i+=3)j=r[i]*b,o=r[i+1]*b,p=r[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,o,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(j[b],j[b+1],j[b+2]),l.push(o)}}})(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;
|
|
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(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
|
|
d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(r in K.objects)if(!M.objects[r])if(s=K.objects[r],s.geometry!==void 0){if(G=M.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)J=M.materials[s.materials[I]],a=J instanceof THREE.ShaderMaterial;a&&G.computeTangents();v=s.position;B=s.rotation;x=s.quaternion;C=s.scale;x=0;J.length==0&&(J=new THREE.MeshFaceMaterial);J.length>1&&(J=new THREE.MeshFaceMaterial);
|
|
|
|
-a=new THREE.Mesh(G,J);a.name=r;a.position.set(v[0],v[1],v[2]);x?(a.quaternion.set(x[0],x[1],x[2],x[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]);a.scale.set(C[0],C[1],C[2]);a.visible=s.visible;M.scene.add(a);M.objects[r]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);M.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(G),M.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
|
|
|
|
-{type:s.trigger,object:s},M.triggers[a.name]=b)}}else v=s.position,B=s.rotation,x=s.quaternion,C=s.scale,x=0,a=new THREE.Object3D,a.name=r,a.position.set(v[0],v[1],v[2]),x?(a.quaternion.set(x[0],x[1],x[2],x[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]),a.scale.set(C[0],C[1],C[2]),a.visible=s.visible!==void 0?s.visible:!1,M.scene.add(a),M.objects[r]=a,M.empties[r]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},M.triggers[a.name]=b)}function g(a){return function(b){M.geometries[a]=
|
|
|
|
-b;e();V-=1;i.onLoadComplete();h()}}function f(a){return function(b){M.geometries[a]=b}}function h(){i.callbackProgress({totalModels:T,totalTextures:k,loadedModels:T-V,loadedTextures:k-Y},M);i.onLoadProgress();V==0&&Y==0&&b(M)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),j,o,r,m,p,n,q,s,t,u,v,B,x,C,E,G,R,z,J,K,U,V,Y,T,k,M;K=a;c=new THREE.BinaryLoader;U=new THREE.JSONLoader;Y=V=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
|
-empties:{}};a=!1;for(r in K.objects)if(s=K.objects[r],s.meshCollider){a=!0;break}if(a)M.scene.collisions=new THREE.CollisionSystem;if(K.transform){a=K.transform.position;t=K.transform.rotation;var L=K.transform.scale;a&&M.scene.position.set(a[0],a[1],a[2]);t&&M.scene.rotation.set(t[0],t[1],t[2]);L&&M.scene.scale.set(L[0],L[1],L[2]);(a||t||L)&&M.scene.updateMatrix()}a=function(){Y-=1;h();i.onLoadComplete()};for(p in K.cameras)t=K.cameras[p],t.type=="perspective"?R=new THREE.PerspectiveCamera(t.fov,
|
|
|
|
-t.aspect,t.near,t.far):t.type=="ortho"&&(R=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far)),v=t.position,t=t.target,R.position.set(v[0],v[1],v[2]),R.target=new THREE.Vector3(t[0],t[1],t[2]),M.cameras[p]=R;for(m in K.lights)t=K.lights[m],p=t.color!==void 0?t.color:16777215,R=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(v=t.direction,u=new THREE.DirectionalLight(p,R),u.position.set(v[0],v[1],v[2]),u.position.normalize()):t.type=="point"?(v=t.position,u=t.distance,
|
|
|
|
-u=new THREE.PointLight(p,R,u),u.position.set(v[0],v[1],v[2])):t.type=="ambient"&&(u=new THREE.AmbientLight(p)),M.scene.add(u),M.lights[m]=u;for(n in K.fogs)m=K.fogs[n],m.type=="linear"?z=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(z=new THREE.FogExp2(0,m.density)),t=m.color,z.color.setRGB(t[0],t[1],t[2]),M.fogs[n]=z;if(M.cameras&&K.defaults.camera)M.currentCamera=M.cameras[K.defaults.camera];if(M.fogs&&K.defaults.fog)M.scene.fog=M.fogs[K.defaults.fog];t=K.defaults.bgcolor;M.bgColor=new THREE.Color;
|
|
|
|
-M.bgColor.setRGB(t[0],t[1],t[2]);M.bgColorAlpha=K.defaults.bgalpha;for(j in K.geometries)if(n=K.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")V+=1,i.onLoadStart();T=V;for(j in K.geometries)n=K.geometries[j],n.type=="cube"?(G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),M.geometries[j]=G):n.type=="plane"?(G=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),M.geometries[j]=G):n.type=="sphere"?
|
|
|
|
-(G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),M.geometries[j]=G):n.type=="cylinder"?(G=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),M.geometries[j]=G):n.type=="torus"?(G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),M.geometries[j]=G):n.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(n.subdivisions),M.geometries[j]=G):n.type=="bin_mesh"?c.load(d(n.url,K.urlBaseType),g(j)):n.type=="ascii_mesh"?U.load(d(n.url,K.urlBaseType),
|
|
|
|
-g(j)):n.type=="embedded_mesh"&&(n=K.embeds[n.id])&&U.createModel(n,f(j),"");for(q in K.textures)if(j=K.textures[q],j.url instanceof Array){Y+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else Y+=1,i.onLoadStart();k=Y;for(q in K.textures){j=K.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var I=0;I<j.url.length;I++)n[I]=d(j.url[I],K.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
|
|
|
|
-K.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(z[j.wrap[0]]!==void 0)n.wrapS=z[j.wrap[0]];if(z[j.wrap[1]]!==void 0)n.wrapT=
|
|
|
|
-z[j.wrap[1]]}}M.textures[q]=n}for(o in K.materials){q=K.materials[o];for(E in q.parameters)if(E=="envMap"||E=="map"||E=="lightMap")q.parameters[E]=M.textures[q.parameters[E]];else if(E=="shading")q.parameters[E]=q.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")q.parameters[E]=THREE[q.parameters[E]]?THREE[q.parameters[E]]:THREE.NormalBlending;else if(E=="combine")q.parameters[E]=q.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(E==
|
|
|
|
-"vertexColors")if(q.parameters[E]=="face")q.parameters[E]=THREE.FaceColors;else if(q.parameters[E])q.parameters[E]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=q.parameters.color;z=q.parameters.specular;c=q.parameters.ambient;U=q.parameters.shininess;a.tNormal.texture=M.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
|
-q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=M.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(z);a.uAmbientColor.value.setHex(c);a.uShininess.value=U;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
|
|
|
|
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);M.materials[o]=q}e();i.callbackSync(M);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 b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(p in G.objects)if(!L.objects[p])if(s=G.objects[p],s.geometry!==void 0){if(B=L.geometries[s.geometry]){a=!1;for(v=0;v<s.materials.length;v++)z=L.materials[s.materials[v]],a=z instanceof THREE.ShaderMaterial;a&&B.computeTangents();y=s.position;A=s.rotation;D=s.quaternion;F=s.scale;D=0;z.length==0&&(z=new THREE.MeshFaceMaterial);z.length>1&&(z=new THREE.MeshFaceMaterial);
|
|
|
|
+a=new THREE.Mesh(B,z);a.name=p;a.position.set(y[0],y[1],y[2]);D?(a.quaternion.set(D[0],D[1],D[2],D[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]);a.scale.set(F[0],F[1],F[2]);a.visible=s.visible;L.scene.add(a);L.objects[p]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);L.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(B),L.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
|
|
|
|
+{type:s.trigger,object:s},L.triggers[a.name]=b)}}else y=s.position,A=s.rotation,D=s.quaternion,F=s.scale,D=0,a=new THREE.Object3D,a.name=p,a.position.set(y[0],y[1],y[2]),D?(a.quaternion.set(D[0],D[1],D[2],D[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]),a.scale.set(F[0],F[1],F[2]),a.visible=s.visible!==void 0?s.visible:!1,L.scene.add(a),L.objects[p]=a,L.empties[p]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},L.triggers[a.name]=b)}function g(a){return function(b){L.geometries[a]=
|
|
|
|
+b;e();S-=1;i.onLoadComplete();h()}}function f(a){return function(b){L.geometries[a]=b}}function h(){i.callbackProgress({totalModels:V,totalTextures:k,loadedModels:V-S,loadedTextures:k-T},L);i.onLoadProgress();S==0&&T==0&&b(L)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),j,o,p,m,r,n,q,s,u,t,y,A,D,F,H,B,J,x,z,G,W,S,T,V,k,L;G=a;c=new THREE.BinaryLoader;W=new THREE.JSONLoader;T=S=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
|
+empties:{}};a=!1;for(p in G.objects)if(s=G.objects[p],s.meshCollider){a=!0;break}if(a)L.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;u=G.transform.rotation;var K=G.transform.scale;a&&L.scene.position.set(a[0],a[1],a[2]);u&&L.scene.rotation.set(u[0],u[1],u[2]);K&&L.scene.scale.set(K[0],K[1],K[2]);(a||u||K)&&L.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(r in G.cameras)u=G.cameras[r],u.type=="perspective"?J=new THREE.PerspectiveCamera(u.fov,
|
|
|
|
+u.aspect,u.near,u.far):u.type=="ortho"&&(J=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),y=u.position,u=u.target,J.position.set(y[0],y[1],y[2]),J.target=new THREE.Vector3(u[0],u[1],u[2]),L.cameras[r]=J;for(m in G.lights)u=G.lights[m],r=u.color!==void 0?u.color:16777215,J=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(y=u.direction,t=new THREE.DirectionalLight(r,J),t.position.set(y[0],y[1],y[2]),t.position.normalize()):u.type=="point"?(y=u.position,t=u.distance,
|
|
|
|
+t=new THREE.PointLight(r,J,t),t.position.set(y[0],y[1],y[2])):u.type=="ambient"&&(t=new THREE.AmbientLight(r)),L.scene.add(t),L.lights[m]=t;for(n in G.fogs)m=G.fogs[n],m.type=="linear"?x=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(x=new THREE.FogExp2(0,m.density)),u=m.color,x.color.setRGB(u[0],u[1],u[2]),L.fogs[n]=x;if(L.cameras&&G.defaults.camera)L.currentCamera=L.cameras[G.defaults.camera];if(L.fogs&&G.defaults.fog)L.scene.fog=L.fogs[G.defaults.fog];u=G.defaults.bgcolor;L.bgColor=new THREE.Color;
|
|
|
|
+L.bgColor.setRGB(u[0],u[1],u[2]);L.bgColorAlpha=G.defaults.bgalpha;for(j in G.geometries)if(n=G.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")S+=1,i.onLoadStart();V=S;for(j in G.geometries)n=G.geometries[j],n.type=="cube"?(B=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),L.geometries[j]=B):n.type=="plane"?(B=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),L.geometries[j]=B):n.type=="sphere"?
|
|
|
|
+(B=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),L.geometries[j]=B):n.type=="cylinder"?(B=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),L.geometries[j]=B):n.type=="torus"?(B=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),L.geometries[j]=B):n.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(n.subdivisions),L.geometries[j]=B):n.type=="bin_mesh"?c.load(d(n.url,G.urlBaseType),g(j)):n.type=="ascii_mesh"?W.load(d(n.url,G.urlBaseType),
|
|
|
|
+g(j)):n.type=="embedded_mesh"&&(n=G.embeds[n.id])&&W.createModel(n,f(j),"");for(q in G.textures)if(j=G.textures[q],j.url instanceof Array){T+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();k=T;for(q in G.textures){j=G.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var v=0;v<j.url.length;v++)n[v]=d(j.url[v],G.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
|
|
|
|
+G.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){x={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(x[j.wrap[0]]!==void 0)n.wrapS=x[j.wrap[0]];if(x[j.wrap[1]]!==void 0)n.wrapT=
|
|
|
|
+x[j.wrap[1]]}}L.textures[q]=n}for(o in G.materials){q=G.materials[o];for(H in q.parameters)if(H=="envMap"||H=="map"||H=="lightMap")q.parameters[H]=L.textures[q.parameters[H]];else if(H=="shading")q.parameters[H]=q.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")q.parameters[H]=THREE[q.parameters[H]]?THREE[q.parameters[H]]:THREE.NormalBlending;else if(H=="combine")q.parameters[H]=q.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==
|
|
|
|
+"vertexColors")if(q.parameters[H]=="face")q.parameters[H]=THREE.FaceColors;else if(q.parameters[H])q.parameters[H]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=q.parameters.color;x=q.parameters.specular;c=q.parameters.ambient;W=q.parameters.shininess;a.tNormal.texture=L.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
|
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=L.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(x);a.uAmbientColor.value.setHex(c);a.uShininess.value=W;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
|
|
|
|
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);L.materials[o]=q}e();i.callbackSync(L);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=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?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=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
|
|
b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
|
|
THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],j=[];(function(a,f,i){for(var j,l,q,s=a.length;i<s;i+=f)j=a[i],l=a[i+1],q=a[i+2],j=j/16383*c,l=l/16383*c,q=q/16383*c,j+=d,l+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,l,q)))})(f[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,j.push(d,1-e)})(f[0],8,3);(function(a,
|
|
THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],j=[];(function(a,f,i){for(var j,l,q,s=a.length;i<s;i+=f)j=a[i],l=a[i+1],q=a[i+2],j=j/16383*c,l=l/16383*c,q=q/16383*c,j+=d,l+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,l,q)))})(f[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,j.push(d,1-e)})(f[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,l.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,u,v,B=a.length;for(c=0;c<B;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;v=e;i=f;t=d;var x=e,C=f,E=g.materials[0],G=l[x*3],R=l[x*3+1],x=l[x*3+2],z=l[C*3],J=l[C*3+1],C=l[C*3+2];t=new THREE.Vector3(l[t*3],l[t*3+1],l[t*3+2]);x=new THREE.Vector3(G,R,x);C=new THREE.Vector3(z,J,C);g.faces.push(new THREE.Face3(u,v,i,[t,x,C],null,E));g=j[d*2];d=j[d*2+
|
|
|
|
-1];i=j[e*2];t=j[e*2+1];u=j[f*2];v=j[f*2+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(u,v));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
|
|
|
+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,l.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,u,t,y,A=a.length;for(c=0;c<A;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;y=e;i=f;u=d;var D=e,F=f,H=g.materials[0],B=l[D*3],J=l[D*3+1],D=l[D*3+2],x=l[F*3],z=l[F*3+1],F=l[F*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);D=new THREE.Vector3(B,J,D);F=new THREE.Vector3(x,z,F);g.faces.push(new THREE.Face3(t,y,i,[u,D,F],null,H));g=j[d*2];d=j[d*2+
|
|
|
|
+1];i=j[e*2];u=j[e*2+1];t=j[f*2];y=j[f*2+1];f=b.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(t,y));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
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(this.size3*3);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(this.size3*3);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(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=l;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=l;b=a+this.yd*
|
|
this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=l;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=l;b=a+this.yd*
|
|
3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=l+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(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],
|
|
3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=l+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(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,g,f,h){var i=g+1,l=g+this.yd,j=g+this.zd,o=i+this.yd,r=i+this.zd,m=g+this.yd+this.zd,p=i+this.yd+this.zd,n=0,q=this.field[g],s=this.field[i],t=this.field[l],u=this.field[o],v=this.field[j],B=this.field[r],x=this.field[m],C=this.field[p];q<f&&(n|=1);s<f&&(n|=2);t<f&&(n|=8);u<f&&(n|=4);v<f&&(n|=16);B<f&&(n|=32);x<f&&(n|=128);C<f&&(n|=64);var E=THREE.edgeTable[n];if(E===0)return 0;var G=this.delta,R=a+
|
|
|
|
-G,z=b+G,G=e+G;E&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,s));E&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,R,b,e,s,u));E&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,z,e,t,u));E&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,t));E&16&&(this.compNorm(j),this.compNorm(r),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,G,v,B));E&32&&(this.compNorm(r),
|
|
|
|
-this.compNorm(p),this.VIntY(r*3,this.vlist,this.nlist,15,f,R,b,G,B,C));E&64&&(this.compNorm(m),this.compNorm(p),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,z,G,x,C));E&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,G,v,x));E&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,v));E&512&&(this.compNorm(i),this.compNorm(r),this.VIntZ(i*3,this.vlist,this.nlist,27,f,R,b,e,s,B));E&1024&&(this.compNorm(o),this.compNorm(p),this.VIntZ(o*
|
|
|
|
-3,this.vlist,this.nlist,30,f,R,z,e,u,C));E&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,z,e,t,x));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,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),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,l=g+this.yd,j=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,r=i+this.yd+this.zd,n=0,q=this.field[g],s=this.field[i],u=this.field[l],t=this.field[o],y=this.field[j],A=this.field[p],D=this.field[m],F=this.field[r];q<f&&(n|=1);s<f&&(n|=2);u<f&&(n|=8);t<f&&(n|=4);y<f&&(n|=16);A<f&&(n|=32);D<f&&(n|=128);F<f&&(n|=64);var H=THREE.edgeTable[n];if(H===0)return 0;var B=this.delta,J=a+
|
|
|
|
+B,x=b+B,B=e+B;H&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,s));H&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,J,b,e,s,t));H&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,x,e,u,t));H&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,u));H&16&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,B,y,A));H&32&&(this.compNorm(p),
|
|
|
|
+this.compNorm(r),this.VIntY(p*3,this.vlist,this.nlist,15,f,J,b,B,A,F));H&64&&(this.compNorm(m),this.compNorm(r),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,x,B,D,F));H&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,B,y,D));H&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,y));H&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,J,b,e,s,A));H&1024&&(this.compNorm(o),this.compNorm(r),this.VIntZ(o*
|
|
|
|
+3,this.vlist,this.nlist,30,f,J,x,e,t,F));H&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,x,e,u,D));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,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),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+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[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
|
|
4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+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[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+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(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,l=b*this.size,j=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var r=Math.floor(l-h);r<1&&(r=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
|
|
|
|
-1);for(var p,n,q,s,t,u;o<i;o++){j=this.size2*o;n=o/this.size-e;t=n*n;for(n=r;n<l;n++){q=j+this.size*n;p=n/this.size-b;u=p*p;for(p=m;p<h;p++)s=p/this.size-a,s=g/(1.0E-6+s*s+u+t)-f,s>0&&(this.field[q+p]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,l=this.size,j=this.yd,o=this.zd,r=this.field,m=l*Math.sqrt(a/b);m>l&&(m=l);for(e=0;e<m;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<l;g++){i=e+g*j;for(f=0;f<l;f++)r[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,r=
|
|
|
|
-this.zd,m=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(g=0;g<p;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<j;e++){l=i+e;for(f=0;f<j;f++)m[r*f+l]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,r=this.zd,m=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(f=0;f<p;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=r*f;for(g=0;g<j;g++){l=i+g*o;for(e=0;e<j;e++)m[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
|
|
|
|
-function(a){this.begin();var b,e,g,f,h,i,l,j,o,r=this.size-2;for(f=1;f<r;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(g=1;g<r;g++){j=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<r;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,l,j,o,r,m;for(f=0;f<g.count;f++)r=f*3,j=r+1,m=r+2,h=g.positionArray[r],i=g.positionArray[j],l=
|
|
|
|
-g.positionArray[m],o=new THREE.Vector3(h,i,l),h=g.normalArray[r],i=g.normalArray[j],l=g.normalArray[m],r=new THREE.Vector3(h,i,l),r.normalize(),j=new THREE.Vertex(o),b.vertices.push(j),e.push(r);o=g.count/3;for(f=0;f<o;f++)r=(a+f)*3,j=r+1,m=r+2,h=e[r],i=e[j],l=e[m],r=new THREE.Face3(r,j,m,[h,i,l]),b.faces.push(r);a+=o;g.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(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,l=b*this.size,j=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
|
|
|
|
+1);for(var r,n,q,s,u,t;o<i;o++){j=this.size2*o;n=o/this.size-e;u=n*n;for(n=p;n<l;n++){q=j+this.size*n;r=n/this.size-b;t=r*r;for(r=m;r<h;r++)s=r/this.size-a,s=g/(1.0E-6+s*s+t+u)-f,s>0&&(this.field[q+r]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,l=this.size,j=this.yd,o=this.zd,p=this.field,m=l*Math.sqrt(a/b);m>l&&(m=l);for(e=0;e<m;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<l;g++){i=e+g*j;for(f=0;f<l;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,p=
|
|
|
|
+this.zd,m=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(g=0;g<r;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<j;e++){l=i+e;for(f=0;f<j;f++)m[p*f+l]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,p=this.zd,m=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(f=0;f<r;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<j;g++){l=i+g*o;for(e=0;e<j;e++)m[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
|
|
|
|
+function(a){this.begin();var b,e,g,f,h,i,l,j,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){j=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,l,j,o,p,m;for(f=0;f<g.count;f++)p=f*3,j=p+1,m=p+2,h=g.positionArray[p],i=g.positionArray[j],l=
|
|
|
|
+g.positionArray[m],o=new THREE.Vector3(h,i,l),h=g.normalArray[p],i=g.normalArray[j],l=g.normalArray[m],p=new THREE.Vector3(h,i,l),p.normalize(),j=new THREE.Vertex(o),b.vertices.push(j),e.push(p);o=g.count/3;for(f=0;f<o;f++)p=(a+f)*3,j=p+1,m=p+2,h=e[p],i=e[j],l=e[m],p=new THREE.Face3(p,j,m,[h,i,l]),b.faces.push(p);a+=o;g.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]);
|
|
@@ -693,29 +694,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
|
|
d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);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);
|
|
d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);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,d.occlusionTexture);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);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
|
|
b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);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);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
|
|
!0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
|
|
!0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
|
|
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var l=new THREE.Vector3,j=h/f,o=f*0.5,r=h*0.5,m=16/h,p=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),s=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
|
|
|
|
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(s.occlusionMap,0);b.uniform1i(s.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var t,u,v,B,x;for(t=0;t<i;t++)if(m=16/h,p.set(m*j,m),B=a[t],l.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(l),
|
|
|
|
-g.projectionMatrix.multiplyVector3(l),n.copy(l),q.x=n.x*o+o,q.y=n.y*r+r,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,0);b.uniform2f(s.scale,p.x,p.y);b.uniform3f(s.screenPosition,n.x,n.y,n.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,d.occlusionTexture);
|
|
|
|
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(n);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(s.renderType,2);b.enable(b.BLEND);u=0;for(v=B.lensFlares.length;u<v;u++)if(x=B.lensFlares[u],x.opacity>0.0010&&x.scale>0.0010)n.x=x.x,n.y=x.y,n.z=x.z,m=x.size*x.scale/
|
|
|
|
-h,p.x=m*j,p.y=m,b.uniform3f(s.screenPosition,n.x,n.y,n.z),b.uniform2f(s.scale,p.x,p.y),b.uniform1f(s.rotation,x.rotation),b.uniform1f(s.opacity,x.opacity),b.uniform3f(s.color,x.color.r,x.color.g,x.color.b),c.setBlending(x.blending),c.setTexture(x.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
|
|
|
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var l=new THREE.Vector3,j=h/f,o=f*0.5,p=h*0.5,m=16/h,r=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),s=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
|
|
|
|
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(s.occlusionMap,0);b.uniform1i(s.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var u,t,y,A,D;for(u=0;u<i;u++)if(m=16/h,r.set(m*j,m),A=a[u],l.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(l),
|
|
|
|
+g.projectionMatrix.multiplyVector3(l),n.copy(l),q.x=n.x*o+o,q.y=n.y*p+p,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,0);b.uniform2f(s.scale,r.x,r.y);b.uniform3f(s.screenPosition,n.x,n.y,n.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,d.occlusionTexture);
|
|
|
|
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(n);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(s.renderType,2);b.enable(b.BLEND);t=0;for(y=A.lensFlares.length;t<y;t++)if(D=A.lensFlares[t],D.opacity>0.0010&&D.scale>0.0010)n.x=D.x,n.y=D.y,n.z=D.z,m=D.size*D.scale/
|
|
|
|
+h,r.x=m*j,r.y=m,b.uniform3f(s.screenPosition,n.x,n.y,n.z),b.uniform2f(s.scale,r.x,r.y),b.uniform1f(s.rotation,D.rotation),b.uniform1f(s.opacity,D.opacity),b.uniform3f(s.color,D.color.r,D.color.g,D.color.b),c.setBlending(D.blending),c.setTexture(D.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,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];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=
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];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(h){var i,l,j,o,r,m,p,n,q=0,s=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(l=s.length;i<l;i++)if(p=s[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
|
-format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(p.position);e.lookAt(p.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
|
|
|
|
-new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();o=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,o);n=h.__webglObjects;j=0;for(o=n.length;j<o;j++)if(r=n[j],p=r.object,r.render=!1,p.visible&&p.castShadow&&
|
|
|
|
-(!(p instanceof THREE.Mesh)||!p.frustumCulled||g.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),r.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(o=n.length;j<o;j++)if(r=n[j],r.render)p=r.object,r=r.buffer,b.setObjectFaces(p),m=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c,b.renderBuffer(e,s,null,m,r,p);n=h.__webglObjectsImmediate;
|
|
|
|
-j=0;for(o=n.length;j<o;j++)r=n[j],p=r.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(e,s,null,c,p));q++}}};
|
|
|
|
|
|
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,l,j,o,p,m,r,n,q=0,s=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(l=s.length;i<l;i++)if(r=s[i],r.castShadow&&r instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
|
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(r.position);e.lookAt(r.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
|
|
|
|
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();o=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,o);n=h.__webglObjects;j=0;for(o=n.length;j<o;j++)if(p=n[j],r=p.object,p.render=!1,r.visible&&r.castShadow&&
|
|
|
|
+(!(r instanceof THREE.Mesh)||!r.frustumCulled||g.contains(r)))r.matrixWorld.flattenToArray(r._objectMatrixArray),r._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,r.matrixWorld,r._modelViewMatrixArray),p.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(o=n.length;j<o;j++)if(p=n[j],p.render)r=p.object,p=p.buffer,b.setObjectFaces(r),m=r.customDepthMaterial?r.customDepthMaterial:r.geometry.morphTargets.length?d:c,b.renderBuffer(e,s,null,m,p,r);n=h.__webglObjectsImmediate;
|
|
|
|
+j=0;for(o=n.length;j<o;j++)p=n[j],r=p.object,r.visible&&r.castShadow&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),r._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,r.matrixWorld,r._modelViewMatrixArray),b.renderImmediateObject(e,s,null,c,r));q++}}};
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
|
|
2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
|
|
2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
|
|
b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
|
|
b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
|
|
b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
|
|
b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
|
|
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var l=d.attributes,j=d.uniforms,o=h/f;f*=0.5;var r=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(l.position),b.enableVertexAttribArray(l.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(l.position,
|
|
|
|
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(l.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var p,n=[],l=0;l<i;l++)if(p=e[l],p.visible&&p.opacity!==0)p.useScreenCoordinates?p.z=-p.position.z:(p._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),p.z=-p._modelViewMatrix.n34);e.sort(a);for(l=0;l<i;l++)p=e[l],p.visible&&
|
|
|
|
-p.opacity!==0&&p.map&&p.map.image&&p.map.image.width&&(p.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(p.position.x-f)/f,(r-p.position.y)/r,Math.max(0,Math.min(1,p.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,p.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,p._modelViewMatrixArray)),g=p.map.image.width/(p.scaleByViewport?h:1),n[0]=g*o*p.scale.x,n[1]=g*p.scale.y,b.uniform2f(j.uvScale,p.uvScale.x,
|
|
|
|
-p.uvScale.y),b.uniform2f(j.uvOffset,p.uvOffset.x,p.uvOffset.y),b.uniform2f(j.alignment,p.alignment.x,p.alignment.y),b.uniform1f(j.opacity,p.opacity),b.uniform3f(j.color,p.color.r,p.color.g,p.color.b),b.uniform1f(j.rotation,p.rotation),b.uniform2fv(j.scale,n),p.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!p.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(p.blending),c.setTexture(p.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,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,j,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},r=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
|
|
|
|
-1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:r},mapRight:{type:"t",value:1,texture:m}},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(p);this.setSize=function(a,d){c.call(b,a,d);r.width=a;r.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||j!==c.far||o!==c.fov){i=c.aspect;l=c.near;j=c.far;o=c.fov;var t=c.projectionMatrix.clone(),u=125/30*0.5,v=u*l/125,B=l*Math.tan(o*Math.PI/360),x;f.n14=u;h.n14=-u;u=-B*i+v;x=B*i+v;t.n11=2*l/(x-u);t.n13=(x+u)/(x-u);e.projectionMatrix.copy(t);u=-B*i-v;x=B*i-v;t.n11=
|
|
|
|
-2*l/(x-u);t.n13=(x+u)/(x-u);g.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,r,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,p)}};
|
|
|
|
|
|
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var l=d.attributes,j=d.uniforms,o=h/f;f*=0.5;var p=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(l.position),b.enableVertexAttribArray(l.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(l.position,
|
|
|
|
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(l.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var r,n=[],l=0;l<i;l++)if(r=e[l],r.visible&&r.opacity!==0)r.useScreenCoordinates?r.z=-r.position.z:(r._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,r.matrixWorld,r._modelViewMatrixArray),r.z=-r._modelViewMatrix.n34);e.sort(a);for(l=0;l<i;l++)r=e[l],r.visible&&
|
|
|
|
+r.opacity!==0&&r.map&&r.map.image&&r.map.image.width&&(r.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(r.position.x-f)/f,(p-r.position.y)/p,Math.max(0,Math.min(1,r.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,r.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,r._modelViewMatrixArray)),g=r.map.image.width/(r.scaleByViewport?h:1),n[0]=g*o*r.scale.x,n[1]=g*r.scale.y,b.uniform2f(j.uvScale,r.uvScale.x,
|
|
|
|
+r.uvScale.y),b.uniform2f(j.uvOffset,r.uvOffset.x,r.uvOffset.y),b.uniform2f(j.alignment,r.alignment.x,r.alignment.y),b.uniform1f(j.opacity,r.opacity),b.uniform3f(j.color,r.color.r,r.color.g,r.color.b),b.uniform1f(j.rotation,r.rotation),b.uniform2fv(j.scale,n),r.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!r.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(r.blending),c.setTexture(r.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,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,j,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
|
|
|
|
+1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},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(r);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||j!==c.far||o!==c.fov){i=c.aspect;l=c.near;j=c.far;o=c.fov;var u=c.projectionMatrix.clone(),t=125/30*0.5,y=t*l/125,A=l*Math.tan(o*Math.PI/360),D;f.n14=t;h.n14=-t;t=-A*i+y;D=A*i+y;u.n11=2*l/(D-t);u.n13=(D+t)/(D-t);e.projectionMatrix.copy(u);t=-A*i-y;D=A*i-y;u.n11=
|
|
|
|
+2*l/(D-t);u.n13=(D+t)/(D-t);g.projectionMatrix.copy(u)}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,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,r)}};
|
|
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,g,f=new THREE.PerspectiveCamera;f.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&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.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,g,f=new THREE.PerspectiveCamera;f.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&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
|
|
c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
|
|
c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);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:"#ifdef GL_ES\nprecision highp float;\n#endif\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:"#ifdef GL_ES\nprecision highp float;\n#endif\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}"},
|