|
@@ -2,7 +2,7 @@
|
|
|
'use strict';var THREE=THREE||{REVISION:"48dev"};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
|
|
|
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),g=Math.max(0,16-(c-a)),f=window.setTimeout(function(){b(c+g)},g);a=c+g;return f};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
|
|
|
function(a){clearTimeout(a)}})();THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){return this.elapsedTime+=this.getDelta()};
|
|
|
-THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
|
|
|
+THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
|
|
|
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
|
|
|
this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(0===c)this.r=this.g=this.b=0;else switch(d=Math.floor(6*a),e=6*a-d,a=c*(1-b),g=c*(1-b*e),b=c*(1-b*(1-e)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=
|
|
|
Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return Math.floor(255*this.r)<<16^Math.floor(255*this.g)<<8^Math.floor(255*this.b)},getContextStyle:function(){return"rgb("+Math.floor(255*this.r)+","+Math.floor(255*this.g)+","+Math.floor(255*this.b)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
@@ -19,11 +19,11 @@ this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.
|
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
|
|
|
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);m.sub(a,b);w=o.dot(o);u=o.dot(q);v=o.dot(m);A=q.dot(q);B=q.dot(m);C=1/(w*A-u*u);D=(A*v-u*B)*C;I=(w*B-u*v)*C;return 0<=D&&0<=I&&1>D+I}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);m.sub(a,b);w=o.dot(o);u=o.dot(q);v=o.dot(m);y=q.dot(q);D=q.dot(m);A=1/(w*y-u*u);C=(y*v-u*D)*A;E=(w*D-u*v)*A;return 0<=C&&0<=E&&1>C+E}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
|
|
|
d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){var o=
|
|
|
c(this.origin,this.direction,a.matrixWorld.getPosition()),q=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(o>a.geometry.boundingSphere.radius*Math.max(q.x,Math.max(q.y,q.z)))return m;var r,s,j=a.geometry,t=j.vertices,u;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,q=j.faces.length;o<q;o++)if(b=j.faces[o],i.copy(this.origin),k.copy(this.direction),u=a.matrixWorld,l=u.multiplyVector3(l.copy(b.centroid)).subSelf(i),
|
|
|
p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),r=k.dot(p),!(1.0E-4>Math.abs(r))&&(s=p.dot(l)/r,!(0>s)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(n.add(i,k.multiplyScalar(s)),b instanceof THREE.Face3)e=u.multiplyVector3(e.copy(t[b.a].position)),g=u.multiplyVector3(g.copy(t[b.b].position)),f=u.multiplyVector3(f.copy(t[b.c].position)),d(n,e,g,f)&&(b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b));else if(b instanceof THREE.Face4&&(e=u.multiplyVector3(e.copy(t[b.a].position)),
|
|
|
-g=u.multiplyVector3(g.copy(t[b.b].position)),f=u.multiplyVector3(f.copy(t[b.c].position)),h=u.multiplyVector3(h.copy(t[b.d].position)),d(n,e,g,h)||d(n,g,f,h)))b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,w,u,v,A,B,C,D,I};
|
|
|
+g=u.multiplyVector3(g.copy(t[b.b].position)),f=u.multiplyVector3(f.copy(t[b.c].position)),h=u.multiplyVector3(h.copy(t[b.d].position)),d(n,e,g,h)||d(n,g,f,h)))b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,w,u,v,y,D,A,C,E};
|
|
|
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,l,p){h=!1;b=g;c=f;d=l;e=p;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,l,p,n,o){h?(h=!1,b=g<l?g<n?g:n:l<n?l:n,c=f<p?f<o?f:o:p<o?p:o,d=g>l?g>n?g:n:l>n?l:n,e=f>p?f>o?f:o:p>o?p:o):(b=g<l?g<n?g<b?g:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=f<p?f<o?f<c?f:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=g>l?g>n?g>d?g:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,e=f>p?f>o?f>e?f:e:o>e?o:e:p>o?p>e?p:e:o>e?o: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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
@@ -32,8 +32,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
|
|
|
THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,k,l,p,n,o,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,f||0,h||0,i||0,k||0,void 0!==l?l:1,p||0,n||0,o||0,q||0,void 0!==m?m:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,k,l,p,n,o,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=p;this.n41=n;this.n42=o;this.n43=q;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(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,k=a.n24,l=a.n31,p=a.n32,n=a.n33,o=a.n34,q=a.n41,m=a.n42,r=a.n43,
|
|
|
-s=a.n44,t=b.n11,w=b.n12,u=b.n13,v=b.n14,A=b.n21,B=b.n22,C=b.n23,D=b.n24,I=b.n31,K=b.n32,O=b.n33,S=b.n34,L=b.n41,P=b.n42,H=b.n43,G=b.n44;this.n11=c*t+d*A+e*I+g*L;this.n12=c*w+d*B+e*K+g*P;this.n13=c*u+d*C+e*O+g*H;this.n14=c*v+d*D+e*S+g*G;this.n21=f*t+h*A+i*I+k*L;this.n22=f*w+h*B+i*K+k*P;this.n23=f*u+h*C+i*O+k*H;this.n24=f*v+h*D+i*S+k*G;this.n31=l*t+p*A+n*I+o*L;this.n32=l*w+p*B+n*K+o*P;this.n33=l*u+p*C+n*O+o*H;this.n34=l*v+p*D+n*S+o*G;this.n41=q*t+m*A+r*I+s*L;this.n42=q*w+m*B+r*K+s*P;this.n43=q*u+m*
|
|
|
-C+r*O+s*H;this.n44=q*v+m*D+r*S+s*G;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
|
+s=a.n44,t=b.n11,w=b.n12,u=b.n13,v=b.n14,y=b.n21,D=b.n22,A=b.n23,C=b.n24,E=b.n31,J=b.n32,N=b.n33,T=b.n34,K=b.n41,P=b.n42,M=b.n43,H=b.n44;this.n11=c*t+d*y+e*E+g*K;this.n12=c*w+d*D+e*J+g*P;this.n13=c*u+d*A+e*N+g*M;this.n14=c*v+d*C+e*T+g*H;this.n21=f*t+h*y+i*E+k*K;this.n22=f*w+h*D+i*J+k*P;this.n23=f*u+h*A+i*N+k*M;this.n24=f*v+h*C+i*T+k*H;this.n31=l*t+p*y+n*E+o*K;this.n32=l*w+p*D+n*J+o*P;this.n33=l*u+p*A+n*N+o*M;this.n34=l*v+p*C+n*T+o*H;this.n41=q*t+m*y+r*E+s*K;this.n42=q*w+m*D+r*J+s*P;this.n43=q*u+m*
|
|
|
+A+r*N+s*M;this.n44=q*v+m*C+r*T+s*H;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
|
|
|
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*
|
|
|
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,k=this.n32,l=this.n33,p=this.n34,n=this.n41,o=this.n42,q=this.n43,m=this.n44;return d*f*k*n-c*h*k*n-d*g*l*n+b*h*l*n+c*g*p*n-b*f*p*n-d*f*i*o+c*h*i*o+d*e*l*o-a*h*l*o-c*e*p*o+a*f*p*o+d*g*i*q-b*h*i*q-d*e*k*q+a*h*k*q+b*e*p*q-a*g*p*q-c*g*i*m+b*f*i*m+c*e*k*m-a*f*k*m-b*e*l*m+a*g*l*m},transpose:function(){var a;
|
|
@@ -50,8 +50,8 @@ e,l=c*h,p=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=k+l*d,this.n22=i-p*
|
|
|
a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
|
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
|
return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
|
|
|
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,f=d*d,h=e*e,i=Math.cos(b),k=Math.sin(b),l=1-i,p=c*d*l,n=c*e*l,l=d*e*l,c=c*k,o=d*k,k=e*k,e=g+(1-g)*i,g=p+k,d=n-o,p=p-k,f=f+(1-f)*i,k=l+c,n=n+o,l=l-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,w=this.n13,u=this.n23,v=this.n33,A=this.n43;this.n11=e*i+g*m+d*w;this.n21=e*c+g*r+d*u;this.n31=e*o+g*s+d*v;this.n41=e*q+g*t+d*A;this.n12=p*i+f*m+k*w;this.n22=
|
|
|
-p*c+f*r+k*u;this.n32=p*o+f*s+k*v;this.n42=p*q+f*t+k*A;this.n13=n*i+l*m+h*w;this.n23=n*c+l*r+h*u;this.n33=n*o+l*s+h*v;this.n43=n*q+l*t+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,g=this.n13,f=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*g;this.n22=k*c+a*f;this.n32=k*d+a*h;this.n42=k*e+a*i;this.n13=k*g-a*b;this.n23=k*f-a*c;this.n33=k*h-a*d;this.n43=k*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
|
|
|
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,f=d*d,h=e*e,i=Math.cos(b),k=Math.sin(b),l=1-i,p=c*d*l,n=c*e*l,l=d*e*l,c=c*k,o=d*k,k=e*k,e=g+(1-g)*i,g=p+k,d=n-o,p=p-k,f=f+(1-f)*i,k=l+c,n=n+o,l=l-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,w=this.n13,u=this.n23,v=this.n33,y=this.n43;this.n11=e*i+g*m+d*w;this.n21=e*c+g*r+d*u;this.n31=e*o+g*s+d*v;this.n41=e*q+g*t+d*y;this.n12=p*i+f*m+k*w;this.n22=
|
|
|
+p*c+f*r+k*u;this.n32=p*o+f*s+k*v;this.n42=p*q+f*t+k*y;this.n13=n*i+l*m+h*w;this.n23=n*c+l*r+h*u;this.n33=n*o+l*s+h*v;this.n43=n*q+l*t+h*y;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,g=this.n13,f=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*g;this.n22=k*c+a*f;this.n32=k*d+a*h;this.n42=k*e+a*i;this.n13=k*g-a*b;this.n23=k*f-a*c;this.n33=k*h-a*d;this.n43=k*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
|
|
|
g=this.n13,f=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*g;this.n21=k*c-a*f;this.n31=k*d-a*h;this.n41=k*e-a*i;this.n13=k*g+a*b;this.n23=k*f+a*c;this.n33=k*h+a*d;this.n43=k*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,f=this.n22,h=this.n32,i=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*g;this.n21=k*c+a*f;this.n31=k*d+a*h;this.n41=k*e+a*i;this.n12=k*g-a*b;this.n22=k*f-a*c;this.n32=k*h-a*d;this.n42=k*i-a*e;return this},
|
|
|
translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
|
|
|
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b};
|
|
@@ -64,22 +64,23 @@ this)console.warn("THREE: Object3D.add(): An object can't be added as a child of
|
|
|
getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
|
|
|
this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=g&&0<=f&&0<=h)return!0;if(0>e&&0>g||0>f&&0>h)return!1;0>e?c=Math.max(c,e/(e-g)):0>g&&(d=Math.min(d,e/(e-g)));0>f?c=Math.max(c,f/(f-h)):0>h&&(d=Math.min(d,f/(f-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
|
-var e,g,f=[],h,i,k=[],l,p,n=[],o,q=[],m,r,s=[],t,w,u=[],v={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,B=new THREE.Vector4,C=new THREE.Matrix4,D=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
|
|
|
-b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||I.contains(b))?(C.multiplyVector3(A.copy(b.position)),e=a(),e.object=
|
|
|
-b,e.z=A.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(C.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,g){var f=e.near,G=e.far,j,A,z,E,Q,N,ea,ia,$,aa,ba,Y,ca,fa,Ua,Ka;w=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);I.setFromMatrix(C);v=this.projectGraph(a,!1);for(a=0,j=v.objects.length;a<j;a++)if($=v.objects[a].object,aa=$.matrixWorld,Y=$.material,i=0,$ instanceof THREE.Mesh){ba=$.geometry;ca=$.geometry.materials;E=ba.vertices;fa=ba.faces;Ua=ba.faceVertexUvs;ba=$.matrixRotationWorld.extractRotation(aa);for(A=0,z=E.length;A<z;A++)h=b(),h.positionWorld.copy(E[A].position),aa.multiplyVector3(h.positionWorld),
|
|
|
-h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<G;for(E=0,A=fa.length;E<A;E++){z=fa[E];if(z instanceof THREE.Face3)if(Q=k[z.a],N=k[z.b],ea=k[z.c],Q.visible&&N.visible&&ea.visible&&($.doubleSided||$.flipSided!=0>(ea.positionScreen.x-Q.positionScreen.x)*(N.positionScreen.y-Q.positionScreen.y)-(ea.positionScreen.y-Q.positionScreen.y)*(N.positionScreen.x-
|
|
|
-Q.positionScreen.x)))ia=n[p]=n[p]||new THREE.RenderableFace3,p++,l=ia,l.v1.copy(Q),l.v2.copy(N),l.v3.copy(ea);else continue;else if(z instanceof THREE.Face4)if(Q=k[z.a],N=k[z.b],ea=k[z.c],ia=k[z.d],Q.visible&&N.visible&&ea.visible&&ia.visible&&($.doubleSided||$.flipSided!=(0>(ia.positionScreen.x-Q.positionScreen.x)*(N.positionScreen.y-Q.positionScreen.y)-(ia.positionScreen.y-Q.positionScreen.y)*(N.positionScreen.x-Q.positionScreen.x)||0>(N.positionScreen.x-ea.positionScreen.x)*(ia.positionScreen.y-
|
|
|
-ea.positionScreen.y)-(N.positionScreen.y-ea.positionScreen.y)*(ia.positionScreen.x-ea.positionScreen.x))))Ka=q[o]=q[o]||new THREE.RenderableFace4,o++,l=Ka,l.v1.copy(Q),l.v2.copy(N),l.v3.copy(ea),l.v4.copy(ia);else continue;l.normalWorld.copy(z.normal);ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(z.centroid);aa.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);C.multiplyVector3(l.centroidScreen);ea=z.vertexNormals;for(Q=0,N=ea.length;Q<N;Q++)ia=l.vertexNormalsWorld[Q],
|
|
|
-ia.copy(ea[Q]),ba.multiplyVector3(ia);for(Q=0,N=Ua.length;Q<N;Q++)if(Ka=Ua[Q][E])for(ea=0,ia=Ka.length;ea<ia;ea++)l.uvs[Q][ea]=Ka[ea];l.material=Y;l.faceMaterial=null!==z.materialIndex?ca[z.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if($ instanceof THREE.Line){D.multiply(C,aa);E=$.geometry.vertices;Q=b();Q.positionScreen.copy(E[0].position);D.multiplyVector4(Q.positionScreen);for(A=1,z=E.length;A<z;A++)if(Q=b(),Q.positionScreen.copy(E[A].position),D.multiplyVector4(Q.positionScreen),
|
|
|
-N=k[i-2],K.copy(Q.positionScreen),O.copy(N.positionScreen),d(K,O))K.multiplyScalar(1/K.w),O.multiplyScalar(1/O.w),$=s[r]=s[r]||new THREE.RenderableLine,r++,m=$,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(O),m.z=Math.max(K.z,O.z),m.material=Y,v.elements.push(m)}for(a=0,j=v.sprites.length;a<j;a++)if($=v.sprites[a].object,aa=$.matrixWorld,$ instanceof THREE.Particle&&(B.set(aa.n14,aa.n24,aa.n34,1),C.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z))f=u[w]=u[w]||new THREE.RenderableParticle,w++,t=f,
|
|
|
-t.x=B.x/B.w,t.y=B.y/B.w,t.z=B.z,t.rotation=$.rotation.z,t.scale.x=$.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),t.scale.y=$.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),t.material=$.material,v.elements.push(t);g&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
+var e,g,f=[],h,i,k=[],l,p,n=[],o,q=[],m,r,s=[],t,w,u=[],v={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,D=new THREE.Vector4,A=new THREE.Matrix4,C=new THREE.Matrix4,E=new THREE.Frustum,J=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiply(b.matrixWorld,
|
|
|
+b.projectionMatrixInverse);A.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;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||E.contains(b))?(A.multiplyVector3(y.copy(b.position)),e=a(),e.object=
|
|
|
+b,e.z=y.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(y.copy(b.position)),e=a(),e.object=b,e.z=y.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,g){var f=e.near,H=e.far,j=!1,y,B,F,Z,O,ga,da,ia,S,aa,R,ba,ea,Ua,Ha;w=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);A.multiply(e.projectionMatrix,e.matrixWorldInverse);E.setFromMatrix(A);v=this.projectGraph(a,!1);for(a=0,y=v.objects.length;a<y;a++)if(S=v.objects[a].object,aa=S.matrixWorld,i=0,S instanceof THREE.Mesh){R=S.geometry;ba=S.geometry.materials;Z=R.vertices;ea=R.faces;Ua=R.faceVertexUvs;R=S.matrixRotationWorld.extractRotation(aa);for(B=0,F=Z.length;B<F;B++)h=b(),h.positionWorld.copy(Z[B].position),aa.multiplyVector3(h.positionWorld),
|
|
|
+h.positionScreen.copy(h.positionWorld),A.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<H;for(Z=0,B=ea.length;Z<B;Z++){F=ea[Z];if(F instanceof THREE.Face3)if(O=k[F.a],ga=k[F.b],da=k[F.c],O.visible&&ga.visible&&da.visible)if(j=0>(da.positionScreen.x-O.positionScreen.x)*(ga.positionScreen.y-O.positionScreen.y)-(da.positionScreen.y-O.positionScreen.y)*(ga.positionScreen.x-O.positionScreen.x),
|
|
|
+S.doubleSided||j!=S.flipSided)ia=n[p]=n[p]||new THREE.RenderableFace3,p++,l=ia,l.v1.copy(O),l.v2.copy(ga),l.v3.copy(da);else continue;else continue;else if(F instanceof THREE.Face4)if(O=k[F.a],ga=k[F.b],da=k[F.c],ia=k[F.d],O.visible&&ga.visible&&da.visible&&ia.visible)if(j=0>(ia.positionScreen.x-O.positionScreen.x)*(ga.positionScreen.y-O.positionScreen.y)-(ia.positionScreen.y-O.positionScreen.y)*(ga.positionScreen.x-O.positionScreen.x)||0>(ga.positionScreen.x-da.positionScreen.x)*(ia.positionScreen.y-
|
|
|
+da.positionScreen.y)-(ga.positionScreen.y-da.positionScreen.y)*(ia.positionScreen.x-da.positionScreen.x),S.doubleSided||j!=S.flipSided)Ha=q[o]=q[o]||new THREE.RenderableFace4,o++,l=Ha,l.v1.copy(O),l.v2.copy(ga),l.v3.copy(da),l.v4.copy(ia);else continue;else continue;l.normalWorld.copy(F.normal);!j&&(S.flipSided||S.doubleSided)&&l.normalWorld.negate();R.multiplyVector3(l.normalWorld);l.centroidWorld.copy(F.centroid);aa.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);A.multiplyVector3(l.centroidScreen);
|
|
|
+da=F.vertexNormals;for(O=0,ga=da.length;O<ga;O++)ia=l.vertexNormalsWorld[O],ia.copy(da[O]),!j&&(S.flipSided||S.doubleSided)&&ia.negate(),R.multiplyVector3(ia);for(O=0,ga=Ua.length;O<ga;O++)if(Ha=Ua[O][Z])for(da=0,ia=Ha.length;da<ia;da++)l.uvs[O][da]=Ha[da];l.material=S.material;l.faceMaterial=null!==F.materialIndex?ba[F.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if(S instanceof THREE.Line){C.multiply(A,aa);Z=S.geometry.vertices;O=b();O.positionScreen.copy(Z[0].position);C.multiplyVector4(O.positionScreen);
|
|
|
+for(B=1,F=Z.length;B<F;B++)if(O=b(),O.positionScreen.copy(Z[B].position),C.multiplyVector4(O.positionScreen),ga=k[i-2],J.copy(O.positionScreen),N.copy(ga.positionScreen),d(J,N))J.multiplyScalar(1/J.w),N.multiplyScalar(1/N.w),aa=s[r]=s[r]||new THREE.RenderableLine,r++,m=aa,m.v1.positionScreen.copy(J),m.v2.positionScreen.copy(N),m.z=Math.max(J.z,N.z),m.material=S.material,v.elements.push(m)}for(a=0,y=v.sprites.length;a<y;a++)if(S=v.sprites[a].object,aa=S.matrixWorld,S instanceof THREE.Particle&&(D.set(aa.n14,
|
|
|
+aa.n24,aa.n34,1),A.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))f=u[w]=u[w]||new THREE.RenderableParticle,w++,t=f,t.x=D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=S.rotation.z,t.scale.x=S.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=S.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=S.material,v.elements.push(t);g&&v.elements.sort(c);return v}};
|
|
|
+THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?
|
|
|
-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
|
|
|
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.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
|
|
|
a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,k=i*c+f*e-h*d,l=i*d+h*c-g*e,p=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=k*i+c*-g+l*-h-p*-f;b.y=l*i+c*-f+p*-g-k*-h;b.z=p*i+c*-h+k*-f-l*-g;return b}};
|
|
|
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(0.001>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
@@ -92,9 +93,9 @@ d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(
|
|
|
b,c,d,e;for(c=0,d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
|
|
|
{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var f=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},f.push(i),h.push(k)}f=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
|
|
|
g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=f.faceNormals[c],k=f.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
|
|
|
-b,c,d,e,g,C){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];p=f[g];n=f[C];o=i.x-h.x;q=k.x-h.x;m=i.y-h.y;r=k.y-h.y;s=i.z-h.z;t=k.z-h.z;w=p.u-l.u;u=n.u-l.u;v=p.v-l.v;A=n.v-l.v;B=1/(w*A-u*v);K.set((A*o-v*q)*B,(A*m-v*r)*B,(A*s-v*t)*B);O.set((w*q-u*o)*B,(w*r-u*m)*B,(w*t-u*s)*B);D[b].addSelf(K);D[c].addSelf(K);D[d].addSelf(K);I[b].addSelf(O);I[c].addSelf(O);I[d].addSelf(O)}var b,c,d,e,g,f,h,i,k,l,p,n,o,q,m,r,s,t,w,u,v,A,B,C,D=[],I=[],K=new THREE.Vector3,O=new THREE.Vector3,
|
|
|
-S=new THREE.Vector3,L=new THREE.Vector3,P=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,I[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)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 H=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)P.copy(g.vertexNormals[d]),e=g[H[d]],
|
|
|
-C=D[e],S.copy(C),S.subSelf(P.multiplyScalar(P.dot(C))).normalize(),L.cross(g.vertexNormals[d],C),e=L.dot(I[e]),e=0>e?-1:1,g.vertexTangents[d]=new THREE.Vector4(S.x,S.y,S.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
|
|
|
+b,c,d,e,g,O){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];p=f[g];n=f[O];o=i.x-h.x;q=k.x-h.x;m=i.y-h.y;r=k.y-h.y;s=i.z-h.z;t=k.z-h.z;w=p.u-l.u;u=n.u-l.u;v=p.v-l.v;y=n.v-l.v;D=1/(w*y-u*v);J.set((y*o-v*q)*D,(y*m-v*r)*D,(y*s-v*t)*D);N.set((w*q-u*o)*D,(w*r-u*m)*D,(w*t-u*s)*D);C[b].addSelf(J);C[c].addSelf(J);C[d].addSelf(J);E[b].addSelf(N);E[c].addSelf(N);E[d].addSelf(N)}var b,c,d,e,g,f,h,i,k,l,p,n,o,q,m,r,s,t,w,u,v,y,D,A,C=[],E=[],J=new THREE.Vector3,N=new THREE.Vector3,
|
|
|
+T=new THREE.Vector3,K=new THREE.Vector3,P=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,E[b]=new THREE.Vector3;for(b=0,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 M=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)P.copy(g.vertexNormals[d]),e=g[M[d]],
|
|
|
+A=C[e],T.copy(A),T.subSelf(P.multiplyScalar(P.dot(A))).normalize(),K.cross(g.vertexNormals[d],A),e=K.dot(E[e]),e=0>e?-1:1,g.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
|
|
|
e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
|
|
|
4),g,f;for(g=0,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("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,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;
|
|
|
THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=0.5*(c-a);d=0.5*(d-b);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,k,l,p,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;g=Math.floor(e);f=e-g;c[0]=0===g?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;k=this.points[c[0]];l=this.points[c[1]];
|
|
@@ -103,7 +104,7 @@ g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]
|
|
|
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=void 0!==e?e:0.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
|
|
|
THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
|
|
|
-THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:43.25)/(2*a));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
|
|
|
+THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
|
|
|
this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
|
THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
|
|
@@ -165,45 +166,45 @@ THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,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,k,l,p,n,o,q,m;a=b.projectScene(c,d);for(i=0,k=a.length;i<k;i++)if(n=a[i],n instanceof THREE.RenderableParticle){q=n.x*e+e;m=n.y*g+g;for(l=0,p=n.material.length;l<p;l++)if(o=n.material[l],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=q+"px",o.style.top=m+"px"}}};
|
|
|
THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(w!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}w=a}}function d(a){if(u!=a)m.strokeStyle=u=a}function e(a){if(v!=a)m.fillStyle=v=a}var a=a||{},g=this,f,h,i,k=new THREE.Projector,l=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-p,n,o,q,m=l.getContext("2d"),r=new THREE.Color(0),s=0,t=1,w=0,u=null,v=null,A=null,B=null,C=null,D,I,K,O,S=new THREE.RenderableVertex,L=new THREE.RenderableVertex,P,H,G,j,X,z,E,Q,N,ea,ia,$,aa=new THREE.Color,ba=new THREE.Color,Y=new THREE.Color,ca=new THREE.Color,fa=new THREE.Color,Ua=[],Ka=[],na,Ha,ra,qa,ib,Va,lb,db,Wa,$a,La=new THREE.Rectangle,ta=new THREE.Rectangle,Aa=new THREE.Rectangle,Fa=!1,Ga=new THREE.Color,Xa=new THREE.Color,mb=new THREE.Color,Z=new THREE.Vector3,R,Fb,Uc,eb,pc,Cc,a=16;R=
|
|
|
-document.createElement("canvas");R.width=R.height=2;Fb=R.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Uc=Fb.getImageData(0,0,2,2);eb=Uc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);l.width=p;l.height=n;La.set(-o,-q,
|
|
|
-o,q);ta.set(-o,-q,o,q);t=1;w=0;C=B=A=v=u=null};this.setClearColor=function(a,b){r.copy(a);s=b;ta.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ta.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);ta.isEmpty()||(ta.minSelf(La),ta.inflate(2),1>s&&m.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
+p,n,o,q,m=l.getContext("2d"),r=new THREE.Color(0),s=0,t=1,w=0,u=null,v=null,y=null,D=null,A=null,C,E,J,N,T=new THREE.RenderableVertex,K=new THREE.RenderableVertex,P,M,H,j,Y,B,F,Z,O,ga,da,ia,S=new THREE.Color,aa=new THREE.Color,R=new THREE.Color,ba=new THREE.Color,ea=new THREE.Color,Ua=[],Ha=[],na,Ia,ra,qa,ib,Va,lb,db,Wa,$a,La=new THREE.Rectangle,ta=new THREE.Rectangle,Aa=new THREE.Rectangle,Fa=!1,Ga=new THREE.Color,Xa=new THREE.Color,mb=new THREE.Color,$=new THREE.Vector3,Q,Fb,Uc,eb,pc,Cc,a=16;Q=
|
|
|
+document.createElement("canvas");Q.width=Q.height=2;Fb=Q.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Uc=Fb.getImageData(0,0,2,2);eb=Uc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);l.width=p;l.height=n;La.set(-o,-q,
|
|
|
+o,q);ta.set(-o,-q,o,q);t=1;w=0;A=D=y=v=u=null};this.setClearColor=function(a,b){r.copy(a);s=b;ta.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ta.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);ta.isEmpty()||(ta.minSelf(La),ta.inflate(2),1>s&&m.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
r.b)+","+s+")"),m.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(a,n){function l(a){var b,c,d,e;Ga.setRGB(0,0,0);Xa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Ga.r+=e.r,Ga.g+=e.g,Ga.b+=e.b):d instanceof THREE.DirectionalLight?(Xa.r+=e.r,Xa.g+=e.g,Xa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
|
|
|
-g,f,j,h,i;for(e=0,g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),0>=i||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(Z.sub(h,b).normalize()),0>=i||(i*=0==f.distance?1:1-Math.min(b.distanceTo(h)/f.distance,1),0!=i&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function r(a,g,f){b(f.opacity);c(f.blending);var Z,j,h,i,n,k;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=
|
|
|
-f.map.image,n=i.width>>1,k=i.height>>1,f=g.scale.x*o,h=g.scale.y*q,Z=f*n,j=h*k,Aa.set(a.x-Z,a.y-j,a.x+Z,a.y+j),La.intersects(Aa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(f,-h),m.translate(-n,-k),m.drawImage(i,0,0),m.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(Z=g.scale.x*o,j=g.scale.y*q,Aa.set(a.x-Z,a.y-j,a.x+Z,a.y+j),La.intersects(Aa)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(Z,j),f.program(m),
|
|
|
-m.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(A!=a)m.lineWidth=A=a;a=f.linecap;if(B!=a)m.lineCap=B=a;a=f.linejoin;if(C!=a)m.lineJoin=C=a;d(f.color.getContextStyle());m.stroke();Aa.inflate(2*f.linewidth)}}function t(a,d,e,f,h,k,m,R){g.info.render.vertices+=3;g.info.render.faces++;b(R.opacity);c(R.blending);
|
|
|
-P=a.positionScreen.x;H=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;X=e.positionScreen.x;z=e.positionScreen.y;w(P,H,G,j,X,z);if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.mapping instanceof THREE.UVMapping&&(qa=m.uvs[0],Vc(P,H,G,j,X,z,qa[f].u,qa[f].v,qa[h].u,qa[h].v,qa[k].u,qa[k].v,R.map));else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,Z.copy(m.vertexNormalsWorld[f]),ib=0.5*(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)+0.5,Va=0.5*
|
|
|
--(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)+0.5,Z.copy(m.vertexNormalsWorld[h]),lb=0.5*(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)+0.5,db=0.5*-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)+0.5,Z.copy(m.vertexNormalsWorld[k]),Wa=0.5*(Z.x*a.n11+Z.y*a.n12+Z.z*a.n13)+0.5,$a=0.5*-(Z.x*a.n21+Z.y*a.n22+Z.z*a.n23)+0.5,Vc(P,H,G,j,X,z,ib,Va,lb,db,Wa,$a,R.envMap)}else R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshLambertMaterial)R.map&&!R.wireframe&&(R.map.mapping instanceof
|
|
|
-THREE.UVMapping&&(qa=m.uvs[0],Vc(P,H,G,j,X,z,qa[f].u,qa[f].v,qa[h].u,qa[h].v,qa[k].u,qa[k].v,R.map)),c(THREE.SubtractiveBlending)),Fa?!R.wireframe&&R.shading==THREE.SmoothShading&&3==m.vertexNormalsWorld.length?(ba.r=Y.r=ca.r=Ga.r,ba.g=Y.g=ca.g=Ga.g,ba.b=Y.b=ca.b=Ga.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ba),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],Y),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ca),ba.r=Math.max(0,Math.min(R.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(R.color.g*ba.g,
|
|
|
-1)),ba.b=Math.max(0,Math.min(R.color.b*ba.b,1)),Y.r=Math.max(0,Math.min(R.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(R.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(R.color.b*Y.b,1)),ca.r=Math.max(0,Math.min(R.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(R.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(R.color.b*ca.b,1)),fa.r=0.5*(Y.r+ca.r),fa.g=0.5*(Y.g+ca.g),fa.b=0.5*(Y.b+ca.b),ra=Dc(ba,Y,ca,fa),gc(P,H,G,j,X,z,0,0,1,0,0,1,ra)):(aa.r=Ga.r,aa.g=Ga.g,aa.b=Ga.b,p(i,m.centroidWorld,m.normalWorld,aa),aa.r=Math.max(0,
|
|
|
-Math.min(R.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(R.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(R.color.b*aa.b,1)),R.wireframe?Mb(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(aa)):R.wireframe?Mb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(R.color);else if(R instanceof THREE.MeshDepthMaterial)na=n.near,Ha=n.far,ba.r=ba.g=ba.b=1-ac(a.positionScreen.z,na,Ha),Y.r=Y.g=Y.b=1-ac(d.positionScreen.z,na,Ha),ca.r=ca.g=ca.b=1-ac(e.positionScreen.z,na,Ha),fa.r=
|
|
|
-0.5*(Y.r+ca.r),fa.g=0.5*(Y.g+ca.g),fa.b=0.5*(Y.b+ca.b),ra=Dc(ba,Y,ca,fa),gc(P,H,G,j,X,z,0,0,1,0,0,1,ra);else if(R instanceof THREE.MeshNormalMaterial)aa.r=hc(m.normalWorld.x),aa.g=hc(m.normalWorld.y),aa.b=hc(m.normalWorld.z),R.wireframe?Mb(aa,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):Gb(aa)}function u(a,d,e,f,Z,h,R,m,k){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,R,m,k),t(Z,e,h,1,2,3,R,m,k);else if(P=a.positionScreen.x,
|
|
|
-H=a.positionScreen.y,G=d.positionScreen.x,j=d.positionScreen.y,X=e.positionScreen.x,z=e.positionScreen.y,E=f.positionScreen.x,Q=f.positionScreen.y,N=Z.positionScreen.x,ea=Z.positionScreen.y,ia=h.positionScreen.x,$=h.positionScreen.y,m instanceof THREE.MeshBasicMaterial)v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)Fa?!m.wireframe&&m.shading==THREE.SmoothShading&&4==R.vertexNormalsWorld.length?
|
|
|
-(ba.r=Y.r=ca.r=fa.r=Ga.r,ba.g=Y.g=ca.g=fa.g=Ga.g,ba.b=Y.b=ca.b=fa.b=Ga.b,p(i,R.v1.positionWorld,R.vertexNormalsWorld[0],ba),p(i,R.v2.positionWorld,R.vertexNormalsWorld[1],Y),p(i,R.v4.positionWorld,R.vertexNormalsWorld[3],ca),p(i,R.v3.positionWorld,R.vertexNormalsWorld[2],fa),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),Y.r=Math.max(0,Math.min(m.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(m.color.g*Y.g,1)),Y.b=Math.max(0,
|
|
|
-Math.min(m.color.b*Y.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),fa.r=Math.max(0,Math.min(m.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(m.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(m.color.b*fa.b,1)),ra=Dc(ba,Y,ca,fa),w(P,H,G,j,E,Q),gc(P,H,G,j,E,Q,0,0,1,0,0,1,ra),w(N,ea,X,z,ia,$),gc(N,ea,X,z,ia,$,1,0,1,1,0,1,ra)):(aa.r=Ga.r,aa.g=Ga.g,aa.b=Ga.b,p(i,R.centroidWorld,R.normalWorld,aa),aa.r=Math.max(0,Math.min(m.color.r*
|
|
|
-aa.r,1)),aa.g=Math.max(0,Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(aa,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(aa)):(v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color));else if(m instanceof THREE.MeshNormalMaterial)aa.r=hc(R.normalWorld.x),aa.g=hc(R.normalWorld.y),aa.b=hc(R.normalWorld.z),v(P,H,G,j,X,z,E,Q),m.wireframe?Mb(aa,m.wireframeLinewidth,m.wireframeLinecap,
|
|
|
-m.wireframeLinejoin):Gb(aa);else if(m instanceof THREE.MeshDepthMaterial)na=n.near,Ha=n.far,ba.r=ba.g=ba.b=1-ac(a.positionScreen.z,na,Ha),Y.r=Y.g=Y.b=1-ac(d.positionScreen.z,na,Ha),ca.r=ca.g=ca.b=1-ac(f.positionScreen.z,na,Ha),fa.r=fa.g=fa.b=1-ac(e.positionScreen.z,na,Ha),ra=Dc(ba,Y,ca,fa),w(P,H,G,j,E,Q),gc(P,H,G,j,E,Q,0,0,1,0,0,1,ra),w(N,ea,X,z,ia,$),gc(N,ea,X,z,ia,$,1,0,1,1,0,1,ra)}function w(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function v(a,
|
|
|
-b,c,d,e,f,g,Z){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,Z);m.lineTo(a,b);m.closePath()}function Mb(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(B!=c)m.lineCap=B=c;if(C!=e)m.lineJoin=C=e;d(a.getContextStyle());m.stroke();Aa.inflate(2*b)}function Gb(a){e(a.getContextStyle());m.fill()}function Vc(a,b,c,d,f,g,Z,j,h,i,R,n,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Ua[k.id]){var l=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Ua[k.id]=m.createPattern(k.image,
|
|
|
-l&&o?"repeat":l&&!o?"repeat-x":!l&&o?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Ua[k.id]);var l=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,Fb=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,Z=(Z+l)*Fb,j=(j+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,h=(h+l)*Fb-Z,i=(i+o)*p-j,R=(R+l)*Fb-Z,n=(n+o)*p-j,l=h*n-R*i;if(0==l){if(void 0===Ka[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),Ka[k.id]=b.getImageData(0,0,k.image.width,
|
|
|
-k.image.height).data;b=Ka[k.id];Z=4*(Math.floor(Z)+Math.floor(j)*k.image.width);aa.setRGB(b[Z]/255,b[Z+1]/255,b[Z+2]/255);Gb(aa)}else l=1/l,k=(n*c-i*f)*l,i=(n*d-i*g)*l,c=(h*f-R*c)*l,d=(h*g-R*d)*l,a=a-k*Z-c*j,Z=b-i*Z-d*j,m.save(),m.transform(k,i,c,d,a,Z),m.fill(),m.restore()}}function gc(a,b,c,d,e,f,g,Z,j,h,i,R,k){var n,l;n=k.width-1;l=k.height-1;g*=n;Z*=l;c-=a;d-=b;e-=a;f-=b;j=j*n-g;h=h*l-Z;i=i*n-g;R=R*l-Z;l=1/(j*R-i*h);n=(R*c-h*e)*l;h=(R*d-h*f)*l;c=(j*e-i*c)*l;d=(j*f-i*d)*l;a=a-n*g-c*Z;b=b-h*g-d*
|
|
|
-Z;m.save();m.transform(n,h,c,d,a,b);m.clip();m.drawImage(k,0,0);m.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),Z=~~(255*b.g),b=~~(255*b.b),j=~~(255*c.r),h=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),m=~~(255*d.g),d=~~(255*d.b);eb[0]=0>e?0:255<e?255:e;eb[1]=0>f?0:255<f?255:f;eb[2]=0>a?0:255<a?255:a;eb[4]=0>g?0:255<g?255:g;eb[5]=0>Z?0:255<Z?255:Z;eb[6]=0>b?0:255<b?255:b;eb[8]=0>j?0:255<j?255:j;eb[9]=0>h?0:255<h?255:h;eb[10]=0>c?0:255<c?255:c;eb[12]=0>i?0:255<
|
|
|
-i?255:i;eb[13]=0>m?0:255<m?255:m;eb[14]=0>d?0:255<d?255:d;Fb.putImageData(Uc,0,0);Cc.drawImage(R,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,fd,Pa,jb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);g.info.render.vertices=0;g.info.render.faces=0;f=k.projectScene(a,n,this.sortElements);h=f.elements;i=
|
|
|
-f.lights;(Fa=0<i.length)&&l(i);for(Ec=0,fd=h.length;Ec<fd;Ec++)if(Pa=h[Ec],jb=Pa.material,jb=jb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:jb,!(null==jb||0==jb.opacity)){Aa.empty();if(Pa instanceof THREE.RenderableParticle)D=Pa,D.x*=o,D.y*=q,r(D,Pa,jb,a);else if(Pa instanceof THREE.RenderableLine)D=Pa.v1,I=Pa.v2,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,Aa.addPoint(D.positionScreen.x,D.positionScreen.y),Aa.addPoint(I.positionScreen.x,I.positionScreen.y),
|
|
|
-La.intersects(Aa)&&s(D,I,Pa,jb,a);else if(Pa instanceof THREE.RenderableFace3)D=Pa.v1,I=Pa.v2,K=Pa.v3,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,jb.overdraw&&(Nb(D.positionScreen,I.positionScreen),Nb(I.positionScreen,K.positionScreen),Nb(K.positionScreen,D.positionScreen)),Aa.add3Points(D.positionScreen.x,D.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),La.intersects(Aa)&&
|
|
|
-t(D,I,K,0,1,2,Pa,jb,a);else if(Pa instanceof THREE.RenderableFace4)D=Pa.v1,I=Pa.v2,K=Pa.v3,O=Pa.v4,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,S.positionScreen.copy(I.positionScreen),L.positionScreen.copy(O.positionScreen),jb.overdraw&&(Nb(D.positionScreen,I.positionScreen),Nb(I.positionScreen,O.positionScreen),Nb(O.positionScreen,D.positionScreen),Nb(K.positionScreen,
|
|
|
-S.positionScreen),Nb(K.positionScreen,L.positionScreen)),Aa.addPoint(D.positionScreen.x,D.positionScreen.y),Aa.addPoint(I.positionScreen.x,I.positionScreen.y),Aa.addPoint(K.positionScreen.x,K.positionScreen.y),Aa.addPoint(O.positionScreen.x,O.positionScreen.y),La.intersects(Aa)&&u(D,I,K,O,S,L,Pa,jb,a);ta.addRectangle(Aa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,m;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),m=c.dot(i),0>=m||(m*=g.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),m=c.dot(D.sub(i,b).normalize()),0>=m||(m*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=m&&(m*=g.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){null==I[a]&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),0==P&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,p,n,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,w=!1,u=new THREE.Color,v=new THREE.Color,A=new THREE.Color,B=new THREE.Color,C,D=new THREE.Vector3,I=[],K=[],O,S,L,P=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":P=1;break;case "low":P=0}};this.setSize=function(a,b){k=a;l=b;p=k/2;n=l/2;i.setAttribute("viewBox",-p+" "+-n+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var j,D,z,E;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);g=e.elements;
|
|
|
-f=e.lights;L=S=0;if(w=0<f.length){v.setRGB(0,0,0);A.setRGB(0,0,0);B.setRGB(0,0,0);for(j=0,D=f.length;j<D;j++)E=f[j],z=E.color,E instanceof THREE.AmbientLight?(v.r+=z.r,v.g+=z.g,v.b+=z.b):E instanceof THREE.DirectionalLight?(A.r+=z.r,A.g+=z.g,A.b+=z.b):E instanceof THREE.PointLight&&(B.r+=z.r,B.g+=z.g,B.b+=z.b)}for(j=0,D=g.length;j<D;j++)if(z=g[j],E=z.material,E=E instanceof THREE.MeshFaceMaterial?z.faceMaterial:E,!(null==E||0==E.opacity))if(t.empty(),z instanceof THREE.RenderableParticle)o=z,o.x*=
|
|
|
-p,o.y*=-n;else if(z instanceof THREE.RenderableLine){if(o=z.v1,q=z.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){z=o;var Q=q,N=L++;null==K[N]&&(K[N]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==P&&K[N].setAttribute("shape-rendering","crispEdges"));O=K[N];O.setAttribute("x1",z.positionScreen.x);O.setAttribute("y1",z.positionScreen.y);
|
|
|
-O.setAttribute("x2",Q.positionScreen.x);O.setAttribute("y2",Q.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+E.color.getContextStyle()+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin),i.appendChild(O))}}else if(z instanceof THREE.RenderableFace3){if(o=z.v1,q=z.v2,m=z.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
|
|
|
-p,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var Q=o,N=q,I=m;d.info.render.vertices+=3;d.info.render.faces++;O=b(S++);O.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?u.copy(E.color):E instanceof THREE.MeshLambertMaterial?
|
|
|
-w?(u.r=v.r,u.g=v.g,u.b=v.b,a(f,z.centroidWorld,z.normalWorld,u),u.r=Math.max(0,Math.min(E.color.r*u.r,1)),u.g=Math.max(0,Math.min(E.color.g*u.g,1)),u.b=Math.max(0,Math.min(E.color.b*u.b,1))):u.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-z.z*E.__farMinusNear),u.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&u.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));E.wireframe?O.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
|
|
|
-E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(O)}}else if(z instanceof THREE.RenderableFace4&&(o=z.v1,q=z.v2,m=z.v3,r=z.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=p,m.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
|
|
|
-o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var Q=o,N=q,I=m,ia=r;d.info.render.vertices+=4;d.info.render.faces++;O=b(S++);O.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?
|
|
|
-u.copy(E.color):E instanceof THREE.MeshLambertMaterial?w?(u.r=v.r,u.g=v.g,u.b=v.b,a(f,z.centroidWorld,z.normalWorld,u),u.r=Math.max(0,Math.min(E.color.r*u.r,1)),u.g=Math.max(0,Math.min(E.color.g*u.g,1)),u.b=Math.max(0,Math.min(E.color.b*u.b,1))):u.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-z.z*E.__farMinusNear),u.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&u.setRGB(c(z.normalWorld.x),c(z.normalWorld.y),c(z.normalWorld.z));E.wireframe?O.setAttribute("style",
|
|
|
-"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):O.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(O)}}};
|
|
|
+g,f,j,h,i;for(e=0,g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),0>=i||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot($.sub(h,b).normalize()),0>=i||(i*=0==f.distance?1:1-Math.min(b.distanceTo(h)/f.distance,1),0!=i&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function r(a,g,f){b(f.opacity);c(f.blending);var $,j,h,i,n,k;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=
|
|
|
+f.map.image,n=i.width>>1,k=i.height>>1,f=g.scale.x*o,h=g.scale.y*q,$=f*n,j=h*k,Aa.set(a.x-$,a.y-j,a.x+$,a.y+j),La.intersects(Aa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(f,-h),m.translate(-n,-k),m.drawImage(i,0,0),m.restore())}else f instanceof THREE.ParticleCanvasMaterial&&($=g.scale.x*o,j=g.scale.y*q,Aa.set(a.x-$,a.y-j,a.x+$,a.y+j),La.intersects(Aa)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale($,j),f.program(m),
|
|
|
+m.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(y!=a)m.lineWidth=y=a;a=f.linecap;if(D!=a)m.lineCap=D=a;a=f.linejoin;if(A!=a)m.lineJoin=A=a;d(f.color.getContextStyle());m.stroke();Aa.inflate(2*f.linewidth)}}function t(a,d,e,f,h,k,m,Q){g.info.render.vertices+=3;g.info.render.faces++;b(Q.opacity);c(Q.blending);
|
|
|
+P=a.positionScreen.x;M=a.positionScreen.y;H=d.positionScreen.x;j=d.positionScreen.y;Y=e.positionScreen.x;B=e.positionScreen.y;w(P,M,H,j,Y,B);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.mapping instanceof THREE.UVMapping&&(qa=m.uvs[0],Vc(P,M,H,j,Y,B,qa[f].u,qa[f].v,qa[h].u,qa[h].v,qa[k].u,qa[k].v,Q.map));else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,$.copy(m.vertexNormalsWorld[f]),ib=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,Va=0.5*
|
|
|
+-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,$.copy(m.vertexNormalsWorld[h]),lb=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,db=0.5*-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,$.copy(m.vertexNormalsWorld[k]),Wa=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,$a=0.5*-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,Vc(P,M,H,j,Y,B,ib,Va,lb,db,Wa,$a,Q.envMap)}else Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Q.map&&!Q.wireframe&&(Q.map.mapping instanceof
|
|
|
+THREE.UVMapping&&(qa=m.uvs[0],Vc(P,M,H,j,Y,B,qa[f].u,qa[f].v,qa[h].u,qa[h].v,qa[k].u,qa[k].v,Q.map)),c(THREE.SubtractiveBlending)),Fa?!Q.wireframe&&Q.shading==THREE.SmoothShading&&3==m.vertexNormalsWorld.length?(aa.r=R.r=ba.r=Ga.r,aa.g=R.g=ba.g=Ga.g,aa.b=R.b=ba.b=Ga.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],aa),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],R),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ba),aa.r=Math.max(0,Math.min(Q.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(Q.color.g*aa.g,
|
|
|
+1)),aa.b=Math.max(0,Math.min(Q.color.b*aa.b,1)),R.r=Math.max(0,Math.min(Q.color.r*R.r,1)),R.g=Math.max(0,Math.min(Q.color.g*R.g,1)),R.b=Math.max(0,Math.min(Q.color.b*R.b,1)),ba.r=Math.max(0,Math.min(Q.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(Q.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(Q.color.b*ba.b,1)),ea.r=0.5*(R.r+ba.r),ea.g=0.5*(R.g+ba.g),ea.b=0.5*(R.b+ba.b),ra=Dc(aa,R,ba,ea),gc(P,M,H,j,Y,B,0,0,1,0,0,1,ra)):(S.r=Ga.r,S.g=Ga.g,S.b=Ga.b,p(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(Q.color.r*
|
|
|
+S.r,1)),S.g=Math.max(0,Math.min(Q.color.g*S.g,1)),S.b=Math.max(0,Math.min(Q.color.b*S.b,1)),Q.wireframe?Mb(S,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(S)):Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(Q.color);else if(Q instanceof THREE.MeshDepthMaterial)na=n.near,Ia=n.far,aa.r=aa.g=aa.b=1-ac(a.positionScreen.z,na,Ia),R.r=R.g=R.b=1-ac(d.positionScreen.z,na,Ia),ba.r=ba.g=ba.b=1-ac(e.positionScreen.z,na,Ia),ea.r=0.5*(R.r+ba.r),ea.g=0.5*
|
|
|
+(R.g+ba.g),ea.b=0.5*(R.b+ba.b),ra=Dc(aa,R,ba,ea),gc(P,M,H,j,Y,B,0,0,1,0,0,1,ra);else if(Q instanceof THREE.MeshNormalMaterial)S.r=hc(m.normalWorld.x),S.g=hc(m.normalWorld.y),S.b=hc(m.normalWorld.z),Q.wireframe?Mb(S,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Gb(S)}function u(a,d,e,f,$,h,Q,m,k){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,Q,m,k),t($,e,h,1,2,3,Q,m,k);else if(P=a.positionScreen.x,M=a.positionScreen.y,H=d.positionScreen.x,
|
|
|
+j=d.positionScreen.y,Y=e.positionScreen.x,B=e.positionScreen.y,F=f.positionScreen.x,Z=f.positionScreen.y,O=$.positionScreen.x,ga=$.positionScreen.y,da=h.positionScreen.x,ia=h.positionScreen.y,m instanceof THREE.MeshBasicMaterial)v(P,M,H,j,Y,B,F,Z),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)Fa?!m.wireframe&&m.shading==THREE.SmoothShading&&4==Q.vertexNormalsWorld.length?(aa.r=R.r=ba.r=ea.r=Ga.r,aa.g=
|
|
|
+R.g=ba.g=ea.g=Ga.g,aa.b=R.b=ba.b=ea.b=Ga.b,p(i,Q.v1.positionWorld,Q.vertexNormalsWorld[0],aa),p(i,Q.v2.positionWorld,Q.vertexNormalsWorld[1],R),p(i,Q.v4.positionWorld,Q.vertexNormalsWorld[3],ba),p(i,Q.v3.positionWorld,Q.vertexNormalsWorld[2],ea),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)),R.r=Math.max(0,Math.min(m.color.r*R.r,1)),R.g=Math.max(0,Math.min(m.color.g*R.g,1)),R.b=Math.max(0,Math.min(m.color.b*R.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)),ea.r=Math.max(0,Math.min(m.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(m.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(m.color.b*ea.b,1)),ra=Dc(aa,R,ba,ea),w(P,M,H,j,F,Z),gc(P,M,H,j,F,Z,0,0,1,0,0,1,ra),w(O,ga,Y,B,da,ia),gc(O,ga,Y,B,da,ia,1,0,1,1,0,1,ra)):(S.r=Ga.r,S.g=Ga.g,S.b=Ga.b,p(i,Q.centroidWorld,Q.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)),v(P,M,H,j,Y,B,F,Z),m.wireframe?Mb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(S)):(v(P,M,H,j,Y,B,F,Z),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color));else if(m instanceof THREE.MeshNormalMaterial)S.r=hc(Q.normalWorld.x),S.g=hc(Q.normalWorld.y),S.b=hc(Q.normalWorld.z),v(P,M,H,j,Y,B,F,Z),m.wireframe?Mb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):
|
|
|
+Gb(S);else if(m instanceof THREE.MeshDepthMaterial)na=n.near,Ia=n.far,aa.r=aa.g=aa.b=1-ac(a.positionScreen.z,na,Ia),R.r=R.g=R.b=1-ac(d.positionScreen.z,na,Ia),ba.r=ba.g=ba.b=1-ac(f.positionScreen.z,na,Ia),ea.r=ea.g=ea.b=1-ac(e.positionScreen.z,na,Ia),ra=Dc(aa,R,ba,ea),w(P,M,H,j,F,Z),gc(P,M,H,j,F,Z,0,0,1,0,0,1,ra),w(O,ga,Y,B,da,ia),gc(O,ga,Y,B,da,ia,1,0,1,1,0,1,ra)}function w(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function v(a,b,c,d,e,f,g,$){m.beginPath();
|
|
|
+m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,$);m.lineTo(a,b);m.closePath()}function Mb(a,b,c,e){if(y!=b)m.lineWidth=y=b;if(D!=c)m.lineCap=D=c;if(A!=e)m.lineJoin=A=e;d(a.getContextStyle());m.stroke();Aa.inflate(2*b)}function Gb(a){e(a.getContextStyle());m.fill()}function Vc(a,b,c,d,f,g,$,j,h,i,Q,n,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Ua[k.id]){var l=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Ua[k.id]=m.createPattern(k.image,l&&o?"repeat":l&&!o?"repeat-x":
|
|
|
+!l&&o?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Ua[k.id]);var l=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,Fb=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,$=($+l)*Fb,j=(j+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,h=(h+l)*Fb-$,i=(i+o)*p-j,Q=(Q+l)*Fb-$,n=(n+o)*p-j,l=h*n-Q*i;if(0==l){if(void 0===Ha[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),Ha[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;b=Ha[k.id];
|
|
|
+$=4*(Math.floor($)+Math.floor(j)*k.image.width);S.setRGB(b[$]/255,b[$+1]/255,b[$+2]/255);Gb(S)}else l=1/l,k=(n*c-i*f)*l,i=(n*d-i*g)*l,c=(h*f-Q*c)*l,d=(h*g-Q*d)*l,a=a-k*$-c*j,$=b-i*$-d*j,m.save(),m.transform(k,i,c,d,a,$),m.fill(),m.restore()}}function gc(a,b,c,d,e,f,g,$,j,h,i,Q,k){var n,l;n=k.width-1;l=k.height-1;g*=n;$*=l;c-=a;d-=b;e-=a;f-=b;j=j*n-g;h=h*l-$;i=i*n-g;Q=Q*l-$;l=1/(j*Q-i*h);n=(Q*c-h*e)*l;h=(Q*d-h*f)*l;c=(j*e-i*c)*l;d=(j*f-i*d)*l;a=a-n*g-c*$;b=b-h*g-d*$;m.save();m.transform(n,h,c,d,a,
|
|
|
+b);m.clip();m.drawImage(k,0,0);m.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),$=~~(255*b.g),b=~~(255*b.b),j=~~(255*c.r),h=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),m=~~(255*d.g),d=~~(255*d.b);eb[0]=0>e?0:255<e?255:e;eb[1]=0>f?0:255<f?255:f;eb[2]=0>a?0:255<a?255:a;eb[4]=0>g?0:255<g?255:g;eb[5]=0>$?0:255<$?255:$;eb[6]=0>b?0:255<b?255:b;eb[8]=0>j?0:255<j?255:j;eb[9]=0>h?0:255<h?255:h;eb[10]=0>c?0:255<c?255:c;eb[12]=0>i?0:255<i?255:i;eb[13]=0>m?0:255<m?255:
|
|
|
+m;eb[14]=0>d?0:255<d?255:d;Fb.putImageData(Uc,0,0);Cc.drawImage(Q,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,fd,Pa,jb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);g.info.render.vertices=0;g.info.render.faces=0;f=k.projectScene(a,n,this.sortElements);h=f.elements;i=f.lights;(Fa=0<i.length)&&l(i);
|
|
|
+for(Ec=0,fd=h.length;Ec<fd;Ec++)if(Pa=h[Ec],jb=Pa.material,jb=jb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:jb,!(null==jb||0==jb.opacity)){Aa.empty();if(Pa instanceof THREE.RenderableParticle)C=Pa,C.x*=o,C.y*=q,r(C,Pa,jb,a);else if(Pa instanceof THREE.RenderableLine)C=Pa.v1,E=Pa.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,Aa.addPoint(C.positionScreen.x,C.positionScreen.y),Aa.addPoint(E.positionScreen.x,E.positionScreen.y),La.intersects(Aa)&&s(C,
|
|
|
+E,Pa,jb,a);else if(Pa instanceof THREE.RenderableFace3)C=Pa.v1,E=Pa.v2,J=Pa.v3,C.positionScreen.x*=o,C.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,jb.overdraw&&(Nb(C.positionScreen,E.positionScreen),Nb(E.positionScreen,J.positionScreen),Nb(J.positionScreen,C.positionScreen)),Aa.add3Points(C.positionScreen.x,C.positionScreen.y,E.positionScreen.x,E.positionScreen.y,J.positionScreen.x,J.positionScreen.y),La.intersects(Aa)&&t(C,E,J,0,1,2,
|
|
|
+Pa,jb,a);else if(Pa instanceof THREE.RenderableFace4)C=Pa.v1,E=Pa.v2,J=Pa.v3,N=Pa.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,J.positionScreen.x*=o,J.positionScreen.y*=q,N.positionScreen.x*=o,N.positionScreen.y*=q,T.positionScreen.copy(E.positionScreen),K.positionScreen.copy(N.positionScreen),jb.overdraw&&(Nb(C.positionScreen,E.positionScreen),Nb(E.positionScreen,N.positionScreen),Nb(N.positionScreen,C.positionScreen),Nb(J.positionScreen,T.positionScreen),
|
|
|
+Nb(J.positionScreen,K.positionScreen)),Aa.addPoint(C.positionScreen.x,C.positionScreen.y),Aa.addPoint(E.positionScreen.x,E.positionScreen.y),Aa.addPoint(J.positionScreen.x,J.positionScreen.y),Aa.addPoint(N.positionScreen.x,N.positionScreen.y),La.intersects(Aa)&&u(C,E,J,N,T,K,Pa,jb,a);ta.addRectangle(Aa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,m;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),m=c.dot(i),0>=m||(m*=g.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),m=c.dot(C.sub(i,b).normalize()),0>=m||(m*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=m&&(m*=g.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){null==E[a]&&(E[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),0==P&&E[a].setAttribute("shape-rendering","crispEdges"));return E[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,p,n,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,w=!1,u=new THREE.Color,v=new THREE.Color,y=new THREE.Color,D=new THREE.Color,A,C=new THREE.Vector3,E=[],J=[],N,T,K,P=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":P=1;break;case "low":P=0}};this.setSize=function(a,b){k=a;l=b;p=k/2;n=l/2;i.setAttribute("viewBox",-p+" "+-n+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var j,C,B,F;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);g=e.elements;
|
|
|
+f=e.lights;K=T=0;if(w=0<f.length){v.setRGB(0,0,0);y.setRGB(0,0,0);D.setRGB(0,0,0);for(j=0,C=f.length;j<C;j++)F=f[j],B=F.color,F instanceof THREE.AmbientLight?(v.r+=B.r,v.g+=B.g,v.b+=B.b):F instanceof THREE.DirectionalLight?(y.r+=B.r,y.g+=B.g,y.b+=B.b):F instanceof THREE.PointLight&&(D.r+=B.r,D.g+=B.g,D.b+=B.b)}for(j=0,C=g.length;j<C;j++)if(B=g[j],F=B.material,F=F instanceof THREE.MeshFaceMaterial?B.faceMaterial:F,!(null==F||0==F.opacity))if(t.empty(),B instanceof THREE.RenderableParticle)o=B,o.x*=
|
|
|
+p,o.y*=-n;else if(B instanceof THREE.RenderableLine){if(o=B.v1,q=B.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){B=o;var Z=q,O=K++;null==J[O]&&(J[O]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==P&&J[O].setAttribute("shape-rendering","crispEdges"));N=J[O];N.setAttribute("x1",B.positionScreen.x);N.setAttribute("y1",B.positionScreen.y);
|
|
|
+N.setAttribute("x2",Z.positionScreen.x);N.setAttribute("y2",Z.positionScreen.y);F instanceof THREE.LineBasicMaterial&&(N.setAttribute("style","fill: none; stroke: "+F.color.getContextStyle()+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin),i.appendChild(N))}}else if(B instanceof THREE.RenderableFace3){if(o=B.v1,q=B.v2,m=B.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
|
|
|
+p,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var Z=o,O=q,E=m;d.info.render.vertices+=3;d.info.render.faces++;N=b(T++);N.setAttribute("d","M "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+"z");F instanceof THREE.MeshBasicMaterial?u.copy(F.color):F instanceof THREE.MeshLambertMaterial?
|
|
|
+w?(u.r=v.r,u.g=v.g,u.b=v.b,a(f,B.centroidWorld,B.normalWorld,u),u.r=Math.max(0,Math.min(F.color.r*u.r,1)),u.g=Math.max(0,Math.min(F.color.g*u.g,1)),u.b=Math.max(0,Math.min(F.color.b*u.b,1))):u.copy(F.color):F instanceof THREE.MeshDepthMaterial?(A=1-F.__2near/(F.__farPlusNear-B.z*F.__farMinusNear),u.setRGB(A,A,A)):F instanceof THREE.MeshNormalMaterial&&u.setRGB(c(B.normalWorld.x),c(B.normalWorld.y),c(B.normalWorld.z));F.wireframe?N.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
|
|
|
+F.wireframeLinewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframeLinecap+"; stroke-linejoin: "+F.wireframeLinejoin):N.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+F.opacity);i.appendChild(N)}}else if(B instanceof THREE.RenderableFace4&&(o=B.v1,q=B.v2,m=B.v3,r=B.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=p,m.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
|
|
|
+o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var Z=o,O=q,E=m,da=r;d.info.render.vertices+=4;d.info.render.faces++;N=b(T++);N.setAttribute("d","M "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");F instanceof THREE.MeshBasicMaterial?
|
|
|
+u.copy(F.color):F instanceof THREE.MeshLambertMaterial?w?(u.r=v.r,u.g=v.g,u.b=v.b,a(f,B.centroidWorld,B.normalWorld,u),u.r=Math.max(0,Math.min(F.color.r*u.r,1)),u.g=Math.max(0,Math.min(F.color.g*u.g,1)),u.b=Math.max(0,Math.min(F.color.b*u.b,1))):u.copy(F.color):F instanceof THREE.MeshDepthMaterial?(A=1-F.__2near/(F.__farPlusNear-B.z*F.__farMinusNear),u.setRGB(A,A,A)):F instanceof THREE.MeshNormalMaterial&&u.setRGB(c(B.normalWorld.x),c(B.normalWorld.y),c(B.normalWorld.z));F.wireframe?N.setAttribute("style",
|
|
|
+"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+F.wireframeLinewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframeLinecap+"; stroke-linejoin: "+F.wireframeLinejoin):N.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+F.opacity);i.appendChild(N)}}};
|
|
|
THREE.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",
|
|
|
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",
|
|
@@ -243,122 +244,122 @@ var i=a.colors,m=i.length,k=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a
|
|
|
void 0===h.boundTo||"vertices"===h.boundTo)if(g=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)f=l[d][1],h.array[d]=h.value[f];else if(2===h.size)for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(4===h.size)for(d=0;d<e;d++)f=l[d][1],f=h.value[f],
|
|
|
h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}else{if(o)for(d=0;d<f;d++)e=h[d].position,g=3*d,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(p)for(d=0;d<m;d++)e=i[d],g=3*d,n[g]=e.r,n[g+1]=e.g,n[g+2]=e.b;if(q)for(i=0,m=q.length;i<m;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,g=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(3===h.size)if("c"===
|
|
|
h.type)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(4===h.size)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-n,b);if(q)for(i=0,m=q.length;i<m;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function f(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ea=z=null,Q=N=ca=Y=ba=-1,a[d].render(b,c,Va,lb),ea=z=null,Q=N=ca=Y=ba=-1}function i(a,b,c,d,e,g,f,h){var j,i,m,k;b?(i=a.length-1,k=b=-1):(i=0,b=a.length,k=1);for(var n=i;n!==b;n+=k)if(j=a[n],j.render){i=j.object;m=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;
|
|
|
-f&&G.setBlending(j.blending);G.setDepthTest(j.depthTest);G.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}G.setObjectFaces(i);m instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,g,j,m,i):G.renderBuffer(d,e,g,j,m,i)}}function k(a,b,c,d,e,g,f){for(var h,j,i=0,m=a.length;i<m;i++)if(h=a[i],j=h.object,j.visible){if(f)h=f;else{h=h[b];if(!h)continue;g&&G.setBlending(h.blending);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
-h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,j)}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||G.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
-!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var g=0,f=G.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==z&&(j.useProgram(g),z=g,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h||a!==ea)j.uniformMatrix4fv(f.projectionMatrix,!1,a._projectionMatrixArray),a!==ea&&(ea=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
|
|
|
-THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var m,k=0,n=0,l=0,o,p,q,r=ta,s=r.directional.colors,t=r.directional.positions,E=r.point.colors,u=r.point.positions,v=r.point.distances,D=0,C=0,N=q=0;for(c=0,h=b.length;c<h;c++)if(m=b[c],!m.onlyShadow)if(o=m.color,p=m.intensity,q=m.distance,m instanceof THREE.AmbientLight)G.gammaInput?(k+=o.r*o.r,n+=o.g*o.g,l+=o.b*o.b):(k+=o.r,n+=o.g,l+=o.b);else if(m instanceof THREE.DirectionalLight)q=
|
|
|
-3*D,G.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),La.copy(m.matrixWorld.getPosition()),La.subSelf(m.target.matrixWorld.getPosition()),La.normalize(),t[q]=La.x,t[q+1]=La.y,t[q+2]=La.z,D+=1;else if(m instanceof THREE.PointLight||m instanceof THREE.SpotLight)N=3*C,G.gammaInput?(E[N]=o.r*o.r*p*p,E[N+1]=o.g*o.g*p*p,E[N+2]=o.b*o.b*p*p):(E[N]=o.r*p,E[N+1]=o.g*p,E[N+2]=o.b*p),m=m.matrixWorld.getPosition(),u[N]=m.x,u[N+1]=m.y,u[N+2]=m.z,v[C]=q,
|
|
|
-C+=1;for(c=3*D,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=E.length;c<h;c++)E[c]=0;r.point.length=C;r.directional.length=D;r.ambient[0]=k;r.ambient[1]=n;r.ambient[2]=l;c=ta;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
-d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,G.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
|
|
|
-d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=B.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,G.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
|
|
|
-(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)G.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=
|
|
|
+n,b);if(q)for(i=0,m=q.length;i<m;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function f(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=B=null,Z=O=ba=R=aa=-1,a[d].render(b,c,Va,lb),ga=B=null,Z=O=ba=R=aa=-1}function i(a,b,c,d,e,g,f,h){var j,i,m,k;b?(i=a.length-1,k=b=-1):(i=0,b=a.length,k=1);for(var n=i;n!==b;n+=k)if(j=a[n],j.render){i=j.object;m=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;
|
|
|
+f&&H.setBlending(j.blending);H.setDepthTest(j.depthTest);H.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}H.setObjectFaces(i);m instanceof THREE.BufferGeometry?H.renderBufferDirect(d,e,g,j,m,i):H.renderBuffer(d,e,g,j,m,i)}}function k(a,b,c,d,e,g,f){for(var h,j,i=0,m=a.length;i<m;i++)if(h=a[i],j=h.object,j.visible){if(f)h=f;else{h=h[b];if(!h)continue;g&&H.setBlending(h.blending);H.setDepthTest(h.depthTest);H.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
|
|
|
+h.polygonOffsetUnits)}H.renderImmediateObject(c,d,e,h,j)}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||H.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets);for(var g=0,f=H.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==B&&(j.useProgram(g),B=g,h=!0);if(d.id!==Z)Z=d.id,h=!0;if(h||a!==ga)j.uniformMatrix4fv(f.projectionMatrix,!1,a._projectionMatrixArray),a!==ga&&(ga=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
|
|
|
+THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var m,k=0,n=0,l=0,o,p,q,r=ta,s=r.directional.colors,t=r.directional.positions,F=r.point.colors,u=r.point.positions,v=r.point.distances,O=0,C=0,A=q=0;for(c=0,h=b.length;c<h;c++)if(m=b[c],!m.onlyShadow)if(o=m.color,p=m.intensity,q=m.distance,m instanceof THREE.AmbientLight)H.gammaInput?(k+=o.r*o.r,n+=o.g*o.g,l+=o.b*o.b):(k+=o.r,n+=o.g,l+=o.b);else if(m instanceof THREE.DirectionalLight)q=
|
|
|
+3*O,H.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),La.copy(m.matrixWorld.getPosition()),La.subSelf(m.target.matrixWorld.getPosition()),La.normalize(),t[q]=La.x,t[q+1]=La.y,t[q+2]=La.z,O+=1;else if(m instanceof THREE.PointLight||m instanceof THREE.SpotLight)A=3*C,H.gammaInput?(F[A]=o.r*o.r*p*p,F[A+1]=o.g*o.g*p*p,F[A+2]=o.b*o.b*p*p):(F[A]=o.r*p,F[A+1]=o.g*p,F[A+2]=o.b*p),m=m.matrixWorld.getPosition(),u[A]=m.x,u[A+1]=m.y,u[A+2]=m.z,v[C]=q,
|
|
|
+C+=1;for(c=3*O,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=F.length;c<h;c++)F[c]=0;r.point.length=C;r.directional.length=O;r.ambient[0]=k;r.ambient[1]=n;r.ambient[2]=l;c=ta;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
+d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,H.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
|
|
|
+d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=D.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,H.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
|
|
|
+(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)H.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=
|
|
|
c=0;for(k=b.length;h<k;h++)if(n=b[h],n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&!n.shadowCascade))i.shadowMap.texture[c]=n.shadowMap,i.shadowMapSize.value[c]=n.shadowMapSize,i.shadowMatrix.value[c]=n.shadowMatrix,i.shadowDarkness.value[c]=n.shadowDarkness,i.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=g.uniforms[b[i][1]])if(h=b[i][0],l=h.type,k=h.value,"i"===l)j.uniform1i(n,k);else if("f"===l)j.uniform1f(n,k);else if("v2"===
|
|
|
l)j.uniform2f(n,k.x,k.y);else if("v3"===l)j.uniform3f(n,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(n,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(n,k.r,k.g,k.b);else if("fv1"===l)j.uniform1fv(n,k);else if("fv"===l)j.uniform3fv(n,k);else if("v2v"===l){if(!h._array)h._array=new Float32Array(2*k.length);for(l=0,r=k.length;l<r;l++)s=2*l,h._array[s]=k[l].x,h._array[s+1]=k[l].y;j.uniform2fv(n,h._array)}else if("v3v"===l){if(!h._array)h._array=new Float32Array(3*k.length);for(l=0,r=k.length;l<r;l++)s=3*l,
|
|
|
h._array[s]=k[l].x,h._array[s+1]=k[l].y,h._array[s+2]=k[l].z;j.uniform3fv(n,h._array)}else if("v4v"==l){if(!h._array)h._array=new Float32Array(4*k.length);for(l=0,r=k.length;l<r;l++)s=4*l,h._array[s]=k[l].x,h._array[s+1]=k[l].y,h._array[s+2]=k[l].z,h._array[s+3]=k[l].w;j.uniform4fv(n,h._array)}else if("m4"===l){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===l){if(!h._array)h._array=new Float32Array(16*k.length);for(l=0,r=k.length;l<
|
|
|
-r;l++)k[l].flattenToArrayOffset(h._array,16*l);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===l){if(j.uniform1i(n,k),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(n=0;6>n;n++){l=k;r=n;if(G.autoScaleCubemaps){if(s=h.image[n],E=Fa,!(s.width<=E&&s.height<=E))u=Math.max(s.width,
|
|
|
-s.height),t=Math.floor(s.width*E/u),E=Math.floor(s.height*E/u),u=document.createElement("canvas"),u.width=t,u.height=E,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,E),s=u}else s=h.image[n];l[r]=s}n=k[0];l=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=A(h.format);s=A(h.type);w(j.TEXTURE_CUBE_MAP,h,l);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,k[n]);h.generateMipmaps&&l&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
|
|
|
-k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):G.setTexture(n,k)}else if("tv"===l){if(!h._array){h._array=[];for(l=0,r=h.texture.length;l<r;l++)h._array[l]=k+l}j.uniform1iv(n,h._array);for(l=0,r=h.texture.length;l<r;l++)(n=h.texture[l])&&G.setTexture(n,h._array[l])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
|
|
|
+r;l++)k[l].flattenToArrayOffset(h._array,16*l);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===l){if(j.uniform1i(n,k),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(n=0;6>n;n++){l=k;r=n;if(H.autoScaleCubemaps){if(s=h.image[n],F=Fa,!(s.width<=F&&s.height<=F))u=Math.max(s.width,
|
|
|
+s.height),t=Math.floor(s.width*F/u),F=Math.floor(s.height*F/u),u=document.createElement("canvas"),u.width=t,u.height=F,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,F),s=u}else s=h.image[n];l[r]=s}n=k[0];l=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=y(h.format);s=y(h.type);w(j.TEXTURE_CUBE_MAP,h,l);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,k[n]);h.generateMipmaps&&l&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
|
|
|
+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):H.setTexture(n,k)}else if("tv"===l){if(!h._array){h._array=[];for(l=0,r=h.texture.length;l<r;l++)h._array[l]=k+l}j.uniform1iv(n,h._array);for(l=0,r=h.texture.length;l<r;l++)(n=h.texture[l])&&H.setTexture(n,h._array[l])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
|
|
|
null!==f.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(f.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==f.viewMatrix&&j.uniformMatrix4fv(f.viewMatrix,!1,a._viewMatrixArray);d.skinning&&j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices)}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);
|
|
|
-(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==f.objectMatrix&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){fa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),fa=a);if(a&&(Ua!==b||Ka!==c))j.polygonOffset(b,
|
|
|
-c),Ua=b,Ka=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function w(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):
|
|
|
+(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==f.objectMatrix&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){ea!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ea=a);if(a&&(Ua!==b||Ha!==c))j.polygonOffset(b,
|
|
|
+c),Ua=b,Ha=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function w(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,y(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,y(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,y(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,y(b.minFilter))):
|
|
|
(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)))}function u(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
|
-j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
|
|
|
+j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function y(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
|
|
|
case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
|
|
|
-case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",D=void 0!==a.alpha?a.alpha:!0,I=void 0!==a.premultipliedAlpha?
|
|
|
-a.premultipliedAlpha:!0,K=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,S=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),P=void 0!==a.clearAlpha?a.clearAlpha:0,H=void 0!==a.maxLights?a.maxLights:4;this.domElement=B;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
|
|
|
-this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,j,X=[],z=null,E=null,Q=-1,N=null,ea=null,ia=0,$=null,aa=null,ba=null,Y=null,ca=null,
|
|
|
-fa=null,Ua=null,Ka=null,na=null,Ha=0,ra=0,qa=0,ib=0,Va=0,lb=0,db=new THREE.Frustum,Wa=new THREE.Matrix4,$a=new THREE.Vector4,La=new THREE.Vector3,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=B.getContext("experimental-webgl",{alpha:D,premultipliedAlpha:I,antialias:K,stencil:O,preserveDrawingBuffer:S})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+
|
|
|
-" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,P);this.context=j;var Aa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
-j.getParameter(j.MAX_TEXTURE_SIZE);var Fa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Aa};this.setSize=function(a,b){B.width=a;B.height=b;this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,b,c,d){Ha=a;ra=b;qa=c;ib=d;j.viewport(Ha,ra,qa,ib)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
-function(a,b){L.setHex(a);P=b;j.clearColor(L.r,L.g,L.b,P)};this.setClearColor=function(a,b){L.copy(a);P=b;j.clearColor(L.r,L.g,L.b,P)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return P};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
|
|
|
+case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),A=void 0!==a.precision?a.precision:"mediump",C=void 0!==a.alpha?a.alpha:!0,E=void 0!==a.premultipliedAlpha?
|
|
|
+a.premultipliedAlpha:!0,J=void 0!==a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,T=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,K=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),P=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
|
|
|
+this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var H=this,j,Y=[],B=null,F=null,Z=-1,O=null,ga=null,da=0,ia=null,S=null,aa=null,R=null,ba=null,
|
|
|
+ea=null,Ua=null,Ha=null,na=null,Ia=0,ra=0,qa=0,ib=0,Va=0,lb=0,db=new THREE.Frustum,Wa=new THREE.Matrix4,$a=new THREE.Vector4,La=new THREE.Vector3,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{alpha:C,premultipliedAlpha:E,antialias:J,stencil:N,preserveDrawingBuffer:T})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+
|
|
|
+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(K.r,K.g,K.b,P);this.context=j;var Aa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
+j.getParameter(j.MAX_TEXTURE_SIZE);var Fa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Aa};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,0,D.width,D.height)};this.setViewport=function(a,b,c,d){Ia=a;ra=b;qa=c;ib=d;j.viewport(Ia,ra,qa,ib)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
+function(a,b){K.setHex(a);P=b;j.clearColor(K.r,K.g,K.b,P)};this.setClearColor=function(a,b){K.copy(a);P=b;j.clearColor(K.r,K.g,K.b,P)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return P};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
|
|
|
this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);
|
|
|
j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=
|
|
|
-0,e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
|
|
|
-G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.updateShadowMap=function(a,b){z=null;Q=N=ca=Y=ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();
|
|
|
+0,e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
|
|
|
+H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),H.info.memory.textures--};this.updateShadowMap=function(a,b){B=null;Z=O=ba=R=aa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();
|
|
|
if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,k,n,l,o=3*a.count;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],g=c[l+2],f=c[l+3],i=c[l+
|
|
|
4],k=c[l+5],h=c[l+6],m=c[l+7],n=c[l+8],d=(d+f+h)/3,e=(e+i+m)/3,g=(g+k+n)/3,c[l]=d,c[l+1]=e,c[l+2]=g,c[l+3]=d,c[l+4]=e,c[l+5]=g,c[l+6]=d,c[l+7]=e,c[l+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,g){if(0!==d.opacity&&(c=m(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?
|
|
|
-1:0),d!==N&&(N=d,b=!0),g instanceof THREE.Mesh)){g=e.offsets;d=0;for(c=g.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*g[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),
|
|
|
-j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*g[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*g[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,g[d].count,j.UNSIGNED_SHORT,2*g[d].start),G.info.render.calls++,G.info.render.vertices+=g[d].count,
|
|
|
-G.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,e,g){if(0!==d.opacity){var f,h,c=m(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,
|
|
|
+1:0),d!==O&&(O=d,b=!0),g instanceof THREE.Mesh)){g=e.offsets;d=0;for(c=g.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*g[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),
|
|
|
+j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*g[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*g[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,g[d].count,j.UNSIGNED_SHORT,2*g[d].start),H.info.render.calls++,H.info.render.vertices+=g[d].count,
|
|
|
+H.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,e,g){if(0!==d.opacity){var f,h,c=m(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==O&&(O=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,
|
|
|
3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[f]]),j.vertexAttribPointer(c["morphNormal"+
|
|
|
f],3,j.FLOAT,!1,0,0)),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],k=-1,l=0;h=g.morphTargetInfluences;var n,o=h.length;f=0;for(-1!==g.morphTargetBase&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(n=0;n<o;n++)!i[n]&&h[n]>k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]),j.vertexAttribPointer(c["morphNormal"+
|
|
|
f],3,j.FLOAT,!1,0,0));g.__webglMorphTargetInfluences[f]=k;i[l]=1;k=-1;f++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(f=0,h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&
|
|
|
(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));
|
|
|
0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==na&&(j.lineWidth(d),na=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,
|
|
|
-j.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=e.__webglFaceCount,G.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==na&&(j.lineWidth(d),na=d),j.drawArrays(g,0,e.__webglLineCount),G.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),G.info.render.calls++,G.info.render.points+=e.__webglParticleCount):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,
|
|
|
-0,e.__webglVertexCount),G.info.render.calls++)}};this.render=function(a,b,c,d){var e,g,m,n,l=a.lights,o=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=
|
|
|
-new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wa.multiply(b.projectionMatrix,b.matrixWorldInverse);db.setFromMatrix(Wa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof
|
|
|
-THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||db.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=g,q=p.object,t=p.buffer,E=void 0,E=E=void 0,E=q.material;if(E instanceof THREE.MeshFaceMaterial){if(E=t.materialIndex,0<=E)E=q.geometry.materials[E],E.transparent?(p.transparent=E,p.opaque=null):(p.opaque=E,p.transparent=null)}else if(E)E.transparent?(p.transparent=E,p.opaque=null):(p.opaque=E,p.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?
|
|
|
-g.z=m.renderDepth:($a.copy(m.position),Wa.multiplyVector3($a),g.z=$a.z)}this.sortObjects&&n.sort(f);n=a.__webglObjectsImmediate;for(d=0,e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),
|
|
|
-s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,l,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,l,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,l,o,!1),k(a.__webglObjectsImmediate,"opaque",b,l,o,!1),i(a.__webglObjects,!1,"transparent",b,l,o,!0),k(a.__webglObjectsImmediate,"transparent",b,l,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&
|
|
|
-c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var g=m(a,b,c,d,e);N=-1;G.setObjectFaces(e);e.immediateRenderCallback?
|
|
|
-e.immediateRenderCallback(g,j,db):e.render(function(a){G.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,i=void 0,m=void 0,k=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=
|
|
|
-new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){if(m=f.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=m,s=void 0,t=void 0,E=void 0,u=void 0,w=void 0,v=void 0,z=void 0,Q={},C=r.morphTargets.length,D=r.morphNormals.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)E=r.faces[s],u=E.materialIndex,v=void 0!==u?u:-1,void 0===Q[v]&&(Q[v]={hash:v,counter:0}),z=Q[v].hash+"_"+Q[v].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]=
|
|
|
-{faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:D}),w=E instanceof THREE.Face3?3:4,65535<r.geometryGroups[z].vertices+w&&(Q[v].counter+=1,z=Q[v].hash+"_"+Q[v].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:D})),E instanceof THREE.Face3?r.geometryGroups[z].faces3.push(s):r.geometryGroups[z].faces4.push(s),r.geometryGroups[z].vertices+=w;r.geometryGroupsList=[];var A=void 0;
|
|
|
-for(A in r.geometryGroups)r.geometryGroups[A].id=ia++,r.geometryGroupsList.push(r.geometryGroups[A])}for(i in m.geometryGroups)if(k=m.geometryGroups[i],!k.__webglVertexBuffer){var N=k;N.__webglVertexBuffer=j.createBuffer();N.__webglNormalBuffer=j.createBuffer();N.__webglTangentBuffer=j.createBuffer();N.__webglColorBuffer=j.createBuffer();N.__webglUVBuffer=j.createBuffer();N.__webglUV2Buffer=j.createBuffer();N.__webglSkinVertexABuffer=j.createBuffer();N.__webglSkinVertexBBuffer=j.createBuffer();N.__webglSkinIndicesBuffer=
|
|
|
-j.createBuffer();N.__webglSkinWeightsBuffer=j.createBuffer();N.__webglFaceBuffer=j.createBuffer();N.__webglLineBuffer=j.createBuffer();var B=void 0,I=void 0;if(N.numMorphTargets){N.__webglMorphTargetsBuffers=[];for(B=0,I=N.numMorphTargets;B<I;B++)N.__webglMorphTargetsBuffers.push(j.createBuffer())}if(N.numMorphNormals){N.__webglMorphNormalsBuffers=[];for(B=0,I=N.numMorphNormals;B<I;B++)N.__webglMorphNormalsBuffers.push(j.createBuffer())}G.info.memory.geometries++;var H=k,L=f,K=L.geometry,ea=H.faces3,
|
|
|
-aa=H.faces4,$=3*ea.length+4*aa.length,O=1*ea.length+2*aa.length,Y=3*ea.length+4*aa.length,ba=c(L,H),ca=e(ba),P=d(ba),S=ba.vertexColors?ba.vertexColors:!1;H.__vertexArray=new Float32Array(3*$);if(P)H.__normalArray=new Float32Array(3*$);if(K.hasTangents)H.__tangentArray=new Float32Array(4*$);if(S)H.__colorArray=new Float32Array(3*$);if(ca){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)H.__uvArray=new Float32Array(2*$);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)H.__uv2Array=new Float32Array(2*
|
|
|
-$)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length)H.__skinVertexAArray=new Float32Array(4*$),H.__skinVertexBArray=new Float32Array(4*$),H.__skinIndexArray=new Float32Array(4*$),H.__skinWeightArray=new Float32Array(4*$);H.__faceArray=new Uint16Array(3*O);H.__lineArray=new Uint16Array(2*Y);var fa=void 0,X=void 0;if(H.numMorphTargets){H.__morphTargetsArrays=[];for(fa=0,X=H.numMorphTargets;fa<X;fa++)H.__morphTargetsArrays.push(new Float32Array(3*$))}if(H.numMorphNormals){H.__morphNormalsArrays=
|
|
|
-[];for(fa=0,X=H.numMorphNormals;fa<X;fa++)H.__morphNormalsArrays.push(new Float32Array(3*$))}H.__webglFaceCount=3*O;H.__webglLineCount=2*Y;if(ba.attributes){if(void 0===H.__webglCustomAttributesList)H.__webglCustomAttributesList=[];var Ua=void 0;for(Ua in ba.attributes){var Ka=ba.attributes[Ua],na={},qa;for(qa in Ka)na[qa]=Ka[qa];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=!0;var ra=1;"v2"===na.type?ra=2:"v3"===na.type?ra=3:"v4"===na.type?ra=4:"c"===na.type&&(ra=3);na.size=
|
|
|
-ra;na.array=new Float32Array($*ra);na.buffer=j.createBuffer();na.buffer.belongsToAttribute=Ua;Ka.needsUpdate=!0;na.__original=Ka}H.__webglCustomAttributesList.push(na)}}H.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}}else if(f instanceof THREE.Ribbon){if(m=f.geometry,!m.__webglVertexBuffer){var Ha=m;Ha.__webglVertexBuffer=j.createBuffer();Ha.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;
|
|
|
-var ta=m,Aa=ta.vertices.length;ta.__vertexArray=new Float32Array(3*Aa);ta.__colorArray=new Float32Array(3*Aa);ta.__webglVertexCount=Aa;m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(f instanceof THREE.Line){if(m=f.geometry,!m.__webglVertexBuffer){var La=m;La.__webglVertexBuffer=j.createBuffer();La.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Fa=m,ib=f,Wa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*Wa);Fa.__colorArray=new Float32Array(3*Wa);Fa.__webglLineCount=Wa;
|
|
|
-b(Fa,ib);m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(f instanceof THREE.ParticleSystem&&(m=f.geometry,!m.__webglVertexBuffer)){var $a=m;$a.__webglVertexBuffer=j.createBuffer();$a.__webglColorBuffer=j.createBuffer();G.info.geometries++;var Va=m,lb=f,db=Va.vertices.length;Va.__vertexArray=new Float32Array(3*db);Va.__colorArray=new Float32Array(3*db);Va.__sortArray=[];Va.__webglParticleCount=db;b(Va,lb);m.__dirtyVertices=!0;m.__dirtyColors=!0}if(!f.__webglActive){if(f instanceof THREE.Mesh)if(m=
|
|
|
-f.geometry,m instanceof THREE.BufferGeometry)l(h.__webglObjects,m,f);else for(i in m.geometryGroups)k=m.geometryGroups[i],l(h.__webglObjects,k,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(m=f.geometry,l(h.__webglObjects,m,f)):void 0!==THREE.MarchingCubes&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite?h.__webglSprites.push(f):f instanceof
|
|
|
-THREE.LensFlare&&h.__webglFlares.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fb=a.__objectsRemoved[0],Fc=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof THREE.Line?o(Fc.__webglObjects,fb):fb instanceof THREE.Sprite?q(Fc.__webglSprites,fb):fb instanceof THREE.LensFlare?q(Fc.__webglFlares,fb):(fb instanceof THREE.MarchingCubes||fb.immediateRenderCallback)&&o(Fc.__webglObjectsImmediate,fb);fb.__webglActive=
|
|
|
-!1;a.__objectsRemoved.splice(0,1)}for(var Wc=0,rd=a.__webglObjects.length;Wc<rd;Wc++){var nb=a.__webglObjects[Wc].object,ja=nb.geometry,qc=void 0,ic=void 0,Ya=void 0;if(nb instanceof THREE.Mesh)if(ja instanceof THREE.BufferGeometry)ja.__dirtyVertices=!1,ja.__dirtyElements=!1,ja.__dirtyUvs=!1,ja.__dirtyNormals=!1,ja.__dirtyColors=!1;else{for(var Xc=0,sd=ja.geometryGroupsList.length;Xc<sd;Xc++)if(qc=ja.geometryGroupsList[Xc],Ya=c(nb,qc),ic=Ya.attributes&&p(Ya),ja.__dirtyVertices||ja.__dirtyMorphTargets||
|
|
|
-ja.__dirtyElements||ja.__dirtyUvs||ja.__dirtyNormals||ja.__dirtyColors||ja.__dirtyTangents||ic){var ga=qc,td=nb,ab=j.DYNAMIC_DRAW,ud=!ja.dynamic,bc=Ya;if(ga.__inittedArrays){var gd=d(bc),Yc=bc.vertexColors?bc.vertexColors:!1,hd=e(bc),Gc=gd===THREE.SmoothShading,F=void 0,T=void 0,kb=void 0,M=void 0,jc=void 0,Ob=void 0,ob=void 0,Hc=void 0,Hb=void 0,kc=void 0,lc=void 0,U=void 0,V=void 0,W=void 0,oa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,
|
|
|
-xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Ic=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Jc=void 0,ka=void 0,id=void 0,Vb=void 0,mc=void 0,nc=void 0,Ma=void 0,jd=void 0,Ia=void 0,Ja=void 0,Wb=void 0,Ib=void 0,Ba=0,Ea=0,Jb=0,Kb=0,gb=0,Ra=0,pa=0,Sa=0,Ca=0,J=0,da=0,y=0,bb=void 0,Na=ga.__vertexArray,wc=ga.__uvArray,xc=ga.__uv2Array,hb=ga.__normalArray,ua=ga.__tangentArray,Oa=ga.__colorArray,va=ga.__skinVertexAArray,wa=ga.__skinVertexBArray,
|
|
|
-xa=ga.__skinIndexArray,ya=ga.__skinWeightArray,Zc=ga.__morphTargetsArrays,$c=ga.__morphNormalsArrays,ad=ga.__webglCustomAttributesList,x=void 0,Eb=ga.__faceArray,cb=ga.__lineArray,Ta=td.geometry,vd=Ta.__dirtyElements,kd=Ta.__dirtyUvs,wd=Ta.__dirtyNormals,xd=Ta.__dirtyTangents,yd=Ta.__dirtyColors,zd=Ta.__dirtyMorphTargets,cc=Ta.vertices,la=ga.faces3,ma=ga.faces4,Da=Ta.faces,bd=Ta.faceVertexUvs[0],cd=Ta.faceVertexUvs[1],dc=Ta.skinVerticesA,ec=Ta.skinVerticesB,fc=Ta.skinIndices,Xb=Ta.skinWeights,Yb=
|
|
|
-Ta.morphTargets,Kc=Ta.morphNormals;if(Ta.__dirtyVertices){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=cc[M.a].position,V=cc[M.b].position,W=cc[M.c].position,Na[Ea]=U.x,Na[Ea+1]=U.y,Na[Ea+2]=U.z,Na[Ea+3]=V.x,Na[Ea+4]=V.y,Na[Ea+5]=V.z,Na[Ea+6]=W.x,Na[Ea+7]=W.y,Na[Ea+8]=W.z,Ea+=9;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],U=cc[M.a].position,V=cc[M.b].position,W=cc[M.c].position,oa=cc[M.d].position,Na[Ea]=U.x,Na[Ea+1]=U.y,Na[Ea+2]=U.z,Na[Ea+3]=V.x,Na[Ea+4]=V.y,Na[Ea+5]=V.z,Na[Ea+6]=W.x,Na[Ea+7]=W.y,Na[Ea+
|
|
|
-8]=W.z,Na[Ea+9]=oa.x,Na[Ea+10]=oa.y,Na[Ea+11]=oa.z,Ea+=12;j.bindBuffer(j.ARRAY_BUFFER,ga.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Na,ab)}if(zd)for(Ma=0,jd=Yb.length;Ma<jd;Ma++){da=0;for(F=0,T=la.length;F<T;F++){Wb=la[F];M=Da[Wb];U=Yb[Ma].vertices[M.a].position;V=Yb[Ma].vertices[M.b].position;W=Yb[Ma].vertices[M.c].position;Ia=Zc[Ma];Ia[da]=U.x;Ia[da+1]=U.y;Ia[da+2]=U.z;Ia[da+3]=V.x;Ia[da+4]=V.y;Ia[da+5]=V.z;Ia[da+6]=W.x;Ia[da+7]=W.y;Ia[da+8]=W.z;if(bc.morphNormals)Gc?(Ib=Kc[Ma].vertexNormals[Wb],
|
|
|
-sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=tb=sb=Kc[Ma].faceNormals[Wb],Ja=$c[Ma],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z;da+=9}for(F=0,T=ma.length;F<T;F++){Wb=ma[F];M=Da[Wb];U=Yb[Ma].vertices[M.a].position;V=Yb[Ma].vertices[M.b].position;W=Yb[Ma].vertices[M.c].position;oa=Yb[Ma].vertices[M.d].position;Ia=Zc[Ma];Ia[da]=U.x;Ia[da+1]=U.y;Ia[da+2]=U.z;Ia[da+3]=V.x;Ia[da+4]=V.y;Ia[da+5]=V.z;Ia[da+6]=W.x;Ia[da+7]=W.y;Ia[da+8]=W.z;Ia[da+
|
|
|
-9]=oa.x;Ia[da+10]=oa.y;Ia[da+11]=oa.z;if(bc.morphNormals)Gc?(Ib=Kc[Ma].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Kc[Ma].faceNormals[Wb],Ja=$c[Ma],Ja[da]=sb.x,Ja[da+1]=sb.y,Ja[da+2]=sb.z,Ja[da+3]=tb.x,Ja[da+4]=tb.y,Ja[da+5]=tb.z,Ja[da+6]=ub.x,Ja[da+7]=ub.y,Ja[da+8]=ub.z,Ja[da+9]=sc.x,Ja[da+10]=sc.y,Ja[da+11]=sc.z;da+=12}j.bindBuffer(j.ARRAY_BUFFER,ga.__webglMorphTargetsBuffers[Ma]);j.bufferData(j.ARRAY_BUFFER,Zc[Ma],ab);bc.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglMorphNormalsBuffers[Ma]),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,$c[Ma],ab))}if(Xb.length){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],
|
|
|
-va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,J+=12;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],uc=Xb[M.d],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=
|
|
|
-zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,ya[J+12]=uc.x,ya[J+13]=uc.y,ya[J+14]=uc.z,ya[J+15]=uc.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],vc=fc[M.d],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,xa[J+12]=vc.x,xa[J+13]=vc.y,xa[J+14]=vc.z,xa[J+15]=vc.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],Ic=dc[M.d],va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,
|
|
|
-va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,va[J+12]=Ic.x,va[J+13]=Ic.y,va[J+14]=Ic.z,va[J+15]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],Jc=ec[M.d],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,wa[J+12]=Jc.x,wa[J+13]=Jc.y,wa[J+14]=Jc.z,wa[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,va,ab),j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-ga.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,wa,ab),j.bindBuffer(j.ARRAY_BUFFER,ga.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,xa,ab),j.bindBuffer(j.ARRAY_BUFFER,ga.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ya,ab))}if(yd&&Yc){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],ob=M.vertexColors,Hc=M.color,3===ob.length&&Yc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Hc,Oa[Ca]=vb.r,Oa[Ca+1]=vb.g,Oa[Ca+2]=vb.b,Oa[Ca+3]=wb.r,Oa[Ca+4]=wb.g,Oa[Ca+5]=wb.b,Oa[Ca+6]=xb.r,
|
|
|
-Oa[Ca+7]=xb.g,Oa[Ca+8]=xb.b,Ca+=9;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],ob=M.vertexColors,Hc=M.color,4===ob.length&&Yc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Hc,Oa[Ca]=vb.r,Oa[Ca+1]=vb.g,Oa[Ca+2]=vb.b,Oa[Ca+3]=wb.r,Oa[Ca+4]=wb.g,Oa[Ca+5]=wb.b,Oa[Ca+6]=xb.r,Oa[Ca+7]=xb.g,Oa[Ca+8]=xb.b,Oa[Ca+9]=tc.r,Oa[Ca+10]=tc.g,Oa[Ca+11]=tc.b,Ca+=12;0<Ca&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Oa,ab))}if(xd&&Ta.hasTangents){for(F=0,T=la.length;F<
|
|
|
-T;F++)M=Da[la[F]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[pa]=pb.x,ua[pa+1]=pb.y,ua[pa+2]=pb.z,ua[pa+3]=pb.w,ua[pa+4]=qb.x,ua[pa+5]=qb.y,ua[pa+6]=qb.z,ua[pa+7]=qb.w,ua[pa+8]=rb.x,ua[pa+9]=rb.y,ua[pa+10]=rb.z,ua[pa+11]=rb.w,pa+=12;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[pa]=pb.x,ua[pa+1]=pb.y,ua[pa+2]=pb.z,ua[pa+3]=pb.w,ua[pa+4]=qb.x,ua[pa+5]=qb.y,ua[pa+6]=qb.z,ua[pa+7]=qb.w,ua[pa+8]=rb.x,ua[pa+9]=rb.y,ua[pa+10]=rb.z,ua[pa+11]=rb.w,
|
|
|
-ua[pa+12]=rc.x,ua[pa+13]=rc.y,ua[pa+14]=rc.z,ua[pa+15]=rc.w,pa+=16;j.bindBuffer(j.ARRAY_BUFFER,ga.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ua,ab)}if(wd&&gd){for(F=0,T=la.length;F<T;F++)if(M=Da[la[F]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Gc)for(ka=0;3>ka;ka++)Vb=jc[ka],hb[Ra]=Vb.x,hb[Ra+1]=Vb.y,hb[Ra+2]=Vb.z,Ra+=3;else for(ka=0;3>ka;ka++)hb[Ra]=Ob.x,hb[Ra+1]=Ob.y,hb[Ra+2]=Ob.z,Ra+=3;for(F=0,T=ma.length;F<T;F++)if(M=Da[ma[F]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Gc)for(ka=
|
|
|
-0;4>ka;ka++)Vb=jc[ka],hb[Ra]=Vb.x,hb[Ra+1]=Vb.y,hb[Ra+2]=Vb.z,Ra+=3;else for(ka=0;4>ka;ka++)hb[Ra]=Ob.x,hb[Ra+1]=Ob.y,hb[Ra+2]=Ob.z,Ra+=3;j.bindBuffer(j.ARRAY_BUFFER,ga.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hb,ab)}if(kd&&bd&&hd){for(F=0,T=la.length;F<T;F++)if(kb=la[F],M=Da[kb],kc=bd[kb],void 0!==kc)for(ka=0;3>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(F=0,T=ma.length;F<T;F++)if(kb=ma[F],M=Da[kb],kc=bd[kb],void 0!==kc)for(ka=0;4>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=
|
|
|
-2;0<Jb&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,wc,ab))}if(kd&&cd&&hd){for(F=0,T=la.length;F<T;F++)if(kb=la[F],M=Da[kb],lc=cd[kb],void 0!==lc)for(ka=0;3>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(F=0,T=ma.length;F<T;F++)if(kb=ma[F],M=Da[kb],lc=cd[kb],void 0!==lc)for(ka=0;4>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(j.bindBuffer(j.ARRAY_BUFFER,ga.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,xc,ab))}if(vd){for(F=0,T=la.length;F<T;F++)M=
|
|
|
-Da[la[F]],Eb[gb]=Ba,Eb[gb+1]=Ba+1,Eb[gb+2]=Ba+2,gb+=3,cb[Sa]=Ba,cb[Sa+1]=Ba+1,cb[Sa+2]=Ba,cb[Sa+3]=Ba+2,cb[Sa+4]=Ba+1,cb[Sa+5]=Ba+2,Sa+=6,Ba+=3;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],Eb[gb]=Ba,Eb[gb+1]=Ba+1,Eb[gb+2]=Ba+3,Eb[gb+3]=Ba+1,Eb[gb+4]=Ba+2,Eb[gb+5]=Ba+3,gb+=6,cb[Sa]=Ba,cb[Sa+1]=Ba+1,cb[Sa+2]=Ba,cb[Sa+3]=Ba+3,cb[Sa+4]=Ba+1,cb[Sa+5]=Ba+2,cb[Sa+6]=Ba+2,cb[Sa+7]=Ba+3,Sa+=8,Ba+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ga.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,ab);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-ga.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,cb,ab)}if(ad)for(ka=0,id=ad.length;ka<id;ka++)if(x=ad[ka],x.__original.needsUpdate){y=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],x.array[y]=x.value[M.a],x.array[y+1]=x.value[M.b],x.array[y+2]=x.value[M.c],y+=3;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],x.array[y]=x.value[M.a],x.array[y+1]=x.value[M.b],x.array[y+2]=x.value[M.c],x.array[y+3]=x.value[M.d],y+=4}else{if("faces"===x.boundTo){for(F=
|
|
|
-0,T=la.length;F<T;F++)bb=x.value[la[F]],x.array[y]=bb,x.array[y+1]=bb,x.array[y+2]=bb,y+=3;for(F=0,T=ma.length;F<T;F++)bb=x.value[ma[F]],x.array[y]=bb,x.array[y+1]=bb,x.array[y+2]=bb,x.array[y+3]=bb,y+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,y+=6;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],
|
|
|
-U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],oa=x.value[M.d],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=oa.x,x.array[y+7]=oa.y,y+=8}else{if("faces"===x.boundTo){for(F=0,T=la.length;F<T;F++)W=V=U=bb=x.value[la[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,y+=6;for(F=0,T=ma.length;F<T;F++)oa=W=V=U=bb=x.value[ma[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=V.x,x.array[y+
|
|
|
-3]=V.y,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=oa.x,x.array[y+7]=oa.y,y+=8}}else if(3===x.size){var ha;ha="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],y+=9;for(F=0,T=ma.length;F<
|
|
|
-T;F++)M=Da[ma[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],oa=x.value[M.d],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],x.array[y+9]=oa[ha[0]],x.array[y+10]=oa[ha[1]],x.array[y+11]=oa[ha[2]],y+=12}else if("faces"===x.boundTo){for(F=0,T=la.length;F<T;F++)W=V=U=bb=x.value[la[F]],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+
|
|
|
-3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],y+=9;for(F=0,T=ma.length;F<T;F++)oa=W=V=U=bb=x.value[ma[F]],x.array[y]=U[ha[0]],x.array[y+1]=U[ha[1]],x.array[y+2]=U[ha[2]],x.array[y+3]=V[ha[0]],x.array[y+4]=V[ha[1]],x.array[y+5]=V[ha[2]],x.array[y+6]=W[ha[0]],x.array[y+7]=W[ha[1]],x.array[y+8]=W[ha[2]],x.array[y+9]=oa[ha[0]],x.array[y+10]=oa[ha[1]],x.array[y+11]=oa[ha[2]],y+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===
|
|
|
-x.boundTo){for(F=0,T=la.length;F<T;F++)M=Da[la[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,y+=12;for(F=0,T=ma.length;F<T;F++)M=Da[ma[F]],U=x.value[M.a],V=x.value[M.b],W=x.value[M.c],oa=x.value[M.d],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=
|
|
|
-V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,x.array[y+12]=oa.x,x.array[y+13]=oa.y,x.array[y+14]=oa.z,x.array[y+15]=oa.w,y+=16}else if("faces"===x.boundTo){for(F=0,T=la.length;F<T;F++)W=V=U=bb=x.value[la[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,y+=12;for(F=0,T=ma.length;F<
|
|
|
-T;F++)oa=W=V=U=bb=x.value[ma[F]],x.array[y]=U.x,x.array[y+1]=U.y,x.array[y+2]=U.z,x.array[y+3]=U.w,x.array[y+4]=V.x,x.array[y+5]=V.y,x.array[y+6]=V.z,x.array[y+7]=V.w,x.array[y+8]=W.x,x.array[y+9]=W.y,x.array[y+10]=W.z,x.array[y+11]=W.w,x.array[y+12]=oa.x,x.array[y+13]=oa.y,x.array[y+14]=oa.z,x.array[y+15]=oa.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,ab)}ud&&(delete ga.__inittedArrays,delete ga.__colorArray,delete ga.__normalArray,delete ga.__tangentArray,delete ga.__uvArray,
|
|
|
-delete ga.__uv2Array,delete ga.__faceArray,delete ga.__vertexArray,delete ga.__lineArray,delete ga.__skinVertexAArray,delete ga.__skinVertexBArray,delete ga.__skinIndexArray,delete ga.__skinWeightArray)}}ja.__dirtyVertices=!1;ja.__dirtyMorphTargets=!1;ja.__dirtyElements=!1;ja.__dirtyUvs=!1;ja.__dirtyNormals=!1;ja.__dirtyColors=!1;ja.__dirtyTangents=!1;Ya.attributes&&n(Ya)}else if(nb instanceof THREE.Ribbon){if(ja.__dirtyVertices||ja.__dirtyColors){var Zb=ja,ld=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Lc=
|
|
|
+j.UNSIGNED_SHORT,0)),H.info.render.calls++,H.info.render.vertices+=e.__webglFaceCount,H.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==na&&(j.lineWidth(d),na=d),j.drawArrays(g,0,e.__webglLineCount),H.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),H.info.render.calls++,H.info.render.points+=e.__webglParticleCount):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,
|
|
|
+0,e.__webglVertexCount),H.info.render.calls++)}};this.render=function(a,b,c,d){var e,g,m,l,n=a.lights,o=a.fog;Z=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=
|
|
|
+new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Wa.multiply(b.projectionMatrix,b.matrixWorldInverse);db.setFromMatrix(Wa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;for(d=0,e=l.length;d<e;d++)if(g=l[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof
|
|
|
+THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||db.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=g,q=p.object,t=p.buffer,F=void 0,F=F=void 0,F=q.material;if(F instanceof THREE.MeshFaceMaterial){if(F=t.materialIndex,0<=F)F=q.geometry.materials[F],F.transparent?(p.transparent=F,p.opaque=null):(p.opaque=F,p.transparent=null)}else if(F)F.transparent?(p.transparent=F,p.opaque=null):(p.opaque=F,p.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?
|
|
|
+g.z=m.renderDepth:($a.copy(m.position),Wa.multiplyVector3($a),g.z=$a.z)}this.sortObjects&&l.sort(f);l=a.__webglObjectsImmediate;for(d=0,e=l.length;d<e;d++)if(g=l[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),
|
|
|
+s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,"transparent",b,n,o,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&
|
|
|
+c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var g=m(a,b,c,d,e);O=-1;H.setObjectFaces(e);e.immediateRenderCallback?
|
|
|
+e.immediateRenderCallback(g,j,db):e.render(function(a){H.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,i=void 0,m=void 0,k=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=
|
|
|
+new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){if(m=f.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=m,s=void 0,F=void 0,t=void 0,u=void 0,w=void 0,v=void 0,B=void 0,A={},C=r.morphTargets.length,O=r.morphNormals.length;r.geometryGroups={};for(s=0,F=r.faces.length;s<F;s++)t=r.faces[s],u=t.materialIndex,v=void 0!==u?u:-1,void 0===A[v]&&(A[v]={hash:v,counter:0}),B=A[v].hash+"_"+A[v].counter,void 0===r.geometryGroups[B]&&(r.geometryGroups[B]=
|
|
|
+{faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:O}),w=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[B].vertices+w&&(A[v].counter+=1,B=A[v].hash+"_"+A[v].counter,void 0===r.geometryGroups[B]&&(r.geometryGroups[B]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C,numMorphNormals:O})),t instanceof THREE.Face3?r.geometryGroups[B].faces3.push(s):r.geometryGroups[B].faces4.push(s),r.geometryGroups[B].vertices+=w;r.geometryGroupsList=[];var Z=void 0;
|
|
|
+for(Z in r.geometryGroups)r.geometryGroups[Z].id=da++,r.geometryGroupsList.push(r.geometryGroups[Z])}for(i in m.geometryGroups)if(k=m.geometryGroups[i],!k.__webglVertexBuffer){var y=k;y.__webglVertexBuffer=j.createBuffer();y.__webglNormalBuffer=j.createBuffer();y.__webglTangentBuffer=j.createBuffer();y.__webglColorBuffer=j.createBuffer();y.__webglUVBuffer=j.createBuffer();y.__webglUV2Buffer=j.createBuffer();y.__webglSkinVertexABuffer=j.createBuffer();y.__webglSkinVertexBBuffer=j.createBuffer();y.__webglSkinIndicesBuffer=
|
|
|
+j.createBuffer();y.__webglSkinWeightsBuffer=j.createBuffer();y.__webglFaceBuffer=j.createBuffer();y.__webglLineBuffer=j.createBuffer();var D=void 0,S=void 0;if(y.numMorphTargets){y.__webglMorphTargetsBuffers=[];for(D=0,S=y.numMorphTargets;D<S;D++)y.__webglMorphTargetsBuffers.push(j.createBuffer())}if(y.numMorphNormals){y.__webglMorphNormalsBuffers=[];for(D=0,S=y.numMorphNormals;D<S;D++)y.__webglMorphNormalsBuffers.push(j.createBuffer())}H.info.memory.geometries++;var E=k,M=f,K=M.geometry,J=E.faces3,
|
|
|
+ga=E.faces4,R=3*J.length+4*ga.length,N=1*J.length+2*ga.length,ia=3*J.length+4*ga.length,aa=c(M,E),ba=e(aa),P=d(aa),T=aa.vertexColors?aa.vertexColors:!1;E.__vertexArray=new Float32Array(3*R);if(P)E.__normalArray=new Float32Array(3*R);if(K.hasTangents)E.__tangentArray=new Float32Array(4*R);if(T)E.__colorArray=new Float32Array(3*R);if(ba){if(0<K.faceUvs.length||0<K.faceVertexUvs.length)E.__uvArray=new Float32Array(2*R);if(1<K.faceUvs.length||1<K.faceVertexUvs.length)E.__uv2Array=new Float32Array(2*R)}if(M.geometry.skinWeights.length&&
|
|
|
+M.geometry.skinIndices.length)E.__skinVertexAArray=new Float32Array(4*R),E.__skinVertexBArray=new Float32Array(4*R),E.__skinIndexArray=new Float32Array(4*R),E.__skinWeightArray=new Float32Array(4*R);E.__faceArray=new Uint16Array(3*N);E.__lineArray=new Uint16Array(2*ia);var ea=void 0,Y=void 0;if(E.numMorphTargets){E.__morphTargetsArrays=[];for(ea=0,Y=E.numMorphTargets;ea<Y;ea++)E.__morphTargetsArrays.push(new Float32Array(3*R))}if(E.numMorphNormals){E.__morphNormalsArrays=[];for(ea=0,Y=E.numMorphNormals;ea<
|
|
|
+Y;ea++)E.__morphNormalsArrays.push(new Float32Array(3*R))}E.__webglFaceCount=3*N;E.__webglLineCount=2*ia;if(aa.attributes){if(void 0===E.__webglCustomAttributesList)E.__webglCustomAttributesList=[];var Ua=void 0;for(Ua in aa.attributes){var Ha=aa.attributes[Ua],na={},qa;for(qa in Ha)na[qa]=Ha[qa];if(!na.__webglInitialized||na.createUniqueBuffers){na.__webglInitialized=!0;var ra=1;"v2"===na.type?ra=2:"v3"===na.type?ra=3:"v4"===na.type?ra=4:"c"===na.type&&(ra=3);na.size=ra;na.array=new Float32Array(R*
|
|
|
+ra);na.buffer=j.createBuffer();na.buffer.belongsToAttribute=Ua;Ha.needsUpdate=!0;na.__original=Ha}E.__webglCustomAttributesList.push(na)}}E.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}}else if(f instanceof THREE.Ribbon){if(m=f.geometry,!m.__webglVertexBuffer){var Ia=m;Ia.__webglVertexBuffer=j.createBuffer();Ia.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var ta=
|
|
|
+m,Aa=ta.vertices.length;ta.__vertexArray=new Float32Array(3*Aa);ta.__colorArray=new Float32Array(3*Aa);ta.__webglVertexCount=Aa;m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(f instanceof THREE.Line){if(m=f.geometry,!m.__webglVertexBuffer){var La=m;La.__webglVertexBuffer=j.createBuffer();La.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Fa=m,ib=f,Wa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*Wa);Fa.__colorArray=new Float32Array(3*Wa);Fa.__webglLineCount=Wa;b(Fa,ib);
|
|
|
+m.__dirtyVertices=!0;m.__dirtyColors=!0}}else if(f instanceof THREE.ParticleSystem&&(m=f.geometry,!m.__webglVertexBuffer)){var $a=m;$a.__webglVertexBuffer=j.createBuffer();$a.__webglColorBuffer=j.createBuffer();H.info.geometries++;var Va=m,lb=f,db=Va.vertices.length;Va.__vertexArray=new Float32Array(3*db);Va.__colorArray=new Float32Array(3*db);Va.__sortArray=[];Va.__webglParticleCount=db;b(Va,lb);m.__dirtyVertices=!0;m.__dirtyColors=!0}if(!f.__webglActive){if(f instanceof THREE.Mesh)if(m=f.geometry,
|
|
|
+m instanceof THREE.BufferGeometry)l(h.__webglObjects,m,f);else for(i in m.geometryGroups)k=m.geometryGroups[i],l(h.__webglObjects,k,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(m=f.geometry,l(h.__webglObjects,m,f)):void 0!==THREE.MarchingCubes&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite?h.__webglSprites.push(f):f instanceof THREE.LensFlare&&
|
|
|
+h.__webglFlares.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fb=a.__objectsRemoved[0],Fc=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof THREE.Line?o(Fc.__webglObjects,fb):fb instanceof THREE.Sprite?q(Fc.__webglSprites,fb):fb instanceof THREE.LensFlare?q(Fc.__webglFlares,fb):(fb instanceof THREE.MarchingCubes||fb.immediateRenderCallback)&&o(Fc.__webglObjectsImmediate,fb);fb.__webglActive=!1;a.__objectsRemoved.splice(0,
|
|
|
+1)}for(var Wc=0,rd=a.__webglObjects.length;Wc<rd;Wc++){var nb=a.__webglObjects[Wc].object,ja=nb.geometry,qc=void 0,ic=void 0,Ya=void 0;if(nb instanceof THREE.Mesh)if(ja instanceof THREE.BufferGeometry)ja.__dirtyVertices=!1,ja.__dirtyElements=!1,ja.__dirtyUvs=!1,ja.__dirtyNormals=!1,ja.__dirtyColors=!1;else{for(var Xc=0,sd=ja.geometryGroupsList.length;Xc<sd;Xc++)if(qc=ja.geometryGroupsList[Xc],Ya=c(nb,qc),ic=Ya.attributes&&p(Ya),ja.__dirtyVertices||ja.__dirtyMorphTargets||ja.__dirtyElements||ja.__dirtyUvs||
|
|
|
+ja.__dirtyNormals||ja.__dirtyColors||ja.__dirtyTangents||ic){var fa=qc,td=nb,ab=j.DYNAMIC_DRAW,ud=!ja.dynamic,bc=Ya;if(fa.__inittedArrays){var gd=d(bc),Yc=bc.vertexColors?bc.vertexColors:!1,hd=e(bc),Gc=gd===THREE.SmoothShading,G=void 0,U=void 0,kb=void 0,L=void 0,jc=void 0,Ob=void 0,ob=void 0,Hc=void 0,Hb=void 0,kc=void 0,lc=void 0,V=void 0,W=void 0,X=void 0,oa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,
|
|
|
+zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Ic=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Jc=void 0,ka=void 0,id=void 0,Vb=void 0,mc=void 0,nc=void 0,Ma=void 0,jd=void 0,Ja=void 0,Ka=void 0,Wb=void 0,Ib=void 0,Ba=0,Ea=0,Jb=0,Kb=0,gb=0,Ra=0,pa=0,Sa=0,Ca=0,I=0,ca=0,z=0,bb=void 0,Na=fa.__vertexArray,wc=fa.__uvArray,xc=fa.__uv2Array,hb=fa.__normalArray,ua=fa.__tangentArray,Oa=fa.__colorArray,va=fa.__skinVertexAArray,wa=fa.__skinVertexBArray,xa=fa.__skinIndexArray,
|
|
|
+ya=fa.__skinWeightArray,Zc=fa.__morphTargetsArrays,$c=fa.__morphNormalsArrays,ad=fa.__webglCustomAttributesList,x=void 0,Eb=fa.__faceArray,cb=fa.__lineArray,Ta=td.geometry,vd=Ta.__dirtyElements,kd=Ta.__dirtyUvs,wd=Ta.__dirtyNormals,xd=Ta.__dirtyTangents,yd=Ta.__dirtyColors,zd=Ta.__dirtyMorphTargets,cc=Ta.vertices,la=fa.faces3,ma=fa.faces4,Da=Ta.faces,bd=Ta.faceVertexUvs[0],cd=Ta.faceVertexUvs[1],dc=Ta.skinVerticesA,ec=Ta.skinVerticesB,fc=Ta.skinIndices,Xb=Ta.skinWeights,Yb=Ta.morphTargets,Kc=Ta.morphNormals;
|
|
|
+if(Ta.__dirtyVertices){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],V=cc[L.a].position,W=cc[L.b].position,X=cc[L.c].position,Na[Ea]=V.x,Na[Ea+1]=V.y,Na[Ea+2]=V.z,Na[Ea+3]=W.x,Na[Ea+4]=W.y,Na[Ea+5]=W.z,Na[Ea+6]=X.x,Na[Ea+7]=X.y,Na[Ea+8]=X.z,Ea+=9;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],V=cc[L.a].position,W=cc[L.b].position,X=cc[L.c].position,oa=cc[L.d].position,Na[Ea]=V.x,Na[Ea+1]=V.y,Na[Ea+2]=V.z,Na[Ea+3]=W.x,Na[Ea+4]=W.y,Na[Ea+5]=W.z,Na[Ea+6]=X.x,Na[Ea+7]=X.y,Na[Ea+8]=X.z,Na[Ea+9]=oa.x,Na[Ea+10]=oa.y,
|
|
|
+Na[Ea+11]=oa.z,Ea+=12;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Na,ab)}if(zd)for(Ma=0,jd=Yb.length;Ma<jd;Ma++){ca=0;for(G=0,U=la.length;G<U;G++){Wb=la[G];L=Da[Wb];V=Yb[Ma].vertices[L.a].position;W=Yb[Ma].vertices[L.b].position;X=Yb[Ma].vertices[L.c].position;Ja=Zc[Ma];Ja[ca]=V.x;Ja[ca+1]=V.y;Ja[ca+2]=V.z;Ja[ca+3]=W.x;Ja[ca+4]=W.y;Ja[ca+5]=W.z;Ja[ca+6]=X.x;Ja[ca+7]=X.y;Ja[ca+8]=X.z;if(bc.morphNormals)Gc?(Ib=Kc[Ma].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=
|
|
|
+tb=sb=Kc[Ma].faceNormals[Wb],Ka=$c[Ma],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z;ca+=9}for(G=0,U=ma.length;G<U;G++){Wb=ma[G];L=Da[Wb];V=Yb[Ma].vertices[L.a].position;W=Yb[Ma].vertices[L.b].position;X=Yb[Ma].vertices[L.c].position;oa=Yb[Ma].vertices[L.d].position;Ja=Zc[Ma];Ja[ca]=V.x;Ja[ca+1]=V.y;Ja[ca+2]=V.z;Ja[ca+3]=W.x;Ja[ca+4]=W.y;Ja[ca+5]=W.z;Ja[ca+6]=X.x;Ja[ca+7]=X.y;Ja[ca+8]=X.z;Ja[ca+9]=oa.x;Ja[ca+10]=oa.y;Ja[ca+
|
|
|
+11]=oa.z;if(bc.morphNormals)Gc?(Ib=Kc[Ma].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Kc[Ma].faceNormals[Wb],Ka=$c[Ma],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z,Ka[ca+9]=sc.x,Ka[ca+10]=sc.y,Ka[ca+11]=sc.z;ca+=12}j.bindBuffer(j.ARRAY_BUFFER,fa.__webglMorphTargetsBuffers[Ma]);j.bufferData(j.ARRAY_BUFFER,Zc[Ma],ab);bc.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglMorphNormalsBuffers[Ma]),j.bufferData(j.ARRAY_BUFFER,
|
|
|
+$c[Ma],ab))}if(Xb.length){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],yb=Xb[L.a],zb=Xb[L.b],Ab=Xb[L.c],ya[I]=yb.x,ya[I+1]=yb.y,ya[I+2]=yb.z,ya[I+3]=yb.w,ya[I+4]=zb.x,ya[I+5]=zb.y,ya[I+6]=zb.z,ya[I+7]=zb.w,ya[I+8]=Ab.x,ya[I+9]=Ab.y,ya[I+10]=Ab.z,ya[I+11]=Ab.w,Bb=fc[L.a],Cb=fc[L.b],Db=fc[L.c],xa[I]=Bb.x,xa[I+1]=Bb.y,xa[I+2]=Bb.z,xa[I+3]=Bb.w,xa[I+4]=Cb.x,xa[I+5]=Cb.y,xa[I+6]=Cb.z,xa[I+7]=Cb.w,xa[I+8]=Db.x,xa[I+9]=Db.y,xa[I+10]=Db.z,xa[I+11]=Db.w,Pb=dc[L.a],Qb=dc[L.b],Rb=dc[L.c],va[I]=Pb.x,va[I+1]=Pb.y,
|
|
|
+va[I+2]=Pb.z,va[I+3]=1,va[I+4]=Qb.x,va[I+5]=Qb.y,va[I+6]=Qb.z,va[I+7]=1,va[I+8]=Rb.x,va[I+9]=Rb.y,va[I+10]=Rb.z,va[I+11]=1,Sb=ec[L.a],Tb=ec[L.b],Ub=ec[L.c],wa[I]=Sb.x,wa[I+1]=Sb.y,wa[I+2]=Sb.z,wa[I+3]=1,wa[I+4]=Tb.x,wa[I+5]=Tb.y,wa[I+6]=Tb.z,wa[I+7]=1,wa[I+8]=Ub.x,wa[I+9]=Ub.y,wa[I+10]=Ub.z,wa[I+11]=1,I+=12;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],yb=Xb[L.a],zb=Xb[L.b],Ab=Xb[L.c],uc=Xb[L.d],ya[I]=yb.x,ya[I+1]=yb.y,ya[I+2]=yb.z,ya[I+3]=yb.w,ya[I+4]=zb.x,ya[I+5]=zb.y,ya[I+6]=zb.z,ya[I+7]=zb.w,ya[I+8]=
|
|
|
+Ab.x,ya[I+9]=Ab.y,ya[I+10]=Ab.z,ya[I+11]=Ab.w,ya[I+12]=uc.x,ya[I+13]=uc.y,ya[I+14]=uc.z,ya[I+15]=uc.w,Bb=fc[L.a],Cb=fc[L.b],Db=fc[L.c],vc=fc[L.d],xa[I]=Bb.x,xa[I+1]=Bb.y,xa[I+2]=Bb.z,xa[I+3]=Bb.w,xa[I+4]=Cb.x,xa[I+5]=Cb.y,xa[I+6]=Cb.z,xa[I+7]=Cb.w,xa[I+8]=Db.x,xa[I+9]=Db.y,xa[I+10]=Db.z,xa[I+11]=Db.w,xa[I+12]=vc.x,xa[I+13]=vc.y,xa[I+14]=vc.z,xa[I+15]=vc.w,Pb=dc[L.a],Qb=dc[L.b],Rb=dc[L.c],Ic=dc[L.d],va[I]=Pb.x,va[I+1]=Pb.y,va[I+2]=Pb.z,va[I+3]=1,va[I+4]=Qb.x,va[I+5]=Qb.y,va[I+6]=Qb.z,va[I+7]=1,va[I+
|
|
|
+8]=Rb.x,va[I+9]=Rb.y,va[I+10]=Rb.z,va[I+11]=1,va[I+12]=Ic.x,va[I+13]=Ic.y,va[I+14]=Ic.z,va[I+15]=1,Sb=ec[L.a],Tb=ec[L.b],Ub=ec[L.c],Jc=ec[L.d],wa[I]=Sb.x,wa[I+1]=Sb.y,wa[I+2]=Sb.z,wa[I+3]=1,wa[I+4]=Tb.x,wa[I+5]=Tb.y,wa[I+6]=Tb.z,wa[I+7]=1,wa[I+8]=Ub.x,wa[I+9]=Ub.y,wa[I+10]=Ub.z,wa[I+11]=1,wa[I+12]=Jc.x,wa[I+13]=Jc.y,wa[I+14]=Jc.z,wa[I+15]=1,I+=16;0<I&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,va,ab),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinVertexBBuffer),
|
|
|
+j.bufferData(j.ARRAY_BUFFER,wa,ab),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,xa,ab),j.bindBuffer(j.ARRAY_BUFFER,fa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ya,ab))}if(yd&&Yc){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],ob=L.vertexColors,Hc=L.color,3===ob.length&&Yc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Hc,Oa[Ca]=vb.r,Oa[Ca+1]=vb.g,Oa[Ca+2]=vb.b,Oa[Ca+3]=wb.r,Oa[Ca+4]=wb.g,Oa[Ca+5]=wb.b,Oa[Ca+6]=xb.r,Oa[Ca+7]=xb.g,Oa[Ca+8]=xb.b,
|
|
|
+Ca+=9;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],ob=L.vertexColors,Hc=L.color,4===ob.length&&Yc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Hc,Oa[Ca]=vb.r,Oa[Ca+1]=vb.g,Oa[Ca+2]=vb.b,Oa[Ca+3]=wb.r,Oa[Ca+4]=wb.g,Oa[Ca+5]=wb.b,Oa[Ca+6]=xb.r,Oa[Ca+7]=xb.g,Oa[Ca+8]=xb.b,Oa[Ca+9]=tc.r,Oa[Ca+10]=tc.g,Oa[Ca+11]=tc.b,Ca+=12;0<Ca&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Oa,ab))}if(xd&&Ta.hasTangents){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],Hb=
|
|
|
+L.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[pa]=pb.x,ua[pa+1]=pb.y,ua[pa+2]=pb.z,ua[pa+3]=pb.w,ua[pa+4]=qb.x,ua[pa+5]=qb.y,ua[pa+6]=qb.z,ua[pa+7]=qb.w,ua[pa+8]=rb.x,ua[pa+9]=rb.y,ua[pa+10]=rb.z,ua[pa+11]=rb.w,pa+=12;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],Hb=L.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[pa]=pb.x,ua[pa+1]=pb.y,ua[pa+2]=pb.z,ua[pa+3]=pb.w,ua[pa+4]=qb.x,ua[pa+5]=qb.y,ua[pa+6]=qb.z,ua[pa+7]=qb.w,ua[pa+8]=rb.x,ua[pa+9]=rb.y,ua[pa+10]=rb.z,ua[pa+11]=rb.w,ua[pa+12]=rc.x,ua[pa+
|
|
|
+13]=rc.y,ua[pa+14]=rc.z,ua[pa+15]=rc.w,pa+=16;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ua,ab)}if(wd&&gd){for(G=0,U=la.length;G<U;G++)if(L=Da[la[G]],jc=L.vertexNormals,Ob=L.normal,3===jc.length&&Gc)for(ka=0;3>ka;ka++)Vb=jc[ka],hb[Ra]=Vb.x,hb[Ra+1]=Vb.y,hb[Ra+2]=Vb.z,Ra+=3;else for(ka=0;3>ka;ka++)hb[Ra]=Ob.x,hb[Ra+1]=Ob.y,hb[Ra+2]=Ob.z,Ra+=3;for(G=0,U=ma.length;G<U;G++)if(L=Da[ma[G]],jc=L.vertexNormals,Ob=L.normal,4===jc.length&&Gc)for(ka=0;4>ka;ka++)Vb=jc[ka],
|
|
|
+hb[Ra]=Vb.x,hb[Ra+1]=Vb.y,hb[Ra+2]=Vb.z,Ra+=3;else for(ka=0;4>ka;ka++)hb[Ra]=Ob.x,hb[Ra+1]=Ob.y,hb[Ra+2]=Ob.z,Ra+=3;j.bindBuffer(j.ARRAY_BUFFER,fa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hb,ab)}if(kd&&bd&&hd){for(G=0,U=la.length;G<U;G++)if(kb=la[G],L=Da[kb],kc=bd[kb],void 0!==kc)for(ka=0;3>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(G=0,U=ma.length;G<U;G++)if(kb=ma[G],L=Da[kb],kc=bd[kb],void 0!==kc)for(ka=0;4>ka;ka++)mc=kc[ka],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+fa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,wc,ab))}if(kd&&cd&&hd){for(G=0,U=la.length;G<U;G++)if(kb=la[G],L=Da[kb],lc=cd[kb],void 0!==lc)for(ka=0;3>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(G=0,U=ma.length;G<U;G++)if(kb=ma[G],L=Da[kb],lc=cd[kb],void 0!==lc)for(ka=0;4>ka;ka++)nc=lc[ka],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(j.bindBuffer(j.ARRAY_BUFFER,fa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,xc,ab))}if(vd){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],Eb[gb]=Ba,Eb[gb+1]=Ba+1,Eb[gb+
|
|
|
+2]=Ba+2,gb+=3,cb[Sa]=Ba,cb[Sa+1]=Ba+1,cb[Sa+2]=Ba,cb[Sa+3]=Ba+2,cb[Sa+4]=Ba+1,cb[Sa+5]=Ba+2,Sa+=6,Ba+=3;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],Eb[gb]=Ba,Eb[gb+1]=Ba+1,Eb[gb+2]=Ba+3,Eb[gb+3]=Ba+1,Eb[gb+4]=Ba+2,Eb[gb+5]=Ba+3,gb+=6,cb[Sa]=Ba,cb[Sa+1]=Ba+1,cb[Sa+2]=Ba,cb[Sa+3]=Ba+3,cb[Sa+4]=Ba+1,cb[Sa+5]=Ba+2,cb[Sa+6]=Ba+2,cb[Sa+7]=Ba+3,Sa+=8,Ba+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,fa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,ab);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,fa.__webglLineBuffer);
|
|
|
+j.bufferData(j.ELEMENT_ARRAY_BUFFER,cb,ab)}if(ad)for(ka=0,id=ad.length;ka<id;ka++)if(x=ad[ka],x.__original.needsUpdate){z=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],x.array[z]=x.value[L.a],x.array[z+1]=x.value[L.b],x.array[z+2]=x.value[L.c],z+=3;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],x.array[z]=x.value[L.a],x.array[z+1]=x.value[L.b],x.array[z+2]=x.value[L.c],x.array[z+3]=x.value[L.d],z+=4}else{if("faces"===x.boundTo){for(G=0,U=la.length;G<
|
|
|
+U;G++)bb=x.value[la[G]],x.array[z]=bb,x.array[z+1]=bb,x.array[z+2]=bb,z+=3;for(G=0,U=ma.length;G<U;G++)bb=x.value[ma[G]],x.array[z]=bb,x.array[z+1]=bb,x.array[z+2]=bb,x.array[z+3]=bb,z+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],V=x.value[L.a],W=x.value[L.b],X=x.value[L.c],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=W.x,x.array[z+3]=W.y,x.array[z+4]=X.x,x.array[z+5]=X.y,z+=6;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],V=x.value[L.a],W=
|
|
|
+x.value[L.b],X=x.value[L.c],oa=x.value[L.d],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=W.x,x.array[z+3]=W.y,x.array[z+4]=X.x,x.array[z+5]=X.y,x.array[z+6]=oa.x,x.array[z+7]=oa.y,z+=8}else{if("faces"===x.boundTo){for(G=0,U=la.length;G<U;G++)X=W=V=bb=x.value[la[G]],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=W.x,x.array[z+3]=W.y,x.array[z+4]=X.x,x.array[z+5]=X.y,z+=6;for(G=0,U=ma.length;G<U;G++)oa=X=W=V=bb=x.value[ma[G]],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=W.x,x.array[z+3]=W.y,x.array[z+
|
|
|
+4]=X.x,x.array[z+5]=X.y,x.array[z+6]=oa.x,x.array[z+7]=oa.y,z+=8}}else if(3===x.size){var ha;ha="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,U=la.length;G<U;G++)L=Da[la[G]],V=x.value[L.a],W=x.value[L.b],X=x.value[L.c],x.array[z]=V[ha[0]],x.array[z+1]=V[ha[1]],x.array[z+2]=V[ha[2]],x.array[z+3]=W[ha[0]],x.array[z+4]=W[ha[1]],x.array[z+5]=W[ha[2]],x.array[z+6]=X[ha[0]],x.array[z+7]=X[ha[1]],x.array[z+8]=X[ha[2]],z+=9;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],
|
|
|
+V=x.value[L.a],W=x.value[L.b],X=x.value[L.c],oa=x.value[L.d],x.array[z]=V[ha[0]],x.array[z+1]=V[ha[1]],x.array[z+2]=V[ha[2]],x.array[z+3]=W[ha[0]],x.array[z+4]=W[ha[1]],x.array[z+5]=W[ha[2]],x.array[z+6]=X[ha[0]],x.array[z+7]=X[ha[1]],x.array[z+8]=X[ha[2]],x.array[z+9]=oa[ha[0]],x.array[z+10]=oa[ha[1]],x.array[z+11]=oa[ha[2]],z+=12}else if("faces"===x.boundTo){for(G=0,U=la.length;G<U;G++)X=W=V=bb=x.value[la[G]],x.array[z]=V[ha[0]],x.array[z+1]=V[ha[1]],x.array[z+2]=V[ha[2]],x.array[z+3]=W[ha[0]],
|
|
|
+x.array[z+4]=W[ha[1]],x.array[z+5]=W[ha[2]],x.array[z+6]=X[ha[0]],x.array[z+7]=X[ha[1]],x.array[z+8]=X[ha[2]],z+=9;for(G=0,U=ma.length;G<U;G++)oa=X=W=V=bb=x.value[ma[G]],x.array[z]=V[ha[0]],x.array[z+1]=V[ha[1]],x.array[z+2]=V[ha[2]],x.array[z+3]=W[ha[0]],x.array[z+4]=W[ha[1]],x.array[z+5]=W[ha[2]],x.array[z+6]=X[ha[0]],x.array[z+7]=X[ha[1]],x.array[z+8]=X[ha[2]],x.array[z+9]=oa[ha[0]],x.array[z+10]=oa[ha[1]],x.array[z+11]=oa[ha[2]],z+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=
|
|
|
+0,U=la.length;G<U;G++)L=Da[la[G]],V=x.value[L.a],W=x.value[L.b],X=x.value[L.c],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=V.z,x.array[z+3]=V.w,x.array[z+4]=W.x,x.array[z+5]=W.y,x.array[z+6]=W.z,x.array[z+7]=W.w,x.array[z+8]=X.x,x.array[z+9]=X.y,x.array[z+10]=X.z,x.array[z+11]=X.w,z+=12;for(G=0,U=ma.length;G<U;G++)L=Da[ma[G]],V=x.value[L.a],W=x.value[L.b],X=x.value[L.c],oa=x.value[L.d],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=V.z,x.array[z+3]=V.w,x.array[z+4]=W.x,x.array[z+5]=W.y,x.array[z+6]=
|
|
|
+W.z,x.array[z+7]=W.w,x.array[z+8]=X.x,x.array[z+9]=X.y,x.array[z+10]=X.z,x.array[z+11]=X.w,x.array[z+12]=oa.x,x.array[z+13]=oa.y,x.array[z+14]=oa.z,x.array[z+15]=oa.w,z+=16}else if("faces"===x.boundTo){for(G=0,U=la.length;G<U;G++)X=W=V=bb=x.value[la[G]],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=V.z,x.array[z+3]=V.w,x.array[z+4]=W.x,x.array[z+5]=W.y,x.array[z+6]=W.z,x.array[z+7]=W.w,x.array[z+8]=X.x,x.array[z+9]=X.y,x.array[z+10]=X.z,x.array[z+11]=X.w,z+=12;for(G=0,U=ma.length;G<U;G++)oa=X=W=V=
|
|
|
+bb=x.value[ma[G]],x.array[z]=V.x,x.array[z+1]=V.y,x.array[z+2]=V.z,x.array[z+3]=V.w,x.array[z+4]=W.x,x.array[z+5]=W.y,x.array[z+6]=W.z,x.array[z+7]=W.w,x.array[z+8]=X.x,x.array[z+9]=X.y,x.array[z+10]=X.z,x.array[z+11]=X.w,x.array[z+12]=oa.x,x.array[z+13]=oa.y,x.array[z+14]=oa.z,x.array[z+15]=oa.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,ab)}ud&&(delete fa.__inittedArrays,delete fa.__colorArray,delete fa.__normalArray,delete fa.__tangentArray,delete fa.__uvArray,
|
|
|
+delete fa.__uv2Array,delete fa.__faceArray,delete fa.__vertexArray,delete fa.__lineArray,delete fa.__skinVertexAArray,delete fa.__skinVertexBArray,delete fa.__skinIndexArray,delete fa.__skinWeightArray)}}ja.__dirtyVertices=!1;ja.__dirtyMorphTargets=!1;ja.__dirtyElements=!1;ja.__dirtyUvs=!1;ja.__dirtyNormals=!1;ja.__dirtyColors=!1;ja.__dirtyTangents=!1;Ya.attributes&&n(Ya)}else if(nb instanceof THREE.Ribbon){if(ja.__dirtyVertices||ja.__dirtyColors){var Zb=ja,ld=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Lc=
|
|
|
void 0,$b=void 0,Mc=void 0,md=Zb.vertices,nd=Zb.colors,Ad=md.length,Bd=nd.length,Nc=Zb.__vertexArray,Oc=Zb.__colorArray,Cd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<Ad;yc++)Lc=md[yc].position,$b=3*yc,Nc[$b]=Lc.x,Nc[$b+1]=Lc.y,Nc[$b+2]=Lc.z;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Nc,ld)}if(Cd){for(zc=0;zc<Bd;zc++)Mc=nd[zc],$b=3*zc,Oc[$b]=Mc.r,Oc[$b+1]=Mc.g,Oc[$b+2]=Mc.b;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
Oc,ld)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1}else if(nb instanceof THREE.Line){Ya=c(nb,qc);ic=Ya.attributes&&p(Ya);if(ja.__dirtyVertices||ja.__dirtyColors||ic){var Lb=ja,dd=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Pc=void 0,za=void 0,Qc=void 0,od=Lb.vertices,pd=Lb.colors,Dd=od.length,Ed=pd.length,Rc=Lb.__vertexArray,Sc=Lb.__colorArray,Fd=Lb.__dirtyColors,ed=Lb.__webglCustomAttributesList,Tc=void 0,qd=void 0,Qa=void 0,oc=void 0,Za=void 0,sa=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Dd;Ac++)Pc=od[Ac].position,
|
|
|
za=3*Ac,Rc[za]=Pc.x,Rc[za+1]=Pc.y,Rc[za+2]=Pc.z;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,dd)}if(Fd){for(Bc=0;Bc<Ed;Bc++)Qc=pd[Bc],za=3*Bc,Sc[za]=Qc.r,Sc[za+1]=Qc.g,Sc[za+2]=Qc.b;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,dd)}if(ed)for(Tc=0,qd=ed.length;Tc<qd;Tc++)if(sa=ed[Tc],sa.needsUpdate&&(void 0===sa.boundTo||"vertices"===sa.boundTo)){za=0;oc=sa.value.length;if(1===sa.size)for(Qa=0;Qa<oc;Qa++)sa.array[Qa]=sa.value[Qa];
|
|
|
else if(2===sa.size)for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.x,sa.array[za+1]=Za.y,za+=2;else if(3===sa.size)if("c"===sa.type)for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.r,sa.array[za+1]=Za.g,sa.array[za+2]=Za.b,za+=3;else for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.x,sa.array[za+1]=Za.y,sa.array[za+2]=Za.z,za+=3;else if(4===sa.size)for(Qa=0;Qa<oc;Qa++)Za=sa.value[Qa],sa.array[za]=Za.x,sa.array[za+1]=Za.y,sa.array[za+2]=Za.z,sa.array[za+3]=Za.w,za+=4;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
sa.buffer);j.bufferData(j.ARRAY_BUFFER,sa.array,dd)}}ja.__dirtyVertices=!1;ja.__dirtyColors=!1;Ya.attributes&&n(Ya)}else if(nb instanceof THREE.ParticleSystem)Ya=c(nb,qc),ic=Ya.attributes&&p(Ya),(ja.__dirtyVertices||ja.__dirtyColors||nb.sortParticles||ic)&&g(ja,j.DYNAMIC_DRAW,nb),ja.__dirtyVertices=!1,ja.__dirtyColors=!1,Ya.attributes&&n(Ya)}};this.initMaterial=function(a,b,c,d){var e,g,f,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof
|
|
|
-THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var m=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var k,n;g=m=0;for(k=0,n=b.length;k<n;k++)e=b[k],e.onlyShadow||(e instanceof THREE.DirectionalLight&&g++,e instanceof
|
|
|
-THREE.PointLight&&m++,e instanceof THREE.SpotLight&&m++);m+g<=H?k=g:(k=Math.ceil(H*g/(m+g)),m=H-k);e=k;g=m;var l=0;for(m=0,k=b.length;m<k;m++)n=b[m],n.castShadow&&(n instanceof THREE.SpotLight&&l++,n instanceof THREE.DirectionalLight&&!n.shadowCascade&&l++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;n=a.vertexShader;var m=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:g,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):
|
|
|
-(d.push(k),d.push(n));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=X.length;q<d;q++)if(X[q].code===i){p=X[q].program;break a}q=j.createProgram();d=[0<Aa?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
|
|
|
+THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var m=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(m.uniforms);a.vertexShader=m.vertexShader;a.fragmentShader=m.fragmentShader}var k,l;g=m=0;for(k=0,l=b.length;k<l;k++)e=b[k],e.onlyShadow||(e instanceof THREE.DirectionalLight&&g++,e instanceof
|
|
|
+THREE.PointLight&&m++,e instanceof THREE.SpotLight&&m++);m+g<=M?k=g:(k=Math.ceil(M*g/(m+g)),m=M-k);e=k;g=m;var n=0;for(m=0,k=b.length;m<k;m++)l=b[m],l.castShadow&&(l instanceof THREE.SpotLight&&n++,l instanceof THREE.DirectionalLight&&!l.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{k=a.fragmentShader;l=a.vertexShader;var m=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:g,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):
|
|
|
+(d.push(k),d.push(l));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Y.length;q<d;q++)if(Y[q].code===i){p=Y[q].program;break a}q=j.createProgram();d=[0<Aa?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
|
|
|
"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",
|
|
|
c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
|
|
|
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",e+k));j.attachShader(q,t("vertex",d+n));j.linkProgram(q);
|
|
|
+e=["precision "+A+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
|
|
|
+"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",e+k));j.attachShader(q,t("vertex",d+l));j.linkProgram(q);
|
|
|
j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in m)d.push(r);r=d;for(d=0,m=r.length;d<m;d++)k=r[d],q.uniforms[k]=j.getUniformLocation(q,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");
|
|
|
-for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=X.length;X.push({program:q,code:i});G.info.memory.programs=X.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);
|
|
|
+for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=Y.length;Y.push({program:q,code:i});H.info.memory.programs=Y.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);
|
|
|
a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&j.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
|
-0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if($!==a.doubleSided)a.doubleSided?
|
|
|
-j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),$=a.doubleSided;if(aa!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),aa=a.flipSided};this.setDepthTest=function(a){Y!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Y=a)};this.setDepthWrite=function(a){ca!==a&&(j.depthMask(a),ca=a)};this.setBlending=function(a){if(a!==ba){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);
|
|
|
-j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}ba=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),G.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);
|
|
|
-var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=A(a.format),g=A(a.type);w(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,g,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,g,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
-if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(ia!==a.doubleSided)a.doubleSided?
|
|
|
+j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ia=a.doubleSided;if(S!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),S=a.flipSided};this.setDepthTest=function(a){R!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),R=a)};this.setDepthWrite=function(a){ba!==a&&(j.depthMask(a),ba=a)};this.setBlending=function(a){if(a!==aa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);
|
|
|
+j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}aa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),H.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);
|
|
|
+var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=y(a.format),g=y(a.type);w(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,g,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,g,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
+if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=y(a.format),e=y(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
c,0,d,a.width,a.height,0,d,e,null);var g=a,f=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,f,g.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=qa,a=ib,e=Ha,c=ra);b!==E&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),E=b);Va=d;lb=a};this.shadowMapPlugin=
|
|
|
+a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=qa,a=ib,e=Ia,c=ra);b!==F&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),F=b);Va=d;lb=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=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
|
|
@@ -466,7 +467,7 @@ c)THREE.Quaternion.slerp(e,g,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
|
|
|
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===g.animationCache)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
@@ -479,14 +480,13 @@ THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.V
|
|
|
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
|
|
|
new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
|
|
|
1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
|
|
|
-this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
|
|
|
-THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,b,c,d,e,g,f){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,g,f);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
+this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.CombinedCamera=function(a,b,c,d,e,g,f){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,g,f);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
|
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
|
|
|
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
|
|
|
-THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(2*a)),c=180/Math.PI*c;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
|
+THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
|
|
|
THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=void 0!==b?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=void 0!==b?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
|
|
|
0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
|
|
|
!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
|
|
|
function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
@@ -496,14 +496,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
|
|
|
this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,s=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)s=d*h.chunks[g]/h.total,b.keys[g]={time:s,pos:f[g]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
|
|
|
-new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
|
|
|
+new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
|
|
|
2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=2*Math.PI,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=0<=a?a:a+f;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
|
|
|
b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
|
|
|
document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),o=0;o<b.points.length;o++)c=new THREE.Mesh(f,h),c.position.copy(b.points[o]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
!1)}};THREE.PathControlsIdCounter=0;
|
|
|
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=void 0!==b?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
|
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
|
|
|
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
|
|
@@ -527,8 +527,8 @@ c.target.addSelf(b);c.staticMoving?l=p:l.addSelf(a.sub(p,l).multiplyScalar(c.dyn
|
|
|
c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(f=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),l=p=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):2===e&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?f=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
|
|
|
e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,m,l){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=g||1;var j=o+1,t=p+1,w=h/o,E=i/p,Q=new THREE.Vector3;Q[n]=0<m?1:-1;for(h=0;h<t;h++)for(i=0;i<j;i++){var N=new THREE.Vector3;N[a]=(i*w-q)*c;N[b]=(h*E-r)*f;N[n]=m;k.vertices.push(new THREE.Vertex(N))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
-new THREE.Face4(i+j*h+s,i+j*(h+1)+s,i+1+j*(h+1)+s,i+1+j*h+s),a.normal.copy(Q),a.vertexNormals.push(Q.clone(),Q.clone(),Q.clone(),Q.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,n=c/2,o,q,m,r,s,t;if(void 0!==f){if(f instanceof Array)this.materials=f;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(f)}o=0;r=1;q=2;s=
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,m,l){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=g||1;var j=o+1,t=p+1,w=h/o,F=i/p,Z=new THREE.Vector3;Z[n]=0<m?1:-1;for(h=0;h<t;h++)for(i=0;i<j;i++){var O=new THREE.Vector3;O[a]=(i*w-q)*c;O[b]=(h*F-r)*f;O[n]=m;k.vertices.push(new THREE.Vertex(O))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
+new THREE.Face4(i+j*h+s,i+j*(h+1)+s,i+1+j*(h+1)+s,i+1+j*h+s),a.normal.copy(Z),a.vertexNormals.push(Z.clone(),Z.clone(),Z.clone(),Z.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var k=this,l=a/2,p=b/2,n=c/2,o,q,m,r,s,t;if(void 0!==f){if(f instanceof Array)this.materials=f;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(f)}o=0;r=1;q=2;s=
|
|
|
3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var w in h)void 0!==this.sides[w]&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,o);this.sides.nx&&i("z","y",1,-1,c,b,-l,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,f=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var p=[],n=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-o*c+f,t=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);n.push(new THREE.UV(m,o))}k.push(p);l.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],p=k[i+1][h],
|
|
@@ -537,15 +537,15 @@ n=k[i+1][h+1],o=k[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(
|
|
|
0),t=l[i][h+1].clone(),w=l[i][h].clone(),u=new THREE.UV(w.u,1),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([t,w,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,e=a.length;this.shapebb=a[e-1].getBoundingBox();for(d=0;d<e;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.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,g=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,j=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();g.set(-d.y,d.x);f.set(e.y,-e.x);h.copy(a).addSelf(g);j.copy(a).addSelf(f);if(h.equals(j))return f.clone();
|
|
|
-h.copy(b).addSelf(g);j.copy(c).addSelf(f);g=d.dot(f);f=j.subSelf(h).dot(f);0===g&&(console.log("Either infinite or no solutions!"),0===f?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;return 0>f?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function e(a){for(j=a.length;0<=--j;){z=j;E=j-1;0>E&&(E=a.length-1);for(var b=
|
|
|
-0,c=o+2*l,b=0;b<c;b++){var d=P*b,e=P*(b+1),g=ia+z+d,f=ia+z+e,m=g,d=ia+E+d,e=ia+E+e,k=f,m=m+I,d=d+I,e=e+I,k=k+I;D.faces.push(new THREE.Face4(m,d,e,k,null,null,u));void 0!==u&&(m=b/c,d=(b+1)/c,e=h+2*i,g=(D.vertices[g].position.z+i)/e,f=(D.vertices[f].position.z+i)/e,D.faceVertexUvs[0].push([new THREE.UV(g,m),new THREE.UV(f,m),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){D.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=I;b+=I;c+=I;D.faces.push(new THREE.Face3(a,
|
|
|
-b,c,null,null,w));if(void 0!==w){var d=v.minX,e=v.minY,g=v.maxY,f=v.maxX,h=D.vertices[b].position.x-d,b=D.vertices[b].position.y-e,j=D.vertices[c].position.x-d,c=D.vertices[c].position.y-e;D.faceVertexUvs[0].push([new THREE.UV((D.vertices[a].position.x-d)/f,(D.vertices[a].position.y-e)/g),new THREE.UV(h/f,b/g),new THREE.UV(j/f,c/g)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
-3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,w=b.material,u=b.extrudeMaterial,v=this.shapebb;if(m)r=m.getPoints(n),o=r.length,s=!0,p=!1;p||(k=i=l=0);var A,B,C,D=this,I=this.vertices.length;q&&a.addWrapPath(q);n=t?a.extractAllSpacedPoints(n):a.extractAllPoints(n);q=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(B=
|
|
|
-0,C=n.length;B<C;B++)A=n[B],THREE.Shape.Utils.isClockWise(A)&&(n[B]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,n);t=q;for(B=0,C=n.length;B<C;B++)A=n[B],q=q.concat(A);for(var K,O,S,L,P=q.length,H=m.length,G=[],j=0,X=t.length,z=X-1,E=j+1;j<X;j++,z++,E++)z===X&&(z=0),E===X&&(E=0),G[j]=d(t[j],t[z],t[E]);var Q=[],N,ea=G.concat();for(B=0,C=n.length;B<C;B++){A=n[B];N=[];for(j=0,X=A.length,z=X-1,E=j+1;j<X;j++,z++,E++)z===X&&(z=0),E===X&&(E=0),N[j]=d(A[j],A[z],A[E]);Q.push(N);ea=ea.concat(N)}for(K=
|
|
|
-0;K<l;K++){O=K/l;S=i*(1-O);O=k*Math.sin(O*Math.PI/2);for(j=0,X=t.length;j<X;j++)L=c(t[j],G[j],O),g(L.x,L.y,-S);for(B=0,C=n.length;B<C;B++){A=n[B];N=Q[B];for(j=0,X=A.length;j<X;j++)L=c(A[j],N[j],O),g(L.x,L.y,-S)}}O=k;for(j=0;j<P;j++)L=p?c(q[j],ea[j],O):q[j],s?g(L.x,L.y+r[0].y,r[0].x):g(L.x,L.y,0);for(K=1;K<=o;K++)for(j=0;j<P;j++)L=p?c(q[j],ea[j],O):q[j],s?g(L.x,L.y+r[K-1].y,r[K-1].x):g(L.x,L.y,h/o*K);for(K=l-1;0<=K;K--){O=K/l;S=i*(1-O);O=k*Math.sin(O*Math.PI/2);for(j=0,X=t.length;j<X;j++)L=c(t[j],
|
|
|
-G[j],O),g(L.x,L.y,h+S);for(B=0,C=n.length;B<C;B++){A=n[B];N=Q[B];for(j=0,X=A.length;j<X;j++)L=c(A[j],N[j],O),s?g(L.x,L.y+r[o-1].y,r[o-1].x+S):g(L.x,L.y,h+S)}}if(p){p=0*P;for(j=0;j<H;j++)k=m[j],f(k[2]+p,k[1]+p,k[0]+p);p=P*(o+2*l);for(j=0;j<H;j++)k=m[j],f(k[0]+p,k[1]+p,k[2]+p)}else{for(j=0;j<H;j++)k=m[j],f(k[2],k[1],k[0]);for(j=0;j<H;j++)k=m[j],f(k[0]+P*o,k[1]+P*o,k[2]+P*o)}var ia=0;e(t);ia+=t.length;for(B=0,C=n.length;B<C;B++)A=n[B],e(A),ia+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+h.copy(b).addSelf(g);j.copy(c).addSelf(f);g=d.dot(f);f=j.subSelf(h).dot(f);0===g&&(console.log("Either infinite or no solutions!"),0===f?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=g;return 0>f?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(f).addSelf(h).subSelf(a).clone()}function e(a){for(j=a.length;0<=--j;){B=j;F=j-1;0>F&&(F=a.length-1);for(var b=
|
|
|
+0,c=o+2*l,b=0;b<c;b++){var d=P*b,e=P*(b+1),g=da+B+d,f=da+B+e,m=g,d=da+F+d,e=da+F+e,k=f,m=m+E,d=d+E,e=e+E,k=k+E;C.faces.push(new THREE.Face4(m,d,e,k,null,null,u));void 0!==u&&(m=b/c,d=(b+1)/c,e=h+2*i,g=(C.vertices[g].position.z+i)/e,f=(C.vertices[f].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(g,m),new THREE.UV(f,m),new THREE.UV(f,d),new THREE.UV(g,d)]))}}}function g(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=E;b+=E;c+=E;C.faces.push(new THREE.Face3(a,
|
|
|
+b,c,null,null,w));if(void 0!==w){var d=v.minX,e=v.minY,g=v.maxY,f=v.maxX,h=C.vertices[b].position.x-d,b=C.vertices[b].position.y-e,j=C.vertices[c].position.x-d,c=C.vertices[c].position.y-e;C.faceVertexUvs[0].push([new THREE.UV((C.vertices[a].position.x-d)/f,(C.vertices[a].position.y-e)/g),new THREE.UV(h/f,b/g),new THREE.UV(j/f,c/g)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
+3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,w=b.material,u=b.extrudeMaterial,v=this.shapebb;if(m)r=m.getPoints(n),o=r.length,s=!0,p=!1;p||(k=i=l=0);var y,D,A,C=this,E=this.vertices.length;q&&a.addWrapPath(q);n=t?a.extractAllSpacedPoints(n):a.extractAllPoints(n);q=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(D=
|
|
|
+0,A=n.length;D<A;D++)y=n[D],THREE.Shape.Utils.isClockWise(y)&&(n[D]=y.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,n);t=q;for(D=0,A=n.length;D<A;D++)y=n[D],q=q.concat(y);for(var J,N,T,K,P=q.length,M=m.length,H=[],j=0,Y=t.length,B=Y-1,F=j+1;j<Y;j++,B++,F++)B===Y&&(B=0),F===Y&&(F=0),H[j]=d(t[j],t[B],t[F]);var Z=[],O,ga=H.concat();for(D=0,A=n.length;D<A;D++){y=n[D];O=[];for(j=0,Y=y.length,B=Y-1,F=j+1;j<Y;j++,B++,F++)B===Y&&(B=0),F===Y&&(F=0),O[j]=d(y[j],y[B],y[F]);Z.push(O);ga=ga.concat(O)}for(J=
|
|
|
+0;J<l;J++){N=J/l;T=i*(1-N);N=k*Math.sin(N*Math.PI/2);for(j=0,Y=t.length;j<Y;j++)K=c(t[j],H[j],N),g(K.x,K.y,-T);for(D=0,A=n.length;D<A;D++){y=n[D];O=Z[D];for(j=0,Y=y.length;j<Y;j++)K=c(y[j],O[j],N),g(K.x,K.y,-T)}}N=k;for(j=0;j<P;j++)K=p?c(q[j],ga[j],N):q[j],s?g(K.x,K.y+r[0].y,r[0].x):g(K.x,K.y,0);for(J=1;J<=o;J++)for(j=0;j<P;j++)K=p?c(q[j],ga[j],N):q[j],s?g(K.x,K.y+r[J-1].y,r[J-1].x):g(K.x,K.y,h/o*J);for(J=l-1;0<=J;J--){N=J/l;T=i*(1-N);N=k*Math.sin(N*Math.PI/2);for(j=0,Y=t.length;j<Y;j++)K=c(t[j],
|
|
|
+H[j],N),g(K.x,K.y,h+T);for(D=0,A=n.length;D<A;D++){y=n[D];O=Z[D];for(j=0,Y=y.length;j<Y;j++)K=c(y[j],O[j],N),s?g(K.x,K.y+r[o-1].y,r[o-1].x+T):g(K.x,K.y,h+T)}}if(p){p=0*P;for(j=0;j<M;j++)k=m[j],f(k[2]+p,k[1]+p,k[0]+p);p=P*(o+2*l);for(j=0;j<M;j++)k=m[j],f(k[0]+p,k[1]+p,k[2]+p)}else{for(j=0;j<M;j++)k=m[j],f(k[2],k[1],k[0]);for(j=0;j<M;j++)k=m[j],f(k[0]+P*o,k[1]+P*o,k[2]+P*o)}var da=0;e(t);da+=t.length;for(D=0,A=n.length;D<A;D++)y=n[D],e(y),da+=y.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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;0==i&&(g=d);
|
|
|
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;0==i&&(g=d);
|
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
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,k=b/d,l=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*k-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(l),e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
|
|
|
c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
@@ -558,8 +558,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
|
|
|
0,e=(""+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=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,k,l,p,n,o,q,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;g.push(new THREE.Vector2(i,l));e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
l));e.lineTo(i,l);break;case "q":i=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,l);if(f=g[g.length-1]){p=f.x;n=f.y;for(f=1,h=this.divisions;f<=h;f++){var t=f/h,w=THREE.Shape.Utils.b2(t,p,o,i),t=THREE.Shape.Utils.b2(t,n,q,l);g.push(new THREE.Vector2(w,t))}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,l,o,q,m,r),f=g[g.length-1]){p=f.x;n=f.y;for(f=1,h=this.divisions;f<=h;f++)t=f/h,w=THREE.Shape.Utils.b3(t,p,o,
|
|
|
m,i),t=THREE.Shape.Utils.b3(t,n,q,r,l),g.push(new THREE.Vector2(w,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 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{n=a;var o=i,q=k,m=l,r=e,s=f,t=void 0,w=void 0,u=void 0,v=void 0,A=void 0,
|
|
|
-B=void 0,C=void 0,D=void 0,I=void 0,w=n[s[o]].x,u=n[s[o]].y,v=n[s[q]].x,A=n[s[q]].y,B=n[s[m]].x,C=n[s[m]].y;if(1.0E-10>(v-w)*(C-u)-(A-u)*(B-w))n=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var D=n[s[t]].x,I=n[s[t]].y,K=void 0,O=void 0,S=void 0,L=void 0,P=void 0,H=void 0,G=void 0,j=void 0,X=void 0,z=void 0,E=void 0,Q=void 0,K=S=P=void 0,K=B-v,O=C-A,S=w-B,L=u-C,P=v-w,H=A-u,G=D-w,j=I-u,X=D-v,z=I-A,E=D-B,Q=I-C,K=K*z-O*X,P=P*j-H*G,S=S*Q-L*E;if(0<=K&&0<=S&&0<=P){n=!1;break a}}n=!0}}if(n){g.push([a[f[i]],
|
|
|
+(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 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{n=a;var o=i,q=k,m=l,r=e,s=f,t=void 0,w=void 0,u=void 0,v=void 0,y=void 0,
|
|
|
+D=void 0,A=void 0,C=void 0,E=void 0,w=n[s[o]].x,u=n[s[o]].y,v=n[s[q]].x,y=n[s[q]].y,D=n[s[m]].x,A=n[s[m]].y;if(1.0E-10>(v-w)*(A-u)-(y-u)*(D-w))n=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var C=n[s[t]].x,E=n[s[t]].y,J=void 0,N=void 0,T=void 0,K=void 0,P=void 0,M=void 0,H=void 0,j=void 0,Y=void 0,B=void 0,F=void 0,Z=void 0,J=T=P=void 0,J=D-v,N=A-y,T=w-D,K=u-A,P=v-w,M=y-u,H=C-w,j=E-u,Y=C-v,B=E-y,F=C-D,Z=E-A,J=J*B-N*Y,P=P*j-M*H,T=T*Z-K*F;if(0<=J&&0<=T&&0<=P){n=!1;break a}}n=!0}}if(n){g.push([a[f[i]],
|
|
|
a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);for(i=k,l=k+1;l<e;i++,l++)f[i]=f[l];e--;p=2*e}}return d?h: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||2*Math.PI;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=2*c/this.segmentsR*Math.PI;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);
|
|
@@ -584,11 +584,11 @@ THREE.CameraHelper.prototype.update=function(a){function b(a,b,g,f){THREE.Camera
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
|
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var m=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){m.vertexColors=[];for(var k,l,p,o=0;4>o;o++){p=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<p.length;q++)l=h.vertexColors[p[q]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=p.length;k.g/=p.length;k.b/=p.length;m.vertexColors[o]=k}}e.push(m);(!f.supportUVs||0!=n.length)&&g.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},p={},n=[],o,q,m,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(m=0,r=t[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],n[s]||(n[s]=t[o][m]);var w;for(o=0,q=d.length;o<q;o++)if(s=d[o],k.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&0!=n.length){w=new THREE.UV;if(s instanceof THREE.Face3)w.u=n[s.a].u+n[s.b].u+n[s.c].u,w.v=n[s.a].v+n[s.b].v+n[s.c].v,w.u/=3,w.v/=3;else if(s instanceof THREE.Face4)w.u=
|
|
|
-n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,w.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,w.u/=4,w.v/=4;n.push(w)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,g,f,h={};for(d=0,e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.a),b(h,f,d)):g instanceof THREE.Face4&&(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.d),b(h,f,d),f=c(g.d,g.a),b(h,f,d));return h}(a);var u=0,t=h.length,v,A,B={},C={},D=function(a,
|
|
|
-b){void 0===B[a]&&(B[a]=[]);B[a].push(b)},I=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in q){w=q[o];v=o.split("_");A=v[0];v=v[1];D(A,[A,v]);D(v,[A,v]);for(m=0,r=w.length;m<r;m++)s=w[m],I(A,s,o),I(v,s,o);2>w.length&&(p[o]=!0)}for(o in q)if(w=q[o],s=w[0],w=w[1],v=o.split("_"),A=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[s]),r.addSelf(k[w]),r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
-l[o]=t+d.length+u,i.push(new THREE.Vertex(r)),u++,f.supportUVs&&0!=n.length)w=new THREE.UV,w.u=n[A].u+n[v].u,w.v=n[A].v+n[v].v,w.u/=2,w.v/=2,n.push(w);var K,O;v=["123","12","2","23"];r=["123","23","3","31"];var D=["123","31","1","12"],I=["1234","12","2","23"],S=["1234","23","3","34"],L=["1234","34","4","41"],P=["1234","41","1","12"];for(o=0,q=k.length;o<q;o++)s=d[o],w=t+o,s instanceof THREE.Face3?(u=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(w,l[u],s.b,l[A],s,v),b(w,l[A],s.c,l[K],s,r),b(w,l[K],s.a,l[u],
|
|
|
-s,D)):s instanceof THREE.Face4?(u=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),O=c(s.d,s.a),b(w,l[u],s.b,l[A],s,I),b(w,l[A],s.c,l[K],s,S),b(w,l[K],s.d,l[O],s,L),b(w,l[O],s.a,l[u],s,P)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;l=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==B[o]){i.set(0,0,0);l.set(0,0,0);s=new THREE.Vector3(0,0,0);w=0;for(m in C[o])i.addSelf(k[m]),w++;u=0;t=B[o].length;for(m=0;m<t;m++)p[c(B[o][m][0],B[o][m][1])]&&u++;if(2!=u){i.divideScalar(w);for(m=0;m<
|
|
|
-t;m++)w=B[o][m],w=h[w[0]].position.clone().addSelf(h[w[1]].position).divideScalar(2),l.addSelf(w);l.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(l.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,w.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,w.u/=4,w.v/=4;n.push(w)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,g,f,h={};for(d=0,e=a.faces.length;d<e;d++)g=a.faces[d],g instanceof THREE.Face3?(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.a),b(h,f,d)):g instanceof THREE.Face4&&(f=c(g.a,g.b),b(h,f,d),f=c(g.b,g.c),b(h,f,d),f=c(g.c,g.d),b(h,f,d),f=c(g.d,g.a),b(h,f,d));return h}(a);var u=0,t=h.length,v,y,D={},A={},C=function(a,
|
|
|
+b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},E=function(a,b){void 0===A[a]&&(A[a]={});A[a][b]=null};for(o in q){w=q[o];v=o.split("_");y=v[0];v=v[1];C(y,[y,v]);C(v,[y,v]);for(m=0,r=w.length;m<r;m++)s=w[m],E(y,s,o),E(v,s,o);2>w.length&&(p[o]=!0)}for(o in q)if(w=q[o],s=w[0],w=w[1],v=o.split("_"),y=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[s]),r.addSelf(k[w]),r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
+l[o]=t+d.length+u,i.push(new THREE.Vertex(r)),u++,f.supportUVs&&0!=n.length)w=new THREE.UV,w.u=n[y].u+n[v].u,w.v=n[y].v+n[v].v,w.u/=2,w.v/=2,n.push(w);var J,N;v=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],E=["1234","12","2","23"],T=["1234","23","3","34"],K=["1234","34","4","41"],P=["1234","41","1","12"];for(o=0,q=k.length;o<q;o++)s=d[o],w=t+o,s instanceof THREE.Face3?(u=c(s.a,s.b),y=c(s.b,s.c),J=c(s.c,s.a),b(w,l[u],s.b,l[y],s,v),b(w,l[y],s.c,l[J],s,r),b(w,l[J],s.a,l[u],
|
|
|
+s,C)):s instanceof THREE.Face4?(u=c(s.a,s.b),y=c(s.b,s.c),J=c(s.c,s.d),N=c(s.d,s.a),b(w,l[u],s.b,l[y],s,E),b(w,l[y],s.c,l[J],s,T),b(w,l[J],s.d,l[N],s,K),b(w,l[N],s.a,l[u],s,P)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;l=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==D[o]){i.set(0,0,0);l.set(0,0,0);s=new THREE.Vector3(0,0,0);w=0;for(m in A[o])i.addSelf(k[m]),w++;u=0;t=D[o].length;for(m=0;m<t;m++)p[c(D[o][m][0],D[o][m][1])]&&u++;if(2!=u){i.divideScalar(w);for(m=0;m<
|
|
|
+t;m++)w=D[o][m],w=h[w[0]].position.clone().addSelf(h[w[1]].position).divideScalar(2),l.addSelf(w);l.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(l.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=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.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
|
|
@@ -604,120 +604,120 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHtt
|
|
|
f.status+"]")};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){4==g.readyState?200==g.status||0==g.status?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):3==g.readyState?e&&(0==h&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):2==g.readyState&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
|
|
|
g.responseType="arraybuffer";g.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,p,n,o,q,m,r,s,t,w,u,v;function A(a){return a%4?4-a%4:0}function B(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function D(b,c){var d,e,g,f,h,i,k,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];g=l[3*d+1];f=l[3*d+2];h=j[2*e];e=j[2*e+1];i=j[2*g];k=j[2*g+1];g=j[2*f];m=j[2*f+1];f=P.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,k));
|
|
|
-n.push(new THREE.UV(g,m));f.push(n)}}function I(b,c){var d,e,g,f,h,i,k,m,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];g=o[4*d+1];f=o[4*d+2];h=o[4*d+3];i=j[2*e];e=j[2*e+1];k=j[2*g];l=j[2*g+1];m=j[2*f];n=j[2*f+1];f=j[2*h];g=j[2*h+1];h=P.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,l));p.push(new THREE.UV(m,n));p.push(new THREE.UV(f,g));h.push(p)}}function K(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],g=c[3*
|
|
|
-d+1],f=c[3*d+2],h=j[d],P.faces.push(new THREE.Face3(e,g,f,null,null,h))}function O(b,c,d){for(var e,g,f,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],g=c[4*d+1],f=c[4*d+2],h=c[4*d+3],j=i[d],P.faces.push(new THREE.Face4(e,g,f,h,null,null,j))}function S(b,c,d,e){for(var g,f,h,j,i,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[3*e];f=c[3*e+1];h=c[3*e+2];i=d[3*e];k=d[3*e+1];m=d[3*e+2];j=l[e];var n=G[3*k],o=G[3*k+1];k=
|
|
|
-G[3*k+2];var p=G[3*m],q=G[3*m+1];m=G[3*m+2];P.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(G[3*i],G[3*i+1],G[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,m)],null,j))}}function L(b,c,d,e){for(var g,f,h,j,i,k,m,l,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[4*e];f=c[4*e+1];h=c[4*e+2];j=c[4*e+3];k=d[4*e];m=d[4*e+1];l=d[4*e+2];n=d[4*e+3];i=o[e];var p=G[3*m],q=G[3*m+1];m=G[3*m+2];var r=G[3*l],s=G[3*l+1];l=G[3*l+2];var t=G[3*n],u=G[3*
|
|
|
-n+1];n=G[3*n+2];P.faces.push(new THREE.Face4(g,f,h,j,[new THREE.Vector3(G[3*k],G[3*k+1],G[3*k+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,l),new THREE.Vector3(t,u,n)],null,i))}}var P=this,H=0,G=[],j=[],X,z;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,H,12);e=B(a,H+12);B(a,H+13);B(a,H+14);B(a,H+15);i=B(a,H+16);k=B(a,H+17);l=B(a,H+18);p=B(a,H+19);n=C(a,H+20);
|
|
|
-o=C(a,H+20+4);q=C(a,H+20+8);b=C(a,H+20+12);m=C(a,H+20+16);r=C(a,H+20+20);s=C(a,H+20+24);t=C(a,H+20+28);w=C(a,H+20+32);u=C(a,H+20+36);v=C(a,H+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");H+=e;c=3*i+p;z=4*i+p;e=b*c;X=m*(c+3*k);i=r*(c+3*l);p=s*(c+3*k+3*l);c=t*z;k=w*(z+4*k);l=u*(z+4*l);H+=function(b){var b=new Float32Array(a,b,3*n),c,d,e,g;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],g=b[3*c+2],P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return 3*
|
|
|
-n*Float32Array.BYTES_PER_ELEMENT}(H);H+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,g;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],g=b[3*c+2],G.push(d/127,e/127,g/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(H);H+=A(3*o);H+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],j.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(H);e=H+e+A(2*b);X=e+X+A(2*m);i=X+i+A(2*r);p=i+p+A(2*s);c=p+c+A(2*t);k=c+k+A(2*w);l=k+l+A(2*u);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
-K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);D(r,b)}})(X);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;S(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);D(s,c)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;O(u,a,b+4*u*Uint32Array.BYTES_PER_ELEMENT);I(u,b)}})(k);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;L(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);I(v,c)}})(l);b&&K(b,H,H+3*b*
|
|
|
-Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;S(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&O(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT;L(w,a,b,b+4*w*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,d,e){Y=a;d=d||Ua;void 0!==e&&(a=e.split("/"),a.pop(),$a=1>a.length?"":a.join("/")+"/");if((a=Y.evaluate("//dae:asset",Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var j=a.childNodes[e];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":Ga=j.textContent.charAt(0)}}if(!Fa.convertUpAxis||Ga===Fa.upAxis)Xa=null;else switch(Ga){case "X":Xa="Y"===Fa.upAxis?
|
|
|
-"XtoY":"XtoZ";break;case "Y":Xa="X"===Fa.upAxis?"YtoX":"YtoZ";break;case "Z":Xa="X"===Fa.upAxis?"ZtoX":"ZtoY"}na=b("//dae:library_images/dae:image",f,"image");ib=b("//dae:library_materials/dae:material",C,"material");Va=b("//dae:library_effects/dae:effect",S,"effect");qa=b("//dae:library_geometries/dae:geometry",r,"geometry");lb=b(".//dae:library_cameras/dae:camera",X,"camera");ra=b("//dae:library_controllers/dae:controller",h,"controller");Ha=b("//dae:library_animations/dae:animation",P,"animation");
|
|
|
-Wa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");La=[];ta=[];(a=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),fa=Wa[a]):fa=null;ca=new THREE.Object3D;for(a=0;a<fa.nodes.length;a++)ca.add(g(fa.nodes[a]));db=[];c(ca);a={scene:ca,morphs:La,skins:ta,animations:db,dae:{images:na,materials:ib,cameras:lb,effects:Va,geometries:qa,controllers:ra,animations:Ha,visualScenes:Wa,
|
|
|
-scene:fa}};d&&d(a);return a}function b(a,b,c){for(var a=Y.evaluate(a,Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=fa.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};db.push(d);for(var e=0,g=b.keys.length;e<g;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,p,n,o,q,m,r,s,t,w,u,v;function y(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function A(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,g,f,h,i,k,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];g=l[3*d+1];f=l[3*d+2];h=j[2*e];e=j[2*e+1];i=j[2*g];k=j[2*g+1];g=j[2*f];m=j[2*f+1];f=P.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,k));
|
|
|
+n.push(new THREE.UV(g,m));f.push(n)}}function E(b,c){var d,e,g,f,h,i,k,m,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];g=o[4*d+1];f=o[4*d+2];h=o[4*d+3];i=j[2*e];e=j[2*e+1];k=j[2*g];l=j[2*g+1];m=j[2*f];n=j[2*f+1];f=j[2*h];g=j[2*h+1];h=P.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,l));p.push(new THREE.UV(m,n));p.push(new THREE.UV(f,g));h.push(p)}}function J(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],g=c[3*
|
|
|
+d+1],f=c[3*d+2],h=j[d],P.faces.push(new THREE.Face3(e,g,f,null,null,h))}function N(b,c,d){for(var e,g,f,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],g=c[4*d+1],f=c[4*d+2],h=c[4*d+3],j=i[d],P.faces.push(new THREE.Face4(e,g,f,h,null,null,j))}function T(b,c,d,e){for(var g,f,h,j,i,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[3*e];f=c[3*e+1];h=c[3*e+2];i=d[3*e];k=d[3*e+1];m=d[3*e+2];j=l[e];var n=H[3*k],o=H[3*k+1];k=
|
|
|
+H[3*k+2];var p=H[3*m],q=H[3*m+1];m=H[3*m+2];P.faces.push(new THREE.Face3(g,f,h,[new THREE.Vector3(H[3*i],H[3*i+1],H[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,m)],null,j))}}function K(b,c,d,e){for(var g,f,h,j,i,k,m,l,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[4*e];f=c[4*e+1];h=c[4*e+2];j=c[4*e+3];k=d[4*e];m=d[4*e+1];l=d[4*e+2];n=d[4*e+3];i=o[e];var p=H[3*m],q=H[3*m+1];m=H[3*m+2];var r=H[3*l],s=H[3*l+1];l=H[3*l+2];var t=H[3*n],u=H[3*
|
|
|
+n+1];n=H[3*n+2];P.faces.push(new THREE.Face4(g,f,h,j,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,l),new THREE.Vector3(t,u,n)],null,i))}}var P=this,M=0,H=[],j=[],Y,B;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,M,12);e=D(a,M+12);D(a,M+13);D(a,M+14);D(a,M+15);i=D(a,M+16);k=D(a,M+17);l=D(a,M+18);p=D(a,M+19);n=A(a,M+20);
|
|
|
+o=A(a,M+20+4);q=A(a,M+20+8);b=A(a,M+20+12);m=A(a,M+20+16);r=A(a,M+20+20);s=A(a,M+20+24);t=A(a,M+20+28);w=A(a,M+20+32);u=A(a,M+20+36);v=A(a,M+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");M+=e;c=3*i+p;B=4*i+p;e=b*c;Y=m*(c+3*k);i=r*(c+3*l);p=s*(c+3*k+3*l);c=t*B;k=w*(B+4*k);l=u*(B+4*l);M+=function(b){var b=new Float32Array(a,b,3*n),c,d,e,g;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],g=b[3*c+2],P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return 3*
|
|
|
+n*Float32Array.BYTES_PER_ELEMENT}(M);M+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,g;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],g=b[3*c+2],H.push(d/127,e/127,g/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(M);M+=y(3*o);M+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],j.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(M);e=M+e+y(2*b);Y=e+Y+y(2*m);i=Y+i+y(2*r);p=i+p+y(2*s);c=p+c+y(2*t);k=c+k+y(2*w);l=k+l+y(2*u);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
+J(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,b)}})(Y);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;T(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);C(s,c)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;N(u,a,b+4*u*Uint32Array.BYTES_PER_ELEMENT);E(u,b)}})(k);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;K(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);E(v,c)}})(l);b&&J(b,M,M+3*b*
|
|
|
+Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;T(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&N(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT;K(w,a,b,b+4*w*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,e){R=a;d=d||Ua;void 0!==e&&(a=e.split("/"),a.pop(),$a=1>a.length?"":a.join("/")+"/");if((a=R.evaluate("//dae:asset",R,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var j=a.childNodes[e];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":Ga=j.textContent.charAt(0)}}if(!Fa.convertUpAxis||Ga===Fa.upAxis)Xa=null;else switch(Ga){case "X":Xa="Y"===Fa.upAxis?
|
|
|
+"XtoY":"XtoZ";break;case "Y":Xa="X"===Fa.upAxis?"YtoX":"YtoZ";break;case "Z":Xa="X"===Fa.upAxis?"ZtoX":"ZtoY"}na=b("//dae:library_images/dae:image",f,"image");ib=b("//dae:library_materials/dae:material",A,"material");Va=b("//dae:library_effects/dae:effect",T,"effect");qa=b("//dae:library_geometries/dae:geometry",r,"geometry");lb=b(".//dae:library_cameras/dae:camera",Y,"camera");ra=b("//dae:library_controllers/dae:controller",h,"controller");Ia=b("//dae:library_animations/dae:animation",P,"animation");
|
|
|
+Wa=b(".//dae:library_visual_scenes/dae:visual_scene",l,"visual_scene");La=[];ta=[];(a=R.evaluate(".//dae:scene/dae:instance_visual_scene",R,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ea=Wa[a]):ea=null;ba=new THREE.Object3D;for(a=0;a<ea.nodes.length;a++)ba.add(g(ea.nodes[a]));db=[];c(ba);a={scene:ba,morphs:La,skins:ta,animations:db,dae:{images:na,materials:ib,cameras:lb,effects:Va,geometries:qa,controllers:ra,animations:Ia,visualScenes:Wa,
|
|
|
+scene:ea}};d&&d(a);return a}function b(a,b,c){for(var a=R.evaluate(a,R,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ea.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};db.push(d);for(var e=0,g=b.keys.length;e<g;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
|
|
|
{hierarchy:[{keys:[],sids:[]}]};e=0;for(g=a.children.length;e<g;e++)for(var b=0,f=c(a.children[e]).hierarchy.length;b<f;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var g=a.channels[0].sampler.output[c];g instanceof THREE.Matrix4&&a.world.copy(g)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,g=ra[b.url];if(!g||
|
|
|
-!g.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,f=-c,h=0;for(e in Ha)for(var j=Ha[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];k.create();c=Math.min(c,k.startTime);f=Math.max(f,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=fa.getChildById(b.skeleton[0],!0)||fa.getChildBySid(b.skeleton[0],!0),m,l,f=new THREE.Vector3,n,i=0;i<a.vertices.length;i++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);
|
|
|
+!g.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,f=-c,h=0;for(e in Ia)for(var j=Ia[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];k.create();c=Math.min(c,k.startTime);f=Math.max(f,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=ea.getChildById(b.skeleton[0],!0)||ea.getChildBySid(b.skeleton[0],!0),m,l,f=new THREE.Vector3,n,i=0;i<a.vertices.length;i++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);
|
|
|
for(c=0;c<e;c++){h=[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;k=g.skin;for(l=0;l<i.length;l++)if(m=i[l],n=-1,"JOINT"==m.type){for(var o=0;o<k.joints.length;o++)if(m.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];m.invBindMatrix=o;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,o);m.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&m.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
m.sid+"'.";}for(i=0;i<h.length;i++)if("JOINT"==h[i].type)for(k=0;k<h[i].weights.length;k++)m=h[i].weights[k],l=m.index,m=m.weight,n=a.vertices[l],l=j[l],f.x=n.position.x,f.y=n.position.y,f.z=n.position.z,h[i].skinningMatrix.multiplyVector3(f),l.position.x+=f.x*m,l.position.y+=f.y*m,l.position.z+=f.z*m;a.morphTargets.push({name:"target_"+c,vertices:j})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var j=ra[a.controllers[f].url];switch(j.type){case "skin":if(qa[j.skin.source]){var i=
|
|
|
new m;i.url=j.skin.source;i.instance_material=a.controllers[f].instance_material;a.geometries.push(i);c=a.controllers[f]}else if(ra[j.skin.source]&&(d=j=ra[j.skin.source],j.morph&&qa[j.morph.source]))i=new m,i.url=j.morph.source,i.instance_material=a.controllers[f].instance_material,a.geometries.push(i);break;case "morph":if(qa[j.morph.source])i=new m,i.url=j.morph.source,i.instance_material=a.controllers[f].instance_material,a.geometries.push(i),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
|
|
|
-0;f<a.geometries.length;f++){var j=a.geometries[f],i=j.instance_material,j=qa[j.url],k={},l=[],n=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var q=Va[ib[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=n;l.push(q.material);p=q.material;n++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<n){i=new THREE.MeshFaceMaterial;j.materials=
|
|
|
-l;for(h=0;h<j.faces.length;h++)l=j.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=ra[c.url],i.skinInstanceController=c,i.name="skin_"+ta.length,ta.push(i);else if(void 0!==d){h=j;k=d instanceof o?ra[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(n=qa[k.targets[l]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,
|
|
|
-n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+La.length;La.push(i)}else i=new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}for(f=0;f<a.cameras.length;f++)b=lb[a.cameras[f].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;f=a.matrix.decompose();b.position=f[0];b.quaternion=
|
|
|
-f[1];b.useQuaternion=!0;b.scale=f[2];Fa.centerGeometry&&b.geometry&&(f=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(f.multiplySelf(b.scale)),b.position.subSelf(f));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 k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];
|
|
|
-this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id=
|
|
|
-"";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}
|
|
|
-function D(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function I(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function S(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}
|
|
|
-function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function H(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function G(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function X(){this.name=this.id=""}function z(){this.url=""}function E(a){return"dae"==
|
|
|
-a?"http://www.collada.org/2005/11/COLLADASchema":null}function Q(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function N(a){for(var a=ea(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ea(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ia(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function $(a,b){if(Fa.convertUpAxis&&Ga!==Fa.upAxis)switch(Xa){case "XtoY":var c=a[0];a[0]=b*a[1];
|
|
|
-a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function aa(a,b){var c=[a[b],a[b+1],a[b+2]];$(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Fa.convertUpAxis){var b=[a[0],a[4],a[8]];$(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];$(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],
|
|
|
-a[10]];$(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];$(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];$(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];$(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];$(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var Y=null,ca=null,fa,Ua=null,Ka={},na={},Ha={},ra={},qa={},ib={},Va={},lb={},db,Wa,$a,La,ta,Aa=THREE.SmoothShading,
|
|
|
-Fa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ga="Y",Xa=null,mb=Math.PI/180;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("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);
|
|
|
-this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new B).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],
|
|
|
-a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new A).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];
|
|
|
-if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=Q(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new B).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new A).parse(d),e=b[d.source];if("JOINT"==
|
|
|
-d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new A).parse(g));break;case "v":c=N(g.textContent);break;case "vcount":d=N(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=
|
|
|
+0;f<a.geometries.length;f++){var j=a.geometries[f],i=j.instance_material,j=qa[j.url],k={},l=[],n=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var q=ib[p.target],r=Va[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=n;l.push(r.material);p=r.material;p.name=null==q.name||""===q.name?q.id:q.name;n++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;
|
|
|
+if(1<n){i=new THREE.MeshFaceMaterial;j.materials=l;for(h=0;h<j.faces.length;h++)l=j.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=ra[c.url],i.skinInstanceController=c,i.name="skin_"+ta.length,ta.push(i);else if(void 0!==d){h=j;k=d instanceof o?ra[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(n=qa[k.targets[l]],n.mesh&&n.mesh.primitives&&
|
|
|
+n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+La.length;La.push(i)}else i=new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}for(f=0;f<a.cameras.length;f++)b=lb[a.cameras[f].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
|
|
|
+f=a.matrix.decompose();b.position=f[0];b.quaternion=f[1];b.useQuaternion=!0;b.scale=f[2];Fa.centerGeometry&&b.geometry&&(f=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(f.multiplySelf(b.scale)),b.position.subSelf(f));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 k(){this.source=
|
|
|
+"";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url=
|
|
|
+"";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function w(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function y(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function A(){this.name=
|
|
|
+this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function N(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function T(){this.name=this.id="";this.sampler=this.surface=this.shader=
|
|
|
+null}function K(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function M(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function H(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function Y(){this.name=this.id=""}function B(){this.url=
|
|
|
+""}function F(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function Z(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function O(a){for(var a=ga(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function ga(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function da(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ia(a,b){if(Fa.convertUpAxis&&Ga!==Fa.upAxis)switch(Xa){case "XtoY":var c=
|
|
|
+a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function S(a,b){var c=[a[b],a[b+1],a[b+2]];ia(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function aa(a){if(Fa.convertUpAxis){var b=[a[0],a[4],a[8]];ia(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ia(b,-1);a[1]=b[0];a[5]=b[1];a[9]=
|
|
|
+b[2];b=[a[2],a[6],a[10]];ia(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ia(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ia(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ia(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];ia(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var R=null,ba=null,ea,Ua=null,Ha={},na={},Ia={},ra={},qa={},ib={},Va={},lb={},db,Wa,$a,La,
|
|
|
+ta,Aa=THREE.SmoothShading,Fa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ga="Y",Xa=null,mb=Math.PI/180;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("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=
|
|
|
+(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new D).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=
|
|
|
+c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new y).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=
|
|
|
+a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=Z(f.textContent);this.bindShapeMatrix=aa(f);break;case "source":f=(new D).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new y).parse(d),e=b[d.source];
|
|
|
+if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new y).parse(g));break;case "v":c=O(g.textContent);break;case "vcount":d=O(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var k={},m=0;m<e.length;m++){var l=e[m],n=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=
|
|
|
n;break;case "WEIGHT":k.weight=b[l.source].data[n]}}j.push(k);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
|
|
|
this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,
|
|
|
""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==
|
|
|
a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));
|
|
|
-break;case "instance_camera":this.cameras.push((new z).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Y.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Y,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));
|
|
|
-break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Ha)for(var e=Ha[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Fa.convertUpAxis)switch(g){case "X":switch(Xa){case "XtoY":case "XtoZ":case "YtoX":g=
|
|
|
+break;case "instance_camera":this.cameras.push((new B).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=R.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",R,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));
|
|
|
+break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Ia)for(var e=Ia[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Fa.convertUpAxis)switch(g){case "X":switch(Xa){case "XtoY":case "XtoZ":case "YtoX":g=
|
|
|
"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Xa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Xa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,k=this.getTransformBySid(b.sid);if(k){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=i.length;b<l;b++){var q=i[b],r=h.getData(k.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=
|
|
|
new j(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:q,0,s)}s.addTarget(f,k,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(l=h[i],l.hasTarget(g)){i=l;break a}i=null}l=void 0;a:{for(k+=1;k<h.length;k++)if(l=h[k],l.hasTarget(g))break a;l=null}if(i&&l){h=(f.time-i.time)/(l.time-
|
|
|
-i.time);i=i.getTarget(g);k=l.getTarget(g).data;l=i.data;r=void 0;if(l.length){r=[];for(q=0;q<l.length;++q)r[q]=l[q]+(k[q]-l[q])*h}else r=l+(k-l)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=Q(a.textContent);this.convert();
|
|
|
-return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*mb;case "translate":$(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":$(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
|
|
|
+i.time);i=i.getTarget(g);k=l.getTarget(g).data;l=i.data;r=void 0;if(l.length){r=[];for(q=0;q<l.length;++q)r[q]=l[q]+(k[q]-l[q])*h}else r=l+(k-l)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=Z(a.textContent);this.convert();
|
|
|
+return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=aa(this.data);break;case "rotate":this.angle=this.data[3]*mb;case "translate":ia(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ia(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
|
|
|
break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
|
|
|
-a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Y.evaluate(".//dae:instance_material",
|
|
|
-c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
|
|
|
-Y.evaluate(".//dae:instance_material",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
-switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Ka[d]&&(Ka[d]=(new B(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new w).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ka[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(aa(a,
|
|
|
-b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<
|
|
|
-f.length;){var q=[],r=[],p={},s=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Ka[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(aa(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===l)d.push(new THREE.Face3(q[0],
|
|
|
-q[1],q[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color));else if(4===l)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));else if(4<l&&Fa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<l-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){q=0;for(r=d.length;q<r;q++){e=d[q];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)s=p[o[e]],s=4<l?[s[0],s[q+1],s[q+2]]:4===l?[s[0],s[1],s[2],s[3]]:[s[0],s[1],s[2]],b.faceVertexUvs[e]||
|
|
|
-(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(s)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=n*l}};t.prototype=new w;t.prototype.constructor=t;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ia(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
-switch(c.nodeName){case "input":this.inputs.push((new A).parse(a.childNodes[b]));break;case "vcount":this.vcount=N(c.textContent);break;case "p":this.p=N(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ia(a,"count",0);this.stride=ia(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};
|
|
|
-v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new A).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};A.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ia(a,"set",-1);this.offset=ia(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
-for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=ea(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=Q(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=N(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ea(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<
|
|
|
-c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};B.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new L).parse(a.childNodes[b]);break}return this};D.prototype.isColor=function(){return null==this.texture};D.prototype.isTexture=function(){return null!=this.texture};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=Q(c.textContent);this.color=new THREE.Color(0);
|
|
|
-this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};D.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
-a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
|
|
|
-(new D).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Y.evaluate(".//dae:float",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};I.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
|
|
|
-if(d instanceof D)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=na[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture($a+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==
|
|
|
-c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
-c.nodeName)}}return this};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
|
-S.prototype.create=function(){if(null==this.shader)return null};S.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};S.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=
|
|
|
-(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};S.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
|
|
|
-S.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new I(c.nodeName,this)).parse(c)}}};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
-if(1==c.nodeType)switch(c.nodeName){case "source":c=(new B).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new G(this)).parse(c));break;case "channel":this.channel.push((new H(this)).parse(c))}}return this};H.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
|
|
|
-else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new A).parse(c))}}return this};G.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=
|
|
|
-this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),
|
|
|
-this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};G.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":$(c,-1);break;case "scale":$(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=0;b<
|
|
|
-this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
|
|
|
-(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};X.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};X.prototype.parseOptics=
|
|
|
-function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};z.prototype.parse=function(a){this.url=
|
|
|
-a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Ua=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
|
|
|
+a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=R.evaluate(".//dae:instance_material",
|
|
|
+c,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
|
|
|
+R.evaluate(".//dae:instance_material",c,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Ha[d]&&(Ha[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new w).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ha[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(S(a,
|
|
|
+b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+
|
|
|
+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var q=[],r=[],p={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Ha[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(S(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+
|
|
|
+1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=Ha[h.source];j=k.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(S(k.data,q[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<m&&Fa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=
|
|
|
+0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=p[o[e]],q=4<m?[q[0],q[h+1],q[h+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};t.prototype=new w;t.prototype.constructor=t;w.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
|
|
|
+a.input.POSITION.source};w.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=da(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=da(a,"count",0);this.stride=
|
|
|
+da(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
+"");this.set=da(a,"set",-1);this.offset=da(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=ga(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=Z(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ga(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
|
|
|
+this.data.slice(b,b+16),c=aa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};A.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new K).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
|
|
|
+C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=Z(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;
|
|
|
+a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};E.prototype.parse=
|
|
|
+function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=R.evaluate(".//dae:float",c,F,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
|
|
|
+return this};E.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=na[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture($a+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
|
|
|
+e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var b=0;b<
|
|
|
+a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
|
|
|
+c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};T.prototype.create=function(){if(null==this.shader)return null};T.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
+T.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new J(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new N(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};T.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};T.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};K.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new H(this)).parse(c));break;case "channel":this.channel.push((new M(this)).parse(c))}}return this};M.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
|
|
|
+b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new y).parse(c))}}return this};
|
|
|
+H.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
|
|
|
+0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};H.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ia(c,-1);break;case "scale":ia(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
|
|
|
+member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
|
|
|
+this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};Y.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};
|
|
|
+Y.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};B.prototype.parse=
|
|
|
+function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Ua=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
|
|
|
d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Aa=a},applySkin:e,geometries:qa,options:Fa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState===g.DONE)if(200===g.status||0===g.status){var h;try{g.responseText?h=JSON.parse(g.responseText):console.warn("EMPTY: ["+b+"] seems to be unreachable or file there is empty")}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format or JSON is invalid")}h&&a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+
|
|
|
"]");else g.readyState===g.LOADING?e&&(0===f&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):g.readyState===g.HEADERS_RECEIVED&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,k,l,p,n,o,q,m,r,s,t,w,u=a.faces;p=a.vertices;var v=a.normals,A=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=p.length;k<
|
|
|
-l;)n=new THREE.Vertex,n.position.x=p[k++]*b,n.position.y=p[k++]*b,n.position.z=p[k++]*b,d.vertices.push(n);k=0;for(l=u.length;k<l;){b=u[k++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;n=b&32;m=b&64;b&=128;p?(r=new THREE.Face4,r.a=u[k++],r.b=u[k++],r.c=u[k++],r.d=u[k++],p=4):(r=new THREE.Face3,r.a=u[k++],r.b=u[k++],r.c=u[k++],p=3);if(i)i=u[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<B;c++)s=a.uvs[c],q=u[k++],w=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(w,q);if(e)for(c=0;c<B;c++){s=a.uvs[c];t=[];
|
|
|
-for(e=0;e<p;e++)q=u[k++],w=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(w,q);d.faceVertexUvs[c][i]=t}if(o)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.normal=e;if(n)for(c=0;c<p;c++)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(m)n=u[k++],n=new THREE.Color(A[n]),r.color=n;if(b)for(c=0;c<p;c++)n=u[k++],n=new THREE.Color(A[n]),r.vertexColors.push(n);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,k,l,p,n,o,q,m,r,s,t,w,u=a.faces;p=a.vertices;var v=a.normals,y=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=p.length;k<
|
|
|
+l;)n=new THREE.Vertex,n.position.x=p[k++]*b,n.position.y=p[k++]*b,n.position.z=p[k++]*b,d.vertices.push(n);k=0;for(l=u.length;k<l;){b=u[k++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;n=b&32;m=b&64;b&=128;p?(r=new THREE.Face4,r.a=u[k++],r.b=u[k++],r.c=u[k++],r.d=u[k++],p=4):(r=new THREE.Face3,r.a=u[k++],r.b=u[k++],r.c=u[k++],p=3);if(i)i=u[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],q=u[k++],w=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(w,q);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
|
|
|
+for(e=0;e<p;e++)q=u[k++],w=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(w,q);d.faceVertexUvs[c][i]=t}if(o)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.normal=e;if(n)for(c=0;c<p;c++)o=3*u[k++],e=new THREE.Vector3,e.x=v[o++],e.y=v[o++],e.z=v[o],r.vertexNormals.push(e);if(m)n=u[k++],n=new THREE.Color(y[n]),r.color=n;if(b)for(c=0;c<p;c++)n=u[k++],n=new THREE.Color(y[n]),r.vertexColors.push(n);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
|
|
|
2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,k,l,p,n,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;
|
|
|
q=a.morphTargets[c].vertices;for(i=0,k=q.length;i<k;i+=3)l=q[i]*b,p=q[i+1]*b,n=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(l,p,n)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;for(b=0,i=l.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(l[b],l[b+1],l[b+2]),k.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
|
|
|
d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){try{var e=JSON.parse(d.responseText)}catch(g){console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}c.createScene(e,b,a)}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");
|
|
|
d.send(null)};
|
|
|
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(n in L.objects)if(!z.objects[n])if(s=L.objects[n],void 0!==s.geometry){if(I=z.geometries[s.geometry]){a=!1;K=z.materials[s.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&I.computeTangents();u=s.position;v=s.rotation;A=s.quaternion;B=s.scale;A=0;0==s.materials.length&&(K=new THREE.MeshFaceMaterial);1<s.materials.length&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(I,
|
|
|
-K);a.name=n;a.position.set(u[0],u[1],u[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(B[0],B[1],B[2]);a.visible=s.visible;z.scene.add(a);z.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);z.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(I),z.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},
|
|
|
-z.triggers[a.name]=b)}}else u=s.position,v=s.rotation,A=s.quaternion,B=s.scale,A=0,a=new THREE.Object3D,a.name=n,a.position.set(u[0],u[1],u[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(B[0],B[1],B[2]),a.visible=void 0!==s.visible?s.visible:!1,z.scene.add(a),z.objects[n]=a,z.empties[n]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function g(a){return function(b){z.geometries[a]=b;e();
|
|
|
-H-=1;i.onLoadComplete();h()}}function f(a){return function(b){z.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:X,loadedModels:j-H,loadedTextures:X-G},z);i.onLoadProgress();0==H&&0==G&&b(z)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),l,p,n,o,q,m,r,s,t,w,u,v,A,B,C,D,I,K,O,S,L,P,H,G,j,X,z;L=a;c=new THREE.BinaryLoader;P=new THREE.JSONLoader;G=H=0;z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
-empties:{}};a=!1;for(n in L.objects)if(s=L.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(L.transform)a=L.transform.position,t=L.transform.rotation,C=L.transform.scale,a&&z.scene.position.set(a[0],a[1],a[2]),t&&z.scene.rotation.set(t[0],t[1],t[2]),C&&z.scene.scale.set(C[0],C[1],C[2]),(a||t||C)&&z.scene.updateMatrix();a=function(){G-=1;h();i.onLoadComplete()};for(q in L.cameras)C=L.cameras[q],"perspective"==C.type?O=new THREE.PerspectiveCamera(C.fov,C.aspect,
|
|
|
-C.near,C.far):"ortho"==C.type&&(O=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),u=C.position,t=C.target,C=C.up,O.position.set(u[0],u[1],u[2]),O.target=new THREE.Vector3(t[0],t[1],t[2]),C&&O.up.set(C[0],C[1],C[2]),z.cameras[q]=O;for(o in L.lights)t=L.lights[o],q=void 0!==t.color?t.color:16777215,O=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,w=new THREE.DirectionalLight(q,O),w.position.set(u[0],u[1],u[2]),w.position.normalize()):"point"==t.type?
|
|
|
-(u=t.position,w=t.distance,w=new THREE.PointLight(q,O,w),w.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(w=new THREE.AmbientLight(q)),z.scene.add(w),z.lights[o]=w;for(m in L.fogs)o=L.fogs[m],"linear"==o.type?S=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(S=new THREE.FogExp2(0,o.density)),C=o.color,S.color.setRGB(C[0],C[1],C[2]),z.fogs[m]=S;if(z.cameras&&L.defaults.camera)z.currentCamera=z.cameras[L.defaults.camera];if(z.fogs&&L.defaults.fog)z.scene.fog=z.fogs[L.defaults.fog];C=L.defaults.bgcolor;
|
|
|
-z.bgColor=new THREE.Color;z.bgColor.setRGB(C[0],C[1],C[2]);z.bgColorAlpha=L.defaults.bgalpha;for(l in L.geometries)if(m=L.geometries[l],"bin_mesh"==m.type||"ascii_mesh"==m.type)H+=1,i.onLoadStart();j=H;for(l in L.geometries)if(m=L.geometries[l],"cube"==m.type)I=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),z.geometries[l]=I;else if("plane"==m.type)I=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),
|
|
|
-z.geometries[l]=I;else if("sphere"==m.type)I=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),z.geometries[l]=I;else if("cylinder"==m.type)I=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),z.geometries[l]=I;else if("torus"==m.type)I=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),z.geometries[l]=I;else if("icosahedron"==m.type)I=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),z.geometries[l]=I;else if("bin_mesh"==m.type)c.load(d(m.url,
|
|
|
-L.urlBaseType),g(l));else if("ascii_mesh"==m.type)P.load(d(m.url,L.urlBaseType),g(l));else if("embedded_mesh"==m.type)m=L.embeds[m.id],m.metadata=L.metadata,m&&P.createModel(m,f(l),"");for(r in L.textures)if(l=L.textures[r],l.url instanceof Array){G+=l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else G+=1,i.onLoadStart();X=G;for(r in L.textures){l=L.textures[r];if(void 0!=l.mapping&&void 0!=THREE[l.mapping])l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(S=0;S<l.url.length;S++)m[S]=
|
|
|
-d(l.url[S],L.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,L.urlBaseType),l.mapping,a);if(void 0!=THREE[l.minFilter])m.minFilter=THREE[l.minFilter];if(void 0!=THREE[l.magFilter])m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(1!=l.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=l.repeat[1])m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){S={repeat:THREE.RepeatWrapping,
|
|
|
-mirror:THREE.MirroredRepeatWrapping};if(void 0!==S[l.wrap[0]])m.wrapS=S[l.wrap[0]];if(void 0!==S[l.wrap[1]])m.wrapT=S[l.wrap[1]]}}z.textures[r]=m}for(p in L.materials){r=L.materials[p];for(D in r.parameters)if("envMap"==D||"map"==D||"lightMap"==D)r.parameters[D]=z.textures[r.parameters[D]];else if("shading"==D)r.parameters[D]="flat"==r.parameters[D]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==D)r.parameters[D]=THREE[r.parameters[D]]?THREE[r.parameters[D]]:THREE.NormalBlending;else if("combine"==
|
|
|
-D)r.parameters[D]="MixOperation"==r.parameters[D]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==D)if("face"==r.parameters[D])r.parameters[D]=THREE.FaceColors;else if(r.parameters[D])r.parameters[D]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);m=r.parameters.color;S=r.parameters.specular;c=r.parameters.ambient;P=r.parameters.shininess;
|
|
|
-a.tNormal.texture=z.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=z.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(S);a.uAmbientColor.value.setHex(c);
|
|
|
-a.uShininess.value=P;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else K=new THREE[r.type](r.parameters);z.materials[p]=K}e();i.callbackSync(z);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(n in K.objects)if(!B.objects[n])if(s=K.objects[n],void 0!==s.geometry){if(E=B.geometries[s.geometry]){a=!1;J=B.materials[s.materials[0]];(a=J instanceof THREE.ShaderMaterial)&&E.computeTangents();u=s.position;v=s.rotation;y=s.quaternion;D=s.scale;y=0;0==s.materials.length&&(J=new THREE.MeshFaceMaterial);1<s.materials.length&&(J=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,
|
|
|
+J);a.name=n;a.position.set(u[0],u[1],u[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;B.scene.add(a);B.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(E),B.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},
|
|
|
+B.triggers[a.name]=b)}}else u=s.position,v=s.rotation,y=s.quaternion,D=s.scale,y=0,a=new THREE.Object3D,a.name=n,a.position.set(u[0],u[1],u[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,B.scene.add(a),B.objects[n]=a,B.empties[n]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},B.triggers[a.name]=b)}function g(a){return function(b){B.geometries[a]=b;e();
|
|
|
+M-=1;i.onLoadComplete();h()}}function f(a){return function(b){B.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:Y,loadedModels:j-M,loadedTextures:Y-H},B);i.onLoadProgress();0==M&&0==H&&b(B)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),l,p,n,o,q,m,r,s,t,w,u,v,y,D,A,C,E,J,N,T,K,P,M,H,j,Y,B;K=a;c=new THREE.BinaryLoader;P=new THREE.JSONLoader;H=M=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(n in K.objects)if(s=K.objects[n],s.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(K.transform)a=K.transform.position,t=K.transform.rotation,A=K.transform.scale,a&&B.scene.position.set(a[0],a[1],a[2]),t&&B.scene.rotation.set(t[0],t[1],t[2]),A&&B.scene.scale.set(A[0],A[1],A[2]),(a||t||A)&&B.scene.updateMatrix();a=function(){H-=1;h();i.onLoadComplete()};for(q in K.cameras)A=K.cameras[q],"perspective"==A.type?N=new THREE.PerspectiveCamera(A.fov,A.aspect,
|
|
|
+A.near,A.far):"ortho"==A.type&&(N=new THREE.OrthographicCamera(A.left,A.right,A.top,A.bottom,A.near,A.far)),u=A.position,t=A.target,A=A.up,N.position.set(u[0],u[1],u[2]),N.target=new THREE.Vector3(t[0],t[1],t[2]),A&&N.up.set(A[0],A[1],A[2]),B.cameras[q]=N;for(o in K.lights)t=K.lights[o],q=void 0!==t.color?t.color:16777215,N=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,w=new THREE.DirectionalLight(q,N),w.position.set(u[0],u[1],u[2]),w.position.normalize()):"point"==t.type?
|
|
|
+(u=t.position,w=t.distance,w=new THREE.PointLight(q,N,w),w.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(w=new THREE.AmbientLight(q)),B.scene.add(w),B.lights[o]=w;for(m in K.fogs)o=K.fogs[m],"linear"==o.type?T=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(T=new THREE.FogExp2(0,o.density)),A=o.color,T.color.setRGB(A[0],A[1],A[2]),B.fogs[m]=T;if(B.cameras&&K.defaults.camera)B.currentCamera=B.cameras[K.defaults.camera];if(B.fogs&&K.defaults.fog)B.scene.fog=B.fogs[K.defaults.fog];A=K.defaults.bgcolor;
|
|
|
+B.bgColor=new THREE.Color;B.bgColor.setRGB(A[0],A[1],A[2]);B.bgColorAlpha=K.defaults.bgalpha;for(l in K.geometries)if(m=K.geometries[l],"bin_mesh"==m.type||"ascii_mesh"==m.type)M+=1,i.onLoadStart();j=M;for(l in K.geometries)if(m=K.geometries[l],"cube"==m.type)E=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),B.geometries[l]=E;else if("plane"==m.type)E=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),
|
|
|
+B.geometries[l]=E;else if("sphere"==m.type)E=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),B.geometries[l]=E;else if("cylinder"==m.type)E=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),B.geometries[l]=E;else if("torus"==m.type)E=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),B.geometries[l]=E;else if("icosahedron"==m.type)E=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),B.geometries[l]=E;else if("bin_mesh"==m.type)c.load(d(m.url,
|
|
|
+K.urlBaseType),g(l));else if("ascii_mesh"==m.type)P.load(d(m.url,K.urlBaseType),g(l));else if("embedded_mesh"==m.type)m=K.embeds[m.id],m.metadata=K.metadata,m&&P.createModel(m,f(l),"");for(r in K.textures)if(l=K.textures[r],l.url instanceof Array){H+=l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else H+=1,i.onLoadStart();Y=H;for(r in K.textures){l=K.textures[r];if(void 0!=l.mapping&&void 0!=THREE[l.mapping])l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(T=0;T<l.url.length;T++)m[T]=
|
|
|
+d(l.url[T],K.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,K.urlBaseType),l.mapping,a);if(void 0!=THREE[l.minFilter])m.minFilter=THREE[l.minFilter];if(void 0!=THREE[l.magFilter])m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(1!=l.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=l.repeat[1])m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){T={repeat:THREE.RepeatWrapping,
|
|
|
+mirror:THREE.MirroredRepeatWrapping};if(void 0!==T[l.wrap[0]])m.wrapS=T[l.wrap[0]];if(void 0!==T[l.wrap[1]])m.wrapT=T[l.wrap[1]]}}B.textures[r]=m}for(p in K.materials){r=K.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=B.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if("combine"==
|
|
|
+C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==C)if("face"==r.parameters[C])r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);m=r.parameters.color;T=r.parameters.specular;c=r.parameters.ambient;P=r.parameters.shininess;
|
|
|
+a.tNormal.texture=B.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=B.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(T);a.uAmbientColor.value.setHex(c);
|
|
|
+a.uShininess.value=P;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;J=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else J=new THREE[r.type](r.parameters);B.materials[p]=J}e();i.callbackSync(B);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,g=void 0!==c.offsetX?c.offsetX:0,f=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d),g=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,0==h&&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),k=[],l=[];(function(a,f,i){for(var k,l,r,s=a.length;i<s;i+=f)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(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,l.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,k.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,w,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;u=e;i=f;var A=k[3*e],B=k[3*e+1],C=k[3*e+2],D=k[3*f],I=k[3*f+1],K=k[3*f+2];t=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);A=new THREE.Vector3(A,B,C);D=new THREE.Vector3(D,I,K);g.faces.push(new THREE.Face3(w,u,i,[t,A,D],null,0));g=l[2*d];d=l[2*d+1];i=l[2*e];t=l[2*e+1];w=l[2*
|
|
|
+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),k=[],l=[];(function(a,f,i){for(var k,m,l,s=a.length;i<s;i+=f)k=a[i],m=a[i+1],l=a[i+2],k=k/16383*c,m=m/16383*c,l=l/16383*c,k+=d,m+=e,l+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,m,l)))})(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,l.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,k.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,w,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;w=d;u=e;i=f;var y=k[3*e],D=k[3*e+1],A=k[3*e+2],C=k[3*f],E=k[3*f+1],J=k[3*f+2];t=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);y=new THREE.Vector3(y,D,A);C=new THREE.Vector3(C,E,J);g.faces.push(new THREE.Face3(w,u,i,[t,y,C],null,0));g=l[2*d];d=l[2*d+1];i=l[2*e];t=l[2*e+1];w=l[2*
|
|
|
f];u=l[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(w,u));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
|
|
|
this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,l,p){f=(f-l)/(p-l);l=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(l[a],l[a+3],f);e[g+1]=this.lerp(l[a+1],l[a+4],f);e[g+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,l,p){f=(f-l)/(p-l);l=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+3*this.yd;
|
|
|
e[g]=this.lerp(l[a],l[b],f);e[g+1]=this.lerp(l[a+1],l[b+1],f);e[g+2]=this.lerp(l[a+2],l[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,l,p){f=(f-l)/(p-l);l=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+3*this.zd;e[g]=this.lerp(l[a],l[b],f);e[g+1]=this.lerp(l[a+1],l[b+1],f);e[g+2]=this.lerp(l[a+2],l[b+2],f)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,l=g+this.zd,p=i+this.yd,n=i+this.zd,o=g+this.yd+this.zd,q=i+this.yd+this.zd,m=0,r=this.field[g],s=this.field[i],t=this.field[k],w=this.field[p],u=this.field[l],v=this.field[n],A=this.field[o],B=this.field[q];r<f&&(m|=1);s<f&&(m|=2);t<f&&(m|=8);w<f&&(m|=4);u<f&&(m|=16);v<f&&(m|=32);A<f&&(m|=128);B<f&&(m|=64);var C=THREE.edgeTable[m];if(0===C)return 0;var D=this.delta,I=a+
|
|
|
-D,K=b+D,D=e+D;C&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,f,a,b,e,r,s));C&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,f,I,b,e,s,w));C&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(3*k,this.vlist,this.nlist,6,f,a,K,e,t,w));C&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(3*g,this.vlist,this.nlist,9,f,a,b,e,r,t));C&16&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,12,f,a,b,D,u,v));C&32&&(this.compNorm(n),
|
|
|
-this.compNorm(q),this.VIntY(3*n,this.vlist,this.nlist,15,f,I,b,D,v,B));C&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,f,a,K,D,A,B));C&128&&(this.compNorm(l),this.compNorm(o),this.VIntY(3*l,this.vlist,this.nlist,21,f,a,b,D,u,A));C&256&&(this.compNorm(g),this.compNorm(l),this.VIntZ(3*g,this.vlist,this.nlist,24,f,a,b,e,r,u));C&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(3*i,this.vlist,this.nlist,27,f,I,b,e,s,v));C&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
-p,this.vlist,this.nlist,30,f,I,K,e,w,B));C&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(3*k,this.vlist,this.nlist,33,f,a,K,e,t,A));m<<=4;for(f=g=0;-1!=THREE.triTable[m+f];)a=m+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=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[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,k=g+this.yd,l=g+this.zd,p=i+this.yd,n=i+this.zd,o=g+this.yd+this.zd,q=i+this.yd+this.zd,m=0,r=this.field[g],s=this.field[i],t=this.field[k],w=this.field[p],u=this.field[l],v=this.field[n],y=this.field[o],D=this.field[q];r<f&&(m|=1);s<f&&(m|=2);t<f&&(m|=8);w<f&&(m|=4);u<f&&(m|=16);v<f&&(m|=32);y<f&&(m|=128);D<f&&(m|=64);var A=THREE.edgeTable[m];if(0===A)return 0;var C=this.delta,E=a+
|
|
|
+C,J=b+C,C=e+C;A&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(3*g,this.vlist,this.nlist,0,f,a,b,e,r,s));A&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,f,E,b,e,s,w));A&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(3*k,this.vlist,this.nlist,6,f,a,J,e,t,w));A&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(3*g,this.vlist,this.nlist,9,f,a,b,e,r,t));A&16&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,12,f,a,b,C,u,v));A&32&&(this.compNorm(n),
|
|
|
+this.compNorm(q),this.VIntY(3*n,this.vlist,this.nlist,15,f,E,b,C,v,D));A&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,f,a,J,C,y,D));A&128&&(this.compNorm(l),this.compNorm(o),this.VIntY(3*l,this.vlist,this.nlist,21,f,a,b,C,u,y));A&256&&(this.compNorm(g),this.compNorm(l),this.VIntZ(3*g,this.vlist,this.nlist,24,f,a,b,e,r,u));A&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(3*i,this.vlist,this.nlist,27,f,E,b,e,s,v));A&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
|
|
|
+p,this.vlist,this.nlist,30,f,E,J,e,w,D));A&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(3*k,this.vlist,this.nlist,33,f,a,J,e,t,y));m<<=4;for(f=g=0;-1!=THREE.triTable[m+f];)a=m+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=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[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;
|
|
|
this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,l=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var n=Math.floor(k-h);1>n&&(n=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-h);1>o&&(o=1);h=Math.floor(l+h);h>this.size-1&&(h=this.size-
|
|
|
1);for(var q,m,r,s,t,w,u,l=p;l<i;l++){r=this.size2*l;t=l/this.size-e;w=t*t;for(p=n;p<k;p++){m=r+this.size*p;q=p/this.size-b;u=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=g/(1.0E-6+s*s+u+w)-f,0<s&&(this.field[m+q]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,l=this.yd,p=this.zd,n=this.field,o=k*Math.sqrt(a/b);o>k&&(o=k);for(e=0;e<o;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,0<h)for(g=0;g<k;g++){i=e+g*l;for(f=0;f<k;f++)n[p*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,l=this.size,p=this.yd,
|
|
@@ -754,11 +754,11 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
|
|
|
0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;g=b.createBuffer();f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
|
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,l=a(THREE.ShaderFlares.lensFlare)):(k=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};n={};p.vertex=b.getAttribLocation(l,"position");p.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
|
|
|
-"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,u=s/e,v=0.5*e,A=0.5*s,B=16/s,C=new THREE.Vector2(B*u,B),D=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),K=n,B=p;b.useProgram(l);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.disable(b.CULL_FACE);b.depthMask(!1);var O,S,L,P,H;for(O=0;O<t;O++)if(B=16/s,C.set(B*u,B),P=a[O],w.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),D.copy(w),I.x=D.x*v+v,I.y=D.y*A+A,k||0<I.x&&I.x<e&&0<I.y&&I.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,C.x,C.y);b.uniform3f(K.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
-6,b.UNSIGNED_SHORT,0);P.positionScreen.copy(D);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(S=0,L=P.lensFlares.length;S<L;S++)if(H=P.lensFlares[S],0.0010<H.opacity&&0.0010<H.scale)D.x=H.x,D.y=H.y,D.z=H.z,B=H.size*H.scale/s,C.x=B*u,C.y=B,b.uniform3f(K.screenPosition,D.x,D.y,D.z),b.uniform2f(K.scale,C.x,C.y),b.uniform1f(K.rotation,H.rotation),b.uniform1f(K.opacity,H.opacity),b.uniform3f(K.color,H.color.r,H.color.g,H.color.b),
|
|
|
-c.setBlending(H.blending),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var w=new THREE.Vector3,u=s/e,v=0.5*e,y=0.5*s,D=16/s,A=new THREE.Vector2(D*u,D),C=new THREE.Vector3(1,1,0),E=new THREE.Vector2(1,1),J=n,D=p;b.useProgram(l);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.disable(b.CULL_FACE);b.depthMask(!1);var N,T,K,P,M;for(N=0;N<t;N++)if(D=16/s,A.set(D*u,D),P=a[N],w.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),C.copy(w),E.x=C.x*v+v,E.y=C.y*y+y,k||0<E.x&&E.x<e&&0<E.y&&E.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,A.x,A.y);b.uniform3f(J.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,E.x-8,E.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
+6,b.UNSIGNED_SHORT,0);P.positionScreen.copy(C);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);for(T=0,K=P.lensFlares.length;T<K;T++)if(M=P.lensFlares[T],0.001<M.opacity&&0.001<M.scale)C.x=M.x,C.y=M.y,C.z=M.z,D=M.size*M.scale/s,A.x=D*u,A.y=D,b.uniform3f(J.screenPosition,C.x,C.y,C.z),b.uniform2f(J.scale,A.x,A.y),b.uniform1f(J.rotation,M.rotation),b.uniform1f(J.opacity,M.opacity),b.uniform3f(J.color,M.color.r,M.color.g,M.color.b),c.setBlending(M.blending),
|
|
|
+c.setTexture(M.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4,f=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
|
|
|
c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var l,p,n,o,q,m,r,s,t,w=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(l=0,p=i.lights.length;l<p;l++)if(n=i.lights[l],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(q=0;q<n.shadowCascadeCount;q++){var u;if(n.shadowCascadeArray[q])u=n.shadowCascadeArray[q];else{t=n;r=q;u=new THREE.DirectionalLight;u.isVirtual=!0;u.onlyShadow=
|
|
|
!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[r];u.shadowMapWidth=t.shadowCascadeWidth[r];u.shadowMapHeight=t.shadowCascadeHeight[r];u.pointsWorld=[];u.pointsFrustum=[];s=u.pointsWorld;m=
|
|
@@ -775,13 +775,13 @@ THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,f,h,i
|
|
|
f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(n,o);b.attachShader(n,q);b.linkProgram(n);h=n;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
|
|
|
"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=k,t=q/o,o=0.5*o,w=0.5*q,u=!0;b.useProgram(h);l||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),l=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f);b.uniformMatrix4fv(s.projectionMatrix,
|
|
|
-!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var v,A=[],r=0;r<m;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(v.position.x-
|
|
|
-o)/o,(w-v.position.y)/w,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),A[0]=e*t*v.scale.x,A[1]=e*v.scale.y,b.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(s.alignment,v.alignment.x,v.alignment.y),b.uniform1f(s.opacity,v.opacity),b.uniform3f(s.color,
|
|
|
-v.color.r,v.color.g,v.color.b),b.uniform1f(s.rotation,v.rotation),b.uniform2fv(s.scale,A),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var v,y=[],r=0;r<m;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(v.position.x-
|
|
|
+o)/o,(w-v.position.y)/w,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,v._modelViewMatrixArray)),e=v.map.image.width/(v.scaleByViewport?q:1),y[0]=e*t*v.scale.x,y[1]=e*v.scale.y,b.uniform2f(s.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(s.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(s.alignment,v.alignment.x,v.alignment.y),b.uniform1f(s.opacity,v.opacity),b.uniform3f(s.color,
|
|
|
+v.color.r,v.color.g,v.color.b),b.uniform1f(s.rotation,v.rotation),b.uniform2fv(s.scale,y),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,p;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
|
|
|
1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(q);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||l!==c.far||p!==c.fov){i=c.aspect;k=c.near;l=c.far;p=c.fov;var t=c.projectionMatrix.clone(),w=0.5*(125/30),u=w*k/125,v=k*Math.tan(p*Math.PI/360),A;f.n14=w;h.n14=-w;w=-v*i+u;A=v*i+u;t.n11=2*k/(A-w);t.n13=(A+w)/(A-w);e.projectionMatrix.copy(t);w=-v*i-u;A=v*i-u;t.n11=
|
|
|
-2*k/(A-w);t.n13=(A+w)/(A-w);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,n,!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,o,!0);m.updateMatrixWorld();d.call(b,m,q)}};
|
|
|
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(q);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||l!==c.far||p!==c.fov){i=c.aspect;k=c.near;l=c.far;p=c.fov;var t=c.projectionMatrix.clone(),w=0.5*(125/30),u=w*k/125,v=k*Math.tan(p*Math.PI/360),y;f.n14=w;h.n14=-w;w=-v*i+u;y=v*i+u;t.n11=2*k/(y-w);t.n13=(y+w)/(y-w);e.projectionMatrix.copy(t);w=-v*i-u;y=v*i-u;t.n11=
|
|
|
+2*k/(y-w);t.n13=(y+w)/(y-w);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,n,!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,o,!0);m.updateMatrixWorld();d.call(b,m,q)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,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&&void 0!==a.separation)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)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|