|
@@ -66,8 +66,8 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,
|
|
|
this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var k=g*h,m=g*f,p=d*h,n=d*f;c[0]=i*h;c[4]=-i*f;c[8]=e;c[1]=m+p*e;c[5]=k-n*e;c[9]=-d*i;c[2]=n-k*e;c[6]=p+m*e;c[10]=g*i}else"YXZ"===b?(k=i*h,m=i*f,p=e*h,n=e*f,c[0]=k+n*d,c[4]=p*d-m,c[8]=g*e,c[1]=g*f,c[5]=g*h,c[9]=-d,c[2]=m*d-p,c[6]=n+k*d,c[10]=g*i):"ZXY"===b?(k=i*h,m=i*f,p=e*h,n=e*f,c[0]=k-n*d,c[4]=-g*f,c[8]=p+m*d,c[1]=m+p*d,c[5]=g*h,c[9]=n-k*d,c[2]=-g*e,c[6]=
|
|
|
d,c[10]=g*i):"ZYX"===b?(k=g*h,m=g*f,p=d*h,n=d*f,c[0]=i*h,c[4]=p*e-m,c[8]=k*e+n,c[1]=i*f,c[5]=n*e+k,c[9]=m*e-p,c[2]=-e,c[6]=d*i,c[10]=g*i):"YZX"===b?(k=g*i,m=g*e,p=d*i,n=d*e,c[0]=i*h,c[4]=n-k*f,c[8]=p*f+m,c[1]=f,c[5]=g*h,c[9]=-d*h,c[2]=-e*h,c[6]=m*f+p,c[10]=k-n*f):"XZY"===b&&(k=g*i,m=g*e,p=d*i,n=d*e,c[0]=i*h,c[4]=-f,c[8]=e*h,c[1]=k*f+n,c[5]=g*h,c[9]=m*f-p,c[2]=p*f-m,c[6]=d*h,c[10]=n*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,i=d+d,h=e+
|
|
|
e,a=c*g,k=c*i,c=c*h,m=d*i,d=d*h,e=e*h,g=f*g,i=f*i,f=f*h;b[0]=1-(m+e);b[4]=k-f;b[8]=c+i;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-i;b[6]=d+g;b[10]=1-(a+m);return this},lookAt:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.subVectors(a,b).normalize();0===g.length()&&(g.z=1);e.crossVectors(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.crossVectors(c,g).normalize());f.crossVectors(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=
|
|
|
-f.z;d[10]=g.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],i=c[8],h=c[12],k=c[1],m=c[5],p=c[9],n=c[13],s=c[2],q=c[6],l=c[10],r=c[14],t=c[3],x=c[7],z=c[11],c=c[15],w=d[0],I=d[4],H=d[8],C=d[12],y=d[1],E=d[5],F=d[9],G=d[13],
|
|
|
-W=d[2],A=d[6],X=d[10],B=d[14],K=d[3],L=d[7],T=d[11],d=d[15];e[0]=f*w+g*y+i*W+h*K;e[4]=f*I+g*E+i*A+h*L;e[8]=f*H+g*F+i*X+h*T;e[12]=f*C+g*G+i*B+h*d;e[1]=k*w+m*y+p*W+n*K;e[5]=k*I+m*E+p*A+n*L;e[9]=k*H+m*F+p*X+n*T;e[13]=k*C+m*G+p*B+n*d;e[2]=s*w+q*y+l*W+r*K;e[6]=s*I+q*E+l*A+r*L;e[10]=s*H+q*F+l*X+r*T;e[14]=s*C+q*G+l*B+r*d;e[3]=t*w+x*y+z*W+c*K;e[7]=t*I+x*E+z*A+c*L;e[11]=t*H+x*F+z*X+c*T;e[15]=t*C+x*G+z*B+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];
|
|
|
+f.z;d[10]=g.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],i=c[8],h=c[12],k=c[1],m=c[5],p=c[9],n=c[13],s=c[2],q=c[6],l=c[10],r=c[14],t=c[3],x=c[7],z=c[11],c=c[15],w=d[0],I=d[4],H=d[8],D=d[12],y=d[1],E=d[5],F=d[9],G=d[13],
|
|
|
+W=d[2],A=d[6],X=d[10],B=d[14],K=d[3],L=d[7],P=d[11],d=d[15];e[0]=f*w+g*y+i*W+h*K;e[4]=f*I+g*E+i*A+h*L;e[8]=f*H+g*F+i*X+h*P;e[12]=f*D+g*G+i*B+h*d;e[1]=k*w+m*y+p*W+n*K;e[5]=k*I+m*E+p*A+n*L;e[9]=k*H+m*F+p*X+n*P;e[13]=k*D+m*G+p*B+n*d;e[2]=s*w+q*y+l*W+r*K;e[6]=s*I+q*E+l*A+r*L;e[10]=s*H+q*F+l*X+r*P;e[14]=s*D+q*G+l*B+r*d;e[3]=t*w+x*y+z*W+c*K;e[7]=t*I+x*E+z*A+c*L;e[11]=t*H+x*F+z*X+c*P;e[15]=t*D+x*G+z*B+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 is now vector.applyMatrix4( matrix ) instead.");
|
|
|
return a.applyMatrix4(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use is now vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,c=0,d=a.length;c<d;c+=3)b.x=a[c],b.y=a[c+1],b.z=a[c+2],b.applyMatrix4(this),a[c]=b.x,a[c+1]=b.y,a[c+2]=b.z;return a},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],i=a[9],h=a[13],k=a[2],m=a[6],p=a[10],n=a[14];return a[3]*(+e*i*m-d*h*m-e*g*p+c*h*p+d*g*n-c*i*n)+a[7]*(+b*i*n-b*h*p+e*f*
|
|
@@ -81,7 +81,7 @@ d.elements[1]/=c.x;d.elements[2]/=c.x;d.elements[4]/=c.y;d.elements[5]/=c.y;d.el
|
|
|
d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;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],i=b[9],h=b[10],k=b[11],m=Math.cos(a),a=Math.sin(a);b[4]=m*c+a*g;b[5]=m*d+a*i;b[6]=m*e+a*h;b[7]=m*f+a*k;b[8]=
|
|
|
m*g-a*c;b[9]=m*i-a*d;b[10]=m*h-a*e;b[11]=m*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],i=b[9],h=b[10],k=b[11],m=Math.cos(a),a=Math.sin(a);b[0]=m*c-a*g;b[1]=m*d-a*i;b[2]=m*e-a*h;b[3]=m*f-a*k;b[8]=m*g+a*c;b[9]=m*i+a*d;b[10]=m*h+a*e;b[11]=m*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],i=b[5],h=b[6],k=b[7],m=Math.cos(a),a=Math.sin(a);b[0]=m*c+a*g;b[1]=m*d+a*i;b[2]=m*e+a*h;b[3]=m*f+a*k;b[4]=m*g-a*c;b[5]=
|
|
|
m*i-a*d;b[6]=m*h-a*e;b[7]=m*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,i=e*e,h=f*f,k=Math.cos(b),m=Math.sin(b),p=1-k,n=d*e*p,s=d*f*p,p=e*f*p,d=d*m,q=e*m,m=f*m,f=g+(1-g)*k,g=n+m,e=s-q,n=n-m,i=i+(1-i)*k,m=p+d,s=s+q,p=p-d,h=h+(1-h)*k,k=c[0],d=c[1],q=c[2],
|
|
|
-l=c[3],r=c[4],t=c[5],x=c[6],z=c[7],w=c[8],I=c[9],H=c[10],C=c[11];c[0]=f*k+g*r+e*w;c[1]=f*d+g*t+e*I;c[2]=f*q+g*x+e*H;c[3]=f*l+g*z+e*C;c[4]=n*k+i*r+m*w;c[5]=n*d+i*t+m*I;c[6]=n*q+i*x+m*H;c[7]=n*l+i*z+m*C;c[8]=s*k+p*r+h*w;c[9]=s*d+p*t+h*I;c[10]=s*q+p*x+h*H;c[11]=s*l+p*z+h*C;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]*
|
|
|
+l=c[3],r=c[4],t=c[5],x=c[6],z=c[7],w=c[8],I=c[9],H=c[10],D=c[11];c[0]=f*k+g*r+e*w;c[1]=f*d+g*t+e*I;c[2]=f*q+g*x+e*H;c[3]=f*l+g*z+e*D;c[4]=n*k+i*r+m*w;c[5]=n*d+i*t+m*I;c[6]=n*q+i*x+m*H;c[7]=n*l+i*z+m*D;c[8]=s*k+p*r+h*w;c[9]=s*d+p*t+h*I;c[10]=s*q+p*x+h*H;c[11]=s*l+p*z+h*D;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){this.set(1,0,0,a.x,0,1,0,a.y,0,0,1,a.z,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,i=a.z,h=e*f,k=e*g;this.set(h*f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,k*g+c,k*i-d*f,0,h*i-d*g,k*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a){this.set(a.x,0,0,0,0,a.y,0,0,0,0,a.z,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,i=b-a,h=c-d,k=f-e;g[0]=2/i;g[4]=0;g[8]=0;g[12]=-((b+a)/i);g[1]=0;g[5]=2/h;g[9]=0;g[13]=-((c+d)/h);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],
|
|
@@ -118,9 +118,9 @@ THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.
|
|
|
new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},
|
|
|
clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Triangle.__v0=new THREE.Vector3;THREE.Triangle.__v1=new THREE.Vector3;THREE.Triangle.__v2=new THREE.Vector3;THREE.Triangle.__v3=new THREE.Vector3;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.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.getDelta();return this.elapsedTime};
|
|
|
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.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.length()&&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.Matrix4,g=function(a,b){return a.distance-b.distance},i=function(g,i,h){if(g instanceof a.Particle){i=i.ray.distanceToPoint(g.matrixWorld.getPosition());if(i>g.scale.x)return h;h.push({distance:i,point:g.position,face:null,object:g})}else if(g instanceof a.Mesh){b.set(g.matrixWorld.getPosition(),
|
|
|
-g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return h;var n=g.geometry,s=n.vertices,q=g.material instanceof a.MeshFaceMaterial,l=!0===q?g.material.materials:null,r=g.material.side,t,x,z,w=i.precision;g.matrixRotationWorld.extractRotation(g.matrixWorld);f.getInverse(g.matrixWorld);c.copy(i.ray).transform(f);for(var I=0,H=n.faces.length;I<H;I++){var C=n.faces[I],r=!0===q?l[C.materialIndex]:g.material;if(void 0!==r){d.setFromNormalAndCoplanarPoint(C.normal,
|
|
|
-s[C.a]);var y=c.distanceToPlane(d);if(!(Math.abs(y)<w)&&!(0>y)){r=r.side;if(r!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(r===a.FrontSide?0>t:0<t)))continue;if(!(y<i.near||y>i.far)){e=c.at(y,e);if(C instanceof a.Face3){if(r=s[C.a],t=s[C.b],x=s[C.c],!a.Triangle.containsPoint(e,r,t,x))continue}else if(C instanceof a.Face4){if(r=s[C.a],t=s[C.b],x=s[C.c],z=s[C.d],!a.Triangle.containsPoint(e,r,t,z)&&!a.Triangle.containsPoint(e,t,x,z))continue}else throw Error("face type not supported");h.push({distance:y,
|
|
|
-point:i.ray.at(y),face:C,faceIndex:I,object:g})}}}}}},h=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&&h(a,this,c);i(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)i(a[d],
|
|
|
+g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return h;var n=g.geometry,s=n.vertices,q=g.material instanceof a.MeshFaceMaterial,l=!0===q?g.material.materials:null,r=g.material.side,t,x,z,w=i.precision;g.matrixRotationWorld.extractRotation(g.matrixWorld);f.getInverse(g.matrixWorld);c.copy(i.ray).transform(f);for(var I=0,H=n.faces.length;I<H;I++){var D=n.faces[I],r=!0===q?l[D.materialIndex]:g.material;if(void 0!==r){d.setFromNormalAndCoplanarPoint(D.normal,
|
|
|
+s[D.a]);var y=c.distanceToPlane(d);if(!(Math.abs(y)<w)&&!(0>y)){r=r.side;if(r!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(r===a.FrontSide?0>t:0<t)))continue;if(!(y<i.near||y>i.far)){e=c.at(y,e);if(D instanceof a.Face3){if(r=s[D.a],t=s[D.b],x=s[D.c],!a.Triangle.containsPoint(e,r,t,x))continue}else if(D instanceof a.Face4){if(r=s[D.a],t=s[D.b],x=s[D.c],z=s[D.d],!a.Triangle.containsPoint(e,r,t,z)&&!a.Triangle.containsPoint(e,t,x,z))continue}else throw Error("face type not supported");h.push({distance:y,
|
|
|
+point:i.ray.at(y),face:D,faceIndex:I,object:g})}}}}}},h=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&&h(a,this,c);i(a,this,c);c.sort(g);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&&h(a[d],this,c);c.sort(g);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,
|
|
@@ -130,19 +130,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===i){var a=new THREE.RenderableObject;g.push(a);i++;f++;return a}return g[f++]}function b(){if(k===p){var a=new THREE.RenderableVertex;m.push(a);p++;k++;return a}return m[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,i=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=i)return!0;if(0>e&&0>f||0>g&&0>i)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-i)):0>i&&(d=Math.min(d,g/(g-i)));if(d<
|
|
|
-c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],i=0,h,k,m=[],p=0,n,s,q=[],l=0,r,t=[],x=0,z,w,I=[],H=0,C,y,E=[],F=0,G={objects:[],sprites:[],lights:[],elements:[]},W=new THREE.Vector3,A=new THREE.Vector4,X=new THREE.Matrix4,B=new THREE.Matrix4,K,L=new THREE.Matrix4,T=new THREE.Matrix3,Z=new THREE.Matrix3,sa=new THREE.Vector3,La=new THREE.Frustum,J=new THREE.Vector4,ja=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiplyMatrices(b.projectionMatrix,
|
|
|
-b.matrixWorldInverse);return a.applyMatrix4(B)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyMatrix4(B)};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,i,p,ha){var ta=!1,oa,da,ra,$,la,jb,Ea,ma,wa,xa,ea,Ua,Bb;y=w=r=s=0;G.elements.length=
|
|
|
-0;g.updateMatrixWorld();void 0===i.parent&&i.updateMatrixWorld();X.copy(i.matrixWorldInverse.getInverse(i.matrixWorld));B.multiplyMatrices(i.projectionMatrix,X);Z.getInverse(X);Z.transpose();La.setFromMatrix(B);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var qb=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===
|
|
|
-La.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(W.copy(f.matrixWorld.getPosition()),W.applyMatrix4(B),e.z=W.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:(W.copy(f.matrixWorld.getPosition()),W.applyMatrix4(B),e.z=W.z),G.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(W.copy(f.matrixWorld.getPosition()),W.applyMatrix4(B),e.z=W.z),G.objects.push(e));
|
|
|
-qb(f)}}};qb(g);!0===p&&G.objects.sort(c);g=0;for(p=G.objects.length;g<p;g++)if(ma=G.objects[g].object,K=ma.matrixWorld,k=0,ma instanceof THREE.Mesh){wa=ma.geometry;ra=wa.vertices;xa=wa.faces;wa=wa.faceVertexUvs;T.getInverse(K);T.transpose();Ua=ma.material instanceof THREE.MeshFaceMaterial;Bb=!0===Ua?ma.material:null;oa=0;for(da=ra.length;oa<da;oa++)h=b(),h.positionWorld.copy(ra[oa]),h.positionWorld.applyMatrix4(K),h.positionScreen.copy(h.positionWorld),h.positionScreen.applyMatrix4(B),h.positionScreen.x/=
|
|
|
-h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.positionScreen.z/=h.positionScreen.w,h.visible=!(-1>h.positionScreen.x||1<h.positionScreen.x||-1>h.positionScreen.y||1<h.positionScreen.y||-1>h.positionScreen.z||1<h.positionScreen.z);ra=0;for(oa=xa.length;ra<oa;ra++){da=xa[ra];var Sa=!0===Ua?Bb.materials[da.materialIndex]:ma.material;if(void 0!==Sa){jb=Sa.side;if(da instanceof THREE.Face3)if($=m[da.a],la=m[da.b],Ea=m[da.c],!0===$.visible||!0===la.visible||!0===Ea.visible)if(ta=0>(Ea.positionScreen.x-
|
|
|
-$.positionScreen.x)*(la.positionScreen.y-$.positionScreen.y)-(Ea.positionScreen.y-$.positionScreen.y)*(la.positionScreen.x-$.positionScreen.x),jb===THREE.DoubleSide||ta===(jb===THREE.FrontSide))s===l?(ea=new THREE.RenderableFace3,q.push(ea),l++,s++,n=ea):n=q[s++],n.v1.copy($),n.v2.copy(la),n.v3.copy(Ea);else continue;else continue;else if(da instanceof THREE.Face4)if($=m[da.a],la=m[da.b],Ea=m[da.c],ea=m[da.d],!0===$.visible||!0===la.visible||!0===Ea.visible||!0===ea.visible)if(ta=0>(ea.positionScreen.x-
|
|
|
-$.positionScreen.x)*(la.positionScreen.y-$.positionScreen.y)-(ea.positionScreen.y-$.positionScreen.y)*(la.positionScreen.x-$.positionScreen.x)||0>(la.positionScreen.x-Ea.positionScreen.x)*(ea.positionScreen.y-Ea.positionScreen.y)-(la.positionScreen.y-Ea.positionScreen.y)*(ea.positionScreen.x-Ea.positionScreen.x),jb===THREE.DoubleSide||ta===(jb===THREE.FrontSide)){if(r===x){var rb=new THREE.RenderableFace4;t.push(rb);x++;r++;n=rb}else n=t[r++];n.v1.copy($);n.v2.copy(la);n.v3.copy(Ea);n.v4.copy(ea)}else continue;
|
|
|
-else continue;n.normalModel.copy(da.normal);!1===ta&&(jb===THREE.BackSide||jb===THREE.DoubleSide)&&n.normalModel.negate();n.normalModel.applyMatrix3(T);n.normalModel.normalize();n.normalModelView.copy(n.normalModel);n.normalModelView.applyMatrix3(Z);n.centroidModel.copy(da.centroid);n.centroidModel.applyMatrix4(K);Ea=da.vertexNormals;$=0;for(la=Ea.length;$<la;$++)ea=n.vertexNormalsModel[$],ea.copy(Ea[$]),!1===ta&&(jb===THREE.BackSide||jb===THREE.DoubleSide)&&ea.negate(),ea.applyMatrix3(T),ea.normalize(),
|
|
|
-rb=n.vertexNormalsModelView[$],rb.copy(ea),rb.applyMatrix3(Z);n.vertexNormalsLength=Ea.length;jb=0;for($=wa.length;jb<$;jb++)if(ea=wa[jb][ra],void 0!==ea){la=0;for(Ea=ea.length;la<Ea;la++)n.uvs[jb][la]=ea[la]}n.color=da.color;n.material=Sa;sa.copy(n.centroidModel);sa.applyMatrix4(B);n.z=sa.z;G.elements.push(n)}}}else if(ma instanceof THREE.Line){L.multiplyMatrices(B,K);ra=ma.geometry.vertices;$=b();$.positionScreen.copy(ra[0]);$.positionScreen.applyMatrix4(L);xa=ma.type===THREE.LinePieces?2:1;oa=
|
|
|
-1;for(da=ra.length;oa<da;oa++)$=b(),$.positionScreen.copy(ra[oa]),$.positionScreen.applyMatrix4(L),0<(oa+1)%xa||(la=m[k-2],J.copy($.positionScreen),ja.copy(la.positionScreen),!0===d(J,ja)&&(J.multiplyScalar(1/J.w),ja.multiplyScalar(1/ja.w),w===H?(wa=new THREE.RenderableLine,I.push(wa),H++,w++,z=wa):z=I[w++],z.v1.positionScreen.copy(J),z.v2.positionScreen.copy(ja),z.z=Math.max(J.z,ja.z),z.material=ma.material,G.elements.push(z)))}g=0;for(p=G.sprites.length;g<p;g++)ma=G.sprites[g].object,K=ma.matrixWorld,
|
|
|
-ma instanceof THREE.Particle&&(A.set(K.elements[12],K.elements[13],K.elements[14],1),A.applyMatrix4(B),A.z/=A.w,0<A.z&&1>A.z&&(y===F?(ta=new THREE.RenderableParticle,E.push(ta),F++,y++,C=ta):C=E[y++],C.object=ma,C.x=A.x/A.w,C.y=A.y/A.w,C.z=A.z,C.rotation=ma.rotation.z,C.scale.x=ma.scale.x*Math.abs(C.x-(A.x+i.projectionMatrix.elements[0])/(A.w+i.projectionMatrix.elements[12])),C.scale.y=ma.scale.y*Math.abs(C.y-(A.y+i.projectionMatrix.elements[5])/(A.w+i.projectionMatrix.elements[13])),C.material=ma.material,
|
|
|
-G.elements.push(C)));!0===ha&&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=[],i=0,h,k,m=[],p=0,n,s,q=[],l=0,r,t=[],x=0,z,w,I=[],H=0,D,y,E=[],F=0,G={objects:[],sprites:[],lights:[],elements:[]},W=new THREE.Vector3,A=new THREE.Vector4,X=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),B=new THREE.Box3,K=new THREE.Matrix4,L=new THREE.Matrix4,P,aa=new THREE.Matrix4,na=new THREE.Matrix3,qa=new THREE.Matrix3,J=new THREE.Vector3,ga=new THREE.Frustum,sa=new THREE.Vector4,ea=new THREE.Vector4;this.projectVector=
|
|
|
+function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);L.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyMatrix4(L)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);L.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyMatrix4(L)};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,i,p,ya){var ha=!1,ra,da,za,oa,ka,Ra,la,va,ta,lb,Da,tb,fb;y=w=r=s=0;G.elements.length=0;g.updateMatrixWorld();void 0===i.parent&&i.updateMatrixWorld();K.copy(i.matrixWorldInverse.getInverse(i.matrixWorld));L.multiplyMatrices(i.projectionMatrix,K);qa.getInverse(K);qa.transpose();ga.setFromMatrix(L);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var Lb=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===ga.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(W.copy(f.matrixWorld.getPosition()),W.applyMatrix4(L),e.z=W.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:(W.copy(f.matrixWorld.getPosition()),W.applyMatrix4(L),e.z=W.z),G.sprites.push(e)):(e=a(),e.object=f,null!==
|
|
|
+f.renderDepth?e.z=f.renderDepth:(W.copy(f.matrixWorld.getPosition()),W.applyMatrix4(L),e.z=W.z),G.objects.push(e));Lb(f)}}};Lb(g);!0===p&&G.objects.sort(c);g=0;for(p=G.objects.length;g<p;g++)if(va=G.objects[g].object,P=va.matrixWorld,k=0,va instanceof THREE.Mesh){ta=va.geometry;za=ta.vertices;lb=ta.faces;ta=ta.faceVertexUvs;na.getInverse(P);na.transpose();tb=va.material instanceof THREE.MeshFaceMaterial;fb=!0===tb?va.material:null;ra=0;for(da=za.length;ra<da;ra++)h=b(),h.positionWorld.copy(za[ra]),
|
|
|
+h.positionWorld.applyMatrix4(P),h.positionScreen.copy(h.positionWorld),h.positionScreen.applyMatrix4(L),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.positionScreen.z/=h.positionScreen.w,h.visible=!(-1>h.positionScreen.x||1<h.positionScreen.x||-1>h.positionScreen.y||1<h.positionScreen.y||-1>h.positionScreen.z||1<h.positionScreen.z);za=0;for(ra=lb.length;za<ra;za++){da=lb[za];var zb=!0===tb?fb.materials[da.materialIndex]:va.material;if(void 0!==zb){Ra=zb.side;if(da instanceof
|
|
|
+THREE.Face3)if(oa=m[da.a],ka=m[da.b],la=m[da.c],!0===oa.visible||!0===ka.visible||!0===la.visible||X.isIntersectionBox(B.setFromPoints([oa.positionScreen,ka.positionScreen,la.positionScreen])))if(ha=0>(la.positionScreen.x-oa.positionScreen.x)*(ka.positionScreen.y-oa.positionScreen.y)-(la.positionScreen.y-oa.positionScreen.y)*(ka.positionScreen.x-oa.positionScreen.x),Ra===THREE.DoubleSide||ha===(Ra===THREE.FrontSide))s===l?(Da=new THREE.RenderableFace3,q.push(Da),l++,s++,n=Da):n=q[s++],n.v1.copy(oa),
|
|
|
+n.v2.copy(ka),n.v3.copy(la);else continue;else continue;else if(da instanceof THREE.Face4)if(oa=m[da.a],ka=m[da.b],la=m[da.c],Da=m[da.d],!0===oa.visible||!0===ka.visible||!0===la.visible||!0===Da.visible||X.isIntersectionBox(B.setFromPoints([oa.positionScreen,ka.positionScreen,la.positionScreen,Da.positionScreen])))if(ha=0>(Da.positionScreen.x-oa.positionScreen.x)*(ka.positionScreen.y-oa.positionScreen.y)-(Da.positionScreen.y-oa.positionScreen.y)*(ka.positionScreen.x-oa.positionScreen.x)||0>(ka.positionScreen.x-
|
|
|
+la.positionScreen.x)*(Da.positionScreen.y-la.positionScreen.y)-(ka.positionScreen.y-la.positionScreen.y)*(Da.positionScreen.x-la.positionScreen.x),Ra===THREE.DoubleSide||ha===(Ra===THREE.FrontSide)){if(r===x){var rb=new THREE.RenderableFace4;t.push(rb);x++;r++;n=rb}else n=t[r++];n.v1.copy(oa);n.v2.copy(ka);n.v3.copy(la);n.v4.copy(Da)}else continue;else continue;n.normalModel.copy(da.normal);!1===ha&&(Ra===THREE.BackSide||Ra===THREE.DoubleSide)&&n.normalModel.negate();n.normalModel.applyMatrix3(na);
|
|
|
+n.normalModel.normalize();n.normalModelView.copy(n.normalModel);n.normalModelView.applyMatrix3(qa);n.centroidModel.copy(da.centroid);n.centroidModel.applyMatrix4(P);la=da.vertexNormals;oa=0;for(ka=la.length;oa<ka;oa++)Da=n.vertexNormalsModel[oa],Da.copy(la[oa]),!1===ha&&(Ra===THREE.BackSide||Ra===THREE.DoubleSide)&&Da.negate(),Da.applyMatrix3(na),Da.normalize(),rb=n.vertexNormalsModelView[oa],rb.copy(Da),rb.applyMatrix3(qa);n.vertexNormalsLength=la.length;Ra=0;for(oa=ta.length;Ra<oa;Ra++)if(Da=ta[Ra][za],
|
|
|
+void 0!==Da){ka=0;for(la=Da.length;ka<la;ka++)n.uvs[Ra][ka]=Da[ka]}n.color=da.color;n.material=zb;J.copy(n.centroidModel);J.applyMatrix4(L);n.z=J.z;G.elements.push(n)}}}else if(va instanceof THREE.Line){aa.multiplyMatrices(L,P);za=va.geometry.vertices;oa=b();oa.positionScreen.copy(za[0]);oa.positionScreen.applyMatrix4(aa);lb=va.type===THREE.LinePieces?2:1;ra=1;for(da=za.length;ra<da;ra++)oa=b(),oa.positionScreen.copy(za[ra]),oa.positionScreen.applyMatrix4(aa),0<(ra+1)%lb||(ka=m[k-2],sa.copy(oa.positionScreen),
|
|
|
+ea.copy(ka.positionScreen),!0===d(sa,ea)&&(sa.multiplyScalar(1/sa.w),ea.multiplyScalar(1/ea.w),w===H?(ta=new THREE.RenderableLine,I.push(ta),H++,w++,z=ta):z=I[w++],z.v1.positionScreen.copy(sa),z.v2.positionScreen.copy(ea),z.z=Math.max(sa.z,ea.z),z.material=va.material,G.elements.push(z)))}g=0;for(p=G.sprites.length;g<p;g++)va=G.sprites[g].object,P=va.matrixWorld,va instanceof THREE.Particle&&(A.set(P.elements[12],P.elements[13],P.elements[14],1),A.applyMatrix4(L),A.z/=A.w,0<A.z&&1>A.z&&(y===F?(ha=
|
|
|
+new THREE.RenderableParticle,E.push(ha),F++,y++,D=ha):D=E[y++],D.object=va,D.x=A.x/A.w,D.y=A.y/A.w,D.z=A.z,D.rotation=va.rotation.z,D.scale.x=va.scale.x*Math.abs(D.x-(A.x+i.projectionMatrix.elements[0])/(A.w+i.projectionMatrix.elements[12])),D.scale.y=va.scale.y*Math.abs(D.y-(A.y+i.projectionMatrix.elements[5])/(A.w+i.projectionMatrix.elements[13])),D.material=va.material,G.elements.push(D)));!0===ya&&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};
|
|
|
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();
|
|
@@ -157,7 +157,7 @@ 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,i=this.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=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(h),i.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],h=g.faceNormals[c],k=g.vertexNormals[c],h.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,y){i=a.vertices[b];h=a.vertices[c];k=a.vertices[d];m=g[e];p=g[f];n=g[y];s=h.x-i.x;q=k.x-i.x;l=h.y-i.y;r=k.y-i.y;t=h.z-i.z;x=k.z-i.z;z=p.x-m.x;w=n.x-m.x;I=p.y-m.y;H=n.y-m.y;C=1/(z*H-w*I);G.set((H*s-I*q)*C,(H*l-I*r)*C,(H*t-I*x)*C);W.set((z*q-w*s)*C,(z*r-w*l)*C,(z*x-w*t)*C);E[b].add(G);E[c].add(G);E[d].add(G);F[b].add(W);F[c].add(W);F[d].add(W)}var b,c,d,e,f,g,i,h,k,m,p,n,s,q,l,r,t,x,z,w,I,H,C,y,E=[],F=[],G=new THREE.Vector3,W=new THREE.Vector3,A=new THREE.Vector3,X=new THREE.Vector3,B=new THREE.Vector3;
|
|
|
+b,c,d,e,f,y){i=a.vertices[b];h=a.vertices[c];k=a.vertices[d];m=g[e];p=g[f];n=g[y];s=h.x-i.x;q=k.x-i.x;l=h.y-i.y;r=k.y-i.y;t=h.z-i.z;x=k.z-i.z;z=p.x-m.x;w=n.x-m.x;I=p.y-m.y;H=n.y-m.y;D=1/(z*H-w*I);G.set((H*s-I*q)*D,(H*l-I*r)*D,(H*t-I*x)*D);W.set((z*q-w*s)*D,(z*r-w*l)*D,(z*x-w*t)*D);E[b].add(G);E[c].add(G);E[d].add(G);F[b].add(W);F[c].add(W);F[d].add(W)}var b,c,d,e,f,g,i,h,k,m,p,n,s,q,l,r,t,x,z,w,I,H,D,y,E=[],F=[],G=new THREE.Vector3,W=new THREE.Vector3,A=new THREE.Vector3,X=new THREE.Vector3,B=new THREE.Vector3;
|
|
|
b=0;for(c=this.vertices.length;b<c;b++)E[b]=new THREE.Vector3,F[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++)B.copy(f.vertexNormals[d]),e=f[K[d]],y=E[e],A.copy(y),A.sub(B.multiplyScalar(B.dot(y))).normalize(),
|
|
|
X.crossVectors(f.vertexNormals[d],y),e=X.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.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,i,h,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];
|
|
@@ -169,10 +169,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,i,h,k,m,p,n=new THREE.Vector3,s=new THREE.Vector3,q=new THREE.Vector3,l=new THREE.Vector3,r=new THREE.Vector3;if(this.attributes.index){var t=this.attributes.index.array,x=this.offsets;c=0;for(d=x.length;c<d;++c){b=x[c].start;g=x[c].count;var z=x[c].index;a=b;for(b+=g;a<b;a+=3)g=z+t[a],i=z+t[a+1],h=z+t[a+2],k=e[3*g],m=e[3*g+1],p=e[3*g+2],n.set(k,m,p),k=e[3*i],m=e[3*i+1],p=e[3*i+2],s.set(k,m,p),k=e[3*h],m=e[3*h+1],p=e[3*h+2],q.set(k,
|
|
|
m,p),l.subVectors(q,s),r.subVectors(n,s),l.cross(r),f[3*g]+=l.x,f[3*g+1]+=l.y,f[3*g+2]+=l.z,f[3*i]+=l.x,f[3*i+1]+=l.y,f[3*i+2]+=l.z,f[3*h]+=l.x,f[3*h+1]+=l.y,f[3*h+2]+=l.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],p=e[a+2],n.set(k,m,p),k=e[a+3],m=e[a+4],p=e[a+5],s.set(k,m,p),k=e[a+6],m=e[a+7],p=e[a+8],q.set(k,m,p),l.subVectors(q,s),r.subVectors(n,s),l.cross(r),f[a]=l.x,f[a+1]=l.y,f[a+2]=l.z,f[a+3]=l.x,f[a+4]=l.y,f[a+5]=l.z,f[a+6]=l.x,f[a+7]=l.y,f[a+8]=l.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){sa.x=d[3*a];sa.y=d[3*a+1];sa.z=d[3*a+2];La.copy(sa);ja=h[a];T.copy(ja);T.sub(sa.multiplyScalar(sa.dot(ja))).normalize();Z.crossVectors(La,ja);ia=Z.dot(k[a]);J=0>ia?-1:1;i[4*a]=T.x;i[4*a+1]=T.y;i[4*a+2]=T.z;i[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){na.x=d[3*a];na.y=d[3*a+1];na.z=d[3*a+2];qa.copy(na);ga=h[a];P.copy(ga);P.sub(na.multiplyScalar(na.dot(ga))).normalize();aa.crossVectors(qa,ga);sa=aa.dot(k[a]);J=0>sa?-1:1;i[4*a]=P.x;i[4*a+1]=P.y;i[4*a+2]=P.z;i[4*a+3]=J}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 i=this.attributes.tangent.array,h=[],k=[],g=0;g<f;g++)h[g]=
|
|
|
-new THREE.Vector3,k[g]=new THREE.Vector3;var m,p,n,s,q,l,r,t,x,z,w,I,H,C,y,f=new THREE.Vector3,g=new THREE.Vector3,E,F,G,W,A,X,B,K=this.offsets;G=0;for(W=K.length;G<W;++G){F=K[G].start;A=K[G].count;var L=K[G].index;E=F;for(F+=A;E<F;E+=3)A=L+b[E],X=L+b[E+1],B=L+b[E+2],m=c[3*A],p=c[3*A+1],n=c[3*A+2],s=c[3*X],q=c[3*X+1],l=c[3*X+2],r=c[3*B],t=c[3*B+1],x=c[3*B+2],z=e[2*A],w=e[2*A+1],I=e[2*X],H=e[2*X+1],C=e[2*B],y=e[2*B+1],s-=m,m=r-m,q-=p,p=t-p,l-=n,n=x-n,I-=z,z=C-z,H-=w,w=y-w,y=1/(I*w-z*H),f.set((w*s-
|
|
|
-H*m)*y,(w*q-H*p)*y,(w*l-H*n)*y),g.set((I*m-z*s)*y,(I*p-z*q)*y,(I*n-z*l)*y),h[A].add(f),h[X].add(f),h[B].add(f),k[A].add(g),k[X].add(g),k[B].add(g)}var T=new THREE.Vector3,Z=new THREE.Vector3,sa=new THREE.Vector3,La=new THREE.Vector3,J,ja,ia;G=0;for(W=K.length;G<W;++G){F=K[G].start;A=K[G].count;L=K[G].index;E=F;for(F+=A;E<F;E+=3)A=L+b[E],X=L+b[E+1],B=L+b[E+2],a(A),a(X),a(B)}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 m,p,n,s,q,l,r,t,x,z,w,I,H,D,y,f=new THREE.Vector3,g=new THREE.Vector3,E,F,G,W,A,X,B,K=this.offsets;G=0;for(W=K.length;G<W;++G){F=K[G].start;A=K[G].count;var L=K[G].index;E=F;for(F+=A;E<F;E+=3)A=L+b[E],X=L+b[E+1],B=L+b[E+2],m=c[3*A],p=c[3*A+1],n=c[3*A+2],s=c[3*X],q=c[3*X+1],l=c[3*X+2],r=c[3*B],t=c[3*B+1],x=c[3*B+2],z=e[2*A],w=e[2*A+1],I=e[2*X],H=e[2*X+1],D=e[2*B],y=e[2*B+1],s-=m,m=r-m,q-=p,p=t-p,l-=n,n=x-n,I-=z,z=D-z,H-=w,w=y-w,y=1/(I*w-z*H),f.set((w*s-
|
|
|
+H*m)*y,(w*q-H*p)*y,(w*l-H*n)*y),g.set((I*m-z*s)*y,(I*p-z*q)*y,(I*n-z*l)*y),h[A].add(f),h[X].add(f),h[B].add(f),k[A].add(g),k[X].add(g),k[B].add(g)}var P=new THREE.Vector3,aa=new THREE.Vector3,na=new THREE.Vector3,qa=new THREE.Vector3,J,ga,sa;G=0;for(W=K.length;G<W;++G){F=K[G].start;A=K[G].count;L=K[G].index;E=F;for(F+=A;E<F;E+=3)A=L+b[E],X=L+b[E+1],B=L+b[E+2],a(A),a(X),a(B)}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=
|
|
@@ -188,11 +188,11 @@ a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(
|
|
|
k.uSpecularColor.value.setHex(h.specular),k.uAmbientColor.value.setHex(h.ambient),k.uShininess.value=h.shininess,void 0!==h.opacity&&(k.uOpacity.value=h.opacity),i=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0}),h.transparent&&(i.transparent=!0)):i=new THREE[i](h);void 0!==a.DbgName&&(i.name=a.DbgName);return i}};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.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var i=JSON.parse(f.responseText);a.createModel(i,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.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,i,h,k,m,p,n,s,q,l,r,t,x,z,w=a.faces;q=a.vertices;var I=a.normals,H=a.colors,C=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&C++;for(f=0;f<C;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];h=0;for(k=q.length;h<k;)m=new THREE.Vector3,m.x=q[h++]*e,m.y=q[h++]*e,m.z=q[h++]*e,d.vertices.push(m);h=0;for(k=w.length;h<k;){q=w[h++];m=q&1;i=q&2;f=q&4;g=q&8;n=q&16;p=q&32;l=q&64;q&=128;m?(r=new THREE.Face4,
|
|
|
-r.a=w[h++],r.b=w[h++],r.c=w[h++],r.d=w[h++],m=4):(r=new THREE.Face3,r.a=w[h++],r.b=w[h++],r.c=w[h++],m=3);i&&(i=w[h++],r.materialIndex=i);i=d.faces.length;if(f)for(f=0;f<C;f++)t=a.uvs[f],s=w[h++],z=t[2*s],s=t[2*s+1],d.faceUvs[f][i]=new THREE.Vector2(z,s);if(g)for(f=0;f<C;f++){t=a.uvs[f];x=[];for(g=0;g<m;g++)s=w[h++],z=t[2*s],s=t[2*s+1],x[g]=new THREE.Vector2(z,s);d.faceVertexUvs[f][i]=x}n&&(n=3*w[h++],g=new THREE.Vector3,g.x=I[n++],g.y=I[n++],g.z=I[n],r.normal=g);if(p)for(f=0;f<m;f++)n=3*w[h++],g=
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,i,h,k,m,p,n,s,q,l,r,t,x,z,w=a.faces;q=a.vertices;var I=a.normals,H=a.colors,D=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&D++;for(f=0;f<D;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];h=0;for(k=q.length;h<k;)m=new THREE.Vector3,m.x=q[h++]*e,m.y=q[h++]*e,m.z=q[h++]*e,d.vertices.push(m);h=0;for(k=w.length;h<k;){q=w[h++];m=q&1;i=q&2;f=q&4;g=q&8;n=q&16;p=q&32;l=q&64;q&=128;m?(r=new THREE.Face4,
|
|
|
+r.a=w[h++],r.b=w[h++],r.c=w[h++],r.d=w[h++],m=4):(r=new THREE.Face3,r.a=w[h++],r.b=w[h++],r.c=w[h++],m=3);i&&(i=w[h++],r.materialIndex=i);i=d.faces.length;if(f)for(f=0;f<D;f++)t=a.uvs[f],s=w[h++],z=t[2*s],s=t[2*s+1],d.faceUvs[f][i]=new THREE.Vector2(z,s);if(g)for(f=0;f<D;f++){t=a.uvs[f];x=[];for(g=0;g<m;g++)s=w[h++],z=t[2*s],s=t[2*s+1],x[g]=new THREE.Vector2(z,s);d.faceVertexUvs[f][i]=x}n&&(n=3*w[h++],g=new THREE.Vector3,g.x=I[n++],g.y=I[n++],g.z=I[n],r.normal=g);if(p)for(f=0;f<m;f++)n=3*w[h++],g=
|
|
|
new THREE.Vector3,g.x=I[n++],g.y=I[n++],g.z=I[n],r.vertexNormals.push(g);l&&(p=w[h++],p=new THREE.Color(H[p]),r.color=p);if(q)for(f=0;f<m;f++)p=w[h++],p=new THREE.Color(H[p]),r.vertexColors.push(p);d.faces.push(r)}if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2)w=a.skinWeights[h],I=a.skinWeights[h+1],d.skinWeights.push(new THREE.Vector4(w,I,0,0))}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2)w=a.skinIndices[h],I=a.skinIndices[h+1],d.skinIndices.push(new THREE.Vector4(w,I,0,0))}d.bones=
|
|
|
-a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){h=0;for(k=a.morphTargets.length;h<k;h++){d.morphTargets[h]={};d.morphTargets[h].name=a.morphTargets[h].name;d.morphTargets[h].vertices=[];H=d.morphTargets[h].vertices;C=a.morphTargets[h].vertices;w=0;for(I=C.length;w<I;w+=3)q=new THREE.Vector3,q.x=C[w]*e,q.y=C[w+1]*e,q.z=C[w+2]*e,H.push(q)}}if(void 0!==a.morphColors){h=0;for(k=a.morphColors.length;h<k;h++){d.morphColors[h]={};d.morphColors[h].name=a.morphColors[h].name;d.morphColors[h].colors=
|
|
|
-[];I=d.morphColors[h].colors;H=a.morphColors[h].colors;e=0;for(w=H.length;e<w;e+=3)C=new THREE.Color(16755200),C.setRGB(H[e],H[e+1],H[e+2]),I.push(C)}}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;
|
|
|
+a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){h=0;for(k=a.morphTargets.length;h<k;h++){d.morphTargets[h]={};d.morphTargets[h].name=a.morphTargets[h].name;d.morphTargets[h].vertices=[];H=d.morphTargets[h].vertices;D=a.morphTargets[h].vertices;w=0;for(I=D.length;w<I;w+=3)q=new THREE.Vector3,q.x=D[w]*e,q.y=D[w+1]*e,q.z=D[w+2]*e,H.push(q)}}if(void 0!==a.morphColors){h=0;for(k=a.morphColors.length;h<k;h++){d.morphColors[h]={};d.morphColors[h].name=a.morphColors[h].name;d.morphColors[h].colors=
|
|
|
+[];I=d.morphColors[h].colors;H=a.morphColors[h].colors;e=0;for(w=H.length;e<w;e+=3)D=new THREE.Color(16755200),D.setRGB(H[e],H[e+1],H[e+2]),I.push(D)}}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:p+"/"+a}function e(){f(y.scene,F.objects)}function f(a,b){var c,e,g,h,k,p;for(p in b)if(void 0===y.objects[p]){var l=b[p],r=null;if(l.type&&l.type in m.hierarchyHandlerMap){if(void 0===l.loading){c={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};e={};for(var w in l)w in c||(e[w]=l[w]);s=y.materials[l.material];l.loading=!0;
|
|
@@ -201,13 +201,13 @@ if(s instanceof THREE.MeshFaceMaterial)for(var A=0;A<s.materials.length;A++)r=r|
|
|
|
c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(r.position.set(e[0],e[1],e[2]),k?(r.quaternion.set(k[0],k[1],k[2],k[3]),r.useQuaternion=!0):r.rotation.set(g[0],g[1],g[2]),r.scale.set(h[0],h[1],h[2]));r.visible=l.visible;r.castShadow=l.castShadow;r.receiveShadow=l.receiveShadow;a.add(r);y.objects[p]=r}}else"DirectionalLight"===l.type||"PointLight"===l.type||"AmbientLight"===l.type?(x=void 0!==l.color?l.color:16777215,z=void 0!==l.intensity?l.intensity:1,"DirectionalLight"===l.type?(e=l.direction,
|
|
|
t=new THREE.DirectionalLight(x,z),t.position.set(e[0],e[1],e[2]),l.target&&(E.push({object:t,targetName:l.target}),t.target=null)):"PointLight"===l.type?(e=l.position,c=l.distance,t=new THREE.PointLight(x,z,c),t.position.set(e[0],e[1],e[2])):"AmbientLight"===l.type&&(t=new THREE.AmbientLight(x)),a.add(t),t.name=p,y.lights[p]=t,y.objects[p]=t):"PerspectiveCamera"===l.type||"OrthographicCamera"===l.type?("PerspectiveCamera"===l.type?q=new THREE.PerspectiveCamera(l.fov,l.aspect,l.near,l.far):"OrthographicCamera"===
|
|
|
l.type&&(q=new THREE.OrthographicCamera(l.left,l.right,l.top,l.bottom,l.near,l.far)),e=l.position,q.position.set(e[0],e[1],e[2]),a.add(q),q.name=p,y.cameras[p]=q,y.objects[p]=q):(e=l.position,g=l.rotation,h=l.scale,k=l.quaternion,r=new THREE.Object3D,r.name=p,r.position.set(e[0],e[1],e[2]),k?(r.quaternion.set(k[0],k[1],k[2],k[3]),r.useQuaternion=!0):r.rotation.set(g[0],g[1],g[2]),r.scale.set(h[0],h[1],h[2]),r.visible=void 0!==l.visible?l.visible:!1,a.add(r),y.objects[p]=r,y.empties[p]=r);if(r){if(void 0!==
|
|
|
-l.properties)for(var B in l.properties)r.properties[B]=l.properties[B];void 0!==l.children&&f(r,l.children)}}}function g(a){return function(b,c){y.geometries[a]=b;y.face_materials[a]=c;e();w-=1;m.onLoadComplete();k()}}function i(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,i=d.rotation,h=d.quaternion,l=d.scale;f.position.set(g[0],g[1],g[2]);h?(f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0):f.rotation.set(i[0],i[1],i[2]);f.scale.set(l[0],l[1],l[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;y.objects[a]=f;e();w-=1;m.onLoadComplete();k()}}function h(a){return function(b,c){y.geometries[a]=b;y.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:H,totalTextures:C,loadedModels:H-w,loadedTextures:C-I},y);m.onLoadProgress();if(0===w&&0===I){for(var a=0;a<E.length;a++){var c=E[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,
|
|
|
-y.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(y)}}var m=this,p=THREE.Loader.prototype.extractUrlBase(c),n,s,q,l,r,t,x,z,w,I,H,C,y,E=[],F=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;I=w=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
+l.properties)for(var D in l.properties)r.properties[D]=l.properties[D];void 0!==l.children&&f(r,l.children)}}}function g(a){return function(b,c){y.geometries[a]=b;y.face_materials[a]=c;e();w-=1;m.onLoadComplete();k()}}function i(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,i=d.rotation,h=d.quaternion,l=d.scale;f.position.set(g[0],g[1],g[2]);h?(f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0):f.rotation.set(i[0],i[1],i[2]);f.scale.set(l[0],l[1],l[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;y.objects[a]=f;e();w-=1;m.onLoadComplete();k()}}function h(a){return function(b,c){y.geometries[a]=b;y.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:H,totalTextures:D,loadedModels:H-w,loadedTextures:D-I},y);m.onLoadProgress();if(0===w&&0===I){for(var a=0;a<E.length;a++){var c=E[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,
|
|
|
+y.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(y)}}var m=this,p=THREE.Loader.prototype.extractUrlBase(c),n,s,q,l,r,t,x,z,w,I,H,D,y,E=[],F=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;I=w=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(F.transform&&(G=F.transform.position,a=F.transform.rotation,c=F.transform.scale,G&&y.scene.position.set(G[0],G[1],G[2]),a&&y.scene.rotation.set(a[0],a[1],a[2]),c&&y.scene.scale.set(c[0],c[1],c[2]),G||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();G=function(a){return function(){I-=a;k();m.onLoadComplete()}};for(var W in F.fogs)a=F.fogs[W],"linear"===a.type?l=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(l=new THREE.FogExp2(0,a.density)),
|
|
|
a=a.color,l.color.setRGB(a[0],a[1],a[2]),y.fogs[W]=l;for(var A in F.geometries)l=F.geometries[A],l.type in this.geometryHandlerMap&&(w+=1,m.onLoadStart());for(var X in F.objects)l=F.objects[X],l.type&&l.type in this.hierarchyHandlerMap&&(w+=1,m.onLoadStart());H=w;for(A in F.geometries)if(l=F.geometries[A],"cube"===l.type)n=new THREE.CubeGeometry(l.width,l.height,l.depth,l.widthSegments,l.heightSegments,l.depthSegments),y.geometries[A]=n;else if("plane"===l.type)n=new THREE.PlaneGeometry(l.width,l.height,
|
|
|
l.widthSegments,l.heightSegments),y.geometries[A]=n;else if("sphere"===l.type)n=new THREE.SphereGeometry(l.radius,l.widthSegments,l.heightSegments),y.geometries[A]=n;else if("cylinder"===l.type)n=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),y.geometries[A]=n;else if("torus"===l.type)n=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),y.geometries[A]=n;else if("icosahedron"===l.type)n=new THREE.IcosahedronGeometry(l.radius,l.subdivisions),y.geometries[A]=
|
|
|
-n;else if(l.type in this.geometryHandlerMap){X={};for(r in l)"type"!==r&&"url"!==r&&(X[r]=l[r]);this.geometryHandlerMap[l.type].loaderObject.load(d(l.url,F.urlBaseType),g(A),X)}else"embedded"===l.type&&(X=F.embeds[l.id],X.metadata=F.metadata,X&&this.geometryHandlerMap.ascii.loaderObject.createModel(X,h(A),""));for(var B in F.textures)if(A=F.textures[B],A.url instanceof Array){I+=A.url.length;for(r=0;r<A.url.length;r++)m.onLoadStart()}else I+=1,m.onLoadStart();C=I;for(B in F.textures){A=F.textures[B];
|
|
|
+n;else if(l.type in this.geometryHandlerMap){X={};for(r in l)"type"!==r&&"url"!==r&&(X[r]=l[r]);this.geometryHandlerMap[l.type].loaderObject.load(d(l.url,F.urlBaseType),g(A),X)}else"embedded"===l.type&&(X=F.embeds[l.id],X.metadata=F.metadata,X&&this.geometryHandlerMap.ascii.loaderObject.createModel(X,h(A),""));for(var B in F.textures)if(A=F.textures[B],A.url instanceof Array){I+=A.url.length;for(r=0;r<A.url.length;r++)m.onLoadStart()}else I+=1,m.onLoadStart();D=I;for(B in F.textures){A=F.textures[B];
|
|
|
void 0!==A.mapping&&void 0!==THREE[A.mapping]&&(A.mapping=new THREE[A.mapping]);if(A.url instanceof Array){X=A.url.length;l=[];for(r=0;r<X;r++)l[r]=d(A.url[r],F.urlBaseType);r=(r=l[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(l,A.mapping,G(X)):THREE.ImageUtils.loadTextureCube(l,A.mapping,G(X))}else r=A.url.toLowerCase().endsWith(".dds"),X=d(A.url,F.urlBaseType),l=G(1),r=r?THREE.ImageUtils.loadCompressedTexture(X,A.mapping,l):THREE.ImageUtils.loadTexture(X,A.mapping,l),void 0!==
|
|
|
THREE[A.minFilter]&&(r.minFilter=THREE[A.minFilter]),void 0!==THREE[A.magFilter]&&(r.magFilter=THREE[A.magFilter]),A.anisotropy&&(r.anisotropy=A.anisotropy),A.repeat&&(r.repeat.set(A.repeat[0],A.repeat[1]),1!==A.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==A.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),A.offset&&r.offset.set(A.offset[0],A.offset[1]),A.wrap&&(X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==X[A.wrap[0]]&&(r.wrapS=X[A.wrap[0]]),void 0!==X[A.wrap[1]]&&(r.wrapT=
|
|
|
X[A.wrap[1]]));y.textures[B]=r}var K,L;for(K in F.materials){B=F.materials[K];for(L in B.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?B.parameters[L]=y.textures[B.parameters[L]]:"shading"===L?B.parameters[L]="flat"===B.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?B.parameters[L]="double"==B.parameters[L]?THREE.DoubleSide:"back"==B.parameters[L]?THREE.BackSide:THREE.FrontSide:"blending"===L?B.parameters[L]=B.parameters[L]in THREE?THREE[B.parameters[L]]:THREE.NormalBlending:
|
|
@@ -259,35 +259,35 @@ THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInver
|
|
|
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){x!==a&&(x=l.globalAlpha=a)}function c(a){z!==a&&(a===THREE.NormalBlending?l.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?l.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(l.globalCompositeOperation="darker"),z=a)}function d(a){w!==a&&(w=l.strokeStyle=a)}function e(a){I!==a&&(I=l.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,i,h,k=new THREE.Projector,m=void 0!==a.canvas?a.canvas:
|
|
|
-document.createElement("canvas"),p,n,s,q,l=m.getContext("2d"),r=new THREE.Color(0),t=0,x=1,z=0,w=null,I=null,H=null,C=null,y=null,E,F,G,W,A=new THREE.RenderableVertex,X=new THREE.RenderableVertex,B,K,L,T,Z,sa,La,J,ja,ia,Pa,M,ha=new THREE.Color,ta=new THREE.Color,oa=new THREE.Color,da=new THREE.Color,ra=new THREE.Color,$=new THREE.Color,la=new THREE.Color,jb=new THREE.Color,Ea={},ma={},wa,xa,ea,Ua,Bb,qb,Sa,rb,jc,kc,eb=new THREE.Box2,Na=new THREE.Box2,Va=new THREE.Box2,Cb=!1,Ta=new THREE.Color,Kb=new THREE.Color,
|
|
|
-Lb=new THREE.Color,kb=new THREE.Vector3,yb,Mb,rc,lb,ya,$a,mb=16;yb=document.createElement("canvas");yb.width=yb.height=2;Mb=yb.getContext("2d");Mb.fillStyle="rgba(0,0,0,1)";Mb.fillRect(0,0,2,2);rc=Mb.getImageData(0,0,2,2);lb=rc.data;ya=document.createElement("canvas");ya.width=ya.height=mb;$a=ya.getContext("2d");$a.translate(-mb/2,-mb/2);$a.scale(mb,mb);mb--;this.domElement=m;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;n=b*this.devicePixelRatio;s=Math.floor(p/2);q=Math.floor(n/2);m.width=p;m.height=n;m.style.width=a+"px";m.style.height=b+"px";eb.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q));Na.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q));x=1;z=0;y=C=H=I=w=null};this.setClearColor=
|
|
|
-function(a,b){r.copy(a);t=void 0!==b?b:1;Na.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q))};this.setClearColorHex=function(a,b){r.setHex(a);t=void 0!==b?b:1;Na.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){l.setTransform(1,0,0,-1,s,q);!1===Na.empty()&&(Na.intersect(eb),Na.expandByScalar(2),1>t&&l.clearRect(Na.min.x|0,Na.min.y|0,Na.max.x-Na.min.x|0,Na.max.y-Na.min.y|0),0<t&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*
|
|
|
-r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*r.b)+","+t+")"),l.fillRect(Na.min.x|0,Na.min.y|0,Na.max.x-Na.min.x|0,Na.max.y-Na.min.y|0)),Na.makeEmpty())};this.render=function(a,m){function n(a,b,c){for(var d=0,e=h.length;d<e;d++){var f=h[d];jb.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=f.matrixWorld.getPosition().normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(jb.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=f.matrixWorld.getPosition(),j=b.dot(kb.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(jb.multiplyScalar(j)))))}}function p(a,d,e,g,j,i,h,Y){f.info.render.vertices+=3;f.info.render.faces++;b(Y.opacity);c(Y.blending);B=a.positionScreen.x;K=a.positionScreen.y;L=d.positionScreen.x;T=d.positionScreen.y;Z=e.positionScreen.x;sa=e.positionScreen.y;r(B,K,L,T,Z,sa);(Y instanceof THREE.MeshLambertMaterial||Y instanceof THREE.MeshPhongMaterial)&&null===Y.map&&null===Y.map?($.copy(Y.color),la.copy(Y.emissive),
|
|
|
-Y.vertexColors===THREE.FaceColors&&$.multiply(h.color),!0===Cb?!1===Y.wireframe&&Y.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(ta.copy(Ta),oa.copy(Ta),da.copy(Ta),n(h.v1.positionWorld,h.vertexNormalsModel[0],ta),n(h.v2.positionWorld,h.vertexNormalsModel[1],oa),n(h.v3.positionWorld,h.vertexNormalsModel[2],da),ta.multiply($).add(la),oa.multiply($).add(la),da.multiply($).add(la),ra.addColors(oa,da).multiplyScalar(0.5),ea=fb(ta,oa,da,ra),I(B,K,L,T,Z,sa,0,0,1,0,0,1,ea)):(ha.copy(Ta),n(h.centroidModel,
|
|
|
-h.normalModel,ha),ha.multiply($).add(la),!0===Y.wireframe?x(ha,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):w(ha)):!0===Y.wireframe?x(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):w(Y.color)):Y instanceof THREE.MeshBasicMaterial||Y instanceof THREE.MeshLambertMaterial||Y instanceof THREE.MeshPhongMaterial?null!==Y.map?Y.map.mapping instanceof THREE.UVMapping&&(Ua=h.uvs[0],z(B,K,L,T,Z,sa,Ua[g].x,Ua[g].y,Ua[j].x,Ua[j].y,Ua[i].x,Ua[i].y,Y.map)):null!==Y.envMap?
|
|
|
-Y.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(kb.copy(h.vertexNormalsModelView[g]),Bb=0.5*kb.x+0.5,qb=0.5*kb.y+0.5,kb.copy(h.vertexNormalsModelView[j]),Sa=0.5*kb.x+0.5,rb=0.5*kb.y+0.5,kb.copy(h.vertexNormalsModelView[i]),jc=0.5*kb.x+0.5,kc=0.5*kb.y+0.5,z(B,K,L,T,Z,sa,Bb,qb,Sa,rb,jc,kc,Y.envMap)):(ha.copy(Y.color),Y.vertexColors===THREE.FaceColors&&ha.multiply(h.color),!0===Y.wireframe?x(ha,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):w(ha)):Y instanceof THREE.MeshDepthMaterial?
|
|
|
-(wa=m.near,xa=m.far,j=1-ab(a.positionScreen.z*a.positionScreen.w,wa,xa),ta.setRGB(j,j,j),j=1-ab(d.positionScreen.z*d.positionScreen.w,wa,xa),oa.setRGB(j,j,j),j=1-ab(e.positionScreen.z*e.positionScreen.w,wa,xa),da.setRGB(j,j,j),ra.addColors(oa,da).multiplyScalar(0.5),ea=fb(ta,oa,da,ra),I(B,K,L,T,Z,sa,0,0,1,0,0,1,ea)):Y instanceof THREE.MeshNormalMaterial&&(Y.shading==THREE.FlatShading?(d=h.normalModelView,ha.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===Y.wireframe?x(ha,Y.wireframeLinewidth,
|
|
|
-Y.wireframeLinecap,Y.wireframeLinejoin):w(ha)):Y.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[g],ta.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],oa.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[i],da.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ra.addColors(oa,da).multiplyScalar(0.5),ea=fb(ta,oa,da,ra),I(B,K,L,T,Z,sa,0,0,1,0,0,1,ea)))}function r(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);
|
|
|
-l.lineTo(e,f);l.closePath()}function t(a,b,c,d,e,f,g,j){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,j);l.closePath()}function x(a,b,c,e){H!==b&&(H=l.lineWidth=b);C!==c&&(C=l.lineCap=c);y!==e&&(y=l.lineJoin=e);d(a.getStyle());l.stroke();Va.expandByScalar(2*b)}function w(a){e(a.getStyle());l.fill()}function z(a,b,c,d,f,g,j,h,i,Y,k,m,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==
|
|
|
-THREE.RepeatWrapping;Ea[n.id]=l.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ea[n.id]?e("rgba(0,0,0,1)"):e(Ea[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,r=n.image.height*n.repeat.y,j=(j+p)*s,h=(1-h+q)*r,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*s-j,Y=(1-Y+q)*r-h,k=(k+p)*s-j,m=(1-m+q)*r-h,p=i*m-k*Y;0===p?(void 0===ma[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,
|
|
|
-b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ma[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ma[n.id],j=4*(Math.floor(j)+Math.floor(h)*n.image.width),ha.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255),w(ha)):(p=1/p,n=(m*c-Y*f)*p,Y=(m*d-Y*g)*p,c=(i*f-k*c)*p,d=(i*g-k*d)*p,a=a-n*j-c*h,j=b-Y*j-d*h,l.save(),l.transform(n,Y,c,d,a,j),l.fill(),l.restore())}}function I(a,b,c,d,e,f,g,j,h,i,Y,k,n){var m,p;m=n.width-1;p=n.height-1;g*=m;j*=p;c-=a;d-=b;e-=a;f-=b;h=h*m-g;i=i*p-
|
|
|
-j;Y=Y*m-g;k=k*p-j;p=1/(h*k-Y*i);m=(k*c-i*e)*p;i=(k*d-i*f)*p;c=(h*e-Y*c)*p;d=(h*f-Y*d)*p;a=a-m*g-c*j;b=b-i*g-d*j;l.save();l.transform(m,i,c,d,a,b);l.clip();l.drawImage(n,0,0);l.restore()}function fb(a,b,c,d){lb[0]=255*a.r|0;lb[1]=255*a.g|0;lb[2]=255*a.b|0;lb[4]=255*b.r|0;lb[5]=255*b.g|0;lb[6]=255*b.b|0;lb[8]=255*c.r|0;lb[9]=255*c.g|0;lb[10]=255*c.b|0;lb[12]=255*d.r|0;lb[13]=255*d.g|0;lb[14]=255*d.b|0;Mb.putImageData(rc,0,0);$a.drawImage(yb,0,0);return ya}function ab(a,b,c){a=(a-b)/(c-b);return a*a*
|
|
|
-(3-2*a)}function tb(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===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();l.setTransform(1,0,0,-1,s,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,m,this.sortObjects,this.sortElements);i=g.elements;h=g.lights;Cb=0<h.length;if(!0===Cb){Ta.setRGB(0,0,0);Kb.setRGB(0,0,0);
|
|
|
-Lb.setRGB(0,0,0);for(var mb=0,dc=h.length;mb<dc;mb++){var U=h[mb],S=U.color;U instanceof THREE.AmbientLight?Ta.add(S):U instanceof THREE.DirectionalLight?Kb.add(S):U instanceof THREE.PointLight&&Lb.add(S)}}mb=0;for(dc=i.length;mb<dc;mb++){var ga=i[mb],U=ga.material;if(!(void 0===U||!1===U.visible)){Va.makeEmpty();if(ga instanceof THREE.RenderableParticle){E=ga;E.x*=s;E.y*=q;var S=E,Wa=ga;b(U.opacity);c(U.blending);var pb=void 0,gb=void 0,Qa=void 0,Xa=void 0,Y=ga=void 0,ed=void 0;U instanceof THREE.ParticleBasicMaterial?
|
|
|
-null===U.map?(Qa=Wa.object.scale.x,Xa=Wa.object.scale.y,Qa*=Wa.scale.x*s,Xa*=Wa.scale.y*q,Va.min.set(S.x-Qa,S.y-Xa),Va.max.set(S.x+Qa,S.y+Xa),!1!==eb.isIntersectionBox(Va)&&(e(U.color.getStyle()),l.save(),l.translate(S.x,S.y),l.rotate(-Wa.rotation),l.scale(Qa,Xa),l.fillRect(-1,-1,2,2),l.restore())):(ga=U.map.image,Y=ga.width>>1,ed=ga.height>>1,Qa=Wa.scale.x*s,Xa=Wa.scale.y*q,pb=Qa*Y,gb=Xa*ed,Va.min.set(S.x-pb,S.y-gb),Va.max.set(S.x+pb,S.y+gb),!1!==eb.isIntersectionBox(Va)&&(l.save(),l.translate(S.x,
|
|
|
-S.y),l.rotate(-Wa.rotation),l.scale(Qa,-Xa),l.translate(-Y,-ed),l.drawImage(ga,0,0),l.restore())):U instanceof THREE.ParticleCanvasMaterial&&(pb=Wa.scale.x*s,gb=Wa.scale.y*q,Va.min.set(S.x-pb,S.y-gb),Va.max.set(S.x+pb,S.y+gb),!1!==eb.isIntersectionBox(Va)&&(d(U.color.getStyle()),e(U.color.getStyle()),l.save(),l.translate(S.x,S.y),l.rotate(-Wa.rotation),l.scale(pb,gb),U.program(l),l.restore()))}else if(ga instanceof THREE.RenderableLine)E=ga.v1,F=ga.v2,E.positionScreen.x*=s,E.positionScreen.y*=q,F.positionScreen.x*=
|
|
|
-s,F.positionScreen.y*=q,Va.setFromPoints([E.positionScreen,F.positionScreen]),!0===eb.isIntersectionBox(Va)&&(S=E,Wa=F,b(U.opacity),c(U.blending),l.beginPath(),l.moveTo(S.positionScreen.x,S.positionScreen.y),l.lineTo(Wa.positionScreen.x,Wa.positionScreen.y),U instanceof THREE.LineBasicMaterial&&(S=U.linewidth,H!==S&&(H=l.lineWidth=S),S=U.linecap,C!==S&&(C=l.lineCap=S),S=U.linejoin,y!==S&&(y=l.lineJoin=S),d(U.color.getStyle()),l.stroke(),Va.expandByScalar(2*U.linewidth)));else if(ga instanceof THREE.RenderableFace3){E=
|
|
|
-ga.v1;F=ga.v2;G=ga.v3;if(-1>E.positionScreen.z||1<E.positionScreen.z)continue;if(-1>F.positionScreen.z||1<F.positionScreen.z)continue;if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;E.positionScreen.x*=s;E.positionScreen.y*=q;F.positionScreen.x*=s;F.positionScreen.y*=q;G.positionScreen.x*=s;G.positionScreen.y*=q;!0===U.overdraw&&(tb(E.positionScreen,F.positionScreen),tb(F.positionScreen,G.positionScreen),tb(G.positionScreen,E.positionScreen));Va.setFromPoints([E.positionScreen,F.positionScreen,
|
|
|
-G.positionScreen]);p(E,F,G,0,1,2,ga,U,a)}else if(ga instanceof THREE.RenderableFace4){E=ga.v1;F=ga.v2;G=ga.v3;W=ga.v4;if(-1>E.positionScreen.z||1<E.positionScreen.z)continue;if(-1>F.positionScreen.z||1<F.positionScreen.z)continue;if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;E.positionScreen.x*=s;E.positionScreen.y*=q;F.positionScreen.x*=s;F.positionScreen.y*=q;G.positionScreen.x*=s;G.positionScreen.y*=q;W.positionScreen.x*=s;W.positionScreen.y*=
|
|
|
-q;A.positionScreen.copy(F.positionScreen);X.positionScreen.copy(W.positionScreen);!0===U.overdraw&&(tb(E.positionScreen,F.positionScreen),tb(F.positionScreen,W.positionScreen),tb(W.positionScreen,E.positionScreen),tb(G.positionScreen,A.positionScreen),tb(G.positionScreen,X.positionScreen));Va.setFromPoints([E.positionScreen,F.positionScreen,G.positionScreen,W.positionScreen]);S=E;Wa=F;pb=G;gb=W;Qa=A;Xa=X;Y=a;f.info.render.vertices+=4;f.info.render.faces++;b(U.opacity);c(U.blending);void 0!==U.map&&
|
|
|
-null!==U.map||void 0!==U.envMap&&null!==U.envMap?(p(S,Wa,gb,0,1,3,ga,U,Y),p(Qa,pb,Xa,1,2,3,ga,U,Y)):(B=S.positionScreen.x,K=S.positionScreen.y,L=Wa.positionScreen.x,T=Wa.positionScreen.y,Z=pb.positionScreen.x,sa=pb.positionScreen.y,La=gb.positionScreen.x,J=gb.positionScreen.y,ja=Qa.positionScreen.x,ia=Qa.positionScreen.y,Pa=Xa.positionScreen.x,M=Xa.positionScreen.y,U instanceof THREE.MeshLambertMaterial||U instanceof THREE.MeshPhongMaterial?($.copy(U.color),la.copy(U.emissive),U.vertexColors===THREE.FaceColors&&
|
|
|
-$.multiply(ga.color),!0===Cb?!1===U.wireframe&&U.shading==THREE.SmoothShading&&4==ga.vertexNormalsLength?(ta.copy(Ta),oa.copy(Ta),da.copy(Ta),ra.copy(Ta),n(ga.v1.positionWorld,ga.vertexNormalsModel[0],ta),n(ga.v2.positionWorld,ga.vertexNormalsModel[1],oa),n(ga.v4.positionWorld,ga.vertexNormalsModel[3],da),n(ga.v3.positionWorld,ga.vertexNormalsModel[2],ra),ta.multiply($).add(la),oa.multiply($).add(la),da.multiply($).add(la),ra.multiply($).add(la),ea=fb(ta,oa,da,ra),r(B,K,L,T,La,J),I(B,K,L,T,La,J,0,
|
|
|
-0,1,0,0,1,ea),r(ja,ia,Z,sa,Pa,M),I(ja,ia,Z,sa,Pa,M,1,0,1,1,0,1,ea)):(ha.copy(Ta),n(ga.centroidModel,ga.normalModel,ha),ha.multiply($).add(la),t(B,K,L,T,Z,sa,La,J),!0===U.wireframe?x(ha,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):w(ha)):(ha.addColors($,la),t(B,K,L,T,Z,sa,La,J),!0===U.wireframe?x(ha,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):w(ha))):U instanceof THREE.MeshBasicMaterial?(ha.copy(U.color),U.vertexColors===THREE.FaceColors&&ha.multiply(ga.color),t(B,
|
|
|
-K,L,T,Z,sa,La,J),!0===U.wireframe?x(ha,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):w(ha)):U instanceof THREE.MeshNormalMaterial?(S=void 0,U.shading==THREE.FlatShading?(S=ga.normalModelView,ha.setRGB(S.x,S.y,S.z).multiplyScalar(0.5).addScalar(0.5),t(B,K,L,T,Z,sa,La,J),!0===U.wireframe?x(ha,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):w(ha)):U.shading==THREE.SmoothShading&&(S=ga.vertexNormalsModelView[0],ta.setRGB(S.x,S.y,S.z).multiplyScalar(0.5).addScalar(0.5),S=ga.vertexNormalsModelView[1],
|
|
|
-oa.setRGB(S.x,S.y,S.z).multiplyScalar(0.5).addScalar(0.5),S=ga.vertexNormalsModelView[3],da.setRGB(S.x,S.y,S.z).multiplyScalar(0.5).addScalar(0.5),S=ga.vertexNormalsModelView[2],ra.setRGB(S.x,S.y,S.z).multiplyScalar(0.5).addScalar(0.5),ea=fb(ta,oa,da,ra),r(B,K,L,T,La,J),I(B,K,L,T,La,J,0,0,1,0,0,1,ea),r(ja,ia,Z,sa,Pa,M),I(ja,ia,Z,sa,Pa,M,1,0,1,1,0,1,ea))):U instanceof THREE.MeshDepthMaterial&&(wa=m.near,xa=m.far,ta.r=ta.g=ta.b=1-ab(S.positionScreen.z*S.positionScreen.w,wa,xa),oa.r=oa.g=oa.b=1-ab(Wa.positionScreen.z*
|
|
|
-Wa.positionScreen.w,wa,xa),da.r=da.g=da.b=1-ab(gb.positionScreen.z*gb.positionScreen.w,wa,xa),ra.r=ra.g=ra.b=1-ab(pb.positionScreen.z*pb.positionScreen.w,wa,xa),ea=fb(ta,oa,da,ra),r(B,K,L,T,La,J),I(B,K,L,T,La,J,0,0,1,0,0,1,ea),r(ja,ia,Z,sa,Pa,M),I(ja,ia,Z,sa,Pa,M,1,0,1,1,0,1,ea)))}Na.union(Va)}}l.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",
|
|
|
+document.createElement("canvas"),p,n,s,q,l=m.getContext("2d"),r=new THREE.Color(0),t=0,x=1,z=0,w=null,I=null,H=null,D=null,y=null,E,F,G,W,A=new THREE.RenderableVertex,X=new THREE.RenderableVertex,B,K,L,P,aa,na,qa,J,ga,sa,ea,M,ja=new THREE.Color,Ga=new THREE.Color,ya=new THREE.Color,ha=new THREE.Color,ra=new THREE.Color,da=new THREE.Color,za=new THREE.Color,oa=new THREE.Color,ka={},Ra={},la,va,ta,lb,Da,tb,fb,Lb,zb,rb,qb=new THREE.Box2,Sa=new THREE.Box2,Ka=new THREE.Box2,Db=!1,Pa=new THREE.Color,kc=
|
|
|
+new THREE.Color,Mb=new THREE.Color,pb=new THREE.Vector3,Ab,Ob,rc,mb,Ha,ab,gb=16;Ab=document.createElement("canvas");Ab.width=Ab.height=2;Ob=Ab.getContext("2d");Ob.fillStyle="rgba(0,0,0,1)";Ob.fillRect(0,0,2,2);rc=Ob.getImageData(0,0,2,2);mb=rc.data;Ha=document.createElement("canvas");Ha.width=Ha.height=gb;ab=Ha.getContext("2d");ab.translate(-gb/2,-gb/2);ab.scale(gb,gb);gb--;this.domElement=m;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;n=b*this.devicePixelRatio;s=Math.floor(p/2);q=Math.floor(n/2);m.width=p;m.height=n;m.style.width=a+"px";m.style.height=b+"px";qb.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q));Sa.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q));x=1;z=0;y=D=H=I=w=null};this.setClearColor=
|
|
|
+function(a,b){r.copy(a);t=void 0!==b?b:1;Sa.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q))};this.setClearColorHex=function(a,b){r.setHex(a);t=void 0!==b?b:1;Sa.set(new THREE.Vector2(-s,-q),new THREE.Vector2(s,q))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){l.setTransform(1,0,0,-1,s,q);!1===Sa.empty()&&(Sa.intersect(qb),Sa.expandByScalar(2),1>t&&l.clearRect(Sa.min.x|0,Sa.min.y|0,Sa.max.x-Sa.min.x|0,Sa.max.y-Sa.min.y|0),0<t&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*
|
|
|
+r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*r.b)+","+t+")"),l.fillRect(Sa.min.x|0,Sa.min.y|0,Sa.max.x-Sa.min.x|0,Sa.max.y-Sa.min.y|0)),Sa.makeEmpty())};this.render=function(a,m){function n(a,b,c){for(var d=0,e=h.length;d<e;d++){var f=h[d];oa.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=f.matrixWorld.getPosition().normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(oa.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=f.matrixWorld.getPosition(),j=b.dot(pb.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(oa.multiplyScalar(j)))))}}function p(a,d,e,g,j,i,h,Y){f.info.render.vertices+=3;f.info.render.faces++;b(Y.opacity);c(Y.blending);B=a.positionScreen.x;K=a.positionScreen.y;L=d.positionScreen.x;P=d.positionScreen.y;aa=e.positionScreen.x;na=e.positionScreen.y;r(B,K,L,P,aa,na);(Y instanceof THREE.MeshLambertMaterial||Y instanceof THREE.MeshPhongMaterial)&&null===Y.map&&null===Y.map?(da.copy(Y.color),za.copy(Y.emissive),
|
|
|
+Y.vertexColors===THREE.FaceColors&&da.multiply(h.color),!0===Db?!1===Y.wireframe&&Y.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(Ga.copy(Pa),ya.copy(Pa),ha.copy(Pa),n(h.v1.positionWorld,h.vertexNormalsModel[0],Ga),n(h.v2.positionWorld,h.vertexNormalsModel[1],ya),n(h.v3.positionWorld,h.vertexNormalsModel[2],ha),Ga.multiply(da).add(za),ya.multiply(da).add(za),ha.multiply(da).add(za),ra.addColors(ya,ha).multiplyScalar(0.5),ta=hb(Ga,ya,ha,ra),I(B,K,L,P,aa,na,0,0,1,0,0,1,ta)):(ja.copy(Pa),n(h.centroidModel,
|
|
|
+h.normalModel,ja),ja.multiply(da).add(za),!0===Y.wireframe?x(ja,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):w(ja)):!0===Y.wireframe?x(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):w(Y.color)):Y instanceof THREE.MeshBasicMaterial||Y instanceof THREE.MeshLambertMaterial||Y instanceof THREE.MeshPhongMaterial?null!==Y.map?Y.map.mapping instanceof THREE.UVMapping&&(lb=h.uvs[0],z(B,K,L,P,aa,na,lb[g].x,lb[g].y,lb[j].x,lb[j].y,lb[i].x,lb[i].y,Y.map)):null!==Y.envMap?
|
|
|
+Y.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(pb.copy(h.vertexNormalsModelView[g]),Da=0.5*pb.x+0.5,tb=0.5*pb.y+0.5,pb.copy(h.vertexNormalsModelView[j]),fb=0.5*pb.x+0.5,Lb=0.5*pb.y+0.5,pb.copy(h.vertexNormalsModelView[i]),zb=0.5*pb.x+0.5,rb=0.5*pb.y+0.5,z(B,K,L,P,aa,na,Da,tb,fb,Lb,zb,rb,Y.envMap)):(ja.copy(Y.color),Y.vertexColors===THREE.FaceColors&&ja.multiply(h.color),!0===Y.wireframe?x(ja,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):w(ja)):Y instanceof THREE.MeshDepthMaterial?
|
|
|
+(la=m.near,va=m.far,j=1-bb(a.positionScreen.z*a.positionScreen.w,la,va),Ga.setRGB(j,j,j),j=1-bb(d.positionScreen.z*d.positionScreen.w,la,va),ya.setRGB(j,j,j),j=1-bb(e.positionScreen.z*e.positionScreen.w,la,va),ha.setRGB(j,j,j),ra.addColors(ya,ha).multiplyScalar(0.5),ta=hb(Ga,ya,ha,ra),I(B,K,L,P,aa,na,0,0,1,0,0,1,ta)):Y instanceof THREE.MeshNormalMaterial&&(Y.shading==THREE.FlatShading?(d=h.normalModelView,ja.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===Y.wireframe?x(ja,Y.wireframeLinewidth,
|
|
|
+Y.wireframeLinecap,Y.wireframeLinejoin):w(ja)):Y.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[g],Ga.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],ya.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[i],ha.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ra.addColors(ya,ha).multiplyScalar(0.5),ta=hb(Ga,ya,ha,ra),I(B,K,L,P,aa,na,0,0,1,0,0,1,ta)))}function r(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);
|
|
|
+l.lineTo(e,f);l.closePath()}function t(a,b,c,d,e,f,g,j){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,j);l.closePath()}function x(a,b,c,e){H!==b&&(H=l.lineWidth=b);D!==c&&(D=l.lineCap=c);y!==e&&(y=l.lineJoin=e);d(a.getStyle());l.stroke();Ka.expandByScalar(2*b)}function w(a){e(a.getStyle());l.fill()}function z(a,b,c,d,f,g,j,h,i,Y,k,m,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==
|
|
|
+THREE.RepeatWrapping;ka[n.id]=l.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===ka[n.id]?e("rgba(0,0,0,1)"):e(ka[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,r=n.image.height*n.repeat.y,j=(j+p)*s,h=(1-h+q)*r,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*s-j,Y=(1-Y+q)*r-h,k=(k+p)*s-j,m=(1-m+q)*r-h,p=i*m-k*Y;0===p?(void 0===Ra[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,
|
|
|
+b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),Ra[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=Ra[n.id],j=4*(Math.floor(j)+Math.floor(h)*n.image.width),ja.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255),w(ja)):(p=1/p,n=(m*c-Y*f)*p,Y=(m*d-Y*g)*p,c=(i*f-k*c)*p,d=(i*g-k*d)*p,a=a-n*j-c*h,j=b-Y*j-d*h,l.save(),l.transform(n,Y,c,d,a,j),l.fill(),l.restore())}}function I(a,b,c,d,e,f,g,j,h,i,Y,k,n){var m,p;m=n.width-1;p=n.height-1;g*=m;j*=p;c-=a;d-=b;e-=a;f-=b;h=h*m-g;i=i*p-
|
|
|
+j;Y=Y*m-g;k=k*p-j;p=1/(h*k-Y*i);m=(k*c-i*e)*p;i=(k*d-i*f)*p;c=(h*e-Y*c)*p;d=(h*f-Y*d)*p;a=a-m*g-c*j;b=b-i*g-d*j;l.save();l.transform(m,i,c,d,a,b);l.clip();l.drawImage(n,0,0);l.restore()}function hb(a,b,c,d){mb[0]=255*a.r|0;mb[1]=255*a.g|0;mb[2]=255*a.b|0;mb[4]=255*b.r|0;mb[5]=255*b.g|0;mb[6]=255*b.b|0;mb[8]=255*c.r|0;mb[9]=255*c.g|0;mb[10]=255*c.b|0;mb[12]=255*d.r|0;mb[13]=255*d.g|0;mb[14]=255*d.b|0;Ob.putImageData(rc,0,0);ab.drawImage(Ab,0,0);return Ha}function bb(a,b,c){a=(a-b)/(c-b);return a*a*
|
|
|
+(3-2*a)}function ub(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===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();l.setTransform(1,0,0,-1,s,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,m,this.sortObjects,this.sortElements);i=g.elements;h=g.lights;Db=0<h.length;if(!0===Db){Pa.setRGB(0,0,0);kc.setRGB(0,0,0);
|
|
|
+Mb.setRGB(0,0,0);for(var gb=0,Nb=h.length;gb<Nb;gb++){var T=h[gb],U=T.color;T instanceof THREE.AmbientLight?Pa.add(U):T instanceof THREE.DirectionalLight?kc.add(U):T instanceof THREE.PointLight&&Mb.add(U)}}gb=0;for(Nb=i.length;gb<Nb;gb++){var fa=i[gb],T=fa.material;if(!(void 0===T||!1===T.visible)){Ka.makeEmpty();if(fa instanceof THREE.RenderableParticle){E=fa;E.x*=s;E.y*=q;var U=E,Xa=fa;b(T.opacity);c(T.blending);var ib=void 0,Ua=void 0,Ya=void 0,Va=void 0,Y=fa=void 0,dd=void 0;T instanceof THREE.ParticleBasicMaterial?
|
|
|
+null===T.map?(Ya=Xa.object.scale.x,Va=Xa.object.scale.y,Ya*=Xa.scale.x*s,Va*=Xa.scale.y*q,Ka.min.set(U.x-Ya,U.y-Va),Ka.max.set(U.x+Ya,U.y+Va),!1!==qb.isIntersectionBox(Ka)&&(e(T.color.getStyle()),l.save(),l.translate(U.x,U.y),l.rotate(-Xa.rotation),l.scale(Ya,Va),l.fillRect(-1,-1,2,2),l.restore())):(fa=T.map.image,Y=fa.width>>1,dd=fa.height>>1,Ya=Xa.scale.x*s,Va=Xa.scale.y*q,ib=Ya*Y,Ua=Va*dd,Ka.min.set(U.x-ib,U.y-Ua),Ka.max.set(U.x+ib,U.y+Ua),!1!==qb.isIntersectionBox(Ka)&&(l.save(),l.translate(U.x,
|
|
|
+U.y),l.rotate(-Xa.rotation),l.scale(Ya,-Va),l.translate(-Y,-dd),l.drawImage(fa,0,0),l.restore())):T instanceof THREE.ParticleCanvasMaterial&&(ib=Xa.scale.x*s,Ua=Xa.scale.y*q,Ka.min.set(U.x-ib,U.y-Ua),Ka.max.set(U.x+ib,U.y+Ua),!1!==qb.isIntersectionBox(Ka)&&(d(T.color.getStyle()),e(T.color.getStyle()),l.save(),l.translate(U.x,U.y),l.rotate(-Xa.rotation),l.scale(ib,Ua),T.program(l),l.restore()))}else if(fa instanceof THREE.RenderableLine)E=fa.v1,F=fa.v2,E.positionScreen.x*=s,E.positionScreen.y*=q,F.positionScreen.x*=
|
|
|
+s,F.positionScreen.y*=q,Ka.setFromPoints([E.positionScreen,F.positionScreen]),!0===qb.isIntersectionBox(Ka)&&(U=E,Xa=F,b(T.opacity),c(T.blending),l.beginPath(),l.moveTo(U.positionScreen.x,U.positionScreen.y),l.lineTo(Xa.positionScreen.x,Xa.positionScreen.y),T instanceof THREE.LineBasicMaterial&&(U=T.linewidth,H!==U&&(H=l.lineWidth=U),U=T.linecap,D!==U&&(D=l.lineCap=U),U=T.linejoin,y!==U&&(y=l.lineJoin=U),d(T.color.getStyle()),l.stroke(),Ka.expandByScalar(2*T.linewidth)));else if(fa instanceof THREE.RenderableFace3){E=
|
|
|
+fa.v1;F=fa.v2;G=fa.v3;if(-1>E.positionScreen.z||1<E.positionScreen.z)continue;if(-1>F.positionScreen.z||1<F.positionScreen.z)continue;if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;E.positionScreen.x*=s;E.positionScreen.y*=q;F.positionScreen.x*=s;F.positionScreen.y*=q;G.positionScreen.x*=s;G.positionScreen.y*=q;!0===T.overdraw&&(ub(E.positionScreen,F.positionScreen),ub(F.positionScreen,G.positionScreen),ub(G.positionScreen,E.positionScreen));Ka.setFromPoints([E.positionScreen,F.positionScreen,
|
|
|
+G.positionScreen]);p(E,F,G,0,1,2,fa,T,a)}else if(fa instanceof THREE.RenderableFace4){E=fa.v1;F=fa.v2;G=fa.v3;W=fa.v4;if(-1>E.positionScreen.z||1<E.positionScreen.z)continue;if(-1>F.positionScreen.z||1<F.positionScreen.z)continue;if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;E.positionScreen.x*=s;E.positionScreen.y*=q;F.positionScreen.x*=s;F.positionScreen.y*=q;G.positionScreen.x*=s;G.positionScreen.y*=q;W.positionScreen.x*=s;W.positionScreen.y*=
|
|
|
+q;A.positionScreen.copy(F.positionScreen);X.positionScreen.copy(W.positionScreen);!0===T.overdraw&&(ub(E.positionScreen,F.positionScreen),ub(F.positionScreen,W.positionScreen),ub(W.positionScreen,E.positionScreen),ub(G.positionScreen,A.positionScreen),ub(G.positionScreen,X.positionScreen));Ka.setFromPoints([E.positionScreen,F.positionScreen,G.positionScreen,W.positionScreen]);U=E;Xa=F;ib=G;Ua=W;Ya=A;Va=X;Y=a;f.info.render.vertices+=4;f.info.render.faces++;b(T.opacity);c(T.blending);void 0!==T.map&&
|
|
|
+null!==T.map||void 0!==T.envMap&&null!==T.envMap?(p(U,Xa,Ua,0,1,3,fa,T,Y),p(Ya,ib,Va,1,2,3,fa,T,Y)):(B=U.positionScreen.x,K=U.positionScreen.y,L=Xa.positionScreen.x,P=Xa.positionScreen.y,aa=ib.positionScreen.x,na=ib.positionScreen.y,qa=Ua.positionScreen.x,J=Ua.positionScreen.y,ga=Ya.positionScreen.x,sa=Ya.positionScreen.y,ea=Va.positionScreen.x,M=Va.positionScreen.y,T instanceof THREE.MeshLambertMaterial||T instanceof THREE.MeshPhongMaterial?(da.copy(T.color),za.copy(T.emissive),T.vertexColors===
|
|
|
+THREE.FaceColors&&da.multiply(fa.color),!0===Db?!1===T.wireframe&&T.shading==THREE.SmoothShading&&4==fa.vertexNormalsLength?(Ga.copy(Pa),ya.copy(Pa),ha.copy(Pa),ra.copy(Pa),n(fa.v1.positionWorld,fa.vertexNormalsModel[0],Ga),n(fa.v2.positionWorld,fa.vertexNormalsModel[1],ya),n(fa.v4.positionWorld,fa.vertexNormalsModel[3],ha),n(fa.v3.positionWorld,fa.vertexNormalsModel[2],ra),Ga.multiply(da).add(za),ya.multiply(da).add(za),ha.multiply(da).add(za),ra.multiply(da).add(za),ta=hb(Ga,ya,ha,ra),r(B,K,L,P,
|
|
|
+qa,J),I(B,K,L,P,qa,J,0,0,1,0,0,1,ta),r(ga,sa,aa,na,ea,M),I(ga,sa,aa,na,ea,M,1,0,1,1,0,1,ta)):(ja.copy(Pa),n(fa.centroidModel,fa.normalModel,ja),ja.multiply(da).add(za),t(B,K,L,P,aa,na,qa,J),!0===T.wireframe?x(ja,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):w(ja)):(ja.addColors(da,za),t(B,K,L,P,aa,na,qa,J),!0===T.wireframe?x(ja,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):w(ja))):T instanceof THREE.MeshBasicMaterial?(ja.copy(T.color),T.vertexColors===THREE.FaceColors&&
|
|
|
+ja.multiply(fa.color),t(B,K,L,P,aa,na,qa,J),!0===T.wireframe?x(ja,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):w(ja)):T instanceof THREE.MeshNormalMaterial?(U=void 0,T.shading==THREE.FlatShading?(U=fa.normalModelView,ja.setRGB(U.x,U.y,U.z).multiplyScalar(0.5).addScalar(0.5),t(B,K,L,P,aa,na,qa,J),!0===T.wireframe?x(ja,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):w(ja)):T.shading==THREE.SmoothShading&&(U=fa.vertexNormalsModelView[0],Ga.setRGB(U.x,U.y,U.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
+U=fa.vertexNormalsModelView[1],ya.setRGB(U.x,U.y,U.z).multiplyScalar(0.5).addScalar(0.5),U=fa.vertexNormalsModelView[3],ha.setRGB(U.x,U.y,U.z).multiplyScalar(0.5).addScalar(0.5),U=fa.vertexNormalsModelView[2],ra.setRGB(U.x,U.y,U.z).multiplyScalar(0.5).addScalar(0.5),ta=hb(Ga,ya,ha,ra),r(B,K,L,P,qa,J),I(B,K,L,P,qa,J,0,0,1,0,0,1,ta),r(ga,sa,aa,na,ea,M),I(ga,sa,aa,na,ea,M,1,0,1,1,0,1,ta))):T instanceof THREE.MeshDepthMaterial&&(la=m.near,va=m.far,Ga.r=Ga.g=Ga.b=1-bb(U.positionScreen.z*U.positionScreen.w,
|
|
|
+la,va),ya.r=ya.g=ya.b=1-bb(Xa.positionScreen.z*Xa.positionScreen.w,la,va),ha.r=ha.g=ha.b=1-bb(Ua.positionScreen.z*Ua.positionScreen.w,la,va),ra.r=ra.g=ra.b=1-bb(ib.positionScreen.z*ib.positionScreen.w,la,va),ta=hb(Ga,ya,ha,ra),r(B,K,L,P,qa,J),I(B,K,L,P,qa,J,0,0,1,0,0,1,ta),r(ga,sa,aa,na,ea,M),I(ga,sa,aa,na,ea,M,1,0,1,1,0,1,ta)))}Sa.union(Ka)}}l.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",
|
|
@@ -338,153 +338,153 @@ n;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 i(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 h(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){kb[a]||(j.enableVertexAttribArray(a),kb[a]=!0)}function m(){for(var a in kb)kb[a]&&(j.disableVertexAttribArray(a),kb[a]=!1)}function p(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function n(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++)la=
|
|
|
-oa=null,ra=$=wa=ma=Sa=qb=xa=-1,$a=!0,a[d].render(b,c,Kb,Lb),la=oa=null,ra=$=wa=ma=Sa=qb=xa=-1,$a=!0}function q(a,b,c,d,e,f,g,j){var i,h,k,n;b?(h=a.length-1,n=b=-1):(h=0,b=a.length,n=1);for(var m=h;m!==b;m+=n)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
|
|
|
+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){pb[a]||(j.enableVertexAttribArray(a),pb[a]=!0)}function m(){for(var a in pb)pb[a]&&(j.disableVertexAttribArray(a),pb[a]=!1)}function p(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function n(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++)za=
|
|
|
+ya=null,ra=da=la=Ra=fb=tb=va=-1,ab=!0,a[d].render(b,c,kc,Mb),za=ya=null,ra=da=la=Ra=fb=tb=va=-1,ab=!0}function q(a,b,c,d,e,f,g,j){var i,h,k,n;b?(h=a.length-1,n=b=-1):(h=0,b=a.length,n=1);for(var m=h;m!==b;m+=n)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 l(a,b,c,d,e,f,g){for(var j,i,h=0,k=a.length;h<k;h++)if(j=a[h],i=j.object,i.visible){if(g)j=g;else{j=j[b];if(!j)continue;f&&M.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);M.setDepthTest(j.depthTest);M.setDepthWrite(j.depthWrite);F(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}M.renderImmediateObject(c,d,e,j,i)}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
-function t(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function x(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function z(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 I(a,b,c,d,e){Ea=0;d.needsUpdate&&(d.program&&Xa(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!==oa&&(j.useProgram(g),oa=g,f=!0);d.id!==ra&&(ra=d.id,f=!0);if(f||a!==la)j.uniformMatrix4fv(i.projectionMatrix,!1,a.projectionMatrix.elements),a!==la&&(la=a);if(d.skinning)if(ab&&e.useVertexTexture){if(null!==i.boneTexture){var k=H();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($a){for(var n,m=k=0,l=0,p,q,s,r=mb,t=r.directional.colors,x=r.directional.positions,w=r.point.colors,z=r.point.positions,B=r.point.distances,C=r.spot.colors,F=r.spot.positions,G=r.spot.distances,I=r.spot.directions,J=r.spot.anglesCos,ha=r.spot.exponents,T=r.hemi.skyColors,U=r.hemi.groundColors,W=r.hemi.positions,
|
|
|
-X=0,$=0,S=0,da=0,ta=0,ga=0,ea=0,ja=0,N=n=0,c=s=N=0,f=b.length;c<f;c++)n=b[c],n.onlyShadow||(p=n.color,q=n.intensity,s=n.distance,n instanceof THREE.AmbientLight?n.visible&&(M.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,l+=p.b*p.b):(k+=p.r,m+=p.g,l+=p.b)):n instanceof THREE.DirectionalLight?(ta+=1,n.visible&&(ya.copy(n.matrixWorld.getPosition()),ya.sub(n.target.matrixWorld.getPosition()),ya.normalize(),0===ya.x&&0===ya.y&&0===ya.z||(n=3*X,x[n]=ya.x,x[n+1]=ya.y,x[n+2]=ya.z,M.gammaInput?y(t,n,p,q*q):E(t,n,p,q),
|
|
|
-X+=1))):n instanceof THREE.PointLight?(ga+=1,n.visible&&(N=3*$,M.gammaInput?y(w,N,p,q*q):E(w,N,p,q),q=n.matrixWorld.getPosition(),z[N]=q.x,z[N+1]=q.y,z[N+2]=q.z,B[$]=s,$+=1)):n instanceof THREE.SpotLight?(ea+=1,n.visible&&(N=3*S,M.gammaInput?y(C,N,p,q*q):E(C,N,p,q),q=n.matrixWorld.getPosition(),F[N]=q.x,F[N+1]=q.y,F[N+2]=q.z,G[S]=s,ya.copy(q),ya.sub(n.target.matrixWorld.getPosition()),ya.normalize(),I[N]=ya.x,I[N+1]=ya.y,I[N+2]=ya.z,J[S]=Math.cos(n.angle),ha[S]=n.exponent,S+=1)):n instanceof THREE.HemisphereLight&&
|
|
|
-(ja+=1,n.visible&&(ya.copy(n.matrixWorld.getPosition()),ya.normalize(),0===ya.x&&0===ya.y&&0===ya.z||(s=3*da,W[s]=ya.x,W[s+1]=ya.y,W[s+2]=ya.z,p=n.color,n=n.groundColor,M.gammaInput?(q*=q,y(T,s,p,q),y(U,s,n,q)):(E(T,s,p,q),E(U,s,n,q)),da+=1))));c=3*X;for(f=Math.max(t.length,3*ta);c<f;c++)t[c]=0;c=3*$;for(f=Math.max(w.length,3*ga);c<f;c++)w[c]=0;c=3*S;for(f=Math.max(C.length,3*ea);c<f;c++)C[c]=0;c=3*da;for(f=Math.max(T.length,3*ja);c<f;c++)T[c]=0;c=3*da;for(f=Math.max(U.length,3*ja);c<f;c++)U[c]=0;
|
|
|
-r.directional.length=X;r.point.length=$;r.spot.length=S;r.hemi.length=da;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=l;$a=!1}c=mb;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;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 Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,h.offsetRepeat.value.set(c.x,c.y,Z.x,Z.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=L.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=Z=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[Z]=k.shadowMap,h.shadowMapSize.value[Z]=k.shadowMapSize,h.shadowMatrix.value[Z]=k.shadowMatrix,h.shadowDarkness.value[Z]=k.shadowDarkness,h.shadowBias.value[Z]=k.shadowBias,Z++}b=d.uniformsList;h=0;for(Z=b.length;h<Z;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(l=k.length;m<l;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(l=
|
|
|
-k.length;m<l;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(l=k.length;m<l;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(l=k.length;m<l;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=H(),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?(l=k,r=m,t=c.image[m],w=bd,t.width<=w&&t.height<=w||(z=Math.max(t.width,t.height),x=Math.floor(t.width*w/z),w=Math.floor(t.height*w/z),z=document.createElement("canvas"),z.width=x,z.height=w,z.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,x,w),t=z),l[r]=t):k[m]=c.image[m];m=k[0];l=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=K(c.format);t=K(c.type);A(j.TEXTURE_CUBE_MAP,c,l);for(m=0;6>m;m++)if(f){w=
|
|
|
-k[m].mipmaps;z=0;for(B=w.length;z<B;z++)x=w[z],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,z,r,x.width,x.height,0,x.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&l&&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(l=c.value.length;m<l;m++)c._array[m]=H();j.uniform1iv(f,c._array);m=0;for(l=c.value.length;m<l;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)b=a.matrixWorld.getPosition(),j.uniform3f(i.cameraPosition,b.x,b.y,b.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 H(){var a=Ea;a>=Cc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Cc);
|
|
|
-Ea+=1;return a}function C(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function y(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 E(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function F(a,b,c){rb!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),rb=a);if(a&&(jc!==b||kc!==c))j.polygonOffset(b,c),jc=b,kc=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 W(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 A(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,K(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,K(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),
|
|
|
-j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(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,B(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,B(b.minFilter)));if(Hb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,Hb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Kc)),b.__oldAnisotropy=b.anisotropy}function X(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&
|
|
|
+function t(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function x(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function z(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 I(a,b,c,d,e){ka=0;d.needsUpdate&&(d.program&&Va(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!==ya&&(j.useProgram(g),ya=g,f=!0);d.id!==ra&&(ra=d.id,f=!0);if(f||a!==za)j.uniformMatrix4fv(i.projectionMatrix,!1,a.projectionMatrix.elements),a!==za&&(za=a);if(d.skinning)if(bb&&e.useVertexTexture){if(null!==i.boneTexture){var k=H();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(ab){for(var n,m=k=0,l=0,p,q,s,r=gb,t=r.directional.colors,x=r.directional.positions,w=r.point.colors,z=r.point.positions,D=r.point.distances,B=r.spot.colors,F=r.spot.positions,G=r.spot.distances,I=r.spot.directions,J=r.spot.anglesCos,ja=r.spot.exponents,P=r.hemi.skyColors,T=r.hemi.groundColors,W=r.hemi.positions,
|
|
|
+X=0,U=0,da=0,ha=0,oa=0,Ga=0,fa=0,la=0,N=n=0,c=s=N=0,f=b.length;c<f;c++)n=b[c],n.onlyShadow||(p=n.color,q=n.intensity,s=n.distance,n instanceof THREE.AmbientLight?n.visible&&(M.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,l+=p.b*p.b):(k+=p.r,m+=p.g,l+=p.b)):n instanceof THREE.DirectionalLight?(oa+=1,n.visible&&(Ha.copy(n.matrixWorld.getPosition()),Ha.sub(n.target.matrixWorld.getPosition()),Ha.normalize(),0===Ha.x&&0===Ha.y&&0===Ha.z||(n=3*X,x[n]=Ha.x,x[n+1]=Ha.y,x[n+2]=Ha.z,M.gammaInput?y(t,n,p,q*q):E(t,n,p,
|
|
|
+q),X+=1))):n instanceof THREE.PointLight?(Ga+=1,n.visible&&(N=3*U,M.gammaInput?y(w,N,p,q*q):E(w,N,p,q),q=n.matrixWorld.getPosition(),z[N]=q.x,z[N+1]=q.y,z[N+2]=q.z,D[U]=s,U+=1)):n instanceof THREE.SpotLight?(fa+=1,n.visible&&(N=3*da,M.gammaInput?y(B,N,p,q*q):E(B,N,p,q),q=n.matrixWorld.getPosition(),F[N]=q.x,F[N+1]=q.y,F[N+2]=q.z,G[da]=s,Ha.copy(q),Ha.sub(n.target.matrixWorld.getPosition()),Ha.normalize(),I[N]=Ha.x,I[N+1]=Ha.y,I[N+2]=Ha.z,J[da]=Math.cos(n.angle),ja[da]=n.exponent,da+=1)):n instanceof
|
|
|
+THREE.HemisphereLight&&(la+=1,n.visible&&(Ha.copy(n.matrixWorld.getPosition()),Ha.normalize(),0===Ha.x&&0===Ha.y&&0===Ha.z||(s=3*ha,W[s]=Ha.x,W[s+1]=Ha.y,W[s+2]=Ha.z,p=n.color,n=n.groundColor,M.gammaInput?(q*=q,y(P,s,p,q),y(T,s,n,q)):(E(P,s,p,q),E(T,s,n,q)),ha+=1))));c=3*X;for(f=Math.max(t.length,3*oa);c<f;c++)t[c]=0;c=3*U;for(f=Math.max(w.length,3*Ga);c<f;c++)w[c]=0;c=3*da;for(f=Math.max(B.length,3*fa);c<f;c++)B[c]=0;c=3*ha;for(f=Math.max(P.length,3*la);c<f;c++)P[c]=0;c=3*ha;for(f=Math.max(T.length,
|
|
|
+3*la);c<f;c++)T[c]=0;r.directional.length=X;r.point.length=U;r.spot.length=da;r.hemi.length=ha;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=l;ab=!1}c=gb;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;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 aa;d.map?aa=d.map:d.specularMap?aa=d.specularMap:d.normalMap?aa=d.normalMap:d.bumpMap&&(aa=d.bumpMap);void 0!==aa&&(c=aa.offset,aa=aa.repeat,h.offsetRepeat.value.set(c.x,c.y,aa.x,aa.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=L.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=aa=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[aa]=k.shadowMap,h.shadowMapSize.value[aa]=k.shadowMapSize,h.shadowMatrix.value[aa]=k.shadowMatrix,h.shadowDarkness.value[aa]=k.shadowDarkness,h.shadowBias.value[aa]=k.shadowBias,aa++}b=d.uniformsList;h=0;for(aa=b.length;h<aa;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(l=k.length;m<l;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(l=k.length;m<l;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(l=k.length;m<l;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(l=k.length;m<l;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=H(),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?(l=k,r=m,t=c.image[m],w=ad,t.width<=w&&t.height<=w||(z=Math.max(t.width,t.height),x=Math.floor(t.width*w/z),w=Math.floor(t.height*w/z),z=document.createElement("canvas"),z.width=x,z.height=w,z.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,x,w),t=z),l[r]=t):k[m]=c.image[m];m=k[0];l=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=K(c.format);t=K(c.type);A(j.TEXTURE_CUBE_MAP,
|
|
|
+c,l);for(m=0;6>m;m++)if(f){w=k[m].mipmaps;z=0;for(D=w.length;z<D;z++)x=w[z],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,z,r,x.width,x.height,0,x.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&l&&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(l=c.value.length;m<l;m++)c._array[m]=H();j.uniform1iv(f,c._array);m=0;for(l=c.value.length;m<l;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)b=a.matrixWorld.getPosition(),j.uniform3f(i.cameraPosition,b.x,b.y,b.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 H(){var a=ka;a>=Bc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+
|
|
|
+Bc);ka+=1;return a}function D(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function y(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 E(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function F(a,b,c){Lb!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Lb=a);if(a&&(zb!==b||rb!==c))j.polygonOffset(b,c),zb=b,rb=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 W(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 A(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,K(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,K(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),
|
|
|
+j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(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,B(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,B(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,Jc)),b.__oldAnisotropy=b.anisotropy}function X(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 B(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||
|
|
|
a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function K(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!==zb){if(a===THREE.RGB_S3TC_DXT1_Format)return zb.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return zb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return zb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return zb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),T=void 0!==a.precision?a.precision:"highp",Z=void 0!==
|
|
|
-a.alpha?a.alpha:!0,sa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,La=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.stencil?a.stencil:!0,ja=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ia=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Pa=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=L;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateScene=
|
|
|
+if(void 0!==Bb){if(a===THREE.RGB_S3TC_DXT1_Format)return Bb.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Bb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Bb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Bb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),P=void 0!==a.precision?a.precision:"highp",aa=void 0!==
|
|
|
+a.alpha?a.alpha:!0,na=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.stencil?a.stencil:!0,ga=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,sa=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),ea=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=L;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 M=this,ha=[],ta=0,oa=null,da=null,ra=-1,$=null,la=null,jb=0,Ea=0,ma=-1,wa=-1,xa=-1,ea=-1,Ua=-1,Bb=-1,qb=-1,Sa=-1,rb=null,jc=null,kc=null,eb=null,Na=0,Va=0,Cb=0,Ta=0,Kb=0,Lb=0,kb={},yb=new THREE.Frustum,Mb=new THREE.Matrix4,rc=new THREE.Matrix4,lb=new THREE.Vector3,ya=new THREE.Vector3,$a=!0,mb={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,lc,sc,Hb,zb;try{if(!(j=L.getContext("experimental-webgl",{alpha:Z,premultipliedAlpha:sa,antialias:La,stencil:J,preserveDrawingBuffer:ja})))throw"Error creating WebGL context.";}catch(cd){console.error(cd)}lc=j.getExtension("OES_texture_float");sc=j.getExtension("OES_standard_derivatives");Hb=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||
|
|
|
-j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");zb=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");lc||console.log("THREE.WebGLRenderer: Float textures not supported.");sc||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Hb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");zb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
|
|
|
-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(ia.r,ia.g,ia.b,Pa);this.context=j;var Cc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),ad=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var bd=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Kc=Hb?j.getParameter(Hb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):
|
|
|
-0,fb=0<ad,ab=fb&&lc;zb&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var tb=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),dd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var dc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),U=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 S=0<tb.precision&&0<dc.precision,ga=0<dd.precision&&0<U.precision;"highp"===T&&!S&&(ga?(T="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(T="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===
|
|
|
-T&&!ga&&(T="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return fb};this.supportsFloatTextures=function(){return lc};this.supportsStandardDerivatives=function(){return sc};this.supportsCompressedTextureS3TC=function(){return zb};this.getMaxAnisotropy=function(){return Kc};this.getPrecision=function(){return T};this.setSize=function(a,b){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;
|
|
|
-L.style.width=a+"px";L.style.height=b+"px";this.setViewport(0,0,L.width,L.height)};this.setViewport=function(a,b,c,d){Na=void 0!==a?a:0;Va=void 0!==b?b:0;Cb=void 0!==c?c:L.width;Ta=void 0!==d?d:L.height;j.viewport(Na,Va,Cb,Ta)};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){ia.setHex(a);Pa=b;j.clearColor(ia.r,ia.g,ia.b,Pa)};this.setClearColor=function(a,b){ia.copy(a);
|
|
|
-Pa=b;j.clearColor(ia.r,ia.g,ia.b,Pa)};this.getClearColor=function(){return ia};this.getClearAlpha=function(){return Pa};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){oa=null;ra=$=Sa=qb=xa=-1;$a=!0;wa=ma=-1;this.shadowMapPlugin.update(a,b)};var Wa=function(a){a=a.target;a.removeEventListener("dispose",Wa);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&&
|
|
|
+geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var M=this,ja=[],Ga=0,ya=null,ha=null,ra=-1,da=null,za=null,oa=0,ka=0,Ra=-1,la=-1,va=-1,ta=-1,lb=-1,Da=-1,tb=-1,fb=-1,Lb=null,zb=null,rb=null,qb=null,Sa=0,Ka=0,Db=0,Pa=0,kc=0,Mb=0,pb={},Ab=new THREE.Frustum,Ob=new THREE.Matrix4,rc=new THREE.Matrix4,mb=new THREE.Vector3,Ha=new THREE.Vector3,ab=!0,gb={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,lc,sc,Eb,Bb;try{if(!(j=L.getContext("experimental-webgl",{alpha:aa,premultipliedAlpha:na,antialias:qa,stencil:J,preserveDrawingBuffer:ga})))throw"Error creating WebGL context.";}catch(bd){console.error(bd)}lc=j.getExtension("OES_texture_float");sc=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");Bb=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");lc||console.log("THREE.WebGLRenderer: Float textures not supported.");sc||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Eb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Bb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
|
|
|
+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(sa.r,sa.g,sa.b,ea);this.context=j;var Bc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$c=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ad=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Jc=Eb?j.getParameter(Eb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):
|
|
|
+0,hb=0<$c,bb=hb&&lc;Bb&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var ub=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var Nb=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),T=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 U=0<ub.precision&&0<Nb.precision,fa=0<cd.precision&&0<T.precision;"highp"===P&&!U&&(fa?(P="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(P="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===
|
|
|
+P&&!fa&&(P="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return hb};this.supportsFloatTextures=function(){return lc};this.supportsStandardDerivatives=function(){return sc};this.supportsCompressedTextureS3TC=function(){return Bb};this.getMaxAnisotropy=function(){return Jc};this.getPrecision=function(){return P};this.setSize=function(a,b){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;
|
|
|
+L.style.width=a+"px";L.style.height=b+"px";this.setViewport(0,0,L.width,L.height)};this.setViewport=function(a,b,c,d){Sa=void 0!==a?a:0;Ka=void 0!==b?b:0;Db=void 0!==c?c:L.width;Pa=void 0!==d?d:L.height;j.viewport(Sa,Ka,Db,Pa)};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){sa.setHex(a);ea=b;j.clearColor(sa.r,sa.g,sa.b,ea)};this.setClearColor=function(a,b){sa.copy(a);
|
|
|
+ea=b;j.clearColor(sa.r,sa.g,sa.b,ea)};this.getClearColor=function(){return sa};this.getClearAlpha=function(){return ea};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){ya=null;ra=da=fb=tb=va=-1;ab=!0;la=Ra=-1;this.shadowMapPlugin.update(a,b)};var Xa=function(a){a=a.target;a.removeEventListener("dispose",Xa);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--},pb=function(a){a=a.target;a.removeEventListener("dispose",pb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));
|
|
|
-M.info.memory.textures--},gb=function(a){a=a.target;a.removeEventListener("dispose",gb);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--},Qa=function(a){a=a.target;a.removeEventListener("dispose",Qa);Xa(a)},Xa=function(a){var b=
|
|
|
-a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=ha.length;a<c;a++)if(d=ha[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ha.length;a<c;a++)d=ha[a],d.program!==b&&e.push(d);ha=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.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--},ib=function(a){a=a.target;a.removeEventListener("dispose",ib);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));
|
|
|
+M.info.memory.textures--},Ua=function(a){a=a.target;a.removeEventListener("dispose",Ua);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--},Ya=function(a){a=a.target;a.removeEventListener("dispose",Ya);Va(a)},Va=function(a){var b=
|
|
|
+a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=ja.length;a<c;a++)if(d=ja[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ja.length;a<c;a++)d=ja[a],d.program!==b&&e.push(d);ja=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,n,l,p,q=3*a.count;for(p=0;p<
|
|
|
q;p+=9)l=a.normalArray,d=l[p],e=l[p+1],f=l[p+2],g=l[p+3],i=l[p+4],m=l[p+5],h=l[p+6],k=l[p+7],n=l[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+n)/3,l[p]=d,l[p+1]=e,l[p+2]=f,l[p+3]=d,l[p+4]=e,l[p+5]=f,l[p+6]=d,l[p+7]=e,l[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=I(a,b,c,d,f),a=c.attributes,
|
|
|
-b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==$&&($=d,b=!0),b&&m(),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,n=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,4*h*n);n=e.attributes.normal;if(0<=a.normal&&n){var l=n.itemSize;j.bindBuffer(j.ARRAY_BUFFER,n.buffer);k(a.normal);j.vertexAttribPointer(a.normal,l,j.FLOAT,
|
|
|
+b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==da&&(da=d,b=!0),b&&m(),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,n=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,4*h*n);n=e.attributes.normal;if(0<=a.normal&&n){var l=n.itemSize;j.bindBuffer(j.ARRAY_BUFFER,n.buffer);k(a.normal);j.vertexAttribPointer(a.normal,l,j.FLOAT,
|
|
|
!1,0,4*h*l)}n=e.attributes.uv;0<=a.uv&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.uv),j.vertexAttribPointer(a.uv,l,j.FLOAT,!1,0,4*h*l));n=e.attributes.color;0<=a.color&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,l,j.FLOAT,!1,0,4*h*l));n=e.attributes.tangent;0<=a.tangent&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,l,j.FLOAT,!1,0,4*h*l));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,
|
|
|
d[c].count,j.UNSIGNED_SHORT,2*d[c].start);M.info.render.calls++;M.info.render.vertices+=d[c].count;M.info.render.faces+=d[c].count/3}}else b&&(i=e.attributes.position,n=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.normal,0<=a.normal&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.normal),j.vertexAttribPointer(a.normal,l,j.FLOAT,!1,0,0)),n=e.attributes.uv,0<=a.uv&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
n.buffer),k(a.uv),j.vertexAttribPointer(a.uv,l,j.FLOAT,!1,0,0)),n=e.attributes.color,0<=a.color&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,l,j.FLOAT,!1,0,0)),n=e.attributes.tangent,0<=a.tangent&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,l,j.FLOAT,!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,n=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.color,0<=a.color&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,l,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,n=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-i.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.color,0<=a.color&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,l,j.FLOAT,!1,0,0)),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=I(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==$&&($=c,a=!0);a&&m();if(!d.morphTargets&&
|
|
|
+i.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.color,0<=a.color&&n&&(l=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,l,j.FLOAT,!1,0,0)),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=I(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==da&&(da=c,a=!0);a&&m();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 l,p=g.length;for(l=0;l<p;l++)i=g[l],0<i&&h.push([i,l]);h.length>d.numSupportedMorphTargets?(h.sort(n),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(n):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(l=h[i][1],0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]),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[l]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[l]):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!==eb&&(j.lineWidth(d),eb=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)),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,d=d.linewidth,d!==eb&&(j.lineWidth(d),eb=d),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;ra=-1;$a=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Mb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);yb.setFromMatrix(Mb);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||yb.intersectsObject(g))){C(g,b);var n=f,m=n.buffer,r=void 0,t=r=void 0,t=n.object.material;if(t instanceof THREE.MeshFaceMaterial)r=
|
|
|
-m.materialIndex,r=t.materials[r],r.transparent?(n.transparent=r,n.opaque=null):(n.opaque=r,n.transparent=null);else if(r=t)r.transparent?(n.transparent=r,n.opaque=null):(n.opaque=r,n.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(lb.copy(g.matrixWorld.getPosition()),lb.applyMatrix4(Mb),f.z=lb.z),f.id=g.id)}this.sortObjects&&h.sort(p);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(C(g,b),g=f.object.material,g.transparent?
|
|
|
+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!==qb&&(j.lineWidth(d),qb=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)),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,d=d.linewidth,d!==qb&&(j.lineWidth(d),qb=d),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;ra=-1;ab=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ob.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ab.setFromMatrix(Ob);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||Ab.intersectsObject(g))){D(g,b);var n=f,m=n.buffer,r=void 0,t=r=void 0,t=n.object.material;if(t instanceof THREE.MeshFaceMaterial)r=
|
|
|
+m.materialIndex,r=t.materials[r],r.transparent?(n.transparent=r,n.opaque=null):(n.opaque=r,n.transparent=null);else if(r=t)r.transparent?(n.transparent=r,n.opaque=null):(n.opaque=r,n.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(mb.copy(g.matrixWorld.getPosition()),mb.applyMatrix4(Ob),f.z=mb.z),f.id=g.id)}this.sortObjects&&h.sort(p);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(D(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),q(a.__webglObjects,!1,"",b,i,k,!0,d),l(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),q(a.__webglObjects,!0,"opaque",b,i,k,!1,d),l(a.__webglObjectsImmediate,"opaque",
|
|
|
b,i,k,!1,d),q(a.__webglObjects,!1,"transparent",b,i,k,!0,d),l(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=I(a,b,c,d,e);$=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,yb):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,m=void 0,l=void 0,p=void 0,q=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",Wa)),b instanceof THREE.Mesh)if(l=b.geometry,p=b.material,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=l,y=void 0,B=void 0,A=void 0,C=void 0,F=void 0,E=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups=
|
|
|
-{};y=0;for(B=s.faces.length;y<B;y++)A=s.faces[y],C=K?A.materialIndex:0,void 0===G[C]&&(G[C]={hash:C,counter:0}),E=G[C].hash+"_"+G[C].counter,void 0===s.geometryGroups[E]&&(s.geometryGroups[E]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:H,numMorphNormals:I}),F=A instanceof THREE.Face3?3:4,65535<s.geometryGroups[E].vertices+F&&(G[C].counter+=1,E=G[C].hash+"_"+G[C].counter,void 0===s.geometryGroups[E]&&(s.geometryGroups[E]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:H,
|
|
|
-numMorphNormals:I})),A instanceof THREE.Face3?s.geometryGroups[E].faces3.push(y):s.geometryGroups[E].faces4.push(y),s.geometryGroups[E].vertices+=F;s.geometryGroupsList=[];var L=void 0;for(L in s.geometryGroups)s.geometryGroups[L].id=jb++,s.geometryGroupsList.push(s.geometryGroups[L])}for(m in l.geometryGroups)if(q=l.geometryGroups[m],!q.__webglVertexBuffer){var J=q;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 ha=void 0,T=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=[];ha=0;for(T=J.numMorphTargets;ha<T;ha++)J.__webglMorphTargetsBuffers.push(j.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];ha=0;for(T=J.numMorphNormals;ha<
|
|
|
-T;ha++)J.__webglMorphNormalsBuffers.push(j.createBuffer())}M.info.memory.geometries++;d(q,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&&i(l);else if(b instanceof THREE.Ribbon){if(l=b.geometry,!l.__webglVertexBuffer){var U=l;U.__webglVertexBuffer=j.createBuffer();U.__webglColorBuffer=j.createBuffer();U.__webglNormalBuffer=j.createBuffer();
|
|
|
-M.info.memory.geometries++;var S=l,X=b,$=S.vertices.length;S.__vertexArray=new Float32Array(3*$);S.__colorArray=new Float32Array(3*$);S.__normalArray=new Float32Array(3*$);S.__webglVertexCount=$;c(S,X);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 W=l;W.__webglVertexBuffer=j.createBuffer();W.__webglColorBuffer=j.createBuffer();W.__webglLineDistanceBuffer=j.createBuffer();
|
|
|
-M.info.memory.geometries++;var da=l,oa=b,la=da.vertices.length;da.__vertexArray=new Float32Array(3*la);da.__colorArray=new Float32Array(3*la);da.__lineDistanceArray=new Float32Array(1*la);da.__webglLineCount=la;c(da,oa);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.lineDistancesNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&i(l)}else if(b instanceof THREE.ParticleSystem&&(l=b.geometry,!l.__webglVertexBuffer))if(l instanceof THREE.Geometry){var ta=l;ta.__webglVertexBuffer=j.createBuffer();
|
|
|
-ta.__webglColorBuffer=j.createBuffer();M.info.memory.geometries++;var Z=l,ra=b,ga=Z.vertices.length;Z.__vertexArray=new Float32Array(3*ga);Z.__colorArray=new Float32Array(3*ga);Z.__sortArray=[];Z.__webglParticleCount=ga;c(Z,ra);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&i(l);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(l=b.geometry,l instanceof THREE.BufferGeometry)r(k.__webglObjects,l,b);else{if(l instanceof THREE.Geometry)for(m in l.geometryGroups)q=
|
|
|
-l.geometryGroups[m],r(k.__webglObjects,q,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(l=b.geometry,r(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 ea=
|
|
|
-a.__objectsRemoved[0],ja=a;ea instanceof THREE.Mesh||ea instanceof THREE.ParticleSystem||ea instanceof THREE.Ribbon||ea instanceof THREE.Line?z(ja.__webglObjects,ea):ea instanceof THREE.Sprite?w(ja.__webglSprites,ea):ea instanceof THREE.LensFlare?w(ja.__webglFlares,ea):(ea instanceof THREE.ImmediateRenderObject||ea.immediateRenderCallback)&&z(ja.__webglObjectsImmediate,ea);ea.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Ea=0,sa=a.__webglObjects.length;Ea<sa;Ea++){var ma=a.__webglObjects[Ea].object,
|
|
|
-N=ma.geometry,ya=void 0,wa=void 0,ia=void 0;if(ma instanceof THREE.Mesh)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate)&&h(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 La=0,Na=N.geometryGroupsList.length;La<Na;La++)if(ya=N.geometryGroupsList[La],ia=e(ma,
|
|
|
-ya),N.buffersNeedUpdate&&d(ya,ma),wa=ia.attributes&&t(ia),N.verticesNeedUpdate||N.morphTargetsNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate||wa){var qa=ya,Pa=ma,xa=j.DYNAMIC_DRAW,Va=!N.dynamic,Ua=ia;if(qa.__inittedArrays){var mb=f(Ua),kb=Ua.vertexColors?Ua.vertexColors:!1,pb=g(Ua),gb=mb===THREE.SmoothShading,D=void 0,V=void 0,Qa=void 0,O=void 0,Xa=void 0,Ta=void 0,Sa=void 0,Bb=void 0,eb=void 0,qb=void 0,rb=void 0,P=void 0,Q=void 0,
|
|
|
-R=void 0,pa=void 0,$a=void 0,ab=void 0,fb=void 0,tb=void 0,Nb=void 0,Ob=void 0,Pb=void 0,yb=void 0,Qb=void 0,Rb=void 0,Sb=void 0,zb=void 0,Tb=void 0,Ub=void 0,Vb=void 0,Cb=void 0,Wb=void 0,Xb=void 0,Yb=void 0,Hb=void 0,za=void 0,jc=void 0,mc=void 0,xc=void 0,yc=void 0,bb=void 0,kc=void 0,Ya=void 0,Za=void 0,nc=void 0,ec=void 0,Ma=0,Ra=0,fc=0,gc=0,Db=0,nb=0,Ca=0,sb=0,Oa=0,ba=0,ka=0,v=0,Aa=void 0,cb=qa.__vertexArray,Kb=qa.__uvArray,Lb=qa.__uv2Array,Eb=qa.__normalArray,Ha=qa.__tangentArray,db=qa.__colorArray,
|
|
|
-Ia=qa.__skinIndexArray,Ja=qa.__skinWeightArray,dc=qa.__morphTargetsArrays,lc=qa.__morphNormalsArrays,sc=qa.__webglCustomAttributesList,u=void 0,Zb=qa.__faceArray,Ab=qa.__lineArray,ub=Pa.geometry,Kc=ub.elementsNeedUpdate,Cc=ub.uvsNeedUpdate,ad=ub.normalsNeedUpdate,bd=ub.tangentsNeedUpdate,cd=ub.colorsNeedUpdate,dd=ub.morphTargetsNeedUpdate,tc=ub.vertices,ua=qa.faces3,va=qa.faces4,ob=ub.faces,fd=ub.faceVertexUvs[0],gd=ub.faceVertexUvs[1],uc=ub.skinIndices,oc=ub.skinWeights,pc=ub.morphTargets,Lc=ub.morphNormals;
|
|
|
-if(ub.verticesNeedUpdate){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],P=tc[O.a],Q=tc[O.b],R=tc[O.c],cb[Ra]=P.x,cb[Ra+1]=P.y,cb[Ra+2]=P.z,cb[Ra+3]=Q.x,cb[Ra+4]=Q.y,cb[Ra+5]=Q.z,cb[Ra+6]=R.x,cb[Ra+7]=R.y,cb[Ra+8]=R.z,Ra+=9;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],P=tc[O.a],Q=tc[O.b],R=tc[O.c],pa=tc[O.d],cb[Ra]=P.x,cb[Ra+1]=P.y,cb[Ra+2]=P.z,cb[Ra+3]=Q.x,cb[Ra+4]=Q.y,cb[Ra+5]=Q.z,cb[Ra+6]=R.x,cb[Ra+7]=R.y,cb[Ra+8]=R.z,cb[Ra+9]=pa.x,cb[Ra+10]=pa.y,cb[Ra+11]=pa.z,Ra+=12;j.bindBuffer(j.ARRAY_BUFFER,qa.__webglVertexBuffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,cb,xa)}if(dd){bb=0;for(kc=pc.length;bb<kc;bb++){D=ka=0;for(V=ua.length;D<V;D++)nc=ua[D],O=ob[nc],P=pc[bb].vertices[O.a],Q=pc[bb].vertices[O.b],R=pc[bb].vertices[O.c],Ya=dc[bb],Ya[ka]=P.x,Ya[ka+1]=P.y,Ya[ka+2]=P.z,Ya[ka+3]=Q.x,Ya[ka+4]=Q.y,Ya[ka+5]=Q.z,Ya[ka+6]=R.x,Ya[ka+7]=R.y,Ya[ka+8]=R.z,Ua.morphNormals&&(gb?(ec=Lc[bb].vertexNormals[nc],Nb=ec.a,Ob=ec.b,Pb=ec.c):Pb=Ob=Nb=Lc[bb].faceNormals[nc],Za=lc[bb],Za[ka]=Nb.x,Za[ka+1]=Nb.y,Za[ka+2]=Nb.z,Za[ka+3]=Ob.x,Za[ka+4]=Ob.y,
|
|
|
-Za[ka+5]=Ob.z,Za[ka+6]=Pb.x,Za[ka+7]=Pb.y,Za[ka+8]=Pb.z),ka+=9;D=0;for(V=va.length;D<V;D++)nc=va[D],O=ob[nc],P=pc[bb].vertices[O.a],Q=pc[bb].vertices[O.b],R=pc[bb].vertices[O.c],pa=pc[bb].vertices[O.d],Ya=dc[bb],Ya[ka]=P.x,Ya[ka+1]=P.y,Ya[ka+2]=P.z,Ya[ka+3]=Q.x,Ya[ka+4]=Q.y,Ya[ka+5]=Q.z,Ya[ka+6]=R.x,Ya[ka+7]=R.y,Ya[ka+8]=R.z,Ya[ka+9]=pa.x,Ya[ka+10]=pa.y,Ya[ka+11]=pa.z,Ua.morphNormals&&(gb?(ec=Lc[bb].vertexNormals[nc],Nb=ec.a,Ob=ec.b,Pb=ec.c,yb=ec.d):yb=Pb=Ob=Nb=Lc[bb].faceNormals[nc],Za=lc[bb],Za[ka]=
|
|
|
-Nb.x,Za[ka+1]=Nb.y,Za[ka+2]=Nb.z,Za[ka+3]=Ob.x,Za[ka+4]=Ob.y,Za[ka+5]=Ob.z,Za[ka+6]=Pb.x,Za[ka+7]=Pb.y,Za[ka+8]=Pb.z,Za[ka+9]=yb.x,Za[ka+10]=yb.y,Za[ka+11]=yb.z),ka+=12;j.bindBuffer(j.ARRAY_BUFFER,qa.__webglMorphTargetsBuffers[bb]);j.bufferData(j.ARRAY_BUFFER,dc[bb],xa);Ua.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,qa.__webglMorphNormalsBuffers[bb]),j.bufferData(j.ARRAY_BUFFER,lc[bb],xa))}}if(oc.length){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],Tb=oc[O.a],Ub=oc[O.b],Vb=oc[O.c],Ja[ba]=Tb.x,Ja[ba+1]=
|
|
|
-Tb.y,Ja[ba+2]=Tb.z,Ja[ba+3]=Tb.w,Ja[ba+4]=Ub.x,Ja[ba+5]=Ub.y,Ja[ba+6]=Ub.z,Ja[ba+7]=Ub.w,Ja[ba+8]=Vb.x,Ja[ba+9]=Vb.y,Ja[ba+10]=Vb.z,Ja[ba+11]=Vb.w,Wb=uc[O.a],Xb=uc[O.b],Yb=uc[O.c],Ia[ba]=Wb.x,Ia[ba+1]=Wb.y,Ia[ba+2]=Wb.z,Ia[ba+3]=Wb.w,Ia[ba+4]=Xb.x,Ia[ba+5]=Xb.y,Ia[ba+6]=Xb.z,Ia[ba+7]=Xb.w,Ia[ba+8]=Yb.x,Ia[ba+9]=Yb.y,Ia[ba+10]=Yb.z,Ia[ba+11]=Yb.w,ba+=12;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],Tb=oc[O.a],Ub=oc[O.b],Vb=oc[O.c],Cb=oc[O.d],Ja[ba]=Tb.x,Ja[ba+1]=Tb.y,Ja[ba+2]=Tb.z,Ja[ba+3]=Tb.w,Ja[ba+4]=
|
|
|
-Ub.x,Ja[ba+5]=Ub.y,Ja[ba+6]=Ub.z,Ja[ba+7]=Ub.w,Ja[ba+8]=Vb.x,Ja[ba+9]=Vb.y,Ja[ba+10]=Vb.z,Ja[ba+11]=Vb.w,Ja[ba+12]=Cb.x,Ja[ba+13]=Cb.y,Ja[ba+14]=Cb.z,Ja[ba+15]=Cb.w,Wb=uc[O.a],Xb=uc[O.b],Yb=uc[O.c],Hb=uc[O.d],Ia[ba]=Wb.x,Ia[ba+1]=Wb.y,Ia[ba+2]=Wb.z,Ia[ba+3]=Wb.w,Ia[ba+4]=Xb.x,Ia[ba+5]=Xb.y,Ia[ba+6]=Xb.z,Ia[ba+7]=Xb.w,Ia[ba+8]=Yb.x,Ia[ba+9]=Yb.y,Ia[ba+10]=Yb.z,Ia[ba+11]=Yb.w,Ia[ba+12]=Hb.x,Ia[ba+13]=Hb.y,Ia[ba+14]=Hb.z,Ia[ba+15]=Hb.w,ba+=16;0<ba&&(j.bindBuffer(j.ARRAY_BUFFER,qa.__webglSkinIndicesBuffer),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,Ia,xa),j.bindBuffer(j.ARRAY_BUFFER,qa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,xa))}if(cd&&kb){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],Sa=O.vertexColors,Bb=O.color,3===Sa.length&&kb===THREE.VertexColors?(Qb=Sa[0],Rb=Sa[1],Sb=Sa[2]):Sb=Rb=Qb=Bb,db[Oa]=Qb.r,db[Oa+1]=Qb.g,db[Oa+2]=Qb.b,db[Oa+3]=Rb.r,db[Oa+4]=Rb.g,db[Oa+5]=Rb.b,db[Oa+6]=Sb.r,db[Oa+7]=Sb.g,db[Oa+8]=Sb.b,Oa+=9;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],Sa=O.vertexColors,Bb=O.color,4===Sa.length&&
|
|
|
-kb===THREE.VertexColors?(Qb=Sa[0],Rb=Sa[1],Sb=Sa[2],zb=Sa[3]):zb=Sb=Rb=Qb=Bb,db[Oa]=Qb.r,db[Oa+1]=Qb.g,db[Oa+2]=Qb.b,db[Oa+3]=Rb.r,db[Oa+4]=Rb.g,db[Oa+5]=Rb.b,db[Oa+6]=Sb.r,db[Oa+7]=Sb.g,db[Oa+8]=Sb.b,db[Oa+9]=zb.r,db[Oa+10]=zb.g,db[Oa+11]=zb.b,Oa+=12;0<Oa&&(j.bindBuffer(j.ARRAY_BUFFER,qa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,db,xa))}if(bd&&ub.hasTangents){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],eb=O.vertexTangents,$a=eb[0],ab=eb[1],fb=eb[2],Ha[Ca]=$a.x,Ha[Ca+1]=$a.y,Ha[Ca+2]=$a.z,Ha[Ca+
|
|
|
-3]=$a.w,Ha[Ca+4]=ab.x,Ha[Ca+5]=ab.y,Ha[Ca+6]=ab.z,Ha[Ca+7]=ab.w,Ha[Ca+8]=fb.x,Ha[Ca+9]=fb.y,Ha[Ca+10]=fb.z,Ha[Ca+11]=fb.w,Ca+=12;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],eb=O.vertexTangents,$a=eb[0],ab=eb[1],fb=eb[2],tb=eb[3],Ha[Ca]=$a.x,Ha[Ca+1]=$a.y,Ha[Ca+2]=$a.z,Ha[Ca+3]=$a.w,Ha[Ca+4]=ab.x,Ha[Ca+5]=ab.y,Ha[Ca+6]=ab.z,Ha[Ca+7]=ab.w,Ha[Ca+8]=fb.x,Ha[Ca+9]=fb.y,Ha[Ca+10]=fb.z,Ha[Ca+11]=fb.w,Ha[Ca+12]=tb.x,Ha[Ca+13]=tb.y,Ha[Ca+14]=tb.z,Ha[Ca+15]=tb.w,Ca+=16;j.bindBuffer(j.ARRAY_BUFFER,qa.__webglTangentBuffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,Ha,xa)}if(ad&&mb){D=0;for(V=ua.length;D<V;D++)if(O=ob[ua[D]],Xa=O.vertexNormals,Ta=O.normal,3===Xa.length&&gb)for(za=0;3>za;za++)mc=Xa[za],Eb[nb]=mc.x,Eb[nb+1]=mc.y,Eb[nb+2]=mc.z,nb+=3;else for(za=0;3>za;za++)Eb[nb]=Ta.x,Eb[nb+1]=Ta.y,Eb[nb+2]=Ta.z,nb+=3;D=0;for(V=va.length;D<V;D++)if(O=ob[va[D]],Xa=O.vertexNormals,Ta=O.normal,4===Xa.length&&gb)for(za=0;4>za;za++)mc=Xa[za],Eb[nb]=mc.x,Eb[nb+1]=mc.y,Eb[nb+2]=mc.z,nb+=3;else for(za=0;4>za;za++)Eb[nb]=Ta.x,Eb[nb+1]=Ta.y,Eb[nb+
|
|
|
-2]=Ta.z,nb+=3;j.bindBuffer(j.ARRAY_BUFFER,qa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Eb,xa)}if(Cc&&fd&&pb){D=0;for(V=ua.length;D<V;D++)if(Qa=ua[D],qb=fd[Qa],void 0!==qb)for(za=0;3>za;za++)xc=qb[za],Kb[fc]=xc.x,Kb[fc+1]=xc.y,fc+=2;D=0;for(V=va.length;D<V;D++)if(Qa=va[D],qb=fd[Qa],void 0!==qb)for(za=0;4>za;za++)xc=qb[za],Kb[fc]=xc.x,Kb[fc+1]=xc.y,fc+=2;0<fc&&(j.bindBuffer(j.ARRAY_BUFFER,qa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Kb,xa))}if(Cc&&gd&&pb){D=0;for(V=ua.length;D<V;D++)if(Qa=
|
|
|
-ua[D],rb=gd[Qa],void 0!==rb)for(za=0;3>za;za++)yc=rb[za],Lb[gc]=yc.x,Lb[gc+1]=yc.y,gc+=2;D=0;for(V=va.length;D<V;D++)if(Qa=va[D],rb=gd[Qa],void 0!==rb)for(za=0;4>za;za++)yc=rb[za],Lb[gc]=yc.x,Lb[gc+1]=yc.y,gc+=2;0<gc&&(j.bindBuffer(j.ARRAY_BUFFER,qa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Lb,xa))}if(Kc){D=0;for(V=ua.length;D<V;D++)Zb[Db]=Ma,Zb[Db+1]=Ma+1,Zb[Db+2]=Ma+2,Db+=3,Ab[sb]=Ma,Ab[sb+1]=Ma+1,Ab[sb+2]=Ma,Ab[sb+3]=Ma+2,Ab[sb+4]=Ma+1,Ab[sb+5]=Ma+2,sb+=6,Ma+=3;D=0;for(V=va.length;D<V;D++)Zb[Db]=
|
|
|
-Ma,Zb[Db+1]=Ma+1,Zb[Db+2]=Ma+3,Zb[Db+3]=Ma+1,Zb[Db+4]=Ma+2,Zb[Db+5]=Ma+3,Db+=6,Ab[sb]=Ma,Ab[sb+1]=Ma+1,Ab[sb+2]=Ma,Ab[sb+3]=Ma+3,Ab[sb+4]=Ma+1,Ab[sb+5]=Ma+2,Ab[sb+6]=Ma+2,Ab[sb+7]=Ma+3,sb+=8,Ma+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,qa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Zb,xa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,qa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ab,xa)}if(sc){za=0;for(jc=sc.length;za<jc;za++)if(u=sc[za],u.__original.needsUpdate){v=0;if(1===u.size)if(void 0===
|
|
|
-u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],u.array[v]=u.value[O.a],u.array[v+1]=u.value[O.b],u.array[v+2]=u.value[O.c],v+=3;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],u.array[v]=u.value[O.a],u.array[v+1]=u.value[O.b],u.array[v+2]=u.value[O.c],u.array[v+3]=u.value[O.d],v+=4}else{if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Aa=u.value[ua[D]],u.array[v]=Aa,u.array[v+1]=Aa,u.array[v+2]=Aa,v+=3;D=0;for(V=va.length;D<V;D++)Aa=u.value[va[D]],u.array[v]=Aa,u.array[v+1]=
|
|
|
-Aa,u.array[v+2]=Aa,u.array[v+3]=Aa,v+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],P=u.value[O.a],Q=u.value[O.b],R=u.value[O.c],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=Q.x,u.array[v+3]=Q.y,u.array[v+4]=R.x,u.array[v+5]=R.y,v+=6;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],P=u.value[O.a],Q=u.value[O.b],R=u.value[O.c],pa=u.value[O.d],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=Q.x,u.array[v+3]=Q.y,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+
|
|
|
-6]=pa.x,u.array[v+7]=pa.y,v+=8}else{if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)R=Q=P=Aa=u.value[ua[D]],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=Q.x,u.array[v+3]=Q.y,u.array[v+4]=R.x,u.array[v+5]=R.y,v+=6;D=0;for(V=va.length;D<V;D++)pa=R=Q=P=Aa=u.value[va[D]],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=Q.x,u.array[v+3]=Q.y,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+6]=pa.x,u.array[v+7]=pa.y,v+=8}}else if(3===u.size){var aa;aa="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||
|
|
|
-"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)O=ob[ua[D]],P=u.value[O.a],Q=u.value[O.b],R=u.value[O.c],u.array[v]=P[aa[0]],u.array[v+1]=P[aa[1]],u.array[v+2]=P[aa[2]],u.array[v+3]=Q[aa[0]],u.array[v+4]=Q[aa[1]],u.array[v+5]=Q[aa[2]],u.array[v+6]=R[aa[0]],u.array[v+7]=R[aa[1]],u.array[v+8]=R[aa[2]],v+=9;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],P=u.value[O.a],Q=u.value[O.b],R=u.value[O.c],pa=u.value[O.d],u.array[v]=P[aa[0]],u.array[v+1]=P[aa[1]],u.array[v+2]=P[aa[2]],u.array[v+3]=Q[aa[0]],u.array[v+
|
|
|
-4]=Q[aa[1]],u.array[v+5]=Q[aa[2]],u.array[v+6]=R[aa[0]],u.array[v+7]=R[aa[1]],u.array[v+8]=R[aa[2]],u.array[v+9]=pa[aa[0]],u.array[v+10]=pa[aa[1]],u.array[v+11]=pa[aa[2]],v+=12}else if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)R=Q=P=Aa=u.value[ua[D]],u.array[v]=P[aa[0]],u.array[v+1]=P[aa[1]],u.array[v+2]=P[aa[2]],u.array[v+3]=Q[aa[0]],u.array[v+4]=Q[aa[1]],u.array[v+5]=Q[aa[2]],u.array[v+6]=R[aa[0]],u.array[v+7]=R[aa[1]],u.array[v+8]=R[aa[2]],v+=9;D=0;for(V=va.length;D<V;D++)pa=R=Q=P=Aa=u.value[va[D]],
|
|
|
-u.array[v]=P[aa[0]],u.array[v+1]=P[aa[1]],u.array[v+2]=P[aa[2]],u.array[v+3]=Q[aa[0]],u.array[v+4]=Q[aa[1]],u.array[v+5]=Q[aa[2]],u.array[v+6]=R[aa[0]],u.array[v+7]=R[aa[1]],u.array[v+8]=R[aa[2]],u.array[v+9]=pa[aa[0]],u.array[v+10]=pa[aa[1]],u.array[v+11]=pa[aa[2]],v+=12}else if("faceVertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Aa=u.value[ua[D]],P=Aa[0],Q=Aa[1],R=Aa[2],u.array[v]=P[aa[0]],u.array[v+1]=P[aa[1]],u.array[v+2]=P[aa[2]],u.array[v+3]=Q[aa[0]],u.array[v+4]=Q[aa[1]],u.array[v+5]=Q[aa[2]],
|
|
|
-u.array[v+6]=R[aa[0]],u.array[v+7]=R[aa[1]],u.array[v+8]=R[aa[2]],v+=9;D=0;for(V=va.length;D<V;D++)Aa=u.value[va[D]],P=Aa[0],Q=Aa[1],R=Aa[2],pa=Aa[3],u.array[v]=P[aa[0]],u.array[v+1]=P[aa[1]],u.array[v+2]=P[aa[2]],u.array[v+3]=Q[aa[0]],u.array[v+4]=Q[aa[1]],u.array[v+5]=Q[aa[2]],u.array[v+6]=R[aa[0]],u.array[v+7]=R[aa[1]],u.array[v+8]=R[aa[2]],u.array[v+9]=pa[aa[0]],u.array[v+10]=pa[aa[1]],u.array[v+11]=pa[aa[2]],v+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<
|
|
|
-V;D++)O=ob[ua[D]],P=u.value[O.a],Q=u.value[O.b],R=u.value[O.c],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=P.z,u.array[v+3]=P.w,u.array[v+4]=Q.x,u.array[v+5]=Q.y,u.array[v+6]=Q.z,u.array[v+7]=Q.w,u.array[v+8]=R.x,u.array[v+9]=R.y,u.array[v+10]=R.z,u.array[v+11]=R.w,v+=12;D=0;for(V=va.length;D<V;D++)O=ob[va[D]],P=u.value[O.a],Q=u.value[O.b],R=u.value[O.c],pa=u.value[O.d],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=P.z,u.array[v+3]=P.w,u.array[v+4]=Q.x,u.array[v+5]=Q.y,u.array[v+6]=Q.z,u.array[v+
|
|
|
-7]=Q.w,u.array[v+8]=R.x,u.array[v+9]=R.y,u.array[v+10]=R.z,u.array[v+11]=R.w,u.array[v+12]=pa.x,u.array[v+13]=pa.y,u.array[v+14]=pa.z,u.array[v+15]=pa.w,v+=16}else if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)R=Q=P=Aa=u.value[ua[D]],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=P.z,u.array[v+3]=P.w,u.array[v+4]=Q.x,u.array[v+5]=Q.y,u.array[v+6]=Q.z,u.array[v+7]=Q.w,u.array[v+8]=R.x,u.array[v+9]=R.y,u.array[v+10]=R.z,u.array[v+11]=R.w,v+=12;D=0;for(V=va.length;D<V;D++)pa=R=Q=P=Aa=u.value[va[D]],
|
|
|
-u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=P.z,u.array[v+3]=P.w,u.array[v+4]=Q.x,u.array[v+5]=Q.y,u.array[v+6]=Q.z,u.array[v+7]=Q.w,u.array[v+8]=R.x,u.array[v+9]=R.y,u.array[v+10]=R.z,u.array[v+11]=R.w,u.array[v+12]=pa.x,u.array[v+13]=pa.y,u.array[v+14]=pa.z,u.array[v+15]=pa.w,v+=16}else if("faceVertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Aa=u.value[ua[D]],P=Aa[0],Q=Aa[1],R=Aa[2],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=P.z,u.array[v+3]=P.w,u.array[v+4]=Q.x,u.array[v+5]=Q.y,u.array[v+
|
|
|
-6]=Q.z,u.array[v+7]=Q.w,u.array[v+8]=R.x,u.array[v+9]=R.y,u.array[v+10]=R.z,u.array[v+11]=R.w,v+=12;D=0;for(V=va.length;D<V;D++)Aa=u.value[va[D]],P=Aa[0],Q=Aa[1],R=Aa[2],pa=Aa[3],u.array[v]=P.x,u.array[v+1]=P.y,u.array[v+2]=P.z,u.array[v+3]=P.w,u.array[v+4]=Q.x,u.array[v+5]=Q.y,u.array[v+6]=Q.z,u.array[v+7]=Q.w,u.array[v+8]=R.x,u.array[v+9]=R.y,u.array[v+10]=R.z,u.array[v+11]=R.w,u.array[v+12]=pa.x,u.array[v+13]=pa.y,u.array[v+14]=pa.z,u.array[v+15]=pa.w,v+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,u.array,xa)}}Va&&(delete qa.__inittedArrays,delete qa.__colorArray,delete qa.__normalArray,delete qa.__tangentArray,delete qa.__uvArray,delete qa.__uv2Array,delete qa.__faceArray,delete qa.__vertexArray,delete qa.__lineArray,delete qa.__skinIndexArray,delete qa.__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;ia.attributes&&
|
|
|
-x(ia)}else if(ma instanceof THREE.Ribbon){ia=e(ma,N);wa=ia.attributes&&t(ia);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.normalsNeedUpdate||wa){var Fb=N,Mc=j.DYNAMIC_DRAW,Dc=void 0,Ec=void 0,Fc=void 0,Nc=void 0,Ba=void 0,Oc=void 0,Pc=void 0,Qc=void 0,md=void 0,hb=void 0,zc=void 0,Fa=void 0,vb=void 0,nd=Fb.vertices,od=Fb.colors,pd=Fb.normals,yd=nd.length,zd=od.length,Ad=pd.length,Rc=Fb.__vertexArray,Sc=Fb.__colorArray,Tc=Fb.__normalArray,Bd=Fb.colorsNeedUpdate,Cd=Fb.normalsNeedUpdate,hd=Fb.__webglCustomAttributesList;
|
|
|
-if(Fb.verticesNeedUpdate){for(Dc=0;Dc<yd;Dc++)Nc=nd[Dc],Ba=3*Dc,Rc[Ba]=Nc.x,Rc[Ba+1]=Nc.y,Rc[Ba+2]=Nc.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,Mc)}if(Bd){for(Ec=0;Ec<zd;Ec++)Oc=od[Ec],Ba=3*Ec,Sc[Ba]=Oc.r,Sc[Ba+1]=Oc.g,Sc[Ba+2]=Oc.b;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,Mc)}if(Cd){for(Fc=0;Fc<Ad;Fc++)Pc=pd[Fc],Ba=3*Fc,Tc[Ba]=Pc.x,Tc[Ba+1]=Pc.y,Tc[Ba+2]=Pc.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Tc,Mc)}if(hd){Qc=0;for(md=hd.length;Qc<md;Qc++)if(Fa=hd[Qc],Fa.needsUpdate&&(void 0===Fa.boundTo||"vertices"===Fa.boundTo)){Ba=0;zc=Fa.value.length;if(1===Fa.size)for(hb=0;hb<zc;hb++)Fa.array[hb]=Fa.value[hb];else if(2===Fa.size)for(hb=0;hb<zc;hb++)vb=Fa.value[hb],Fa.array[Ba]=vb.x,Fa.array[Ba+1]=vb.y,Ba+=2;else if(3===Fa.size)if("c"===Fa.type)for(hb=0;hb<zc;hb++)vb=Fa.value[hb],Fa.array[Ba]=vb.r,Fa.array[Ba+1]=vb.g,Fa.array[Ba+2]=vb.b,Ba+=3;else for(hb=0;hb<zc;hb++)vb=Fa.value[hb],Fa.array[Ba]=vb.x,
|
|
|
-Fa.array[Ba+1]=vb.y,Fa.array[Ba+2]=vb.z,Ba+=3;else if(4===Fa.size)for(hb=0;hb<zc;hb++)vb=Fa.value[hb],Fa.array[Ba]=vb.x,Fa.array[Ba+1]=vb.y,Fa.array[Ba+2]=vb.z,Fa.array[Ba+3]=vb.w,Ba+=4;j.bindBuffer(j.ARRAY_BUFFER,Fa.buffer);j.bufferData(j.ARRAY_BUFFER,Fa.array,Mc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.normalsNeedUpdate=!1;ia.attributes&&x(ia)}else if(ma instanceof THREE.Line)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&h(N,j.DYNAMIC_DRAW,!N.dynamic),
|
|
|
-N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ia=e(ma,N);wa=ia.attributes&&t(ia);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.lineDistancesNeedUpdate||wa){var Gb=N,Uc=j.DYNAMIC_DRAW,Gc=void 0,Hc=void 0,Ic=void 0,Vc=void 0,Ka=void 0,Wc=void 0,qd=Gb.vertices,rd=Gb.colors,sd=Gb.lineDistances,Dd=qd.length,Ed=rd.length,Fd=sd.length,Xc=Gb.__vertexArray,Yc=Gb.__colorArray,td=Gb.__lineDistanceArray,Gd=Gb.colorsNeedUpdate,Hd=Gb.lineDistancesNeedUpdate,id=Gb.__webglCustomAttributesList,Zc=void 0,ud=
|
|
|
-void 0,ib=void 0,Ac=void 0,wb=void 0,Ga=void 0;if(Gb.verticesNeedUpdate){for(Gc=0;Gc<Dd;Gc++)Vc=qd[Gc],Ka=3*Gc,Xc[Ka]=Vc.x,Xc[Ka+1]=Vc.y,Xc[Ka+2]=Vc.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,Uc)}if(Gd){for(Hc=0;Hc<Ed;Hc++)Wc=rd[Hc],Ka=3*Hc,Yc[Ka]=Wc.r,Yc[Ka+1]=Wc.g,Yc[Ka+2]=Wc.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Yc,Uc)}if(Hd){for(Ic=0;Ic<Fd;Ic++)td[Ic]=sd[Ic];j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglLineDistanceBuffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,td,Uc)}if(id){Zc=0;for(ud=id.length;Zc<ud;Zc++)if(Ga=id[Zc],Ga.needsUpdate&&(void 0===Ga.boundTo||"vertices"===Ga.boundTo)){Ka=0;Ac=Ga.value.length;if(1===Ga.size)for(ib=0;ib<Ac;ib++)Ga.array[ib]=Ga.value[ib];else if(2===Ga.size)for(ib=0;ib<Ac;ib++)wb=Ga.value[ib],Ga.array[Ka]=wb.x,Ga.array[Ka+1]=wb.y,Ka+=2;else if(3===Ga.size)if("c"===Ga.type)for(ib=0;ib<Ac;ib++)wb=Ga.value[ib],Ga.array[Ka]=wb.r,Ga.array[Ka+1]=wb.g,Ga.array[Ka+2]=wb.b,Ka+=3;else for(ib=0;ib<Ac;ib++)wb=
|
|
|
-Ga.value[ib],Ga.array[Ka]=wb.x,Ga.array[Ka+1]=wb.y,Ga.array[Ka+2]=wb.z,Ka+=3;else if(4===Ga.size)for(ib=0;ib<Ac;ib++)wb=Ga.value[ib],Ga.array[Ka]=wb.x,Ga.array[Ka+1]=wb.y,Ga.array[Ka+2]=wb.z,Ga.array[Ka+3]=wb.w,Ka+=4;j.bindBuffer(j.ARRAY_BUFFER,Ga.buffer);j.bufferData(j.ARRAY_BUFFER,Ga.array,Uc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.lineDistancesNeedUpdate=!1;ia.attributes&&x(ia)}else if(ma instanceof THREE.ParticleSystem)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&
|
|
|
-h(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ia=e(ma,N);wa=ia.attributes&&t(ia);if(N.verticesNeedUpdate||N.colorsNeedUpdate||ma.sortParticles||wa){var $b=N,jd=j.DYNAMIC_DRAW,Jc=ma,xb=void 0,ac=void 0,bc=void 0,fa=void 0,cc=void 0,qc=void 0,$c=$b.vertices,kd=$c.length,ld=$b.colors,vd=ld.length,vc=$b.__vertexArray,wc=$b.__colorArray,hc=$b.__sortArray,wd=$b.verticesNeedUpdate,xd=$b.colorsNeedUpdate,ic=$b.__webglCustomAttributesList,Ib=void 0,Bc=void 0,na=void 0,Jb=
|
|
|
-void 0,Da=void 0,ca=void 0;if(Jc.sortParticles){rc.copy(Mb);rc.multiply(Jc.matrixWorld);for(xb=0;xb<kd;xb++)bc=$c[xb],lb.copy(bc),lb.applyMatrix4(rc),hc[xb]=[lb.z,xb];hc.sort(n);for(xb=0;xb<kd;xb++)bc=$c[hc[xb][1]],fa=3*xb,vc[fa]=bc.x,vc[fa+1]=bc.y,vc[fa+2]=bc.z;for(ac=0;ac<vd;ac++)fa=3*ac,qc=ld[hc[ac][1]],wc[fa]=qc.r,wc[fa+1]=qc.g,wc[fa+2]=qc.b;if(ic){Ib=0;for(Bc=ic.length;Ib<Bc;Ib++)if(ca=ic[Ib],void 0===ca.boundTo||"vertices"===ca.boundTo)if(fa=0,Jb=ca.value.length,1===ca.size)for(na=0;na<Jb;na++)cc=
|
|
|
-hc[na][1],ca.array[na]=ca.value[cc];else if(2===ca.size)for(na=0;na<Jb;na++)cc=hc[na][1],Da=ca.value[cc],ca.array[fa]=Da.x,ca.array[fa+1]=Da.y,fa+=2;else if(3===ca.size)if("c"===ca.type)for(na=0;na<Jb;na++)cc=hc[na][1],Da=ca.value[cc],ca.array[fa]=Da.r,ca.array[fa+1]=Da.g,ca.array[fa+2]=Da.b,fa+=3;else for(na=0;na<Jb;na++)cc=hc[na][1],Da=ca.value[cc],ca.array[fa]=Da.x,ca.array[fa+1]=Da.y,ca.array[fa+2]=Da.z,fa+=3;else if(4===ca.size)for(na=0;na<Jb;na++)cc=hc[na][1],Da=ca.value[cc],ca.array[fa]=Da.x,
|
|
|
-ca.array[fa+1]=Da.y,ca.array[fa+2]=Da.z,ca.array[fa+3]=Da.w,fa+=4}}else{if(wd)for(xb=0;xb<kd;xb++)bc=$c[xb],fa=3*xb,vc[fa]=bc.x,vc[fa+1]=bc.y,vc[fa+2]=bc.z;if(xd)for(ac=0;ac<vd;ac++)qc=ld[ac],fa=3*ac,wc[fa]=qc.r,wc[fa+1]=qc.g,wc[fa+2]=qc.b;if(ic){Ib=0;for(Bc=ic.length;Ib<Bc;Ib++)if(ca=ic[Ib],ca.needsUpdate&&(void 0===ca.boundTo||"vertices"===ca.boundTo))if(Jb=ca.value.length,fa=0,1===ca.size)for(na=0;na<Jb;na++)ca.array[na]=ca.value[na];else if(2===ca.size)for(na=0;na<Jb;na++)Da=ca.value[na],ca.array[fa]=
|
|
|
-Da.x,ca.array[fa+1]=Da.y,fa+=2;else if(3===ca.size)if("c"===ca.type)for(na=0;na<Jb;na++)Da=ca.value[na],ca.array[fa]=Da.r,ca.array[fa+1]=Da.g,ca.array[fa+2]=Da.b,fa+=3;else for(na=0;na<Jb;na++)Da=ca.value[na],ca.array[fa]=Da.x,ca.array[fa+1]=Da.y,ca.array[fa+2]=Da.z,fa+=3;else if(4===ca.size)for(na=0;na<Jb;na++)Da=ca.value[na],ca.array[fa]=Da.x,ca.array[fa+1]=Da.y,ca.array[fa+2]=Da.z,ca.array[fa+3]=Da.w,fa+=4}}if(wd||Jc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,$b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-vc,jd);if(xd||Jc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,$b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,wc,jd);if(ic){Ib=0;for(Bc=ic.length;Ib<Bc;Ib++)if(ca=ic[Ib],ca.needsUpdate||Jc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ca.buffer),j.bufferData(j.ARRAY_BUFFER,ca.array,jd)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ia.attributes&&x(ia)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Qa);var i,k,n,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof
|
|
|
-THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var p=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=
|
|
|
-p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;h=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);l=q;ab&&d&&d.useVertexTexture?n=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)")),n=b);a:{s=a.fragmentShader;r=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:n,useVertexTexture:ab&&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,x,w,d=[];m?d.push(m):(d.push(s),d.push(r));for(x in q)d.push(x),d.push(q[x]);for(t in c)d.push(t),d.push(c[t]);m=d.join();t=0;for(x=ha.length;t<x;t++)if(d=ha[t],d.code===m){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");
|
|
|
-x=[];for(w in q)d=q[w],!1!==d&&(d="#define "+w+" "+d,x.push(d));d=x.join("\n");w=j.createProgram();x=["precision "+T+" float;",d,fb?"#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 "+T+" 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":"",
|
|
|
+null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=I(a,b,c,d,e);da=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ab):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,m=void 0,l=void 0,p=void 0,q=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",Xa)),b instanceof THREE.Mesh)if(l=b.geometry,p=b.material,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=l,y=void 0,A=void 0,D=void 0,B=void 0,F=void 0,E=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,L=p instanceof THREE.MeshFaceMaterial;s.geometryGroups=
|
|
|
+{};y=0;for(A=s.faces.length;y<A;y++)D=s.faces[y],B=L?D.materialIndex:0,void 0===G[B]&&(G[B]={hash:B,counter:0}),E=G[B].hash+"_"+G[B].counter,void 0===s.geometryGroups[E]&&(s.geometryGroups[E]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:H,numMorphNormals:I}),F=D instanceof THREE.Face3?3:4,65535<s.geometryGroups[E].vertices+F&&(G[B].counter+=1,E=G[B].hash+"_"+G[B].counter,void 0===s.geometryGroups[E]&&(s.geometryGroups[E]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:H,
|
|
|
+numMorphNormals:I})),D instanceof THREE.Face3?s.geometryGroups[E].faces3.push(y):s.geometryGroups[E].faces4.push(y),s.geometryGroups[E].vertices+=F;s.geometryGroupsList=[];var K=void 0;for(K in s.geometryGroups)s.geometryGroups[K].id=oa++,s.geometryGroupsList.push(s.geometryGroups[K])}for(m in l.geometryGroups)if(q=l.geometryGroups[m],!q.__webglVertexBuffer){var J=q;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 P=void 0,ja=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=[];P=0;for(ja=J.numMorphTargets;P<ja;P++)J.__webglMorphTargetsBuffers.push(j.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];P=0;for(ja=J.numMorphNormals;P<
|
|
|
+ja;P++)J.__webglMorphNormalsBuffers.push(j.createBuffer())}M.info.memory.geometries++;d(q,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&&i(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 U=l,X=b,W=U.vertices.length;U.__vertexArray=new Float32Array(3*W);U.__colorArray=new Float32Array(3*W);U.__normalArray=new Float32Array(3*W);U.__webglVertexCount=W;c(U,X);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 da=l;da.__webglVertexBuffer=j.createBuffer();da.__webglColorBuffer=j.createBuffer();da.__webglLineDistanceBuffer=j.createBuffer();
|
|
|
+M.info.memory.geometries++;var ha=l,aa=b,ya=ha.vertices.length;ha.__vertexArray=new Float32Array(3*ya);ha.__colorArray=new Float32Array(3*ya);ha.__lineDistanceArray=new Float32Array(1*ya);ha.__webglLineCount=ya;c(ha,aa);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.lineDistancesNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&i(l)}else if(b instanceof THREE.ParticleSystem&&(l=b.geometry,!l.__webglVertexBuffer))if(l instanceof THREE.Geometry){var za=l;za.__webglVertexBuffer=j.createBuffer();
|
|
|
+za.__webglColorBuffer=j.createBuffer();M.info.memory.geometries++;var Ga=l,fa=b,ra=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*ra);Ga.__colorArray=new Float32Array(3*ra);Ga.__sortArray=[];Ga.__webglParticleCount=ra;c(Ga,fa);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&i(l);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(l=b.geometry,l instanceof THREE.BufferGeometry)r(k.__webglObjects,l,b);else{if(l instanceof THREE.Geometry)for(m in l.geometryGroups)q=
|
|
|
+l.geometryGroups[m],r(k.__webglObjects,q,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(l=b.geometry,r(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 ka=
|
|
|
+a.__objectsRemoved[0],la=a;ka instanceof THREE.Mesh||ka instanceof THREE.ParticleSystem||ka instanceof THREE.Ribbon||ka instanceof THREE.Line?z(la.__webglObjects,ka):ka instanceof THREE.Sprite?w(la.__webglSprites,ka):ka instanceof THREE.LensFlare?w(la.__webglFlares,ka):(ka instanceof THREE.ImmediateRenderObject||ka.immediateRenderCallback)&&z(la.__webglObjectsImmediate,ka);ka.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var na=0,va=a.__webglObjects.length;na<va;na++){var ga=a.__webglObjects[na].object,
|
|
|
+N=ga.geometry,sa=void 0,ta=void 0,ea=void 0;if(ga instanceof THREE.Mesh)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate)&&h(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,Ra=N.geometryGroupsList.length;Da<Ra;Da++)if(sa=N.geometryGroupsList[Da],ea=e(ga,
|
|
|
+sa),N.buffersNeedUpdate&&d(sa,ga),ta=ea.attributes&&t(ea),N.verticesNeedUpdate||N.morphTargetsNeedUpdate||N.elementsNeedUpdate||N.uvsNeedUpdate||N.normalsNeedUpdate||N.colorsNeedUpdate||N.tangentsNeedUpdate||ta){var ua=sa,Ha=ga,qa=j.DYNAMIC_DRAW,Sa=!N.dynamic,Ka=ea;if(ua.__inittedArrays){var lb=f(Ka),gb=Ka.vertexColors?Ka.vertexColors:!1,pb=g(Ka),ib=lb===THREE.SmoothShading,C=void 0,V=void 0,Ua=void 0,O=void 0,Ya=void 0,Va=void 0,Pa=void 0,tb=void 0,fb=void 0,qb=void 0,rb=void 0,Q=void 0,R=void 0,
|
|
|
+S=void 0,pa=void 0,ab=void 0,bb=void 0,hb=void 0,ub=void 0,Pb=void 0,Qb=void 0,Rb=void 0,zb=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ab=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Bb=void 0,Yb=void 0,Zb=void 0,$b=void 0,Db=void 0,Aa=void 0,Lb=void 0,mc=void 0,Eb=void 0,xc=void 0,cb=void 0,kc=void 0,Za=void 0,$a=void 0,nc=void 0,fc=void 0,Qa=0,Wa=0,gc=0,hc=0,Fb=0,nb=0,Ea=0,sb=0,Ta=0,$=0,ia=0,v=0,Ba=void 0,db=ua.__vertexArray,Mb=ua.__uvArray,Nb=ua.__uv2Array,Gb=ua.__normalArray,La=ua.__tangentArray,eb=ua.__colorArray,
|
|
|
+Ma=ua.__skinIndexArray,Na=ua.__skinWeightArray,lc=ua.__morphTargetsArrays,sc=ua.__morphNormalsArrays,ed=ua.__webglCustomAttributesList,u=void 0,ac=ua.__faceArray,Cb=ua.__lineArray,vb=Ha.geometry,Jc=vb.elementsNeedUpdate,Bc=vb.uvsNeedUpdate,$c=vb.normalsNeedUpdate,ad=vb.tangentsNeedUpdate,bd=vb.colorsNeedUpdate,cd=vb.morphTargetsNeedUpdate,tc=vb.vertices,wa=ua.faces3,xa=ua.faces4,ob=vb.faces,fd=vb.faceVertexUvs[0],gd=vb.faceVertexUvs[1],uc=vb.skinIndices,oc=vb.skinWeights,pc=vb.morphTargets,Kc=vb.morphNormals;
|
|
|
+if(vb.verticesNeedUpdate){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],Q=tc[O.a],R=tc[O.b],S=tc[O.c],db[Wa]=Q.x,db[Wa+1]=Q.y,db[Wa+2]=Q.z,db[Wa+3]=R.x,db[Wa+4]=R.y,db[Wa+5]=R.z,db[Wa+6]=S.x,db[Wa+7]=S.y,db[Wa+8]=S.z,Wa+=9;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],Q=tc[O.a],R=tc[O.b],S=tc[O.c],pa=tc[O.d],db[Wa]=Q.x,db[Wa+1]=Q.y,db[Wa+2]=Q.z,db[Wa+3]=R.x,db[Wa+4]=R.y,db[Wa+5]=R.z,db[Wa+6]=S.x,db[Wa+7]=S.y,db[Wa+8]=S.z,db[Wa+9]=pa.x,db[Wa+10]=pa.y,db[Wa+11]=pa.z,Wa+=12;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglVertexBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,db,qa)}if(cd){cb=0;for(kc=pc.length;cb<kc;cb++){C=ia=0;for(V=wa.length;C<V;C++)nc=wa[C],O=ob[nc],Q=pc[cb].vertices[O.a],R=pc[cb].vertices[O.b],S=pc[cb].vertices[O.c],Za=lc[cb],Za[ia]=Q.x,Za[ia+1]=Q.y,Za[ia+2]=Q.z,Za[ia+3]=R.x,Za[ia+4]=R.y,Za[ia+5]=R.z,Za[ia+6]=S.x,Za[ia+7]=S.y,Za[ia+8]=S.z,Ka.morphNormals&&(ib?(fc=Kc[cb].vertexNormals[nc],Pb=fc.a,Qb=fc.b,Rb=fc.c):Rb=Qb=Pb=Kc[cb].faceNormals[nc],$a=sc[cb],$a[ia]=Pb.x,$a[ia+1]=Pb.y,$a[ia+2]=Pb.z,$a[ia+3]=Qb.x,$a[ia+4]=Qb.y,
|
|
|
+$a[ia+5]=Qb.z,$a[ia+6]=Rb.x,$a[ia+7]=Rb.y,$a[ia+8]=Rb.z),ia+=9;C=0;for(V=xa.length;C<V;C++)nc=xa[C],O=ob[nc],Q=pc[cb].vertices[O.a],R=pc[cb].vertices[O.b],S=pc[cb].vertices[O.c],pa=pc[cb].vertices[O.d],Za=lc[cb],Za[ia]=Q.x,Za[ia+1]=Q.y,Za[ia+2]=Q.z,Za[ia+3]=R.x,Za[ia+4]=R.y,Za[ia+5]=R.z,Za[ia+6]=S.x,Za[ia+7]=S.y,Za[ia+8]=S.z,Za[ia+9]=pa.x,Za[ia+10]=pa.y,Za[ia+11]=pa.z,Ka.morphNormals&&(ib?(fc=Kc[cb].vertexNormals[nc],Pb=fc.a,Qb=fc.b,Rb=fc.c,zb=fc.d):zb=Rb=Qb=Pb=Kc[cb].faceNormals[nc],$a=sc[cb],$a[ia]=
|
|
|
+Pb.x,$a[ia+1]=Pb.y,$a[ia+2]=Pb.z,$a[ia+3]=Qb.x,$a[ia+4]=Qb.y,$a[ia+5]=Qb.z,$a[ia+6]=Rb.x,$a[ia+7]=Rb.y,$a[ia+8]=Rb.z,$a[ia+9]=zb.x,$a[ia+10]=zb.y,$a[ia+11]=zb.z),ia+=12;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,lc[cb],qa);Ka.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ua.__webglMorphNormalsBuffers[cb]),j.bufferData(j.ARRAY_BUFFER,sc[cb],qa))}}if(oc.length){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],Vb=oc[O.a],Wb=oc[O.b],Xb=oc[O.c],Na[$]=Vb.x,Na[$+1]=Vb.y,
|
|
|
+Na[$+2]=Vb.z,Na[$+3]=Vb.w,Na[$+4]=Wb.x,Na[$+5]=Wb.y,Na[$+6]=Wb.z,Na[$+7]=Wb.w,Na[$+8]=Xb.x,Na[$+9]=Xb.y,Na[$+10]=Xb.z,Na[$+11]=Xb.w,Yb=uc[O.a],Zb=uc[O.b],$b=uc[O.c],Ma[$]=Yb.x,Ma[$+1]=Yb.y,Ma[$+2]=Yb.z,Ma[$+3]=Yb.w,Ma[$+4]=Zb.x,Ma[$+5]=Zb.y,Ma[$+6]=Zb.z,Ma[$+7]=Zb.w,Ma[$+8]=$b.x,Ma[$+9]=$b.y,Ma[$+10]=$b.z,Ma[$+11]=$b.w,$+=12;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],Vb=oc[O.a],Wb=oc[O.b],Xb=oc[O.c],Bb=oc[O.d],Na[$]=Vb.x,Na[$+1]=Vb.y,Na[$+2]=Vb.z,Na[$+3]=Vb.w,Na[$+4]=Wb.x,Na[$+5]=Wb.y,Na[$+6]=Wb.z,Na[$+
|
|
|
+7]=Wb.w,Na[$+8]=Xb.x,Na[$+9]=Xb.y,Na[$+10]=Xb.z,Na[$+11]=Xb.w,Na[$+12]=Bb.x,Na[$+13]=Bb.y,Na[$+14]=Bb.z,Na[$+15]=Bb.w,Yb=uc[O.a],Zb=uc[O.b],$b=uc[O.c],Db=uc[O.d],Ma[$]=Yb.x,Ma[$+1]=Yb.y,Ma[$+2]=Yb.z,Ma[$+3]=Yb.w,Ma[$+4]=Zb.x,Ma[$+5]=Zb.y,Ma[$+6]=Zb.z,Ma[$+7]=Zb.w,Ma[$+8]=$b.x,Ma[$+9]=$b.y,Ma[$+10]=$b.z,Ma[$+11]=$b.w,Ma[$+12]=Db.x,Ma[$+13]=Db.y,Ma[$+14]=Db.z,Ma[$+15]=Db.w,$+=16;0<$&&(j.bindBuffer(j.ARRAY_BUFFER,ua.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ma,qa),j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+ua.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Na,qa))}if(bd&&gb){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],Pa=O.vertexColors,tb=O.color,3===Pa.length&&gb===THREE.VertexColors?(Sb=Pa[0],Tb=Pa[1],Ub=Pa[2]):Ub=Tb=Sb=tb,eb[Ta]=Sb.r,eb[Ta+1]=Sb.g,eb[Ta+2]=Sb.b,eb[Ta+3]=Tb.r,eb[Ta+4]=Tb.g,eb[Ta+5]=Tb.b,eb[Ta+6]=Ub.r,eb[Ta+7]=Ub.g,eb[Ta+8]=Ub.b,Ta+=9;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],Pa=O.vertexColors,tb=O.color,4===Pa.length&&gb===THREE.VertexColors?(Sb=Pa[0],Tb=Pa[1],Ub=Pa[2],Ab=Pa[3]):
|
|
|
+Ab=Ub=Tb=Sb=tb,eb[Ta]=Sb.r,eb[Ta+1]=Sb.g,eb[Ta+2]=Sb.b,eb[Ta+3]=Tb.r,eb[Ta+4]=Tb.g,eb[Ta+5]=Tb.b,eb[Ta+6]=Ub.r,eb[Ta+7]=Ub.g,eb[Ta+8]=Ub.b,eb[Ta+9]=Ab.r,eb[Ta+10]=Ab.g,eb[Ta+11]=Ab.b,Ta+=12;0<Ta&&(j.bindBuffer(j.ARRAY_BUFFER,ua.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,eb,qa))}if(ad&&vb.hasTangents){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],fb=O.vertexTangents,ab=fb[0],bb=fb[1],hb=fb[2],La[Ea]=ab.x,La[Ea+1]=ab.y,La[Ea+2]=ab.z,La[Ea+3]=ab.w,La[Ea+4]=bb.x,La[Ea+5]=bb.y,La[Ea+6]=bb.z,La[Ea+7]=bb.w,
|
|
|
+La[Ea+8]=hb.x,La[Ea+9]=hb.y,La[Ea+10]=hb.z,La[Ea+11]=hb.w,Ea+=12;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],fb=O.vertexTangents,ab=fb[0],bb=fb[1],hb=fb[2],ub=fb[3],La[Ea]=ab.x,La[Ea+1]=ab.y,La[Ea+2]=ab.z,La[Ea+3]=ab.w,La[Ea+4]=bb.x,La[Ea+5]=bb.y,La[Ea+6]=bb.z,La[Ea+7]=bb.w,La[Ea+8]=hb.x,La[Ea+9]=hb.y,La[Ea+10]=hb.z,La[Ea+11]=hb.w,La[Ea+12]=ub.x,La[Ea+13]=ub.y,La[Ea+14]=ub.z,La[Ea+15]=ub.w,Ea+=16;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,La,qa)}if($c&&lb){C=0;for(V=
|
|
|
+wa.length;C<V;C++)if(O=ob[wa[C]],Ya=O.vertexNormals,Va=O.normal,3===Ya.length&&ib)for(Aa=0;3>Aa;Aa++)mc=Ya[Aa],Gb[nb]=mc.x,Gb[nb+1]=mc.y,Gb[nb+2]=mc.z,nb+=3;else for(Aa=0;3>Aa;Aa++)Gb[nb]=Va.x,Gb[nb+1]=Va.y,Gb[nb+2]=Va.z,nb+=3;C=0;for(V=xa.length;C<V;C++)if(O=ob[xa[C]],Ya=O.vertexNormals,Va=O.normal,4===Ya.length&&ib)for(Aa=0;4>Aa;Aa++)mc=Ya[Aa],Gb[nb]=mc.x,Gb[nb+1]=mc.y,Gb[nb+2]=mc.z,nb+=3;else for(Aa=0;4>Aa;Aa++)Gb[nb]=Va.x,Gb[nb+1]=Va.y,Gb[nb+2]=Va.z,nb+=3;j.bindBuffer(j.ARRAY_BUFFER,ua.__webglNormalBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,Gb,qa)}if(Bc&&fd&&pb){C=0;for(V=wa.length;C<V;C++)if(Ua=wa[C],qb=fd[Ua],void 0!==qb)for(Aa=0;3>Aa;Aa++)Eb=qb[Aa],Mb[gc]=Eb.x,Mb[gc+1]=Eb.y,gc+=2;C=0;for(V=xa.length;C<V;C++)if(Ua=xa[C],qb=fd[Ua],void 0!==qb)for(Aa=0;4>Aa;Aa++)Eb=qb[Aa],Mb[gc]=Eb.x,Mb[gc+1]=Eb.y,gc+=2;0<gc&&(j.bindBuffer(j.ARRAY_BUFFER,ua.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Mb,qa))}if(Bc&&gd&&pb){C=0;for(V=wa.length;C<V;C++)if(Ua=wa[C],rb=gd[Ua],void 0!==rb)for(Aa=0;3>Aa;Aa++)xc=rb[Aa],Nb[hc]=xc.x,
|
|
|
+Nb[hc+1]=xc.y,hc+=2;C=0;for(V=xa.length;C<V;C++)if(Ua=xa[C],rb=gd[Ua],void 0!==rb)for(Aa=0;4>Aa;Aa++)xc=rb[Aa],Nb[hc]=xc.x,Nb[hc+1]=xc.y,hc+=2;0<hc&&(j.bindBuffer(j.ARRAY_BUFFER,ua.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Nb,qa))}if(Jc){C=0;for(V=wa.length;C<V;C++)ac[Fb]=Qa,ac[Fb+1]=Qa+1,ac[Fb+2]=Qa+2,Fb+=3,Cb[sb]=Qa,Cb[sb+1]=Qa+1,Cb[sb+2]=Qa,Cb[sb+3]=Qa+2,Cb[sb+4]=Qa+1,Cb[sb+5]=Qa+2,sb+=6,Qa+=3;C=0;for(V=xa.length;C<V;C++)ac[Fb]=Qa,ac[Fb+1]=Qa+1,ac[Fb+2]=Qa+3,ac[Fb+3]=Qa+1,ac[Fb+4]=Qa+2,ac[Fb+
|
|
|
+5]=Qa+3,Fb+=6,Cb[sb]=Qa,Cb[sb+1]=Qa+1,Cb[sb+2]=Qa,Cb[sb+3]=Qa+3,Cb[sb+4]=Qa+1,Cb[sb+5]=Qa+2,Cb[sb+6]=Qa+2,Cb[sb+7]=Qa+3,sb+=8,Qa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ua.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ac,qa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ua.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Cb,qa)}if(ed){Aa=0;for(Lb=ed.length;Aa<Lb;Aa++)if(u=ed[Aa],u.__original.needsUpdate){v=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){C=0;for(V=wa.length;C<V;C++)O=
|
|
|
+ob[wa[C]],u.array[v]=u.value[O.a],u.array[v+1]=u.value[O.b],u.array[v+2]=u.value[O.c],v+=3;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],u.array[v]=u.value[O.a],u.array[v+1]=u.value[O.b],u.array[v+2]=u.value[O.c],u.array[v+3]=u.value[O.d],v+=4}else{if("faces"===u.boundTo){C=0;for(V=wa.length;C<V;C++)Ba=u.value[wa[C]],u.array[v]=Ba,u.array[v+1]=Ba,u.array[v+2]=Ba,v+=3;C=0;for(V=xa.length;C<V;C++)Ba=u.value[xa[C]],u.array[v]=Ba,u.array[v+1]=Ba,u.array[v+2]=Ba,u.array[v+3]=Ba,v+=4}}else if(2===u.size)if(void 0===
|
|
|
+u.boundTo||"vertices"===u.boundTo){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],Q=u.value[O.a],R=u.value[O.b],S=u.value[O.c],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=R.x,u.array[v+3]=R.y,u.array[v+4]=S.x,u.array[v+5]=S.y,v+=6;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],Q=u.value[O.a],R=u.value[O.b],S=u.value[O.c],pa=u.value[O.d],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=R.x,u.array[v+3]=R.y,u.array[v+4]=S.x,u.array[v+5]=S.y,u.array[v+6]=pa.x,u.array[v+7]=pa.y,v+=8}else{if("faces"===u.boundTo){C=0;for(V=
|
|
|
+wa.length;C<V;C++)S=R=Q=Ba=u.value[wa[C]],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=R.x,u.array[v+3]=R.y,u.array[v+4]=S.x,u.array[v+5]=S.y,v+=6;C=0;for(V=xa.length;C<V;C++)pa=S=R=Q=Ba=u.value[xa[C]],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=R.x,u.array[v+3]=R.y,u.array[v+4]=S.x,u.array[v+5]=S.y,u.array[v+6]=pa.x,u.array[v+7]=pa.y,v+=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){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],Q=
|
|
|
+u.value[O.a],R=u.value[O.b],S=u.value[O.c],u.array[v]=Q[Z[0]],u.array[v+1]=Q[Z[1]],u.array[v+2]=Q[Z[2]],u.array[v+3]=R[Z[0]],u.array[v+4]=R[Z[1]],u.array[v+5]=R[Z[2]],u.array[v+6]=S[Z[0]],u.array[v+7]=S[Z[1]],u.array[v+8]=S[Z[2]],v+=9;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],Q=u.value[O.a],R=u.value[O.b],S=u.value[O.c],pa=u.value[O.d],u.array[v]=Q[Z[0]],u.array[v+1]=Q[Z[1]],u.array[v+2]=Q[Z[2]],u.array[v+3]=R[Z[0]],u.array[v+4]=R[Z[1]],u.array[v+5]=R[Z[2]],u.array[v+6]=S[Z[0]],u.array[v+7]=S[Z[1]],
|
|
|
+u.array[v+8]=S[Z[2]],u.array[v+9]=pa[Z[0]],u.array[v+10]=pa[Z[1]],u.array[v+11]=pa[Z[2]],v+=12}else if("faces"===u.boundTo){C=0;for(V=wa.length;C<V;C++)S=R=Q=Ba=u.value[wa[C]],u.array[v]=Q[Z[0]],u.array[v+1]=Q[Z[1]],u.array[v+2]=Q[Z[2]],u.array[v+3]=R[Z[0]],u.array[v+4]=R[Z[1]],u.array[v+5]=R[Z[2]],u.array[v+6]=S[Z[0]],u.array[v+7]=S[Z[1]],u.array[v+8]=S[Z[2]],v+=9;C=0;for(V=xa.length;C<V;C++)pa=S=R=Q=Ba=u.value[xa[C]],u.array[v]=Q[Z[0]],u.array[v+1]=Q[Z[1]],u.array[v+2]=Q[Z[2]],u.array[v+3]=R[Z[0]],
|
|
|
+u.array[v+4]=R[Z[1]],u.array[v+5]=R[Z[2]],u.array[v+6]=S[Z[0]],u.array[v+7]=S[Z[1]],u.array[v+8]=S[Z[2]],u.array[v+9]=pa[Z[0]],u.array[v+10]=pa[Z[1]],u.array[v+11]=pa[Z[2]],v+=12}else if("faceVertices"===u.boundTo){C=0;for(V=wa.length;C<V;C++)Ba=u.value[wa[C]],Q=Ba[0],R=Ba[1],S=Ba[2],u.array[v]=Q[Z[0]],u.array[v+1]=Q[Z[1]],u.array[v+2]=Q[Z[2]],u.array[v+3]=R[Z[0]],u.array[v+4]=R[Z[1]],u.array[v+5]=R[Z[2]],u.array[v+6]=S[Z[0]],u.array[v+7]=S[Z[1]],u.array[v+8]=S[Z[2]],v+=9;C=0;for(V=xa.length;C<V;C++)Ba=
|
|
|
+u.value[xa[C]],Q=Ba[0],R=Ba[1],S=Ba[2],pa=Ba[3],u.array[v]=Q[Z[0]],u.array[v+1]=Q[Z[1]],u.array[v+2]=Q[Z[2]],u.array[v+3]=R[Z[0]],u.array[v+4]=R[Z[1]],u.array[v+5]=R[Z[2]],u.array[v+6]=S[Z[0]],u.array[v+7]=S[Z[1]],u.array[v+8]=S[Z[2]],u.array[v+9]=pa[Z[0]],u.array[v+10]=pa[Z[1]],u.array[v+11]=pa[Z[2]],v+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){C=0;for(V=wa.length;C<V;C++)O=ob[wa[C]],Q=u.value[O.a],R=u.value[O.b],S=u.value[O.c],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+
|
|
|
+2]=Q.z,u.array[v+3]=Q.w,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+6]=R.z,u.array[v+7]=R.w,u.array[v+8]=S.x,u.array[v+9]=S.y,u.array[v+10]=S.z,u.array[v+11]=S.w,v+=12;C=0;for(V=xa.length;C<V;C++)O=ob[xa[C]],Q=u.value[O.a],R=u.value[O.b],S=u.value[O.c],pa=u.value[O.d],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=Q.z,u.array[v+3]=Q.w,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+6]=R.z,u.array[v+7]=R.w,u.array[v+8]=S.x,u.array[v+9]=S.y,u.array[v+10]=S.z,u.array[v+11]=S.w,u.array[v+12]=pa.x,u.array[v+
|
|
|
+13]=pa.y,u.array[v+14]=pa.z,u.array[v+15]=pa.w,v+=16}else if("faces"===u.boundTo){C=0;for(V=wa.length;C<V;C++)S=R=Q=Ba=u.value[wa[C]],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=Q.z,u.array[v+3]=Q.w,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+6]=R.z,u.array[v+7]=R.w,u.array[v+8]=S.x,u.array[v+9]=S.y,u.array[v+10]=S.z,u.array[v+11]=S.w,v+=12;C=0;for(V=xa.length;C<V;C++)pa=S=R=Q=Ba=u.value[xa[C]],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=Q.z,u.array[v+3]=Q.w,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+
|
|
|
+6]=R.z,u.array[v+7]=R.w,u.array[v+8]=S.x,u.array[v+9]=S.y,u.array[v+10]=S.z,u.array[v+11]=S.w,u.array[v+12]=pa.x,u.array[v+13]=pa.y,u.array[v+14]=pa.z,u.array[v+15]=pa.w,v+=16}else if("faceVertices"===u.boundTo){C=0;for(V=wa.length;C<V;C++)Ba=u.value[wa[C]],Q=Ba[0],R=Ba[1],S=Ba[2],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=Q.z,u.array[v+3]=Q.w,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+6]=R.z,u.array[v+7]=R.w,u.array[v+8]=S.x,u.array[v+9]=S.y,u.array[v+10]=S.z,u.array[v+11]=S.w,v+=12;C=0;for(V=
|
|
|
+xa.length;C<V;C++)Ba=u.value[xa[C]],Q=Ba[0],R=Ba[1],S=Ba[2],pa=Ba[3],u.array[v]=Q.x,u.array[v+1]=Q.y,u.array[v+2]=Q.z,u.array[v+3]=Q.w,u.array[v+4]=R.x,u.array[v+5]=R.y,u.array[v+6]=R.z,u.array[v+7]=R.w,u.array[v+8]=S.x,u.array[v+9]=S.y,u.array[v+10]=S.z,u.array[v+11]=S.w,u.array[v+12]=pa.x,u.array[v+13]=pa.y,u.array[v+14]=pa.z,u.array[v+15]=pa.w,v+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,qa)}}Sa&&(delete ua.__inittedArrays,delete ua.__colorArray,delete ua.__normalArray,
|
|
|
+delete ua.__tangentArray,delete ua.__uvArray,delete ua.__uv2Array,delete ua.__faceArray,delete ua.__vertexArray,delete ua.__lineArray,delete ua.__skinIndexArray,delete ua.__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;ea.attributes&&x(ea)}else if(ga instanceof THREE.Ribbon){ea=e(ga,N);ta=ea.attributes&&t(ea);if(N.verticesNeedUpdate||N.colorsNeedUpdate||
|
|
|
+N.normalsNeedUpdate||ta){var Hb=N,Lc=j.DYNAMIC_DRAW,Cc=void 0,Dc=void 0,Ec=void 0,Mc=void 0,Ca=void 0,Nc=void 0,Oc=void 0,Pc=void 0,md=void 0,jb=void 0,yc=void 0,Ia=void 0,wb=void 0,nd=Hb.vertices,od=Hb.colors,pd=Hb.normals,yd=nd.length,zd=od.length,Ad=pd.length,Qc=Hb.__vertexArray,Rc=Hb.__colorArray,Sc=Hb.__normalArray,Bd=Hb.colorsNeedUpdate,Cd=Hb.normalsNeedUpdate,hd=Hb.__webglCustomAttributesList;if(Hb.verticesNeedUpdate){for(Cc=0;Cc<yd;Cc++)Mc=nd[Cc],Ca=3*Cc,Qc[Ca]=Mc.x,Qc[Ca+1]=Mc.y,Qc[Ca+2]=
|
|
|
+Mc.z;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,Lc)}if(Bd){for(Dc=0;Dc<zd;Dc++)Nc=od[Dc],Ca=3*Dc,Rc[Ca]=Nc.r,Rc[Ca+1]=Nc.g,Rc[Ca+2]=Nc.b;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,Lc)}if(Cd){for(Ec=0;Ec<Ad;Ec++)Oc=pd[Ec],Ca=3*Ec,Sc[Ca]=Oc.x,Sc[Ca+1]=Oc.y,Sc[Ca+2]=Oc.z;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,Lc)}if(hd){Pc=0;for(md=hd.length;Pc<md;Pc++)if(Ia=hd[Pc],Ia.needsUpdate&&
|
|
|
+(void 0===Ia.boundTo||"vertices"===Ia.boundTo)){Ca=0;yc=Ia.value.length;if(1===Ia.size)for(jb=0;jb<yc;jb++)Ia.array[jb]=Ia.value[jb];else if(2===Ia.size)for(jb=0;jb<yc;jb++)wb=Ia.value[jb],Ia.array[Ca]=wb.x,Ia.array[Ca+1]=wb.y,Ca+=2;else if(3===Ia.size)if("c"===Ia.type)for(jb=0;jb<yc;jb++)wb=Ia.value[jb],Ia.array[Ca]=wb.r,Ia.array[Ca+1]=wb.g,Ia.array[Ca+2]=wb.b,Ca+=3;else for(jb=0;jb<yc;jb++)wb=Ia.value[jb],Ia.array[Ca]=wb.x,Ia.array[Ca+1]=wb.y,Ia.array[Ca+2]=wb.z,Ca+=3;else if(4===Ia.size)for(jb=
|
|
|
+0;jb<yc;jb++)wb=Ia.value[jb],Ia.array[Ca]=wb.x,Ia.array[Ca+1]=wb.y,Ia.array[Ca+2]=wb.z,Ia.array[Ca+3]=wb.w,Ca+=4;j.bindBuffer(j.ARRAY_BUFFER,Ia.buffer);j.bufferData(j.ARRAY_BUFFER,Ia.array,Lc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.normalsNeedUpdate=!1;ea.attributes&&x(ea)}else if(ga instanceof THREE.Line)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&h(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=!1;else{ea=e(ga,N);ta=ea.attributes&&
|
|
|
+t(ea);if(N.verticesNeedUpdate||N.colorsNeedUpdate||N.lineDistancesNeedUpdate||ta){var Ib=N,Tc=j.DYNAMIC_DRAW,Fc=void 0,Gc=void 0,Hc=void 0,Uc=void 0,Oa=void 0,Vc=void 0,qd=Ib.vertices,rd=Ib.colors,sd=Ib.lineDistances,Dd=qd.length,Ed=rd.length,Fd=sd.length,Wc=Ib.__vertexArray,Xc=Ib.__colorArray,td=Ib.__lineDistanceArray,Gd=Ib.colorsNeedUpdate,Hd=Ib.lineDistancesNeedUpdate,id=Ib.__webglCustomAttributesList,Yc=void 0,ud=void 0,kb=void 0,zc=void 0,xb=void 0,Ja=void 0;if(Ib.verticesNeedUpdate){for(Fc=
|
|
|
+0;Fc<Dd;Fc++)Uc=qd[Fc],Oa=3*Fc,Wc[Oa]=Uc.x,Wc[Oa+1]=Uc.y,Wc[Oa+2]=Uc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Wc,Tc)}if(Gd){for(Gc=0;Gc<Ed;Gc++)Vc=rd[Gc],Oa=3*Gc,Xc[Oa]=Vc.r,Xc[Oa+1]=Vc.g,Xc[Oa+2]=Vc.b;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,Tc)}if(Hd){for(Hc=0;Hc<Fd;Hc++)td[Hc]=sd[Hc];j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,td,Tc)}if(id){Yc=0;for(ud=id.length;Yc<ud;Yc++)if(Ja=
|
|
|
+id[Yc],Ja.needsUpdate&&(void 0===Ja.boundTo||"vertices"===Ja.boundTo)){Oa=0;zc=Ja.value.length;if(1===Ja.size)for(kb=0;kb<zc;kb++)Ja.array[kb]=Ja.value[kb];else if(2===Ja.size)for(kb=0;kb<zc;kb++)xb=Ja.value[kb],Ja.array[Oa]=xb.x,Ja.array[Oa+1]=xb.y,Oa+=2;else if(3===Ja.size)if("c"===Ja.type)for(kb=0;kb<zc;kb++)xb=Ja.value[kb],Ja.array[Oa]=xb.r,Ja.array[Oa+1]=xb.g,Ja.array[Oa+2]=xb.b,Oa+=3;else for(kb=0;kb<zc;kb++)xb=Ja.value[kb],Ja.array[Oa]=xb.x,Ja.array[Oa+1]=xb.y,Ja.array[Oa+2]=xb.z,Oa+=3;else if(4===
|
|
|
+Ja.size)for(kb=0;kb<zc;kb++)xb=Ja.value[kb],Ja.array[Oa]=xb.x,Ja.array[Oa+1]=xb.y,Ja.array[Oa+2]=xb.z,Ja.array[Oa+3]=xb.w,Oa+=4;j.bindBuffer(j.ARRAY_BUFFER,Ja.buffer);j.bufferData(j.ARRAY_BUFFER,Ja.array,Tc)}}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;N.lineDistancesNeedUpdate=!1;ea.attributes&&x(ea)}else if(ga instanceof THREE.ParticleSystem)if(N instanceof THREE.BufferGeometry)(N.verticesNeedUpdate||N.colorsNeedUpdate)&&h(N,j.DYNAMIC_DRAW,!N.dynamic),N.verticesNeedUpdate=!1,N.colorsNeedUpdate=
|
|
|
+!1;else{ea=e(ga,N);ta=ea.attributes&&t(ea);if(N.verticesNeedUpdate||N.colorsNeedUpdate||ga.sortParticles||ta){var bc=N,jd=j.DYNAMIC_DRAW,Ic=ga,yb=void 0,cc=void 0,dc=void 0,ca=void 0,ec=void 0,qc=void 0,Zc=bc.vertices,kd=Zc.length,ld=bc.colors,vd=ld.length,vc=bc.__vertexArray,wc=bc.__colorArray,ic=bc.__sortArray,wd=bc.verticesNeedUpdate,xd=bc.colorsNeedUpdate,jc=bc.__webglCustomAttributesList,Jb=void 0,Ac=void 0,ma=void 0,Kb=void 0,Fa=void 0,ba=void 0;if(Ic.sortParticles){rc.copy(Ob);rc.multiply(Ic.matrixWorld);
|
|
|
+for(yb=0;yb<kd;yb++)dc=Zc[yb],mb.copy(dc),mb.applyMatrix4(rc),ic[yb]=[mb.z,yb];ic.sort(n);for(yb=0;yb<kd;yb++)dc=Zc[ic[yb][1]],ca=3*yb,vc[ca]=dc.x,vc[ca+1]=dc.y,vc[ca+2]=dc.z;for(cc=0;cc<vd;cc++)ca=3*cc,qc=ld[ic[cc][1]],wc[ca]=qc.r,wc[ca+1]=qc.g,wc[ca+2]=qc.b;if(jc){Jb=0;for(Ac=jc.length;Jb<Ac;Jb++)if(ba=jc[Jb],void 0===ba.boundTo||"vertices"===ba.boundTo)if(ca=0,Kb=ba.value.length,1===ba.size)for(ma=0;ma<Kb;ma++)ec=ic[ma][1],ba.array[ma]=ba.value[ec];else if(2===ba.size)for(ma=0;ma<Kb;ma++)ec=ic[ma][1],
|
|
|
+Fa=ba.value[ec],ba.array[ca]=Fa.x,ba.array[ca+1]=Fa.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(ma=0;ma<Kb;ma++)ec=ic[ma][1],Fa=ba.value[ec],ba.array[ca]=Fa.r,ba.array[ca+1]=Fa.g,ba.array[ca+2]=Fa.b,ca+=3;else for(ma=0;ma<Kb;ma++)ec=ic[ma][1],Fa=ba.value[ec],ba.array[ca]=Fa.x,ba.array[ca+1]=Fa.y,ba.array[ca+2]=Fa.z,ca+=3;else if(4===ba.size)for(ma=0;ma<Kb;ma++)ec=ic[ma][1],Fa=ba.value[ec],ba.array[ca]=Fa.x,ba.array[ca+1]=Fa.y,ba.array[ca+2]=Fa.z,ba.array[ca+3]=Fa.w,ca+=4}}else{if(wd)for(yb=0;yb<
|
|
|
+kd;yb++)dc=Zc[yb],ca=3*yb,vc[ca]=dc.x,vc[ca+1]=dc.y,vc[ca+2]=dc.z;if(xd)for(cc=0;cc<vd;cc++)qc=ld[cc],ca=3*cc,wc[ca]=qc.r,wc[ca+1]=qc.g,wc[ca+2]=qc.b;if(jc){Jb=0;for(Ac=jc.length;Jb<Ac;Jb++)if(ba=jc[Jb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Kb=ba.value.length,ca=0,1===ba.size)for(ma=0;ma<Kb;ma++)ba.array[ma]=ba.value[ma];else if(2===ba.size)for(ma=0;ma<Kb;ma++)Fa=ba.value[ma],ba.array[ca]=Fa.x,ba.array[ca+1]=Fa.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(ma=0;ma<Kb;ma++)Fa=
|
|
|
+ba.value[ma],ba.array[ca]=Fa.r,ba.array[ca+1]=Fa.g,ba.array[ca+2]=Fa.b,ca+=3;else for(ma=0;ma<Kb;ma++)Fa=ba.value[ma],ba.array[ca]=Fa.x,ba.array[ca+1]=Fa.y,ba.array[ca+2]=Fa.z,ca+=3;else if(4===ba.size)for(ma=0;ma<Kb;ma++)Fa=ba.value[ma],ba.array[ca]=Fa.x,ba.array[ca+1]=Fa.y,ba.array[ca+2]=Fa.z,ba.array[ca+3]=Fa.w,ca+=4}}if(wd||Ic.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,vc,jd);if(xd||Ic.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),
|
|
|
+j.bufferData(j.ARRAY_BUFFER,wc,jd);if(jc){Jb=0;for(Ac=jc.length;Jb<Ac;Jb++)if(ba=jc[Jb],ba.needsUpdate||Ic.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,jd)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ea.attributes&&x(ea)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Ya);var i,k,n,l,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m=
|
|
|
+"basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var p=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&
|
|
|
+g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;h=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);l=q;bb&&d&&d.useVertexTexture?n=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)")),n=b);a:{s=a.fragmentShader;r=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:n,useVertexTexture:bb&&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,x,w,d=[];m?d.push(m):(d.push(s),d.push(r));for(x in q)d.push(x),d.push(q[x]);for(t in c)d.push(t),d.push(c[t]);m=d.join();t=0;for(x=ja.length;t<x;t++)if(d=ja[t],d.code===m){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");x=[];for(w in q)d=q[w],!1!==d&&(d="#define "+w+" "+d,x.push(d));
|
|
|
+d=x.join("\n");w=j.createProgram();x=["precision "+P+" float;",d,hb?"#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 "+P+" 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=W("fragment",t+s);x=W("vertex",x+r);j.attachShader(w,x);j.attachShader(w,t);j.linkProgram(w);j.getProgramParameter(w,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(w,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
j.getError()+"]");j.deleteShader(t);j.deleteShader(x);w.uniforms={};w.attributes={};var y;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(y in p)t.push(y);y=t;t=0;for(x=y.length;t<x;t++)p=y[t],w.uniforms[p]=j.getUniformLocation(w,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(y=0;y<c.maxMorphTargets;y++)t.push("morphTarget"+
|
|
|
-y);for(y=0;y<c.maxMorphNormals;y++)t.push("morphNormal"+y);for(k in b)t.push(k);k=t;y=0;for(b=k.length;y<b;y++)t=k[y],w.attributes[t]=j.getAttribLocation(w,t);w.id=ta++;ha.push({program:w,code:m,usedTimes:1});M.info.memory.programs=ha.length;k=w}a.program=k;y=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=y[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)w=
|
|
|
-b+k,0<=y[w]&&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;ma!==
|
|
|
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ma=b);wa!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),wa=a)};this.setDepthTest=function(a){qb!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),qb=a)};this.setDepthWrite=function(a){Sa!==a&&(j.depthMask(a),Sa=a)};this.setBlending=function(a,b,c,d){a!==xa&&(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)),xa=a);if(a===THREE.CustomBlending){if(b!==ea&&(j.blendEquation(K(b)),ea=b),c!==Ua||d!==Bb)j.blendFunc(K(c),K(d)),Ua=c,Bb=d}else Bb=
|
|
|
-Ua=ea=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",pb),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=K(a.format),
|
|
|
+y);for(y=0;y<c.maxMorphNormals;y++)t.push("morphNormal"+y);for(k in b)t.push(k);k=t;y=0;for(b=k.length;y<b;y++)t=k[y],w.attributes[t]=j.getAttribLocation(w,t);w.id=Ga++;ja.push({program:w,code:m,usedTimes:1});M.info.memory.programs=ja.length;k=w}a.program=k;y=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=y[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)w=
|
|
|
+b+k,0<=y[w]&&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;Ra!==
|
|
|
+b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Ra=b);la!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),la=a)};this.setDepthTest=function(a){tb!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),tb=a)};this.setDepthWrite=function(a){fb!==a&&(j.depthMask(a),fb=a)};this.setBlending=function(a,b,c,d){a!==va&&(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)),va=a);if(a===THREE.CustomBlending){if(b!==ta&&(j.blendEquation(K(b)),ta=b),c!==lb||d!==Da)j.blendFunc(K(c),K(d)),lb=c,Da=d}else Da=
|
|
|
+lb=ta=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",ib),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=K(a.format),
|
|
|
f=K(a.type);A(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",gb);a.__webglTexture=
|
|
|
+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",Ua);a.__webglTexture=
|
|
|
j.createTexture();M.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=K(a.format),e=K(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);A(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);X(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),A(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):X(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=Cb,a=Ta,d=Na,e=Va);b!==da&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),da=b);Kb=c;Lb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){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);
|
|
|
+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=Db,a=Pa,d=Sa,e=Ka);b!==ha&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),ha=b);kc=c;Mb=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];
|
|
@@ -519,7 +519,7 @@ cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexSha
|
|
|
c+d;m=b[a++]*c;s=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(s,q,h,m);if(g=f[f.length-1]){p=g.x;n=g.y;g=1;for(i=this.divisions;g<=i;g++){var x=g/i;THREE.Shape.Utils.b2(x,p,s,h);THREE.Shape.Utils.b2(x,n,q,m)}}break;case "b":if(h=b[a++]*c+d,m=b[a++]*c,s=b[a++]*c+d,q=b[a++]*-c,l=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(h,m,s,q,l,r),g=f[f.length-1]){p=g.x;n=g.y;g=1;for(i=this.divisions;g<=i;g++)x=g/i,THREE.Shape.Utils.b3(x,p,s,l,h),THREE.Shape.Utils.b3(x,n,q,r,m)}}}return{offset:t.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=[],i=[],h,k,m;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}h=k;e<=h&&(h=0);k=h+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var n;a:{var s=n=void 0,q=void 0,l=void 0,r=void 0,t=void 0,x=void 0,z=void 0,w=
|
|
|
-void 0,s=a[g[h]].x,q=a[g[h]].y,l=a[g[k]].x,r=a[g[k]].y,t=a[g[m]].x,x=a[g[m]].y;if(1E-10>(l-s)*(x-q)-(r-q)*(t-s))n=!1;else{var I=void 0,H=void 0,C=void 0,y=void 0,E=void 0,F=void 0,G=void 0,W=void 0,A=void 0,X=void 0,A=W=G=w=z=void 0,I=t-l,H=x-r,C=s-t,y=q-x,E=l-s,F=r-q;for(n=0;n<e;n++)if(!(n===h||n===k||n===m))if(z=a[g[n]].x,w=a[g[n]].y,G=z-s,W=w-q,A=z-l,X=w-r,z-=t,w-=x,A=I*X-H*A,G=E*W-F*G,W=C*w-y*z,0<=A&&0<=W&&0<=G){n=!1;break a}n=!0}}if(n){f.push([a[g[h]],a[g[k]],a[g[m]]]);i.push([g[h],g[k],g[m]]);
|
|
|
+void 0,s=a[g[h]].x,q=a[g[h]].y,l=a[g[k]].x,r=a[g[k]].y,t=a[g[m]].x,x=a[g[m]].y;if(1E-10>(l-s)*(x-q)-(r-q)*(t-s))n=!1;else{var I=void 0,H=void 0,D=void 0,y=void 0,E=void 0,F=void 0,G=void 0,W=void 0,A=void 0,X=void 0,A=W=G=w=z=void 0,I=t-l,H=x-r,D=s-t,y=q-x,E=l-s,F=r-q;for(n=0;n<e;n++)if(!(n===h||n===k||n===m))if(z=a[g[n]].x,w=a[g[n]].y,G=z-s,W=w-q,A=z-l,X=w-r,z-=t,w-=x,A=I*X-H*A,G=E*W-F*G,W=D*w-y*z,0<=A&&0<=W&&0<=G){n=!1;break a}n=!0}}if(n){f.push([a[g[h]],a[g[k]],a[g[m]]]);i.push([g[h],g[k],g[m]]);
|
|
|
h=k;for(m=k+1;m<e;h++,m++)g[h]=g[m];e--;p=2*e}}return d?i: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,i=e-1,h;g<=i;)if(d=Math.floor(g+(i-g)/2),h=c[d]-f,0>h)g=d+1;else if(0<h)i=d-1;else{i=d;break}d=i;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()};
|
|
@@ -595,20 +595,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 i=new THREE.Vector3;i.x=a*Math.cos(c+e/b*d);i.y=a*Math.sin(c+e/b*d);this.vertices.push(i);f.push(new THREE.Vector2((i.x/a+1)/2,-(i.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,l){var r,t=i.widthSegments,x=i.heightSegments,z=e/2,w=f/2,I=i.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)r="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)r="y",x=i.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)r="x",t=i.depthSegments;var H=t+1,C=x+1,y=e/t,E=f/x,F=new THREE.Vector3;F[r]=0<g?1:-1;for(e=0;e<C;e++)for(f=0;f<H;f++){var G=new THREE.Vector3;G[a]=(f*y-z)*c;G[b]=(e*E-w)*d;G[r]=g;i.vertices.push(G)}for(e=
|
|
|
+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,l){var r,t=i.widthSegments,x=i.heightSegments,z=e/2,w=f/2,I=i.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)r="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)r="y",x=i.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)r="x",t=i.depthSegments;var H=t+1,D=x+1,y=e/t,E=f/x,F=new THREE.Vector3;F[r]=0<g?1:-1;for(e=0;e<D;e++)for(f=0;f<H;f++){var G=new THREE.Vector3;G[a]=(f*y-z)*c;G[b]=(e*E-w)*d;G[r]=g;i.vertices.push(G)}for(e=
|
|
|
0;e<x;e++)for(f=0;f<t;f++)a=new THREE.Face4(f+H*e+I,f+H*(e+1)+I,f+1+H*(e+1)+I,f+1+H*e+I),a.normal.copy(F),a.vertexNormals.push(F.clone(),F.clone(),F.clone(),F.clone()),a.materialIndex=l,i.faces.push(a),i.faceVertexUvs[0].push([new THREE.Vector2(f/t,1-e/x),new THREE.Vector2(f/t,1-(e+1)/x),new THREE.Vector2((f+1)/t,1-(e+1)/x),new THREE.Vector2((f+1)/t,1-e/x)])}THREE.Geometry.call(this);var i=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,i,h,k=[],m=[];for(h=0;h<=e;h++){var p=[],n=[],s=h/e,q=s*(b-a)+a;for(i=0;i<=d;i++){var l=i/d,r=new THREE.Vector3;r.x=q*Math.sin(2*l*Math.PI);r.y=-s*c+g;r.z=q*Math.cos(2*l*Math.PI);this.vertices.push(r);p.push(this.vertices.length-1);n.push(new THREE.Vector2(l,1-s))}k.push(p);m.push(n)}c=(b-a)/c;for(i=0;i<d;i++){0!==a?(p=this.vertices[k[0][i]].clone(),
|
|
|
-n=this.vertices[k[0][i+1]].clone()):(p=this.vertices[k[1][i]].clone(),n=this.vertices[k[1][i+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(h=0;h<e;h++){var s=k[h][i],q=k[h+1][i],l=k[h+1][i+1],r=k[h][i+1],t=p.clone(),x=p.clone(),z=n.clone(),w=n.clone(),I=m[h][i].clone(),H=m[h+1][i].clone(),C=m[h+1][i+1].clone(),y=m[h][i+1].clone();this.faces.push(new THREE.Face4(s,q,l,r,[t,x,z,w]));this.faceVertexUvs[0].push([I,H,C,y])}}if(!f&&0<
|
|
|
-a){this.vertices.push(new THREE.Vector3(0,g,0));for(i=0;i<d;i++)s=k[0][i],q=k[0][i+1],l=this.vertices.length-1,t=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),I=m[0][i].clone(),H=m[0][i+1].clone(),C=new THREE.Vector2(H.u,0),this.faces.push(new THREE.Face3(s,q,l,[t,x,z])),this.faceVertexUvs[0].push([I,H,C])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(i=0;i<d;i++)s=k[h][i+1],q=k[h][i],l=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,
|
|
|
--1,0),z=new THREE.Vector3(0,-1,0),I=m[h][i+1].clone(),H=m[h][i].clone(),C=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(s,q,l,[t,x,z])),this.faceVertexUvs[0].push([I,H,C])}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)};
|
|
|
+n=this.vertices[k[0][i+1]].clone()):(p=this.vertices[k[1][i]].clone(),n=this.vertices[k[1][i+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(h=0;h<e;h++){var s=k[h][i],q=k[h+1][i],l=k[h+1][i+1],r=k[h][i+1],t=p.clone(),x=p.clone(),z=n.clone(),w=n.clone(),I=m[h][i].clone(),H=m[h+1][i].clone(),D=m[h+1][i+1].clone(),y=m[h][i+1].clone();this.faces.push(new THREE.Face4(s,q,l,r,[t,x,z,w]));this.faceVertexUvs[0].push([I,H,D,y])}}if(!f&&0<
|
|
|
+a){this.vertices.push(new THREE.Vector3(0,g,0));for(i=0;i<d;i++)s=k[0][i],q=k[0][i+1],l=this.vertices.length-1,t=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),I=m[0][i].clone(),H=m[0][i+1].clone(),D=new THREE.Vector2(H.u,0),this.faces.push(new THREE.Face3(s,q,l,[t,x,z])),this.faceVertexUvs[0].push([I,H,D])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(i=0;i<d;i++)s=k[h][i+1],q=k[h][i],l=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,
|
|
|
+-1,0),z=new THREE.Vector3(0,-1,0),I=m[h][i+1].clone(),H=m[h][i].clone(),D=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(s,q,l,[t,x,z])),this.faceVertexUvs[0].push([I,H,D])}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*m,
|
|
|
-g=0;g<h;g++){var i=Z*g,k=Z*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,t=e,w=f,l=l+W,i=i+W,n=n+W,k=k+W;G.faces.push(new THREE.Face4(l,i,n,k,null,null,x));l=z.generateSideWallUV(G,a,p,b,l,i,n,k,q,r,t,w);G.faceVertexUvs[0].push(l)}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=W;d+=W;e+=W;G.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?z.generateBottomUV(G,a,b,c,d,e):z.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var i=void 0!==b.amount?b.amount:
|
|
|
-100,h=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:h-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,q=b.extrudePath,l,r=!1,t=b.material,x=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,I,H,C;q&&(l=q.getSpacedPoints(s),r=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(q,s,
|
|
|
-!1),I=new THREE.Vector3,H=new THREE.Vector3,C=new THREE.Vector3);p||(k=h=m=0);var y,E,F,G=this,W=this.vertices.length,n=a.extractPoints(n),A=n.shape,n=n.holes;if(q=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();E=0;for(F=n.length;E<F;E++)y=n[E],THREE.Shape.Utils.isClockWise(y)&&(n[E]=y.reverse());q=!1}var X=THREE.Shape.Utils.triangulateShape(A,n),q=A;E=0;for(F=n.length;E<F;E++)y=n[E],A=A.concat(y);var B,K,L,T,Z=A.length,sa=X.length,La=[],J=0,ja=q.length;B=ja-1;for(K=J+1;J<ja;J++,B++,K++)B===ja&&
|
|
|
-(B=0),K===ja&&(K=0),La[J]=d(q[J],q[B],q[K]);var ia=[],Pa,M=La.concat();E=0;for(F=n.length;E<F;E++){y=n[E];Pa=[];J=0;ja=y.length;B=ja-1;for(K=J+1;J<ja;J++,B++,K++)B===ja&&(B=0),K===ja&&(K=0),Pa[J]=d(y[J],y[B],y[K]);ia.push(Pa);M=M.concat(Pa)}for(B=0;B<m;B++){y=B/m;L=h*(1-y);K=k*Math.sin(y*Math.PI/2);J=0;for(ja=q.length;J<ja;J++)T=c(q[J],La[J],K),f(T.x,T.y,-L);E=0;for(F=n.length;E<F;E++){y=n[E];Pa=ia[E];J=0;for(ja=y.length;J<ja;J++)T=c(y[J],Pa[J],K),f(T.x,T.y,-L)}}K=k;for(J=0;J<Z;J++)T=p?c(A[J],M[J],
|
|
|
-K):A[J],r?(H.copy(w.normals[0]).multiplyScalar(T.x),I.copy(w.binormals[0]).multiplyScalar(T.y),C.copy(l[0]).add(H).add(I),f(C.x,C.y,C.z)):f(T.x,T.y,0);for(y=1;y<=s;y++)for(J=0;J<Z;J++)T=p?c(A[J],M[J],K):A[J],r?(H.copy(w.normals[y]).multiplyScalar(T.x),I.copy(w.binormals[y]).multiplyScalar(T.y),C.copy(l[y]).add(H).add(I),f(C.x,C.y,C.z)):f(T.x,T.y,i/s*y);for(B=m-1;0<=B;B--){y=B/m;L=h*(1-y);K=k*Math.sin(y*Math.PI/2);J=0;for(ja=q.length;J<ja;J++)T=c(q[J],La[J],K),f(T.x,T.y,i+L);E=0;for(F=n.length;E<F;E++){y=
|
|
|
-n[E];Pa=ia[E];J=0;for(ja=y.length;J<ja;J++)T=c(y[J],Pa[J],K),r?f(T.x,T.y+l[s-1].y,l[s-1].x+L):f(T.x,T.y,i+L)}}if(p){h=0*Z;for(J=0;J<sa;J++)i=X[J],g(i[2]+h,i[1]+h,i[0]+h,!0);h=Z*(s+2*m);for(J=0;J<sa;J++)i=X[J],g(i[0]+h,i[1]+h,i[2]+h,!1)}else{for(J=0;J<sa;J++)i=X[J],g(i[2],i[1],i[0],!0);for(J=0;J<sa;J++)i=X[J],g(i[0]+Z*s,i[1]+Z*s,i[2]+Z*s,!1)}i=0;e(q,i);i+=q.length;E=0;for(F=n.length;E<F;E++)y=n[E],e(y,i),i+=y.length};
|
|
|
+g=0;g<h;g++){var i=aa*g,k=aa*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,t=e,w=f,l=l+W,i=i+W,n=n+W,k=k+W;G.faces.push(new THREE.Face4(l,i,n,k,null,null,x));l=z.generateSideWallUV(G,a,p,b,l,i,n,k,q,r,t,w);G.faceVertexUvs[0].push(l)}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=W;d+=W;e+=W;G.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?z.generateBottomUV(G,a,b,c,d,e):z.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var i=void 0!==b.amount?b.amount:
|
|
|
+100,h=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:h-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,q=b.extrudePath,l,r=!1,t=b.material,x=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,I,H,D;q&&(l=q.getSpacedPoints(s),r=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(q,s,
|
|
|
+!1),I=new THREE.Vector3,H=new THREE.Vector3,D=new THREE.Vector3);p||(k=h=m=0);var y,E,F,G=this,W=this.vertices.length,n=a.extractPoints(n),A=n.shape,n=n.holes;if(q=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();E=0;for(F=n.length;E<F;E++)y=n[E],THREE.Shape.Utils.isClockWise(y)&&(n[E]=y.reverse());q=!1}var X=THREE.Shape.Utils.triangulateShape(A,n),q=A;E=0;for(F=n.length;E<F;E++)y=n[E],A=A.concat(y);var B,K,L,P,aa=A.length,na=X.length,qa=[],J=0,ga=q.length;B=ga-1;for(K=J+1;J<ga;J++,B++,K++)B===ga&&
|
|
|
+(B=0),K===ga&&(K=0),qa[J]=d(q[J],q[B],q[K]);var sa=[],ea,M=qa.concat();E=0;for(F=n.length;E<F;E++){y=n[E];ea=[];J=0;ga=y.length;B=ga-1;for(K=J+1;J<ga;J++,B++,K++)B===ga&&(B=0),K===ga&&(K=0),ea[J]=d(y[J],y[B],y[K]);sa.push(ea);M=M.concat(ea)}for(B=0;B<m;B++){y=B/m;L=h*(1-y);K=k*Math.sin(y*Math.PI/2);J=0;for(ga=q.length;J<ga;J++)P=c(q[J],qa[J],K),f(P.x,P.y,-L);E=0;for(F=n.length;E<F;E++){y=n[E];ea=sa[E];J=0;for(ga=y.length;J<ga;J++)P=c(y[J],ea[J],K),f(P.x,P.y,-L)}}K=k;for(J=0;J<aa;J++)P=p?c(A[J],M[J],
|
|
|
+K):A[J],r?(H.copy(w.normals[0]).multiplyScalar(P.x),I.copy(w.binormals[0]).multiplyScalar(P.y),D.copy(l[0]).add(H).add(I),f(D.x,D.y,D.z)):f(P.x,P.y,0);for(y=1;y<=s;y++)for(J=0;J<aa;J++)P=p?c(A[J],M[J],K):A[J],r?(H.copy(w.normals[y]).multiplyScalar(P.x),I.copy(w.binormals[y]).multiplyScalar(P.y),D.copy(l[y]).add(H).add(I),f(D.x,D.y,D.z)):f(P.x,P.y,i/s*y);for(B=m-1;0<=B;B--){y=B/m;L=h*(1-y);K=k*Math.sin(y*Math.PI/2);J=0;for(ga=q.length;J<ga;J++)P=c(q[J],qa[J],K),f(P.x,P.y,i+L);E=0;for(F=n.length;E<
|
|
|
+F;E++){y=n[E];ea=sa[E];J=0;for(ga=y.length;J<ga;J++)P=c(y[J],ea[J],K),r?f(P.x,P.y+l[s-1].y,l[s-1].x+L):f(P.x,P.y,i+L)}}if(p){h=0*aa;for(J=0;J<na;J++)i=X[J],g(i[2]+h,i[1]+h,i[0]+h,!0);h=aa*(s+2*m);for(J=0;J<na;J++)i=X[J],g(i[0]+h,i[1]+h,i[2]+h,!1)}else{for(J=0;J<na;J++)i=X[J],g(i[2],i[1],i[0],!0);for(J=0;J<na;J++)i=X[J],g(i[0]+aa*s,i[1]+aa*s,i[2]+aa*s,!1)}i=0;e(q,i);i+=q.length;E=0;for(F=n.length;E<F;E++)y=n[E],e(y,i),i+=y.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,i){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,h=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,
|
|
|
m=a.vertices[g].y,g=a.vertices[g].z,p=a.vertices[i].x,n=a.vertices[i].y,a=a.vertices[i].z;return 0.01>Math.abs(c-h)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(p,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(h,1-f),new THREE.Vector2(m,1-g),new THREE.Vector2(n,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};
|
|
@@ -667,29 +667,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[q++]=0;e[q++]=0;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;g=b.createBuffer();i=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,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)?(m=!1,p=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,p=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};s={};n.vertex=b.getAttribLocation(p,"position");n.uv=b.getAttribLocation(p,"uv");s.renderType=b.getUniformLocation(p,"renderType");s.map=b.getUniformLocation(p,"map");s.occlusionMap=b.getUniformLocation(p,"occlusionMap");s.opacity=
|
|
|
-b.getUniformLocation(p,"opacity");s.color=b.getUniformLocation(p,"color");s.scale=b.getUniformLocation(p,"scale");s.rotation=b.getUniformLocation(p,"rotation");s.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,x=a.length;if(x){var z=new THREE.Vector3,w=f/e,I=0.5*e,H=0.5*f,C=16/f,y=new THREE.Vector2(C*w,C),E=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),G=s,C=n;b.useProgram(p);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
-b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(C.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.disable(b.CULL_FACE);b.depthMask(!1);var W,A,X,B,K;for(W=0;W<x;W++)if(C=16/f,y.set(C*w,C),B=a[W],z.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyMatrix4(d.projectionMatrix),E.copy(z),F.x=E.x*I+I,F.y=
|
|
|
+b.getUniformLocation(p,"opacity");s.color=b.getUniformLocation(p,"color");s.scale=b.getUniformLocation(p,"scale");s.rotation=b.getUniformLocation(p,"rotation");s.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,x=a.length;if(x){var z=new THREE.Vector3,w=f/e,I=0.5*e,H=0.5*f,D=16/f,y=new THREE.Vector2(D*w,D),E=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),G=s,D=n;b.useProgram(p);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
+b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.disable(b.CULL_FACE);b.depthMask(!1);var W,A,X,B,K;for(W=0;W<x;W++)if(D=16/f,y.set(D*w,D),B=a[W],z.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyMatrix4(d.projectionMatrix),E.copy(z),F.x=E.x*I+I,F.y=
|
|
|
E.y*H+H,m||0<F.x&&F.x<e&&0<F.y&&F.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,y.x,y.y);b.uniform3f(G.screenPosition,E.x,E.y,E.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,F.x-8,F.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(E);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);A=0;for(X=B.lensFlares.length;A<X;A++)K=B.lensFlares[A],0.001<K.opacity&&0.001<K.scale&&(E.x=K.x,E.y=K.y,E.z=K.z,C=K.size*K.scale/f,y.x=C*w,y.y=C,b.uniform3f(G.screenPosition,E.x,E.y,E.z),b.uniform2f(G.scale,y.x,y.y),b.uniform1f(G.rotation,K.rotation),b.uniform1f(G.opacity,
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(E);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);A=0;for(X=B.lensFlares.length;A<X;A++)K=B.lensFlares[A],0.001<K.opacity&&0.001<K.scale&&(E.x=K.x,E.y=K.y,E.z=K.z,D=K.size*K.scale/f,y.x=D*w,y.y=D,b.uniform3f(G.screenPosition,E.x,E.y,E.z),b.uniform2f(G.scale,y.x,y.y),b.uniform1f(G.rotation,K.rotation),b.uniform1f(G.opacity,
|
|
|
K.opacity),b.uniform3f(G.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,i=new THREE.Matrix4,h=new THREE.Vector3,k=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(m,p){var n,s,q,l,r,t,x,z,w,I=[];l=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);n=0;for(s=m.__lights.length;n<s;n++)if(q=m.__lights[n],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(r=0;r<q.shadowCascadeCount;r++){var H;if(q.shadowCascadeArray[r])H=q.shadowCascadeArray[r];else{w=q;x=r;H=new THREE.DirectionalLight;H.isVirtual=!0;H.onlyShadow=!0;H.castShadow=!0;H.shadowCameraNear=w.shadowCameraNear;H.shadowCameraFar=w.shadowCameraFar;H.shadowCameraLeft=w.shadowCameraLeft;H.shadowCameraRight=w.shadowCameraRight;
|
|
|
-H.shadowCameraBottom=w.shadowCameraBottom;H.shadowCameraTop=w.shadowCameraTop;H.shadowCameraVisible=w.shadowCameraVisible;H.shadowDarkness=w.shadowDarkness;H.shadowBias=w.shadowCascadeBias[x];H.shadowMapWidth=w.shadowCascadeWidth[x];H.shadowMapHeight=w.shadowCascadeHeight[x];H.pointsWorld=[];H.pointsFrustum=[];z=H.pointsWorld;t=H.pointsFrustum;for(var C=0;8>C;C++)z[C]=new THREE.Vector3,t[C]=new THREE.Vector3;z=w.shadowCascadeNearZ[x];w=w.shadowCascadeFarZ[x];t[0].set(-1,-1,z);t[1].set(1,-1,z);t[2].set(-1,
|
|
|
+H.shadowCameraBottom=w.shadowCameraBottom;H.shadowCameraTop=w.shadowCameraTop;H.shadowCameraVisible=w.shadowCameraVisible;H.shadowDarkness=w.shadowDarkness;H.shadowBias=w.shadowCascadeBias[x];H.shadowMapWidth=w.shadowCascadeWidth[x];H.shadowMapHeight=w.shadowCascadeHeight[x];H.pointsWorld=[];H.pointsFrustum=[];z=H.pointsWorld;t=H.pointsFrustum;for(var D=0;8>D;D++)z[D]=new THREE.Vector3,t[D]=new THREE.Vector3;z=w.shadowCascadeNearZ[x];w=w.shadowCascadeFarZ[x];t[0].set(-1,-1,z);t[1].set(1,-1,z);t[2].set(-1,
|
|
|
1,z);t[3].set(1,1,z);t[4].set(-1,-1,w);t[5].set(1,-1,w);t[6].set(-1,1,w);t[7].set(1,1,w);H.originalCamera=p;t=new THREE.Gyroscope;t.position=q.shadowCascadeOffset;t.add(H);t.add(H.target);p.add(t);q.shadowCascadeArray[r]=H;console.log("Created virtualLight",H)}x=q;z=r;w=x.shadowCascadeArray[z];w.position.copy(x.position);w.target.position.copy(x.target.position);w.lookAt(w.target);w.shadowCameraVisible=x.shadowCameraVisible;w.shadowDarkness=x.shadowDarkness;w.shadowBias=x.shadowCascadeBias[z];t=x.shadowCascadeNearZ[z];
|
|
|
x=x.shadowCascadeFarZ[z];w=w.pointsFrustum;w[0].z=t;w[1].z=t;w[2].z=t;w[3].z=t;w[4].z=x;w[5].z=x;w[6].z=x;w[7].z=x;I[l]=H;l++}else I[l]=q,l++;n=0;for(s=I.length;n<s;n++){q=I[n];q.shadowMap||(r=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(r=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:r,magFilter:r,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(q.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
|
!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&H.originalCamera==p){r=p;l=q.shadowCamera;t=q.pointsFrustum;w=q.pointsWorld;h.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)z=w[x],z.copy(t[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(z,r),z.applyMatrix4(l.matrixWorldInverse),z.x<h.x&&(h.x=z.x),z.x>k.x&&(k.x=z.x),z.y<h.y&&(h.y=z.y),z.y>k.y&&(k.y=z.y),z.z<h.z&&(h.z=z.z),z.z>k.z&&
|
|
|
(k.z=z.z);l.left=h.x;l.right=k.x;l.top=k.y;l.bottom=h.y;l.updateProjectionMatrix()}l=q.shadowMap;t=q.shadowMatrix;r=q.shadowCamera;r.position.copy(q.matrixWorld.getPosition());r.lookAt(q.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.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(r.projectionMatrix);t.multiply(r.matrixWorldInverse);
|
|
|
-i.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);g.setFromMatrix(i);b.setRenderTarget(l);b.clear();w=m.__webglObjects;q=0;for(l=w.length;q<l;q++)if(x=w[q],t=x.object,x.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),x.render=!0;q=0;for(l=w.length;q<l;q++)x=w[q],x.render&&(t=x.object,x=x.buffer,C=t.material instanceof THREE.MeshFaceMaterial?
|
|
|
-t.material.materials[0]:t.material,z=0<t.geometry.morphTargets.length&&C.morphTargets,C=t instanceof THREE.SkinnedMesh&&C.skinning,z=t.customDepthMaterial?t.customDepthMaterial:C?z?f:e:z?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,z,x,t):b.renderBuffer(r,m.__lights,null,z,x,t));w=m.__webglObjectsImmediate;q=0;for(l=w.length;q<l;q++)x=w[q],t=x.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(r,
|
|
|
+i.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);g.setFromMatrix(i);b.setRenderTarget(l);b.clear();w=m.__webglObjects;q=0;for(l=w.length;q<l;q++)if(x=w[q],t=x.object,x.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),x.render=!0;q=0;for(l=w.length;q<l;q++)x=w[q],x.render&&(t=x.object,x=x.buffer,D=t.material instanceof THREE.MeshFaceMaterial?
|
|
|
+t.material.materials[0]:t.material,z=0<t.geometry.morphTargets.length&&D.morphTargets,D=t instanceof THREE.SkinnedMesh&&D.skinning,z=t.customDepthMaterial?t.customDepthMaterial:D?z?f:e:z?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,z,x,t):b.renderBuffer(r,m.__lights,null,z,x,t));w=m.__webglObjectsImmediate;q=0;for(l=w.length;q<l;q++)x=w[q],t=x.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(r,
|
|
|
m.__lights,null,c,t))}n=b.getClearColor();s=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,s);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,i,h,k,m;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();i=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
|
|
|
e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER),l="precision "+d+" float;\n";b.shaderSource(s,l+a.fragmentShader);b.shaderSource(q,l+a.vertexShader);b.compileShader(s);b.compileShader(q);b.attachShader(n,s);b.attachShader(n,q);b.linkProgram(n);h=n;k={};m={};k.position=b.getAttribLocation(h,"position");k.uv=b.getAttribLocation(h,
|
|
|
"uv");m.uvOffset=b.getUniformLocation(h,"uvOffset");m.uvScale=b.getUniformLocation(h,"uvScale");m.rotation=b.getUniformLocation(h,"rotation");m.scale=b.getUniformLocation(h,"scale");m.alignment=b.getUniformLocation(h,"alignment");m.color=b.getUniformLocation(h,"color");m.map=b.getUniformLocation(h,"map");m.opacity=b.getUniformLocation(h,"opacity");m.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");m.sizeAttenuation=b.getUniformLocation(h,"sizeAttenuation");m.screenPosition=b.getUniformLocation(h,
|
|
|
"screenPosition");m.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");m.fogType=b.getUniformLocation(h,"fogType");m.fogDensity=b.getUniformLocation(h,"fogDensity");m.fogNear=b.getUniformLocation(h,"fogNear");m.fogFar=b.getUniformLocation(h,"fogFar");m.fogColor=b.getUniformLocation(h,"fogColor");m.alphaTest=b.getUniformLocation(h,"alphaTest")};this.render=function(d,e,f,q){var l=d.__webglSprites,r=l.length;if(r){var t=k,x=m,z=q/
|
|
|
f,f=0.5*f,w=0.5*q;b.useProgram(h);b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i);b.uniformMatrix4fv(x.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(x.map,0);var I=t=0,H=d.fog;H?(b.uniform3f(x.fogColor,H.color.r,H.color.g,H.color.b),
|
|
|
-H instanceof THREE.Fog?(b.uniform1f(x.fogNear,H.near),b.uniform1f(x.fogFar,H.far),b.uniform1i(x.fogType,1),I=t=1):H instanceof THREE.FogExp2&&(b.uniform1f(x.fogDensity,H.density),b.uniform1i(x.fogType,2),I=t=2)):(b.uniform1i(x.fogType,0),I=t=0);for(var C,y,E=[],H=0;H<r;H++)C=l[H],y=C.material,C.visible&&0!==y.opacity&&(y.useScreenCoordinates?C.z=-C.position.z:(C._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,C.matrixWorld),C.z=-C._modelViewMatrix.elements[14]));l.sort(a);for(H=0;H<r;H++)C=
|
|
|
-l[H],y=C.material,C.visible&&0!==y.opacity&&(y.map&&y.map.image&&y.map.image.width)&&(b.uniform1f(x.alphaTest,y.alphaTest),!0===y.useScreenCoordinates?(b.uniform1i(x.useScreenCoordinates,1),b.uniform3f(x.screenPosition,(C.position.x*c.devicePixelRatio-f)/f,(w-C.position.y*c.devicePixelRatio)/w,Math.max(0,Math.min(1,C.position.z))),E[0]=c.devicePixelRatio,E[1]=c.devicePixelRatio):(b.uniform1i(x.useScreenCoordinates,0),b.uniform1i(x.sizeAttenuation,y.sizeAttenuation?1:0),b.uniformMatrix4fv(x.modelViewMatrix,
|
|
|
-!1,C._modelViewMatrix.elements),E[0]=1,E[1]=1),e=d.fog&&y.fog?I:0,t!==e&&(b.uniform1i(x.fogType,e),t=e),e=1/(y.scaleByViewport?q:1),E[0]*=e*z*C.scale.x,E[1]*=e*C.scale.y,b.uniform2f(x.uvScale,y.uvScale.x,y.uvScale.y),b.uniform2f(x.uvOffset,y.uvOffset.x,y.uvOffset.y),b.uniform2f(x.alignment,y.alignment.x,y.alignment.y),b.uniform1f(x.opacity,y.opacity),b.uniform3f(x.color,y.color.r,y.color.g,y.color.b),b.uniform1f(x.rotation,C.rotation),b.uniform2fv(x.scale,E),c.setBlending(y.blending,y.blendEquation,
|
|
|
+H instanceof THREE.Fog?(b.uniform1f(x.fogNear,H.near),b.uniform1f(x.fogFar,H.far),b.uniform1i(x.fogType,1),I=t=1):H instanceof THREE.FogExp2&&(b.uniform1f(x.fogDensity,H.density),b.uniform1i(x.fogType,2),I=t=2)):(b.uniform1i(x.fogType,0),I=t=0);for(var D,y,E=[],H=0;H<r;H++)D=l[H],y=D.material,D.visible&&0!==y.opacity&&(y.useScreenCoordinates?D.z=-D.position.z:(D._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,D.matrixWorld),D.z=-D._modelViewMatrix.elements[14]));l.sort(a);for(H=0;H<r;H++)D=
|
|
|
+l[H],y=D.material,D.visible&&0!==y.opacity&&(y.map&&y.map.image&&y.map.image.width)&&(b.uniform1f(x.alphaTest,y.alphaTest),!0===y.useScreenCoordinates?(b.uniform1i(x.useScreenCoordinates,1),b.uniform3f(x.screenPosition,(D.position.x*c.devicePixelRatio-f)/f,(w-D.position.y*c.devicePixelRatio)/w,Math.max(0,Math.min(1,D.position.z))),E[0]=c.devicePixelRatio,E[1]=c.devicePixelRatio):(b.uniform1i(x.useScreenCoordinates,0),b.uniform1i(x.sizeAttenuation,y.sizeAttenuation?1:0),b.uniformMatrix4fv(x.modelViewMatrix,
|
|
|
+!1,D._modelViewMatrix.elements),E[0]=1,E[1]=1),e=d.fog&&y.fog?I:0,t!==e&&(b.uniform1i(x.fogType,e),t=e),e=1/(y.scaleByViewport?q:1),E[0]*=e*z*D.scale.x,E[1]*=e*D.scale.y,b.uniform2f(x.uvScale,y.uvScale.x,y.uvScale.y),b.uniform2f(x.uvOffset,y.uvOffset.x,y.uvOffset.y),b.uniform2f(x.alignment,y.alignment.x,y.alignment.y),b.uniform1f(x.opacity,y.opacity),b.uniform3f(x.color,y.color.r,y.color.g,y.color.b),b.uniform1f(x.rotation,D.rotation),b.uniform2fv(x.scale,E),c.setBlending(y.blending,y.blendEquation,
|
|
|
y.blendSrc,y.blendDst),c.setDepthTest(y.depthTest),c.setDepthWrite(y.depthWrite),c.setTexture(y.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,i=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,i=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:i,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,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(h,k){var m,p,n,s,q,l;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&h.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);i.multiplyMatrices(k.projectionMatrix,
|
|
|
k.matrixWorldInverse);g.setFromMatrix(i);b.setRenderTarget(this.renderTarget);b.clear();l=h.__webglObjects;m=0;for(p=l.length;m<p;m++)if(n=l[m],q=n.object,n.render=!1,q.visible&&(!(q instanceof THREE.Mesh||q instanceof THREE.ParticleSystem)||!q.frustumCulled||g.intersectsObject(q)))q._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,q.matrixWorld),n.render=!0;var r;m=0;for(p=l.length;m<p;m++)if(n=l[m],n.render&&(q=n.object,n=n.buffer,!(q instanceof THREE.ParticleSystem)||q.customDepthMaterial))(r=
|