|
@@ -76,8 +76,8 @@ THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,r
|
|
|
d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var k=g*i,l=g*f,n=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+n*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=n+l*e;c[10]=g*h}else"YXZ"===b?(k=h*i,l=h*f,n=e*i,m=e*f,c[0]=k+m*d,c[4]=n*d-l,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=l*d-n,c[6]=m+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,l=h*f,n=e*i,m=e*f,c[0]=k-m*d,c[4]=-g*f,c[8]=n+l*d,c[1]=l+n*d,c[5]=g*i,c[9]=m-k*d,c[2]=-g*e,c[6]=d,c[10]=g*h):
|
|
|
"ZYX"===b?(k=g*i,l=g*f,n=d*i,m=d*f,c[0]=h*i,c[4]=n*e-l,c[8]=k*e+m,c[1]=h*f,c[5]=m*e+k,c[9]=l*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=m-k*f,c[8]=n*f+l,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=l*f+n,c[10]=k-m*f):"XZY"===b&&(k=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+m,c[5]=g*i,c[9]=l*f-n,c[2]=n*f-l,c[6]=d*i,c[10]=m*f+k);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,k=c*h,
|
|
|
c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;
|
|
|
-g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],n=c[9],m=c[13],s=c[2],r=c[6],p=c[10],q=c[14],x=c[3],t=c[7],v=c[11],c=c[15],w=d[0],D=d[4],K=d[8],A=d[12],z=d[1],F=d[5],H=d[9],
|
|
|
-G=d[13],V=d[2],B=d[6],T=d[10],C=d[14],I=d[3],M=d[7],W=d[11],d=d[15];e[0]=f*w+g*z+h*V+i*I;e[4]=f*D+g*F+h*B+i*M;e[8]=f*K+g*H+h*T+i*W;e[12]=f*A+g*G+h*C+i*d;e[1]=k*w+l*z+n*V+m*I;e[5]=k*D+l*F+n*B+m*M;e[9]=k*K+l*H+n*T+m*W;e[13]=k*A+l*G+n*C+m*d;e[2]=s*w+r*z+p*V+q*I;e[6]=s*D+r*F+p*B+q*M;e[10]=s*K+r*H+p*T+q*W;e[14]=s*A+r*G+p*C+q*d;e[3]=x*w+t*z+v*V+c*I;e[7]=x*D+t*F+v*B+c*M;e[11]=x*K+t*H+v*T+c*W;e[15]=x*A+t*G+v*C+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
|
|
|
+g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],n=c[9],m=c[13],s=c[2],r=c[6],p=c[10],q=c[14],x=c[3],t=c[7],v=c[11],c=c[15],w=d[0],E=d[4],J=d[8],A=d[12],z=d[1],G=d[5],I=d[9],
|
|
|
+F=d[13],V=d[2],B=d[6],T=d[10],C=d[14],K=d[3],L=d[7],W=d[11],d=d[15];e[0]=f*w+g*z+h*V+i*K;e[4]=f*E+g*G+h*B+i*L;e[8]=f*J+g*I+h*T+i*W;e[12]=f*A+g*F+h*C+i*d;e[1]=k*w+l*z+n*V+m*K;e[5]=k*E+l*G+n*B+m*L;e[9]=k*J+l*I+n*T+m*W;e[13]=k*A+l*F+n*C+m*d;e[2]=s*w+r*z+p*V+q*K;e[6]=s*E+r*G+p*B+q*L;e[10]=s*J+r*I+p*T+q*W;e[14]=s*A+r*F+p*C+q*d;e[3]=x*w+t*z+v*V+c*K;e[7]=x*E+t*G+v*B+c*L;e[11]=x*J+t*I+v*T+c*W;e[15]=x*A+t*F+v*C+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
|
|
|
c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=
|
|
|
c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],l=a[6],n=a[10],m=a[14];return a[3]*(+e*h*l-d*i*l-e*g*n+c*i*n+d*g*m-c*h*m)+a[7]*
|
|
@@ -91,7 +91,7 @@ g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;
|
|
|
b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=
|
|
|
l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*
|
|
|
k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;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 d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),n=1-k,m=d*e*n,s=d*f*n,n=e*f*n,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=s-r,m=m-l,h=h+(1-h)*k,l=n+d,s=s+r,n=n-d,i=i+(1-i)*k,k=c[0],d=c[1],r=c[2],p=c[3],q=c[4],x=c[5],t=c[6],
|
|
|
-v=c[7],w=c[8],D=c[9],K=c[10],A=c[11];c[0]=f*k+g*q+e*w;c[1]=f*d+g*x+e*D;c[2]=f*r+g*t+e*K;c[3]=f*p+g*v+e*A;c[4]=m*k+h*q+l*w;c[5]=m*d+h*x+l*D;c[6]=m*r+h*t+l*K;c[7]=m*p+h*v+l*A;c[8]=s*k+n*q+i*w;c[9]=s*d+n*x+i*D;c[10]=s*r+n*t+i*K;c[11]=s*p+n*v+i*A;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*
|
|
|
+v=c[7],w=c[8],E=c[9],J=c[10],A=c[11];c[0]=f*k+g*q+e*w;c[1]=f*d+g*x+e*E;c[2]=f*r+g*t+e*J;c[3]=f*p+g*v+e*A;c[4]=m*k+h*q+l*w;c[5]=m*d+h*x+l*E;c[6]=m*r+h*t+l*J;c[7]=m*p+h*v+l*A;c[8]=s*k+n*q+i*w;c[9]=s*d+n*x+i*E;c[10]=s*r+n*t+i*J;c[11]=s*p+n*v+i*A;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*
|
|
|
a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,
|
|
|
0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*
|
|
|
f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],
|
|
@@ -121,9 +121,9 @@ midpoint:function(a){return(a||new THREE.Vector3).addVectors(this.a,this.b).add(
|
|
|
a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};
|
|
|
THREE.extend(THREE.Clock.prototype,{start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(),
|
|
|
a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}});THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=function(h,i,k){if(h instanceof a.Particle){f.getPositionFromMatrix(h.matrixWorld);i=i.ray.distanceToPoint(f);if(i>h.scale.x)return k;k.push({distance:i,point:h.position,face:null,object:h})}else if(h instanceof
|
|
|
-a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return k;var s=h.geometry,r=s.vertices,p=h.material instanceof a.MeshFaceMaterial,q=!0===p?h.material.materials:null,x=h.material.side,t,v,w,D=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).transform(g);for(var K=0,A=s.faces.length;K<A;K++){var z=s.faces[K],x=!0===p?q[z.materialIndex]:
|
|
|
-h.material;if(void 0!==x){d.setFromNormalAndCoplanarPoint(z.normal,r[z.a]);var F=c.distanceToPlane(d);if(!(Math.abs(F)<D)&&!(0>F)){x=x.side;if(x!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(x===a.FrontSide?0>t:0<t)))continue;if(!(F<i.near||F>i.far)){e=c.at(F,e);if(z instanceof a.Face3){if(x=r[z.a],t=r[z.b],v=r[z.c],!a.Triangle.containsPoint(e,x,t,v))continue}else if(z instanceof a.Face4){if(x=r[z.a],t=r[z.b],v=r[z.c],w=r[z.d],!a.Triangle.containsPoint(e,x,t,w)&&!a.Triangle.containsPoint(e,t,v,w))continue}else throw Error("face type not supported");
|
|
|
-k.push({distance:F,point:i.ray.at(F),face:z,faceIndex:K,object:h})}}}}}},k=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&k(a,this,c);i(a,this,c);c.sort(h);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<
|
|
|
+a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return k;var s=h.geometry,r=s.vertices,p=h.material instanceof a.MeshFaceMaterial,q=!0===p?h.material.materials:null,x=h.material.side,t,v,w,E=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).transform(g);for(var J=0,A=s.faces.length;J<A;J++){var z=s.faces[J],x=!0===p?q[z.materialIndex]:
|
|
|
+h.material;if(void 0!==x){d.setFromNormalAndCoplanarPoint(z.normal,r[z.a]);var G=c.distanceToPlane(d);if(!(Math.abs(G)<E)&&!(0>G)){x=x.side;if(x!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(x===a.FrontSide?0>t:0<t)))continue;if(!(G<i.near||G>i.far)){e=c.at(G,e);if(z instanceof a.Face3){if(x=r[z.a],t=r[z.b],v=r[z.c],!a.Triangle.containsPoint(e,x,t,v))continue}else if(z instanceof a.Face4){if(x=r[z.a],t=r[z.b],v=r[z.c],w=r[z.d],!a.Triangle.containsPoint(e,x,t,w)&&!a.Triangle.containsPoint(e,t,v,w))continue}else throw Error("face type not supported");
|
|
|
+k.push({distance:G,point:i.ray.at(G),face:z,faceIndex:J,object:h})}}}}}},k=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&k(a,this,c);i(a,this,c);c.sort(h);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<
|
|
|
e;d++)i(a[d],this,c),!0===b&&k(a[d],this,c);c.sort(h);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.add(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
|
|
@@ -133,19 +133,19 @@ traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.chi
|
|
|
!1===this.useQuaternion?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),
|
|
|
this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);
|
|
|
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(k===n){var a=new THREE.RenderableVertex;l.push(a);n++;k++;return a}return l[k++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
-c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,k,l=[],n=0,m,s,r=[],p=0,q,x=[],t=0,v,w,D=[],K=0,A,z,F=[],H=0,G={objects:[],sprites:[],lights:[],elements:[]},V=new THREE.Vector3,B=new THREE.Vector4,T=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,I=Array(3),M=Array(4),W=new THREE.Matrix4,ua=new THREE.Matrix4,Ha,oa=new THREE.Matrix4,J=new THREE.Matrix3,da=new THREE.Matrix3,ka=new THREE.Vector3,Y=new THREE.Frustum,L=new THREE.Vector4,va=new THREE.Vector4;
|
|
|
-this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);ua.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(ua)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);ua.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(ua)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
|
|
|
-c)};this.projectScene=function(g,h,n,ta){var Ma=!1,ga,ja,ma,X,ha,ra,fa,Da,Za,$a,ia,Ra,Ua;z=w=q=s=0;G.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();W.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));ua.multiplyMatrices(h.projectionMatrix,W);da.getInverse(W);da.transpose();Y.setFromMatrix(ua);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var Sa=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
|
|
|
-THREE.Light)G.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===Y.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),G.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),G.sprites.push(e)):(e=a(),e.object=
|
|
|
-f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(ua),e.z=V.z),G.objects.push(e));Sa(f)}}};Sa(g);!0===n&&G.objects.sort(c);g=0;for(n=G.objects.length;g<n;g++)if(Da=G.objects[g].object,Ha=Da.matrixWorld,k=0,Da instanceof THREE.Mesh){Za=Da.geometry;ma=Za.vertices;$a=Za.faces;Za=Za.faceVertexUvs;J.getInverse(Ha);J.transpose();Ra=Da.material instanceof THREE.MeshFaceMaterial;Ua=!0===Ra?Da.material:null;ga=0;for(ja=ma.length;ga<ja;ga++)i=b(),i.positionWorld.copy(ma[ga]).applyMatrix4(Ha),
|
|
|
-i.positionScreen.copy(i.positionWorld).applyMatrix4(ua),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);ma=0;for(ga=$a.length;ma<ga;ma++){ja=$a[ma];var fb=!0===Ra?Ua.materials[ja.materialIndex]:Da.material;if(void 0!==fb){ra=fb.side;if(ja instanceof THREE.Face3)if(X=l[ja.a],ha=l[ja.b],
|
|
|
-fa=l[ja.c],I[0]=X.positionScreen,I[1]=ha.positionScreen,I[2]=fa.positionScreen,!0===X.visible||!0===ha.visible||!0===fa.visible||T.isIntersectionBox(C.setFromPoints(I)))if(Ma=0>(fa.positionScreen.x-X.positionScreen.x)*(ha.positionScreen.y-X.positionScreen.y)-(fa.positionScreen.y-X.positionScreen.y)*(ha.positionScreen.x-X.positionScreen.x),ra===THREE.DoubleSide||Ma===(ra===THREE.FrontSide))s===p?(ia=new THREE.RenderableFace3,r.push(ia),p++,s++,m=ia):m=r[s++],m.v1.copy(X),m.v2.copy(ha),m.v3.copy(fa);
|
|
|
-else continue;else continue;else if(ja instanceof THREE.Face4)if(X=l[ja.a],ha=l[ja.b],fa=l[ja.c],ia=l[ja.d],M[0]=X.positionScreen,M[1]=ha.positionScreen,M[2]=fa.positionScreen,M[3]=ia.positionScreen,!0===X.visible||!0===ha.visible||!0===fa.visible||!0===ia.visible||T.isIntersectionBox(C.setFromPoints(M)))if(Ma=0>(ia.positionScreen.x-X.positionScreen.x)*(ha.positionScreen.y-X.positionScreen.y)-(ia.positionScreen.y-X.positionScreen.y)*(ha.positionScreen.x-X.positionScreen.x)||0>(ha.positionScreen.x-
|
|
|
-fa.positionScreen.x)*(ia.positionScreen.y-fa.positionScreen.y)-(ha.positionScreen.y-fa.positionScreen.y)*(ia.positionScreen.x-fa.positionScreen.x),ra===THREE.DoubleSide||Ma===(ra===THREE.FrontSide)){if(q===t){var pb=new THREE.RenderableFace4;x.push(pb);t++;q++;m=pb}else m=x[q++];m.v1.copy(X);m.v2.copy(ha);m.v3.copy(fa);m.v4.copy(ia)}else continue;else continue;m.normalModel.copy(ja.normal);!1===Ma&&(ra===THREE.BackSide||ra===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(J).normalize();
|
|
|
-m.normalModelView.copy(m.normalModel).applyMatrix3(da);m.centroidModel.copy(ja.centroid).applyMatrix4(Ha);fa=ja.vertexNormals;X=0;for(ha=fa.length;X<ha;X++)ia=m.vertexNormalsModel[X],ia.copy(fa[X]),!1===Ma&&(ra===THREE.BackSide||ra===THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(J).normalize(),m.vertexNormalsModelView[X].copy(ia).applyMatrix3(da);m.vertexNormalsLength=fa.length;X=0;for(ha=Za.length;X<ha;X++)if(ia=Za[X][ma],void 0!==ia){ra=0;for(fa=ia.length;ra<fa;ra++)m.uvs[X][ra]=ia[ra]}m.color=
|
|
|
-ja.color;m.material=fb;ka.copy(m.centroidModel).applyProjection(ua);m.z=ka.z;G.elements.push(m)}}}else if(Da instanceof THREE.Line){oa.multiplyMatrices(ua,Ha);ma=Da.geometry.vertices;X=b();X.positionScreen.copy(ma[0]).applyMatrix4(oa);$a=Da.type===THREE.LinePieces?2:1;ga=1;for(ja=ma.length;ga<ja;ga++)X=b(),X.positionScreen.copy(ma[ga]).applyMatrix4(oa),0<(ga+1)%$a||(ha=l[k-2],L.copy(X.positionScreen),va.copy(ha.positionScreen),!0===d(L,va)&&(L.multiplyScalar(1/L.w),va.multiplyScalar(1/va.w),w===K?
|
|
|
-(Za=new THREE.RenderableLine,D.push(Za),K++,w++,v=Za):v=D[w++],v.v1.positionScreen.copy(L),v.v2.positionScreen.copy(va),v.z=Math.max(L.z,va.z),v.material=Da.material,G.elements.push(v)))}g=0;for(n=G.sprites.length;g<n;g++)Da=G.sprites[g].object,Ha=Da.matrixWorld,Da instanceof THREE.Particle&&(B.set(Ha.elements[12],Ha.elements[13],Ha.elements[14],1),B.applyMatrix4(ua),B.z/=B.w,0<B.z&&1>B.z&&(z===H?(Ma=new THREE.RenderableParticle,F.push(Ma),H++,z++,A=Ma):A=F[z++],A.object=Da,A.x=B.x/B.w,A.y=B.y/B.w,
|
|
|
-A.z=B.z,A.rotation=Da.rotation.z,A.scale.x=Da.scale.x*Math.abs(A.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),A.scale.y=Da.scale.y*Math.abs(A.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),A.material=Da.material,G.elements.push(A)));!0===ta&&G.elements.sort(c);return G}};THREE.Face3=function(a,b,c,d,e,f){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=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
+c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,k,l=[],n=0,m,s,r=[],p=0,q,x=[],t=0,v,w,E=[],J=0,A,z,G=[],I=0,F={objects:[],sprites:[],lights:[],elements:[]},V=new THREE.Vector3,B=new THREE.Vector4,T=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,K=Array(3),L=Array(4),W=new THREE.Matrix4,X=new THREE.Matrix4,qa,ga=new THREE.Matrix4,H=new THREE.Matrix3,ba=new THREE.Matrix3,Ca=new THREE.Vector3,ja=new THREE.Frustum,oa=new THREE.Vector4,M=new THREE.Vector4;
|
|
|
+this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);X.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(X)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);X.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(X)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
|
|
|
+c)};this.projectScene=function(g,h,n,xb){var za=!1,ca,ma,na,Z,ha,sa,ka,Ia,db,$a,ua,Wa,Ta;z=w=q=s=0;F.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();W.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));X.multiplyMatrices(h.projectionMatrix,W);ba.getInverse(W);ba.transpose();ja.setFromMatrix(X);f=0;F.objects.length=0;F.sprites.length=0;F.lights.length=0;var Ua=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
|
|
|
+THREE.Light)F.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===ja.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(X),e.z=V.z),F.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(X),e.z=V.z),F.sprites.push(e)):(e=a(),e.object=
|
|
|
+f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(X),e.z=V.z),F.objects.push(e));Ua(f)}}};Ua(g);!0===n&&F.objects.sort(c);g=0;for(n=F.objects.length;g<n;g++)if(Ia=F.objects[g].object,qa=Ia.matrixWorld,k=0,Ia instanceof THREE.Mesh){db=Ia.geometry;na=db.vertices;$a=db.faces;db=db.faceVertexUvs;H.getInverse(qa);H.transpose();Wa=Ia.material instanceof THREE.MeshFaceMaterial;Ta=!0===Wa?Ia.material:null;ca=0;for(ma=na.length;ca<ma;ca++)i=b(),i.positionWorld.copy(na[ca]).applyMatrix4(qa),
|
|
|
+i.positionScreen.copy(i.positionWorld).applyMatrix4(X),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);na=0;for(ca=$a.length;na<ca;na++){ma=$a[na];var nb=!0===Wa?Ta.materials[ma.materialIndex]:Ia.material;if(void 0!==nb){sa=nb.side;if(ma instanceof THREE.Face3)if(Z=l[ma.a],ha=l[ma.b],
|
|
|
+ka=l[ma.c],K[0]=Z.positionScreen,K[1]=ha.positionScreen,K[2]=ka.positionScreen,!0===Z.visible||!0===ha.visible||!0===ka.visible||T.isIntersectionBox(C.setFromPoints(K)))if(za=0>(ka.positionScreen.x-Z.positionScreen.x)*(ha.positionScreen.y-Z.positionScreen.y)-(ka.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x),sa===THREE.DoubleSide||za===(sa===THREE.FrontSide))s===p?(ua=new THREE.RenderableFace3,r.push(ua),p++,s++,m=ua):m=r[s++],m.v1.copy(Z),m.v2.copy(ha),m.v3.copy(ka);
|
|
|
+else continue;else continue;else if(ma instanceof THREE.Face4)if(Z=l[ma.a],ha=l[ma.b],ka=l[ma.c],ua=l[ma.d],L[0]=Z.positionScreen,L[1]=ha.positionScreen,L[2]=ka.positionScreen,L[3]=ua.positionScreen,!0===Z.visible||!0===ha.visible||!0===ka.visible||!0===ua.visible||T.isIntersectionBox(C.setFromPoints(L)))if(za=0>(ua.positionScreen.x-Z.positionScreen.x)*(ha.positionScreen.y-Z.positionScreen.y)-(ua.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x)||0>(ha.positionScreen.x-
|
|
|
+ka.positionScreen.x)*(ua.positionScreen.y-ka.positionScreen.y)-(ha.positionScreen.y-ka.positionScreen.y)*(ua.positionScreen.x-ka.positionScreen.x),sa===THREE.DoubleSide||za===(sa===THREE.FrontSide)){if(q===t){var yb=new THREE.RenderableFace4;x.push(yb);t++;q++;m=yb}else m=x[q++];m.v1.copy(Z);m.v2.copy(ha);m.v3.copy(ka);m.v4.copy(ua)}else continue;else continue;m.normalModel.copy(ma.normal);!1===za&&(sa===THREE.BackSide||sa===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(H).normalize();
|
|
|
+m.normalModelView.copy(m.normalModel).applyMatrix3(ba);m.centroidModel.copy(ma.centroid).applyMatrix4(qa);ka=ma.vertexNormals;Z=0;for(ha=ka.length;Z<ha;Z++)ua=m.vertexNormalsModel[Z],ua.copy(ka[Z]),!1===za&&(sa===THREE.BackSide||sa===THREE.DoubleSide)&&ua.negate(),ua.applyMatrix3(H).normalize(),m.vertexNormalsModelView[Z].copy(ua).applyMatrix3(ba);m.vertexNormalsLength=ka.length;Z=0;for(ha=db.length;Z<ha;Z++)if(ua=db[Z][na],void 0!==ua){sa=0;for(ka=ua.length;sa<ka;sa++)m.uvs[Z][sa]=ua[sa]}m.color=
|
|
|
+ma.color;m.material=nb;Ca.copy(m.centroidModel).applyProjection(X);m.z=Ca.z;F.elements.push(m)}}}else if(Ia instanceof THREE.Line){ga.multiplyMatrices(X,qa);na=Ia.geometry.vertices;Z=b();Z.positionScreen.copy(na[0]).applyMatrix4(ga);$a=Ia.type===THREE.LinePieces?2:1;ca=1;for(ma=na.length;ca<ma;ca++)Z=b(),Z.positionScreen.copy(na[ca]).applyMatrix4(ga),0<(ca+1)%$a||(ha=l[k-2],oa.copy(Z.positionScreen),M.copy(ha.positionScreen),!0===d(oa,M)&&(oa.multiplyScalar(1/oa.w),M.multiplyScalar(1/M.w),w===J?(db=
|
|
|
+new THREE.RenderableLine,E.push(db),J++,w++,v=db):v=E[w++],v.v1.positionScreen.copy(oa),v.v2.positionScreen.copy(M),v.z=Math.max(oa.z,M.z),v.material=Ia.material,F.elements.push(v)))}g=0;for(n=F.sprites.length;g<n;g++)Ia=F.sprites[g].object,qa=Ia.matrixWorld,Ia instanceof THREE.Particle&&(B.set(qa.elements[12],qa.elements[13],qa.elements[14],1),B.applyMatrix4(X),B.z/=B.w,0<B.z&&1>B.z&&(z===I?(za=new THREE.RenderableParticle,G.push(za),I++,z++,A=za):A=G[z++],A.object=Ia,A.x=B.x/B.w,A.y=B.y/B.w,A.z=
|
|
|
+B.z,A.rotation=Ia.rotation.z,A.scale.x=Ia.scale.x*Math.abs(A.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),A.scale.y=Ia.scale.y*Math.abs(A.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),A.material=Ia.material,F.elements.push(A)));!0===xb&&F.elements.sort(c);return F}};THREE.Face3=function(a,b,c,d,e,f){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=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,g){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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -160,9 +160,9 @@ e[d.b].add(d.normal),e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.v
|
|
|
for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
|
|
|
{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
|
|
|
f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
|
|
|
-b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];n=g[f];m=g[z];s=i.x-h.x;r=k.x-h.x;p=i.y-h.y;q=k.y-h.y;x=i.z-h.z;t=k.z-h.z;v=n.x-l.x;w=m.x-l.x;D=n.y-l.y;K=m.y-l.y;A=1/(v*K-w*D);G.set((K*s-D*r)*A,(K*p-D*q)*A,(K*x-D*t)*A);V.set((v*r-w*s)*A,(v*q-w*p)*A,(v*t-w*x)*A);F[b].add(G);F[c].add(G);F[d].add(G);H[b].add(V);H[c].add(V);H[d].add(V)}var b,c,d,e,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w,D,K,A,z,F=[],H=[],G=new THREE.Vector3,V=new THREE.Vector3,B=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3;
|
|
|
-b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,H[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)C.copy(f.vertexNormals[d]),e=f[I[d]],z=F[e],B.copy(z),B.sub(C.multiplyScalar(C.dot(z))).normalize(),
|
|
|
-T.crossVectors(f.vertexNormals[d],z),e=T.dot(H[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
+b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];n=g[f];m=g[z];s=i.x-h.x;r=k.x-h.x;p=i.y-h.y;q=k.y-h.y;x=i.z-h.z;t=k.z-h.z;v=n.x-l.x;w=m.x-l.x;E=n.y-l.y;J=m.y-l.y;A=1/(v*J-w*E);F.set((J*s-E*r)*A,(J*p-E*q)*A,(J*x-E*t)*A);V.set((v*r-w*s)*A,(v*q-w*p)*A,(v*t-w*x)*A);G[b].add(F);G[c].add(F);G[d].add(F);I[b].add(V);I[c].add(V);I[d].add(V)}var b,c,d,e,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w,E,J,A,z,G=[],I=[],F=new THREE.Vector3,V=new THREE.Vector3,B=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3;
|
|
|
+b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,I[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var K=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)C.copy(f.vertexNormals[d]),e=f[K[d]],z=G[e],B.copy(z),B.sub(C.multiplyScalar(C.dot(z))).normalize(),
|
|
|
+T.crossVectors(f.vertexNormals[d],z),e=T.dot(I[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,k;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];
|
|
|
h=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}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];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){h.splice(d,1);var l=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;h<i;h++)(k=this.faceVertexUvs[h][f])&&k.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(l.vertexNormals=a.vertexNormals,l.vertexNormals.splice(d,
|
|
|
1));a.vertexColors&&0<a.vertexColors.length&&(l.vertexColors=a.vertexColors,l.vertexColors.splice(d,1));this.faces[f]=l}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);h=0;for(i=this.faceVertexUvs.length;h<i;h++)this.faceVertexUvs[h].splice(f,1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];
|
|
@@ -172,10 +172,10 @@ var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.len
|
|
|
new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
|
0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,k,l,n,m=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var x=this.attributes.index.array,t=this.offsets;c=0;for(d=t.length;c<d;++c){b=t[c].start;g=t[c].count;var v=t[c].index;a=b;for(b+=g;a<b;a+=3)g=v+x[a],h=v+x[a+1],i=v+x[a+2],k=e[3*g],l=e[3*g+1],n=e[3*g+2],m.set(k,l,n),k=e[3*h],l=e[3*h+1],n=e[3*h+2],s.set(k,l,n),k=e[3*i],l=e[3*i+1],n=e[3*i+2],r.set(k,
|
|
|
l,n),p.subVectors(r,s),q.subVectors(m,s),p.cross(q),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],n=e[a+2],m.set(k,l,n),k=e[a+3],l=e[a+4],n=e[a+5],s.set(k,l,n),k=e[a+6],l=e[a+7],n=e[a+8],r.set(k,l,n),p.subVectors(r,s),q.subVectors(m,s),p.cross(q),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=
|
|
|
-!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){Ha.x=d[3*a];Ha.y=d[3*a+1];Ha.z=d[3*a+2];oa.copy(Ha);da=i[a];W.copy(da);W.sub(Ha.multiplyScalar(Ha.dot(da))).normalize();ua.crossVectors(oa,da);ka=ua.dot(k[a]);J=0>ka?-1:1;h[4*a]=W.x;h[4*a+1]=W.y;h[4*a+2]=W.z;h[4*a+3]=J}if(void 0===this.attributes.index||void 0===this.attributes.position||
|
|
|
+!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){qa.x=d[3*a];qa.y=d[3*a+1];qa.z=d[3*a+2];ga.copy(qa);ba=i[a];W.copy(ba);W.sub(qa.multiplyScalar(qa.dot(ba))).normalize();X.crossVectors(ga,ba);Ca=X.dot(k[a]);H=0>Ca?-1:1;h[4*a]=W.x;h[4*a+1]=W.y;h[4*a+2]=W.z;h[4*a+3]=H}if(void 0===this.attributes.index||void 0===this.attributes.position||
|
|
|
void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],k=[],g=0;g<f;g++)i[g]=
|
|
|
-new THREE.Vector3,k[g]=new THREE.Vector3;var l,n,m,s,r,p,q,x,t,v,w,D,K,A,z,f=new THREE.Vector3,g=new THREE.Vector3,F,H,G,V,B,T,C,I=this.offsets;G=0;for(V=I.length;G<V;++G){H=I[G].start;B=I[G].count;var M=I[G].index;F=H;for(H+=B;F<H;F+=3)B=M+b[F],T=M+b[F+1],C=M+b[F+2],l=c[3*B],n=c[3*B+1],m=c[3*B+2],s=c[3*T],r=c[3*T+1],p=c[3*T+2],q=c[3*C],x=c[3*C+1],t=c[3*C+2],v=e[2*B],w=e[2*B+1],D=e[2*T],K=e[2*T+1],A=e[2*C],z=e[2*C+1],s-=l,l=q-l,r-=n,n=x-n,p-=m,m=t-m,D-=v,v=A-v,K-=w,w=z-w,z=1/(D*w-v*K),f.set((w*s-
|
|
|
-K*l)*z,(w*r-K*n)*z,(w*p-K*m)*z),g.set((D*l-v*s)*z,(D*n-v*r)*z,(D*m-v*p)*z),i[B].add(f),i[T].add(f),i[C].add(f),k[B].add(g),k[T].add(g),k[C].add(g)}var W=new THREE.Vector3,ua=new THREE.Vector3,Ha=new THREE.Vector3,oa=new THREE.Vector3,J,da,ka;G=0;for(V=I.length;G<V;++G){H=I[G].start;B=I[G].count;M=I[G].index;F=H;for(H+=B;F<H;F+=3)B=M+b[F],T=M+b[F+1],C=M+b[F+2],a(B),a(T),a(C)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
+new THREE.Vector3,k[g]=new THREE.Vector3;var l,n,m,s,r,p,q,x,t,v,w,E,J,A,z,f=new THREE.Vector3,g=new THREE.Vector3,G,I,F,V,B,T,C,K=this.offsets;F=0;for(V=K.length;F<V;++F){I=K[F].start;B=K[F].count;var L=K[F].index;G=I;for(I+=B;G<I;G+=3)B=L+b[G],T=L+b[G+1],C=L+b[G+2],l=c[3*B],n=c[3*B+1],m=c[3*B+2],s=c[3*T],r=c[3*T+1],p=c[3*T+2],q=c[3*C],x=c[3*C+1],t=c[3*C+2],v=e[2*B],w=e[2*B+1],E=e[2*T],J=e[2*T+1],A=e[2*C],z=e[2*C+1],s-=l,l=q-l,r-=n,n=x-n,p-=m,m=t-m,E-=v,v=A-v,J-=w,w=z-w,z=1/(E*w-v*J),f.set((w*s-
|
|
|
+J*l)*z,(w*r-J*n)*z,(w*p-J*m)*z),g.set((E*l-v*s)*z,(E*n-v*r)*z,(E*m-v*p)*z),i[B].add(f),i[T].add(f),i[C].add(f),k[B].add(g),k[T].add(g),k[C].add(g)}var W=new THREE.Vector3,X=new THREE.Vector3,qa=new THREE.Vector3,ga=new THREE.Vector3,H,ba,Ca;F=0;for(V=K.length;F<V;++F){I=K[F].start;B=K[F].count;L=K[F].index;G=I;for(I+=B;G<I;G+=3)B=L+b[G],T=L+b[G+1],C=L+b[G+2],a(B),a(T),a(C)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.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.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=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){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.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=!1;this.shadowCascadeOffset=
|
|
|
new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight=function(a,b,c,d,e){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.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
|
|
@@ -191,34 +191,34 @@ a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(
|
|
|
k.uSpecularColor.value.setHex(i.specular),k.uAmbientColor.value.setHex(i.ambient),k.uShininess.value=i.shininess,void 0!==i.opacity&&(k.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:k,lights:!0,fog:!0}),i.transparent&&(h.transparent=!0)):h=new THREE[h](i);void 0!==a.DbgName&&(h.name=a.DbgName);return h}};THREE.ImageLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),
|
|
|
e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w=a.faces;r=a.vertices;var D=a.normals,K=a.colors,A=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&A++;for(f=0;f<A;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=r.length;i<k;)l=new THREE.Vector3,l.x=r[i++]*e,l.y=r[i++]*e,l.z=r[i++]*e,d.vertices.push(l);i=0;for(k=w.length;i<k;){r=w[i++];l=r&1;h=r&2;f=r&4;g=r&8;m=r&16;n=r&32;p=r&64;r&=128;l?(q=new THREE.Face4,
|
|
|
-q.a=w[i++],q.b=w[i++],q.c=w[i++],q.d=w[i++],l=4):(q=new THREE.Face3,q.a=w[i++],q.b=w[i++],q.c=w[i++],l=3);h&&(h=w[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<A;f++)x=a.uvs[f],s=w[i++],v=x[2*s],s=x[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(v,s);if(g)for(f=0;f<A;f++){x=a.uvs[f];t=[];for(g=0;g<l;g++)s=w[i++],v=x[2*s],s=x[2*s+1],t[g]=new THREE.Vector2(v,s);d.faceVertexUvs[f][h]=t}m&&(m=3*w[i++],g=new THREE.Vector3,g.x=D[m++],g.y=D[m++],g.z=D[m],q.normal=g);if(n)for(f=0;f<l;f++)m=3*w[i++],g=
|
|
|
-new THREE.Vector3,g.x=D[m++],g.y=D[m++],g.z=D[m],q.vertexNormals.push(g);p&&(n=w[i++],n=new THREE.Color(K[n]),q.color=n);if(r)for(f=0;f<l;f++)n=w[i++],n=new THREE.Color(K[n]),q.vertexColors.push(n);d.faces.push(q)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)w=a.skinWeights[i],D=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(w,D,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)w=a.skinIndices[i],D=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(w,D,0,0))}d.bones=
|
|
|
-a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];K=d.morphTargets[i].vertices;A=a.morphTargets[i].vertices;w=0;for(D=A.length;w<D;w+=3)r=new THREE.Vector3,r.x=A[w]*e,r.y=A[w+1]*e,r.z=A[w+2]*e,K.push(r)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
-[];D=d.morphColors[i].colors;K=a.morphColors[i].colors;e=0;for(w=K.length;e<w;e+=3)A=new THREE.Color(16755200),A.setRGB(K[e],K[e+1],K[e+2]),D.push(A)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w=a.faces;r=a.vertices;var E=a.normals,J=a.colors,A=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&A++;for(f=0;f<A;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=r.length;i<k;)l=new THREE.Vector3,l.x=r[i++]*e,l.y=r[i++]*e,l.z=r[i++]*e,d.vertices.push(l);i=0;for(k=w.length;i<k;){r=w[i++];l=r&1;h=r&2;f=r&4;g=r&8;m=r&16;n=r&32;p=r&64;r&=128;l?(q=new THREE.Face4,
|
|
|
+q.a=w[i++],q.b=w[i++],q.c=w[i++],q.d=w[i++],l=4):(q=new THREE.Face3,q.a=w[i++],q.b=w[i++],q.c=w[i++],l=3);h&&(h=w[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<A;f++)x=a.uvs[f],s=w[i++],v=x[2*s],s=x[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(v,s);if(g)for(f=0;f<A;f++){x=a.uvs[f];t=[];for(g=0;g<l;g++)s=w[i++],v=x[2*s],s=x[2*s+1],t[g]=new THREE.Vector2(v,s);d.faceVertexUvs[f][h]=t}m&&(m=3*w[i++],g=new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],q.normal=g);if(n)for(f=0;f<l;f++)m=3*w[i++],g=
|
|
|
+new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],q.vertexNormals.push(g);p&&(n=w[i++],n=new THREE.Color(J[n]),q.color=n);if(r)for(f=0;f<l;f++)n=w[i++],n=new THREE.Color(J[n]),q.vertexColors.push(n);d.faces.push(q)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)w=a.skinWeights[i],E=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(w,E,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)w=a.skinIndices[i],E=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(w,E,0,0))}d.bones=
|
|
|
+a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];J=d.morphTargets[i].vertices;A=a.morphTargets[i].vertices;w=0;for(E=A.length;w<E;w+=3)r=new THREE.Vector3,r.x=A[w]*e,r.y=A[w+1]*e,r.z=A[w+2]*e,J.push(r)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
+[];E=d.morphColors[i].colors;J=a.morphColors[i].colors;e=0;for(w=J.length;e<w;e+=3)A=new THREE.Color(16755200),A.setRGB(J[e],J[e+1],J[e+2]),E.push(A)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};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){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
|
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,H.objects)}function f(a,b){var c,e,g,i,k,n,p;for(p in b)if(void 0===z.objects[p]){var q=b[p],w=null;if(q.type&&q.type in l.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var C in q)C in e||(g[C]=q[C]);s=z.materials[q.material];q.loading=
|
|
|
-!0;e=l.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,H.urlBaseType),h(p,a,s,q)):e.load(d(q.url,H.urlBaseType),h(p,a,s,q),g)}}else if(void 0!==q.geometry){if(m=z.geometries[q.geometry]){w=!1;s=z.materials[q.material];w=s instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;k=q.scale;c=q.matrix;n=q.quaternion;q.material||(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));
|
|
|
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,I.objects)}function f(a,b){var c,e,g,i,k,n,p;for(p in b)if(void 0===z.objects[p]){var q=b[p],w=null;if(q.type&&q.type in l.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var C in q)C in e||(g[C]=q[C]);s=z.materials[q.material];q.loading=
|
|
|
+!0;e=l.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,I.urlBaseType),h(p,a,s,q)):e.load(d(q.url,I.urlBaseType),h(p,a,s,q),g)}}else if(void 0!==q.geometry){if(m=z.geometries[q.geometry]){w=!1;s=z.materials[q.material];w=s instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;k=q.scale;c=q.matrix;n=q.quaternion;q.material||(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));
|
|
|
if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)w=w||s.materials[e]instanceof THREE.ShaderMaterial;w&&m.computeTangents();q.skin?w=new THREE.SkinnedMesh(m,s):q.morph?(w=new THREE.MorphAnimMesh(m,s),void 0!==q.duration&&(w.duration=q.duration),void 0!==q.time&&(w.time=q.time),void 0!==q.mirroredLoop&&(w.mirroredLoop=q.mirroredLoop),s.morphNormals&&m.computeMorphNormals()):w=new THREE.Mesh(m,s);w.name=p;c?(w.matrixAutoUpdate=!1,w.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
|
|
|
c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(w.position.set(g[0],g[1],g[2]),n?(w.quaternion.set(n[0],n[1],n[2],n[3]),w.useQuaternion=!0):w.rotation.set(i[0],i[1],i[2]),w.scale.set(k[0],k[1],k[2]));w.visible=q.visible;w.castShadow=q.castShadow;w.receiveShadow=q.receiveShadow;a.add(w);z.objects[p]=w}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(t=void 0!==q.color?q.color:16777215,v=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(g=q.direction,
|
|
|
-x=new THREE.DirectionalLight(t,v),x.position.set(g[0],g[1],g[2]),q.target&&(F.push({object:x,targetName:q.target}),x.target=null)):"PointLight"===q.type?(g=q.position,e=q.distance,x=new THREE.PointLight(t,v,e),x.position.set(g[0],g[1],g[2])):"AmbientLight"===q.type&&(x=new THREE.AmbientLight(t)),a.add(x),x.name=p,z.lights[p]=x,z.objects[p]=x):"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?("PerspectiveCamera"===q.type?r=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===
|
|
|
+x=new THREE.DirectionalLight(t,v),x.position.set(g[0],g[1],g[2]),q.target&&(G.push({object:x,targetName:q.target}),x.target=null)):"PointLight"===q.type?(g=q.position,e=q.distance,x=new THREE.PointLight(t,v,e),x.position.set(g[0],g[1],g[2])):"AmbientLight"===q.type&&(x=new THREE.AmbientLight(t)),a.add(x),x.name=p,z.lights[p]=x,z.objects[p]=x):"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?("PerspectiveCamera"===q.type?r=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===
|
|
|
q.type&&(r=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),g=q.position,r.position.set(g[0],g[1],g[2]),a.add(r),r.name=p,z.cameras[p]=r,z.objects[p]=r):(g=q.position,i=q.rotation,k=q.scale,n=q.quaternion,w=new THREE.Object3D,w.name=p,w.position.set(g[0],g[1],g[2]),n?(w.quaternion.set(n[0],n[1],n[2],n[3]),w.useQuaternion=!0):w.rotation.set(i[0],i[1],i[2]),w.scale.set(k[0],k[1],k[2]),w.visible=void 0!==q.visible?q.visible:!1,a.add(w),z.objects[p]=w,z.empties[p]=w);if(w){if(void 0!==
|
|
|
q.properties)for(var B in q.properties)w.properties[B]=q.properties[B];if(void 0!==q.groups)for(e=0;e<q.groups.length;e++)g=q.groups[e],void 0===z.groups[g]&&(z.groups[g]=[]),z.groups[g].push(p);void 0!==q.children&&f(w,q.children)}}}function g(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c;e();w-=1;l.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,m=d.scale;f.position.set(g[0],g[1],g[2]);
|
|
|
-i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;z.objects[a]=f;e();w-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:K,totalTextures:A,loadedModels:K-w,loadedTextures:A-D},z);l.onLoadProgress();if(0===
|
|
|
-w&&0===D){for(var a=0;a<F.length;a++){var c=F[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),m,s,r,p,q,x,t,v,w,D,K,A,z,F=[],H=a,G;for(G in this.geometryHandlerMap)a=this.geometryHandlerMap[G].loaderClass,this.geometryHandlerMap[G].loaderObject=new a;for(G in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[G].loaderClass,
|
|
|
-this.hierarchyHandlerMap[G].loaderObject=new a;D=w=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(H.transform&&(G=H.transform.position,a=H.transform.rotation,c=H.transform.scale,G&&z.scene.position.set(G[0],G[1],G[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),G||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();G=function(a){return function(){D-=a;k();l.onLoadComplete()}};
|
|
|
-for(var V in H.fogs)a=H.fogs[V],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),z.fogs[V]=p;for(var B in H.geometries)p=H.geometries[B],p.type in this.geometryHandlerMap&&(w+=1,l.onLoadStart());for(var T in H.objects)p=H.objects[T],p.type&&p.type in this.hierarchyHandlerMap&&(w+=1,l.onLoadStart());K=w;for(B in H.geometries)if(p=H.geometries[B],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,
|
|
|
+i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;z.objects[a]=f;e();w-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:J,totalTextures:A,loadedModels:J-w,loadedTextures:A-E},z);l.onLoadProgress();if(0===
|
|
|
+w&&0===E){for(var a=0;a<G.length;a++){var c=G[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),m,s,r,p,q,x,t,v,w,E,J,A,z,G=[],I=a,F;for(F in this.geometryHandlerMap)a=this.geometryHandlerMap[F].loaderClass,this.geometryHandlerMap[F].loaderObject=new a;for(F in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[F].loaderClass,
|
|
|
+this.hierarchyHandlerMap[F].loaderObject=new a;E=w=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(I.transform&&(F=I.transform.position,a=I.transform.rotation,c=I.transform.scale,F&&z.scene.position.set(F[0],F[1],F[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),F||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();F=function(a){return function(){E-=a;k();l.onLoadComplete()}};
|
|
|
+for(var V in I.fogs)a=I.fogs[V],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),z.fogs[V]=p;for(var B in I.geometries)p=I.geometries[B],p.type in this.geometryHandlerMap&&(w+=1,l.onLoadStart());for(var T in I.objects)p=I.objects[T],p.type&&p.type in this.hierarchyHandlerMap&&(w+=1,l.onLoadStart());J=w;for(B in I.geometries)if(p=I.geometries[B],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,
|
|
|
p.widthSegments,p.heightSegments,p.depthSegments),z.geometries[B]=m;else if("plane"===p.type)m=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),z.geometries[B]=m;else if("sphere"===p.type)m=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),z.geometries[B]=m;else if("cylinder"===p.type)m=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),z.geometries[B]=m;else if("torus"===p.type)m=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
|
|
|
-p.segmentsT),z.geometries[B]=m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),z.geometries[B]=m;else if(p.type in this.geometryHandlerMap){T={};for(q in p)"type"!==q&&"url"!==q&&(T[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,H.urlBaseType),g(B),T)}else"embedded"===p.type&&(T=H.embeds[p.id],T.metadata=H.metadata,T&&this.geometryHandlerMap.ascii.loaderObject.createModel(T,i(B),""));for(var C in H.textures)if(B=H.textures[C],B.url instanceof
|
|
|
-Array){D+=B.url.length;for(q=0;q<B.url.length;q++)l.onLoadStart()}else D+=1,l.onLoadStart();A=D;for(C in H.textures){B=H.textures[C];void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){T=B.url.length;p=[];for(q=0;q<T;q++)p[q]=d(B.url[q],H.urlBaseType);q=(q=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,G(T)):THREE.ImageUtils.loadTextureCube(p,B.mapping,G(T))}else q=B.url.toLowerCase().endsWith(".dds"),T=d(B.url,
|
|
|
-H.urlBaseType),p=G(1),q=q?THREE.ImageUtils.loadCompressedTexture(T,B.mapping,p):THREE.ImageUtils.loadTexture(T,B.mapping,p),void 0!==THREE[B.minFilter]&&(q.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(q.magFilter=THREE[B.magFilter]),B.anisotropy&&(q.anisotropy=B.anisotropy),B.repeat&&(q.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),B.offset&&q.offset.set(B.offset[0],B.offset[1]),B.wrap&&(T={repeat:THREE.RepeatWrapping,
|
|
|
-mirror:THREE.MirroredRepeatWrapping},void 0!==T[B.wrap[0]]&&(q.wrapS=T[B.wrap[0]]),void 0!==T[B.wrap[1]]&&(q.wrapT=T[B.wrap[1]]));z.textures[C]=q}var I,M;for(I in H.materials){C=H.materials[I];for(M in C.parameters)"envMap"===M||"map"===M||"lightMap"===M||"bumpMap"===M?C.parameters[M]=z.textures[C.parameters[M]]:"shading"===M?C.parameters[M]="flat"===C.parameters[M]?THREE.FlatShading:THREE.SmoothShading:"side"===M?C.parameters[M]="double"==C.parameters[M]?THREE.DoubleSide:"back"==C.parameters[M]?
|
|
|
-THREE.BackSide:THREE.FrontSide:"blending"===M?C.parameters[M]=C.parameters[M]in THREE?THREE[C.parameters[M]]:THREE.NormalBlending:"combine"===M?C.parameters[M]=C.parameters[M]in THREE?THREE[C.parameters[M]]:THREE.MultiplyOperation:"vertexColors"===M?"face"==C.parameters[M]?C.parameters[M]=THREE.FaceColors:C.parameters[M]&&(C.parameters[M]=THREE.VertexColors):"wrapRGB"===M&&(G=C.parameters[M],C.parameters[M]=new THREE.Vector3(G[0],G[1],G[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
|
|
|
-(C.parameters.transparent=!0);C.parameters.normalMap?(G=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(G.uniforms),q=C.parameters.color,T=C.parameters.specular,p=C.parameters.ambient,V=C.parameters.shininess,B.tNormal.value=z.textures[C.parameters.normalMap],C.parameters.normalScale&&B.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(B.tDiffuse.value=C.parameters.map,B.enableDiffuse.value=!0),C.parameters.envMap&&(B.tCube.value=C.parameters.envMap,
|
|
|
+p.segmentsT),z.geometries[B]=m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),z.geometries[B]=m;else if(p.type in this.geometryHandlerMap){T={};for(q in p)"type"!==q&&"url"!==q&&(T[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,I.urlBaseType),g(B),T)}else"embedded"===p.type&&(T=I.embeds[p.id],T.metadata=I.metadata,T&&this.geometryHandlerMap.ascii.loaderObject.createModel(T,i(B),""));for(var C in I.textures)if(B=I.textures[C],B.url instanceof
|
|
|
+Array){E+=B.url.length;for(q=0;q<B.url.length;q++)l.onLoadStart()}else E+=1,l.onLoadStart();A=E;for(C in I.textures){B=I.textures[C];void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){T=B.url.length;p=[];for(q=0;q<T;q++)p[q]=d(B.url[q],I.urlBaseType);q=(q=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,F(T)):THREE.ImageUtils.loadTextureCube(p,B.mapping,F(T))}else q=B.url.toLowerCase().endsWith(".dds"),T=d(B.url,
|
|
|
+I.urlBaseType),p=F(1),q=q?THREE.ImageUtils.loadCompressedTexture(T,B.mapping,p):THREE.ImageUtils.loadTexture(T,B.mapping,p),void 0!==THREE[B.minFilter]&&(q.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(q.magFilter=THREE[B.magFilter]),B.anisotropy&&(q.anisotropy=B.anisotropy),B.repeat&&(q.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),B.offset&&q.offset.set(B.offset[0],B.offset[1]),B.wrap&&(T={repeat:THREE.RepeatWrapping,
|
|
|
+mirror:THREE.MirroredRepeatWrapping},void 0!==T[B.wrap[0]]&&(q.wrapS=T[B.wrap[0]]),void 0!==T[B.wrap[1]]&&(q.wrapT=T[B.wrap[1]]));z.textures[C]=q}var K,L;for(K in I.materials){C=I.materials[K];for(L in C.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?C.parameters[L]=z.textures[C.parameters[L]]:"shading"===L?C.parameters[L]="flat"===C.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?C.parameters[L]="double"==C.parameters[L]?THREE.DoubleSide:"back"==C.parameters[L]?
|
|
|
+THREE.BackSide:THREE.FrontSide:"blending"===L?C.parameters[L]=C.parameters[L]in THREE?THREE[C.parameters[L]]:THREE.NormalBlending:"combine"===L?C.parameters[L]=C.parameters[L]in THREE?THREE[C.parameters[L]]:THREE.MultiplyOperation:"vertexColors"===L?"face"==C.parameters[L]?C.parameters[L]=THREE.FaceColors:C.parameters[L]&&(C.parameters[L]=THREE.VertexColors):"wrapRGB"===L&&(F=C.parameters[L],C.parameters[L]=new THREE.Vector3(F[0],F[1],F[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
|
|
|
+(C.parameters.transparent=!0);C.parameters.normalMap?(F=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(F.uniforms),q=C.parameters.color,T=C.parameters.specular,p=C.parameters.ambient,V=C.parameters.shininess,B.tNormal.value=z.textures[C.parameters.normalMap],C.parameters.normalScale&&B.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(B.tDiffuse.value=C.parameters.map,B.enableDiffuse.value=!0),C.parameters.envMap&&(B.tCube.value=C.parameters.envMap,
|
|
|
B.enableReflection.value=!0,B.uReflectivity.value=C.parameters.reflectivity),C.parameters.lightMap&&(B.tAO.value=C.parameters.lightMap,B.enableAO.value=!0),C.parameters.specularMap&&(B.tSpecular.value=z.textures[C.parameters.specularMap],B.enableSpecular.value=!0),C.parameters.displacementMap&&(B.tDisplacement.value=z.textures[C.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=C.parameters.displacementBias,B.uDisplacementScale.value=C.parameters.displacementScale),
|
|
|
-B.uDiffuseColor.value.setHex(q),B.uSpecularColor.value.setHex(T),B.uAmbientColor.value.setHex(p),B.uShininess.value=V,C.parameters.opacity&&(B.uOpacity.value=C.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:G.fragmentShader,vertexShader:G.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[C.type](C.parameters);z.materials[I]=s}for(I in H.materials)if(C=H.materials[I],C.parameters.materials){M=[];for(q=0;q<C.parameters.materials.length;q++)M.push(z.materials[C.parameters.materials[q]]);
|
|
|
-z.materials[I].materials=M}e();z.cameras&&H.defaults.camera&&(z.currentCamera=z.cameras[H.defaults.camera]);z.fogs&&H.defaults.fog&&(z.scene.fog=z.fogs[H.defaults.fog]);l.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
|
+B.uDiffuseColor.value.setHex(q),B.uSpecularColor.value.setHex(T),B.uAmbientColor.value.setHex(p),B.uShininess.value=V,C.parameters.opacity&&(B.uOpacity.value=C.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:F.fragmentShader,vertexShader:F.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[C.type](C.parameters);z.materials[K]=s}for(K in I.materials)if(C=I.materials[K],C.parameters.materials){L=[];for(q=0;q<C.parameters.materials.length;q++)L.push(z.materials[C.parameters.materials[q]]);
|
|
|
+z.materials[K].materials=L}e();z.cameras&&I.defaults.camera&&(z.currentCamera=z.cameras[I.defaults.camera]);z.fogs&&I.defaults.fog&&(z.scene.fog=z.fogs[I.defaults.fog]);l.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
|
|
|
THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
|
|
|
a.visible=this.visible;return a};THREE.Material.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
@@ -261,37 +261,37 @@ THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInver
|
|
|
!1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);(1!==this.scale.x||1!==this.scale.y)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0};
|
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){K!==a&&(K=v.globalAlpha=a)}function c(a){A!==a&&(a===THREE.NormalBlending?v.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?v.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(v.globalCompositeOperation="darker"),A=a)}function d(a){H!==a&&(H=v.lineWidth=a)}function e(a){G!==a&&(G=v.lineCap=a)}function f(a){V!==a&&(V=v.lineJoin=a)}function g(a){z!==a&&(z=v.strokeStyle=a)}function h(a){F!==a&&(F=v.fillStyle=a)}function i(a,
|
|
|
-b){if(B!==a||T!==b)v.setLineDash([a,b]),B=a,T=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},k=this,l,n,m,s=new THREE.Projector,r=void 0!==a.canvas?a.canvas:document.createElement("canvas"),p,q,x,t,v=r.getContext("2d"),w=new THREE.Color(0),D=0,K=1,A=0,z=null,F=null,H=null,G=null,V=null,B=null,T=0,C,I,M,W,ua=new THREE.RenderableVertex,Ha=new THREE.RenderableVertex,oa,J,da,ka,Y,L,va,Ya,mb,Hb,ta,Ma,ga=new THREE.Color,ja=new THREE.Color,ma=new THREE.Color,X=new THREE.Color,ha=new THREE.Color,
|
|
|
-ra=new THREE.Color,fa=new THREE.Color,Da=new THREE.Color,Za={},$a={},ia,Ra,Ua,Sa,fb,pb,Ib,Jb,fc,mc,qb=new THREE.Box2,qa=new THREE.Box2,Ea=new THREE.Box2,gc=!1,vb=new THREE.Color,Pa=new THREE.Color,Na=new THREE.Color,ab=new THREE.Vector3,xb,j,yb,bb,ob,Va,zb=16;xb=document.createElement("canvas");xb.width=xb.height=2;j=xb.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);yb=j.getImageData(0,0,2,2);bb=yb.data;ob=document.createElement("canvas");ob.width=ob.height=zb;Va=ob.getContext("2d");
|
|
|
-Va.translate(-zb/2,-zb/2);Va.scale(zb,zb);zb--;void 0===v.setLineDash&&(v.setLineDash=void 0!==v.mozDash?function(a){v.mozDash=null!==a[0]?a:null}:function(){});this.domElement=r;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b){p=
|
|
|
-a*this.devicePixelRatio;q=b*this.devicePixelRatio;x=Math.floor(p/2);t=Math.floor(q/2);r.width=p;r.height=q;r.style.width=a+"px";r.style.height=b+"px";qb.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));K=1;A=0;V=G=H=F=z=null};this.setClearColor=function(a,b){w.copy(a);D=void 0!==b?b:1;qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t))};this.setClearColorHex=function(a,b){w.setHex(a);D=void 0!==b?b:1;qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,
|
|
|
-t))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){v.setTransform(1,0,0,-1,x,t);!1===qa.empty()&&(qa.intersect(qb),qa.expandByScalar(2),1>D&&v.clearRect(qa.min.x|0,qa.min.y|0,qa.max.x-qa.min.x|0,qa.max.y-qa.min.y|0),0<D&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*w.r)+","+Math.floor(255*w.g)+","+Math.floor(255*w.b)+","+D+")"),v.fillRect(qa.min.x|0,qa.min.y|0,qa.max.x-qa.min.x|0,qa.max.y-qa.min.y|0)),qa.makeEmpty())};this.render=function(a,p){function q(a,b,c){for(var d=
|
|
|
-0,e=m.length;d<e;d++){var f=m[d];Da.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ab.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(Da.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=ab.getPositionFromMatrix(f.matrixWorld),j=b.dot(ab.subVectors(g,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=j&&(j*=f.intensity,c.add(Da.multiplyScalar(j)))))}}function r(a,d,e,f,g,j,h,i){k.info.render.vertices+=
|
|
|
-3;k.info.render.faces++;b(i.opacity);c(i.blending);oa=a.positionScreen.x;J=a.positionScreen.y;da=d.positionScreen.x;ka=d.positionScreen.y;Y=e.positionScreen.x;L=e.positionScreen.y;z(oa,J,da,ka,Y,L);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ra.copy(i.color),fa.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ra.multiply(h.color),!0===gc?!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(ja.copy(vb),ma.copy(vb),X.copy(vb),
|
|
|
-q(h.v1.positionWorld,h.vertexNormalsModel[0],ja),q(h.v2.positionWorld,h.vertexNormalsModel[1],ma),q(h.v3.positionWorld,h.vertexNormalsModel[2],X),ja.multiply(ra).add(fa),ma.multiply(ra).add(fa),X.multiply(ra).add(fa),ha.addColors(ma,X).multiplyScalar(0.5),Ua=G(ja,ma,X,ha),F(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ua)):(ga.copy(vb),q(h.centroidModel,h.normalModel,ga),ga.multiply(ra).add(fa),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):!0===i.wireframe?B(i.color,i.wireframeLinewidth,
|
|
|
-i.wireframeLinecap,i.wireframeLinejoin):A(i.color)):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Sa=h.uvs[0],D(oa,J,da,ka,Y,L,Sa[f].x,Sa[f].y,Sa[g].x,Sa[g].y,Sa[j].x,Sa[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ab.copy(h.vertexNormalsModelView[f]),fb=0.5*ab.x+0.5,pb=0.5*ab.y+0.5,ab.copy(h.vertexNormalsModelView[g]),Ib=0.5*ab.x+
|
|
|
-0.5,Jb=0.5*ab.y+0.5,ab.copy(h.vertexNormalsModelView[j]),fc=0.5*ab.x+0.5,mc=0.5*ab.y+0.5,D(oa,J,da,ka,Y,L,fb,pb,Ib,Jb,fc,mc,i.envMap)):(ga.copy(i.color),i.vertexColors===THREE.FaceColors&&ga.multiply(h.color),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i instanceof THREE.MeshDepthMaterial?(ia=p.near,Ra=p.far,g=1-K(a.positionScreen.z*a.positionScreen.w,ia,Ra),ja.setRGB(g,g,g),g=1-K(d.positionScreen.z*d.positionScreen.w,ia,Ra),ma.setRGB(g,g,g),g=1-K(e.positionScreen.z*
|
|
|
-e.positionScreen.w,ia,Ra),X.setRGB(g,g,g),ha.addColors(ma,X).multiplyScalar(0.5),Ua=G(ja,ma,X,ha),F(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ua)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(d=h.normalModelView,ga.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[f],ja.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[g],
|
|
|
-ma.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],X.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ha.addColors(ma,X).multiplyScalar(0.5),Ua=G(ja,ma,X,ha),F(oa,J,da,ka,Y,L,0,0,1,0,0,1,Ua)))}function z(a,b,c,d,e,f){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.closePath()}function w(a,b,c,d,e,f,g,j){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.lineTo(g,j);v.closePath()}function B(a,b,c,j){d(b);e(c);f(j);g(a.getStyle());v.stroke();
|
|
|
-Ea.expandByScalar(2*b)}function A(a){h(a.getStyle());v.fill()}function D(a,b,c,d,e,f,g,j,i,ea,k,m,l){if(!(l instanceof THREE.DataTexture||void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,gb=l.wrapT==THREE.RepeatWrapping;Za[l.id]=v.createPattern(l.image,!0===n&&!0===gb?"repeat":!0===n&&!1===gb?"repeat-x":!1===n&&!0===gb?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===Za[l.id]?h("rgba(0,0,0,1)"):h(Za[l.id]);var n=l.offset.x/l.repeat.x,gb=l.offset.y/l.repeat.y,
|
|
|
-p=l.image.width*l.repeat.x,q=l.image.height*l.repeat.y,g=(g+n)*p,j=(1-j+gb)*q,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*p-g,ea=(1-ea+gb)*q-j,k=(k+n)*p-g,m=(1-m+gb)*q-j,n=i*m-k*ea;0===n?(void 0===$a[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),$a[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=$a[l.id],g=4*(Math.floor(g)+Math.floor(j)*l.image.width),ga.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),A(ga)):(n=1/n,
|
|
|
-l=(m*c-ea*e)*n,ea=(m*d-ea*f)*n,c=(i*e-k*c)*n,d=(i*f-k*d)*n,a=a-l*g-c*j,g=b-ea*g-d*j,v.save(),v.transform(l,ea,c,d,a,g),v.fill(),v.restore())}}function F(a,b,c,d,e,f,g,j,h,i,ea,k,l){var n,m;n=l.width-1;m=l.height-1;g*=n;j*=m;c-=a;d-=b;e-=a;f-=b;h=h*n-g;i=i*m-j;ea=ea*n-g;k=k*m-j;m=1/(h*k-ea*i);n=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-ea*c)*m;d=(h*f-ea*d)*m;a=a-n*g-c*j;b=b-i*g-d*j;v.save();v.transform(n,i,c,d,a,b);v.clip();v.drawImage(l,0,0);v.restore()}function G(a,b,c,d){bb[0]=255*a.r|0;bb[1]=255*a.g|0;
|
|
|
-bb[2]=255*a.b|0;bb[4]=255*b.r|0;bb[5]=255*b.g|0;bb[6]=255*b.b|0;bb[8]=255*c.r|0;bb[9]=255*c.g|0;bb[10]=255*c.b|0;bb[12]=255*d.r|0;bb[13]=255*d.g|0;bb[14]=255*d.b|0;j.putImageData(yb,0,0);Va.drawImage(xb,0,0);return ob}function K(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function H(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)}if(!1===p instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{!0===this.autoClear&&this.clear();v.setTransform(1,0,0,-1,x,t);k.info.render.vertices=0;k.info.render.faces=0;l=s.projectScene(a,p,this.sortObjects,this.sortElements);n=l.elements;m=l.lights;gc=0<m.length;if(!0===gc){vb.setRGB(0,0,0);Pa.setRGB(0,0,0);Na.setRGB(0,0,0);for(var T=0,V=m.length;T<V;T++){var O=m[T],aa=O.color;O instanceof THREE.AmbientLight?vb.add(aa):O instanceof THREE.DirectionalLight?Pa.add(aa):O instanceof THREE.PointLight&&Na.add(aa)}}T=0;for(V=n.length;T<V;T++){var ea=n[T],O=
|
|
|
-ea.material;if(!(void 0===O||!1===O.visible)){Ea.makeEmpty();if(ea instanceof THREE.RenderableParticle){C=ea;C.x*=x;C.y*=t;var aa=C,jb=ea;b(O.opacity);c(O.blending);var gb=void 0,Ab=void 0,Bb=void 0,Cb=void 0,yc=ea=void 0,od=void 0;O instanceof THREE.ParticleBasicMaterial?null===O.map?(Bb=jb.object.scale.x,Cb=jb.object.scale.y,Bb*=jb.scale.x*x,Cb*=jb.scale.y*t,Ea.min.set(aa.x-Bb,aa.y-Cb),Ea.max.set(aa.x+Bb,aa.y+Cb),!1!==qb.isIntersectionBox(Ea)&&(h(O.color.getStyle()),v.save(),v.translate(aa.x,aa.y),
|
|
|
-v.rotate(-jb.rotation),v.scale(Bb,Cb),v.fillRect(-1,-1,2,2),v.restore())):(ea=O.map.image,yc=ea.width>>1,od=ea.height>>1,Bb=jb.scale.x*x,Cb=jb.scale.y*t,gb=Bb*yc,Ab=Cb*od,Ea.min.set(aa.x-gb,aa.y-Ab),Ea.max.set(aa.x+gb,aa.y+Ab),!1!==qb.isIntersectionBox(Ea)&&(v.save(),v.translate(aa.x,aa.y),v.rotate(-jb.rotation),v.scale(Bb,-Cb),v.translate(-yc,-od),v.drawImage(ea,0,0),v.restore())):O instanceof THREE.ParticleCanvasMaterial&&(gb=jb.scale.x*x,Ab=jb.scale.y*t,Ea.min.set(aa.x-gb,aa.y-Ab),Ea.max.set(aa.x+
|
|
|
-gb,aa.y+Ab),!1!==qb.isIntersectionBox(Ea)&&(g(O.color.getStyle()),h(O.color.getStyle()),v.save(),v.translate(aa.x,aa.y),v.rotate(-jb.rotation),v.scale(gb,Ab),O.program(v),v.restore()))}else if(ea instanceof THREE.RenderableLine)C=ea.v1,I=ea.v2,C.positionScreen.x*=x,C.positionScreen.y*=t,I.positionScreen.x*=x,I.positionScreen.y*=t,Ea.setFromPoints([C.positionScreen,I.positionScreen]),!0===qb.isIntersectionBox(Ea)&&(aa=C,jb=I,b(O.opacity),c(O.blending),v.beginPath(),v.moveTo(aa.positionScreen.x,aa.positionScreen.y),
|
|
|
-v.lineTo(jb.positionScreen.x,jb.positionScreen.y),O instanceof THREE.LineBasicMaterial?(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),i(null,null),v.stroke(),Ea.expandByScalar(2*O.linewidth)):O instanceof THREE.LineDashedMaterial&&(d(O.linewidth),e(O.linecap),f(O.linejoin),g(O.color.getStyle()),i(O.dashSize,O.gapSize),v.stroke(),Ea.expandByScalar(2*O.linewidth)));else if(ea instanceof THREE.RenderableFace3){C=ea.v1;I=ea.v2;M=ea.v3;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;
|
|
|
-if(-1>I.positionScreen.z||1<I.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;I.positionScreen.x*=x;I.positionScreen.y*=t;M.positionScreen.x*=x;M.positionScreen.y*=t;!0===O.overdraw&&(H(C.positionScreen,I.positionScreen),H(I.positionScreen,M.positionScreen),H(M.positionScreen,C.positionScreen));Ea.setFromPoints([C.positionScreen,I.positionScreen,M.positionScreen]);r(C,I,M,0,1,2,ea,O,a)}else if(ea instanceof THREE.RenderableFace4){C=
|
|
|
-ea.v1;I=ea.v2;M=ea.v3;W=ea.v4;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;if(-1>I.positionScreen.z||1<I.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;I.positionScreen.x*=x;I.positionScreen.y*=t;M.positionScreen.x*=x;M.positionScreen.y*=t;W.positionScreen.x*=x;W.positionScreen.y*=t;ua.positionScreen.copy(I.positionScreen);Ha.positionScreen.copy(W.positionScreen);
|
|
|
-!0===O.overdraw&&(H(C.positionScreen,I.positionScreen),H(I.positionScreen,W.positionScreen),H(W.positionScreen,C.positionScreen),H(M.positionScreen,ua.positionScreen),H(M.positionScreen,Ha.positionScreen));Ea.setFromPoints([C.positionScreen,I.positionScreen,M.positionScreen,W.positionScreen]);aa=C;jb=I;gb=M;Ab=W;Bb=ua;Cb=Ha;yc=a;k.info.render.vertices+=4;k.info.render.faces++;b(O.opacity);c(O.blending);void 0!==O.map&&null!==O.map||void 0!==O.envMap&&null!==O.envMap?(r(aa,jb,Ab,0,1,3,ea,O,yc),r(Bb,
|
|
|
-gb,Cb,1,2,3,ea,O,yc)):(oa=aa.positionScreen.x,J=aa.positionScreen.y,da=jb.positionScreen.x,ka=jb.positionScreen.y,Y=gb.positionScreen.x,L=gb.positionScreen.y,va=Ab.positionScreen.x,Ya=Ab.positionScreen.y,mb=Bb.positionScreen.x,Hb=Bb.positionScreen.y,ta=Cb.positionScreen.x,Ma=Cb.positionScreen.y,O instanceof THREE.MeshLambertMaterial||O instanceof THREE.MeshPhongMaterial?(ra.copy(O.color),fa.copy(O.emissive),O.vertexColors===THREE.FaceColors&&ra.multiply(ea.color),!0===gc?!1===O.wireframe&&O.shading==
|
|
|
-THREE.SmoothShading&&4==ea.vertexNormalsLength?(ja.copy(vb),ma.copy(vb),X.copy(vb),ha.copy(vb),q(ea.v1.positionWorld,ea.vertexNormalsModel[0],ja),q(ea.v2.positionWorld,ea.vertexNormalsModel[1],ma),q(ea.v4.positionWorld,ea.vertexNormalsModel[3],X),q(ea.v3.positionWorld,ea.vertexNormalsModel[2],ha),ja.multiply(ra).add(fa),ma.multiply(ra).add(fa),X.multiply(ra).add(fa),ha.multiply(ra).add(fa),Ua=G(ja,ma,X,ha),z(oa,J,da,ka,va,Ya),F(oa,J,da,ka,va,Ya,0,0,1,0,0,1,Ua),z(mb,Hb,Y,L,ta,Ma),F(mb,Hb,Y,L,ta,Ma,
|
|
|
-1,0,1,1,0,1,Ua)):(ga.copy(vb),q(ea.centroidModel,ea.normalModel,ga),ga.multiply(ra).add(fa),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga)):(ga.addColors(ra,fa),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga))):O instanceof THREE.MeshBasicMaterial?(ga.copy(O.color),O.vertexColors===THREE.FaceColors&&ga.multiply(ea.color),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,
|
|
|
-O.wireframeLinecap,O.wireframeLinejoin):A(ga)):O instanceof THREE.MeshNormalMaterial?(aa=void 0,O.shading==THREE.FlatShading?(aa=ea.normalModelView,ga.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),w(oa,J,da,ka,Y,L,va,Ya),!0===O.wireframe?B(ga,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):A(ga)):O.shading==THREE.SmoothShading&&(aa=ea.vertexNormalsModelView[0],ja.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[1],ma.setRGB(aa.x,aa.y,
|
|
|
-aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[3],X.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),aa=ea.vertexNormalsModelView[2],ha.setRGB(aa.x,aa.y,aa.z).multiplyScalar(0.5).addScalar(0.5),Ua=G(ja,ma,X,ha),z(oa,J,da,ka,va,Ya),F(oa,J,da,ka,va,Ya,0,0,1,0,0,1,Ua),z(mb,Hb,Y,L,ta,Ma),F(mb,Hb,Y,L,ta,Ma,1,0,1,1,0,1,Ua))):O instanceof THREE.MeshDepthMaterial&&(ia=p.near,Ra=p.far,ja.r=ja.g=ja.b=1-K(aa.positionScreen.z*aa.positionScreen.w,ia,Ra),ma.r=ma.g=ma.b=1-K(jb.positionScreen.z*
|
|
|
-jb.positionScreen.w,ia,Ra),X.r=X.g=X.b=1-K(Ab.positionScreen.z*Ab.positionScreen.w,ia,Ra),ha.r=ha.g=ha.b=1-K(gb.positionScreen.z*gb.positionScreen.w,ia,Ra),Ua=G(ja,ma,X,ha),z(oa,J,da,ka,va,Ya),F(oa,J,da,ka,va,Ya,0,0,1,0,0,1,Ua),z(mb,Hb,Y,L,ta,Ma),F(mb,Hb,Y,L,ta,Ma,1,0,1,1,0,1,Ua)))}qa.union(Ea)}}v.setTransform(1,0,0,1,0,0)}}};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",
|
|
|
+THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){J!==a&&(J=v.globalAlpha=a)}function c(a){A!==a&&(a===THREE.NormalBlending?v.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?v.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(v.globalCompositeOperation="darker"),A=a)}function d(a){I!==a&&(I=v.lineWidth=a)}function e(a){F!==a&&(F=v.lineCap=a)}function f(a){V!==a&&(V=v.lineJoin=a)}function g(a){z!==a&&(z=v.strokeStyle=a)}function h(a){G!==a&&(G=v.fillStyle=a)}function i(a,
|
|
|
+b){if(B!==a||T!==b)v.setLineDash([a,b]),B=a,T=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},k=this,l,n,m,s=new THREE.Projector,r=void 0!==a.canvas?a.canvas:document.createElement("canvas"),p,q,x,t,v=r.getContext("2d"),w=new THREE.Color(0),E=0,J=1,A=0,z=null,G=null,I=null,F=null,V=null,B=null,T=0,C,K,L,W,X=new THREE.RenderableVertex,qa=new THREE.RenderableVertex,ga,H,ba,Ca,ja,oa,M,Na,wb,lb,xb,za,ca=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,Z=new THREE.Color,ha=new THREE.Color,
|
|
|
+sa=new THREE.Color,ka=new THREE.Color,Ia=new THREE.Color,db={},$a={},ua,Wa,Ta,Ua,nb,yb,Kb,gc,Bb,Cb,ob=new THREE.Box2,Qa=new THREE.Box2,Da=new THREE.Box2,zb=!1,pb=new THREE.Color,wc=new THREE.Color,Ra=new THREE.Color,ia=new THREE.Vector3,mb,Ab,j,Oa,ub,eb,Xa=16;mb=document.createElement("canvas");mb.width=mb.height=2;Ab=mb.getContext("2d");Ab.fillStyle="rgba(0,0,0,1)";Ab.fillRect(0,0,2,2);j=Ab.getImageData(0,0,2,2);Oa=j.data;ub=document.createElement("canvas");ub.width=ub.height=Xa;eb=ub.getContext("2d");
|
|
|
+eb.translate(-Xa/2,-Xa/2);eb.scale(Xa,Xa);Xa--;void 0===v.setLineDash&&(v.setLineDash=void 0!==v.mozDash?function(a){v.mozDash=null!==a[0]?a:null}:function(){});this.domElement=r;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b){p=
|
|
|
+a*this.devicePixelRatio;q=b*this.devicePixelRatio;x=Math.floor(p/2);t=Math.floor(q/2);r.width=p;r.height=q;r.style.width=a+"px";r.style.height=b+"px";ob.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));Qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));J=1;A=0;V=F=I=G=z=null};this.setClearColor=function(a,b){w.copy(a);E=void 0!==b?b:1;Qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t))};this.setClearColorHex=function(a,b){w.setHex(a);E=void 0!==b?b:1;Qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,
|
|
|
+t))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){v.setTransform(1,0,0,-1,x,t);!1===Qa.empty()&&(Qa.intersect(ob),Qa.expandByScalar(2),1>E&&v.clearRect(Qa.min.x|0,Qa.min.y|0,Qa.max.x-Qa.min.x|0,Qa.max.y-Qa.min.y|0),0<E&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*w.r)+","+Math.floor(255*w.g)+","+Math.floor(255*w.b)+","+E+")"),v.fillRect(Qa.min.x|0,Qa.min.y|0,Qa.max.x-Qa.min.x|0,Qa.max.y-Qa.min.y|0)),Qa.makeEmpty())};this.render=function(a,p){function q(a,b,c){for(var d=
|
|
|
+0,e=m.length;d<e;d++){var f=m[d];Ia.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ia.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(Ia.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=ia.getPositionFromMatrix(f.matrixWorld),j=b.dot(ia.subVectors(g,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=j&&(j*=f.intensity,c.add(Ia.multiplyScalar(j)))))}}function r(a,d,e,f,g,j,h,i){k.info.render.vertices+=
|
|
|
+3;k.info.render.faces++;b(i.opacity);c(i.blending);ga=a.positionScreen.x;H=a.positionScreen.y;ba=d.positionScreen.x;Ca=d.positionScreen.y;ja=e.positionScreen.x;oa=e.positionScreen.y;z(ga,H,ba,Ca,ja,oa);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(sa.copy(i.color),ka.copy(i.emissive),i.vertexColors===THREE.FaceColors&&sa.multiply(h.color),!0===zb?!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(ma.copy(pb),na.copy(pb),Z.copy(pb),
|
|
|
+q(h.v1.positionWorld,h.vertexNormalsModel[0],ma),q(h.v2.positionWorld,h.vertexNormalsModel[1],na),q(h.v3.positionWorld,h.vertexNormalsModel[2],Z),ma.multiply(sa).add(ka),na.multiply(sa).add(ka),Z.multiply(sa).add(ka),ha.addColors(na,Z).multiplyScalar(0.5),Ta=F(ma,na,Z,ha),G(ga,H,ba,Ca,ja,oa,0,0,1,0,0,1,Ta)):(ca.copy(pb),q(h.centroidModel,h.normalModel,ca),ca.multiply(sa).add(ka),!0===i.wireframe?B(ca,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ca)):!0===i.wireframe?B(i.color,i.wireframeLinewidth,
|
|
|
+i.wireframeLinecap,i.wireframeLinejoin):A(i.color)):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Ua=h.uvs[0],E(ga,H,ba,Ca,ja,oa,Ua[f].x,Ua[f].y,Ua[g].x,Ua[g].y,Ua[j].x,Ua[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ia.copy(h.vertexNormalsModelView[f]),nb=0.5*ia.x+0.5,yb=0.5*ia.y+0.5,ia.copy(h.vertexNormalsModelView[g]),Kb=0.5*
|
|
|
+ia.x+0.5,gc=0.5*ia.y+0.5,ia.copy(h.vertexNormalsModelView[j]),Bb=0.5*ia.x+0.5,Cb=0.5*ia.y+0.5,E(ga,H,ba,Ca,ja,oa,nb,yb,Kb,gc,Bb,Cb,i.envMap)):(ca.copy(i.color),i.vertexColors===THREE.FaceColors&&ca.multiply(h.color),!0===i.wireframe?B(ca,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ca)):i instanceof THREE.MeshDepthMaterial?(ua=p.near,Wa=p.far,g=1-J(a.positionScreen.z*a.positionScreen.w,ua,Wa),ma.setRGB(g,g,g),g=1-J(d.positionScreen.z*d.positionScreen.w,ua,Wa),na.setRGB(g,g,g),g=
|
|
|
+1-J(e.positionScreen.z*e.positionScreen.w,ua,Wa),Z.setRGB(g,g,g),ha.addColors(na,Z).multiplyScalar(0.5),Ta=F(ma,na,Z,ha),G(ga,H,ba,Ca,ja,oa,0,0,1,0,0,1,Ta)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(d=h.normalModelView,ca.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?B(ca,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ca)):i.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[f],ma.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
+d=h.vertexNormalsModelView[g],na.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],Z.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ha.addColors(na,Z).multiplyScalar(0.5),Ta=F(ma,na,Z,ha),G(ga,H,ba,Ca,ja,oa,0,0,1,0,0,1,Ta)))}function z(a,b,c,d,e,f){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.closePath()}function w(a,b,c,d,e,f,g,j){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.lineTo(g,j);v.closePath()}function B(a,b,c,j){d(b);e(c);
|
|
|
+f(j);g(a.getStyle());v.stroke();Da.expandByScalar(2*b)}function A(a){h(a.getStyle());v.fill()}function E(a,b,c,d,e,f,g,j,i,xa,k,m,l){if(!(l instanceof THREE.DataTexture||void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,fb=l.wrapT==THREE.RepeatWrapping;db[l.id]=v.createPattern(l.image,!0===n&&!0===fb?"repeat":!0===n&&!1===fb?"repeat-x":!1===n&&!0===fb?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===db[l.id]?h("rgba(0,0,0,1)"):h(db[l.id]);var n=l.offset.x/
|
|
|
+l.repeat.x,fb=l.offset.y/l.repeat.y,p=l.image.width*l.repeat.x,q=l.image.height*l.repeat.y,g=(g+n)*p,j=(1-j+fb)*q,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*p-g,xa=(1-xa+fb)*q-j,k=(k+n)*p-g,m=(1-m+fb)*q-j,n=i*m-k*xa;0===n?(void 0===$a[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),$a[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=$a[l.id],g=4*(Math.floor(g)+Math.floor(j)*l.image.width),ca.setRGB(b[g]/255,
|
|
|
+b[g+1]/255,b[g+2]/255),A(ca)):(n=1/n,l=(m*c-xa*e)*n,xa=(m*d-xa*f)*n,c=(i*e-k*c)*n,d=(i*f-k*d)*n,a=a-l*g-c*j,g=b-xa*g-d*j,v.save(),v.transform(l,xa,c,d,a,g),v.fill(),v.restore())}}function G(a,b,c,d,e,f,g,j,h,i,xa,k,l){var n,m;n=l.width-1;m=l.height-1;g*=n;j*=m;c-=a;d-=b;e-=a;f-=b;h=h*n-g;i=i*m-j;xa=xa*n-g;k=k*m-j;m=1/(h*k-xa*i);n=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-xa*c)*m;d=(h*f-xa*d)*m;a=a-n*g-c*j;b=b-i*g-d*j;v.save();v.transform(n,i,c,d,a,b);v.clip();v.drawImage(l,0,0);v.restore()}function F(a,b,
|
|
|
+c,d){Oa[0]=255*a.r|0;Oa[1]=255*a.g|0;Oa[2]=255*a.b|0;Oa[4]=255*b.r|0;Oa[5]=255*b.g|0;Oa[6]=255*b.b|0;Oa[8]=255*c.r|0;Oa[9]=255*c.g|0;Oa[10]=255*c.b|0;Oa[12]=255*d.r|0;Oa[13]=255*d.g|0;Oa[14]=255*d.b|0;Ab.putImageData(j,0,0);eb.drawImage(mb,0,0);return ub}function J(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function I(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)}if(!1===p instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{!0===this.autoClear&&this.clear();v.setTransform(1,0,0,-1,x,t);k.info.render.vertices=0;k.info.render.faces=0;l=s.projectScene(a,p,this.sortObjects,this.sortElements);n=l.elements;m=l.lights;zb=0<m.length;if(!0===zb){pb.setRGB(0,0,0);wc.setRGB(0,0,0);Ra.setRGB(0,0,0);for(var T=0,V=m.length;T<V;T++){var N=m[T],Y=N.color;N instanceof THREE.AmbientLight?pb.add(Y):N instanceof THREE.DirectionalLight?wc.add(Y):N instanceof THREE.PointLight&&Ra.add(Y)}}T=0;for(V=n.length;T<V;T++){var da=n[T],N=da.material;
|
|
|
+if(!(void 0===N||!1===N.visible)){Da.makeEmpty();if(da instanceof THREE.RenderableParticle){C=da;C.x*=x;C.y*=t;var Y=C,xa=da;b(N.opacity);c(N.blending);var Db=void 0,fb=void 0,Eb=void 0,Fb=void 0,yc=da=void 0,md=void 0;N instanceof THREE.ParticleBasicMaterial?null===N.map?(Eb=xa.object.scale.x,Fb=xa.object.scale.y,Eb*=xa.scale.x*x,Fb*=xa.scale.y*t,Da.min.set(Y.x-Eb,Y.y-Fb),Da.max.set(Y.x+Eb,Y.y+Fb),!1!==ob.isIntersectionBox(Da)&&(h(N.color.getStyle()),v.save(),v.translate(Y.x,Y.y),v.rotate(-xa.rotation),
|
|
|
+v.scale(Eb,Fb),v.fillRect(-1,-1,2,2),v.restore())):(da=N.map.image,yc=da.width>>1,md=da.height>>1,Eb=xa.scale.x*x,Fb=xa.scale.y*t,Db=Eb*yc,fb=Fb*md,Da.min.set(Y.x-Db,Y.y-fb),Da.max.set(Y.x+Db,Y.y+fb),!1!==ob.isIntersectionBox(Da)&&(v.save(),v.translate(Y.x,Y.y),v.rotate(-xa.rotation),v.scale(Eb,-Fb),v.translate(-yc,-md),v.drawImage(da,0,0),v.restore())):N instanceof THREE.ParticleCanvasMaterial&&(Db=xa.scale.x*x,fb=xa.scale.y*t,Da.min.set(Y.x-Db,Y.y-fb),Da.max.set(Y.x+Db,Y.y+fb),!1!==ob.isIntersectionBox(Da)&&
|
|
|
+(g(N.color.getStyle()),h(N.color.getStyle()),v.save(),v.translate(Y.x,Y.y),v.rotate(-xa.rotation),v.scale(Db,fb),N.program(v),v.restore()))}else if(da instanceof THREE.RenderableLine)C=da.v1,K=da.v2,C.positionScreen.x*=x,C.positionScreen.y*=t,K.positionScreen.x*=x,K.positionScreen.y*=t,Da.setFromPoints([C.positionScreen,K.positionScreen]),!0===ob.isIntersectionBox(Da)&&(Y=C,xa=K,b(N.opacity),c(N.blending),v.beginPath(),v.moveTo(Y.positionScreen.x,Y.positionScreen.y),v.lineTo(xa.positionScreen.x,xa.positionScreen.y),
|
|
|
+N instanceof THREE.LineBasicMaterial?(d(N.linewidth),e(N.linecap),f(N.linejoin),g(N.color.getStyle()),i(null,null),v.stroke(),Da.expandByScalar(2*N.linewidth)):N instanceof THREE.LineDashedMaterial&&(d(N.linewidth),e(N.linecap),f(N.linejoin),g(N.color.getStyle()),i(N.dashSize,N.gapSize),v.stroke(),Da.expandByScalar(2*N.linewidth)));else if(da instanceof THREE.RenderableFace3){C=da.v1;K=da.v2;L=da.v3;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;
|
|
|
+if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;K.positionScreen.x*=x;K.positionScreen.y*=t;L.positionScreen.x*=x;L.positionScreen.y*=t;!0===N.overdraw&&(I(C.positionScreen,K.positionScreen),I(K.positionScreen,L.positionScreen),I(L.positionScreen,C.positionScreen));Da.setFromPoints([C.positionScreen,K.positionScreen,L.positionScreen]);r(C,K,L,0,1,2,da,N,a)}else if(da instanceof THREE.RenderableFace4){C=da.v1;K=da.v2;L=da.v3;W=da.v4;if(-1>C.positionScreen.z||
|
|
|
+1<C.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;K.positionScreen.x*=x;K.positionScreen.y*=t;L.positionScreen.x*=x;L.positionScreen.y*=t;W.positionScreen.x*=x;W.positionScreen.y*=t;X.positionScreen.copy(K.positionScreen);qa.positionScreen.copy(W.positionScreen);!0===N.overdraw&&(I(C.positionScreen,K.positionScreen),
|
|
|
+I(K.positionScreen,W.positionScreen),I(W.positionScreen,C.positionScreen),I(L.positionScreen,X.positionScreen),I(L.positionScreen,qa.positionScreen));Da.setFromPoints([C.positionScreen,K.positionScreen,L.positionScreen,W.positionScreen]);Y=C;xa=K;Db=L;fb=W;Eb=X;Fb=qa;yc=a;k.info.render.vertices+=4;k.info.render.faces++;b(N.opacity);c(N.blending);void 0!==N.map&&null!==N.map||void 0!==N.envMap&&null!==N.envMap?(r(Y,xa,fb,0,1,3,da,N,yc),r(Eb,Db,Fb,1,2,3,da,N,yc)):(ga=Y.positionScreen.x,H=Y.positionScreen.y,
|
|
|
+ba=xa.positionScreen.x,Ca=xa.positionScreen.y,ja=Db.positionScreen.x,oa=Db.positionScreen.y,M=fb.positionScreen.x,Na=fb.positionScreen.y,wb=Eb.positionScreen.x,lb=Eb.positionScreen.y,xb=Fb.positionScreen.x,za=Fb.positionScreen.y,N instanceof THREE.MeshLambertMaterial||N instanceof THREE.MeshPhongMaterial?(sa.copy(N.color),ka.copy(N.emissive),N.vertexColors===THREE.FaceColors&&sa.multiply(da.color),!0===zb?!1===N.wireframe&&N.shading==THREE.SmoothShading&&4==da.vertexNormalsLength?(ma.copy(pb),na.copy(pb),
|
|
|
+Z.copy(pb),ha.copy(pb),q(da.v1.positionWorld,da.vertexNormalsModel[0],ma),q(da.v2.positionWorld,da.vertexNormalsModel[1],na),q(da.v4.positionWorld,da.vertexNormalsModel[3],Z),q(da.v3.positionWorld,da.vertexNormalsModel[2],ha),ma.multiply(sa).add(ka),na.multiply(sa).add(ka),Z.multiply(sa).add(ka),ha.multiply(sa).add(ka),Ta=F(ma,na,Z,ha),z(ga,H,ba,Ca,M,Na),G(ga,H,ba,Ca,M,Na,0,0,1,0,0,1,Ta),z(wb,lb,ja,oa,xb,za),G(wb,lb,ja,oa,xb,za,1,0,1,1,0,1,Ta)):(ca.copy(pb),q(da.centroidModel,da.normalModel,ca),ca.multiply(sa).add(ka),
|
|
|
+w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca)):(ca.addColors(sa,ka),w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca))):N instanceof THREE.MeshBasicMaterial?(ca.copy(N.color),N.vertexColors===THREE.FaceColors&&ca.multiply(da.color),w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca)):N instanceof THREE.MeshNormalMaterial?
|
|
|
+(Y=void 0,N.shading==THREE.FlatShading?(Y=da.normalModelView,ca.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca)):N.shading==THREE.SmoothShading&&(Y=da.vertexNormalsModelView[0],ma.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Y=da.vertexNormalsModelView[1],na.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Y=da.vertexNormalsModelView[3],Z.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
+Y=da.vertexNormalsModelView[2],ha.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Ta=F(ma,na,Z,ha),z(ga,H,ba,Ca,M,Na),G(ga,H,ba,Ca,M,Na,0,0,1,0,0,1,Ta),z(wb,lb,ja,oa,xb,za),G(wb,lb,ja,oa,xb,za,1,0,1,1,0,1,Ta))):N instanceof THREE.MeshDepthMaterial&&(ua=p.near,Wa=p.far,ma.r=ma.g=ma.b=1-J(Y.positionScreen.z*Y.positionScreen.w,ua,Wa),na.r=na.g=na.b=1-J(xa.positionScreen.z*xa.positionScreen.w,ua,Wa),Z.r=Z.g=Z.b=1-J(fb.positionScreen.z*fb.positionScreen.w,ua,Wa),ha.r=ha.g=ha.b=1-J(Db.positionScreen.z*
|
|
|
+Db.positionScreen.w,ua,Wa),Ta=F(ma,na,Z,ha),z(ga,H,ba,Ca,M,Na),G(ga,H,ba,Ca,M,Na,0,0,1,0,0,1,Ta),z(wb,lb,ja,oa,xb,za),G(wb,lb,ja,oa,xb,za,1,0,1,1,0,1,Ta)))}Qa.union(Da)}}v.setTransform(1,0,0,1,0,0)}}};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\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -348,153 +348,154 @@ l;c++)a.__morphTargetsArrays.push(new Float32Array(3*h))}if(a.numMorphNormals){a
|
|
|
"v3"===c.type?i=3:"v4"===c.type?i=4:"c"===c.type&&(i=3),c.size=i,c.array=new Float32Array(h*i),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
|
|
|
THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,i=d.uv,h=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
|
void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.colorsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){qa[a]||(j.enableVertexAttribArray(a),qa[a]=!0)}function l(){for(var a in qa)qa[a]&&(j.disableVertexAttribArray(a),qa[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=
|
|
|
-mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0,a[d].render(b,c,mc,qb),ga=mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0}function r(a,b,c,d,e,f,g,j){var i,h,k,l;b?(h=a.length-1,l=b=-1):(h=0,b=a.length,l=1);for(var m=h;m!==b;m+=l)if(i=a[m],i.render){h=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;g&&L.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);L.setDepthTest(i.depthTest);L.setDepthWrite(i.depthWrite);H(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}L.setMaterialFaces(i);k instanceof
|
|
|
-THREE.BufferGeometry?L.renderBufferDirect(d,e,f,i,k,h):L.renderBuffer(d,e,f,i,k,h)}}function p(a,b,c,d,e,f,g){for(var i,j,h=0,k=a.length;h<k;h++)if(i=a[h],j=i.object,j.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&L.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);L.setDepthTest(i.depthTest);L.setDepthWrite(i.depthWrite);H(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,i,j)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
-function x(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function D(a,b,c,d,e){ma=0;d.needsUpdate&&(d.program&&aa(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));
|
|
|
-var f=!1,g=d.program,i=g.uniforms,h=d.uniforms;g!==mb&&(j.useProgram(g),mb=g,f=!0);d.id!==ta&&(ta=d.id,f=!0);if(f||a!==ga)j.uniformMatrix4fv(i.projectionMatrix,!1,a.projectionMatrix.elements),a!==ga&&(ga=a);if(d.skinning)if(tc&&e.useVertexTexture){if(null!==i.boneTexture){var k=K();j.uniform1i(i.boneTexture,k);L.setTexture(e.boneTexture,k)}}else null!==i.boneGlobalMatrices&&j.uniformMatrix4fv(i.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(h.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
-(h.fogNear.value=c.near,h.fogFar.value=c.far):c instanceof THREE.FogExp2&&(h.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ab){for(var l,m=k=0,n=0,p,q,s,r=xb,t=r.directional.colors,v=r.directional.positions,x=r.point.colors,w=r.point.positions,C=r.point.distances,A=r.spot.colors,D=r.spot.positions,G=r.spot.distances,H=r.spot.directions,J=r.spot.anglesCos,O=r.spot.exponents,T=r.hemi.skyColors,X=r.hemi.groundColors,va=r.hemi.positions,
|
|
|
-W=0,V=0,ja=0,da=0,ha=0,ka=0,fa=0,Ya=0,N=l=0,c=s=N=0,f=b.length;c<f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,s=l.distance,l instanceof THREE.AmbientLight?l.visible&&(L.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(ha+=1,l.visible&&(Na.getPositionFromMatrix(l.matrixWorld),Pa.getPositionFromMatrix(l.target.matrixWorld),Na.sub(Pa),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(l=3*W,v[l]=Na.x,v[l+1]=Na.y,v[l+2]=Na.z,L.gammaInput?z(t,
|
|
|
-l,p,q*q):F(t,l,p,q),W+=1))):l instanceof THREE.PointLight?(ka+=1,l.visible&&(N=3*V,L.gammaInput?z(x,N,p,q*q):F(x,N,p,q),Pa.getPositionFromMatrix(l.matrixWorld),w[N]=Pa.x,w[N+1]=Pa.y,w[N+2]=Pa.z,C[V]=s,V+=1)):l instanceof THREE.SpotLight?(fa+=1,l.visible&&(N=3*ja,L.gammaInput?z(A,N,p,q*q):F(A,N,p,q),Pa.getPositionFromMatrix(l.matrixWorld),D[N]=Pa.x,D[N+1]=Pa.y,D[N+2]=Pa.z,G[ja]=s,Na.copy(Pa),Pa.getPositionFromMatrix(l.target.matrixWorld),Na.sub(Pa),Na.normalize(),H[N]=Na.x,H[N+1]=Na.y,H[N+2]=Na.z,
|
|
|
-J[ja]=Math.cos(l.angle),O[ja]=l.exponent,ja+=1)):l instanceof THREE.HemisphereLight&&(Ya+=1,l.visible&&(Na.getPositionFromMatrix(l.matrixWorld),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(s=3*da,va[s]=Na.x,va[s+1]=Na.y,va[s+2]=Na.z,p=l.color,l=l.groundColor,L.gammaInput?(q*=q,z(T,s,p,q),z(X,s,l,q)):(F(T,s,p,q),F(X,s,l,q)),da+=1))));c=3*W;for(f=Math.max(t.length,3*ha);c<f;c++)t[c]=0;c=3*V;for(f=Math.max(x.length,3*ka);c<f;c++)x[c]=0;c=3*ja;for(f=Math.max(A.length,3*fa);c<f;c++)A[c]=0;c=3*da;for(f=
|
|
|
-Math.max(T.length,3*Ya);c<f;c++)T[c]=0;c=3*da;for(f=Math.max(X.length,3*Ya);c<f;c++)X[c]=0;r.directional.length=W;r.point.length=V;r.spot.length=ja;r.hemi.length=da;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;ab=!1}c=xb;h.ambientLightColor.value=c.ambient;h.directionalLightColor.value=c.directional.colors;h.directionalLightDirection.value=c.directional.positions;h.pointLightColor.value=c.point.colors;h.pointLightPosition.value=c.point.positions;h.pointLightDistance.value=c.point.distances;h.spotLightColor.value=
|
|
|
+h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){Da[a]||(j.enableVertexAttribArray(a),Da[a]=!0)}function l(){for(var a in Da)Da[a]&&(j.disableVertexAttribArray(a),Da[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ma=
|
|
|
+lb=null,za=ca=sa=ha=Wa=ua=ka=-1,mb=!0,a[d].render(b,c,ob,Qa),ma=lb=null,za=ca=sa=ha=Wa=ua=ka=-1,mb=!0}function r(a,b,c,d,e,f,g,j){var i,h,k,l;b?(h=a.length-1,l=b=-1):(h=0,b=a.length,l=1);for(var m=h;m!==b;m+=l)if(i=a[m],i.render){h=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;g&&M.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);M.setDepthTest(i.depthTest);M.setDepthWrite(i.depthWrite);F(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}M.setMaterialFaces(i);k instanceof
|
|
|
+THREE.BufferGeometry?M.renderBufferDirect(d,e,f,i,k,h):M.renderBuffer(d,e,f,i,k,h)}}function p(a,b,c,d,e,f,g){for(var i,j,h=0,k=a.length;h<k;h++)if(i=a[h],j=i.object,j.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&M.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);M.setDepthTest(i.depthTest);M.setDepthWrite(i.depthWrite);F(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}M.renderImmediateObject(c,d,e,i,j)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
+function x(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function E(a,b,c,d,e){Z=0;d.needsUpdate&&(d.program&&da(d),M.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets));
|
|
|
+var f=!1,g=d.program,i=g.uniforms,h=d.uniforms;g!==lb&&(j.useProgram(g),lb=g,f=!0);d.id!==za&&(za=d.id,f=!0);if(f||a!==ma)j.uniformMatrix4fv(i.projectionMatrix,!1,a.projectionMatrix.elements),a!==ma&&(ma=a);if(d.skinning)if(xc&&e.useVertexTexture){if(null!==i.boneTexture){var k=J();j.uniform1i(i.boneTexture,k);M.setTexture(e.boneTexture,k)}}else null!==i.boneGlobalMatrices&&j.uniformMatrix4fv(i.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(h.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
+(h.fogNear.value=c.near,h.fogFar.value=c.far):c instanceof THREE.FogExp2&&(h.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(mb){for(var l,m=k=0,n=0,p,q,s,r=Ab,t=r.directional.colors,v=r.directional.positions,x=r.point.colors,w=r.point.positions,B=r.point.distances,C=r.spot.colors,A=r.spot.positions,E=r.spot.distances,F=r.spot.directions,I=r.spot.anglesCos,K=r.spot.exponents,H=r.hemi.skyColors,N=r.hemi.groundColors,ca=r.hemi.positions,
|
|
|
+V=0,Y=0,na=0,ba=0,Na=0,ha=0,ja=0,ka=0,O=l=0,c=s=O=0,f=b.length;c<f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,s=l.distance,l instanceof THREE.AmbientLight?l.visible&&(M.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(Na+=1,l.visible&&(ia.getPositionFromMatrix(l.matrixWorld),Ra.getPositionFromMatrix(l.target.matrixWorld),ia.sub(Ra),ia.normalize(),0===ia.x&&0===ia.y&&0===ia.z||(l=3*V,v[l]=ia.x,v[l+1]=ia.y,v[l+2]=ia.z,M.gammaInput?z(t,
|
|
|
+l,p,q*q):G(t,l,p,q),V+=1))):l instanceof THREE.PointLight?(ha+=1,l.visible&&(O=3*Y,M.gammaInput?z(x,O,p,q*q):G(x,O,p,q),Ra.getPositionFromMatrix(l.matrixWorld),w[O]=Ra.x,w[O+1]=Ra.y,w[O+2]=Ra.z,B[Y]=s,Y+=1)):l instanceof THREE.SpotLight?(ja+=1,l.visible&&(O=3*na,M.gammaInput?z(C,O,p,q*q):G(C,O,p,q),Ra.getPositionFromMatrix(l.matrixWorld),A[O]=Ra.x,A[O+1]=Ra.y,A[O+2]=Ra.z,E[na]=s,ia.copy(Ra),Ra.getPositionFromMatrix(l.target.matrixWorld),ia.sub(Ra),ia.normalize(),F[O]=ia.x,F[O+1]=ia.y,F[O+2]=ia.z,
|
|
|
+I[na]=Math.cos(l.angle),K[na]=l.exponent,na+=1)):l instanceof THREE.HemisphereLight&&(ka+=1,l.visible&&(ia.getPositionFromMatrix(l.matrixWorld),ia.normalize(),0===ia.x&&0===ia.y&&0===ia.z||(s=3*ba,ca[s]=ia.x,ca[s+1]=ia.y,ca[s+2]=ia.z,p=l.color,l=l.groundColor,M.gammaInput?(q*=q,z(H,s,p,q),z(N,s,l,q)):(G(H,s,p,q),G(N,s,l,q)),ba+=1))));c=3*V;for(f=Math.max(t.length,3*Na);c<f;c++)t[c]=0;c=3*Y;for(f=Math.max(x.length,3*ha);c<f;c++)x[c]=0;c=3*na;for(f=Math.max(C.length,3*ja);c<f;c++)C[c]=0;c=3*ba;for(f=
|
|
|
+Math.max(H.length,3*ka);c<f;c++)H[c]=0;c=3*ba;for(f=Math.max(N.length,3*ka);c<f;c++)N[c]=0;r.directional.length=V;r.point.length=Y;r.spot.length=na;r.hemi.length=ba;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;mb=!1}c=Ab;h.ambientLightColor.value=c.ambient;h.directionalLightColor.value=c.directional.colors;h.directionalLightDirection.value=c.directional.positions;h.pointLightColor.value=c.point.colors;h.pointLightPosition.value=c.point.positions;h.pointLightDistance.value=c.point.distances;h.spotLightColor.value=
|
|
|
c.spot.colors;h.spotLightPosition.value=c.spot.positions;h.spotLightDistance.value=c.spot.distances;h.spotLightDirection.value=c.spot.directions;h.spotLightAngleCos.value=c.spot.anglesCos;h.spotLightExponent.value=c.spot.exponents;h.hemisphereLightSkyColor.value=c.hemi.skyColors;h.hemisphereLightGroundColor.value=c.hemi.groundColors;h.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){h.opacity.value=
|
|
|
-d.opacity;L.gammaInput?h.diffuse.value.copyGammaToLinear(d.color):h.diffuse.value=d.color;h.map.value=d.map;h.lightMap.value=d.lightMap;h.specularMap.value=d.specularMap;d.bumpMap&&(h.bumpMap.value=d.bumpMap,h.bumpScale.value=d.bumpScale);d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,h.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));
|
|
|
+d.opacity;M.gammaInput?h.diffuse.value.copyGammaToLinear(d.color):h.diffuse.value=d.color;h.map.value=d.map;h.lightMap.value=d.lightMap;h.specularMap.value=d.specularMap;d.bumpMap&&(h.bumpMap.value=d.bumpMap,h.bumpScale.value=d.bumpScale);d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale));var X;d.map?X=d.map:d.specularMap?X=d.specularMap:d.normalMap?X=d.normalMap:d.bumpMap&&(X=d.bumpMap);void 0!==X&&(c=X.offset,X=X.repeat,h.offsetRepeat.value.set(c.x,c.y,X.x,X.y));
|
|
|
h.envMap.value=d.envMap;h.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;h.reflectivity.value=d.reflectivity;h.refractionRatio.value=d.refractionRatio;h.combine.value=d.combine;h.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity,h.dashSize.value=d.dashSize,h.totalSize.value=
|
|
|
-d.dashSize+d.gapSize,h.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(h.psColor.value=d.color,h.opacity.value=d.opacity,h.size.value=d.size,h.scale.value=M.height/2,h.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(h.shininess.value=d.shininess,L.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive),h.specular.value.copyGammaToLinear(d.specular)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive,h.specular.value=d.specular),
|
|
|
-d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(L.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(h.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&
|
|
|
-h.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))h.shadowMap.value[Y]=k.shadowMap,h.shadowMapSize.value[Y]=k.shadowMapSize,h.shadowMatrix.value[Y]=k.shadowMatrix,h.shadowDarkness.value[Y]=k.shadowDarkness,h.shadowBias.value[Y]=k.shadowBias,Y++}b=d.uniformsList;h=0;for(Y=b.length;h<Y;h++)if(f=g.uniforms[b[h][1]])if(c=b[h][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,
|
|
|
+d.dashSize+d.gapSize,h.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(h.psColor.value=d.color,h.opacity.value=d.opacity,h.size.value=d.size,h.scale.value=W.height/2,h.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(h.shininess.value=d.shininess,M.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive),h.specular.value.copyGammaToLinear(d.specular)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive,h.specular.value=d.specular),
|
|
|
+d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(M.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(h.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&
|
|
|
+h.shadowMatrix){c=X=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))h.shadowMap.value[X]=k.shadowMap,h.shadowMapSize.value[X]=k.shadowMapSize,h.shadowMatrix.value[X]=k.shadowMatrix,h.shadowDarkness.value[X]=k.shadowDarkness,h.shadowBias.value[X]=k.shadowBias,X++}b=d.uniformsList;h=0;for(X=b.length;h<X;h++)if(f=g.uniforms[b[h][1]])if(c=b[h][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,
|
|
|
k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===m)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===m)j.uniform1iv(f,k);else if("iv"===m)j.uniform3iv(f,k);else if("fv1"===m)j.uniform1fv(f,k);else if("fv"===m)j.uniform3fv(f,k);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*k.length));m=0;for(n=k.length;m<n;m++)r=2*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y;j.uniform2fv(f,c._array)}else if("v3v"===
|
|
|
m){void 0===c._array&&(c._array=new Float32Array(3*k.length));m=0;for(n=k.length;m<n;m++)r=3*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z;j.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*k.length));m=0;for(n=k.length;m<n;m++)r=4*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z,c._array[r+3]=k[m].w;j.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,
|
|
|
-!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=K(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
-c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(m=0;6>m;m++)L.autoScaleCubemaps&&!f?(n=k,r=m,t=c.image[m],x=id,t.width<=x&&t.height<=x||(w=Math.max(t.width,t.height),v=Math.floor(t.width*x/w),x=Math.floor(t.height*x/w),w=document.createElement("canvas"),w.width=v,w.height=x,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,x),t=w),n[r]=t):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=I(c.format);
|
|
|
-t=I(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(m=0;6>m;m++)if(f){x=k[m].mipmaps;w=0;for(C=x.length;w<C;w++)v=x[w],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=K();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&L.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)Pa.getPositionFromMatrix(a.matrixWorld),j.uniform3f(i.cameraPosition,Pa.x,Pa.y,
|
|
|
-Pa.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&j.uniformMatrix4fv(i.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(i.modelViewMatrix,!1,e._modelViewMatrix.elements);i.normalMatrix&&j.uniformMatrix3fv(i.normalMatrix,!1,e._normalMatrix.elements);null!==i.modelMatrix&&j.uniformMatrix4fv(i.modelMatrix,!1,e.matrixWorld.elements);return g}function K(){var a=ma;a>=Oc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+Oc);ma+=1;return a}function A(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function F(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function H(a,b,c){Ra!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ra=a);if(a&&(Ua!==b||Sa!==c))j.polygonOffset(b,c),
|
|
|
-Ua=b,Sa=c}function G(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function V(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(G(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,I(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,I(b.wrapT)),
|
|
|
-j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(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,C(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,C(b.minFilter)));if(ob&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ob.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ec)),b.__oldAnisotropy=b.anisotropy}
|
|
|
-function T(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 C(a){return a===
|
|
|
-THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function I(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;
|
|
|
-if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;
|
|
|
-if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;
|
|
|
+!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=J(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),M.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
+c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(m=0;6>m;m++)M.autoScaleCubemaps&&!f?(n=k,r=m,t=c.image[m],x=gd,t.width<=x&&t.height<=x||(w=Math.max(t.width,t.height),v=Math.floor(t.width*x/w),x=Math.floor(t.height*x/w),w=document.createElement("canvas"),w.width=v,w.height=x,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,x),t=w),n[r]=t):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=L(c.format);
|
|
|
+t=L(c.type);T(j.TEXTURE_CUBE_MAP,c,n);for(m=0;6>m;m++)if(f){x=k[m].mipmaps;w=0;for(B=x.length;w<B;w++)v=x[w],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?
|
|
|
+(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):M.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=J();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&M.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)Ra.getPositionFromMatrix(a.matrixWorld),j.uniform3f(i.cameraPosition,Ra.x,Ra.y,
|
|
|
+Ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&j.uniformMatrix4fv(i.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(i.modelViewMatrix,!1,e._modelViewMatrix.elements);i.normalMatrix&&j.uniformMatrix3fv(i.normalMatrix,!1,e._normalMatrix.elements);null!==i.modelMatrix&&j.uniformMatrix4fv(i.modelMatrix,!1,e.matrixWorld.elements);return g}function J(){var a=Z;a>=Mc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
+a+" texture units while this GPU supports only "+Mc);Z+=1;return a}function A(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function I(a){a!==yb&&(j.lineWidth(a),yb=a)}function F(a,b,c){Ta!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ta=a);if(a&&
|
|
|
+(Ua!==b||nb!==c))j.polygonOffset(b,c),Ua=b,nb=c}function V(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function B(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(V(b)),null):c}function T(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,L(b.wrapS)),j.texParameteri(a,
|
|
|
+j.TEXTURE_WRAP_T,L(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(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,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)));if(eb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,eb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Cc)),b.__oldAnisotropy=
|
|
|
+b.anisotropy}function C(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 K(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function L(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
|
|
|
+THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===
|
|
|
+THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;
|
|
|
if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;
|
|
|
-if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Va){if(a===THREE.RGB_S3TC_DXT1_Format)return Va.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Va.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Va.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Va.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},M=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-W=void 0!==a.precision?a.precision:"highp",ua=void 0!==a.alpha?a.alpha:!0,Ha=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.stencil?a.stencil:!0,da=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Y=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=M;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?
|
|
|
+if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Xa){if(a===THREE.RGB_S3TC_DXT1_Format)return Xa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Xa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Xa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Xa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},W=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
+X=void 0!==a.precision?a.precision:"highp",qa=void 0!==a.alpha?a.alpha:!0,ga=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,H=void 0!==a.antialias?a.antialias:!1,ba=void 0!==a.stencil?a.stencil:!0,Ca=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ja=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),oa=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=W;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?
|
|
|
window.devicePixelRatio:1;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.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;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 L=this,va=[],Ya=0,mb=null,Hb=null,ta=-1,Ma=null,ga=null,ja=0,ma=0,X=-1,ha=-1,ra=-1,fa=-1,Da=-1,Za=-1,$a=-1,ia=-1,Ra=null,Ua=null,Sa=null,fb=null,pb=0,Ib=0,Jb=0,fc=0,mc=0,qb=0,qa={},Ea=new THREE.Frustum,gc=new THREE.Matrix4,vb=new THREE.Matrix4,Pa=new THREE.Vector3,Na=new THREE.Vector3,ab=!0,xb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
-colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,yb,bb,ob,Va;try{if(!(j=M.getContext("experimental-webgl",{alpha:ua,premultipliedAlpha:Ha,antialias:oa,stencil:J,preserveDrawingBuffer:da})))throw"Error creating WebGL context.";}catch(zb){console.error(zb)}yb=j.getExtension("OES_texture_float");bb=j.getExtension("OES_standard_derivatives");ob=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
-j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Va=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");yb||console.log("THREE.WebGLRenderer: Float textures not supported.");bb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");ob||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
-Va||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});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(ka.r,ka.g,ka.b,Y);this.context=j;var Oc=
|
|
|
-j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),hd=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var id=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Ec=ob?j.getParameter(ob.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,sc=0<hd,tc=sc&&yb;Va&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var ld=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),md=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var nd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
|
|
|
-j.HIGH_FLOAT),kd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var jd=0<ld.precision&&0<nd.precision,
|
|
|
-Pc=0<md.precision&&0<kd.precision;"highp"===W&&!jd&&(Pc?(W="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(W="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===W&&!Pc&&(W="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return sc};this.supportsFloatTextures=function(){return yb};this.supportsStandardDerivatives=function(){return bb};
|
|
|
-this.supportsCompressedTextureS3TC=function(){return Va};this.getMaxAnisotropy=function(){return Ec};this.getPrecision=function(){return W};this.setSize=function(a,b){M.width=a*this.devicePixelRatio;M.height=b*this.devicePixelRatio;M.style.width=a+"px";M.style.height=b+"px";this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,b,c,d){pb=void 0!==a?a:0;Ib=void 0!==b?b:0;Jb=void 0!==c?c:M.width;fc=void 0!==d?d:M.height;j.viewport(pb,Ib,Jb,fc)};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){ka.setHex(a);Y=b;j.clearColor(ka.r,ka.g,ka.b,Y)};this.setClearColor=function(a,b){ka.copy(a);Y=b;j.clearColor(ka.r,ka.g,ka.b,Y)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return Y};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.updateShadowMap=function(a,b){mb=null;ta=Ma=ia=$a=ra=-1;ab=!0;ha=X=-1;this.shadowMapPlugin.update(a,b)};var xd=function(a){a=a.target;a.removeEventListener("dispose",xd);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==
|
|
|
-a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&
|
|
|
-j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);
|
|
|
-L.info.memory.geometries--},Qc=function(a){a=a.target;a.removeEventListener("dispose",Qc);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));L.info.memory.textures--},Rc=function(a){a=a.target;a.removeEventListener("dispose",Rc);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
-else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},O=function(a){a=a.target;a.removeEventListener("dispose",O);aa(a)},aa=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=va.length;a<c;a++)if(d=va[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=va.length;a<c;a++)d=va[a],d.program!==b&&e.push(d);va=e;j.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
+[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var M=this,Na=[],wb=0,lb=null,xb=null,za=-1,ca=null,ma=null,na=0,Z=0,ha=-1,sa=-1,ka=-1,Ia=-1,db=-1,$a=-1,ua=-1,Wa=-1,Ta=null,Ua=null,nb=null,yb=null,Kb=0,gc=0,Bb=0,Cb=0,ob=0,Qa=0,Da={},zb=new THREE.Frustum,pb=new THREE.Matrix4,wc=new THREE.Matrix4,Ra=new THREE.Vector3,ia=new THREE.Vector3,mb=!0,Ab={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
+colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Oa,ub,eb,Xa;try{if(!(j=W.getContext("experimental-webgl",{alpha:qa,premultipliedAlpha:ga,antialias:H,stencil:ba,preserveDrawingBuffer:Ca})))throw"Error creating WebGL context.";}catch(ed){console.error(ed)}Oa=j.getExtension("OES_texture_float");ub=j.getExtension("OES_standard_derivatives");eb=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
+j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Xa=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Oa||console.log("THREE.WebGLRenderer: Float textures not supported.");ub||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");eb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
+Xa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});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(ja.r,ja.g,ja.b,oa);this.context=j;
|
|
|
+var Mc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),fd=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var gd=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Cc=eb?j.getParameter(eb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,rc=0<fd,xc=rc&&Oa;Xa&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var jd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),kd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var id=
|
|
|
+j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),hd=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
|
|
|
+j.LOW_INT);var ld=0<jd.precision&&0<id.precision,Nc=0<kd.precision&&0<hd.precision;"highp"===X&&!ld&&(Nc?(X="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(X="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===X&&!Nc&&(X="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return rc};this.supportsFloatTextures=function(){return Oa};
|
|
|
+this.supportsStandardDerivatives=function(){return ub};this.supportsCompressedTextureS3TC=function(){return Xa};this.getMaxAnisotropy=function(){return Cc};this.getPrecision=function(){return X};this.setSize=function(a,b){W.width=a*this.devicePixelRatio;W.height=b*this.devicePixelRatio;W.style.width=a+"px";W.style.height=b+"px";this.setViewport(0,0,W.width,W.height)};this.setViewport=function(a,b,c,d){Kb=void 0!==a?a:0;gc=void 0!==b?b:0;Bb=void 0!==c?c:W.width;Cb=void 0!==d?d:W.height;j.viewport(Kb,
|
|
|
+gc,Bb,Cb)};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){ja.setHex(a);oa=b;j.clearColor(ja.r,ja.g,ja.b,oa)};this.setClearColor=function(a,b){ja.copy(a);oa=b;j.clearColor(ja.r,ja.g,ja.b,oa)};this.getClearColor=function(){return ja};this.getClearAlpha=function(){return oa};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.updateShadowMap=function(a,b){lb=null;za=ca=Wa=ua=ka=-1;mb=!0;sa=ha=-1;this.shadowMapPlugin.update(a,b)};var wd=function(a){a=a.target;a.removeEventListener("dispose",wd);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&
|
|
|
+j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);
|
|
|
+void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);
|
|
|
+M.info.memory.geometries--},Oc=function(a){a=a.target;a.removeEventListener("dispose",Oc);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));M.info.memory.textures--},N=function(a){a=a.target;a.removeEventListener("dispose",N);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
+else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);M.info.memory.textures--},Y=function(a){a=a.target;a.removeEventListener("dispose",Y);da(a)},da=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=Na.length;a<c;a++)if(d=Na[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Na.length;a<c;a++)d=Na[a],d.program!==b&&e.push(d);Na=e;j.deleteProgram(b);M.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(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.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,m,l,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],m=n[p+5],h=n[p+6],k=n[p+7],l=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
|
|
|
3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,
|
|
|
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=D(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==Ma&&(Ma=d,b=!0),b&&l(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<g;c++){var h=d[c].index;if(b){var i=e.attributes.position,m=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*h*m);m=e.attributes.normal;if(0<=
|
|
|
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0),c!==ca&&(ca=c,b=!0),b&&l(),f instanceof THREE.Mesh)if(d=e.attributes.index){f=e.offsets;1<f.length&&(b=!0);for(var c=0,g=f.length;c<g;c++){var h=f[c].index;if(b){var i=e.attributes.position,m=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*h*m);m=e.attributes.normal;if(0<=
|
|
|
a.normal&&m){var n=m.itemSize;j.bindBuffer(j.ARRAY_BUFFER,m.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*h*n)}m=e.attributes.uv;0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*h*n));m=e.attributes.color;0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*h*n));m=e.attributes.tangent;0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*h*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,d[c].count,j.UNSIGNED_SHORT,2*d[c].start);L.info.render.calls++;L.info.render.vertices+=d[c].count;L.info.render.faces+=d[c].count/3}}else b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.normal,0<=a.normal&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*h*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,d.buffer)}j.drawElements(j.TRIANGLES,f[c].count,j.UNSIGNED_SHORT,2*f[c].start);M.info.render.calls++;M.info.render.vertices+=f[c].count;M.info.render.faces+=f[c].count/3}}else b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.normal,0<=a.normal&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
m.buffer),k(a.normal),j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,0)),m=e.attributes.uv,0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,0)),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),m=e.attributes.tangent,0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,
|
|
|
-!1,0,0))),j.drawArrays(j.TRIANGLES,0,i.numItems/3),L.info.render.calls++,L.info.render.vertices+=i.numItems/3,L.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
|
|
|
-i.numItems/3),L.info.render.calls++,L.info.render.points+=i.numItems/3):f instanceof THREE.Line&&b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.LINE_STRIP,0,i.numItems/3),L.info.render.calls++,L.info.render.points+=i.numItems)};this.renderBuffer=
|
|
|
-function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=D(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ma&&(Ma=c,a=!0);a&&l();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,
|
|
|
-3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)i=g[n],0<i&&h.push([i,n]);h.length>d.numSupportedMorphTargets?(h.sort(m),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(m):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(n=h[i][1],0<=
|
|
|
-c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[n]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
|
-f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),k(b[c.buffer.belongsToAttribute]),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(b.color),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglNormalBuffer),k(b.normal),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(b.tangent),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(b.uv),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0));0<=b.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(b.uv2),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=b.skinIndex&&0<=b.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglSkinIndicesBuffer),k(b.skinIndex),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));0<=b.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),j.vertexAttribPointer(b.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==fb&&(j.lineWidth(d),fb=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)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==fb&&(j.lineWidth(d),fb=d),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof
|
|
|
-THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,k=a.fog;ta=-1;ab=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&
|
|
|
-b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);gc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(gc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,
|
|
|
-f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Ea.intersectsObject(g))){A(g,b);var m=f,l=m.buffer,q=void 0,t=q=void 0,t=m.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=t)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:
|
|
|
-(Pa.getPositionFromMatrix(g.matrixWorld),Pa.applyProjection(gc),f.z=Pa.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(A(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),H(d.polygonOffset,d.polygonOffsetFactor,
|
|
|
-d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,i,k,!0,d),p(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,i,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,i,k,!1,d),r(a.__webglObjects,!1,"transparent",b,i,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=D(a,b,c,d,e);Ma=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ea):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=
|
|
|
-function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,n=void 0,l=void 0,p=void 0,r=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",xd)),b instanceof THREE.Mesh)if(l=b.geometry,p=b.material,
|
|
|
-l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=l,z=void 0,C=void 0,B=void 0,A=void 0,D=void 0,F=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups={};z=0;for(C=s.faces.length;z<C;z++)B=s.faces[z],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I}),
|
|
|
-D=B instanceof THREE.Face3?3:4,65535<s.geometryGroups[F].vertices+D&&(G[A].counter+=1,F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I})),B instanceof THREE.Face3?s.geometryGroups[F].faces3.push(z):s.geometryGroups[F].faces4.push(z),s.geometryGroups[F].vertices+=D;s.geometryGroupsList=[];var M=void 0;for(M in s.geometryGroups)s.geometryGroups[M].id=ja++,s.geometryGroupsList.push(s.geometryGroups[M])}for(n in l.geometryGroups)if(r=
|
|
|
-l.geometryGroups[n],!r.__webglVertexBuffer){var J=r;J.__webglVertexBuffer=j.createBuffer();J.__webglNormalBuffer=j.createBuffer();J.__webglTangentBuffer=j.createBuffer();J.__webglColorBuffer=j.createBuffer();J.__webglUVBuffer=j.createBuffer();J.__webglUV2Buffer=j.createBuffer();J.__webglSkinIndicesBuffer=j.createBuffer();J.__webglSkinWeightsBuffer=j.createBuffer();J.__webglFaceBuffer=j.createBuffer();J.__webglLineBuffer=j.createBuffer();var O=void 0,T=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=
|
|
|
-[];O=0;for(T=J.numMorphTargets;O<T;O++)J.__webglMorphTargetsBuffers.push(j.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];O=0;for(T=J.numMorphNormals;O<T;O++)J.__webglMorphNormalsBuffers.push(j.createBuffer())}L.info.memory.geometries++;d(r,b);l.verticesNeedUpdate=!0;l.morphTargetsNeedUpdate=!0;l.elementsNeedUpdate=!0;l.uvsNeedUpdate=!0;l.normalsNeedUpdate=!0;l.tangentsNeedUpdate=!0;l.colorsNeedUpdate=!0}}else l instanceof THREE.BufferGeometry&&h(l);else if(b instanceof THREE.Ribbon){if(l=
|
|
|
-b.geometry,!l.__webglVertexBuffer){var X=l;X.__webglVertexBuffer=j.createBuffer();X.__webglColorBuffer=j.createBuffer();X.__webglNormalBuffer=j.createBuffer();L.info.memory.geometries++;var ga=l,W=b,va=ga.vertices.length;ga.__vertexArray=new Float32Array(3*va);ga.__colorArray=new Float32Array(3*va);ga.__normalArray=new Float32Array(3*va);ga.__webglVertexCount=va;c(ga,W);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(l=b.geometry,!l.__webglVertexBuffer)if(l instanceof
|
|
|
-THREE.Geometry){var V=l;V.__webglVertexBuffer=j.createBuffer();V.__webglColorBuffer=j.createBuffer();V.__webglLineDistanceBuffer=j.createBuffer();L.info.memory.geometries++;var Y=l,da=b,aa=Y.vertices.length;Y.__vertexArray=new Float32Array(3*aa);Y.__colorArray=new Float32Array(3*aa);Y.__lineDistanceArray=new Float32Array(1*aa);Y.__webglLineCount=aa;c(Y,da);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.lineDistancesNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l)}else if(b instanceof THREE.ParticleSystem&&
|
|
|
-(l=b.geometry,!l.__webglVertexBuffer))if(l instanceof THREE.Geometry){var ma=l;ma.__webglVertexBuffer=j.createBuffer();ma.__webglColorBuffer=j.createBuffer();L.info.memory.geometries++;var ha=l,ka=b,Ya=ha.vertices.length;ha.__vertexArray=new Float32Array(3*Ya);ha.__colorArray=new Float32Array(3*Ya);ha.__sortArray=[];ha.__webglParticleCount=Ya;c(ha,ka);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(l=b.geometry,
|
|
|
+!1,0,0))),j.drawArrays(j.TRIANGLES,0,i.numItems/3),M.info.render.calls++,M.info.render.vertices+=i.numItems/3,M.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
|
|
|
+i.numItems/3),M.info.render.calls++,M.info.render.points+=i.numItems/3):f instanceof THREE.Line&&b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),I(d.linewidth),j.drawArrays(j.LINE_STRIP,0,i.numItems/3),M.info.render.calls++,M.info.render.points+=i.numItems)};
|
|
|
+this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ca&&(ca=c,b=!0);b&&l();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),
|
|
|
+j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=
|
|
|
+c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)i=g[n],0<i&&h.push([i,n]);h.length>d.numSupportedMorphTargets?(h.sort(m),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(m):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?
|
|
|
+(n=h[i][1],0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[n]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
|
+f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),k(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+e.__webglNormalBuffer),k(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+e.__webglSkinIndicesBuffer),k(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(I(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,
|
|
|
+e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,I(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),
|
|
|
+M.info.render.calls++,M.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,k=a.fog;za=-1;mb=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+pb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);zb.setFromMatrix(pb);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;M.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof
|
|
|
+THREE.ParticleSystem)||!g.frustumCulled||zb.intersectsObject(g))){A(g,b);var m=f,l=m.buffer,q=void 0,t=q=void 0,t=m.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=t)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Ra.getPositionFromMatrix(g.matrixWorld),Ra.applyProjection(pb),
|
|
|
+f.z=Ra.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(A(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),F(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,
|
|
|
+i,k,!0,d),p(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,i,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,i,k,!1,d),r(a.__webglObjects,!1,"transparent",b,i,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),
|
|
|
+j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=E(a,b,c,d,e);ca=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,zb):e.render(function(a){M.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=
|
|
|
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,n=void 0,l=void 0,p=void 0,r=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",wd)),b instanceof THREE.Mesh)if(l=b.geometry,p=b.material,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=
|
|
|
+l,z=void 0,C=void 0,B=void 0,A=void 0,E=void 0,F=void 0,G={},I=s.morphTargets.length,J=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups={};z=0;for(C=s.faces.length;z<C;z++)B=s.faces[z],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:I,numMorphNormals:J}),E=B instanceof THREE.Face3?3:4,65535<s.geometryGroups[F].vertices+
|
|
|
+E&&(G[A].counter+=1,F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:I,numMorphNormals:J})),B instanceof THREE.Face3?s.geometryGroups[F].faces3.push(z):s.geometryGroups[F].faces4.push(z),s.geometryGroups[F].vertices+=E;s.geometryGroupsList=[];var L=void 0;for(L in s.geometryGroups)s.geometryGroups[L].id=na++,s.geometryGroupsList.push(s.geometryGroups[L])}for(n in l.geometryGroups)if(r=l.geometryGroups[n],
|
|
|
+!r.__webglVertexBuffer){var H=r;H.__webglVertexBuffer=j.createBuffer();H.__webglNormalBuffer=j.createBuffer();H.__webglTangentBuffer=j.createBuffer();H.__webglColorBuffer=j.createBuffer();H.__webglUVBuffer=j.createBuffer();H.__webglUV2Buffer=j.createBuffer();H.__webglSkinIndicesBuffer=j.createBuffer();H.__webglSkinWeightsBuffer=j.createBuffer();H.__webglFaceBuffer=j.createBuffer();H.__webglLineBuffer=j.createBuffer();var N=void 0,ca=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];N=0;
|
|
|
+for(ca=H.numMorphTargets;N<ca;N++)H.__webglMorphTargetsBuffers.push(j.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];N=0;for(ca=H.numMorphNormals;N<ca;N++)H.__webglMorphNormalsBuffers.push(j.createBuffer())}M.info.memory.geometries++;d(r,b);l.verticesNeedUpdate=!0;l.morphTargetsNeedUpdate=!0;l.elementsNeedUpdate=!0;l.uvsNeedUpdate=!0;l.normalsNeedUpdate=!0;l.tangentsNeedUpdate=!0;l.colorsNeedUpdate=!0}}else l instanceof THREE.BufferGeometry&&h(l);else if(b instanceof THREE.Ribbon){if(l=
|
|
|
+b.geometry,!l.__webglVertexBuffer){var T=l;T.__webglVertexBuffer=j.createBuffer();T.__webglColorBuffer=j.createBuffer();T.__webglNormalBuffer=j.createBuffer();M.info.memory.geometries++;var V=l,W=b,Z=V.vertices.length;V.__vertexArray=new Float32Array(3*Z);V.__colorArray=new Float32Array(3*Z);V.__normalArray=new Float32Array(3*Z);V.__webglVertexCount=Z;c(V,W);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(l=b.geometry,!l.__webglVertexBuffer)if(l instanceof
|
|
|
+THREE.Geometry){var Y=l;Y.__webglVertexBuffer=j.createBuffer();Y.__webglColorBuffer=j.createBuffer();Y.__webglLineDistanceBuffer=j.createBuffer();M.info.memory.geometries++;var X=l,ma=b,ba=X.vertices.length;X.__vertexArray=new Float32Array(3*ba);X.__colorArray=new Float32Array(3*ba);X.__lineDistanceArray=new Float32Array(1*ba);X.__webglLineCount=ba;c(X,ma);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.lineDistancesNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l)}else if(b instanceof THREE.ParticleSystem&&
|
|
|
+(l=b.geometry,!l.__webglVertexBuffer))if(l instanceof THREE.Geometry){var Na=l;Na.__webglVertexBuffer=j.createBuffer();Na.__webglColorBuffer=j.createBuffer();M.info.memory.geometries++;var ha=l,ja=b,ka=ha.vertices.length;ha.__vertexArray=new Float32Array(3*ka);ha.__colorArray=new Float32Array(3*ka);ha.__sortArray=[];ha.__webglParticleCount=ka;c(ha,ja);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(l=b.geometry,
|
|
|
l instanceof THREE.BufferGeometry)q(k.__webglObjects,l,b);else{if(l instanceof THREE.Geometry)for(n in l.geometryGroups)r=l.geometryGroups[n],q(k.__webglObjects,r,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(l=b.geometry,q(k.__webglObjects,l,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&
|
|
|
-k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fa=a.__objectsRemoved[0],mb=a;fa instanceof THREE.Mesh||fa instanceof THREE.ParticleSystem||fa instanceof THREE.Ribbon||fa instanceof THREE.Line?v(mb.__webglObjects,fa):fa instanceof THREE.Sprite?w(mb.__webglSprites,fa):fa instanceof THREE.LensFlare?w(mb.__webglFlares,fa):(fa instanceof THREE.ImmediateRenderObject||fa.immediateRenderCallback)&&v(mb.__webglObjectsImmediate,fa);fa.__webglActive=
|
|
|
-!1;a.__objectsRemoved.splice(0,1)}for(var ra=0,Ma=a.__webglObjects.length;ra<Ma;ra++){var ia=a.__webglObjects[ra].object,N=ia.geometry,ua=void 0,oa=void 0,ta=void 0;if(ia instanceof THREE.Mesh)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate)&&i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.elementsNeedUpdate=!1,N.uvsNeedUpdate=!1,N.normalsNeedUpdate=!1,N.colorsNeedUpdate=!1,N.tangentsNeedUpdate=
|
|
|
-!1;else{for(var Da=0,Hb=N.geometryGroupsList.length;Da<Hb;Da++)if(ua=N.geometryGroupsList[Da],ta=e(ia,ua),N.buffersNeedUpdate&&d(ua,ia),oa=ta.attributes&&x(ta),N.verticesNeedUpdate||N.morphTargetsNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate||oa){var sa=ua,Ha=ia,qa=j.DYNAMIC_DRAW,Na=!N.dynamic,Ea=ta;if(sa.__inittedArrays){var Ua=f(Ea),Za=Ea.vertexColors?Ea.vertexColors:!1,ab=g(Ea),bb=Ua===THREE.SmoothShading,E=void 0,U=void 0,Ra=void 0,
|
|
|
-P=void 0,$a=void 0,Va=void 0,Sa=void 0,ob=void 0,fb=void 0,pb=void 0,qb=void 0,Q=void 0,R=void 0,S=void 0,pa=void 0,Mb=void 0,Nb=void 0,Ob=void 0,xb=void 0,Pb=void 0,Qb=void 0,Rb=void 0,yb=void 0,Sb=void 0,Tb=void 0,Ub=void 0,zb=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Ib=void 0,Yb=void 0,Zb=void 0,$b=void 0,Jb=void 0,ya=void 0,fc=void 0,nc=void 0,zc=void 0,Ac=void 0,cb=void 0,mc=void 0,Wa=void 0,Xa=void 0,oc=void 0,hc=void 0,Oa=0,Ta=0,ic=0,jc=0,Db=0,kb=0,Ba=0,nb=0,Qa=0,$=0,la=0,y=0,za=void 0,db=sa.__vertexArray,
|
|
|
-Fc=sa.__uvArray,Gc=sa.__uv2Array,Eb=sa.__normalArray,Ia=sa.__tangentArray,eb=sa.__colorArray,Ja=sa.__skinIndexArray,Ka=sa.__skinWeightArray,sc=sa.__morphTargetsArrays,tc=sa.__morphNormalsArrays,pd=sa.__webglCustomAttributesList,u=void 0,ac=sa.__faceArray,wb=sa.__lineArray,rb=Ha.geometry,Oc=rb.elementsNeedUpdate,Ec=rb.uvsNeedUpdate,Pc=rb.normalsNeedUpdate,Qc=rb.tangentsNeedUpdate,Rc=rb.colorsNeedUpdate,hd=rb.morphTargetsNeedUpdate,uc=rb.vertices,wa=sa.faces3,xa=sa.faces4,lb=rb.faces,qd=rb.faceVertexUvs[0],
|
|
|
-rd=rb.faceVertexUvs[1],vc=rb.skinIndices,pc=rb.skinWeights,qc=rb.morphTargets,Sc=rb.morphNormals;if(rb.verticesNeedUpdate){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=uc[P.a],R=uc[P.b],S=uc[P.c],db[Ta]=Q.x,db[Ta+1]=Q.y,db[Ta+2]=Q.z,db[Ta+3]=R.x,db[Ta+4]=R.y,db[Ta+5]=R.z,db[Ta+6]=S.x,db[Ta+7]=S.y,db[Ta+8]=S.z,Ta+=9;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=uc[P.a],R=uc[P.b],S=uc[P.c],pa=uc[P.d],db[Ta]=Q.x,db[Ta+1]=Q.y,db[Ta+2]=Q.z,db[Ta+3]=R.x,db[Ta+4]=R.y,db[Ta+5]=R.z,db[Ta+6]=S.x,db[Ta+7]=S.y,db[Ta+
|
|
|
-8]=S.z,db[Ta+9]=pa.x,db[Ta+10]=pa.y,db[Ta+11]=pa.z,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,db,qa)}if(hd){cb=0;for(mc=qc.length;cb<mc;cb++){E=la=0;for(U=wa.length;E<U;E++)oc=wa[E],P=lb[oc],Q=qc[cb].vertices[P.a],R=qc[cb].vertices[P.b],S=qc[cb].vertices[P.c],Wa=sc[cb],Wa[la]=Q.x,Wa[la+1]=Q.y,Wa[la+2]=Q.z,Wa[la+3]=R.x,Wa[la+4]=R.y,Wa[la+5]=R.z,Wa[la+6]=S.x,Wa[la+7]=S.y,Wa[la+8]=S.z,Ea.morphNormals&&(bb?(hc=Sc[cb].vertexNormals[oc],Pb=hc.a,Qb=hc.b,Rb=hc.c):
|
|
|
-Rb=Qb=Pb=Sc[cb].faceNormals[oc],Xa=tc[cb],Xa[la]=Pb.x,Xa[la+1]=Pb.y,Xa[la+2]=Pb.z,Xa[la+3]=Qb.x,Xa[la+4]=Qb.y,Xa[la+5]=Qb.z,Xa[la+6]=Rb.x,Xa[la+7]=Rb.y,Xa[la+8]=Rb.z),la+=9;E=0;for(U=xa.length;E<U;E++)oc=xa[E],P=lb[oc],Q=qc[cb].vertices[P.a],R=qc[cb].vertices[P.b],S=qc[cb].vertices[P.c],pa=qc[cb].vertices[P.d],Wa=sc[cb],Wa[la]=Q.x,Wa[la+1]=Q.y,Wa[la+2]=Q.z,Wa[la+3]=R.x,Wa[la+4]=R.y,Wa[la+5]=R.z,Wa[la+6]=S.x,Wa[la+7]=S.y,Wa[la+8]=S.z,Wa[la+9]=pa.x,Wa[la+10]=pa.y,Wa[la+11]=pa.z,Ea.morphNormals&&(bb?
|
|
|
-(hc=Sc[cb].vertexNormals[oc],Pb=hc.a,Qb=hc.b,Rb=hc.c,yb=hc.d):yb=Rb=Qb=Pb=Sc[cb].faceNormals[oc],Xa=tc[cb],Xa[la]=Pb.x,Xa[la+1]=Pb.y,Xa[la+2]=Pb.z,Xa[la+3]=Qb.x,Xa[la+4]=Qb.y,Xa[la+5]=Qb.z,Xa[la+6]=Rb.x,Xa[la+7]=Rb.y,Xa[la+8]=Rb.z,Xa[la+9]=yb.x,Xa[la+10]=yb.y,Xa[la+11]=yb.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,sc[cb],qa);Ea.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphNormalsBuffers[cb]),j.bufferData(j.ARRAY_BUFFER,tc[cb],
|
|
|
-qa))}}if(pc.length){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Vb=pc[P.a],Wb=pc[P.b],Xb=pc[P.c],Ka[$]=Vb.x,Ka[$+1]=Vb.y,Ka[$+2]=Vb.z,Ka[$+3]=Vb.w,Ka[$+4]=Wb.x,Ka[$+5]=Wb.y,Ka[$+6]=Wb.z,Ka[$+7]=Wb.w,Ka[$+8]=Xb.x,Ka[$+9]=Xb.y,Ka[$+10]=Xb.z,Ka[$+11]=Xb.w,Yb=vc[P.a],Zb=vc[P.b],$b=vc[P.c],Ja[$]=Yb.x,Ja[$+1]=Yb.y,Ja[$+2]=Yb.z,Ja[$+3]=Yb.w,Ja[$+4]=Zb.x,Ja[$+5]=Zb.y,Ja[$+6]=Zb.z,Ja[$+7]=Zb.w,Ja[$+8]=$b.x,Ja[$+9]=$b.y,Ja[$+10]=$b.z,Ja[$+11]=$b.w,$+=12;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Vb=pc[P.a],Wb=pc[P.b],
|
|
|
-Xb=pc[P.c],Ib=pc[P.d],Ka[$]=Vb.x,Ka[$+1]=Vb.y,Ka[$+2]=Vb.z,Ka[$+3]=Vb.w,Ka[$+4]=Wb.x,Ka[$+5]=Wb.y,Ka[$+6]=Wb.z,Ka[$+7]=Wb.w,Ka[$+8]=Xb.x,Ka[$+9]=Xb.y,Ka[$+10]=Xb.z,Ka[$+11]=Xb.w,Ka[$+12]=Ib.x,Ka[$+13]=Ib.y,Ka[$+14]=Ib.z,Ka[$+15]=Ib.w,Yb=vc[P.a],Zb=vc[P.b],$b=vc[P.c],Jb=vc[P.d],Ja[$]=Yb.x,Ja[$+1]=Yb.y,Ja[$+2]=Yb.z,Ja[$+3]=Yb.w,Ja[$+4]=Zb.x,Ja[$+5]=Zb.y,Ja[$+6]=Zb.z,Ja[$+7]=Zb.w,Ja[$+8]=$b.x,Ja[$+9]=$b.y,Ja[$+10]=$b.z,Ja[$+11]=$b.w,Ja[$+12]=Jb.x,Ja[$+13]=Jb.y,Ja[$+14]=Jb.z,Ja[$+15]=Jb.w,$+=16;0<$&&
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,qa),j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ka,qa))}if(Rc&&Za){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Sa=P.vertexColors,ob=P.color,3===Sa.length&&Za===THREE.VertexColors?(Sb=Sa[0],Tb=Sa[1],Ub=Sa[2]):Ub=Tb=Sb=ob,eb[Qa]=Sb.r,eb[Qa+1]=Sb.g,eb[Qa+2]=Sb.b,eb[Qa+3]=Tb.r,eb[Qa+4]=Tb.g,eb[Qa+5]=Tb.b,eb[Qa+6]=Ub.r,eb[Qa+7]=Ub.g,eb[Qa+8]=Ub.b,Qa+=9;E=0;for(U=xa.length;E<U;E++)P=
|
|
|
-lb[xa[E]],Sa=P.vertexColors,ob=P.color,4===Sa.length&&Za===THREE.VertexColors?(Sb=Sa[0],Tb=Sa[1],Ub=Sa[2],zb=Sa[3]):zb=Ub=Tb=Sb=ob,eb[Qa]=Sb.r,eb[Qa+1]=Sb.g,eb[Qa+2]=Sb.b,eb[Qa+3]=Tb.r,eb[Qa+4]=Tb.g,eb[Qa+5]=Tb.b,eb[Qa+6]=Ub.r,eb[Qa+7]=Ub.g,eb[Qa+8]=Ub.b,eb[Qa+9]=zb.r,eb[Qa+10]=zb.g,eb[Qa+11]=zb.b,Qa+=12;0<Qa&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,eb,qa))}if(Qc&&rb.hasTangents){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],fb=P.vertexTangents,Mb=fb[0],Nb=fb[1],
|
|
|
-Ob=fb[2],Ia[Ba]=Mb.x,Ia[Ba+1]=Mb.y,Ia[Ba+2]=Mb.z,Ia[Ba+3]=Mb.w,Ia[Ba+4]=Nb.x,Ia[Ba+5]=Nb.y,Ia[Ba+6]=Nb.z,Ia[Ba+7]=Nb.w,Ia[Ba+8]=Ob.x,Ia[Ba+9]=Ob.y,Ia[Ba+10]=Ob.z,Ia[Ba+11]=Ob.w,Ba+=12;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],fb=P.vertexTangents,Mb=fb[0],Nb=fb[1],Ob=fb[2],xb=fb[3],Ia[Ba]=Mb.x,Ia[Ba+1]=Mb.y,Ia[Ba+2]=Mb.z,Ia[Ba+3]=Mb.w,Ia[Ba+4]=Nb.x,Ia[Ba+5]=Nb.y,Ia[Ba+6]=Nb.z,Ia[Ba+7]=Nb.w,Ia[Ba+8]=Ob.x,Ia[Ba+9]=Ob.y,Ia[Ba+10]=Ob.z,Ia[Ba+11]=Ob.w,Ia[Ba+12]=xb.x,Ia[Ba+13]=xb.y,Ia[Ba+14]=xb.z,Ia[Ba+15]=
|
|
|
-xb.w,Ba+=16;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ia,qa)}if(Pc&&Ua){E=0;for(U=wa.length;E<U;E++)if(P=lb[wa[E]],$a=P.vertexNormals,Va=P.normal,3===$a.length&&bb)for(ya=0;3>ya;ya++)nc=$a[ya],Eb[kb]=nc.x,Eb[kb+1]=nc.y,Eb[kb+2]=nc.z,kb+=3;else for(ya=0;3>ya;ya++)Eb[kb]=Va.x,Eb[kb+1]=Va.y,Eb[kb+2]=Va.z,kb+=3;E=0;for(U=xa.length;E<U;E++)if(P=lb[xa[E]],$a=P.vertexNormals,Va=P.normal,4===$a.length&&bb)for(ya=0;4>ya;ya++)nc=$a[ya],Eb[kb]=nc.x,Eb[kb+1]=nc.y,Eb[kb+
|
|
|
-2]=nc.z,kb+=3;else for(ya=0;4>ya;ya++)Eb[kb]=Va.x,Eb[kb+1]=Va.y,Eb[kb+2]=Va.z,kb+=3;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Eb,qa)}if(Ec&&qd&&ab){E=0;for(U=wa.length;E<U;E++)if(Ra=wa[E],pb=qd[Ra],void 0!==pb)for(ya=0;3>ya;ya++)zc=pb[ya],Fc[ic]=zc.x,Fc[ic+1]=zc.y,ic+=2;E=0;for(U=xa.length;E<U;E++)if(Ra=xa[E],pb=qd[Ra],void 0!==pb)for(ya=0;4>ya;ya++)zc=pb[ya],Fc[ic]=zc.x,Fc[ic+1]=zc.y,ic+=2;0<ic&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Fc,qa))}if(Ec&&rd&&ab){E=0;for(U=wa.length;E<U;E++)if(Ra=wa[E],qb=rd[Ra],void 0!==qb)for(ya=0;3>ya;ya++)Ac=qb[ya],Gc[jc]=Ac.x,Gc[jc+1]=Ac.y,jc+=2;E=0;for(U=xa.length;E<U;E++)if(Ra=xa[E],qb=rd[Ra],void 0!==qb)for(ya=0;4>ya;ya++)Ac=qb[ya],Gc[jc]=Ac.x,Gc[jc+1]=Ac.y,jc+=2;0<jc&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Gc,qa))}if(Oc){E=0;for(U=wa.length;E<U;E++)ac[Db]=Oa,ac[Db+1]=Oa+1,ac[Db+2]=Oa+2,Db+=3,wb[nb]=Oa,wb[nb+1]=Oa+1,wb[nb+2]=Oa,wb[nb+3]=Oa+2,wb[nb+4]=Oa+
|
|
|
-1,wb[nb+5]=Oa+2,nb+=6,Oa+=3;E=0;for(U=xa.length;E<U;E++)ac[Db]=Oa,ac[Db+1]=Oa+1,ac[Db+2]=Oa+3,ac[Db+3]=Oa+1,ac[Db+4]=Oa+2,ac[Db+5]=Oa+3,Db+=6,wb[nb]=Oa,wb[nb+1]=Oa+1,wb[nb+2]=Oa,wb[nb+3]=Oa+3,wb[nb+4]=Oa+1,wb[nb+5]=Oa+2,wb[nb+6]=Oa+2,wb[nb+7]=Oa+3,nb+=8,Oa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ac,qa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,wb,qa)}if(pd){ya=0;for(fc=pd.length;ya<fc;ya++)if(u=
|
|
|
-pd[ya],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],y+=3;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],u.array[y+3]=u.value[P.d],y+=4}else{if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)za=u.value[wa[E]],u.array[y]=za,u.array[y+1]=za,u.array[y+2]=za,y+=3;E=0;for(U=
|
|
|
-xa.length;E<U;E++)za=u.value[xa[E]],u.array[y]=za,u.array[y+1]=za,u.array[y+2]=za,u.array[y+3]=za,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+
|
|
|
-2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=pa.x,u.array[y+7]=pa.y,y+=8}else{if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)S=R=Q=za=u.value[wa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;E=0;for(U=xa.length;E<U;E++)pa=S=R=Q=za=u.value[xa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=pa.x,u.array[y+7]=pa.y,y+=8}}else if(3===u.size){var Z;
|
|
|
-Z="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],
|
|
|
-u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}else if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)S=R=Q=za=u.value[wa[E]],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;E=0;for(U=
|
|
|
-xa.length;E<U;E++)pa=S=R=Q=za=u.value[xa[E]],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}else if("faceVertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)za=u.value[wa[E]],Q=za[0],R=za[1],S=za[2],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+
|
|
|
-4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],y+=9;E=0;for(U=xa.length;E<U;E++)za=u.value[xa[E]],Q=za[0],R=za[1],S=za[2],pa=za[3],u.array[y]=Q[Z[0]],u.array[y+1]=Q[Z[1]],u.array[y+2]=Q[Z[2]],u.array[y+3]=R[Z[0]],u.array[y+4]=R[Z[1]],u.array[y+5]=R[Z[2]],u.array[y+6]=S[Z[0]],u.array[y+7]=S[Z[1]],u.array[y+8]=S[Z[2]],u.array[y+9]=pa[Z[0]],u.array[y+10]=pa[Z[1]],u.array[y+11]=pa[Z[2]],y+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=
|
|
|
-0;for(U=wa.length;E<U;E++)P=lb[wa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;E=0;for(U=xa.length;E<U;E++)P=lb[xa[E]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],pa=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+
|
|
|
-6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}else if("faces"===u.boundTo){E=0;for(U=wa.length;E<U;E++)S=R=Q=za=u.value[wa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;E=0;for(U=xa.length;E<U;E++)pa=S=R=
|
|
|
-Q=za=u.value[xa[E]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}else if("faceVertices"===u.boundTo){E=0;for(U=wa.length;E<U;E++)za=u.value[wa[E]],Q=za[0],R=za[1],S=za[2],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+
|
|
|
-5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;E=0;for(U=xa.length;E<U;E++)za=u.value[xa[E]],Q=za[0],R=za[1],S=za[2],pa=za[3],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=pa.x,u.array[y+13]=pa.y,u.array[y+14]=pa.z,u.array[y+15]=pa.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,qa)}}Na&&(delete sa.__inittedArrays,delete sa.__colorArray,delete sa.__normalArray,delete sa.__tangentArray,delete sa.__uvArray,delete sa.__uv2Array,delete sa.__faceArray,delete sa.__vertexArray,delete sa.__lineArray,delete sa.__skinIndexArray,delete sa.__skinWeightArray)}}N.verticesNeedUpdate=!1;N.morphTargetsNeedUpdate=!1;N.elementsNeedUpdate=!1;N.uvsNeedUpdate=!1;N.normalsNeedUpdate=!1;N.colorsNeedUpdate=!1;N.tangentsNeedUpdate=!1;N.buffersNeedUpdate=
|
|
|
-!1;ta.attributes&&t(ta)}else if(ia instanceof THREE.Ribbon){ta=e(ia,N);oa=ta.attributes&&x(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.normalsNeedUpdate||oa){var Fb=N,Tc=j.DYNAMIC_DRAW,Hc=void 0,Ic=void 0,Jc=void 0,Uc=void 0,Aa=void 0,Vc=void 0,Wc=void 0,Xc=void 0,yd=void 0,hb=void 0,Bc=void 0,Fa=void 0,sb=void 0,zd=Fb.vertices,Ad=Fb.colors,Bd=Fb.normals,id=zd.length,jd=Ad.length,kd=Bd.length,Yc=Fb.__vertexArray,Zc=Fb.__colorArray,$c=Fb.__normalArray,ld=Fb.colorsNeedUpdate,md=Fb.normalsNeedUpdate,
|
|
|
-sd=Fb.__webglCustomAttributesList;if(Fb.verticesNeedUpdate){for(Hc=0;Hc<id;Hc++)Uc=zd[Hc],Aa=3*Hc,Yc[Aa]=Uc.x,Yc[Aa+1]=Uc.y,Yc[Aa+2]=Uc.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Yc,Tc)}if(ld){for(Ic=0;Ic<jd;Ic++)Vc=Ad[Ic],Aa=3*Ic,Zc[Aa]=Vc.r,Zc[Aa+1]=Vc.g,Zc[Aa+2]=Vc.b;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Zc,Tc)}if(md){for(Jc=0;Jc<kd;Jc++)Wc=Bd[Jc],Aa=3*Jc,$c[Aa]=Wc.x,$c[Aa+1]=Wc.y,$c[Aa+2]=Wc.z;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-Fb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,$c,Tc)}if(sd){Xc=0;for(yd=sd.length;Xc<yd;Xc++)if(Fa=sd[Xc],Fa.needsUpdate&&(void 0===Fa.boundTo||"vertices"===Fa.boundTo)){Aa=0;Bc=Fa.value.length;if(1===Fa.size)for(hb=0;hb<Bc;hb++)Fa.array[hb]=Fa.value[hb];else if(2===Fa.size)for(hb=0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.x,Fa.array[Aa+1]=sb.y,Aa+=2;else if(3===Fa.size)if("c"===Fa.type)for(hb=0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.r,Fa.array[Aa+1]=sb.g,Fa.array[Aa+2]=sb.b,Aa+=3;else for(hb=
|
|
|
-0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.x,Fa.array[Aa+1]=sb.y,Fa.array[Aa+2]=sb.z,Aa+=3;else if(4===Fa.size)for(hb=0;hb<Bc;hb++)sb=Fa.value[hb],Fa.array[Aa]=sb.x,Fa.array[Aa+1]=sb.y,Fa.array[Aa+2]=sb.z,Fa.array[Aa+3]=sb.w,Aa+=4;j.bindBuffer(j.ARRAY_BUFFER,Fa.buffer);j.bufferData(j.ARRAY_BUFFER,Fa.array,Tc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.normalsNeedUpdate=!1;ta.attributes&&t(ta)}else if(ia instanceof THREE.Line)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
|
|
|
-i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ta=e(ia,N);oa=ta.attributes&&x(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.lineDistancesNeedUpdate||oa){var Gb=N,ad=j.DYNAMIC_DRAW,Kc=void 0,Lc=void 0,Mc=void 0,bd=void 0,La=void 0,cd=void 0,Cd=Gb.vertices,Dd=Gb.colors,Ed=Gb.lineDistances,nd=Cd.length,Kd=Dd.length,Ld=Ed.length,dd=Gb.__vertexArray,ed=Gb.__colorArray,Fd=Gb.__lineDistanceArray,Md=Gb.colorsNeedUpdate,Nd=Gb.lineDistancesNeedUpdate,td=Gb.__webglCustomAttributesList,
|
|
|
-fd=void 0,Gd=void 0,ib=void 0,Cc=void 0,tb=void 0,Ga=void 0;if(Gb.verticesNeedUpdate){for(Kc=0;Kc<nd;Kc++)bd=Cd[Kc],La=3*Kc,dd[La]=bd.x,dd[La+1]=bd.y,dd[La+2]=bd.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,dd,ad)}if(Md){for(Lc=0;Lc<Kd;Lc++)cd=Dd[Lc],La=3*Lc,ed[La]=cd.r,ed[La+1]=cd.g,ed[La+2]=cd.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,ed,ad)}if(Nd){for(Mc=0;Mc<Ld;Mc++)Fd[Mc]=Ed[Mc];j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglLineDistanceBuffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,Fd,ad)}if(td){fd=0;for(Gd=td.length;fd<Gd;fd++)if(Ga=td[fd],Ga.needsUpdate&&(void 0===Ga.boundTo||"vertices"===Ga.boundTo)){La=0;Cc=Ga.value.length;if(1===Ga.size)for(ib=0;ib<Cc;ib++)Ga.array[ib]=Ga.value[ib];else if(2===Ga.size)for(ib=0;ib<Cc;ib++)tb=Ga.value[ib],Ga.array[La]=tb.x,Ga.array[La+1]=tb.y,La+=2;else if(3===Ga.size)if("c"===Ga.type)for(ib=0;ib<Cc;ib++)tb=Ga.value[ib],Ga.array[La]=tb.r,Ga.array[La+1]=tb.g,Ga.array[La+2]=tb.b,La+=3;else for(ib=0;ib<Cc;ib++)tb=
|
|
|
-Ga.value[ib],Ga.array[La]=tb.x,Ga.array[La+1]=tb.y,Ga.array[La+2]=tb.z,La+=3;else if(4===Ga.size)for(ib=0;ib<Cc;ib++)tb=Ga.value[ib],Ga.array[La]=tb.x,Ga.array[La+1]=tb.y,Ga.array[La+2]=tb.z,Ga.array[La+3]=tb.w,La+=4;j.bindBuffer(j.ARRAY_BUFFER,Ga.buffer);j.bufferData(j.ARRAY_BUFFER,Ga.array,ad)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.lineDistancesNeedUpdate=!1;ta.attributes&&t(ta)}else if(ia instanceof THREE.ParticleSystem)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
|
|
|
-i(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ta=e(ia,N);oa=ta.attributes&&x(ta);if(N.verticesNeedUpdate||N.colorsNeedUpdate||ia.sortParticles||oa){var bc=N,ud=j.DYNAMIC_DRAW,Nc=ia,ub=void 0,cc=void 0,dc=void 0,ca=void 0,ec=void 0,rc=void 0,gd=bc.vertices,vd=gd.length,wd=bc.colors,Hd=wd.length,wc=bc.__vertexArray,xc=bc.__colorArray,kc=bc.__sortArray,Id=bc.verticesNeedUpdate,Jd=bc.colorsNeedUpdate,lc=bc.__webglCustomAttributesList,Kb=void 0,Dc=void 0,na=void 0,Lb=
|
|
|
-void 0,Ca=void 0,ba=void 0;if(Nc.sortParticles){vb.copy(gc);vb.multiply(Nc.matrixWorld);for(ub=0;ub<vd;ub++)dc=gd[ub],Pa.copy(dc),Pa.applyProjection(vb),kc[ub]=[Pa.z,ub];kc.sort(m);for(ub=0;ub<vd;ub++)dc=gd[kc[ub][1]],ca=3*ub,wc[ca]=dc.x,wc[ca+1]=dc.y,wc[ca+2]=dc.z;for(cc=0;cc<Hd;cc++)ca=3*cc,rc=wd[kc[cc][1]],xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],void 0===ba.boundTo||"vertices"===ba.boundTo)if(ca=0,Lb=ba.value.length,1===ba.size)for(na=0;na<Lb;na++)ec=
|
|
|
-kc[na][1],ba.array[na]=ba.value[ec];else if(2===ba.size)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,
|
|
|
-ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}else{if(Id)for(ub=0;ub<vd;ub++)dc=gd[ub],ca=3*ub,wc[ca]=dc.x,wc[ca+1]=dc.y,wc[ca+2]=dc.z;if(Jd)for(cc=0;cc<Hd;cc++)rc=wd[cc],ca=3*cc,xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Lb=ba.value.length,ca=0,1===ba.size)for(na=0;na<Lb;na++)ba.array[na]=ba.value[na];else if(2===ba.size)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=
|
|
|
-Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}if(Id||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-wc,ud);if(Jd||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xc,ud);if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,ud)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ta.attributes&&t(ta)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",O);var i,k,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof
|
|
|
-THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,r,s;e=g=r=s=
|
|
|
-p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&p++);e=g;f=r;g=s;h=p;p=q=0;for(s=b.length;p<s;p++)r=b[p],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);l=q;tc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
|
|
|
-(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),m=b);a:{r=a.fragmentShader;s=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
|
|
|
-skinning:a.skinning,maxBones:m,useVertexTexture:tc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
|
|
|
-alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,x,d=[];n?d.push(n):(d.push(r),d.push(s));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=va.length;t<v;t++)if(d=va[t],d.code===n){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");
|
|
|
-v=[];for(x in q)d=q[x],!1!==d&&(d="#define "+x+" "+d,v.push(d));d=v.join("\n");x=j.createProgram();v=["precision "+W+" float;",d,sc?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#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.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):
|
|
|
-"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\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 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-t=["precision "+W+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
+k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var da=a.__objectsRemoved[0],oa=a;da instanceof THREE.Mesh||da instanceof THREE.ParticleSystem||da instanceof THREE.Ribbon||da instanceof THREE.Line?v(oa.__webglObjects,da):da instanceof THREE.Sprite?w(oa.__webglSprites,da):da instanceof THREE.LensFlare?w(oa.__webglFlares,da):(da instanceof THREE.ImmediateRenderObject||da.immediateRenderCallback)&&v(oa.__webglObjectsImmediate,da);da.__webglActive=
|
|
|
+!1;a.__objectsRemoved.splice(0,1)}for(var sa=0,ua=a.__webglObjects.length;sa<ua;sa++){var ia=a.__webglObjects[sa].object,O=ia.geometry,wb=void 0,za=void 0,ga=void 0;if(ia instanceof THREE.Mesh)if(O instanceof THREE.BufferGeometry)(O.verticesNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.elementsNeedUpdate=!1,O.uvsNeedUpdate=!1,O.normalsNeedUpdate=!1,O.colorsNeedUpdate=!1,O.tangentsNeedUpdate=
|
|
|
+!1;else{for(var lb=0,Ca=O.geometryGroupsList.length;lb<Ca;lb++)if(wb=O.geometryGroupsList[lb],ga=e(ia,wb),O.buffersNeedUpdate&&d(wb,ia),za=ga.attributes&&x(ga),O.verticesNeedUpdate||O.morphTargetsNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate||za){var ta=wb,Ia=ia,qa=j.DYNAMIC_DRAW,xb=!O.dynamic,Da=ga;if(ta.__inittedArrays){var Qa=f(Da),Ta=Da.vertexColors?Da.vertexColors:!1,db=g(Da),Wa=Qa===THREE.SmoothShading,D=void 0,U=void 0,Oa=void 0,
|
|
|
+P=void 0,Xa=void 0,$a=void 0,Ua=void 0,mb=void 0,eb=void 0,nb=void 0,ob=void 0,Q=void 0,R=void 0,S=void 0,ra=void 0,Nb=void 0,Ob=void 0,Pb=void 0,ub=void 0,Qb=void 0,Rb=void 0,Sb=void 0,yb=void 0,Tb=void 0,Ub=void 0,Vb=void 0,zb=void 0,Wb=void 0,Xb=void 0,Yb=void 0,Ab=void 0,Zb=void 0,$b=void 0,ac=void 0,Kb=void 0,ya=void 0,gc=void 0,mc=void 0,Bb=void 0,Cb=void 0,ab=void 0,xc=void 0,Ya=void 0,Za=void 0,nc=void 0,hc=void 0,Pa=0,Va=0,ic=0,jc=0,Gb=0,ib=0,Ea=0,kb=0,Sa=0,aa=0,la=0,y=0,Aa=void 0,bb=ta.__vertexArray,
|
|
|
+Dc=ta.__uvArray,Ec=ta.__uv2Array,Hb=ta.__normalArray,Ja=ta.__tangentArray,cb=ta.__colorArray,Ka=ta.__skinIndexArray,La=ta.__skinWeightArray,rc=ta.__morphTargetsArrays,nd=ta.__morphNormalsArrays,od=ta.__webglCustomAttributesList,u=void 0,bc=ta.__faceArray,vb=ta.__lineArray,qb=Ia.geometry,Mc=qb.elementsNeedUpdate,Cc=qb.uvsNeedUpdate,Nc=qb.normalsNeedUpdate,Oc=qb.tangentsNeedUpdate,ed=qb.colorsNeedUpdate,fd=qb.morphTargetsNeedUpdate,sc=qb.vertices,va=ta.faces3,wa=ta.faces4,jb=qb.faces,pd=qb.faceVertexUvs[0],
|
|
|
+qd=qb.faceVertexUvs[1],tc=qb.skinIndices,oc=qb.skinWeights,pc=qb.morphTargets,Pc=qb.morphNormals;if(qb.verticesNeedUpdate){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=sc[P.a],R=sc[P.b],S=sc[P.c],bb[Va]=Q.x,bb[Va+1]=Q.y,bb[Va+2]=Q.z,bb[Va+3]=R.x,bb[Va+4]=R.y,bb[Va+5]=R.z,bb[Va+6]=S.x,bb[Va+7]=S.y,bb[Va+8]=S.z,Va+=9;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=sc[P.a],R=sc[P.b],S=sc[P.c],ra=sc[P.d],bb[Va]=Q.x,bb[Va+1]=Q.y,bb[Va+2]=Q.z,bb[Va+3]=R.x,bb[Va+4]=R.y,bb[Va+5]=R.z,bb[Va+6]=S.x,bb[Va+7]=S.y,bb[Va+
|
|
|
+8]=S.z,bb[Va+9]=ra.x,bb[Va+10]=ra.y,bb[Va+11]=ra.z,Va+=12;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,bb,qa)}if(fd){ab=0;for(xc=pc.length;ab<xc;ab++){D=la=0;for(U=va.length;D<U;D++)nc=va[D],P=jb[nc],Q=pc[ab].vertices[P.a],R=pc[ab].vertices[P.b],S=pc[ab].vertices[P.c],Ya=rc[ab],Ya[la]=Q.x,Ya[la+1]=Q.y,Ya[la+2]=Q.z,Ya[la+3]=R.x,Ya[la+4]=R.y,Ya[la+5]=R.z,Ya[la+6]=S.x,Ya[la+7]=S.y,Ya[la+8]=S.z,Da.morphNormals&&(Wa?(hc=Pc[ab].vertexNormals[nc],Qb=hc.a,Rb=hc.b,Sb=hc.c):
|
|
|
+Sb=Rb=Qb=Pc[ab].faceNormals[nc],Za=nd[ab],Za[la]=Qb.x,Za[la+1]=Qb.y,Za[la+2]=Qb.z,Za[la+3]=Rb.x,Za[la+4]=Rb.y,Za[la+5]=Rb.z,Za[la+6]=Sb.x,Za[la+7]=Sb.y,Za[la+8]=Sb.z),la+=9;D=0;for(U=wa.length;D<U;D++)nc=wa[D],P=jb[nc],Q=pc[ab].vertices[P.a],R=pc[ab].vertices[P.b],S=pc[ab].vertices[P.c],ra=pc[ab].vertices[P.d],Ya=rc[ab],Ya[la]=Q.x,Ya[la+1]=Q.y,Ya[la+2]=Q.z,Ya[la+3]=R.x,Ya[la+4]=R.y,Ya[la+5]=R.z,Ya[la+6]=S.x,Ya[la+7]=S.y,Ya[la+8]=S.z,Ya[la+9]=ra.x,Ya[la+10]=ra.y,Ya[la+11]=ra.z,Da.morphNormals&&(Wa?
|
|
|
+(hc=Pc[ab].vertexNormals[nc],Qb=hc.a,Rb=hc.b,Sb=hc.c,yb=hc.d):yb=Sb=Rb=Qb=Pc[ab].faceNormals[nc],Za=nd[ab],Za[la]=Qb.x,Za[la+1]=Qb.y,Za[la+2]=Qb.z,Za[la+3]=Rb.x,Za[la+4]=Rb.y,Za[la+5]=Rb.z,Za[la+6]=Sb.x,Za[la+7]=Sb.y,Za[la+8]=Sb.z,Za[la+9]=yb.x,Za[la+10]=yb.y,Za[la+11]=yb.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglMorphTargetsBuffers[ab]);j.bufferData(j.ARRAY_BUFFER,rc[ab],qa);Da.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglMorphNormalsBuffers[ab]),j.bufferData(j.ARRAY_BUFFER,nd[ab],
|
|
|
+qa))}}if(oc.length){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Wb=oc[P.a],Xb=oc[P.b],Yb=oc[P.c],La[aa]=Wb.x,La[aa+1]=Wb.y,La[aa+2]=Wb.z,La[aa+3]=Wb.w,La[aa+4]=Xb.x,La[aa+5]=Xb.y,La[aa+6]=Xb.z,La[aa+7]=Xb.w,La[aa+8]=Yb.x,La[aa+9]=Yb.y,La[aa+10]=Yb.z,La[aa+11]=Yb.w,Zb=tc[P.a],$b=tc[P.b],ac=tc[P.c],Ka[aa]=Zb.x,Ka[aa+1]=Zb.y,Ka[aa+2]=Zb.z,Ka[aa+3]=Zb.w,Ka[aa+4]=$b.x,Ka[aa+5]=$b.y,Ka[aa+6]=$b.z,Ka[aa+7]=$b.w,Ka[aa+8]=ac.x,Ka[aa+9]=ac.y,Ka[aa+10]=ac.z,Ka[aa+11]=ac.w,aa+=12;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],
|
|
|
+Wb=oc[P.a],Xb=oc[P.b],Yb=oc[P.c],Ab=oc[P.d],La[aa]=Wb.x,La[aa+1]=Wb.y,La[aa+2]=Wb.z,La[aa+3]=Wb.w,La[aa+4]=Xb.x,La[aa+5]=Xb.y,La[aa+6]=Xb.z,La[aa+7]=Xb.w,La[aa+8]=Yb.x,La[aa+9]=Yb.y,La[aa+10]=Yb.z,La[aa+11]=Yb.w,La[aa+12]=Ab.x,La[aa+13]=Ab.y,La[aa+14]=Ab.z,La[aa+15]=Ab.w,Zb=tc[P.a],$b=tc[P.b],ac=tc[P.c],Kb=tc[P.d],Ka[aa]=Zb.x,Ka[aa+1]=Zb.y,Ka[aa+2]=Zb.z,Ka[aa+3]=Zb.w,Ka[aa+4]=$b.x,Ka[aa+5]=$b.y,Ka[aa+6]=$b.z,Ka[aa+7]=$b.w,Ka[aa+8]=ac.x,Ka[aa+9]=ac.y,Ka[aa+10]=ac.z,Ka[aa+11]=ac.w,Ka[aa+12]=Kb.x,Ka[aa+
|
|
|
+13]=Kb.y,Ka[aa+14]=Kb.z,Ka[aa+15]=Kb.w,aa+=16;0<aa&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ka,qa),j.bindBuffer(j.ARRAY_BUFFER,ta.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,La,qa))}if(ed&&Ta){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Ua=P.vertexColors,mb=P.color,3===Ua.length&&Ta===THREE.VertexColors?(Tb=Ua[0],Ub=Ua[1],Vb=Ua[2]):Vb=Ub=Tb=mb,cb[Sa]=Tb.r,cb[Sa+1]=Tb.g,cb[Sa+2]=Tb.b,cb[Sa+3]=Ub.r,cb[Sa+4]=Ub.g,cb[Sa+5]=Ub.b,cb[Sa+6]=Vb.r,cb[Sa+7]=
|
|
|
+Vb.g,cb[Sa+8]=Vb.b,Sa+=9;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Ua=P.vertexColors,mb=P.color,4===Ua.length&&Ta===THREE.VertexColors?(Tb=Ua[0],Ub=Ua[1],Vb=Ua[2],zb=Ua[3]):zb=Vb=Ub=Tb=mb,cb[Sa]=Tb.r,cb[Sa+1]=Tb.g,cb[Sa+2]=Tb.b,cb[Sa+3]=Ub.r,cb[Sa+4]=Ub.g,cb[Sa+5]=Ub.b,cb[Sa+6]=Vb.r,cb[Sa+7]=Vb.g,cb[Sa+8]=Vb.b,cb[Sa+9]=zb.r,cb[Sa+10]=zb.g,cb[Sa+11]=zb.b,Sa+=12;0<Sa&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,cb,qa))}if(Oc&&qb.hasTangents){D=0;for(U=va.length;D<U;D++)P=
|
|
|
+jb[va[D]],eb=P.vertexTangents,Nb=eb[0],Ob=eb[1],Pb=eb[2],Ja[Ea]=Nb.x,Ja[Ea+1]=Nb.y,Ja[Ea+2]=Nb.z,Ja[Ea+3]=Nb.w,Ja[Ea+4]=Ob.x,Ja[Ea+5]=Ob.y,Ja[Ea+6]=Ob.z,Ja[Ea+7]=Ob.w,Ja[Ea+8]=Pb.x,Ja[Ea+9]=Pb.y,Ja[Ea+10]=Pb.z,Ja[Ea+11]=Pb.w,Ea+=12;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],eb=P.vertexTangents,Nb=eb[0],Ob=eb[1],Pb=eb[2],ub=eb[3],Ja[Ea]=Nb.x,Ja[Ea+1]=Nb.y,Ja[Ea+2]=Nb.z,Ja[Ea+3]=Nb.w,Ja[Ea+4]=Ob.x,Ja[Ea+5]=Ob.y,Ja[Ea+6]=Ob.z,Ja[Ea+7]=Ob.w,Ja[Ea+8]=Pb.x,Ja[Ea+9]=Pb.y,Ja[Ea+10]=Pb.z,Ja[Ea+11]=Pb.w,Ja[Ea+
|
|
|
+12]=ub.x,Ja[Ea+13]=ub.y,Ja[Ea+14]=ub.z,Ja[Ea+15]=ub.w,Ea+=16;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ja,qa)}if(Nc&&Qa){D=0;for(U=va.length;D<U;D++)if(P=jb[va[D]],Xa=P.vertexNormals,$a=P.normal,3===Xa.length&&Wa)for(ya=0;3>ya;ya++)mc=Xa[ya],Hb[ib]=mc.x,Hb[ib+1]=mc.y,Hb[ib+2]=mc.z,ib+=3;else for(ya=0;3>ya;ya++)Hb[ib]=$a.x,Hb[ib+1]=$a.y,Hb[ib+2]=$a.z,ib+=3;D=0;for(U=wa.length;D<U;D++)if(P=jb[wa[D]],Xa=P.vertexNormals,$a=P.normal,4===Xa.length&&Wa)for(ya=0;4>ya;ya++)mc=
|
|
|
+Xa[ya],Hb[ib]=mc.x,Hb[ib+1]=mc.y,Hb[ib+2]=mc.z,ib+=3;else for(ya=0;4>ya;ya++)Hb[ib]=$a.x,Hb[ib+1]=$a.y,Hb[ib+2]=$a.z,ib+=3;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Hb,qa)}if(Cc&&pd&&db){D=0;for(U=va.length;D<U;D++)if(Oa=va[D],nb=pd[Oa],void 0!==nb)for(ya=0;3>ya;ya++)Bb=nb[ya],Dc[ic]=Bb.x,Dc[ic+1]=Bb.y,ic+=2;D=0;for(U=wa.length;D<U;D++)if(Oa=wa[D],nb=pd[Oa],void 0!==nb)for(ya=0;4>ya;ya++)Bb=nb[ya],Dc[ic]=Bb.x,Dc[ic+1]=Bb.y,ic+=2;0<ic&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+ta.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Dc,qa))}if(Cc&&qd&&db){D=0;for(U=va.length;D<U;D++)if(Oa=va[D],ob=qd[Oa],void 0!==ob)for(ya=0;3>ya;ya++)Cb=ob[ya],Ec[jc]=Cb.x,Ec[jc+1]=Cb.y,jc+=2;D=0;for(U=wa.length;D<U;D++)if(Oa=wa[D],ob=qd[Oa],void 0!==ob)for(ya=0;4>ya;ya++)Cb=ob[ya],Ec[jc]=Cb.x,Ec[jc+1]=Cb.y,jc+=2;0<jc&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Ec,qa))}if(Mc){D=0;for(U=va.length;D<U;D++)bc[Gb]=Pa,bc[Gb+1]=Pa+1,bc[Gb+2]=Pa+2,Gb+=3,vb[kb]=Pa,vb[kb+
|
|
|
+1]=Pa+1,vb[kb+2]=Pa,vb[kb+3]=Pa+2,vb[kb+4]=Pa+1,vb[kb+5]=Pa+2,kb+=6,Pa+=3;D=0;for(U=wa.length;D<U;D++)bc[Gb]=Pa,bc[Gb+1]=Pa+1,bc[Gb+2]=Pa+3,bc[Gb+3]=Pa+1,bc[Gb+4]=Pa+2,bc[Gb+5]=Pa+3,Gb+=6,vb[kb]=Pa,vb[kb+1]=Pa+1,vb[kb+2]=Pa,vb[kb+3]=Pa+3,vb[kb+4]=Pa+1,vb[kb+5]=Pa+2,vb[kb+6]=Pa+2,vb[kb+7]=Pa+3,kb+=8,Pa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ta.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,bc,qa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ta.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+vb,qa)}if(od){ya=0;for(gc=od.length;ya<gc;ya++)if(u=od[ya],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],y+=3;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],u.array[y+3]=u.value[P.d],y+=4}else{if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)Aa=u.value[va[D]],u.array[y]=
|
|
|
+Aa,u.array[y+1]=Aa,u.array[y+2]=Aa,y+=3;D=0;for(U=wa.length;D<U;D++)Aa=u.value[wa[D]],u.array[y]=Aa,u.array[y+1]=Aa,u.array[y+2]=Aa,u.array[y+3]=Aa,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],ra=u.value[P.d],
|
|
|
+u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=ra.x,u.array[y+7]=ra.y,y+=8}else{if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)S=R=Q=Aa=u.value[va[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(U=wa.length;D<U;D++)ra=S=R=Q=Aa=u.value[wa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=ra.x,u.array[y+
|
|
|
+7]=ra.y,y+=8}}else if(3===u.size){var $;$="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],ra=u.value[P.d],
|
|
|
+u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=ra[$[0]],u.array[y+10]=ra[$[1]],u.array[y+11]=ra[$[2]],y+=12}else if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)S=R=Q=Aa=u.value[va[D]],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],
|
|
|
+u.array[y+8]=S[$[2]],y+=9;D=0;for(U=wa.length;D<U;D++)ra=S=R=Q=Aa=u.value[wa[D]],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=ra[$[0]],u.array[y+10]=ra[$[1]],u.array[y+11]=ra[$[2]],y+=12}else if("faceVertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)Aa=u.value[va[D]],Q=Aa[0],R=Aa[1],S=Aa[2],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=
|
|
|
+Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(U=wa.length;D<U;D++)Aa=u.value[wa[D]],Q=Aa[0],R=Aa[1],S=Aa[2],ra=Aa[3],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=ra[$[0]],u.array[y+10]=ra[$[1]],u.array[y+11]=ra[$[2]],y+=12}}else if(4===u.size)if(void 0===
|
|
|
+u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],ra=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+
|
|
|
+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=ra.x,u.array[y+13]=ra.y,u.array[y+14]=ra.z,u.array[y+15]=ra.w,y+=16}else if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)S=R=Q=Aa=u.value[va[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;
|
|
|
+D=0;for(U=wa.length;D<U;D++)ra=S=R=Q=Aa=u.value[wa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=ra.x,u.array[y+13]=ra.y,u.array[y+14]=ra.z,u.array[y+15]=ra.w,y+=16}else if("faceVertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)Aa=u.value[va[D]],Q=Aa[0],R=Aa[1],S=Aa[2],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+
|
|
|
+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=wa.length;D<U;D++)Aa=u.value[wa[D]],Q=Aa[0],R=Aa[1],S=Aa[2],ra=Aa[3],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=ra.x,u.array[y+13]=ra.y,u.array[y+14]=ra.z,u.array[y+
|
|
|
+15]=ra.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,qa)}}xb&&(delete ta.__inittedArrays,delete ta.__colorArray,delete ta.__normalArray,delete ta.__tangentArray,delete ta.__uvArray,delete ta.__uv2Array,delete ta.__faceArray,delete ta.__vertexArray,delete ta.__lineArray,delete ta.__skinIndexArray,delete ta.__skinWeightArray)}}O.verticesNeedUpdate=!1;O.morphTargetsNeedUpdate=!1;O.elementsNeedUpdate=!1;O.uvsNeedUpdate=!1;O.normalsNeedUpdate=!1;O.colorsNeedUpdate=!1;
|
|
|
+O.tangentsNeedUpdate=!1;O.buffersNeedUpdate=!1;ga.attributes&&t(ga)}else if(ia instanceof THREE.Ribbon){ga=e(ia,O);za=ga.attributes&&x(ga);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.normalsNeedUpdate||za){var Ib=O,Qc=j.DYNAMIC_DRAW,Fc=void 0,Gc=void 0,Hc=void 0,Rc=void 0,Ba=void 0,Sc=void 0,Tc=void 0,Uc=void 0,xd=void 0,gb=void 0,zc=void 0,Ga=void 0,rb=void 0,yd=Ib.vertices,zd=Ib.colors,Ad=Ib.normals,gd=yd.length,hd=zd.length,id=Ad.length,Vc=Ib.__vertexArray,Wc=Ib.__colorArray,Xc=Ib.__normalArray,
|
|
|
+jd=Ib.colorsNeedUpdate,kd=Ib.normalsNeedUpdate,rd=Ib.__webglCustomAttributesList;if(Ib.verticesNeedUpdate){for(Fc=0;Fc<gd;Fc++)Rc=yd[Fc],Ba=3*Fc,Vc[Ba]=Rc.x,Vc[Ba+1]=Rc.y,Vc[Ba+2]=Rc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Vc,Qc)}if(jd){for(Gc=0;Gc<hd;Gc++)Sc=zd[Gc],Ba=3*Gc,Wc[Ba]=Sc.r,Wc[Ba+1]=Sc.g,Wc[Ba+2]=Sc.b;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Wc,Qc)}if(kd){for(Hc=0;Hc<id;Hc++)Tc=Ad[Hc],Ba=3*Hc,Xc[Ba]=Tc.x,Xc[Ba+
|
|
|
+1]=Tc.y,Xc[Ba+2]=Tc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,Qc)}if(rd){Uc=0;for(xd=rd.length;Uc<xd;Uc++)if(Ga=rd[Uc],Ga.needsUpdate&&(void 0===Ga.boundTo||"vertices"===Ga.boundTo)){Ba=0;zc=Ga.value.length;if(1===Ga.size)for(gb=0;gb<zc;gb++)Ga.array[gb]=Ga.value[gb];else if(2===Ga.size)for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.x,Ga.array[Ba+1]=rb.y,Ba+=2;else if(3===Ga.size)if("c"===Ga.type)for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.r,
|
|
|
+Ga.array[Ba+1]=rb.g,Ga.array[Ba+2]=rb.b,Ba+=3;else for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.x,Ga.array[Ba+1]=rb.y,Ga.array[Ba+2]=rb.z,Ba+=3;else if(4===Ga.size)for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.x,Ga.array[Ba+1]=rb.y,Ga.array[Ba+2]=rb.z,Ga.array[Ba+3]=rb.w,Ba+=4;j.bindBuffer(j.ARRAY_BUFFER,Ga.buffer);j.bufferData(j.ARRAY_BUFFER,Ga.array,Qc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.normalsNeedUpdate=!1;ga.attributes&&t(ga)}else if(ia instanceof THREE.Line)if(O instanceof
|
|
|
+THREE.BufferGeometry)(O.verticesNeedUpdate||O.colorsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.colorsNeedUpdate=!1;else{ga=e(ia,O);za=ga.attributes&&x(ga);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.lineDistancesNeedUpdate||za){var Jb=O,Yc=j.DYNAMIC_DRAW,Ic=void 0,Jc=void 0,Kc=void 0,Zc=void 0,Ma=void 0,$c=void 0,Bd=Jb.vertices,Cd=Jb.colors,Dd=Jb.lineDistances,ld=Bd.length,Jd=Cd.length,Kd=Dd.length,ad=Jb.__vertexArray,bd=Jb.__colorArray,Ed=Jb.__lineDistanceArray,Ld=Jb.colorsNeedUpdate,
|
|
|
+Md=Jb.lineDistancesNeedUpdate,sd=Jb.__webglCustomAttributesList,cd=void 0,Fd=void 0,hb=void 0,Ac=void 0,sb=void 0,Ha=void 0;if(Jb.verticesNeedUpdate){for(Ic=0;Ic<ld;Ic++)Zc=Bd[Ic],Ma=3*Ic,ad[Ma]=Zc.x,ad[Ma+1]=Zc.y,ad[Ma+2]=Zc.z;j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ad,Yc)}if(Ld){for(Jc=0;Jc<Jd;Jc++)$c=Cd[Jc],Ma=3*Jc,bd[Ma]=$c.r,bd[Ma+1]=$c.g,bd[Ma+2]=$c.b;j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,bd,Yc)}if(Md){for(Kc=0;Kc<
|
|
|
+Kd;Kc++)Ed[Kc]=Dd[Kc];j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Ed,Yc)}if(sd){cd=0;for(Fd=sd.length;cd<Fd;cd++)if(Ha=sd[cd],Ha.needsUpdate&&(void 0===Ha.boundTo||"vertices"===Ha.boundTo)){Ma=0;Ac=Ha.value.length;if(1===Ha.size)for(hb=0;hb<Ac;hb++)Ha.array[hb]=Ha.value[hb];else if(2===Ha.size)for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=sb.x,Ha.array[Ma+1]=sb.y,Ma+=2;else if(3===Ha.size)if("c"===Ha.type)for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=
|
|
|
+sb.r,Ha.array[Ma+1]=sb.g,Ha.array[Ma+2]=sb.b,Ma+=3;else for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=sb.x,Ha.array[Ma+1]=sb.y,Ha.array[Ma+2]=sb.z,Ma+=3;else if(4===Ha.size)for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=sb.x,Ha.array[Ma+1]=sb.y,Ha.array[Ma+2]=sb.z,Ha.array[Ma+3]=sb.w,Ma+=4;j.bindBuffer(j.ARRAY_BUFFER,Ha.buffer);j.bufferData(j.ARRAY_BUFFER,Ha.array,Yc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.lineDistancesNeedUpdate=!1;ga.attributes&&t(ga)}else if(ia instanceof THREE.ParticleSystem)if(O instanceof
|
|
|
+THREE.BufferGeometry)(O.verticesNeedUpdate||O.colorsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.colorsNeedUpdate=!1;else{ga=e(ia,O);za=ga.attributes&&x(ga);if(O.verticesNeedUpdate||O.colorsNeedUpdate||ia.sortParticles||za){var cc=O,td=j.DYNAMIC_DRAW,Lc=ia,tb=void 0,dc=void 0,ec=void 0,fa=void 0,fc=void 0,qc=void 0,dd=cc.vertices,ud=dd.length,vd=cc.colors,Gd=vd.length,uc=cc.__vertexArray,vc=cc.__colorArray,kc=cc.__sortArray,Hd=cc.verticesNeedUpdate,Id=cc.colorsNeedUpdate,
|
|
|
+lc=cc.__webglCustomAttributesList,Lb=void 0,Bc=void 0,pa=void 0,Mb=void 0,Fa=void 0,ea=void 0;if(Lc.sortParticles){wc.copy(pb);wc.multiply(Lc.matrixWorld);for(tb=0;tb<ud;tb++)ec=dd[tb],Ra.copy(ec),Ra.applyProjection(wc),kc[tb]=[Ra.z,tb];kc.sort(m);for(tb=0;tb<ud;tb++)ec=dd[kc[tb][1]],fa=3*tb,uc[fa]=ec.x,uc[fa+1]=ec.y,uc[fa+2]=ec.z;for(dc=0;dc<Gd;dc++)fa=3*dc,qc=vd[kc[dc][1]],vc[fa]=qc.r,vc[fa+1]=qc.g,vc[fa+2]=qc.b;if(lc){Lb=0;for(Bc=lc.length;Lb<Bc;Lb++)if(ea=lc[Lb],void 0===ea.boundTo||"vertices"===
|
|
|
+ea.boundTo)if(fa=0,Mb=ea.value.length,1===ea.size)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],ea.array[pa]=ea.value[fc];else if(2===ea.size)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,fa+=2;else if(3===ea.size)if("c"===ea.type)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.r,ea.array[fa+1]=Fa.g,ea.array[fa+2]=Fa.b,fa+=3;else for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,fa+=3;else if(4===
|
|
|
+ea.size)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,ea.array[fa+3]=Fa.w,fa+=4}}else{if(Hd)for(tb=0;tb<ud;tb++)ec=dd[tb],fa=3*tb,uc[fa]=ec.x,uc[fa+1]=ec.y,uc[fa+2]=ec.z;if(Id)for(dc=0;dc<Gd;dc++)qc=vd[dc],fa=3*dc,vc[fa]=qc.r,vc[fa+1]=qc.g,vc[fa+2]=qc.b;if(lc){Lb=0;for(Bc=lc.length;Lb<Bc;Lb++)if(ea=lc[Lb],ea.needsUpdate&&(void 0===ea.boundTo||"vertices"===ea.boundTo))if(Mb=ea.value.length,fa=0,1===ea.size)for(pa=0;pa<Mb;pa++)ea.array[pa]=
|
|
|
+ea.value[pa];else if(2===ea.size)for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,fa+=2;else if(3===ea.size)if("c"===ea.type)for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.r,ea.array[fa+1]=Fa.g,ea.array[fa+2]=Fa.b,fa+=3;else for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,fa+=3;else if(4===ea.size)for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,ea.array[fa+3]=Fa.w,fa+=4}}if(Hd||
|
|
|
+Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,cc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,uc,td);if(Id||Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,cc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,vc,td);if(lc){Lb=0;for(Bc=lc.length;Lb<Bc;Lb++)if(ea=lc[Lb],ea.needsUpdate||Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ea.buffer),j.bufferData(j.ARRAY_BUFFER,ea.array,td)}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;ga.attributes&&t(ga)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",
|
|
|
+Y);var i,k,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=
|
|
|
+p.vertexShader;a.fragmentShader=p.fragmentShader}var q,r,s;e=g=r=s=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&p++);e=g;f=r;g=s;h=p;p=q=0;for(s=b.length;p<s;p++)r=b[p],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);l=q;xc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),
|
|
|
+b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),m=b);a:{r=a.fragmentShader;s=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
+fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:m,useVertexTexture:xc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
+shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,x,d=[];n?d.push(n):(d.push(r),d.push(s));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=Na.length;t<v;t++)if(d=Na[t],d.code===n){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":
|
|
|
+c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");v=[];for(x in q)d=q[x],!1!==d&&(d="#define "+x+" "+d,v.push(d));d=v.join("\n");x=j.createProgram();v=["precision "+X+" float;",d,rc?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,
|
|
|
+"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#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.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):
|
|
|
+"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":
|
|
|
+"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\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 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+t=["precision "+X+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=V("fragment",t+r);v=V("vertex",v+s);j.attachShader(x,v);j.attachShader(x,t);j.linkProgram(x);j.getProgramParameter(x,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(x,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=B("fragment",t+r);v=B("vertex",v+s);j.attachShader(x,v);j.attachShader(x,t);j.linkProgram(x);j.getProgramParameter(x,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(x,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
j.getError()+"]");j.deleteShader(t);j.deleteShader(v);x.uniforms={};x.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(v=w.length;t<v;t++)p=w[t],x.uniforms[p]=j.getUniformLocation(x,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+
|
|
|
-w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],x.attributes[t]=j.getAttribLocation(x,t);x.id=Ya++;va.push({program:x,code:n,usedTimes:1});L.info.memory.programs=va.length;k=x}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)x=b+k,0<=w[x]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)x=
|
|
|
-b+k,0<=w[x]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;X!==
|
|
|
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),X=b);ha!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ha=a)};this.setDepthTest=function(a){$a!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),$a=a)};this.setDepthWrite=function(a){ia!==a&&(j.depthMask(a),ia=a)};this.setBlending=function(a,b,c,d){a!==ra&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
|
|
|
-j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),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)),ra=a);if(a===THREE.CustomBlending){if(b!==fa&&(j.blendEquation(I(b)),fa=b),c!==Da||d!==Za)j.blendFunc(I(c),I(d)),Da=c,Za=d}else Za=
|
|
|
-Da=fa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Qc),a.__webglTexture=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=I(a.format),
|
|
|
-f=I(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
|
|
|
-h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}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){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Rc);a.__webglTexture=
|
|
|
-j.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);T(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(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),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):T(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);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,c=a.width,a=a.height,e=d=0):(b=null,c=Jb,a=fc,d=pb,e=Ib);b!==Hb&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Hb=b);mc=c;qb=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){THREE.EventDispatcher.call(this);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.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
|
|
|
+w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],x.attributes[t]=j.getAttribLocation(x,t);x.id=wb++;Na.push({program:x,code:n,usedTimes:1});M.info.memory.programs=Na.length;k=x}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)x=b+k,0<=w[x]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)x=
|
|
|
+b+k,0<=w[x]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;ha!==
|
|
|
+b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ha=b);sa!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),sa=a)};this.setDepthTest=function(a){ua!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ua=a)};this.setDepthWrite=function(a){Wa!==a&&(j.depthMask(a),Wa=a)};this.setBlending=function(a,b,c,d){a!==ka&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
|
|
|
+j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),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)),ka=a);if(a===THREE.CustomBlending){if(b!==Ia&&(j.blendEquation(L(b)),Ia=b),c!==db||d!==$a)j.blendFunc(L(c),L(d)),db=c,$a=d}else $a=
|
|
|
+db=Ia=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Oc),a.__webglTexture=j.createTexture(),M.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=L(a.format),
|
|
|
+f=L(a.type);T(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
|
|
|
+h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}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){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",N);a.__webglTexture=
|
|
|
+j.createTexture();M.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=L(a.format),e=L(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);T(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);C(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),T(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),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):C(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);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,c=a.width,a=a.height,e=d=0):(b=null,c=Bb,a=Cb,d=Kb,e=gc);b!==xb&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),xb=b);ob=c;Qa=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){THREE.EventDispatcher.call(this);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.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;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;this.shareDepthFrom=null};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
|
|
|
THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
|
|
@@ -521,7 +522,7 @@ c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.Dat
|
|
|
c+d;l=b[a++]*c;s=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(s,r,i,l);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h;THREE.Shape.Utils.b2(t,n,s,i);THREE.Shape.Utils.b2(t,m,r,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,s=b[a++]*c+d,r=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,s,r,p,q),g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++)t=g/h,THREE.Shape.Utils.b3(t,n,s,p,i),THREE.Shape.Utils.b3(t,m,r,q,l)}}}return{offset:x.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{var s=m=void 0,r=void 0,p=void 0,q=void 0,x=void 0,t=void 0,v=void 0,w=
|
|
|
-void 0,s=a[g[i]].x,r=a[g[i]].y,p=a[g[k]].x,q=a[g[k]].y,x=a[g[l]].x,t=a[g[l]].y;if(1E-10>(p-s)*(t-r)-(q-r)*(x-s))m=!1;else{var D=void 0,K=void 0,A=void 0,z=void 0,F=void 0,H=void 0,G=void 0,V=void 0,B=void 0,T=void 0,B=V=G=w=v=void 0,D=x-p,K=t-q,A=s-x,z=r-t,F=p-s,H=q-r;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(v=a[g[m]].x,w=a[g[m]].y,G=v-s,V=w-r,B=v-p,T=w-q,v-=x,w-=t,B=D*T-K*B,G=F*V-H*G,V=A*w-z*v,0<=B&&0<=V&&0<=G){m=!1;break a}m=!0}}if(m){f.push([a[g[i]],a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);
|
|
|
+void 0,s=a[g[i]].x,r=a[g[i]].y,p=a[g[k]].x,q=a[g[k]].y,x=a[g[l]].x,t=a[g[l]].y;if(1E-10>(p-s)*(t-r)-(q-r)*(x-s))m=!1;else{var E=void 0,J=void 0,A=void 0,z=void 0,G=void 0,I=void 0,F=void 0,V=void 0,B=void 0,T=void 0,B=V=F=w=v=void 0,E=x-p,J=t-q,A=s-x,z=r-t,G=p-s,I=q-r;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(v=a[g[m]].x,w=a[g[m]].y,F=v-s,V=w-r,B=v-p,T=w-q,v-=x,w-=t,B=E*T-J*B,F=G*V-I*F,V=A*w-z*v,0<=B&&0<=V&&0<=F){m=!1;break a}m=!0}}if(m){f.push([a[g[i]],a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);
|
|
|
i=k;for(l=k+1;l<e;i++,l++)g[i]=g[l];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -597,20 +598,20 @@ THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*
|
|
|
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.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a,d=0.707*b,c=[[a,0,0],[b,0,0],[-a,0,0],[-b,0,0],[0,a,0],[0,b,0],[0,-a,0],[0,-b,0],[0,0,a],[0,0,b],[0,0,-a],[0,0,-b],[c,c,0],[d,d,0],[-c,-c,0],[-d,-d,0],[c,-c,0],[d,-d,0],[-c,c,0],[-d,d,0],[c,0,c],[d,0,d],[-c,0,-c],[-d,0,-d],[c,0,-c],[d,0,-d],[-c,0,c],[-d,0,d],[0,c,c],[0,d,d],[0,-c,-c],[0,-d,-d],[0,c,-c],[0,d,-d],[0,-c,c],[0,-d,d]],d=0,e=c.length;d<e;d++)this.vertices.push(new THREE.Vector3(c[d][0],c[d][1],c[d][2]))};
|
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),
|
|
|
-this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var q,x=h.widthSegments,t=h.heightSegments,v=e/2,w=f/2,D=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",t=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",x=h.depthSegments;var K=x+1,A=t+1,z=e/x,F=f/t,H=new THREE.Vector3;H[q]=0<g?1:-1;for(e=0;e<A;e++)for(f=0;f<K;f++){var G=new THREE.Vector3;G[a]=(f*z-v)*c;G[b]=(e*F-w)*d;G[q]=g;h.vertices.push(G)}for(e=
|
|
|
-0;e<t;e++)for(f=0;f<x;f++)a=new THREE.Face4(f+K*e+D,f+K*(e+1)+D,f+1+K*(e+1)+D,f+1+K*e+D),a.normal.copy(H),a.vertexNormals.push(H.clone(),H.clone(),H.clone(),H.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/x,1-e/t),new THREE.Vector2(f/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-e/t)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
+this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var q,x=h.widthSegments,t=h.heightSegments,v=e/2,w=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",t=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",x=h.depthSegments;var J=x+1,A=t+1,z=e/x,G=f/t,I=new THREE.Vector3;I[q]=0<g?1:-1;for(e=0;e<A;e++)for(f=0;f<J;f++){var F=new THREE.Vector3;F[a]=(f*z-v)*c;F[b]=(e*G-w)*d;F[q]=g;h.vertices.push(F)}for(e=
|
|
|
+0;e<t;e++)for(f=0;f<x;f++)a=new THREE.Face4(f+J*e+E,f+J*(e+1)+E,f+1+J*(e+1)+E,f+1+J*e+E),a.normal.copy(I),a.vertexNormals.push(I.clone(),I.clone(),I.clone(),I.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/x,1-e/t),new THREE.Vector2(f/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-e/t)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var n=[],m=[],s=i/e,r=s*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,q=new THREE.Vector3;q.x=r*Math.sin(2*p*Math.PI);q.y=-s*c+g;q.z=r*Math.cos(2*p*Math.PI);this.vertices.push(q);n.push(this.vertices.length-1);m.push(new THREE.Vector2(p,1-s))}k.push(n);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[k[0][h]].clone(),
|
|
|
-m=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),m=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],p=k[i+1][h+1],q=k[i][h+1],x=n.clone(),t=n.clone(),v=m.clone(),w=m.clone(),D=l[i][h].clone(),K=l[i+1][h].clone(),A=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[x,t,v,w]));this.faceVertexUvs[0].push([D,K,A,z])}}if(!f&&0<
|
|
|
-a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],p=this.vertices.length-1,x=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),D=l[0][h].clone(),K=l[0][h+1].clone(),A=new THREE.Vector2(K.u,0),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([D,K,A])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],p=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,
|
|
|
--1,0),v=new THREE.Vector3(0,-1,0),D=l[i][h+1].clone(),K=l[i][h].clone(),A=new THREE.Vector2(K.u,1),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([D,K,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+m=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),m=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],p=k[i+1][h+1],q=k[i][h+1],x=n.clone(),t=n.clone(),v=m.clone(),w=m.clone(),E=l[i][h].clone(),J=l[i+1][h].clone(),A=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[x,t,v,w]));this.faceVertexUvs[0].push([E,J,A,z])}}if(!f&&0<
|
|
|
+a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],p=this.vertices.length-1,x=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),E=l[0][h].clone(),J=l[0][h+1].clone(),A=new THREE.Vector2(J.u,0),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([E,J,A])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],p=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,
|
|
|
+-1,0),v=new THREE.Vector3(0,-1,0),E=l[i][h+1].clone(),J=l[i][h].clone(),A=new THREE.Vector2(J.u,1),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([E,J,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(J=c.length;0<=--J;){e=J;f=J-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*l,
|
|
|
-g=0;g<h;g++){var i=ua*g,k=ua*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,x=e,w=f,m=m+V,i=i+V,n=n+V,k=k+V;G.faces.push(new THREE.Face4(m,i,n,k,null,null,t));m=v.generateSideWallUV(G,a,p,b,m,i,n,k,q,r,x,w);G.faceVertexUvs[0].push(m)}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;G.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?v.generateBottomUV(G,a,b,c,d,e):v.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}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,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,x=b.material,t=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,D,K,A;r&&(p=r.getSpacedPoints(s),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
|
|
|
-!1),D=new THREE.Vector3,K=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var z,F,H,G=this,V=this.vertices.length,m=a.extractPoints(m),B=m.shape,m=m.holes;if(r=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();F=0;for(H=m.length;F<H;F++)z=m[F],THREE.Shape.Utils.isClockWise(z)&&(m[F]=z.reverse());r=!1}var T=THREE.Shape.Utils.triangulateShape(B,m),r=B;F=0;for(H=m.length;F<H;F++)z=m[F],B=B.concat(z);var C,I,M,W,ua=B.length,Ha=T.length,oa=[],J=0,da=r.length;C=da-1;for(I=J+1;J<da;J++,C++,I++)C===da&&
|
|
|
-(C=0),I===da&&(I=0),oa[J]=d(r[J],r[C],r[I]);var ka=[],Y,L=oa.concat();F=0;for(H=m.length;F<H;F++){z=m[F];Y=[];J=0;da=z.length;C=da-1;for(I=J+1;J<da;J++,C++,I++)C===da&&(C=0),I===da&&(I=0),Y[J]=d(z[J],z[C],z[I]);ka.push(Y);L=L.concat(Y)}for(C=0;C<l;C++){z=C/l;M=i*(1-z);I=k*Math.sin(z*Math.PI/2);J=0;for(da=r.length;J<da;J++)W=c(r[J],oa[J],I),f(W.x,W.y,-M);F=0;for(H=m.length;F<H;F++){z=m[F];Y=ka[F];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],I),f(W.x,W.y,-M)}}I=k;for(J=0;J<ua;J++)W=n?c(B[J],L[J],I):B[J],
|
|
|
-q?(K.copy(w.normals[0]).multiplyScalar(W.x),D.copy(w.binormals[0]).multiplyScalar(W.y),A.copy(p[0]).add(K).add(D),f(A.x,A.y,A.z)):f(W.x,W.y,0);for(z=1;z<=s;z++)for(J=0;J<ua;J++)W=n?c(B[J],L[J],I):B[J],q?(K.copy(w.normals[z]).multiplyScalar(W.x),D.copy(w.binormals[z]).multiplyScalar(W.y),A.copy(p[z]).add(K).add(D),f(A.x,A.y,A.z)):f(W.x,W.y,h/s*z);for(C=l-1;0<=C;C--){z=C/l;M=i*(1-z);I=k*Math.sin(z*Math.PI/2);J=0;for(da=r.length;J<da;J++)W=c(r[J],oa[J],I),f(W.x,W.y,h+M);F=0;for(H=m.length;F<H;F++){z=
|
|
|
-m[F];Y=ka[F];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],I),q?f(W.x,W.y+p[s-1].y,p[s-1].x+M):f(W.x,W.y,h+M)}}if(n){i=0*ua;for(J=0;J<Ha;J++)h=T[J],g(h[2]+i,h[1]+i,h[0]+i,!0);i=ua*(s+2*l);for(J=0;J<Ha;J++)h=T[J],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(J=0;J<Ha;J++)h=T[J],g(h[2],h[1],h[0],!0);for(J=0;J<Ha;J++)h=T[J],g(h[0]+ua*s,h[1]+ua*s,h[2]+ua*s,!1)}h=0;e(r,h);h+=r.length;F=0;for(H=m.length;F<H;F++)z=m[F],e(z,h),h+=z.length};
|
|
|
+h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(H=c.length;0<=--H;){e=H;f=H-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*l,
|
|
|
+g=0;g<h;g++){var i=X*g,k=X*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,x=e,w=f,m=m+V,i=i+V,n=n+V,k=k+V;F.faces.push(new THREE.Face4(m,i,n,k,null,null,t));m=v.generateSideWallUV(F,a,p,b,m,i,n,k,q,r,x,w);F.faceVertexUvs[0].push(m)}}}function f(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;F.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?v.generateBottomUV(F,a,b,c,d,e):v.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}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,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,x=b.material,t=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,E,J,A;r&&(p=r.getSpacedPoints(s),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
|
|
|
+!1),E=new THREE.Vector3,J=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var z,G,I,F=this,V=this.vertices.length,m=a.extractPoints(m),B=m.shape,m=m.holes;if(r=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();G=0;for(I=m.length;G<I;G++)z=m[G],THREE.Shape.Utils.isClockWise(z)&&(m[G]=z.reverse());r=!1}var T=THREE.Shape.Utils.triangulateShape(B,m),r=B;G=0;for(I=m.length;G<I;G++)z=m[G],B=B.concat(z);var C,K,L,W,X=B.length,qa=T.length,ga=[],H=0,ba=r.length;C=ba-1;for(K=H+1;H<ba;H++,C++,K++)C===ba&&
|
|
|
+(C=0),K===ba&&(K=0),ga[H]=d(r[H],r[C],r[K]);var Ca=[],ja,oa=ga.concat();G=0;for(I=m.length;G<I;G++){z=m[G];ja=[];H=0;ba=z.length;C=ba-1;for(K=H+1;H<ba;H++,C++,K++)C===ba&&(C=0),K===ba&&(K=0),ja[H]=d(z[H],z[C],z[K]);Ca.push(ja);oa=oa.concat(ja)}for(C=0;C<l;C++){z=C/l;L=i*(1-z);K=k*Math.sin(z*Math.PI/2);H=0;for(ba=r.length;H<ba;H++)W=c(r[H],ga[H],K),f(W.x,W.y,-L);G=0;for(I=m.length;G<I;G++){z=m[G];ja=Ca[G];H=0;for(ba=z.length;H<ba;H++)W=c(z[H],ja[H],K),f(W.x,W.y,-L)}}K=k;for(H=0;H<X;H++)W=n?c(B[H],
|
|
|
+oa[H],K):B[H],q?(J.copy(w.normals[0]).multiplyScalar(W.x),E.copy(w.binormals[0]).multiplyScalar(W.y),A.copy(p[0]).add(J).add(E),f(A.x,A.y,A.z)):f(W.x,W.y,0);for(z=1;z<=s;z++)for(H=0;H<X;H++)W=n?c(B[H],oa[H],K):B[H],q?(J.copy(w.normals[z]).multiplyScalar(W.x),E.copy(w.binormals[z]).multiplyScalar(W.y),A.copy(p[z]).add(J).add(E),f(A.x,A.y,A.z)):f(W.x,W.y,h/s*z);for(C=l-1;0<=C;C--){z=C/l;L=i*(1-z);K=k*Math.sin(z*Math.PI/2);H=0;for(ba=r.length;H<ba;H++)W=c(r[H],ga[H],K),f(W.x,W.y,h+L);G=0;for(I=m.length;G<
|
|
|
+I;G++){z=m[G];ja=Ca[G];H=0;for(ba=z.length;H<ba;H++)W=c(z[H],ja[H],K),q?f(W.x,W.y+p[s-1].y,p[s-1].x+L):f(W.x,W.y,h+L)}}if(n){i=0*X;for(H=0;H<qa;H++)h=T[H],g(h[2]+i,h[1]+i,h[0]+i,!0);i=X*(s+2*l);for(H=0;H<qa;H++)h=T[H],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(H=0;H<qa;H++)h=T[H],g(h[2],h[1],h[0],!0);for(H=0;H<qa;H++)h=T[H],g(h[0]+X*s,h[1]+X*s,h[2]+X*s,!1)}h=0;e(r,h);h+=r.length;G=0;for(I=m.length;G<I;G++)z=m[G],e(z,h),h+=z.length};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,
|
|
|
l=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(m,1-a)]}};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.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
@@ -669,29 +670,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);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,k);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)?(l=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};s={};m.vertex=b.getAttribLocation(n,"position");m.uv=b.getAttribLocation(n,"uv");s.renderType=b.getUniformLocation(n,"renderType");s.map=b.getUniformLocation(n,"map");s.occlusionMap=b.getUniformLocation(n,"occlusionMap");s.opacity=
|
|
|
-b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,t=a.length;if(t){var v=new THREE.Vector3,w=f/e,D=0.5*e,K=0.5*f,A=16/f,z=new THREE.Vector2(A*w,A),F=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),G=s,A=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
-b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,C,I;for(V=0;V<t;V++)if(A=16/f,z.set(A*w,A),C=a[V],v.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),F.copy(v),H.x=F.x*D+D,
|
|
|
-H.y=F.y*K+K,l||0<H.x&&H.x<e&&0<H.y&&H.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,z.x,z.y);b.uniform3f(G.screenPosition,F.x,F.y,F.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,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(F);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);B=0;for(T=C.lensFlares.length;B<T;B++)I=C.lensFlares[B],0.001<I.opacity&&0.001<I.scale&&(F.x=I.x,F.y=I.y,F.z=I.z,A=I.size*I.scale/f,z.x=A*w,z.y=A,b.uniform3f(G.screenPosition,F.x,F.y,F.z),b.uniform2f(G.scale,z.x,z.y),b.uniform1f(G.rotation,I.rotation),b.uniform1f(G.opacity,
|
|
|
-I.opacity),b.uniform3f(G.color,I.color.r,I.color.g,I.color.b),c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst),c.setTexture(I.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,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,r,p,q,x,t,v,w,D,K=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=n.__lights.length;s<r;s++)if(p=n.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(x=0;x<p.shadowCascadeCount;x++){var A;if(p.shadowCascadeArray[x])A=p.shadowCascadeArray[x];else{D=p;v=x;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=D.shadowCameraNear;A.shadowCameraFar=D.shadowCameraFar;A.shadowCameraLeft=D.shadowCameraLeft;A.shadowCameraRight=D.shadowCameraRight;
|
|
|
-A.shadowCameraBottom=D.shadowCameraBottom;A.shadowCameraTop=D.shadowCameraTop;A.shadowCameraVisible=D.shadowCameraVisible;A.shadowDarkness=D.shadowDarkness;A.shadowBias=D.shadowCascadeBias[v];A.shadowMapWidth=D.shadowCascadeWidth[v];A.shadowMapHeight=D.shadowCascadeHeight[v];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;t=A.pointsFrustum;for(var z=0;8>z;z++)w[z]=new THREE.Vector3,t[z]=new THREE.Vector3;w=D.shadowCascadeNearZ[v];D=D.shadowCascadeFarZ[v];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
|
|
|
-1,w);t[3].set(1,1,w);t[4].set(-1,-1,D);t[5].set(1,-1,D);t[6].set(-1,1,D);t[7].set(1,1,D);A.originalCamera=m;t=new THREE.Gyroscope;t.position=p.shadowCascadeOffset;t.add(A);t.add(A.target);m.add(t);p.shadowCascadeArray[x]=A;console.log("Created virtualLight",A)}v=p;w=x;D=v.shadowCascadeArray[w];D.position.copy(v.position);D.target.position.copy(v.target.position);D.lookAt(D.target);D.shadowCameraVisible=v.shadowCameraVisible;D.shadowDarkness=v.shadowDarkness;D.shadowBias=v.shadowCascadeBias[w];t=v.shadowCascadeNearZ[w];
|
|
|
-v=v.shadowCascadeFarZ[w];D=D.pointsFrustum;D[0].z=t;D[1].z=t;D[2].z=t;D[3].z=t;D[4].z=v;D[5].z=v;D[6].z=v;D[7].z=v;K[q]=A;q++}else K[q]=p,q++;s=0;for(r=K.length;s<r;s++){p=K[s];p.shadowMap||(x=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:x,magFilter:x,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,t=a.length;if(t){var v=new THREE.Vector3,w=f/e,E=0.5*e,J=0.5*f,A=16/f,z=new THREE.Vector2(A*w,A),G=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),F=s,A=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
+b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,C,K;for(V=0;V<t;V++)if(A=16/f,z.set(A*w,A),C=a[V],v.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),G.copy(v),I.x=G.x*E+E,
|
|
|
+I.y=G.y*J+J,l||0<I.x&&I.x<e&&0<I.y&&I.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,z.x,z.y);b.uniform3f(F.screenPosition,G.x,G.y,G.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,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(G);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);B=0;for(T=C.lensFlares.length;B<T;B++)K=C.lensFlares[B],0.001<K.opacity&&0.001<K.scale&&(G.x=K.x,G.y=K.y,G.z=K.z,A=K.size*K.scale/f,z.x=A*w,z.y=A,b.uniform3f(F.screenPosition,G.x,G.y,G.z),b.uniform2f(F.scale,z.x,z.y),b.uniform1f(F.rotation,K.rotation),b.uniform1f(F.opacity,
|
|
|
+K.opacity),b.uniform3f(F.color,K.color.r,K.color.g,K.color.b),c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst),c.setTexture(K.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,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,r,p,q,x,t,v,w,E,J=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=n.__lights.length;s<r;s++)if(p=n.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(x=0;x<p.shadowCascadeCount;x++){var A;if(p.shadowCascadeArray[x])A=p.shadowCascadeArray[x];else{E=p;v=x;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=E.shadowCameraNear;A.shadowCameraFar=E.shadowCameraFar;A.shadowCameraLeft=E.shadowCameraLeft;A.shadowCameraRight=E.shadowCameraRight;
|
|
|
+A.shadowCameraBottom=E.shadowCameraBottom;A.shadowCameraTop=E.shadowCameraTop;A.shadowCameraVisible=E.shadowCameraVisible;A.shadowDarkness=E.shadowDarkness;A.shadowBias=E.shadowCascadeBias[v];A.shadowMapWidth=E.shadowCascadeWidth[v];A.shadowMapHeight=E.shadowCascadeHeight[v];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;t=A.pointsFrustum;for(var z=0;8>z;z++)w[z]=new THREE.Vector3,t[z]=new THREE.Vector3;w=E.shadowCascadeNearZ[v];E=E.shadowCascadeFarZ[v];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
|
|
|
+1,w);t[3].set(1,1,w);t[4].set(-1,-1,E);t[5].set(1,-1,E);t[6].set(-1,1,E);t[7].set(1,1,E);A.originalCamera=m;t=new THREE.Gyroscope;t.position=p.shadowCascadeOffset;t.add(A);t.add(A.target);m.add(t);p.shadowCascadeArray[x]=A;console.log("Created virtualLight",A)}v=p;w=x;E=v.shadowCascadeArray[w];E.position.copy(v.position);E.target.position.copy(v.target.position);E.lookAt(E.target);E.shadowCameraVisible=v.shadowCameraVisible;E.shadowDarkness=v.shadowDarkness;E.shadowBias=v.shadowCascadeBias[w];t=v.shadowCascadeNearZ[w];
|
|
|
+v=v.shadowCascadeFarZ[w];E=E.pointsFrustum;E[0].z=t;E[1].z=t;E[2].z=t;E[3].z=t;E[4].z=v;E[5].z=v;E[6].z=v;E[7].z=v;J[q]=A;q++}else J[q]=p,q++;s=0;for(r=J.length;s<r;s++){p=J[s];p.shadowMap||(x=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:x,magFilter:x,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}n.add(p.shadowCamera);b.autoUpdateScene&&n.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&A.originalCamera==m){x=m;q=p.shadowCamera;t=p.pointsFrustum;D=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=D[v],w.copy(t[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,x),w.applyMatrix4(q.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&A.originalCamera==m){x=m;q=p.shadowCamera;t=p.pointsFrustum;E=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=E[v],w.copy(t[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,x),w.applyMatrix4(q.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
(k.z=w.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;t=p.shadowMatrix;x=p.shadowCamera;x.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);x.lookAt(l);x.updateMatrixWorld();x.matrixWorldInverse.getInverse(x.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiply(x.projectionMatrix);t.multiply(x.matrixWorldInverse);
|
|
|
-h.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();D=n.__webglObjects;p=0;for(q=D.length;p<q;p++)if(v=D[p],t=v.object,v.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),v.render=!0;p=0;for(q=D.length;p<q;p++)v=D[p],v.render&&(t=v.object,v=v.buffer,z=t.material instanceof THREE.MeshFaceMaterial?
|
|
|
-t.material.materials[0]:t.material,w=0<t.geometry.morphTargets.length&&z.morphTargets,z=t instanceof THREE.SkinnedMesh&&z.skinning,w=t.customDepthMaterial?t.customDepthMaterial:z?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(x,n.__lights,null,w,v,t):b.renderBuffer(x,n.__lights,null,w,v,t));D=n.__webglObjectsImmediate;p=0;for(q=D.length;p<q;p++)v=D[p],t=v.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(x,
|
|
|
+h.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();E=n.__webglObjects;p=0;for(q=E.length;p<q;p++)if(v=E[p],t=v.object,v.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),v.render=!0;p=0;for(q=E.length;p<q;p++)v=E[p],v.render&&(t=v.object,v=v.buffer,z=t.material instanceof THREE.MeshFaceMaterial?
|
|
|
+t.material.materials[0]:t.material,w=0<t.geometry.morphTargets.length&&z.morphTargets,z=t instanceof THREE.SkinnedMesh&&z.skinning,w=t.customDepthMaterial?t.customDepthMaterial:z?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(x,n.__lights,null,w,v,t):b.renderBuffer(x,n.__lights,null,w,v,t));E=n.__webglObjectsImmediate;p=0;for(q=E.length;p<q;p++)v=E[p],t=v.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(x,
|
|
|
n.__lights,null,c,t))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
|
|
|
e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(s,p+a.fragmentShader);b.shaderSource(r,p+a.vertexShader);b.compileShader(s);b.compileShader(r);b.attachShader(m,s);b.attachShader(m,r);b.linkProgram(m);i=m;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
|
|
|
"uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
|
|
|
"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,r){var p=d.__webglSprites,q=p.length;if(q){var x=k,t=l,v=r/
|
|
|
-f,f=0.5*f,w=0.5*r;b.useProgram(i);b.enableVertexAttribArray(x.position);b.enableVertexAttribArray(x.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(x.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(x.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(t.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);var D=x=0,K=d.fog;K?(b.uniform3f(t.fogColor,K.color.r,K.color.g,K.color.b),
|
|
|
-K instanceof THREE.Fog?(b.uniform1f(t.fogNear,K.near),b.uniform1f(t.fogFar,K.far),b.uniform1i(t.fogType,1),D=x=1):K instanceof THREE.FogExp2&&(b.uniform1f(t.fogDensity,K.density),b.uniform1i(t.fogType,2),D=x=2)):(b.uniform1i(t.fogType,0),D=x=0);for(var A,z,F=[],K=0;K<q;K++)A=p[K],z=A.material,A.visible&&0!==z.opacity&&(z.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,A.matrixWorld),A.z=-A._modelViewMatrix.elements[14]));p.sort(a);for(K=0;K<q;K++)A=
|
|
|
-p[K],z=A.material,A.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(t.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(t.useScreenCoordinates,1),b.uniform3f(t.screenPosition,(A.position.x*c.devicePixelRatio-f)/f,(w-A.position.y*c.devicePixelRatio)/w,Math.max(0,Math.min(1,A.position.z))),F[0]=c.devicePixelRatio,F[1]=c.devicePixelRatio):(b.uniform1i(t.useScreenCoordinates,0),b.uniform1i(t.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(t.modelViewMatrix,
|
|
|
-!1,A._modelViewMatrix.elements),F[0]=1,F[1]=1),e=d.fog&&z.fog?D:0,x!==e&&(b.uniform1i(t.fogType,e),x=e),e=1/(z.scaleByViewport?r:1),F[0]*=e*v*A.scale.x,F[1]*=e*A.scale.y,b.uniform2f(t.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(t.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(t.alignment,z.alignment.x,z.alignment.y),b.uniform1f(t.opacity,z.opacity),b.uniform3f(t.color,z.color.r,z.color.g,z.color.b),b.uniform1f(t.rotation,A.rotation),b.uniform2fv(t.scale,F),c.setBlending(z.blending,z.blendEquation,
|
|
|
+f,f=0.5*f,w=0.5*r;b.useProgram(i);b.enableVertexAttribArray(x.position);b.enableVertexAttribArray(x.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(x.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(x.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(t.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);var E=x=0,J=d.fog;J?(b.uniform3f(t.fogColor,J.color.r,J.color.g,J.color.b),
|
|
|
+J instanceof THREE.Fog?(b.uniform1f(t.fogNear,J.near),b.uniform1f(t.fogFar,J.far),b.uniform1i(t.fogType,1),E=x=1):J instanceof THREE.FogExp2&&(b.uniform1f(t.fogDensity,J.density),b.uniform1i(t.fogType,2),E=x=2)):(b.uniform1i(t.fogType,0),E=x=0);for(var A,z,G=[],J=0;J<q;J++)A=p[J],z=A.material,A.visible&&0!==z.opacity&&(z.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,A.matrixWorld),A.z=-A._modelViewMatrix.elements[14]));p.sort(a);for(J=0;J<q;J++)A=
|
|
|
+p[J],z=A.material,A.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(t.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(t.useScreenCoordinates,1),b.uniform3f(t.screenPosition,(A.position.x*c.devicePixelRatio-f)/f,(w-A.position.y*c.devicePixelRatio)/w,Math.max(0,Math.min(1,A.position.z))),G[0]=c.devicePixelRatio,G[1]=c.devicePixelRatio):(b.uniform1i(t.useScreenCoordinates,0),b.uniform1i(t.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(t.modelViewMatrix,
|
|
|
+!1,A._modelViewMatrix.elements),G[0]=1,G[1]=1),e=d.fog&&z.fog?E:0,x!==e&&(b.uniform1i(t.fogType,e),x=e),e=1/(z.scaleByViewport?r:1),G[0]*=e*v*A.scale.x,G[1]*=e*A.scale.y,b.uniform2f(t.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(t.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(t.alignment,z.alignment.x,z.alignment.y),b.uniform1f(t.opacity,z.opacity),b.uniform3f(t.color,z.color.r,z.color.g,z.color.b),b.uniform1f(t.rotation,A.rotation),b.uniform2fv(t.scale,G),c.setBlending(z.blending,z.blendEquation,
|
|
|
z.blendSrc,z.blendDst),c.setDepthTest(z.depthTest),c.setDepthWrite(z.depthWrite),c.setTexture(z.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,n,m,s,r,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiplyMatrices(k.projectionMatrix,
|
|
|
k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(n=p.length;l<n;l++)if(m=p[l],r=m.object,m.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||g.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),m.render=!0;var q;l=0;for(n=p.length;l<n;l++)if(m=p[l],m.render&&(r=m.object,m=m.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
|