|
@@ -92,7 +92,7 @@ f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=l+a*c,b[10]=f*h):"ZXY"===a.order?(
|
|
|
h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+l,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,a=c*h,k=c*g,c=
|
|
|
c*i,l=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);h[0]=a.x;
|
|
|
h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],l=c[5],n=c[9],p=c[13],t=c[2],r=c[6],m=c[10],q=c[14],u=c[3],s=c[7],v=c[11],c=c[15],
|
|
|
-w=d[0],G=d[4],N=d[8],A=d[12],y=d[1],z=d[5],C=d[9],O=d[13],F=d[2],x=d[6],D=d[10],E=d[14],H=d[3],K=d[7],I=d[11],d=d[15];e[0]=f*w+h*y+g*F+i*H;e[4]=f*G+h*z+g*x+i*K;e[8]=f*N+h*C+g*D+i*I;e[12]=f*A+h*O+g*E+i*d;e[1]=k*w+l*y+n*F+p*H;e[5]=k*G+l*z+n*x+p*K;e[9]=k*N+l*C+n*D+p*I;e[13]=k*A+l*O+n*E+p*d;e[2]=t*w+r*y+m*F+q*H;e[6]=t*G+r*z+m*x+q*K;e[10]=t*N+r*C+m*D+q*I;e[14]=t*A+r*O+m*E+q*d;e[3]=u*w+s*y+v*F+c*H;e[7]=u*G+s*z+v*x+c*K;e[11]=u*N+s*C+v*D+c*I;e[15]=u*A+s*O+v*E+c*d;return this},multiplyToArray:function(a,b,
|
|
|
+w=d[0],G=d[4],K=d[8],B=d[12],y=d[1],z=d[5],C=d[9],N=d[13],F=d[2],D=d[6],E=d[10],x=d[14],H=d[3],S=d[7],A=d[11],d=d[15];e[0]=f*w+h*y+g*F+i*H;e[4]=f*G+h*z+g*D+i*S;e[8]=f*K+h*C+g*E+i*A;e[12]=f*B+h*N+g*x+i*d;e[1]=k*w+l*y+n*F+p*H;e[5]=k*G+l*z+n*D+p*S;e[9]=k*K+l*C+n*E+p*A;e[13]=k*B+l*N+n*x+p*d;e[2]=t*w+r*y+m*F+q*H;e[6]=t*G+r*z+m*D+q*S;e[10]=t*K+r*C+m*E+q*A;e[14]=t*B+r*N+m*x+q*d;e[3]=u*w+s*y+v*F+c*H;e[7]=u*G+s*z+v*D+c*S;e[11]=u*K+s*C+v*E+c*A;e[15]=u*B+s*N+v*x+c*d;return this},multiplyToArray:function(a,b,
|
|
|
c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],l=a[6],n=a[10],p=a[14];return a[3]*(+e*g*l-d*i*l-e*h*n+c*i*n+d*h*p-c*g*p)+a[7]*(+b*g*p-b*i*n+e*f*n-d*f*p+d*i*k-e*g*k)+a[11]*(+b*i*l-b*h*p-e*f*l+c*f*p+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*l+b*h*n+d*f*l-c*f*
|
|
@@ -143,10 +143,10 @@ THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:functio
|
|
|
c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(){var a=[];return function(b){if(void 0!==this._listeners){var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=c.length,e=0;e<d;e++)a[e]=c[e];for(e=0;e<d;e++)a[e].call(this,
|
|
|
b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,l,t){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var r=l.ray.distanceToPoint(d);if(r>f.scale.x)return t;t.push({distance:r,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
a.LOD)d.setFromMatrixPosition(f.matrixWorld),r=l.ray.origin.distanceTo(d),k(f.getObjectForDistance(r),l,t);else if(f instanceof a.Mesh){var m=f.geometry;null===m.boundingSphere&&m.computeBoundingSphere();b.copy(m.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===l.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(null!==m.boundingBox&&!1===c.isIntersectionBox(m.boundingBox))return t;if(m instanceof a.BufferGeometry){var q=f.material;if(void 0===
|
|
|
-q||!1===m.dynamic)return t;var u,s,v=l.precision;if(void 0!==m.attributes.index)for(var w=m.offsets,G=m.attributes.index.array,N=m.attributes.position.array,A=m.offsets.length,y=m.attributes.index.array.length/3,y=0;y<A;++y)for(var r=w[y].start,z=w[y].index,m=r,C=r+w[y].count;m<C;m+=3)r=z+G[m],u=z+G[m+1],s=z+G[m+2],h.set(N[3*r],N[3*r+1],N[3*r+2]),g.set(N[3*u],N[3*u+1],N[3*u+2]),i.set(N[3*s],N[3*s+1],N[3*s+2]),u=q.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,q.side!==a.DoubleSide),
|
|
|
-null!==u&&(u.applyMatrix4(f.matrixWorld),r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:null,faceIndex:null,object:f}));else{N=m.attributes.position.array;y=m.attributes.position.array.length;for(m=0;m<y;m+=3)r=m,u=m+1,s=m+2,h.set(N[3*r],N[3*r+1],N[3*r+2]),g.set(N[3*u],N[3*u+1],N[3*u+2]),i.set(N[3*s],N[3*s+1],N[3*s+2]),u=q.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,q.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
-r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:null,faceIndex:null,object:f}))}}else if(m instanceof a.Geometry){G=f.material instanceof a.MeshFaceMaterial;N=!0===G?f.material.materials:null;v=l.precision;w=m.vertices;A=0;for(y=m.faces.length;A<y;A++)z=m.faces[A],q=!0===G?N[z.materialIndex]:f.material,void 0!==q&&(r=w[z.a],u=w[z.b],s=w[z.c],u=q.side===a.BackSide?c.intersectTriangle(s,u,r,!0):c.intersectTriangle(r,u,s,q.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
-r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:z,faceIndex:A,object:f})))}}else if(f instanceof a.Line){v=l.linePrecision;q=v*v;m=f.geometry;null===m.boundingSphere&&m.computeBoundingSphere();b.copy(m.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===l.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(m instanceof a.Geometry){w=m.vertices;v=w.length;u=new a.Vector3;s=new a.Vector3;y=f.type===a.LineStrip?1:
|
|
|
+q||!1===m.dynamic)return t;var u,s,v=l.precision;if(void 0!==m.attributes.index)for(var w=m.offsets,G=m.attributes.index.array,K=m.attributes.position.array,B=m.offsets.length,y=m.attributes.index.array.length/3,y=0;y<B;++y)for(var r=w[y].start,z=w[y].index,m=r,C=r+w[y].count;m<C;m+=3)r=z+G[m],u=z+G[m+1],s=z+G[m+2],h.set(K[3*r],K[3*r+1],K[3*r+2]),g.set(K[3*u],K[3*u+1],K[3*u+2]),i.set(K[3*s],K[3*s+1],K[3*s+2]),u=q.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,q.side!==a.DoubleSide),
|
|
|
+null!==u&&(u.applyMatrix4(f.matrixWorld),r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:null,faceIndex:null,object:f}));else{K=m.attributes.position.array;y=m.attributes.position.array.length;for(m=0;m<y;m+=3)r=m,u=m+1,s=m+2,h.set(K[3*r],K[3*r+1],K[3*r+2]),g.set(K[3*u],K[3*u+1],K[3*u+2]),i.set(K[3*s],K[3*s+1],K[3*s+2]),u=q.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,q.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
+r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:null,faceIndex:null,object:f}))}}else if(m instanceof a.Geometry){G=f.material instanceof a.MeshFaceMaterial;K=!0===G?f.material.materials:null;v=l.precision;w=m.vertices;B=0;for(y=m.faces.length;B<y;B++)z=m.faces[B],q=!0===G?K[z.materialIndex]:f.material,void 0!==q&&(r=w[z.a],u=w[z.b],s=w[z.c],u=q.side===a.BackSide?c.intersectTriangle(s,u,r,!0):c.intersectTriangle(r,u,s,q.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
+r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:z,faceIndex:B,object:f})))}}else if(f instanceof a.Line){v=l.linePrecision;q=v*v;m=f.geometry;null===m.boundingSphere&&m.computeBoundingSphere();b.copy(m.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===l.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(m instanceof a.Geometry){w=m.vertices;v=w.length;u=new a.Vector3;s=new a.Vector3;y=f.type===a.LineStrip?1:
|
|
|
2;for(m=0;m<v-1;m+=y)c.distanceSqToSegment(w[m],w[m+1],s,u)>q||(r=c.origin.distanceTo(s),r<l.near||r>l.far||t.push({distance:r,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},l=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&l(a,
|
|
|
this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&l(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
|
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
@@ -161,17 +161,17 @@ b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name=
|
|
|
this.quaternion,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,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);
|
|
|
a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));
|
|
|
if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===l){var a=new THREE.RenderableVertex;k.push(a);l++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
|
|
|
-0,g,i,k=[],l=0,n,p,t=[],r=0,m,q,u=[],s=0,v,w,G=[],N=0,A={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,z=new THREE.Vector4,C=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),O=new THREE.Box3,F=Array(3),x=new THREE.Matrix4,D=new THREE.Matrix4,E,H=new THREE.Matrix4,K=new THREE.Matrix3,I=new THREE.Matrix3,S=new THREE.Vector3,ga=new THREE.Frustum,oa=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
-D.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(D)};var Q=new THREE.Matrix4;this.unprojectVector=function(a,b){Q.getInverse(b.projectionMatrix);D.multiplyMatrices(b.matrixWorld,Q);return a.applyProjection(D)};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)};var P=function(a){if(e===h){var b=new THREE.RenderableObject;f.push(b);h++;e++;
|
|
|
-d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(D),d.z=y.z);return d},B=function(a){if(!1!==a.visible){a instanceof THREE.Light?A.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===ga.intersectsObject(a))&&A.objects.push(P(a)):a instanceof THREE.Sprite&&A.sprites.push(P(a));for(var b=0,c=a.children.length;b<c;b++)B(a.children[b])}};this.projectScene=function(d,f,h,l){var y=
|
|
|
-!1,Q,P,ca,$,Y,da,U,ba,qa,ha,va,Ha;w=q=p=0;A.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();x.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));D.multiplyMatrices(f.projectionMatrix,x);I.getNormalMatrix(x);ga.setFromMatrix(D);e=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;B(d);!0===h&&A.objects.sort(b);d=0;for(h=A.objects.length;d<h;d++)if(U=A.objects[d].object,E=U.matrixWorld,i=0,U instanceof THREE.Mesh){ba=U.geometry;ca=ba.vertices;
|
|
|
-qa=ba.faces;ba=ba.faceVertexUvs;K.getNormalMatrix(E);va=U.material instanceof THREE.MeshFaceMaterial;Ha=!0===va?U.material:null;Q=0;for(P=ca.length;Q<P;Q++){g=a();g.positionWorld.copy(ca[Q]).applyMatrix4(E);g.positionScreen.copy(g.positionWorld).applyMatrix4(D);var ra=1/g.positionScreen.w;g.positionScreen.x*=ra;g.positionScreen.y*=ra;g.positionScreen.z*=ra;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||1<g.positionScreen.z)}ca=
|
|
|
-0;for(Q=qa.length;ca<Q;ca++)if(P=qa[ca],ra=!0===va?Ha.materials[P.materialIndex]:U.material,void 0!==ra&&(da=ra.side,$=k[P.a],Y=k[P.b],ha=k[P.c],F[0]=$.positionScreen,F[1]=Y.positionScreen,F[2]=ha.positionScreen,!0===$.visible||!0===Y.visible||!0===ha.visible||C.isIntersectionBox(O.setFromPoints(F))))if(y=0>(ha.positionScreen.x-$.positionScreen.x)*(Y.positionScreen.y-$.positionScreen.y)-(ha.positionScreen.y-$.positionScreen.y)*(Y.positionScreen.x-$.positionScreen.x),da===THREE.DoubleSide||y===(da===
|
|
|
-THREE.FrontSide)){if(p===r){var Ea=new THREE.RenderableFace3;t.push(Ea);r++;p++;n=Ea}else n=t[p++];n.id=U.id;n.v1.copy($);n.v2.copy(Y);n.v3.copy(ha);n.normalModel.copy(P.normal);!1===y&&(da===THREE.BackSide||da===THREE.DoubleSide)&&n.normalModel.negate();n.normalModel.applyMatrix3(K).normalize();n.normalModelView.copy(n.normalModel).applyMatrix3(I);n.centroidModel.copy(P.centroid).applyMatrix4(E);ha=P.vertexNormals;$=0;for(Y=Math.min(ha.length,3);$<Y;$++)Ea=n.vertexNormalsModel[$],Ea.copy(ha[$]),
|
|
|
-!1===y&&(da===THREE.BackSide||da===THREE.DoubleSide)&&Ea.negate(),Ea.applyMatrix3(K).normalize(),n.vertexNormalsModelView[$].copy(Ea).applyMatrix3(I);n.vertexNormalsLength=ha.length;y=0;for($=Math.min(ba.length,3);y<$;y++)if(ha=ba[y][ca],void 0!==ha){Y=0;for(da=ha.length;Y<da;Y++)n.uvs[y][Y]=ha[Y]}n.color=P.color;n.material=ra;S.copy(n.centroidModel).applyProjection(D);n.z=S.z;A.elements.push(n)}}else if(U instanceof THREE.Line){H.multiplyMatrices(D,E);ca=U.geometry.vertices;$=a();$.positionScreen.copy(ca[0]).applyMatrix4(H);
|
|
|
-qa=U.type===THREE.LinePieces?2:1;Q=1;for(P=ca.length;Q<P;Q++)$=a(),$.positionScreen.copy(ca[Q]).applyMatrix4(H),0<(Q+1)%qa||(Y=k[i-2],oa.copy($.positionScreen),L.copy(Y.positionScreen),!0===c(oa,L)&&(oa.multiplyScalar(1/oa.w),L.multiplyScalar(1/L.w),q===s?(ba=new THREE.RenderableLine,u.push(ba),s++,q++,m=ba):m=u[q++],m.id=U.id,m.v1.positionScreen.copy(oa),m.v2.positionScreen.copy(L),m.z=Math.max(oa.z,L.z),m.material=U.material,U.material.vertexColors===THREE.VertexColors&&(m.vertexColors[0].copy(U.geometry.colors[Q]),
|
|
|
-m.vertexColors[1].copy(U.geometry.colors[Q-1])),A.elements.push(m)))}d=0;for(h=A.sprites.length;d<h;d++)U=A.sprites[d].object,E=U.matrixWorld,z.set(E.elements[12],E.elements[13],E.elements[14],1),z.applyMatrix4(D),ra=1/z.w,z.z*=ra,-1<=z.z&&1>=z.z&&(w===N?(qa=new THREE.RenderableSprite,G.push(qa),N++,w++,v=qa):v=G[w++],v.id=U.id,v.x=z.x*ra,v.y=z.y*ra,v.z=z.z,v.object=U,v.rotation=U.rotation,v.scale.x=U.scale.x*Math.abs(v.x-(z.x+f.projectionMatrix.elements[0])/(z.w+f.projectionMatrix.elements[12])),
|
|
|
-v.scale.y=U.scale.y*Math.abs(v.y-(z.y+f.projectionMatrix.elements[5])/(z.w+f.projectionMatrix.elements[13])),v.material=U.material,A.elements.push(v));!0===l&&A.elements.sort(b);return A}};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};
|
|
|
+0,g,i,k=[],l=0,n,p,t=[],r=0,m,q,u=[],s=0,v,w,G=[],K=0,B={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,z=new THREE.Vector4,C=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),N=new THREE.Box3,F=Array(3),D=new THREE.Matrix4,E=new THREE.Matrix4,x,H=new THREE.Matrix4,S=new THREE.Matrix3,A=new THREE.Matrix3,ca=new THREE.Vector3,ja=new THREE.Frustum,qa=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+E.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(E)};var P=new THREE.Matrix4;this.unprojectVector=function(a,b){P.getInverse(b.projectionMatrix);E.multiplyMatrices(b.matrixWorld,P);return a.applyProjection(E)};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)};var Q=function(a){if(e===h){var b=new THREE.RenderableObject;f.push(b);h++;e++;
|
|
|
+d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(E),d.z=y.z);return d},I=function(a){if(!1!==a.visible){a instanceof THREE.Light?B.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===ja.intersectsObject(a))&&B.objects.push(Q(a)):a instanceof THREE.Sprite&&B.sprites.push(Q(a));for(var b=0,c=a.children.length;b<c;b++)I(a.children[b])}};this.projectScene=function(d,f,h,l){var y=
|
|
|
+!1,P,Q,ea,aa,W,ga,U,da,sa,ka,Ha,Ma;w=q=p=0;B.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();D.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));E.multiplyMatrices(f.projectionMatrix,D);A.getNormalMatrix(D);ja.setFromMatrix(E);e=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;I(d);!0===h&&B.objects.sort(b);d=0;for(h=B.objects.length;d<h;d++)if(U=B.objects[d].object,x=U.matrixWorld,i=0,U instanceof THREE.Mesh){da=U.geometry;ea=da.vertices;
|
|
|
+sa=da.faces;da=da.faceVertexUvs;S.getNormalMatrix(x);Ha=U.material instanceof THREE.MeshFaceMaterial;Ma=!0===Ha?U.material:null;P=0;for(Q=ea.length;P<Q;P++){g=a();g.positionWorld.copy(ea[P]).applyMatrix4(x);g.positionScreen.copy(g.positionWorld).applyMatrix4(E);var ta=1/g.positionScreen.w;g.positionScreen.x*=ta;g.positionScreen.y*=ta;g.positionScreen.z*=ta;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||1<g.positionScreen.z)}ea=
|
|
|
+0;for(P=sa.length;ea<P;ea++)if(Q=sa[ea],ta=!0===Ha?Ma.materials[Q.materialIndex]:U.material,void 0!==ta&&(ga=ta.side,aa=k[Q.a],W=k[Q.b],ka=k[Q.c],F[0]=aa.positionScreen,F[1]=W.positionScreen,F[2]=ka.positionScreen,!0===aa.visible||!0===W.visible||!0===ka.visible||C.isIntersectionBox(N.setFromPoints(F))))if(y=0>(ka.positionScreen.x-aa.positionScreen.x)*(W.positionScreen.y-aa.positionScreen.y)-(ka.positionScreen.y-aa.positionScreen.y)*(W.positionScreen.x-aa.positionScreen.x),ga===THREE.DoubleSide||
|
|
|
+y===(ga===THREE.FrontSide)){if(p===r){var Ca=new THREE.RenderableFace3;t.push(Ca);r++;p++;n=Ca}else n=t[p++];n.id=U.id;n.v1.copy(aa);n.v2.copy(W);n.v3.copy(ka);n.normalModel.copy(Q.normal);!1===y&&(ga===THREE.BackSide||ga===THREE.DoubleSide)&&n.normalModel.negate();n.normalModel.applyMatrix3(S).normalize();n.normalModelView.copy(n.normalModel).applyMatrix3(A);n.centroidModel.copy(Q.centroid).applyMatrix4(x);ka=Q.vertexNormals;aa=0;for(W=Math.min(ka.length,3);aa<W;aa++)Ca=n.vertexNormalsModel[aa],
|
|
|
+Ca.copy(ka[aa]),!1===y&&(ga===THREE.BackSide||ga===THREE.DoubleSide)&&Ca.negate(),Ca.applyMatrix3(S).normalize(),n.vertexNormalsModelView[aa].copy(Ca).applyMatrix3(A);n.vertexNormalsLength=ka.length;y=0;for(aa=Math.min(da.length,3);y<aa;y++)if(ka=da[y][ea],void 0!==ka){W=0;for(ga=ka.length;W<ga;W++)n.uvs[y][W]=ka[W]}n.color=Q.color;n.material=ta;ca.copy(n.centroidModel).applyProjection(E);n.z=ca.z;B.elements.push(n)}}else if(U instanceof THREE.Line){H.multiplyMatrices(E,x);ea=U.geometry.vertices;
|
|
|
+aa=a();aa.positionScreen.copy(ea[0]).applyMatrix4(H);sa=U.type===THREE.LinePieces?2:1;P=1;for(Q=ea.length;P<Q;P++)aa=a(),aa.positionScreen.copy(ea[P]).applyMatrix4(H),0<(P+1)%sa||(W=k[i-2],qa.copy(aa.positionScreen),L.copy(W.positionScreen),!0===c(qa,L)&&(qa.multiplyScalar(1/qa.w),L.multiplyScalar(1/L.w),q===s?(da=new THREE.RenderableLine,u.push(da),s++,q++,m=da):m=u[q++],m.id=U.id,m.v1.positionScreen.copy(qa),m.v2.positionScreen.copy(L),m.z=Math.max(qa.z,L.z),m.material=U.material,U.material.vertexColors===
|
|
|
+THREE.VertexColors&&(m.vertexColors[0].copy(U.geometry.colors[P]),m.vertexColors[1].copy(U.geometry.colors[P-1])),B.elements.push(m)))}d=0;for(h=B.sprites.length;d<h;d++)U=B.sprites[d].object,x=U.matrixWorld,z.set(x.elements[12],x.elements[13],x.elements[14],1),z.applyMatrix4(E),ta=1/z.w,z.z*=ta,-1<=z.z&&1>=z.z&&(w===K?(sa=new THREE.RenderableSprite,G.push(sa),K++,w++,v=sa):v=G[w++],v.id=U.id,v.x=z.x*ta,v.y=z.y*ta,v.z=z.z,v.object=U,v.rotation=U.rotation,v.scale.x=U.scale.x*Math.abs(v.x-(z.x+f.projectionMatrix.elements[0])/
|
|
|
+(z.w+f.projectionMatrix.elements[12])),v.scale.y=U.scale.y*Math.abs(v.y-(z.y+f.projectionMatrix.elements[5])/(z.w+f.projectionMatrix.elements[13])),v.material=U.material,B.elements.push(v));!0===l&&B.elements.sort(b);return B}};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,h){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
|
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
@@ -181,8 +181,8 @@ h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
|
0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal)}b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},computeMorphNormals:function(){var a,b,c,d,e;c=0;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=[];e=this.morphNormals[a].faceNormals;
|
|
|
var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=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],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=
|
|
|
-this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,l,n,p,t,r,m,q,u=[],s=[];c=new THREE.Vector3;var v=new THREE.Vector3,w=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)u[a]=new THREE.Vector3,s[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,q=e.b,e=e.c,h=this.vertices[d],g=this.vertices[q],
|
|
|
-i=this.vertices[e],k=f[0],l=f[1],n=f[2],f=g.x-h.x,p=i.x-h.x,t=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,m=n.x-k.x,l=l.y-k.y,k=n.y-k.y,n=1/(i*k-m*l),c.set((k*f-l*p)*n,(k*t-l*r)*n,(k*g-l*h)*n),v.set((i*p-m*f)*n,(i*r-m*t)*n,(i*h-m*g)*n),u[d].add(c),u[q].add(c),u[e].add(c),s[d].add(v),s[q].add(v),s[e].add(v);v=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)N.copy(e.vertexNormals[c]),d=e[v[c]],q=u[d],w.copy(q),w.sub(N.multiplyScalar(N.dot(q))).normalize(),
|
|
|
+this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,l,n,p,t,r,m,q,u=[],s=[];c=new THREE.Vector3;var v=new THREE.Vector3,w=new THREE.Vector3,G=new THREE.Vector3,K=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)u[a]=new THREE.Vector3,s[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,q=e.b,e=e.c,h=this.vertices[d],g=this.vertices[q],
|
|
|
+i=this.vertices[e],k=f[0],l=f[1],n=f[2],f=g.x-h.x,p=i.x-h.x,t=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,m=n.x-k.x,l=l.y-k.y,k=n.y-k.y,n=1/(i*k-m*l),c.set((k*f-l*p)*n,(k*t-l*r)*n,(k*g-l*h)*n),v.set((i*p-m*f)*n,(i*r-m*t)*n,(i*h-m*g)*n),u[d].add(c),u[q].add(c),u[e].add(c),s[d].add(v),s[q].add(v),s[e].add(v);v=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)K.copy(e.vertexNormals[c]),d=e[v[c]],q=u[d],w.copy(q),w.sub(K.multiplyScalar(K.dot(q))).normalize(),
|
|
|
G.crossVectors(e.vertexNormals[c],q),d=G.dot(s[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d)}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.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){e=
|
|
|
a[f];this.faces.splice(e,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(e,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},
|
|
@@ -192,11 +192,11 @@ this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.positi
|
|
|
new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var h=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),h=Math.max(h,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(h)}}}(),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)};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,h,g,i,k,l,n,p=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var u=this.attributes.index.array,s=this.offsets;c=0;for(d=
|
|
|
s.length;c<d;++c){b=s[c].start;h=s[c].count;var v=s[c].index;a=b;for(b+=h;a<b;a+=3)h=v+u[a],g=v+u[a+1],i=v+u[a+2],k=e[3*h],l=e[3*h+1],n=e[3*h+2],p.set(k,l,n),k=e[3*g],l=e[3*g+1],n=e[3*g+2],t.set(k,l,n),k=e[3*i],l=e[3*i+1],n=e[3*i+2],r.set(k,l,n),m.subVectors(r,t),q.subVectors(p,t),m.cross(q),f[3*h]+=m.x,f[3*h+1]+=m.y,f[3*h+2]+=m.z,f[3*g]+=m.x,f[3*g+1]+=m.y,f[3*g+2]+=m.z,f[3*i]+=m.x,f[3*i+1]+=m.y,f[3*i+2]+=m.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],n=e[a+2],p.set(k,l,n),k=e[a+3],l=e[a+4],
|
|
|
-n=e[a+5],t.set(k,l,n),k=e[a+6],l=e[a+7],n=e[a+8],r.set(k,l,n),m.subVectors(r,t),q.subVectors(p,t),m.cross(q),f[a]=m.x,f[a+1]=m.y,f[a+2]=m.z,f[a+3]=m.x,f[a+4]=m.y,f[a+5]=m.z,f[a+6]=m.x,f[a+7]=m.y,f[a+8]=m.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){ga.x=d[3*a];ga.y=d[3*a+1];
|
|
|
-ga.z=d[3*a+2];oa.copy(ga);Q=g[a];I.copy(Q);I.sub(ga.multiplyScalar(ga.dot(Q))).normalize();S.crossVectors(oa,Q);P=S.dot(i[a]);L=0>P?-1:1;h[4*a]=I.x;h[4*a+1]=I.y;h[4*a+2]=I.z;h[4*a+3]=L}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;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var l,n,p,t,r,m,q,u,s,v,w,G,N,A,y,f=new THREE.Vector3,k=new THREE.Vector3,z,C,O,F,x,D,E,H=this.offsets;O=0;for(F=H.length;O<F;++O){C=H[O].start;x=H[O].count;var K=H[O].index;z=C;for(C+=x;z<C;z+=3)x=K+b[z],D=K+b[z+1],E=K+b[z+
|
|
|
-2],l=c[3*x],n=c[3*x+1],p=c[3*x+2],t=c[3*D],r=c[3*D+1],m=c[3*D+2],q=c[3*E],u=c[3*E+1],s=c[3*E+2],v=e[2*x],w=e[2*x+1],G=e[2*D],N=e[2*D+1],A=e[2*E],y=e[2*E+1],t-=l,l=q-l,r-=n,n=u-n,m-=p,p=s-p,G-=v,v=A-v,N-=w,w=y-w,y=1/(G*w-v*N),f.set((w*t-N*l)*y,(w*r-N*n)*y,(w*m-N*p)*y),k.set((G*l-v*t)*y,(G*n-v*r)*y,(G*p-v*m)*y),g[x].add(f),g[D].add(f),g[E].add(f),i[x].add(k),i[D].add(k),i[E].add(k)}var I=new THREE.Vector3,S=new THREE.Vector3,ga=new THREE.Vector3,oa=new THREE.Vector3,L,Q,P;O=0;for(F=H.length;O<F;++O){C=
|
|
|
-H[O].start;x=H[O].count;K=H[O].index;z=C;for(C+=x;z<C;z+=3)x=K+b[z],D=K+b[z+1],E=K+b[z+2],a(x),a(D),a(E)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);
|
|
|
+n=e[a+5],t.set(k,l,n),k=e[a+6],l=e[a+7],n=e[a+8],r.set(k,l,n),m.subVectors(r,t),q.subVectors(p,t),m.cross(q),f[a]=m.x,f[a+1]=m.y,f[a+2]=m.z,f[a+3]=m.x,f[a+4]=m.y,f[a+5]=m.z,f[a+6]=m.x,f[a+7]=m.y,f[a+8]=m.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){ja.x=d[3*a];ja.y=d[3*a+1];
|
|
|
+ja.z=d[3*a+2];qa.copy(ja);P=g[a];A.copy(P);A.sub(ja.multiplyScalar(ja.dot(P))).normalize();ca.crossVectors(qa,P);Q=ca.dot(i[a]);L=0>Q?-1:1;h[4*a]=A.x;h[4*a+1]=A.y;h[4*a+2]=A.z;h[4*a+3]=L}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;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var l,n,p,t,r,m,q,u,s,v,w,G,K,B,y,f=new THREE.Vector3,k=new THREE.Vector3,z,C,N,F,D,E,x,H=this.offsets;N=0;for(F=H.length;N<F;++N){C=H[N].start;D=H[N].count;var S=H[N].index;z=C;for(C+=D;z<C;z+=3)D=S+b[z],E=S+b[z+1],x=S+b[z+
|
|
|
+2],l=c[3*D],n=c[3*D+1],p=c[3*D+2],t=c[3*E],r=c[3*E+1],m=c[3*E+2],q=c[3*x],u=c[3*x+1],s=c[3*x+2],v=e[2*D],w=e[2*D+1],G=e[2*E],K=e[2*E+1],B=e[2*x],y=e[2*x+1],t-=l,l=q-l,r-=n,n=u-n,m-=p,p=s-p,G-=v,v=B-v,K-=w,w=y-w,y=1/(G*w-v*K),f.set((w*t-K*l)*y,(w*r-K*n)*y,(w*m-K*p)*y),k.set((G*l-v*t)*y,(G*n-v*r)*y,(G*p-v*m)*y),g[D].add(f),g[E].add(f),g[x].add(f),i[D].add(k),i[E].add(k),i[x].add(k)}var A=new THREE.Vector3,ca=new THREE.Vector3,ja=new THREE.Vector3,qa=new THREE.Vector3,L,P,Q;N=0;for(F=H.length;N<F;++N){C=
|
|
|
+H[N].start;D=H[N].count;S=H[N].index;z=C;for(C+=D;z<C;z+=3)D=S+b[z],E=S+b[z+1],x=S+b[z+2],a(D),a(E),a(x)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);
|
|
|
break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};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.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;return a};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()};
|
|
@@ -236,28 +236,28 @@ c.parse(g.data).geometry}h.uuid=g.uuid;void 0!==g.name&&(h.name=g.name);b[g.uuid
|
|
|
b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,b.groundColor,
|
|
|
b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;case "Sprite":f=d[b.material];void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Sprite(f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),
|
|
|
a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
|
|
|
-THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:p+"/"+a}function e(){f(A.scene,
|
|
|
-z.objects)}function f(a,b){var c,e,h,i,k,l;for(l in b){var p=A.objects[l],q=b[l];if(void 0===p){if(q.type&&q.type in n.hierarchyHandlers){if(void 0===q.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var u={},v;for(v in q)v in c||(u[v]=q[v]);r=A.materials[q.material];q.loading=!0;c=n.hierarchyHandlers[q.type].loaderObject;c.options?c.load(d(q.url,z.urlBaseType),g(l,a,r,q)):c.load(d(q.url,z.urlBaseType),g(l,
|
|
|
-a,r,q),u)}}else if(void 0!==q.geometry){if(t=A.geometries[q.geometry]){p=!1;r=A.materials[q.material];p=r instanceof THREE.ShaderMaterial;e=q.position;h=q.rotation;i=q.scale;c=q.matrix;k=q.quaternion;q.material||(r=new THREE.MeshFaceMaterial(A.face_materials[q.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(A.face_materials[q.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(u=0;u<r.materials.length;u++)p=p||r.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
+THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:p+"/"+a}function e(){f(B.scene,
|
|
|
+z.objects)}function f(a,b){var c,e,h,i,k,l;for(l in b){var p=B.objects[l],q=b[l];if(void 0===p){if(q.type&&q.type in n.hierarchyHandlers){if(void 0===q.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var u={},v;for(v in q)v in c||(u[v]=q[v]);r=B.materials[q.material];q.loading=!0;c=n.hierarchyHandlers[q.type].loaderObject;c.options?c.load(d(q.url,z.urlBaseType),g(l,a,r,q)):c.load(d(q.url,z.urlBaseType),g(l,
|
|
|
+a,r,q),u)}}else if(void 0!==q.geometry){if(t=B.geometries[q.geometry]){p=!1;r=B.materials[q.material];p=r instanceof THREE.ShaderMaterial;e=q.position;h=q.rotation;i=q.scale;c=q.matrix;k=q.quaternion;q.material||(r=new THREE.MeshFaceMaterial(B.face_materials[q.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(B.face_materials[q.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(u=0;u<r.materials.length;u++)p=p||r.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
p&&t.computeTangents();q.skin?p=new THREE.SkinnedMesh(t,r):q.morph?(p=new THREE.MorphAnimMesh(t,r),void 0!==q.duration&&(p.duration=q.duration),void 0!==q.time&&(p.time=q.time),void 0!==q.mirroredLoop&&(p.mirroredLoop=q.mirroredLoop),r.morphNormals&&t.computeMorphNormals()):p=new THREE.Mesh(t,r);p.name=l;c?(p.matrixAutoUpdate=!1,p.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),
|
|
|
-p.scale.fromArray(i));p.visible=q.visible;p.castShadow=q.castShadow;p.receiveShadow=q.receiveShadow;a.add(p);A.objects[l]=p}}else if("AmbientLight"===q.type||"PointLight"===q.type||"DirectionalLight"===q.type||"SpotLight"===q.type||"HemisphereLight"===q.type||"AreaLight"===q.type){u=q.color;c=q.intensity;e=q.distance;h=q.position;i=q.rotation;switch(q.type){case "AmbientLight":s=new THREE.AmbientLight(u);break;case "PointLight":s=new THREE.PointLight(u,c,e);s.position.fromArray(h);break;case "DirectionalLight":s=
|
|
|
+p.scale.fromArray(i));p.visible=q.visible;p.castShadow=q.castShadow;p.receiveShadow=q.receiveShadow;a.add(p);B.objects[l]=p}}else if("AmbientLight"===q.type||"PointLight"===q.type||"DirectionalLight"===q.type||"SpotLight"===q.type||"HemisphereLight"===q.type||"AreaLight"===q.type){u=q.color;c=q.intensity;e=q.distance;h=q.position;i=q.rotation;switch(q.type){case "AmbientLight":s=new THREE.AmbientLight(u);break;case "PointLight":s=new THREE.PointLight(u,c,e);s.position.fromArray(h);break;case "DirectionalLight":s=
|
|
|
new THREE.DirectionalLight(u,c);s.position.fromArray(q.direction);break;case "SpotLight":s=new THREE.SpotLight(u,c,e,1);s.angle=q.angle;s.position.fromArray(h);s.target.set(h[0],h[1]-e,h[2]);s.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":s=new THREE.DirectionalLight(u,c,e);s.target.set(h[0],h[1]-e,h[2]);s.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":s=new THREE.AreaLight(u,c),s.position.fromArray(h),s.width=q.size,s.height=
|
|
|
-q.size_y}a.add(s);s.name=l;A.lights[l]=s;A.objects[l]=s}else"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?(e=q.position,h=q.rotation,k=q.quaternion,"PerspectiveCamera"===q.type?m=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===q.type&&(m=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),m.name=l,m.position.fromArray(e),void 0!==k?m.quaternion.fromArray(k):void 0!==h&&m.rotation.fromArray(h),a.add(m),A.cameras[l]=m,A.objects[l]=
|
|
|
-m):(e=q.position,h=q.rotation,i=q.scale,k=q.quaternion,p=new THREE.Object3D,p.name=l,p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),p.scale.fromArray(i),p.visible=void 0!==q.visible?q.visible:!1,a.add(p),A.objects[l]=p,A.empties[l]=p);if(p){if(void 0!==q.userData)for(var w in q.userData)p.userData[w]=q.userData[w];if(void 0!==q.groups)for(u=0;u<q.groups.length;u++)c=q.groups[u],void 0===A.groups[c]&&(A.groups[c]=[]),A.groups[c].push(l)}}void 0!==p&&void 0!==q.children&&
|
|
|
-f(p,q.children)}}function h(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c;e();v-=1;n.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;A.objects[a]=
|
|
|
-f;e();v-=1;n.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c}}function k(){n.callbackProgress({totalModels:G,totalTextures:N,loadedModels:G-v,loadedTextures:N-w},A);n.onLoadProgress();if(0===v&&0===w){for(var a=0;a<y.length;a++){var c=y[a],d=A.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,A.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(A)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],
|
|
|
-b)}var n=this,p=THREE.Loader.prototype.extractUrlBase(c),t,r,m,q,u,s,v,w,G,N,A,y=[],z=a,C;for(C in this.geometryHandlers)a=this.geometryHandlers[C].loaderClass,this.geometryHandlers[C].loaderObject=new a;for(C in this.hierarchyHandlers)a=this.hierarchyHandlers[C].loaderClass,this.hierarchyHandlers[C].loaderObject=new a;w=v=0;A={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(z.transform&&(C=z.transform.position,
|
|
|
-a=z.transform.rotation,c=z.transform.scale,C&&A.scene.position.fromArray(C),a&&A.scene.rotation.fromArray(a),c&&A.scene.scale.fromArray(c),C||a||c))A.scene.updateMatrix(),A.scene.updateMatrixWorld();C=function(a){return function(){w-=a;k();n.onLoadComplete()}};for(var O in z.fogs)a=z.fogs[O],"linear"===a.type?q=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(q=new THREE.FogExp2(0,a.density)),a=a.color,q.color.setRGB(a[0],a[1],a[2]),A.fogs[O]=q;for(var F in z.geometries)q=z.geometries[F],q.type in
|
|
|
-this.geometryHandlers&&(v+=1,n.onLoadStart());for(var x in z.objects)l(z.objects[x],function(a){a.type&&a.type in n.hierarchyHandlers&&(v+=1,n.onLoadStart())});G=v;for(F in z.geometries)if(q=z.geometries[F],"cube"===q.type)t=new THREE.CubeGeometry(q.width,q.height,q.depth,q.widthSegments,q.heightSegments,q.depthSegments),t.name=F,A.geometries[F]=t;else if("plane"===q.type)t=new THREE.PlaneGeometry(q.width,q.height,q.widthSegments,q.heightSegments),t.name=F,A.geometries[F]=t;else if("sphere"===q.type)t=
|
|
|
-new THREE.SphereGeometry(q.radius,q.widthSegments,q.heightSegments),t.name=F,A.geometries[F]=t;else if("cylinder"===q.type)t=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs),t.name=F,A.geometries[F]=t;else if("torus"===q.type)t=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT),t.name=F,A.geometries[F]=t;else if("icosahedron"===q.type)t=new THREE.IcosahedronGeometry(q.radius,q.subdivisions),t.name=F,A.geometries[F]=t;else if(q.type in this.geometryHandlers){x=
|
|
|
-{};for(u in q)"type"!==u&&"url"!==u&&(x[u]=q[u]);this.geometryHandlers[q.type].loaderObject.load(d(q.url,z.urlBaseType),h(F),x)}else"embedded"===q.type&&(x=z.embeds[q.id],x.metadata=z.metadata,x&&(x=this.geometryHandlers.ascii.loaderObject.parse(x,""),i(F)(x.geometry,x.materials)));for(var D in z.textures)if(F=z.textures[D],F.url instanceof Array){w+=F.url.length;for(u=0;u<F.url.length;u++)n.onLoadStart()}else w+=1,n.onLoadStart();N=w;for(D in z.textures){F=z.textures[D];void 0!==F.mapping&&void 0!==
|
|
|
-THREE[F.mapping]&&(F.mapping=new THREE[F.mapping]);if(F.url instanceof Array){x=F.url.length;q=[];for(u=0;u<x;u++)q[u]=d(F.url[u],z.urlBaseType);u=(u=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,F.mapping,C(x)):THREE.ImageUtils.loadTextureCube(q,F.mapping,C(x))}else u=/\.dds$/i.test(F.url),x=d(F.url,z.urlBaseType),q=C(1),u=u?THREE.ImageUtils.loadCompressedTexture(x,F.mapping,q):THREE.ImageUtils.loadTexture(x,F.mapping,q),void 0!==THREE[F.minFilter]&&(u.minFilter=THREE[F.minFilter]),
|
|
|
-void 0!==THREE[F.magFilter]&&(u.magFilter=THREE[F.magFilter]),F.anisotropy&&(u.anisotropy=F.anisotropy),F.repeat&&(u.repeat.set(F.repeat[0],F.repeat[1]),1!==F.repeat[0]&&(u.wrapS=THREE.RepeatWrapping),1!==F.repeat[1]&&(u.wrapT=THREE.RepeatWrapping)),F.offset&&u.offset.set(F.offset[0],F.offset[1]),F.wrap&&(x={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==x[F.wrap[0]]&&(u.wrapS=x[F.wrap[0]]),void 0!==x[F.wrap[1]]&&(u.wrapT=x[F.wrap[1]]));A.textures[D]=u}var E,H;for(E in z.materials){D=
|
|
|
-z.materials[E];for(H in D.parameters)"envMap"===H||"map"===H||"lightMap"===H||"bumpMap"===H?D.parameters[H]=A.textures[D.parameters[H]]:"shading"===H?D.parameters[H]="flat"===D.parameters[H]?THREE.FlatShading:THREE.SmoothShading:"side"===H?D.parameters[H]="double"==D.parameters[H]?THREE.DoubleSide:"back"==D.parameters[H]?THREE.BackSide:THREE.FrontSide:"blending"===H?D.parameters[H]=D.parameters[H]in THREE?THREE[D.parameters[H]]:THREE.NormalBlending:"combine"===H?D.parameters[H]=D.parameters[H]in THREE?
|
|
|
-THREE[D.parameters[H]]:THREE.MultiplyOperation:"vertexColors"===H?"face"==D.parameters[H]?D.parameters[H]=THREE.FaceColors:D.parameters[H]&&(D.parameters[H]=THREE.VertexColors):"wrapRGB"===H&&(C=D.parameters[H],D.parameters[H]=new THREE.Vector3(C[0],C[1],C[2]));void 0!==D.parameters.opacity&&1>D.parameters.opacity&&(D.parameters.transparent=!0);D.parameters.normalMap?(C=THREE.ShaderLib.normalmap,F=THREE.UniformsUtils.clone(C.uniforms),u=D.parameters.color,x=D.parameters.specular,q=D.parameters.ambient,
|
|
|
-O=D.parameters.shininess,F.tNormal.value=A.textures[D.parameters.normalMap],D.parameters.normalScale&&F.uNormalScale.value.set(D.parameters.normalScale[0],D.parameters.normalScale[1]),D.parameters.map&&(F.tDiffuse.value=D.parameters.map,F.enableDiffuse.value=!0),D.parameters.envMap&&(F.tCube.value=D.parameters.envMap,F.enableReflection.value=!0,F.reflectivity.value=D.parameters.reflectivity),D.parameters.lightMap&&(F.tAO.value=D.parameters.lightMap,F.enableAO.value=!0),D.parameters.specularMap&&(F.tSpecular.value=
|
|
|
-A.textures[D.parameters.specularMap],F.enableSpecular.value=!0),D.parameters.displacementMap&&(F.tDisplacement.value=A.textures[D.parameters.displacementMap],F.enableDisplacement.value=!0,F.uDisplacementBias.value=D.parameters.displacementBias,F.uDisplacementScale.value=D.parameters.displacementScale),F.diffuse.value.setHex(u),F.specular.value.setHex(x),F.ambient.value.setHex(q),F.shininess.value=O,D.parameters.opacity&&(F.opacity.value=D.parameters.opacity),r=new THREE.ShaderMaterial({fragmentShader:C.fragmentShader,
|
|
|
-vertexShader:C.vertexShader,uniforms:F,lights:!0,fog:!0})):r=new THREE[D.type](D.parameters);r.name=E;A.materials[E]=r}for(E in z.materials)if(D=z.materials[E],D.parameters.materials){H=[];for(u=0;u<D.parameters.materials.length;u++)H.push(A.materials[D.parameters.materials[u]]);A.materials[E].materials=H}e();A.cameras&&z.defaults.camera&&(A.currentCamera=A.cameras[z.defaults.camera]);A.fogs&&z.defaults.fog&&(A.scene.fog=A.fogs[z.defaults.fog]);n.callbackSync(A);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
+q.size_y}a.add(s);s.name=l;B.lights[l]=s;B.objects[l]=s}else"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?(e=q.position,h=q.rotation,k=q.quaternion,"PerspectiveCamera"===q.type?m=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===q.type&&(m=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),m.name=l,m.position.fromArray(e),void 0!==k?m.quaternion.fromArray(k):void 0!==h&&m.rotation.fromArray(h),a.add(m),B.cameras[l]=m,B.objects[l]=
|
|
|
+m):(e=q.position,h=q.rotation,i=q.scale,k=q.quaternion,p=new THREE.Object3D,p.name=l,p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),p.scale.fromArray(i),p.visible=void 0!==q.visible?q.visible:!1,a.add(p),B.objects[l]=p,B.empties[l]=p);if(p){if(void 0!==q.userData)for(var w in q.userData)p.userData[w]=q.userData[w];if(void 0!==q.groups)for(u=0;u<q.groups.length;u++)c=q.groups[u],void 0===B.groups[c]&&(B.groups[c]=[]),B.groups[c].push(l)}}void 0!==p&&void 0!==q.children&&
|
|
|
+f(p,q.children)}}function h(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c;e();v-=1;n.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;B.objects[a]=
|
|
|
+f;e();v-=1;n.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c}}function k(){n.callbackProgress({totalModels:G,totalTextures:K,loadedModels:G-v,loadedTextures:K-w},B);n.onLoadProgress();if(0===v&&0===w){for(var a=0;a<y.length;a++){var c=y[a],d=B.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,B.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(B)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],
|
|
|
+b)}var n=this,p=THREE.Loader.prototype.extractUrlBase(c),t,r,m,q,u,s,v,w,G,K,B,y=[],z=a,C;for(C in this.geometryHandlers)a=this.geometryHandlers[C].loaderClass,this.geometryHandlers[C].loaderObject=new a;for(C in this.hierarchyHandlers)a=this.hierarchyHandlers[C].loaderClass,this.hierarchyHandlers[C].loaderObject=new a;w=v=0;B={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(z.transform&&(C=z.transform.position,
|
|
|
+a=z.transform.rotation,c=z.transform.scale,C&&B.scene.position.fromArray(C),a&&B.scene.rotation.fromArray(a),c&&B.scene.scale.fromArray(c),C||a||c))B.scene.updateMatrix(),B.scene.updateMatrixWorld();C=function(a){return function(){w-=a;k();n.onLoadComplete()}};for(var N in z.fogs)a=z.fogs[N],"linear"===a.type?q=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(q=new THREE.FogExp2(0,a.density)),a=a.color,q.color.setRGB(a[0],a[1],a[2]),B.fogs[N]=q;for(var F in z.geometries)q=z.geometries[F],q.type in
|
|
|
+this.geometryHandlers&&(v+=1,n.onLoadStart());for(var D in z.objects)l(z.objects[D],function(a){a.type&&a.type in n.hierarchyHandlers&&(v+=1,n.onLoadStart())});G=v;for(F in z.geometries)if(q=z.geometries[F],"cube"===q.type)t=new THREE.CubeGeometry(q.width,q.height,q.depth,q.widthSegments,q.heightSegments,q.depthSegments),t.name=F,B.geometries[F]=t;else if("plane"===q.type)t=new THREE.PlaneGeometry(q.width,q.height,q.widthSegments,q.heightSegments),t.name=F,B.geometries[F]=t;else if("sphere"===q.type)t=
|
|
|
+new THREE.SphereGeometry(q.radius,q.widthSegments,q.heightSegments),t.name=F,B.geometries[F]=t;else if("cylinder"===q.type)t=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs),t.name=F,B.geometries[F]=t;else if("torus"===q.type)t=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT),t.name=F,B.geometries[F]=t;else if("icosahedron"===q.type)t=new THREE.IcosahedronGeometry(q.radius,q.subdivisions),t.name=F,B.geometries[F]=t;else if(q.type in this.geometryHandlers){D=
|
|
|
+{};for(u in q)"type"!==u&&"url"!==u&&(D[u]=q[u]);this.geometryHandlers[q.type].loaderObject.load(d(q.url,z.urlBaseType),h(F),D)}else"embedded"===q.type&&(D=z.embeds[q.id],D.metadata=z.metadata,D&&(D=this.geometryHandlers.ascii.loaderObject.parse(D,""),i(F)(D.geometry,D.materials)));for(var E in z.textures)if(F=z.textures[E],F.url instanceof Array){w+=F.url.length;for(u=0;u<F.url.length;u++)n.onLoadStart()}else w+=1,n.onLoadStart();K=w;for(E in z.textures){F=z.textures[E];void 0!==F.mapping&&void 0!==
|
|
|
+THREE[F.mapping]&&(F.mapping=new THREE[F.mapping]);if(F.url instanceof Array){D=F.url.length;q=[];for(u=0;u<D;u++)q[u]=d(F.url[u],z.urlBaseType);u=(u=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,F.mapping,C(D)):THREE.ImageUtils.loadTextureCube(q,F.mapping,C(D))}else u=/\.dds$/i.test(F.url),D=d(F.url,z.urlBaseType),q=C(1),u=u?THREE.ImageUtils.loadCompressedTexture(D,F.mapping,q):THREE.ImageUtils.loadTexture(D,F.mapping,q),void 0!==THREE[F.minFilter]&&(u.minFilter=THREE[F.minFilter]),
|
|
|
+void 0!==THREE[F.magFilter]&&(u.magFilter=THREE[F.magFilter]),F.anisotropy&&(u.anisotropy=F.anisotropy),F.repeat&&(u.repeat.set(F.repeat[0],F.repeat[1]),1!==F.repeat[0]&&(u.wrapS=THREE.RepeatWrapping),1!==F.repeat[1]&&(u.wrapT=THREE.RepeatWrapping)),F.offset&&u.offset.set(F.offset[0],F.offset[1]),F.wrap&&(D={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==D[F.wrap[0]]&&(u.wrapS=D[F.wrap[0]]),void 0!==D[F.wrap[1]]&&(u.wrapT=D[F.wrap[1]]));B.textures[E]=u}var x,H;for(x in z.materials){E=
|
|
|
+z.materials[x];for(H in E.parameters)"envMap"===H||"map"===H||"lightMap"===H||"bumpMap"===H?E.parameters[H]=B.textures[E.parameters[H]]:"shading"===H?E.parameters[H]="flat"===E.parameters[H]?THREE.FlatShading:THREE.SmoothShading:"side"===H?E.parameters[H]="double"==E.parameters[H]?THREE.DoubleSide:"back"==E.parameters[H]?THREE.BackSide:THREE.FrontSide:"blending"===H?E.parameters[H]=E.parameters[H]in THREE?THREE[E.parameters[H]]:THREE.NormalBlending:"combine"===H?E.parameters[H]=E.parameters[H]in THREE?
|
|
|
+THREE[E.parameters[H]]:THREE.MultiplyOperation:"vertexColors"===H?"face"==E.parameters[H]?E.parameters[H]=THREE.FaceColors:E.parameters[H]&&(E.parameters[H]=THREE.VertexColors):"wrapRGB"===H&&(C=E.parameters[H],E.parameters[H]=new THREE.Vector3(C[0],C[1],C[2]));void 0!==E.parameters.opacity&&1>E.parameters.opacity&&(E.parameters.transparent=!0);E.parameters.normalMap?(C=THREE.ShaderLib.normalmap,F=THREE.UniformsUtils.clone(C.uniforms),u=E.parameters.color,D=E.parameters.specular,q=E.parameters.ambient,
|
|
|
+N=E.parameters.shininess,F.tNormal.value=B.textures[E.parameters.normalMap],E.parameters.normalScale&&F.uNormalScale.value.set(E.parameters.normalScale[0],E.parameters.normalScale[1]),E.parameters.map&&(F.tDiffuse.value=E.parameters.map,F.enableDiffuse.value=!0),E.parameters.envMap&&(F.tCube.value=E.parameters.envMap,F.enableReflection.value=!0,F.reflectivity.value=E.parameters.reflectivity),E.parameters.lightMap&&(F.tAO.value=E.parameters.lightMap,F.enableAO.value=!0),E.parameters.specularMap&&(F.tSpecular.value=
|
|
|
+B.textures[E.parameters.specularMap],F.enableSpecular.value=!0),E.parameters.displacementMap&&(F.tDisplacement.value=B.textures[E.parameters.displacementMap],F.enableDisplacement.value=!0,F.uDisplacementBias.value=E.parameters.displacementBias,F.uDisplacementScale.value=E.parameters.displacementScale),F.diffuse.value.setHex(u),F.specular.value.setHex(D),F.ambient.value.setHex(q),F.shininess.value=N,E.parameters.opacity&&(F.opacity.value=E.parameters.opacity),r=new THREE.ShaderMaterial({fragmentShader:C.fragmentShader,
|
|
|
+vertexShader:C.vertexShader,uniforms:F,lights:!0,fog:!0})):r=new THREE[E.type](E.parameters);r.name=x;B.materials[x]=r}for(x in z.materials)if(E=z.materials[x],E.parameters.materials){H=[];for(u=0;u<E.parameters.materials.length;u++)H.push(B.materials[E.parameters.materials[u]]);B.materials[x].materials=H}e();B.cameras&&z.defaults.camera&&(B.currentCamera=B.cameras[z.defaults.camera]);B.fogs&&z.defaults.fog&&(B.scene.fog=B.fogs[z.defaults.fog]);n.callbackSync(B);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
|
|
|
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
|
|
|
THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
@@ -296,30 +296,30 @@ THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAn
|
|
|
THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.setFromMatrixPosition(c.matrixWorld);b.setFromMatrixPosition(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!1}}}();THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0};THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;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)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}this.dispatchEvent({type:"objectAdded",object:a});a.dispatchEvent({type:"addedToScene",scene:this});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);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));this.dispatchEvent({type:"objectRemoved",object:a});a.dispatchEvent({type:"removedFromScene",scene:this});for(b=
|
|
|
-0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};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,b,c){for(var d=0,e=N.length;d<e;d++){var f=N[d];Ha.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=Aa.setFromMatrixPosition(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ha.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=Aa.setFromMatrixPosition(f.matrixWorld),g=b.dot(Aa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ha.multiplyScalar(g)))))}}
|
|
|
-function c(a,b,c,d){p(b);t(c);r(d);m(a.getStyle());x.stroke();Fa.expandByScalar(2*b)}function d(a){q(a.getStyle());x.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);ra[a.id]=x.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
-function h(a,b,c,d,h,g,j,i,k,l,n,p,m){if(!(m instanceof THREE.DataTexture)){!1===m.hasEventListener("update",e)&&(void 0!==m.image&&0<m.image.width&&f(m),m.addEventListener("update",e));var t=ra[m.id];if(void 0!==t){q(t);var t=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=m.image.width*m.repeat.x,m=m.image.height*m.repeat.y,j=(j+t)*s,i=(i+r)*m,c=c-a,d=d-b,h=h-a,g=g-b,k=(k+t)*s-j,l=(l+r)*m-i,n=(n+t)*s-j,p=(p+r)*m-i,m=k*p-n*l;0!==m&&(t=1/m,m=(p*c-l*h)*t,l=(p*d-l*g)*t,c=(k*h-n*c)*t,d=(k*g-n*d)*t,a=
|
|
|
-a-m*j-c*i,b=b-l*j-d*i,x.save(),x.transform(m,l,c,d,a,b),x.fill(),x.restore())}else q("rgba(0,0,0,1)"),x.fill()}}function g(a,b,c,d,e,f,h,g,j,i,k,l,n){var m,p;m=n.width-1;p=n.height-1;h*=m;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*m-h;i=i*p-g;k=k*m-h;l=l*p-g;p=1/(j*l-k*i);m=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-m*h-c*g;b=b-i*h-d*g;x.save();x.transform(m,i,c,d,a,b);x.clip();x.drawImage(n,0,0);x.restore()}function i(a,b,c,d){ma[0]=255*a.r|0;ma[1]=255*a.g|0;ma[2]=255*a.b|0;ma[4]=255*b.r|0;ma[5]=
|
|
|
-255*b.g|0;ma[6]=255*b.b|0;ma[8]=255*c.r|0;ma[9]=255*c.g|0;ma[10]=255*c.b|0;ma[12]=255*d.r|0;ma[13]=255*d.g|0;ma[14]=255*d.b|0;wa.putImageData(bb,0,0);cb.drawImage(j,0,0);return Ca}function k(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function l(a){H!==a&&(H=x.globalAlpha=a)}function n(a){K!==a&&(a===THREE.NormalBlending?x.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?x.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
-(x.globalCompositeOperation="darker"),K=a)}function p(a){ga!==a&&(ga=x.lineWidth=a)}function t(a){oa!==a&&(oa=x.lineCap=a)}function r(a){L!==a&&(L=x.lineJoin=a)}function m(a){I!==a&&(I=x.strokeStyle=a)}function q(a){S!==a&&(S=x.fillStyle=a)}function u(a,b){if(Q!==a||P!==b)x.setLineDash([a,b]),Q=a,P=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var s=THREE.Math.smoothstep,a=a||{},v=this,w,G,N,A=new THREE.Projector,y=void 0!==a.canvas?a.canvas:document.createElement("canvas"),z=y.width,C=y.height,
|
|
|
-O=Math.floor(z/2),F=Math.floor(C/2),x=y.getContext("2d"),D=new THREE.Color(0),E=0,H=1,K=0,I=null,S=null,ga=null,oa=null,L=null,Q=null,P=0,B,R,ia,ta;new THREE.RenderableVertex;new THREE.RenderableVertex;var Ga,za,ua,Ba,ca,$,Y=new THREE.Color,da=new THREE.Color,U=new THREE.Color,ba=new THREE.Color,qa=new THREE.Color,ha=new THREE.Color,va=new THREE.Color,Ha=new THREE.Color,ra={},Ea,La,Pa,Ma,gb,hb,db,ib,wb,Qa,Ra=new THREE.Box2,sa=new THREE.Box2,Fa=new THREE.Box2,ja=new THREE.Color,ea=new THREE.Color,
|
|
|
-Na=new THREE.Color,Aa=new THREE.Vector3,j,wa,bb,ma,Ca,cb,Sa=16;j=document.createElement("canvas");j.width=j.height=2;wa=j.getContext("2d");wa.fillStyle="rgba(0,0,0,1)";wa.fillRect(0,0,2,2);bb=wa.getImageData(0,0,2,2);ma=bb.data;Ca=document.createElement("canvas");Ca.width=Ca.height=Sa;cb=Ca.getContext("2d");cb.translate(-Sa/2,-Sa/2);cb.scale(Sa,Sa);Sa--;void 0===x.setLineDash&&(x.setLineDash=void 0!==x.mozDash?function(a){x.mozDash=null!==a[0]?a:null}:function(){});this.domElement=y;this.devicePixelRatio=
|
|
|
-void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.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,c){z=a*this.devicePixelRatio;C=b*this.devicePixelRatio;O=Math.floor(z/2);F=Math.floor(C/2);y.width=z;y.height=C;1!==this.devicePixelRatio&&!1!==c&&(y.style.width=a+"px",y.style.height=b+"px");Ra.set(new THREE.Vector2(-O,
|
|
|
--F),new THREE.Vector2(O,F));sa.set(new THREE.Vector2(-O,-F),new THREE.Vector2(O,F));H=1;K=0;L=oa=ga=S=I=null};this.setClearColor=function(a,b){D.set(a);E=void 0!==b?b:1;sa.set(new THREE.Vector2(-O,-F),new THREE.Vector2(O,F))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){x.setTransform(1,0,0,-1,O,F);!1===sa.empty()&&(sa.intersect(Ra),
|
|
|
-sa.expandByScalar(2),1>E&&x.clearRect(sa.min.x|0,sa.min.y|0,sa.max.x-sa.min.x|0,sa.max.y-sa.min.y|0),0<E&&(n(THREE.NormalBlending),l(1),q("rgba("+Math.floor(255*D.r)+","+Math.floor(255*D.g)+","+Math.floor(255*D.b)+","+E+")"),x.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.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{!0===this.autoClear&&this.clear();x.setTransform(1,0,0,-1,O,F);v.info.render.vertices=0;v.info.render.faces=0;w=A.projectScene(a,j,this.sortObjects,this.sortElements);G=w.elements;N=w.lights;B=j;ja.setRGB(0,0,0);ea.setRGB(0,0,0);Na.setRGB(0,0,0);for(var z=0,H=N.length;z<H;z++){var y=N[z],D=y.color;y instanceof THREE.AmbientLight?ja.add(D):y instanceof THREE.DirectionalLight?ea.add(D):y instanceof THREE.PointLight&&Na.add(D)}z=0;for(H=G.length;z<H;z++){var C=G[z],E=C.material;if(!(void 0===E||
|
|
|
-!1===E.visible)){Fa.makeEmpty();if(C instanceof THREE.RenderableSprite){R=C;R.x*=O;R.y*=F;var y=R,D=C,L=E;l(L.opacity);n(L.blending);var I=D.scale.x*O,K=D.scale.y*F,D=0.5*Math.sqrt(I*I+K*K);Fa.min.set(y.x-D,y.y-D);Fa.max.set(y.x+D,y.y+D);if(!1===Ra.isIntersectionBox(Fa))Fa.makeEmpty();else if(L instanceof THREE.SpriteMaterial||L instanceof THREE.ParticleSystemMaterial){var Q=L.map;if(null!==Q){!1===Q.hasEventListener("update",e)&&(void 0!==Q.image&&0<Q.image.width&&f(Q),Q.addEventListener("update",
|
|
|
-e));var P=Q.image;if(1>=Q.repeat.x&&1>=Q.repeat.y){var D=P.width*Q.offset.x,S=P.height*(1-Q.offset.y-Q.repeat.y),C=P.width*Q.repeat.x,E=P.height*Q.repeat.y;x.save();x.translate(y.x,y.y);0!==L.rotation&&x.rotate(L.rotation);x.scale(I,-K);x.drawImage(P,D,S,C,E,-0.5,-0.5,1,1)}else D=P.width*Q.offset.x,S=P.height*Q.offset.y,C=P.width*Q.repeat.x,E=P.height*Q.repeat.y,L=C/I,I=E/K,K=ra[Q.id],void 0!==K?q(K):q("rgba( 0, 0, 0, 1 )"),x.save(),x.scale(1/L,1/I),x.translate(y.x*L-0.5*C-D,y.y*I-0.5*E-S),x.fillRect(D,
|
|
|
-S,C,E)}else q(L.color.getStyle()),x.save(),x.translate(y.x,y.y),0!==L.rotation&&x.rotate(L.rotation),x.scale(I,-K),x.fillRect(-0.5,-0.5,1,1);x.restore()}else L instanceof THREE.SpriteCanvasMaterial&&(m(L.color.getStyle()),q(L.color.getStyle()),x.save(),x.translate(y.x,y.y),0!==L.rotation&&x.rotate(L.rotation),x.scale(I,K),L.program(x),x.restore())}else if(C instanceof THREE.RenderableLine){if(R=C.v1,ia=C.v2,R.positionScreen.x*=O,R.positionScreen.y*=F,ia.positionScreen.x*=O,ia.positionScreen.y*=F,
|
|
|
-Fa.setFromPoints([R.positionScreen,ia.positionScreen]),!0===Ra.isIntersectionBox(Fa))if(y=R,D=ia,S=C,C=E,l(C.opacity),n(C.blending),x.beginPath(),x.moveTo(y.positionScreen.x,y.positionScreen.y),x.lineTo(D.positionScreen.x,D.positionScreen.y),C instanceof THREE.LineBasicMaterial){p(C.linewidth);t(C.linecap);r(C.linejoin);if(C.vertexColors!==THREE.VertexColors)m(C.color.getStyle());else if(E=S.vertexColors[0].getStyle(),S=S.vertexColors[1].getStyle(),E===S)m(E);else{try{var ga=x.createLinearGradient(y.positionScreen.x,
|
|
|
-y.positionScreen.y,D.positionScreen.x,D.positionScreen.y);ga.addColorStop(0,E);ga.addColorStop(1,S)}catch(oa){ga=E}m(ga)}x.stroke();Fa.expandByScalar(2*C.linewidth)}else C instanceof THREE.LineDashedMaterial&&(p(C.linewidth),t(C.linecap),r(C.linejoin),m(C.color.getStyle()),u(C.dashSize,C.gapSize),x.stroke(),Fa.expandByScalar(2*C.linewidth),u(null,null))}else if(C instanceof THREE.RenderableFace3){R=C.v1;ia=C.v2;ta=C.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>ia.positionScreen.z||
|
|
|
-1<ia.positionScreen.z)continue;if(-1>ta.positionScreen.z||1<ta.positionScreen.z)continue;R.positionScreen.x*=O;R.positionScreen.y*=F;ia.positionScreen.x*=O;ia.positionScreen.y*=F;ta.positionScreen.x*=O;ta.positionScreen.y*=F;0<E.overdraw&&(k(R.positionScreen,ia.positionScreen,E.overdraw),k(ia.positionScreen,ta.positionScreen,E.overdraw),k(ta.positionScreen,R.positionScreen,E.overdraw));Fa.setFromPoints([R.positionScreen,ia.positionScreen,ta.positionScreen]);if(!0===Ra.isIntersectionBox(Fa)){y=R;D=
|
|
|
-ia;S=ta;v.info.render.vertices+=3;v.info.render.faces++;l(E.opacity);n(E.blending);Ga=y.positionScreen.x;za=y.positionScreen.y;ua=D.positionScreen.x;Ba=D.positionScreen.y;ca=S.positionScreen.x;$=S.positionScreen.y;var L=Ga,I=za,K=ua,Q=Ba,P=ca,ma=$;x.beginPath();x.moveTo(L,I);x.lineTo(K,Q);x.lineTo(P,ma);x.closePath();(E instanceof THREE.MeshLambertMaterial||E instanceof THREE.MeshPhongMaterial)&&null===E.map?(ha.copy(E.color),va.copy(E.emissive),E.vertexColors===THREE.FaceColors&&ha.multiply(C.color),
|
|
|
-!1===E.wireframe&&E.shading===THREE.SmoothShading&&3===C.vertexNormalsLength?(da.copy(ja),U.copy(ja),ba.copy(ja),b(C.v1.positionWorld,C.vertexNormalsModel[0],da),b(C.v2.positionWorld,C.vertexNormalsModel[1],U),b(C.v3.positionWorld,C.vertexNormalsModel[2],ba),da.multiply(ha).add(va),U.multiply(ha).add(va),ba.multiply(ha).add(va),qa.addColors(U,ba).multiplyScalar(0.5),Pa=i(da,U,ba,qa),g(Ga,za,ua,Ba,ca,$,0,0,1,0,0,1,Pa)):(Y.copy(ja),b(C.centroidModel,C.normalModel,Y),Y.multiply(ha).add(va),!0===E.wireframe?
|
|
|
-c(Y,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):d(Y))):E instanceof THREE.MeshBasicMaterial||E instanceof THREE.MeshLambertMaterial||E instanceof THREE.MeshPhongMaterial?null!==E.map?E.map.mapping instanceof THREE.UVMapping&&(Ma=C.uvs[0],h(Ga,za,ua,Ba,ca,$,Ma[0].x,Ma[0].y,Ma[1].x,Ma[1].y,Ma[2].x,Ma[2].y,E.map)):null!==E.envMap?E.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(Aa.copy(C.vertexNormalsModelView[0]),gb=0.5*Aa.x+0.5,hb=0.5*Aa.y+0.5,Aa.copy(C.vertexNormalsModelView[1]),
|
|
|
-db=0.5*Aa.x+0.5,ib=0.5*Aa.y+0.5,Aa.copy(C.vertexNormalsModelView[2]),wb=0.5*Aa.x+0.5,Qa=0.5*Aa.y+0.5,h(Ga,za,ua,Ba,ca,$,gb,hb,db,ib,wb,Qa,E.envMap)):(Y.copy(E.color),E.vertexColors===THREE.FaceColors&&Y.multiply(C.color),!0===E.wireframe?c(Y,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):d(Y)):E instanceof THREE.MeshDepthMaterial?(Ea=B.near,La=B.far,da.r=da.g=da.b=1-s(y.positionScreen.z*y.positionScreen.w,Ea,La),U.r=U.g=U.b=1-s(D.positionScreen.z*D.positionScreen.w,Ea,La),ba.r=ba.g=
|
|
|
-ba.b=1-s(S.positionScreen.z*S.positionScreen.w,Ea,La),qa.addColors(U,ba).multiplyScalar(0.5),Pa=i(da,U,ba,qa),g(Ga,za,ua,Ba,ca,$,0,0,1,0,0,1,Pa)):E instanceof THREE.MeshNormalMaterial&&(y=void 0,E.shading===THREE.FlatShading?(y=C.normalModelView,Y.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),!0===E.wireframe?c(Y,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):d(Y)):E.shading===THREE.SmoothShading&&(y=C.vertexNormalsModelView[0],da.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-y=C.vertexNormalsModelView[1],U.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),y=C.vertexNormalsModelView[2],ba.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),qa.addColors(U,ba).multiplyScalar(0.5),Pa=i(da,U,ba,qa),g(Ga,za,ua,Ba,ca,$,0,0,1,0,0,1,Pa)))}}sa.union(Fa)}}x.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",
|
|
|
+0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};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,b,c){for(var d=0,e=K.length;d<e;d++){var f=K[d];Ma.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=Ea.setFromMatrixPosition(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ma.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=Ea.setFromMatrixPosition(f.matrixWorld),g=b.dot(Ea.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ma.multiplyScalar(g)))))}}
|
|
|
+function c(a,b,c,d){p(b);t(c);r(d);m(a.getStyle());D.stroke();Ia.expandByScalar(2*b)}function d(a){q(a.getStyle());D.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);ta[a.id]=D.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
+function h(a,b,c,d,h,g,j,i,k,l,n,p,m){if(!(m instanceof THREE.DataTexture)){!1===m.hasEventListener("update",e)&&(void 0!==m.image&&0<m.image.width&&f(m),m.addEventListener("update",e));var t=ta[m.id];if(void 0!==t){q(t);var t=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=m.image.width*m.repeat.x,m=m.image.height*m.repeat.y,j=(j+t)*s,i=(i+r)*m,c=c-a,d=d-b,h=h-a,g=g-b,k=(k+t)*s-j,l=(l+r)*m-i,n=(n+t)*s-j,p=(p+r)*m-i,m=k*p-n*l;0!==m&&(t=1/m,m=(p*c-l*h)*t,l=(p*d-l*g)*t,c=(k*h-n*c)*t,d=(k*g-n*d)*t,a=
|
|
|
+a-m*j-c*i,b=b-l*j-d*i,D.save(),D.transform(m,l,c,d,a,b),D.fill(),D.restore())}else q("rgba(0,0,0,1)"),D.fill()}}function g(a,b,c,d,e,f,h,g,j,i,k,l,n){var m,p;m=n.width-1;p=n.height-1;h*=m;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*m-h;i=i*p-g;k=k*m-h;l=l*p-g;p=1/(j*l-k*i);m=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-m*h-c*g;b=b-i*h-d*g;D.save();D.transform(m,i,c,d,a,b);D.clip();D.drawImage(n,0,0);D.restore()}function i(a,b,c,d){oa[0]=255*a.r|0;oa[1]=255*a.g|0;oa[2]=255*a.b|0;oa[4]=255*b.r|0;oa[5]=
|
|
|
+255*b.g|0;oa[6]=255*b.b|0;oa[8]=255*c.r|0;oa[9]=255*c.g|0;oa[10]=255*c.b|0;oa[12]=255*d.r|0;oa[13]=255*d.g|0;oa[14]=255*d.b|0;ya.putImageData(cb,0,0);db.drawImage(j,0,0);return Fa}function k(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function l(a){H!==a&&(H=D.globalAlpha=a)}function n(a){S!==a&&(a===THREE.NormalBlending?D.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?D.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
+(D.globalCompositeOperation="darker"),S=a)}function p(a){ja!==a&&(ja=D.lineWidth=a)}function t(a){qa!==a&&(qa=D.lineCap=a)}function r(a){L!==a&&(L=D.lineJoin=a)}function m(a){A!==a&&(A=D.strokeStyle=a)}function q(a){ca!==a&&(ca=D.fillStyle=a)}function u(a,b){if(P!==a||Q!==b)D.setLineDash([a,b]),P=a,Q=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var s=THREE.Math.smoothstep,a=a||{},v=this,w,G,K,B=new THREE.Projector,y=void 0!==a.canvas?a.canvas:document.createElement("canvas"),z=y.width,C=y.height,
|
|
|
+N=Math.floor(z/2),F=Math.floor(C/2),D=y.getContext("2d"),E=new THREE.Color(0),x=0,H=1,S=0,A=null,ca=null,ja=null,qa=null,L=null,P=null,Q=0,I,V,O,va;new THREE.RenderableVertex;new THREE.RenderableVertex;var fa,Ba,xa,Da,ea,aa,W=new THREE.Color,ga=new THREE.Color,U=new THREE.Color,da=new THREE.Color,sa=new THREE.Color,ka=new THREE.Color,Ha=new THREE.Color,Ma=new THREE.Color,ta={},Ca,Na,Qa,wa,hb,ib,eb,jb,wb,Ra,Sa=new THREE.Box2,ua=new THREE.Box2,Ia=new THREE.Box2,la=new THREE.Color,ha=new THREE.Color,
|
|
|
+Oa=new THREE.Color,Ea=new THREE.Vector3,j,ya,cb,oa,Fa,db,Ta=16;j=document.createElement("canvas");j.width=j.height=2;ya=j.getContext("2d");ya.fillStyle="rgba(0,0,0,1)";ya.fillRect(0,0,2,2);cb=ya.getImageData(0,0,2,2);oa=cb.data;Fa=document.createElement("canvas");Fa.width=Fa.height=Ta;db=Fa.getContext("2d");db.translate(-Ta/2,-Ta/2);db.scale(Ta,Ta);Ta--;void 0===D.setLineDash&&(D.setLineDash=void 0!==D.mozDash?function(a){D.mozDash=null!==a[0]?a:null}:function(){});this.domElement=y;this.devicePixelRatio=
|
|
|
+void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.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,c){z=a*this.devicePixelRatio;C=b*this.devicePixelRatio;N=Math.floor(z/2);F=Math.floor(C/2);y.width=z;y.height=C;1!==this.devicePixelRatio&&!1!==c&&(y.style.width=a+"px",y.style.height=b+"px");Sa.set(new THREE.Vector2(-N,
|
|
|
+-F),new THREE.Vector2(N,F));ua.set(new THREE.Vector2(-N,-F),new THREE.Vector2(N,F));H=1;S=0;L=qa=ja=ca=A=null};this.setClearColor=function(a,b){E.set(a);x=void 0!==b?b:1;ua.set(new THREE.Vector2(-N,-F),new THREE.Vector2(N,F))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){D.setTransform(1,0,0,-1,N,F);!1===ua.empty()&&(ua.intersect(Sa),
|
|
|
+ua.expandByScalar(2),1>x&&D.clearRect(ua.min.x|0,ua.min.y|0,ua.max.x-ua.min.x|0,ua.max.y-ua.min.y|0),0<x&&(n(THREE.NormalBlending),l(1),q("rgba("+Math.floor(255*E.r)+","+Math.floor(255*E.g)+","+Math.floor(255*E.b)+","+x+")"),D.fillRect(ua.min.x|0,ua.min.y|0,ua.max.x-ua.min.x|0,ua.max.y-ua.min.y|0)),ua.makeEmpty())};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{!0===this.autoClear&&this.clear();D.setTransform(1,0,0,-1,N,F);v.info.render.vertices=0;v.info.render.faces=0;w=B.projectScene(a,j,this.sortObjects,this.sortElements);G=w.elements;K=w.lights;I=j;la.setRGB(0,0,0);ha.setRGB(0,0,0);Oa.setRGB(0,0,0);for(var z=0,H=K.length;z<H;z++){var y=K[z],E=y.color;y instanceof THREE.AmbientLight?la.add(E):y instanceof THREE.DirectionalLight?ha.add(E):y instanceof THREE.PointLight&&Oa.add(E)}z=0;for(H=G.length;z<H;z++){var C=G[z],x=C.material;if(!(void 0===x||
|
|
|
+!1===x.visible)){Ia.makeEmpty();if(C instanceof THREE.RenderableSprite){V=C;V.x*=N;V.y*=F;y=V;E=x;l(E.opacity);n(E.blending);var L=C.scale.x*N,C=C.scale.y*F,x=0.5*Math.sqrt(L*L+C*C);Ia.min.set(y.x-x,y.y-x);Ia.max.set(y.x+x,y.y+x);if(!1===Sa.isIntersectionBox(Ia))Ia.makeEmpty();else if(E instanceof THREE.SpriteMaterial||E instanceof THREE.ParticleSystemMaterial){var A=E.map;if(null!==A){!1===A.hasEventListener("update",e)&&(void 0!==A.image&&0<A.image.width&&f(A),A.addEventListener("update",e));x=
|
|
|
+ta[A.id];void 0!==x?q(x):q("rgba( 0, 0, 0, 1 )");var S=A.image,x=S.width*A.offset.x,P=S.height*A.offset.y,Q=S.width*A.repeat.x,A=S.height*A.repeat.y,S=L/Q,ca=C/A;D.save();D.translate(y.x,y.y);0!==E.rotation&&D.rotate(E.rotation);D.translate(-L/2,-C/2);D.scale(S,ca);D.translate(-x,-P);D.fillRect(x,P,Q,A)}else q(E.color.getStyle()),D.save(),D.translate(y.x,y.y),0!==E.rotation&&D.rotate(E.rotation),D.scale(L,-C),D.fillRect(-0.5,-0.5,1,1);D.restore()}else E instanceof THREE.SpriteCanvasMaterial&&(m(E.color.getStyle()),
|
|
|
+q(E.color.getStyle()),D.save(),D.translate(y.x,y.y),0!==E.rotation&&D.rotate(E.rotation),D.scale(L,C),E.program(D),D.restore())}else if(C instanceof THREE.RenderableLine){if(V=C.v1,O=C.v2,V.positionScreen.x*=N,V.positionScreen.y*=F,O.positionScreen.x*=N,O.positionScreen.y*=F,Ia.setFromPoints([V.positionScreen,O.positionScreen]),!0===Sa.isIntersectionBox(Ia))if(y=V,E=O,L=C,C=x,l(C.opacity),n(C.blending),D.beginPath(),D.moveTo(y.positionScreen.x,y.positionScreen.y),D.lineTo(E.positionScreen.x,E.positionScreen.y),
|
|
|
+C instanceof THREE.LineBasicMaterial){p(C.linewidth);t(C.linecap);r(C.linejoin);if(C.vertexColors!==THREE.VertexColors)m(C.color.getStyle());else if(x=L.vertexColors[0].getStyle(),L=L.vertexColors[1].getStyle(),x===L)m(x);else{try{var ja=D.createLinearGradient(y.positionScreen.x,y.positionScreen.y,E.positionScreen.x,E.positionScreen.y);ja.addColorStop(0,x);ja.addColorStop(1,L)}catch(qa){ja=x}m(ja)}D.stroke();Ia.expandByScalar(2*C.linewidth)}else C instanceof THREE.LineDashedMaterial&&(p(C.linewidth),
|
|
|
+t(C.linecap),r(C.linejoin),m(C.color.getStyle()),u(C.dashSize,C.gapSize),D.stroke(),Ia.expandByScalar(2*C.linewidth),u(null,null))}else if(C instanceof THREE.RenderableFace3){V=C.v1;O=C.v2;va=C.v3;if(-1>V.positionScreen.z||1<V.positionScreen.z)continue;if(-1>O.positionScreen.z||1<O.positionScreen.z)continue;if(-1>va.positionScreen.z||1<va.positionScreen.z)continue;V.positionScreen.x*=N;V.positionScreen.y*=F;O.positionScreen.x*=N;O.positionScreen.y*=F;va.positionScreen.x*=N;va.positionScreen.y*=F;
|
|
|
+0<x.overdraw&&(k(V.positionScreen,O.positionScreen,x.overdraw),k(O.positionScreen,va.positionScreen,x.overdraw),k(va.positionScreen,V.positionScreen,x.overdraw));Ia.setFromPoints([V.positionScreen,O.positionScreen,va.positionScreen]);if(!0===Sa.isIntersectionBox(Ia)){y=V;E=O;L=va;v.info.render.vertices+=3;v.info.render.faces++;l(x.opacity);n(x.blending);fa=y.positionScreen.x;Ba=y.positionScreen.y;xa=E.positionScreen.x;Da=E.positionScreen.y;ea=L.positionScreen.x;aa=L.positionScreen.y;var P=fa,Q=Ba,
|
|
|
+A=xa,S=Da,ca=ea,oa=aa;D.beginPath();D.moveTo(P,Q);D.lineTo(A,S);D.lineTo(ca,oa);D.closePath();(x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial)&&null===x.map?(ka.copy(x.color),Ha.copy(x.emissive),x.vertexColors===THREE.FaceColors&&ka.multiply(C.color),!1===x.wireframe&&x.shading===THREE.SmoothShading&&3===C.vertexNormalsLength?(ga.copy(la),U.copy(la),da.copy(la),b(C.v1.positionWorld,C.vertexNormalsModel[0],ga),b(C.v2.positionWorld,C.vertexNormalsModel[1],U),b(C.v3.positionWorld,
|
|
|
+C.vertexNormalsModel[2],da),ga.multiply(ka).add(Ha),U.multiply(ka).add(Ha),da.multiply(ka).add(Ha),sa.addColors(U,da).multiplyScalar(0.5),Qa=i(ga,U,da,sa),g(fa,Ba,xa,Da,ea,aa,0,0,1,0,0,1,Qa)):(W.copy(la),b(C.centroidModel,C.normalModel,W),W.multiply(ka).add(Ha),!0===x.wireframe?c(W,x.wireframeLinewidth,x.wireframeLinecap,x.wireframeLinejoin):d(W))):x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial?null!==x.map?x.map.mapping instanceof
|
|
|
+THREE.UVMapping&&(wa=C.uvs[0],h(fa,Ba,xa,Da,ea,aa,wa[0].x,wa[0].y,wa[1].x,wa[1].y,wa[2].x,wa[2].y,x.map)):null!==x.envMap?x.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(Ea.copy(C.vertexNormalsModelView[0]),hb=0.5*Ea.x+0.5,ib=0.5*Ea.y+0.5,Ea.copy(C.vertexNormalsModelView[1]),eb=0.5*Ea.x+0.5,jb=0.5*Ea.y+0.5,Ea.copy(C.vertexNormalsModelView[2]),wb=0.5*Ea.x+0.5,Ra=0.5*Ea.y+0.5,h(fa,Ba,xa,Da,ea,aa,hb,ib,eb,jb,wb,Ra,x.envMap)):(W.copy(x.color),x.vertexColors===THREE.FaceColors&&W.multiply(C.color),
|
|
|
+!0===x.wireframe?c(W,x.wireframeLinewidth,x.wireframeLinecap,x.wireframeLinejoin):d(W)):x instanceof THREE.MeshDepthMaterial?(Ca=I.near,Na=I.far,ga.r=ga.g=ga.b=1-s(y.positionScreen.z*y.positionScreen.w,Ca,Na),U.r=U.g=U.b=1-s(E.positionScreen.z*E.positionScreen.w,Ca,Na),da.r=da.g=da.b=1-s(L.positionScreen.z*L.positionScreen.w,Ca,Na),sa.addColors(U,da).multiplyScalar(0.5),Qa=i(ga,U,da,sa),g(fa,Ba,xa,Da,ea,aa,0,0,1,0,0,1,Qa)):x instanceof THREE.MeshNormalMaterial&&(y=void 0,x.shading===THREE.FlatShading?
|
|
|
+(y=C.normalModelView,W.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),!0===x.wireframe?c(W,x.wireframeLinewidth,x.wireframeLinecap,x.wireframeLinejoin):d(W)):x.shading===THREE.SmoothShading&&(y=C.vertexNormalsModelView[0],ga.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),y=C.vertexNormalsModelView[1],U.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),y=C.vertexNormalsModelView[2],da.setRGB(y.x,y.y,y.z).multiplyScalar(0.5).addScalar(0.5),sa.addColors(U,da).multiplyScalar(0.5),
|
|
|
+Qa=i(ga,U,da,sa),g(fa,Ba,xa,Da,ea,aa,0,0,1,0,0,1,Qa)))}}ua.union(Ia)}}D.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",
|
|
@@ -370,73 +370,73 @@ depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,T
|
|
|
function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.length,h=d(b,a),l=f(h),m=e(h),n=h.vertexColors?h.vertexColors:!1;a.__vertexArray=new Float32Array(3*g);m&&(a.__normalArray=new Float32Array(3*g));c.hasTangents&&(a.__tangentArray=new Float32Array(4*g));n&&(a.__colorArray=new Float32Array(3*g));l&&(0<c.faceVertexUvs.length&&(a.__uvArray=new Float32Array(2*g)),1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*g)));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&
|
|
|
(a.__skinIndexArray=new Float32Array(4*g),a.__skinWeightArray=new Float32Array(4*g));a.__faceArray=new Uint16Array(3*i);a.__lineArray=new Uint16Array(2*k);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<l;c++)a.__morphTargetsArrays.push(new Float32Array(3*g))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*g))}a.__webglFaceCount=3*i;a.__webglLineCount=2*k;if(h.attributes){void 0===a.__webglCustomAttributesList&&
|
|
|
(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
|
|
|
-a.material.materials[b.materialIndex]:a.material}function e(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 f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){Qa[a]||(j.enableVertexAttribArray(a),Qa[a]=!0)}function g(){for(var a in Qa)Qa[a]&&(j.disableVertexAttribArray(a),Qa[a]=
|
|
|
-!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)Ba=ta=null,za=ua=da=Y=Ha=va=U=-1,Na=!0,a[d].render(b,c,ib,wb),Ba=ta=null,za=ua=da=Y=Ha=va=U=-1,Na=!0}function n(a,b,c,d,e,f,h,g){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&B.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
|
-B.setDepthTest(j.depthTest);B.setDepthWrite(j.depthWrite);z(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}B.setMaterialFaces(j);k instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,j,k,i):B.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&B.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);B.setDepthTest(g.depthTest);B.setDepthWrite(g.depthWrite);z(g.polygonOffset,
|
|
|
-g.polygonOffsetFactor,g.polygonOffsetUnits)}B.renderImmediateObject(c,d,e,g,j)}}function t(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Fb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
|
|
|
+a.material.materials[b.materialIndex]:a.material}function e(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 f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){Ra[a]||(j.enableVertexAttribArray(a),Ra[a]=!0)}function g(){for(var a in Ra)Ra[a]&&(j.disableVertexAttribArray(a),Ra[a]=
|
|
|
+!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)Da=va=null,Ba=xa=ga=W=Ma=Ha=U=-1,Oa=!0,a[d].render(b,c,jb,wb),Da=va=null,Ba=xa=ga=W=Ma=Ha=U=-1,Oa=!0}function n(a,b,c,d,e,f,h,g){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&I.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
|
+I.setDepthTest(j.depthTest);I.setDepthWrite(j.depthWrite);z(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}I.setMaterialFaces(j);k instanceof THREE.BufferGeometry?I.renderBufferDirect(d,e,f,j,k,i):I.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&I.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);I.setDepthTest(g.depthTest);I.setDepthWrite(g.depthWrite);z(g.polygonOffset,
|
|
|
+g.polygonOffsetFactor,g.polygonOffsetUnits)}I.renderImmediateObject(c,d,e,g,j)}}function t(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Fb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
|
|
|
void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var l,m,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,t=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(l=i.faces.length;h<l;h++)m=i.faces[h],m=t?m.materialIndex:0,void 0===k[m]&&(k[m]={hash:m,counter:0}),n=k[m].hash+"_"+k[m].counter,void 0===i.geometryGroups[n]&&
|
|
|
-(i.geometryGroups[n]={faces3:[],materialIndex:m,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[m].counter+=1,n=k[m].hash+"_"+k[m].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:m,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=ca++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
|
|
|
+(i.geometryGroups[n]={faces3:[],materialIndex:m,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[m].counter+=1,n=k[m].hash+"_"+k[m].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:m,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=ea++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
|
|
|
f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();p=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];
|
|
|
-k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(p=i.numMorphNormals;k<p;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}B.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
|
|
|
-j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),B.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
|
|
|
-B.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],r(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
|
|
|
+k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(p=i.numMorphNormals;k<p;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}I.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
|
|
|
+j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),I.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
|
|
|
+I.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],r(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
|
|
|
THREE.ParticleSystem?(f=a.geometry,r(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function r(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
|
return!1}function q(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?s(b.__webglObjects,a):a instanceof THREE.Sprite?v(b.__webglSprites,a):a instanceof THREE.LensFlare?v(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&s(b.__webglObjectsImmediate,a);delete a.__webglActive}function s(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}
|
|
|
-function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function w(a,b,c,d,e){$=0;d.needsUpdate&&(d.program&&Kb(d),B.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets));var f=!1,h=d.program,g=h.uniforms,i=d.uniforms;h!==ta&&(j.useProgram(h),ta=h,f=!0);d.id!==za&&(za=d.id,f=!0);if(f||a!==Ba)j.uniformMatrix4fv(g.projectionMatrix,!1,a.projectionMatrix.elements),a!==Ba&&(Ba=a);if(d.skinning)if(Db&&
|
|
|
-e.useVertexTexture){if(null!==g.boneTexture){var k=G();j.uniform1i(g.boneTexture,k);B.setTexture(e.boneTexture,k)}null!==g.boneTextureWidth&&j.uniform1i(g.boneTextureWidth,e.boneTextureWidth);null!==g.boneTextureHeight&&j.uniform1i(g.boneTextureHeight,e.boneTextureHeight)}else null!==g.boneGlobalMatrices&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
-(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Na){for(var l,m=k=0,n=0,p,q,t,r=Aa,s=r.directional.colors,u=r.directional.positions,v=r.point.colors,w=r.point.positions,y=r.point.distances,C=r.spot.colors,z=r.spot.positions,x=r.spot.distances,D=r.spot.directions,L=r.spot.anglesCos,O=r.spot.exponents,I=r.hemi.skyColors,Q=r.hemi.groundColors,K=r.hemi.positions,ia=0,Y=0,U=0,ca=0,P=0,ec=0,X=0,W=0,S=l=0,c=t=S=0,f=b.length;c<
|
|
|
-f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,t=l.distance,l instanceof THREE.AmbientLight?l.visible&&(B.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(P+=1,l.visible&&(ea.setFromMatrixPosition(l.matrixWorld),ja.setFromMatrixPosition(l.target.matrixWorld),ea.sub(ja),ea.normalize(),0===ea.x&&0===ea.y&&0===ea.z||(l=3*ia,u[l]=ea.x,u[l+1]=ea.y,u[l+2]=ea.z,B.gammaInput?N(s,l,p,q*q):A(s,l,p,q),ia+=1))):l instanceof THREE.PointLight?(ec+=
|
|
|
-1,l.visible&&(S=3*Y,B.gammaInput?N(v,S,p,q*q):A(v,S,p,q),ja.setFromMatrixPosition(l.matrixWorld),w[S]=ja.x,w[S+1]=ja.y,w[S+2]=ja.z,y[Y]=t,Y+=1)):l instanceof THREE.SpotLight?(X+=1,l.visible&&(S=3*U,B.gammaInput?N(C,S,p,q*q):A(C,S,p,q),ja.setFromMatrixPosition(l.matrixWorld),z[S]=ja.x,z[S+1]=ja.y,z[S+2]=ja.z,x[U]=t,ea.copy(ja),ja.setFromMatrixPosition(l.target.matrixWorld),ea.sub(ja),ea.normalize(),D[S]=ea.x,D[S+1]=ea.y,D[S+2]=ea.z,L[U]=Math.cos(l.angle),O[U]=l.exponent,U+=1)):l instanceof THREE.HemisphereLight&&
|
|
|
-(W+=1,l.visible&&(ea.setFromMatrixPosition(l.matrixWorld),ea.normalize(),0===ea.x&&0===ea.y&&0===ea.z||(t=3*ca,K[t]=ea.x,K[t+1]=ea.y,K[t+2]=ea.z,p=l.color,l=l.groundColor,B.gammaInput?(q*=q,N(I,t,p,q),N(Q,t,l,q)):(A(I,t,p,q),A(Q,t,l,q)),ca+=1))));c=3*ia;for(f=Math.max(s.length,3*P);c<f;c++)s[c]=0;c=3*Y;for(f=Math.max(v.length,3*ec);c<f;c++)v[c]=0;c=3*U;for(f=Math.max(C.length,3*X);c<f;c++)C[c]=0;c=3*ca;for(f=Math.max(I.length,3*W);c<f;c++)I[c]=0;c=3*ca;for(f=Math.max(Q.length,3*W);c<f;c++)Q[c]=0;
|
|
|
-r.directional.length=ia;r.point.length=Y;r.spot.length=U;r.hemi.length=ca;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;Na=!1}c=Aa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=
|
|
|
-c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;B.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):
|
|
|
-i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var R;d.map?R=d.map:d.specularMap?R=d.specularMap:d.normalMap?R=d.normalMap:d.bumpMap&&(R=d.bumpMap);void 0!==R&&(c=R.offset,R=R.repeat,i.offsetRepeat.value.set(c.x,c.y,R.x,R.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
|
+function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function w(a,b,c,d,e){aa=0;d.needsUpdate&&(d.program&&Kb(d),I.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets));var f=!1,h=d.program,g=h.uniforms,i=d.uniforms;h!==va&&(j.useProgram(h),va=h,f=!0);d.id!==Ba&&(Ba=d.id,f=!0);if(f||a!==Da)j.uniformMatrix4fv(g.projectionMatrix,!1,a.projectionMatrix.elements),a!==Da&&(Da=a);if(d.skinning)if(Db&&
|
|
|
+e.useVertexTexture){if(null!==g.boneTexture){var k=G();j.uniform1i(g.boneTexture,k);I.setTexture(e.boneTexture,k)}null!==g.boneTextureWidth&&j.uniform1i(g.boneTextureWidth,e.boneTextureWidth);null!==g.boneTextureHeight&&j.uniform1i(g.boneTextureHeight,e.boneTextureHeight)}else null!==g.boneGlobalMatrices&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
+(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Oa){for(var l,m=k=0,n=0,p,q,t,r=Ea,s=r.directional.colors,u=r.directional.positions,v=r.point.colors,w=r.point.positions,y=r.point.distances,C=r.spot.colors,z=r.spot.positions,D=r.spot.distances,E=r.spot.directions,L=r.spot.anglesCos,N=r.spot.exponents,A=r.hemi.skyColors,S=r.hemi.groundColors,P=r.hemi.positions,O=0,W=0,U=0,ea=0,V=0,Y=0,Z=0,X=0,fa=l=0,c=t=fa=0,f=b.length;c<
|
|
|
+f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,t=l.distance,l instanceof THREE.AmbientLight?l.visible&&(I.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(V+=1,l.visible&&(ha.setFromMatrixPosition(l.matrixWorld),la.setFromMatrixPosition(l.target.matrixWorld),ha.sub(la),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(l=3*O,u[l]=ha.x,u[l+1]=ha.y,u[l+2]=ha.z,I.gammaInput?K(s,l,p,q*q):B(s,l,p,q),O+=1))):l instanceof THREE.PointLight?(Y+=1,l.visible&&
|
|
|
+(fa=3*W,I.gammaInput?K(v,fa,p,q*q):B(v,fa,p,q),la.setFromMatrixPosition(l.matrixWorld),w[fa]=la.x,w[fa+1]=la.y,w[fa+2]=la.z,y[W]=t,W+=1)):l instanceof THREE.SpotLight?(Z+=1,l.visible&&(fa=3*U,I.gammaInput?K(C,fa,p,q*q):B(C,fa,p,q),la.setFromMatrixPosition(l.matrixWorld),z[fa]=la.x,z[fa+1]=la.y,z[fa+2]=la.z,D[U]=t,ha.copy(la),la.setFromMatrixPosition(l.target.matrixWorld),ha.sub(la),ha.normalize(),E[fa]=ha.x,E[fa+1]=ha.y,E[fa+2]=ha.z,L[U]=Math.cos(l.angle),N[U]=l.exponent,U+=1)):l instanceof THREE.HemisphereLight&&
|
|
|
+(X+=1,l.visible&&(ha.setFromMatrixPosition(l.matrixWorld),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(t=3*ea,P[t]=ha.x,P[t+1]=ha.y,P[t+2]=ha.z,p=l.color,l=l.groundColor,I.gammaInput?(q*=q,K(A,t,p,q),K(S,t,l,q)):(B(A,t,p,q),B(S,t,l,q)),ea+=1))));c=3*O;for(f=Math.max(s.length,3*V);c<f;c++)s[c]=0;c=3*W;for(f=Math.max(v.length,3*Y);c<f;c++)v[c]=0;c=3*U;for(f=Math.max(C.length,3*Z);c<f;c++)C[c]=0;c=3*ea;for(f=Math.max(A.length,3*X);c<f;c++)A[c]=0;c=3*ea;for(f=Math.max(S.length,3*X);c<f;c++)S[c]=0;r.directional.length=
|
|
|
+O;r.point.length=W;r.spot.length=U;r.hemi.length=ea;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;Oa=!1}c=Ea;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;
|
|
|
+i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;I.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=
|
|
|
+d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Q;d.map?Q=d.map:d.specularMap?Q=d.specularMap:d.normalMap?Q=d.normalMap:d.bumpMap&&(Q=d.bumpMap);void 0!==Q&&(c=Q.offset,Q=Q.repeat,i.offsetRepeat.value.set(c.x,c.y,Q.x,Q.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
|
1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?
|
|
|
-(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=H.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
|
|
|
-(B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=R=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
|
|
|
-THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[R]=k.shadowMap,i.shadowMapSize.value[R]=k.shadowMapSize,i.shadowMatrix.value[R]=k.shadowMatrix,i.shadowDarkness.value[R]=k.shadowDarkness,i.shadowBias.value[R]=k.shadowBias,R++}b=d.uniformsList;i=0;for(R=b.length;i<R;i++)if(f=h.uniforms[b[i][1]])if(c=b[i][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,
|
|
|
+(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=H.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,I.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
|
|
|
+(I.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Q=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
|
|
|
+THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Q]=k.shadowMap,i.shadowMapSize.value[Q]=k.shadowMapSize,i.shadowMatrix.value[Q]=k.shadowMatrix,i.shadowDarkness.value[Q]=k.shadowDarkness,i.shadowBias.value[Q]=k.shadowBias,Q++}b=d.uniformsList;i=0;for(Q=b.length;i<Q;i++)if(f=h.uniforms[b[i][1]])if(c=b[i][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,k.x,
|
|
|
k.y,k.z);else if("v4"===m)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===m)j.uniform1iv(f,k);else if("iv"===m)j.uniform3iv(f,k);else if("fv1"===m)j.uniform1fv(f,k);else if("fv"===m)j.uniform3fv(f,k);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*k.length));m=0;for(n=k.length;m<n;m++)r=2*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y;j.uniform2fv(f,c._array)}else if("v3v"===m){void 0===c._array&&(c._array=new Float32Array(3*k.length));m=0;for(n=
|
|
|
k.length;m<n;m++)r=3*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z;j.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*k.length));m=0;for(n=k.length;m<n;m++)r=4*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z,c._array[r+3]=k[m].w;j.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=
|
|
|
-new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=G(),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.addEventListener("dispose",Gb),c.image.__webglTextureCube=j.createTexture(),B.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++)B.autoScaleCubemaps&&!f?(n=k,r=m,s=c.image[m],v=ac,s.width<=v&&s.height<=v||(w=Math.max(s.width,s.height),u=Math.floor(s.width*v/w),v=Math.floor(s.height*v/w),w=document.createElement("canvas"),w.width=u,w.height=v,w.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,v),s=w),n[r]=s):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=E(c.format);s=E(c.type);F(j.TEXTURE_CUBE_MAP,
|
|
|
+new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=G(),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.addEventListener("dispose",Gb),c.image.__webglTextureCube=j.createTexture(),I.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++)I.autoScaleCubemaps&&!f?(n=k,r=m,s=c.image[m],v=ac,s.width<=v&&s.height<=v||(w=Math.max(s.width,s.height),u=Math.floor(s.width*v/w),v=Math.floor(s.height*v/w),w=document.createElement("canvas"),w.width=u,w.height=v,w.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,v),s=w),n[r]=s):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=x(c.format);s=x(c.type);F(j.TEXTURE_CUBE_MAP,
|
|
|
c,n);for(m=0;6>m;m++)if(f){v=k[m].mipmaps;w=0;for(y=v.length;w<y;w++)u=v[w],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,u.width,u.height,0,r,s,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,s,k[m]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
-c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):B.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=G();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&B.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+m);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
-THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)ja.setFromMatrixPosition(a.matrixWorld),j.uniform3f(g.cameraPosition,ja.x,ja.y,ja.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrix.elements);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrix.elements);
|
|
|
-null!==g.modelMatrix&&j.uniformMatrix4fv(g.modelMatrix,!1,e.matrixWorld.elements);return h}function G(){var a=$;a>=Pb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Pb);$+=1;return a}function N(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 A(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function y(a){a!==Pa&&(j.lineWidth(a),Pa=a)}function z(a,b,c){ra!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ra=a);
|
|
|
-if(a&&(Ea!==b||La!==c))j.polygonOffset(b,c),Ea=b,La=c}function C(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 O(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(C(b)),null):c}function F(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,E(b.wrapS)),j.texParameteri(a,
|
|
|
-j.TEXTURE_WRAP_T,E(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,E(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,E(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,D(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,D(b.minFilter)));if(ma&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ma.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Qb)),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 D(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function E(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===
|
|
|
+c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):I.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=G();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&I.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+m);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
+THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)la.setFromMatrixPosition(a.matrixWorld),j.uniform3f(g.cameraPosition,la.x,la.y,la.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrix.elements);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrix.elements);
|
|
|
+null!==g.modelMatrix&&j.uniformMatrix4fv(g.modelMatrix,!1,e.matrixWorld.elements);return h}function G(){var a=aa;a>=Pb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Pb);aa+=1;return a}function K(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 B(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function y(a){a!==Qa&&(j.lineWidth(a),Qa=a)}function z(a,b,c){ta!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ta=a);
|
|
|
+if(a&&(Ca!==b||Na!==c))j.polygonOffset(b,c),Ca=b,Na=c}function C(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 N(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(C(b)),null):c}function F(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,x(b.wrapS)),j.texParameteri(a,
|
|
|
+j.TEXTURE_WRAP_T,x(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,x(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,x(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,E(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,E(b.minFilter)));if(oa&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,oa.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Qb)),b.__oldAnisotropy=
|
|
|
+b.anisotropy}function D(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 E(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function x(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!==Ca){if(a===THREE.RGB_S3TC_DXT1_Format)return Ca.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ca.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ca.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ca.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-K=void 0!==a.precision?a.precision:"highp",I=void 0!==a.alpha?a.alpha:!1,S=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ga=void 0!==a.antialias?a.antialias:!1,oa=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Q=new THREE.Color(0),P=0;this.domElement=H;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
-this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=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 B=this,
|
|
|
-R=[],ia=0,ta=null,Ga=null,za=-1,ua=null,Ba=null,ca=0,$=0,Y=-1,da=-1,U=-1,ba=-1,qa=-1,ha=-1,va=-1,Ha=-1,ra=null,Ea=null,La=null,Pa=null,Ma=0,gb=0,hb=H.width,db=H.height,ib=0,wb=0,Qa={},Ra=new THREE.Frustum,sa=new THREE.Matrix4,Fa=new THREE.Matrix4,ja=new THREE.Vector3,ea=new THREE.Vector3,Na=!0,Aa={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,wa,bb,ma,Ca;try{var cb={alpha:I,premultipliedAlpha:S,antialias:ga,stencil:oa,preserveDrawingBuffer:L};j=H.getContext("webgl",cb)||H.getContext("experimental-webgl",cb);if(null===j)throw"Error creating WebGL context.";}catch(Sa){console.error(Sa)}wa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");bb=j.getExtension("OES_standard_derivatives");ma=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||
|
|
|
-j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ca=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");wa||console.log("THREE.WebGLRenderer: Float textures not supported.");bb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");ma||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Ca||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
|
|
|
-void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.viewport(Ma,gb,hb,db);j.clearColor(Q.r,Q.g,Q.b,P);this.context=j;var Pb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$b=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
-j.getParameter(j.MAX_TEXTURE_SIZE);var ac=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Qb=ma?j.getParameter(ma.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Ab=0<$b,Db=Ab&&wa;Ca&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var bc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cc=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),qc=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 rc=0<bc.precision&&0<dc.precision,Eb=0<cc.precision&&0<qc.precision;"highp"===K&&!rc&&
|
|
|
-(Eb?(K="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(K="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===K&&!Eb&&(K="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Ab};this.supportsFloatTextures=function(){return wa};this.supportsStandardDerivatives=function(){return bb};this.supportsCompressedTextureS3TC=function(){return Ca};
|
|
|
-this.getMaxAnisotropy=function(){return Qb};this.getPrecision=function(){return K};this.setSize=function(a,b,c){H.width=a*this.devicePixelRatio;H.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(H.style.width=a+"px",H.style.height=b+"px");this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){Ma=void 0!==a?a:0;gb=void 0!==b?b:0;hb=void 0!==c?c:H.width;db=void 0!==d?d:H.height;j.viewport(Ma,gb,hb,db)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=
|
|
|
-function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){Q.set(a);P=void 0!==b?b:1;j.clearColor(Q.r,Q.g,Q.b,P)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return P};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;
|
|
|
-if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearColor=function(){j.clear(j.COLOR_BUFFER_BIT)};this.clearDepth=function(){j.clear(j.DEPTH_BUFFER_BIT)};this.clearStencil=function(){j.clear(j.STENCIL_BUFFER_BIT)};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){ta=null;za=ua=
|
|
|
-Ha=va=U=-1;Na=!0;da=Y=-1;this.shadowMapPlugin.update(a,b)};var Fb=function(a){a=a.target;a.removeEventListener("dispose",Fb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer);B.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==
|
|
|
-c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Jb(c)}else Jb(a)},Gb=function(a){a=a.target;a.removeEventListener("dispose",Gb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));B.info.memory.textures--},Hb=function(a){a=a.target;a.removeEventListener("dispose",Hb);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);B.info.memory.textures--},Ib=function(a){a=a.target;a.removeEventListener("dispose",Ib);Kb(a)},Jb=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);
|
|
|
+if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Fa){if(a===THREE.RGB_S3TC_DXT1_Format)return Fa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Fa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Fa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Fa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
+S=void 0!==a.precision?a.precision:"highp",A=void 0!==a.alpha?a.alpha:!1,ca=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ja=void 0!==a.antialias?a.antialias:!1,qa=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,P=new THREE.Color(0),Q=0;this.domElement=H;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=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 I=this,
|
|
|
+V=[],O=0,va=null,fa=null,Ba=-1,xa=null,Da=null,ea=0,aa=0,W=-1,ga=-1,U=-1,da=-1,sa=-1,ka=-1,Ha=-1,Ma=-1,ta=null,Ca=null,Na=null,Qa=null,wa=0,hb=0,ib=H.width,eb=H.height,jb=0,wb=0,Ra={},Sa=new THREE.Frustum,ua=new THREE.Matrix4,Ia=new THREE.Matrix4,la=new THREE.Vector3,ha=new THREE.Vector3,Oa=!0,Ea={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,ya,cb,oa,Fa;try{var db={alpha:A,premultipliedAlpha:ca,antialias:ja,stencil:qa,preserveDrawingBuffer:L};j=H.getContext("webgl",db)||H.getContext("experimental-webgl",db);if(null===j)throw"Error creating WebGL context.";}catch(Ta){console.error(Ta)}ya=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");cb=j.getExtension("OES_standard_derivatives");oa=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||
|
|
|
+j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Fa=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");ya||console.log("THREE.WebGLRenderer: Float textures not supported.");cb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");oa||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Fa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
|
|
|
+void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.viewport(wa,hb,ib,eb);j.clearColor(P.r,P.g,P.b,Q);this.context=j;var Pb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$b=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
+j.getParameter(j.MAX_TEXTURE_SIZE);var ac=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Qb=oa?j.getParameter(oa.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Ab=0<$b,Db=Ab&&ya;Fa&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var bc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cc=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),pc=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 qc=0<bc.precision&&0<dc.precision,Eb=0<cc.precision&&0<pc.precision;"highp"===S&&!qc&&
|
|
|
+(Eb?(S="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(S="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===S&&!Eb&&(S="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Ab};this.supportsFloatTextures=function(){return ya};this.supportsStandardDerivatives=function(){return cb};this.supportsCompressedTextureS3TC=function(){return Fa};
|
|
|
+this.getMaxAnisotropy=function(){return Qb};this.getPrecision=function(){return S};this.setSize=function(a,b,c){H.width=a*this.devicePixelRatio;H.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(H.style.width=a+"px",H.style.height=b+"px");this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){wa=void 0!==a?a:0;hb=void 0!==b?b:0;ib=void 0!==c?c:H.width;eb=void 0!==d?d:H.height;j.viewport(wa,hb,ib,eb)};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.setClearColor=function(a,b){P.set(a);Q=void 0!==b?b:1;j.clearColor(P.r,P.g,P.b,Q)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return P};this.getClearAlpha=function(){return Q};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.clearColor=function(){j.clear(j.COLOR_BUFFER_BIT)};this.clearDepth=function(){j.clear(j.DEPTH_BUFFER_BIT)};this.clearStencil=function(){j.clear(j.STENCIL_BUFFER_BIT)};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){va=null;Ba=xa=
|
|
|
+Ma=Ha=U=-1;Oa=!0;ga=W=-1;this.shadowMapPlugin.update(a,b)};var Fb=function(a){a=a.target;a.removeEventListener("dispose",Fb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer);I.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==
|
|
|
+c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Jb(c)}else Jb(a)},Gb=function(a){a=a.target;a.removeEventListener("dispose",Gb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));I.info.memory.textures--},Hb=function(a){a=a.target;a.removeEventListener("dispose",Hb);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);I.info.memory.textures--},Ib=function(a){a=a.target;a.removeEventListener("dispose",Ib);Kb(a)},Jb=function(a){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.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer);B.info.memory.geometries--},Kb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=R.length;a<c;a++)if(d=R[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=R.length;a<c;a++)d=R[a],d.program!==b&&e.push(d);R=e;j.deleteProgram(b);B.info.memory.programs--}}};
|
|
|
+j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer);I.info.memory.geometries--},Kb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=V.length;a<c;a++)if(d=V[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=V.length;a<c;a++)d=V[a],d.program!==b&&e.push(d);V=e;j.deleteProgram(b);I.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,h,g,i,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],h=n[p+3],i=n[p+4],l=n[p+5],g=n[p+6],k=n[p+7],m=n[p+8],d=(d+h+g)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);
|
|
|
j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,
|
|
|
-3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,k,l,m;i=w(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==ua&&(ua=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(f=a.index){e=e.offsets;1<e.length&&(c=!0);for(var n=0,p=e.length;n<p;n++){var q=e[n].index;if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,
|
|
|
-m,j.FLOAT,!1,0,4*q*m)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,e[n].count,j.UNSIGNED_SHORT,2*e[n].start);B.info.render.calls++;B.info.render.vertices+=e[n].count;B.info.render.faces+=e[n].count/3}}else{if(c)for(k in b)"index"!==k&&(l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,
|
|
|
-j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k]))));d=e.attributes.position;j.drawArrays(j.TRIANGLES,0,d.numItems/3);B.info.render.calls++;B.info.render.vertices+=d.numItems/3;B.info.render.faces+=d.numItems/3/3}else if(f instanceof
|
|
|
-THREE.ParticleSystem){if(c)for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));d=a.position;j.drawArrays(j.POINTS,0,d.numItems/3);B.info.render.calls++;B.info.render.points+=d.numItems/
|
|
|
+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){var i,k,l,m;i=w(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==xa&&(xa=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(f=a.index){e=e.offsets;1<e.length&&(c=!0);for(var n=0,p=e.length;n<p;n++){var q=e[n].index;if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,
|
|
|
+m,j.FLOAT,!1,0,4*q*m)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,e[n].count,j.UNSIGNED_SHORT,2*e[n].start);I.info.render.calls++;I.info.render.vertices+=e[n].count;I.info.render.faces+=e[n].count/3}}else{if(c)for(k in b)"index"!==k&&(l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,
|
|
|
+j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k]))));d=e.attributes.position;j.drawArrays(j.TRIANGLES,0,d.numItems/3);I.info.render.calls++;I.info.render.vertices+=d.numItems/3;I.info.render.faces+=d.numItems/3/3}else if(f instanceof
|
|
|
+THREE.ParticleSystem){if(c)for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));d=a.position;j.drawArrays(j.POINTS,0,d.numItems/3);I.info.render.calls++;I.info.render.points+=d.numItems/
|
|
|
3}else if(f instanceof THREE.Line){if(c)for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;y(d.linewidth);d=a.position;j.drawArrays(k,0,
|
|
|
-d.numItems/3);B.info.render.calls++;B.info.render.points+=d.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=w(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ua&&(ua=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+d.numItems/3);I.info.render.calls++;I.info.render.points+=d.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=w(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==xa&&(xa=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;l=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<l.length;)0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[m]]),h(c["morphTarget"+m]),
|
|
|
j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[m]]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[l[m]],m++}else{l=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)m=i[n],0<m&&l.push([m,n]);l.length>d.numSupportedMorphTargets?(l.sort(k),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?
|
|
|
l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)l[m]?(n=l[m][1],0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[n]):f.__webglMorphTargetInfluences[m]=
|
|
@@ -444,64 +444,64 @@ l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)l[m]
|
|
|
(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib3fv(a.color,d.defaultAttributeValues.color));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(f.geometry.faceVertexUvs[0]?(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv,d.defaultAttributeValues.uv));0<=a.uv2&&(f.geometry.faceVertexUvs[1]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv2,d.defaultAttributeValues.uv2));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,
|
|
|
4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(y(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,y(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount)}};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,h,g,k=a.__lights,m=a.fog;za=-1;Na=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);sa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ra.setFromMatrix(sa);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);B.info.render.calls=0;
|
|
|
-B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Ra.intersectsObject(h))){var q=h;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);
|
|
|
-var q=f,r=q.buffer,t=void 0,s=t=void 0,s=q.object.material;if(s instanceof THREE.MeshFaceMaterial)t=r.materialIndex,t=s.materials[t],t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);else if(t=s)t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ja.setFromMatrixPosition(h.matrixWorld),ja.applyProjection(sa),f.z=ja.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;
|
|
|
+e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),I.info.render.calls++,I.info.render.vertices+=e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,y(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),I.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),I.info.render.calls++,I.info.render.points+=e.__webglParticleCount)}};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,h,g,k=a.__lights,m=a.fog;Ba=-1;Oa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ua.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Sa.setFromMatrix(ua);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);I.info.render.calls=0;
|
|
|
+I.info.render.vertices=0;I.info.render.faces=0;I.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Sa.intersectsObject(h))){var q=h;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);
|
|
|
+var q=f,r=q.buffer,t=void 0,s=t=void 0,s=q.object.material;if(s instanceof THREE.MeshFaceMaterial)t=r.materialIndex,t=s.materials[t],t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);else if(t=s)t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(la.setFromMatrixPosition(h.matrixWorld),la.applyProjection(ua),f.z=la.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;
|
|
|
d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,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),z(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),
|
|
|
n(a.__webglObjects,!1,"",b,k,m,!0,d),p(a.__webglObjectsImmediate,"",b,k,m,!1,d)):(d=null,this.setBlending(THREE.NoBlending),n(a.__webglObjects,!0,"opaque",b,k,m,!1,d),p(a.__webglObjectsImmediate,"opaque",b,k,m,!1,d),n(a.__webglObjects,!1,"transparent",b,k,m,!0,d),p(a.__webglObjectsImmediate,"transparent",b,k,m,!0,d));l(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=w(a,b,c,d,e);ua=-1;B.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ra):e.render(function(a){B.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||
|
|
|
+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=w(a,b,c,d,e);xa=-1;I.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Sa):e.render(function(a){I.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||
|
|
|
(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&u(g,a),t(g,a));var i=g,l=i.geometry,n=void 0,p=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var s=
|
|
|
-j.DYNAMIC_DRAW,v=!l.dynamic,w=l.attributes,y=void 0,C=void 0;for(y in w)C=w[y],C.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,C.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,C.array,s)):(j.bindBuffer(j.ARRAY_BUFFER,C.buffer),j.bufferData(j.ARRAY_BUFFER,C.array,s)),C.needsUpdate=!1),v&&!C.dynamic&&(C.array=null)}else if(i instanceof THREE.Mesh){for(var z=0,A=l.geometryGroupsList.length;z<A;z++)if(n=l.geometryGroupsList[z],r=d(i,n),l.buffersNeedUpdate&&c(n,i),p=r.attributes&&m(r),l.verticesNeedUpdate||
|
|
|
-l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||p){var x=n,E=i,D=j.DYNAMIC_DRAW,F=!l.dynamic,G=r;if(x.__inittedArrays){var H=e(G),N=G.vertexColors?G.vertexColors:!1,L=f(G),O=H===THREE.SmoothShading,B=void 0,I=void 0,Q=void 0,K=void 0,ia=void 0,R=void 0,S=void 0,Y=void 0,U=void 0,ca=void 0,$=void 0,P=void 0,X=void 0,W=void 0,ta=void 0,Ga=void 0,za=void 0,da=void 0,ba=void 0,ua=void 0,ha=void 0,ea=void 0,ga=void 0,Ba=void 0,
|
|
|
-ma=void 0,oa=void 0,qa=void 0,ra=void 0,va=void 0,Da=void 0,Ea=void 0,Aa=void 0,Ca=void 0,Ha=void 0,Ta=void 0,Ma=void 0,wa=void 0,jb=void 0,Pa=void 0,Ra=void 0,eb=0,fb=0,Na=0,Qa=0,Sa=0,kb=0,Ua=0,ub=0,Za=0,pa=0,xa=0,M=0,Oa=void 0,lb=x.__vertexArray,bb=x.__uvArray,cb=x.__uv2Array,La=x.__normalArray,Va=x.__tangentArray,mb=x.__colorArray,Wa=x.__skinIndexArray,Xa=x.__skinWeightArray,gb=x.__morphTargetsArrays,hb=x.__morphNormalsArrays,db=x.__webglCustomAttributesList,J=void 0,ib=x.__faceArray,xb=x.__lineArray,
|
|
|
-Ia=E.geometry,wb=Ia.elementsNeedUpdate,Ab=Ia.uvsNeedUpdate,Db=Ia.normalsNeedUpdate,Gb=Ia.tangentsNeedUpdate,Pb=Ia.colorsNeedUpdate,Qb=Ia.morphTargetsNeedUpdate,fc=Ia.vertices,aa=x.faces3,nb=Ia.faces,Eb=Ia.faceVertexUvs[0],Fb=Ia.faceVertexUvs[1],gc=Ia.skinIndices,Rb=Ia.skinWeights,Sb=Ia.morphTargets,Hb=Ia.morphNormals;if(Ia.verticesNeedUpdate){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],P=fc[K.a],X=fc[K.b],W=fc[K.c],lb[fb]=P.x,lb[fb+1]=P.y,lb[fb+2]=P.z,lb[fb+3]=X.x,lb[fb+4]=X.y,lb[fb+5]=X.z,lb[fb+6]=W.x,
|
|
|
-lb[fb+7]=W.y,lb[fb+8]=W.z,fb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,lb,D)}if(Qb){Ta=0;for(Ma=Sb.length;Ta<Ma;Ta++){B=xa=0;for(I=aa.length;B<I;B++)Pa=aa[B],K=nb[Pa],P=Sb[Ta].vertices[K.a],X=Sb[Ta].vertices[K.b],W=Sb[Ta].vertices[K.c],wa=gb[Ta],wa[xa]=P.x,wa[xa+1]=P.y,wa[xa+2]=P.z,wa[xa+3]=X.x,wa[xa+4]=X.y,wa[xa+5]=X.z,wa[xa+6]=W.x,wa[xa+7]=W.y,wa[xa+8]=W.z,G.morphNormals&&(O?(Ra=Hb[Ta].vertexNormals[Pa],da=Ra.a,ba=Ra.b,ua=Ra.c):ua=ba=da=Hb[Ta].faceNormals[Pa],
|
|
|
-jb=hb[Ta],jb[xa]=da.x,jb[xa+1]=da.y,jb[xa+2]=da.z,jb[xa+3]=ba.x,jb[xa+4]=ba.y,jb[xa+5]=ba.z,jb[xa+6]=ua.x,jb[xa+7]=ua.y,jb[xa+8]=ua.z),xa+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Ta]);j.bufferData(j.ARRAY_BUFFER,gb[Ta],D);G.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Ta]),j.bufferData(j.ARRAY_BUFFER,hb[Ta],D))}}if(Rb.length){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],Ba=Rb[K.a],ma=Rb[K.b],oa=Rb[K.c],Xa[pa]=Ba.x,Xa[pa+1]=Ba.y,Xa[pa+2]=Ba.z,Xa[pa+3]=Ba.w,
|
|
|
-Xa[pa+4]=ma.x,Xa[pa+5]=ma.y,Xa[pa+6]=ma.z,Xa[pa+7]=ma.w,Xa[pa+8]=oa.x,Xa[pa+9]=oa.y,Xa[pa+10]=oa.z,Xa[pa+11]=oa.w,qa=gc[K.a],ra=gc[K.b],va=gc[K.c],Wa[pa]=qa.x,Wa[pa+1]=qa.y,Wa[pa+2]=qa.z,Wa[pa+3]=qa.w,Wa[pa+4]=ra.x,Wa[pa+5]=ra.y,Wa[pa+6]=ra.z,Wa[pa+7]=ra.w,Wa[pa+8]=va.x,Wa[pa+9]=va.y,Wa[pa+10]=va.z,Wa[pa+11]=va.w,pa+=12;0<pa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,D),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Xa,D))}if(Pb&&N){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],S=K.vertexColors,Y=K.color,3===S.length&&N===THREE.VertexColors?(ha=S[0],ea=S[1],ga=S[2]):ga=ea=ha=Y,mb[Za]=ha.r,mb[Za+1]=ha.g,mb[Za+2]=ha.b,mb[Za+3]=ea.r,mb[Za+4]=ea.g,mb[Za+5]=ea.b,mb[Za+6]=ga.r,mb[Za+7]=ga.g,mb[Za+8]=ga.b,Za+=9;0<Za&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,mb,D))}if(Gb&&Ia.hasTangents){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],U=K.vertexTangents,ta=U[0],Ga=U[1],za=U[2],Va[Ua]=ta.x,Va[Ua+
|
|
|
-1]=ta.y,Va[Ua+2]=ta.z,Va[Ua+3]=ta.w,Va[Ua+4]=Ga.x,Va[Ua+5]=Ga.y,Va[Ua+6]=Ga.z,Va[Ua+7]=Ga.w,Va[Ua+8]=za.x,Va[Ua+9]=za.y,Va[Ua+10]=za.z,Va[Ua+11]=za.w,Ua+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Va,D)}if(Db&&H){B=0;for(I=aa.length;B<I;B++)if(K=nb[aa[B]],ia=K.vertexNormals,R=K.normal,3===ia.length&&O)for(Da=0;3>Da;Da++)Aa=ia[Da],La[kb]=Aa.x,La[kb+1]=Aa.y,La[kb+2]=Aa.z,kb+=3;else for(Da=0;3>Da;Da++)La[kb]=R.x,La[kb+1]=R.y,La[kb+2]=R.z,kb+=3;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,La,D)}if(Ab&&Eb&&L){B=0;for(I=aa.length;B<I;B++)if(Q=aa[B],ca=Eb[Q],void 0!==ca)for(Da=0;3>Da;Da++)Ca=ca[Da],bb[Na]=Ca.x,bb[Na+1]=Ca.y,Na+=2;0<Na&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,bb,D))}if(Ab&&Fb&&L){B=0;for(I=aa.length;B<I;B++)if(Q=aa[B],$=Fb[Q],void 0!==$)for(Da=0;3>Da;Da++)Ha=$[Da],cb[Qa]=Ha.x,cb[Qa+1]=Ha.y,Qa+=2;0<Qa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,cb,D))}if(wb){B=
|
|
|
-0;for(I=aa.length;B<I;B++)ib[Sa]=eb,ib[Sa+1]=eb+1,ib[Sa+2]=eb+2,Sa+=3,xb[ub]=eb,xb[ub+1]=eb+1,xb[ub+2]=eb,xb[ub+3]=eb+2,xb[ub+4]=eb+1,xb[ub+5]=eb+2,ub+=6,eb+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ib,D);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,xb,D)}if(db){Da=0;for(Ea=db.length;Da<Ea;Da++)if(J=db[Da],J.__original.needsUpdate){M=0;if(1===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=
|
|
|
-0;for(I=aa.length;B<I;B++)K=nb[aa[B]],J.array[M]=J.value[K.a],J.array[M+1]=J.value[K.b],J.array[M+2]=J.value[K.c],M+=3}else{if("faces"===J.boundTo){B=0;for(I=aa.length;B<I;B++)Oa=J.value[aa[B]],J.array[M]=Oa,J.array[M+1]=Oa,J.array[M+2]=Oa,M+=3}}else if(2===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],P=J.value[K.a],X=J.value[K.b],W=J.value[K.c],J.array[M]=P.x,J.array[M+1]=P.y,J.array[M+2]=X.x,J.array[M+3]=X.y,J.array[M+4]=W.x,J.array[M+5]=W.y,M+=6}else{if("faces"===
|
|
|
-J.boundTo){B=0;for(I=aa.length;B<I;B++)W=X=P=Oa=J.value[aa[B]],J.array[M]=P.x,J.array[M+1]=P.y,J.array[M+2]=X.x,J.array[M+3]=X.y,J.array[M+4]=W.x,J.array[M+5]=W.y,M+=6}}else if(3===J.size){var na;na="c"===J.type?["r","g","b"]:["x","y","z"];if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],P=J.value[K.a],X=J.value[K.b],W=J.value[K.c],J.array[M]=P[na[0]],J.array[M+1]=P[na[1]],J.array[M+2]=P[na[2]],J.array[M+3]=X[na[0]],J.array[M+4]=X[na[1]],J.array[M+5]=X[na[2]],
|
|
|
-J.array[M+6]=W[na[0]],J.array[M+7]=W[na[1]],J.array[M+8]=W[na[2]],M+=9}else if("faces"===J.boundTo){B=0;for(I=aa.length;B<I;B++)W=X=P=Oa=J.value[aa[B]],J.array[M]=P[na[0]],J.array[M+1]=P[na[1]],J.array[M+2]=P[na[2]],J.array[M+3]=X[na[0]],J.array[M+4]=X[na[1]],J.array[M+5]=X[na[2]],J.array[M+6]=W[na[0]],J.array[M+7]=W[na[1]],J.array[M+8]=W[na[2]],M+=9}else if("faceVertices"===J.boundTo){B=0;for(I=aa.length;B<I;B++)Oa=J.value[aa[B]],P=Oa[0],X=Oa[1],W=Oa[2],J.array[M]=P[na[0]],J.array[M+1]=P[na[1]],
|
|
|
-J.array[M+2]=P[na[2]],J.array[M+3]=X[na[0]],J.array[M+4]=X[na[1]],J.array[M+5]=X[na[2]],J.array[M+6]=W[na[0]],J.array[M+7]=W[na[1]],J.array[M+8]=W[na[2]],M+=9}}else if(4===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){B=0;for(I=aa.length;B<I;B++)K=nb[aa[B]],P=J.value[K.a],X=J.value[K.b],W=J.value[K.c],J.array[M]=P.x,J.array[M+1]=P.y,J.array[M+2]=P.z,J.array[M+3]=P.w,J.array[M+4]=X.x,J.array[M+5]=X.y,J.array[M+6]=X.z,J.array[M+7]=X.w,J.array[M+8]=W.x,J.array[M+9]=W.y,J.array[M+10]=W.z,J.array[M+
|
|
|
-11]=W.w,M+=12}else if("faces"===J.boundTo){B=0;for(I=aa.length;B<I;B++)W=X=P=Oa=J.value[aa[B]],J.array[M]=P.x,J.array[M+1]=P.y,J.array[M+2]=P.z,J.array[M+3]=P.w,J.array[M+4]=X.x,J.array[M+5]=X.y,J.array[M+6]=X.z,J.array[M+7]=X.w,J.array[M+8]=W.x,J.array[M+9]=W.y,J.array[M+10]=W.z,J.array[M+11]=W.w,M+=12}else if("faceVertices"===J.boundTo){B=0;for(I=aa.length;B<I;B++)Oa=J.value[aa[B]],P=Oa[0],X=Oa[1],W=Oa[2],J.array[M]=P.x,J.array[M+1]=P.y,J.array[M+2]=P.z,J.array[M+3]=P.w,J.array[M+4]=X.x,J.array[M+
|
|
|
-5]=X.y,J.array[M+6]=X.z,J.array[M+7]=X.w,J.array[M+8]=W.x,J.array[M+9]=W.y,J.array[M+10]=W.z,J.array[M+11]=W.w,M+=12}j.bindBuffer(j.ARRAY_BUFFER,J.buffer);j.bufferData(j.ARRAY_BUFFER,J.array,D)}}F&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=
|
|
|
-!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof THREE.Line){r=d(i,l);p=r.attributes&&m(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||p){var Ya=l,Tb=j.DYNAMIC_DRAW,Lb=void 0,Mb=void 0,Nb=void 0,Ub=void 0,la=void 0,Vb=void 0,Ib=Ya.vertices,Jb=Ya.colors,Kb=Ya.lineDistances,$b=Ib.length,ac=Jb.length,bc=Kb.length,Wb=Ya.__vertexArray,Xb=Ya.__colorArray,
|
|
|
-lc=Ya.__lineDistanceArray,cc=Ya.colorsNeedUpdate,dc=Ya.lineDistancesNeedUpdate,hc=Ya.__webglCustomAttributesList,Yb=void 0,mc=void 0,ya=void 0,Bb=void 0,Ja=void 0,ka=void 0;if(Ya.verticesNeedUpdate){for(Lb=0;Lb<$b;Lb++)Ub=Ib[Lb],la=3*Lb,Wb[la]=Ub.x,Wb[la+1]=Ub.y,Wb[la+2]=Ub.z;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Wb,Tb)}if(cc){for(Mb=0;Mb<ac;Mb++)Vb=Jb[Mb],la=3*Mb,Xb[la]=Vb.r,Xb[la+1]=Vb.g,Xb[la+2]=Vb.b;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-Xb,Tb)}if(dc){for(Nb=0;Nb<bc;Nb++)lc[Nb]=Kb[Nb];j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,lc,Tb)}if(hc){Yb=0;for(mc=hc.length;Yb<mc;Yb++)if(ka=hc[Yb],ka.needsUpdate&&(void 0===ka.boundTo||"vertices"===ka.boundTo)){la=0;Bb=ka.value.length;if(1===ka.size)for(ya=0;ya<Bb;ya++)ka.array[ya]=ka.value[ya];else if(2===ka.size)for(ya=0;ya<Bb;ya++)Ja=ka.value[ya],ka.array[la]=Ja.x,ka.array[la+1]=Ja.y,la+=2;else if(3===ka.size)if("c"===ka.type)for(ya=0;ya<Bb;ya++)Ja=
|
|
|
-ka.value[ya],ka.array[la]=Ja.r,ka.array[la+1]=Ja.g,ka.array[la+2]=Ja.b,la+=3;else for(ya=0;ya<Bb;ya++)Ja=ka.value[ya],ka.array[la]=Ja.x,ka.array[la+1]=Ja.y,ka.array[la+2]=Ja.z,la+=3;else if(4===ka.size)for(ya=0;ya<Bb;ya++)Ja=ka.value[ya],ka.array[la]=Ja.x,ka.array[la+1]=Ja.y,ka.array[la+2]=Ja.z,ka.array[la+3]=Ja.w,la+=4;j.bindBuffer(j.ARRAY_BUFFER,ka.buffer);j.bufferData(j.ARRAY_BUFFER,ka.array,Tb)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof
|
|
|
-THREE.ParticleSystem){r=d(i,l);p=r.attributes&&m(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||p){var ob=l,ic=j.DYNAMIC_DRAW,Ob=i,Ka=void 0,pb=void 0,qb=void 0,V=void 0,rb=void 0,vb=void 0,Zb=ob.vertices,jc=Zb.length,kc=ob.colors,nc=kc.length,yb=ob.__vertexArray,zb=ob.__colorArray,sb=ob.__sortArray,oc=ob.verticesNeedUpdate,pc=ob.colorsNeedUpdate,tb=ob.__webglCustomAttributesList,$a=void 0,Cb=void 0,Z=void 0,ab=void 0,fa=void 0,T=void 0;if(Ob.sortParticles){Fa.copy(sa);Fa.multiply(Ob.matrixWorld);
|
|
|
-for(Ka=0;Ka<jc;Ka++)qb=Zb[Ka],ja.copy(qb),ja.applyProjection(Fa),sb[Ka]=[ja.z,Ka];sb.sort(k);for(Ka=0;Ka<jc;Ka++)qb=Zb[sb[Ka][1]],V=3*Ka,yb[V]=qb.x,yb[V+1]=qb.y,yb[V+2]=qb.z;for(pb=0;pb<nc;pb++)V=3*pb,vb=kc[sb[pb][1]],zb[V]=vb.r,zb[V+1]=vb.g,zb[V+2]=vb.b;if(tb){$a=0;for(Cb=tb.length;$a<Cb;$a++)if(T=tb[$a],void 0===T.boundTo||"vertices"===T.boundTo)if(V=0,ab=T.value.length,1===T.size)for(Z=0;Z<ab;Z++)rb=sb[Z][1],T.array[Z]=T.value[rb];else if(2===T.size)for(Z=0;Z<ab;Z++)rb=sb[Z][1],fa=T.value[rb],
|
|
|
-T.array[V]=fa.x,T.array[V+1]=fa.y,V+=2;else if(3===T.size)if("c"===T.type)for(Z=0;Z<ab;Z++)rb=sb[Z][1],fa=T.value[rb],T.array[V]=fa.r,T.array[V+1]=fa.g,T.array[V+2]=fa.b,V+=3;else for(Z=0;Z<ab;Z++)rb=sb[Z][1],fa=T.value[rb],T.array[V]=fa.x,T.array[V+1]=fa.y,T.array[V+2]=fa.z,V+=3;else if(4===T.size)for(Z=0;Z<ab;Z++)rb=sb[Z][1],fa=T.value[rb],T.array[V]=fa.x,T.array[V+1]=fa.y,T.array[V+2]=fa.z,T.array[V+3]=fa.w,V+=4}}else{if(oc)for(Ka=0;Ka<jc;Ka++)qb=Zb[Ka],V=3*Ka,yb[V]=qb.x,yb[V+1]=qb.y,yb[V+2]=qb.z;
|
|
|
-if(pc)for(pb=0;pb<nc;pb++)vb=kc[pb],V=3*pb,zb[V]=vb.r,zb[V+1]=vb.g,zb[V+2]=vb.b;if(tb){$a=0;for(Cb=tb.length;$a<Cb;$a++)if(T=tb[$a],T.needsUpdate&&(void 0===T.boundTo||"vertices"===T.boundTo))if(ab=T.value.length,V=0,1===T.size)for(Z=0;Z<ab;Z++)T.array[Z]=T.value[Z];else if(2===T.size)for(Z=0;Z<ab;Z++)fa=T.value[Z],T.array[V]=fa.x,T.array[V+1]=fa.y,V+=2;else if(3===T.size)if("c"===T.type)for(Z=0;Z<ab;Z++)fa=T.value[Z],T.array[V]=fa.r,T.array[V+1]=fa.g,T.array[V+2]=fa.b,V+=3;else for(Z=0;Z<ab;Z++)fa=
|
|
|
-T.value[Z],T.array[V]=fa.x,T.array[V+1]=fa.y,T.array[V+2]=fa.z,V+=3;else if(4===T.size)for(Z=0;Z<ab;Z++)fa=T.value[Z],T.array[V]=fa.x,T.array[V+1]=fa.y,T.array[V+2]=fa.z,T.array[V+3]=fa.w,V+=4}}if(oc||Ob.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ob.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,yb,ic);if(pc||Ob.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ob.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,zb,ic);if(tb){$a=0;for(Cb=tb.length;$a<Cb;$a++)if(T=tb[$a],T.needsUpdate||Ob.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-T.buffer),j.bufferData(j.ARRAY_BUFFER,T.array,ic)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&q(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Ib);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":
|
|
|
-a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleSystemMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0,t=p=0;for(f=b.length;t<f;t++)h=b[t],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&p++);f=q;h=r;g=p;r=p=0;for(q=b.length;r<
|
|
|
-q;r++)t=b[r],t.castShadow&&(t instanceof THREE.SpotLight&&p++,t instanceof THREE.DirectionalLight&&!t.shadowCascade&&p++);m=p;Db&&d&&d.useVertexTexture?l=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)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,
|
|
|
-b=a.attributes,t=a.defines,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:l,useVertexTexture:Db&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,
|
|
|
-maxSpotLights:h,maxHemiLights:g,maxShadows:m,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},d=a.index0AttributeName,s,u,v;e=[];n?e.push(n):(e.push(r),e.push(q));for(u in t)e.push(u),e.push(t[u]);for(s in c)e.push(s),e.push(c[s]);n=e.join();
|
|
|
-s=0;for(u=R.length;s<u;s++)if(e=R[s],e.code===n){e.usedTimes++;k=e.program;break a}s="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?s="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(s="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in t)e=t[v],!1!==e&&(e="#define "+v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+K+" float;","precision "+K+" int;",e,Ab?"#define VERTEX_TEXTURES":"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",
|
|
|
-"#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?
|
|
|
+j.DYNAMIC_DRAW,v=!l.dynamic,w=l.attributes,y=void 0,C=void 0;for(y in w)C=w[y],C.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,C.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,C.array,s)):(j.bindBuffer(j.ARRAY_BUFFER,C.buffer),j.bufferData(j.ARRAY_BUFFER,C.array,s)),C.needsUpdate=!1),v&&!C.dynamic&&(C.array=null)}else if(i instanceof THREE.Mesh){for(var z=0,B=l.geometryGroupsList.length;z<B;z++)if(n=l.geometryGroupsList[z],r=d(i,n),l.buffersNeedUpdate&&c(n,i),p=r.attributes&&m(r),l.verticesNeedUpdate||
|
|
|
+l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||p){var x=n,E=i,D=j.DYNAMIC_DRAW,F=!l.dynamic,G=r;if(x.__inittedArrays){var H=e(G),K=G.vertexColors?G.vertexColors:!1,L=f(G),N=H===THREE.SmoothShading,A=void 0,I=void 0,S=void 0,O=void 0,P=void 0,W=void 0,Q=void 0,U=void 0,fa=void 0,ea=void 0,aa=void 0,Y=void 0,Z=void 0,X=void 0,V=void 0,va=void 0,Ba=void 0,ga=void 0,da=void 0,xa=void 0,ca=void 0,ka=void 0,ha=void 0,ja=void 0,
|
|
|
+Da=void 0,oa=void 0,qa=void 0,sa=void 0,ta=void 0,Ga=void 0,Ha=void 0,Ca=void 0,Ea=void 0,Fa=void 0,Ua=void 0,Ma=void 0,wa=void 0,ya=void 0,Qa=void 0,Sa=void 0,fb=0,gb=0,Oa=0,Ra=0,Ta=0,kb=0,Va=0,ub=0,$a=0,ra=0,za=0,M=0,Pa=void 0,lb=x.__vertexArray,cb=x.__uvArray,db=x.__uv2Array,Na=x.__normalArray,Wa=x.__tangentArray,mb=x.__colorArray,Xa=x.__skinIndexArray,Ya=x.__skinWeightArray,hb=x.__morphTargetsArrays,ib=x.__morphNormalsArrays,eb=x.__webglCustomAttributesList,J=void 0,jb=x.__faceArray,xb=x.__lineArray,
|
|
|
+Ja=E.geometry,wb=Ja.elementsNeedUpdate,Ab=Ja.uvsNeedUpdate,Db=Ja.normalsNeedUpdate,Gb=Ja.tangentsNeedUpdate,Pb=Ja.colorsNeedUpdate,Qb=Ja.morphTargetsNeedUpdate,ec=Ja.vertices,ba=x.faces3,nb=Ja.faces,Eb=Ja.faceVertexUvs[0],Fb=Ja.faceVertexUvs[1],fc=Ja.skinIndices,Rb=Ja.skinWeights,Sb=Ja.morphTargets,Hb=Ja.morphNormals;if(Ja.verticesNeedUpdate){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],Y=ec[O.a],Z=ec[O.b],X=ec[O.c],lb[gb]=Y.x,lb[gb+1]=Y.y,lb[gb+2]=Y.z,lb[gb+3]=Z.x,lb[gb+4]=Z.y,lb[gb+5]=Z.z,lb[gb+6]=X.x,
|
|
|
+lb[gb+7]=X.y,lb[gb+8]=X.z,gb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,lb,D)}if(Qb){Ua=0;for(Ma=Sb.length;Ua<Ma;Ua++){A=za=0;for(I=ba.length;A<I;A++)Qa=ba[A],O=nb[Qa],Y=Sb[Ua].vertices[O.a],Z=Sb[Ua].vertices[O.b],X=Sb[Ua].vertices[O.c],wa=hb[Ua],wa[za]=Y.x,wa[za+1]=Y.y,wa[za+2]=Y.z,wa[za+3]=Z.x,wa[za+4]=Z.y,wa[za+5]=Z.z,wa[za+6]=X.x,wa[za+7]=X.y,wa[za+8]=X.z,G.morphNormals&&(N?(Sa=Hb[Ua].vertexNormals[Qa],ga=Sa.a,da=Sa.b,xa=Sa.c):xa=da=ga=Hb[Ua].faceNormals[Qa],
|
|
|
+ya=ib[Ua],ya[za]=ga.x,ya[za+1]=ga.y,ya[za+2]=ga.z,ya[za+3]=da.x,ya[za+4]=da.y,ya[za+5]=da.z,ya[za+6]=xa.x,ya[za+7]=xa.y,ya[za+8]=xa.z),za+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Ua]);j.bufferData(j.ARRAY_BUFFER,hb[Ua],D);G.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Ua]),j.bufferData(j.ARRAY_BUFFER,ib[Ua],D))}}if(Rb.length){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],ja=Rb[O.a],Da=Rb[O.b],oa=Rb[O.c],Ya[ra]=ja.x,Ya[ra+1]=ja.y,Ya[ra+2]=ja.z,Ya[ra+3]=ja.w,
|
|
|
+Ya[ra+4]=Da.x,Ya[ra+5]=Da.y,Ya[ra+6]=Da.z,Ya[ra+7]=Da.w,Ya[ra+8]=oa.x,Ya[ra+9]=oa.y,Ya[ra+10]=oa.z,Ya[ra+11]=oa.w,qa=fc[O.a],sa=fc[O.b],ta=fc[O.c],Xa[ra]=qa.x,Xa[ra+1]=qa.y,Xa[ra+2]=qa.z,Xa[ra+3]=qa.w,Xa[ra+4]=sa.x,Xa[ra+5]=sa.y,Xa[ra+6]=sa.z,Xa[ra+7]=sa.w,Xa[ra+8]=ta.x,Xa[ra+9]=ta.y,Xa[ra+10]=ta.z,Xa[ra+11]=ta.w,ra+=12;0<ra&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Xa,D),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
+Ya,D))}if(Pb&&K){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],Q=O.vertexColors,U=O.color,3===Q.length&&K===THREE.VertexColors?(ca=Q[0],ka=Q[1],ha=Q[2]):ha=ka=ca=U,mb[$a]=ca.r,mb[$a+1]=ca.g,mb[$a+2]=ca.b,mb[$a+3]=ka.r,mb[$a+4]=ka.g,mb[$a+5]=ka.b,mb[$a+6]=ha.r,mb[$a+7]=ha.g,mb[$a+8]=ha.b,$a+=9;0<$a&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,mb,D))}if(Gb&&Ja.hasTangents){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],fa=O.vertexTangents,V=fa[0],va=fa[1],Ba=fa[2],Wa[Va]=V.x,Wa[Va+
|
|
|
+1]=V.y,Wa[Va+2]=V.z,Wa[Va+3]=V.w,Wa[Va+4]=va.x,Wa[Va+5]=va.y,Wa[Va+6]=va.z,Wa[Va+7]=va.w,Wa[Va+8]=Ba.x,Wa[Va+9]=Ba.y,Wa[Va+10]=Ba.z,Wa[Va+11]=Ba.w,Va+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Wa,D)}if(Db&&H){A=0;for(I=ba.length;A<I;A++)if(O=nb[ba[A]],P=O.vertexNormals,W=O.normal,3===P.length&&N)for(Ga=0;3>Ga;Ga++)Ca=P[Ga],Na[kb]=Ca.x,Na[kb+1]=Ca.y,Na[kb+2]=Ca.z,kb+=3;else for(Ga=0;3>Ga;Ga++)Na[kb]=W.x,Na[kb+1]=W.y,Na[kb+2]=W.z,kb+=3;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Na,D)}if(Ab&&Eb&&L){A=0;for(I=ba.length;A<I;A++)if(S=ba[A],ea=Eb[S],void 0!==ea)for(Ga=0;3>Ga;Ga++)Ea=ea[Ga],cb[Oa]=Ea.x,cb[Oa+1]=Ea.y,Oa+=2;0<Oa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,cb,D))}if(Ab&&Fb&&L){A=0;for(I=ba.length;A<I;A++)if(S=ba[A],aa=Fb[S],void 0!==aa)for(Ga=0;3>Ga;Ga++)Fa=aa[Ga],db[Ra]=Fa.x,db[Ra+1]=Fa.y,Ra+=2;0<Ra&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,db,
|
|
|
+D))}if(wb){A=0;for(I=ba.length;A<I;A++)jb[Ta]=fb,jb[Ta+1]=fb+1,jb[Ta+2]=fb+2,Ta+=3,xb[ub]=fb,xb[ub+1]=fb+1,xb[ub+2]=fb,xb[ub+3]=fb+2,xb[ub+4]=fb+1,xb[ub+5]=fb+2,ub+=6,fb+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,jb,D);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,xb,D)}if(eb){Ga=0;for(Ha=eb.length;Ga<Ha;Ga++)if(J=eb[Ga],J.__original.needsUpdate){M=0;if(1===J.size)if(void 0===J.boundTo||"vertices"===
|
|
|
+J.boundTo){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],J.array[M]=J.value[O.a],J.array[M+1]=J.value[O.b],J.array[M+2]=J.value[O.c],M+=3}else{if("faces"===J.boundTo){A=0;for(I=ba.length;A<I;A++)Pa=J.value[ba[A]],J.array[M]=Pa,J.array[M+1]=Pa,J.array[M+2]=Pa,M+=3}}else if(2===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],Y=J.value[O.a],Z=J.value[O.b],X=J.value[O.c],J.array[M]=Y.x,J.array[M+1]=Y.y,J.array[M+2]=Z.x,J.array[M+3]=Z.y,J.array[M+4]=X.x,J.array[M+
|
|
|
+5]=X.y,M+=6}else{if("faces"===J.boundTo){A=0;for(I=ba.length;A<I;A++)X=Z=Y=Pa=J.value[ba[A]],J.array[M]=Y.x,J.array[M+1]=Y.y,J.array[M+2]=Z.x,J.array[M+3]=Z.y,J.array[M+4]=X.x,J.array[M+5]=X.y,M+=6}}else if(3===J.size){var pa;pa="c"===J.type?["r","g","b"]:["x","y","z"];if(void 0===J.boundTo||"vertices"===J.boundTo){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],Y=J.value[O.a],Z=J.value[O.b],X=J.value[O.c],J.array[M]=Y[pa[0]],J.array[M+1]=Y[pa[1]],J.array[M+2]=Y[pa[2]],J.array[M+3]=Z[pa[0]],J.array[M+4]=
|
|
|
+Z[pa[1]],J.array[M+5]=Z[pa[2]],J.array[M+6]=X[pa[0]],J.array[M+7]=X[pa[1]],J.array[M+8]=X[pa[2]],M+=9}else if("faces"===J.boundTo){A=0;for(I=ba.length;A<I;A++)X=Z=Y=Pa=J.value[ba[A]],J.array[M]=Y[pa[0]],J.array[M+1]=Y[pa[1]],J.array[M+2]=Y[pa[2]],J.array[M+3]=Z[pa[0]],J.array[M+4]=Z[pa[1]],J.array[M+5]=Z[pa[2]],J.array[M+6]=X[pa[0]],J.array[M+7]=X[pa[1]],J.array[M+8]=X[pa[2]],M+=9}else if("faceVertices"===J.boundTo){A=0;for(I=ba.length;A<I;A++)Pa=J.value[ba[A]],Y=Pa[0],Z=Pa[1],X=Pa[2],J.array[M]=
|
|
|
+Y[pa[0]],J.array[M+1]=Y[pa[1]],J.array[M+2]=Y[pa[2]],J.array[M+3]=Z[pa[0]],J.array[M+4]=Z[pa[1]],J.array[M+5]=Z[pa[2]],J.array[M+6]=X[pa[0]],J.array[M+7]=X[pa[1]],J.array[M+8]=X[pa[2]],M+=9}}else if(4===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo){A=0;for(I=ba.length;A<I;A++)O=nb[ba[A]],Y=J.value[O.a],Z=J.value[O.b],X=J.value[O.c],J.array[M]=Y.x,J.array[M+1]=Y.y,J.array[M+2]=Y.z,J.array[M+3]=Y.w,J.array[M+4]=Z.x,J.array[M+5]=Z.y,J.array[M+6]=Z.z,J.array[M+7]=Z.w,J.array[M+8]=X.x,J.array[M+
|
|
|
+9]=X.y,J.array[M+10]=X.z,J.array[M+11]=X.w,M+=12}else if("faces"===J.boundTo){A=0;for(I=ba.length;A<I;A++)X=Z=Y=Pa=J.value[ba[A]],J.array[M]=Y.x,J.array[M+1]=Y.y,J.array[M+2]=Y.z,J.array[M+3]=Y.w,J.array[M+4]=Z.x,J.array[M+5]=Z.y,J.array[M+6]=Z.z,J.array[M+7]=Z.w,J.array[M+8]=X.x,J.array[M+9]=X.y,J.array[M+10]=X.z,J.array[M+11]=X.w,M+=12}else if("faceVertices"===J.boundTo){A=0;for(I=ba.length;A<I;A++)Pa=J.value[ba[A]],Y=Pa[0],Z=Pa[1],X=Pa[2],J.array[M]=Y.x,J.array[M+1]=Y.y,J.array[M+2]=Y.z,J.array[M+
|
|
|
+3]=Y.w,J.array[M+4]=Z.x,J.array[M+5]=Z.y,J.array[M+6]=Z.z,J.array[M+7]=Z.w,J.array[M+8]=X.x,J.array[M+9]=X.y,J.array[M+10]=X.z,J.array[M+11]=X.w,M+=12}j.bindBuffer(j.ARRAY_BUFFER,J.buffer);j.bufferData(j.ARRAY_BUFFER,J.array,D)}}F&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=
|
|
|
+!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof THREE.Line){r=d(i,l);p=r.attributes&&m(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||p){var Za=l,Tb=j.DYNAMIC_DRAW,Lb=void 0,Mb=void 0,Nb=void 0,Ub=void 0,na=void 0,Vb=void 0,Ib=Za.vertices,Jb=Za.colors,Kb=Za.lineDistances,$b=Ib.length,ac=Jb.length,bc=Kb.length,Wb=Za.__vertexArray,
|
|
|
+Xb=Za.__colorArray,kc=Za.__lineDistanceArray,cc=Za.colorsNeedUpdate,dc=Za.lineDistancesNeedUpdate,gc=Za.__webglCustomAttributesList,Yb=void 0,lc=void 0,Aa=void 0,Bb=void 0,Ka=void 0,ma=void 0;if(Za.verticesNeedUpdate){for(Lb=0;Lb<$b;Lb++)Ub=Ib[Lb],na=3*Lb,Wb[na]=Ub.x,Wb[na+1]=Ub.y,Wb[na+2]=Ub.z;j.bindBuffer(j.ARRAY_BUFFER,Za.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Wb,Tb)}if(cc){for(Mb=0;Mb<ac;Mb++)Vb=Jb[Mb],na=3*Mb,Xb[na]=Vb.r,Xb[na+1]=Vb.g,Xb[na+2]=Vb.b;j.bindBuffer(j.ARRAY_BUFFER,Za.__webglColorBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,Xb,Tb)}if(dc){for(Nb=0;Nb<bc;Nb++)kc[Nb]=Kb[Nb];j.bindBuffer(j.ARRAY_BUFFER,Za.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,kc,Tb)}if(gc){Yb=0;for(lc=gc.length;Yb<lc;Yb++)if(ma=gc[Yb],ma.needsUpdate&&(void 0===ma.boundTo||"vertices"===ma.boundTo)){na=0;Bb=ma.value.length;if(1===ma.size)for(Aa=0;Aa<Bb;Aa++)ma.array[Aa]=ma.value[Aa];else if(2===ma.size)for(Aa=0;Aa<Bb;Aa++)Ka=ma.value[Aa],ma.array[na]=Ka.x,ma.array[na+1]=Ka.y,na+=2;else if(3===ma.size)if("c"===ma.type)for(Aa=
|
|
|
+0;Aa<Bb;Aa++)Ka=ma.value[Aa],ma.array[na]=Ka.r,ma.array[na+1]=Ka.g,ma.array[na+2]=Ka.b,na+=3;else for(Aa=0;Aa<Bb;Aa++)Ka=ma.value[Aa],ma.array[na]=Ka.x,ma.array[na+1]=Ka.y,ma.array[na+2]=Ka.z,na+=3;else if(4===ma.size)for(Aa=0;Aa<Bb;Aa++)Ka=ma.value[Aa],ma.array[na]=Ka.x,ma.array[na+1]=Ka.y,ma.array[na+2]=Ka.z,ma.array[na+3]=Ka.w,na+=4;j.bindBuffer(j.ARRAY_BUFFER,ma.buffer);j.bufferData(j.ARRAY_BUFFER,ma.array,Tb)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&
|
|
|
+q(r)}else if(i instanceof THREE.ParticleSystem){r=d(i,l);p=r.attributes&&m(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||p){var ob=l,hc=j.DYNAMIC_DRAW,Ob=i,La=void 0,pb=void 0,qb=void 0,T=void 0,rb=void 0,vb=void 0,Zb=ob.vertices,ic=Zb.length,jc=ob.colors,mc=jc.length,yb=ob.__vertexArray,zb=ob.__colorArray,sb=ob.__sortArray,nc=ob.verticesNeedUpdate,oc=ob.colorsNeedUpdate,tb=ob.__webglCustomAttributesList,ab=void 0,Cb=void 0,$=void 0,bb=void 0,ia=void 0,R=void 0;if(Ob.sortParticles){Ia.copy(ua);
|
|
|
+Ia.multiply(Ob.matrixWorld);for(La=0;La<ic;La++)qb=Zb[La],la.copy(qb),la.applyProjection(Ia),sb[La]=[la.z,La];sb.sort(k);for(La=0;La<ic;La++)qb=Zb[sb[La][1]],T=3*La,yb[T]=qb.x,yb[T+1]=qb.y,yb[T+2]=qb.z;for(pb=0;pb<mc;pb++)T=3*pb,vb=jc[sb[pb][1]],zb[T]=vb.r,zb[T+1]=vb.g,zb[T+2]=vb.b;if(tb){ab=0;for(Cb=tb.length;ab<Cb;ab++)if(R=tb[ab],void 0===R.boundTo||"vertices"===R.boundTo)if(T=0,bb=R.value.length,1===R.size)for($=0;$<bb;$++)rb=sb[$][1],R.array[$]=R.value[rb];else if(2===R.size)for($=0;$<bb;$++)rb=
|
|
|
+sb[$][1],ia=R.value[rb],R.array[T]=ia.x,R.array[T+1]=ia.y,T+=2;else if(3===R.size)if("c"===R.type)for($=0;$<bb;$++)rb=sb[$][1],ia=R.value[rb],R.array[T]=ia.r,R.array[T+1]=ia.g,R.array[T+2]=ia.b,T+=3;else for($=0;$<bb;$++)rb=sb[$][1],ia=R.value[rb],R.array[T]=ia.x,R.array[T+1]=ia.y,R.array[T+2]=ia.z,T+=3;else if(4===R.size)for($=0;$<bb;$++)rb=sb[$][1],ia=R.value[rb],R.array[T]=ia.x,R.array[T+1]=ia.y,R.array[T+2]=ia.z,R.array[T+3]=ia.w,T+=4}}else{if(nc)for(La=0;La<ic;La++)qb=Zb[La],T=3*La,yb[T]=qb.x,
|
|
|
+yb[T+1]=qb.y,yb[T+2]=qb.z;if(oc)for(pb=0;pb<mc;pb++)vb=jc[pb],T=3*pb,zb[T]=vb.r,zb[T+1]=vb.g,zb[T+2]=vb.b;if(tb){ab=0;for(Cb=tb.length;ab<Cb;ab++)if(R=tb[ab],R.needsUpdate&&(void 0===R.boundTo||"vertices"===R.boundTo))if(bb=R.value.length,T=0,1===R.size)for($=0;$<bb;$++)R.array[$]=R.value[$];else if(2===R.size)for($=0;$<bb;$++)ia=R.value[$],R.array[T]=ia.x,R.array[T+1]=ia.y,T+=2;else if(3===R.size)if("c"===R.type)for($=0;$<bb;$++)ia=R.value[$],R.array[T]=ia.r,R.array[T+1]=ia.g,R.array[T+2]=ia.b,T+=
|
|
|
+3;else for($=0;$<bb;$++)ia=R.value[$],R.array[T]=ia.x,R.array[T+1]=ia.y,R.array[T+2]=ia.z,T+=3;else if(4===R.size)for($=0;$<bb;$++)ia=R.value[$],R.array[T]=ia.x,R.array[T+1]=ia.y,R.array[T+2]=ia.z,R.array[T+3]=ia.w,T+=4}}if(nc||Ob.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ob.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,yb,hc);if(oc||Ob.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ob.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,zb,hc);if(tb){ab=0;for(Cb=tb.length;ab<Cb;ab++)if(R=tb[ab],R.needsUpdate||
|
|
|
+Ob.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,R.buffer),j.bufferData(j.ARRAY_BUFFER,R.array,hc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&q(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Ib);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof
|
|
|
+THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleSystemMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0,t=p=0;for(f=b.length;t<f;t++)h=b[t],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&
|
|
|
+p++);f=q;h=r;g=p;r=p=0;for(q=b.length;r<q;r++)t=b[r],t.castShadow&&(t instanceof THREE.SpotLight&&p++,t instanceof THREE.DirectionalLight&&!t.shadowCascade&&p++);m=p;Db&&d&&d.useVertexTexture?l=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)")),l=b);a:{var r=
|
|
|
+a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,t=a.defines,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:l,useVertexTexture:Db&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,
|
|
|
+maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:m,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},d=a.index0AttributeName,s,u,v;e=[];n?e.push(n):(e.push(r),e.push(q));for(u in t)e.push(u),e.push(t[u]);for(s in c)e.push(s),
|
|
|
+e.push(c[s]);n=e.join();s=0;for(u=V.length;s<u;s++)if(e=V[s],e.code===n){e.usedTimes++;k=e.program;break a}s="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?s="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(s="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in t)e=t[v],!1!==e&&(e="#define "+v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+S+" float;","precision "+S+" int;",e,Ab?"#define VERTEX_TEXTURES":"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?"#define GAMMA_OUTPUT":
|
|
|
+"","#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.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 "+s:"",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");
|
|
|
-s=["precision "+K+" float;","precision "+K+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#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:"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&
|
|
|
+s=["precision "+S+" float;","precision "+S+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#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:"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?"#define GAMMA_OUTPUT":"",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 "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=O("vertex",u+q);s=O("fragment",s+r);j.attachShader(v,u);j.attachShader(v,s);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+j.getError()+
|
|
|
+"",c.shadowMapEnabled?"#define "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=N("vertex",u+q);s=N("fragment",s+r);j.attachShader(v,u);j.attachShader(v,s);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+j.getError()+
|
|
|
"]"),console.error("Program Info Log: "+j.getProgramInfoLog(v)));j.deleteShader(s);j.deleteShader(u);v.uniforms={};v.attributes={};var w;s="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(s.push("boneTexture"),s.push("boneTextureWidth"),s.push("boneTextureHeight")):s.push("boneGlobalMatrices");for(w in p)s.push(w);w=s;s=0;for(u=w.length;s<u;s++)p=w[s],v.uniforms[p]=j.getUniformLocation(v,p);s="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
|
|
|
-for(w=0;w<c.maxMorphTargets;w++)s.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)s.push("morphNormal"+w);for(k in b)s.push(k);k=s;w=0;for(b=k.length;w<b;w++)s=k[w],v.attributes[s]=j.getAttribLocation(v,s);v.id=ia++;R.push({program:v,code:n,usedTimes:1});B.info.memory.programs=R.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)v=b+k,0<=w[v]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
|
+for(w=0;w<c.maxMorphTargets;w++)s.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)s.push("morphNormal"+w);for(k in b)s.push(k);k=s;w=0;for(b=k.length;w<b;w++)s=k[w],v.attributes[s]=j.getAttribLocation(v,s);v.id=O++;V.push({program:v,code:n,usedTimes:1});I.info.memory.programs=V.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)v=b+k,0<=w[v]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
|
0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)v=b+k,0<=w[v]&&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;Y!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Y=b);da!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),da=a)};this.setDepthTest=function(a){va!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),va=a)};this.setDepthWrite=function(a){Ha!==a&&(j.depthMask(a),Ha=a)};this.setBlending=function(a,b,c,d){a!==U&&(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)),U=a);if(a===THREE.CustomBlending){if(b!==ba&&(j.blendEquation(E(b)),ba=b),
|
|
|
-c!==qa||d!==ha)j.blendFunc(E(c),E(d)),qa=c,ha=d}else ha=qa=ba=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Gb),a.__webglTexture=j.createTexture(),B.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=E(a.format),f=E(a.type);F(j.TEXTURE_2D,a,d);var h=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<h.length&&d){for(var g=0,i=h.length;g<i;g++)c=h[g],j.texImage2D(j.TEXTURE_2D,g,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){g=0;for(i=h.length;g<i;g++)c=h[g],a.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_2D,g,e,c.width,
|
|
|
+a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;W!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),W=b);ga!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ga=a)};this.setDepthTest=function(a){Ha!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Ha=a)};this.setDepthWrite=function(a){Ma!==a&&(j.depthMask(a),Ma=a)};this.setBlending=function(a,b,c,d){a!==U&&(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)),U=a);if(a===THREE.CustomBlending){if(b!==da&&(j.blendEquation(x(b)),da=b),
|
|
|
+c!==sa||d!==ka)j.blendFunc(x(c),x(d)),sa=c,ka=d}else ka=sa=da=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Gb),a.__webglTexture=j.createTexture(),I.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=x(a.format),f=x(a.type);F(j.TEXTURE_2D,a,d);var h=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<h.length&&d){for(var g=0,i=h.length;g<i;g++)c=h[g],j.texImage2D(j.TEXTURE_2D,g,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){g=0;for(i=h.length;g<i;g++)c=h[g],a.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_2D,g,e,c.width,
|
|
|
c.height,0,c.data):j.texImage2D(j.TEXTURE_2D,g,e,c.width,c.height,0,e,f,c.data)}else if(0<h.length&&d){g=0;for(i=h.length;g<i;g++)c=h[g],j.texImage2D(j.TEXTURE_2D,g,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",Hb);a.__webglTexture=j.createTexture();B.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=E(a.format),e=E(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);F(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 h=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,h.__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,
|
|
|
+if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Hb);a.__webglTexture=j.createTexture();I.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=x(a.format),e=x(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);F(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 h=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,h.__webglTexture,0);D(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),F(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=hb,a=db,d=Ma,e=gb);b!==Ga&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Ga=b);ib=c;wb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);
|
|
|
+a.__webglRenderbuffer):D(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=ib,a=eb,d=wa,e=hb);b!==fa&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),fa=b);jb=c;wb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);
|
|
|
this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.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={constructor:THREE.WebGLRenderTarget,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;
|
|
@@ -518,7 +518,7 @@ e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.
|
|
|
b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;var h=new XMLHttpRequest;h.onload=function(){var a=THREE.ImageUtils.parseDDS(h.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var l=0;l<a.mipmapCount;l++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+l]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}else f.image.width=a.width,f.image.height=a.height,
|
|
|
f.mipmaps=a.mipmaps;f.format=a.format;f.needsUpdate=!0;c&&c(f)};h.onerror=d;h.open("GET",a,!0);h.responseType="arraybuffer";h.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&
|
|
|
4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[21],k=!1;switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:if(32==g[22]&&g[23]&16711680&&g[24]&65280&&g[25]&255&&g[26]&4278190080)k=!0,e=64,d.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&
|
|
|
-255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,l=0;l<i;l++){for(var n=0;n<d.mipmapCount;n++){if(k){var p;p=f;for(var t=h,r=4*p*t,m=new Uint8Array(a,g,r),r=new Uint8Array(r),q=0,u=0,s=0;s<t;s++)for(var v=0;v<p;v++){var w=m[u];u++;var G=m[u];u++;var N=m[u];u++;var A=m[u];u++;r[q]=N;q++;r[q]=G;q++;r[q]=w;q++;r[q]=A;q++}p=r;t=p.length}else t=
|
|
|
+255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,l=0;l<i;l++){for(var n=0;n<d.mipmapCount;n++){if(k){var p;p=f;for(var t=h,r=4*p*t,m=new Uint8Array(a,g,r),r=new Uint8Array(r),q=0,u=0,s=0;s<t;s++)for(var v=0;v<p;v++){var w=m[u];u++;var G=m[u];u++;var K=m[u];u++;var B=m[u];u++;r[q]=K;q++;r[q]=G;q++;r[q]=w;q++;r[q]=B;q++}p=r;t=p.length}else t=
|
|
|
Math.max(4,f)/4*Math.max(4,h)/4*e,p=new Uint8Array(a,g,t);d.mipmaps.push({data:p,width:f,height:h});g+=t;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),k=i.data,l=0;l<
|
|
|
d;l++)for(var n=0;n<e;n++){var p=0>n-1?0:n-1,t=n+1>e-1?e-1:n+1,r=0>l-1?0:l-1,m=l+1>d-1?d-1:l+1,q=[],u=[0,0,g[4*(n*d+l)]/255*b];q.push([-1,0,g[4*(n*d+r)]/255*b]);q.push([-1,-1,g[4*(p*d+r)]/255*b]);q.push([0,-1,g[4*(p*d+l)]/255*b]);q.push([1,-1,g[4*(p*d+m)]/255*b]);q.push([1,0,g[4*(n*d+m)]/255*b]);q.push([1,1,g[4*(t*d+m)]/255*b]);q.push([0,1,g[4*(t*d+l)]/255*b]);q.push([-1,1,g[4*(t*d+r)]/255*b]);p=[];r=q.length;for(t=0;t<r;t++){var m=q[t],s=q[(t+1)%r],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],s=[s[0]-u[0],
|
|
|
s[1]-u[1],s[2]-u[2]];p.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}q=[0,0,0];for(t=0;t<p.length;t++)q[0]+=p[t][0],q[1]+=p[t][1],q[2]+=p[t][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;u=4*(n*d+l);k[u]=255*((q[0]+1)/2)|0;k[u+1]=255*((q[1]+1)/2)|0;k[u+2]=255*q[2]|0;k[u+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+
|
|
@@ -527,7 +527,7 @@ s[1]-u[1],s[2]-u[2]];p.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]
|
|
|
c+d;l=b[a++]*c;t=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(t,r,i,l);if(h=f[f.length-1]){n=h.x;p=h.y;h=1;for(g=this.divisions;h<=g;h++){var s=h/g;THREE.Shape.Utils.b2(s,n,t,i);THREE.Shape.Utils.b2(s,p,r,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,t=b[a++]*c+d,r=b[a++]*-c,m=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,t,r,m,q),h=f[f.length-1]){n=h.x;p=h.y;h=1;for(g=this.divisions;h<=g;h++)s=h/g,THREE.Shape.Utils.b3(s,n,t,m,i),THREE.Shape.Utils.b3(s,p,r,q,l)}}}return{offset:u.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,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var p;a:{var t=p=void 0,r=void 0,m=void 0,q=void 0,u=void 0,s=void 0,v=void 0,w=
|
|
|
-void 0,t=a[h[i]].x,r=a[h[i]].y,m=a[h[k]].x,q=a[h[k]].y,u=a[h[l]].x,s=a[h[l]].y;if(1E-10>(m-t)*(s-r)-(q-r)*(u-t))p=!1;else{var G=void 0,N=void 0,A=void 0,y=void 0,z=void 0,C=void 0,O=void 0,F=void 0,x=void 0,D=void 0,x=F=O=w=v=void 0,G=u-m,N=s-q,A=t-u,y=r-s,z=m-t,C=q-r;for(p=0;p<e;p++)if(!(p===i||p===k||p===l))if(v=a[h[p]].x,w=a[h[p]].y,O=v-t,F=w-r,x=v-m,D=w-q,v-=u,w-=s,x=G*D-N*x,O=z*F-C*O,F=A*w-y*v,-1E-10<=x&&-1E-10<=F&&-1E-10<=O){p=!1;break a}p=!0}}if(p){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],
|
|
|
+void 0,t=a[h[i]].x,r=a[h[i]].y,m=a[h[k]].x,q=a[h[k]].y,u=a[h[l]].x,s=a[h[l]].y;if(1E-10>(m-t)*(s-r)-(q-r)*(u-t))p=!1;else{var G=void 0,K=void 0,B=void 0,y=void 0,z=void 0,C=void 0,N=void 0,F=void 0,D=void 0,E=void 0,D=F=N=w=v=void 0,G=u-m,K=s-q,B=t-u,y=r-s,z=m-t,C=q-r;for(p=0;p<e;p++)if(!(p===i||p===k||p===l))if(v=a[h[p]].x,w=a[h[p]].y,N=v-t,F=w-r,D=v-m,E=w-q,v-=u,w-=s,D=G*E-K*D,N=z*F-C*N,F=B*w-y*v,-1E-10<=D&&-1E-10<=F&&-1E-10<=N){p=!1;break a}p=!0}}if(p){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],
|
|
|
h[k],h[l]]);i=k;for(l=k+1;l<e;i++,l++)h[i]=h[l];e--;n=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;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 h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(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,21 +595,21 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
|
|
|
-e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),h.clone()]);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 h(a,b,c,d,e,f,h,m){var q,u=g.widthSegments,s=g.heightSegments,v=e/2,w=f/2,G=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",s=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",u=g.depthSegments;var N=u+1,A=s+1,y=e/u,z=f/s,C=new THREE.Vector3;C[q]=0<h?1:-1;for(e=0;e<A;e++)for(f=0;f<N;f++){var O=new THREE.Vector3;O[a]=(f*y-v)*c;O[b]=(e*z-w)*d;O[q]=h;g.vertices.push(O)}for(e=
|
|
|
-0;e<s;e++)for(f=0;f<u;f++)w=f+N*e,a=f+N*(e+1),b=f+1+N*(e+1),c=f+1+N*e,d=new THREE.Vector2(f/u,1-e/s),h=new THREE.Vector2(f/u,1-(e+1)/s),q=new THREE.Vector2((f+1)/u,1-(e+1)/s),v=new THREE.Vector2((f+1)/u,1-e/s),w=new THREE.Face3(w+G,a+G,c+G),w.normal.copy(C),w.vertexNormals.push(C.clone(),C.clone(),C.clone()),w.materialIndex=m,g.faces.push(w),g.faceVertexUvs[0].push([d,h,v]),w=new THREE.Face3(a+G,b+G,c+G),w.normal.copy(C),w.vertexNormals.push(C.clone(),C.clone(),C.clone()),w.materialIndex=m,g.faces.push(w),
|
|
|
+e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),h.clone()]);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 h(a,b,c,d,e,f,h,m){var q,u=g.widthSegments,s=g.heightSegments,v=e/2,w=f/2,G=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",s=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",u=g.depthSegments;var K=u+1,B=s+1,y=e/u,z=f/s,C=new THREE.Vector3;C[q]=0<h?1:-1;for(e=0;e<B;e++)for(f=0;f<K;f++){var N=new THREE.Vector3;N[a]=(f*y-v)*c;N[b]=(e*z-w)*d;N[q]=h;g.vertices.push(N)}for(e=
|
|
|
+0;e<s;e++)for(f=0;f<u;f++)w=f+K*e,a=f+K*(e+1),b=f+1+K*(e+1),c=f+1+K*e,d=new THREE.Vector2(f/u,1-e/s),h=new THREE.Vector2(f/u,1-(e+1)/s),q=new THREE.Vector2((f+1)/u,1-(e+1)/s),v=new THREE.Vector2((f+1)/u,1-e/s),w=new THREE.Face3(w+G,a+G,c+G),w.normal.copy(C),w.vertexNormals.push(C.clone(),C.clone(),C.clone()),w.materialIndex=m,g.faces.push(w),g.faceVertexUvs[0].push([d,h,v]),w=new THREE.Face3(a+G,b+G,c+G),w.normal.copy(C),w.vertexNormals.push(C.clone(),C.clone(),C.clone()),w.materialIndex=m,g.faces.push(w),
|
|
|
g.faceVertexUvs[0].push([h.clone(),q,v.clone()])}THREE.Geometry.call(this);var g=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;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("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);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],l=[];for(i=0;i<=e;i++){var n=[],p=[],t=i/e,r=t*(b-a)+a;for(g=0;g<=d;g++){var m=g/d,q=new THREE.Vector3;q.x=r*Math.sin(2*m*Math.PI);q.y=-t*c+h;q.z=r*Math.cos(2*m*Math.PI);this.vertices.push(q);n.push(this.vertices.length-1);p.push(new THREE.Vector2(m,
|
|
|
-1-t))}k.push(n);l.push(p)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(n=this.vertices[k[0][g]].clone(),p=this.vertices[k[0][g+1]].clone()):(n=this.vertices[k[1][g]].clone(),p=this.vertices[k[1][g+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();for(i=0;i<e;i++){var t=k[i][g],r=k[i+1][g],m=k[i+1][g+1],q=k[i][g+1],u=n.clone(),s=n.clone(),v=p.clone(),w=p.clone(),G=l[i][g].clone(),N=l[i+1][g].clone(),A=l[i+1][g+1].clone(),y=l[i][g+1].clone();this.faces.push(new THREE.Face3(t,
|
|
|
-r,q,[u,s,w]));this.faceVertexUvs[0].push([G,N,y]);this.faces.push(new THREE.Face3(r,m,q,[s.clone(),v,w.clone()]));this.faceVertexUvs[0].push([N.clone(),A,y.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)t=k[0][g],r=k[0][g+1],m=this.vertices.length-1,u=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),G=l[0][g].clone(),N=l[0][g+1].clone(),A=new THREE.Vector2(N.x,0),this.faces.push(new THREE.Face3(t,r,m,[u,s,v])),this.faceVertexUvs[0].push([G,
|
|
|
-N,A])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)t=k[i][g+1],r=k[i][g],m=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),G=l[i][g+1].clone(),N=l[i][g].clone(),A=new THREE.Vector2(N.x,1),this.faces.push(new THREE.Face3(t,r,m,[u,s,v])),this.faceVertexUvs[0].push([G,N,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+1-t))}k.push(n);l.push(p)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(n=this.vertices[k[0][g]].clone(),p=this.vertices[k[0][g+1]].clone()):(n=this.vertices[k[1][g]].clone(),p=this.vertices[k[1][g+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();for(i=0;i<e;i++){var t=k[i][g],r=k[i+1][g],m=k[i+1][g+1],q=k[i][g+1],u=n.clone(),s=n.clone(),v=p.clone(),w=p.clone(),G=l[i][g].clone(),K=l[i+1][g].clone(),B=l[i+1][g+1].clone(),y=l[i][g+1].clone();this.faces.push(new THREE.Face3(t,
|
|
|
+r,q,[u,s,w]));this.faceVertexUvs[0].push([G,K,y]);this.faces.push(new THREE.Face3(r,m,q,[s.clone(),v,w.clone()]));this.faceVertexUvs[0].push([K.clone(),B,y.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)t=k[0][g],r=k[0][g+1],m=this.vertices.length-1,u=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),G=l[0][g].clone(),K=l[0][g+1].clone(),B=new THREE.Vector2(K.x,0),this.faces.push(new THREE.Face3(t,r,m,[u,s,v])),this.faceVertexUvs[0].push([G,
|
|
|
+K,B])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)t=k[i][g+1],r=k[i][g],m=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),G=l[i][g+1].clone(),K=l[i][g].clone(),B=new THREE.Vector2(K.x,1),this.faces.push(new THREE.Face3(t,r,m,[u,s,v])),this.faceVertexUvs[0].push([G,K,B])}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(L=c.length;0<=--L;){e=L;f=L-1;0>f&&(f=c.length-1);for(var g=0,h=t+2*l,
|
|
|
-g=0;g<h;g++){var i=S*g,k=S*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,u=e,w=f,m=m+F,i=i+F,n=n+F,k=k+F;O.faces.push(new THREE.Face3(m,i,k,null,null,s));O.faces.push(new THREE.Face3(i,n,k,null,null,s));m=v.generateSideWallUV(O,a,p,b,m,i,n,k,q,r,u,w);O.faceVertexUvs[0].push([m[0],m[1],m[3]]);O.faceVertexUvs[0].push([m[1],m[2],m[3]])}}}function f(a,b,c){O.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=F;d+=F;e+=F;O.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?v.generateBottomUV(O,
|
|
|
-a,b,c,d,e):v.generateTopUV(O,a,b,c,d,e);O.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,r=b.extrudePath,m,q=!1,u=b.material,s=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,G,N,A;r&&(m=
|
|
|
-r.getSpacedPoints(t),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,t,!1),G=new THREE.Vector3,N=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var y,z,C,O=this,F=this.vertices.length,p=a.extractPoints(p),x=p.shape,p=p.holes;if(r=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();z=0;for(C=p.length;z<C;z++)y=p[z],THREE.Shape.Utils.isClockWise(y)&&(p[z]=y.reverse());r=!1}var D=THREE.Shape.Utils.triangulateShape(x,p),r=x;z=0;for(C=p.length;z<C;z++)y=p[z],x=x.concat(y);
|
|
|
-var E,H,K,I,S=x.length,ga=D.length,oa=[],L=0,Q=r.length;E=Q-1;for(H=L+1;L<Q;L++,E++,H++)E===Q&&(E=0),H===Q&&(H=0),oa[L]=d(r[L],r[E],r[H]);var P=[],B,R=oa.concat();z=0;for(C=p.length;z<C;z++){y=p[z];B=[];L=0;Q=y.length;E=Q-1;for(H=L+1;L<Q;L++,E++,H++)E===Q&&(E=0),H===Q&&(H=0),B[L]=d(y[L],y[E],y[H]);P.push(B);R=R.concat(B)}for(E=0;E<l;E++){y=E/l;K=i*(1-y);H=k*Math.sin(y*Math.PI/2);L=0;for(Q=r.length;L<Q;L++)I=c(r[L],oa[L],H),f(I.x,I.y,-K);z=0;for(C=p.length;z<C;z++){y=p[z];B=P[z];L=0;for(Q=y.length;L<
|
|
|
-Q;L++)I=c(y[L],B[L],H),f(I.x,I.y,-K)}}H=k;for(L=0;L<S;L++)I=n?c(x[L],R[L],H):x[L],q?(N.copy(w.normals[0]).multiplyScalar(I.x),G.copy(w.binormals[0]).multiplyScalar(I.y),A.copy(m[0]).add(N).add(G),f(A.x,A.y,A.z)):f(I.x,I.y,0);for(y=1;y<=t;y++)for(L=0;L<S;L++)I=n?c(x[L],R[L],H):x[L],q?(N.copy(w.normals[y]).multiplyScalar(I.x),G.copy(w.binormals[y]).multiplyScalar(I.y),A.copy(m[y]).add(N).add(G),f(A.x,A.y,A.z)):f(I.x,I.y,g/t*y);for(E=l-1;0<=E;E--){y=E/l;K=i*(1-y);H=k*Math.sin(y*Math.PI/2);L=0;for(Q=
|
|
|
-r.length;L<Q;L++)I=c(r[L],oa[L],H),f(I.x,I.y,g+K);z=0;for(C=p.length;z<C;z++){y=p[z];B=P[z];L=0;for(Q=y.length;L<Q;L++)I=c(y[L],B[L],H),q?f(I.x,I.y+m[t-1].y,m[t-1].x+K):f(I.x,I.y,g+K)}}if(n){i=0*S;for(L=0;L<ga;L++)g=D[L],h(g[2]+i,g[1]+i,g[0]+i,!0);i=S*(t+2*l);for(L=0;L<ga;L++)g=D[L],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(L=0;L<ga;L++)g=D[L],h(g[2],g[1],g[0],!0);for(L=0;L<ga;L++)g=D[L],h(g[0]+S*t,g[1]+S*t,g[2]+S*t,!1)}g=0;e(r,g);g+=r.length;z=0;for(C=p.length;z<C;z++)y=p[z],e(y,g),g+=y.length};
|
|
|
+g=0;g<h;g++){var i=ca*g,k=ca*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,u=e,w=f,m=m+F,i=i+F,n=n+F,k=k+F;N.faces.push(new THREE.Face3(m,i,k,null,null,s));N.faces.push(new THREE.Face3(i,n,k,null,null,s));m=v.generateSideWallUV(N,a,p,b,m,i,n,k,q,r,u,w);N.faceVertexUvs[0].push([m[0],m[1],m[3]]);N.faceVertexUvs[0].push([m[1],m[2],m[3]])}}}function f(a,b,c){N.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=F;d+=F;e+=F;N.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?v.generateBottomUV(N,
|
|
|
+a,b,c,d,e):v.generateTopUV(N,a,b,c,d,e);N.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,r=b.extrudePath,m,q=!1,u=b.material,s=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,G,K,B;r&&(m=
|
|
|
+r.getSpacedPoints(t),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,t,!1),G=new THREE.Vector3,K=new THREE.Vector3,B=new THREE.Vector3);n||(k=i=l=0);var y,z,C,N=this,F=this.vertices.length,p=a.extractPoints(p),D=p.shape,p=p.holes;if(r=!THREE.Shape.Utils.isClockWise(D)){D=D.reverse();z=0;for(C=p.length;z<C;z++)y=p[z],THREE.Shape.Utils.isClockWise(y)&&(p[z]=y.reverse());r=!1}var E=THREE.Shape.Utils.triangulateShape(D,p),r=D;z=0;for(C=p.length;z<C;z++)y=p[z],D=D.concat(y);
|
|
|
+var x,H,S,A,ca=D.length,ja=E.length,qa=[],L=0,P=r.length;x=P-1;for(H=L+1;L<P;L++,x++,H++)x===P&&(x=0),H===P&&(H=0),qa[L]=d(r[L],r[x],r[H]);var Q=[],I,V=qa.concat();z=0;for(C=p.length;z<C;z++){y=p[z];I=[];L=0;P=y.length;x=P-1;for(H=L+1;L<P;L++,x++,H++)x===P&&(x=0),H===P&&(H=0),I[L]=d(y[L],y[x],y[H]);Q.push(I);V=V.concat(I)}for(x=0;x<l;x++){y=x/l;S=i*(1-y);H=k*Math.sin(y*Math.PI/2);L=0;for(P=r.length;L<P;L++)A=c(r[L],qa[L],H),f(A.x,A.y,-S);z=0;for(C=p.length;z<C;z++){y=p[z];I=Q[z];L=0;for(P=y.length;L<
|
|
|
+P;L++)A=c(y[L],I[L],H),f(A.x,A.y,-S)}}H=k;for(L=0;L<ca;L++)A=n?c(D[L],V[L],H):D[L],q?(K.copy(w.normals[0]).multiplyScalar(A.x),G.copy(w.binormals[0]).multiplyScalar(A.y),B.copy(m[0]).add(K).add(G),f(B.x,B.y,B.z)):f(A.x,A.y,0);for(y=1;y<=t;y++)for(L=0;L<ca;L++)A=n?c(D[L],V[L],H):D[L],q?(K.copy(w.normals[y]).multiplyScalar(A.x),G.copy(w.binormals[y]).multiplyScalar(A.y),B.copy(m[y]).add(K).add(G),f(B.x,B.y,B.z)):f(A.x,A.y,g/t*y);for(x=l-1;0<=x;x--){y=x/l;S=i*(1-y);H=k*Math.sin(y*Math.PI/2);L=0;for(P=
|
|
|
+r.length;L<P;L++)A=c(r[L],qa[L],H),f(A.x,A.y,g+S);z=0;for(C=p.length;z<C;z++){y=p[z];I=Q[z];L=0;for(P=y.length;L<P;L++)A=c(y[L],I[L],H),q?f(A.x,A.y+m[t-1].y,m[t-1].x+S):f(A.x,A.y,g+S)}}if(n){i=0*ca;for(L=0;L<ja;L++)g=E[L],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ca*(t+2*l);for(L=0;L<ja;L++)g=E[L],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(L=0;L<ja;L++)g=E[L],h(g[2],g[1],g[0],!0);for(L=0;L<ja;L++)g=E[L],h(g[0]+ca*t,g[1]+ca*t,g[2]+ca*t,!1)}g=0;e(r,g);g+=r.length;z=0;for(C=p.length;z<C;z++)y=p[z],e(y,g),g+=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,h,g){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[h].x,
|
|
|
l=a.vertices[h].y,h=a.vertices[h].z,n=a.vertices[g].x,p=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-h),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-h),new THREE.Vector2(p,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};
|
|
@@ -674,29 +674,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));p={};t={};p.vertex=b.getAttribLocation(n,"position");p.uv=b.getAttribLocation(n,"uv");t.renderType=b.getUniformLocation(n,"renderType");t.map=b.getUniformLocation(n,"map");t.occlusionMap=b.getUniformLocation(n,"occlusionMap");t.opacity=
|
|
|
-b.getUniformLocation(n,"opacity");t.color=b.getUniformLocation(n,"color");t.scale=b.getUniformLocation(n,"scale");t.rotation=b.getUniformLocation(n,"rotation");t.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,s=a.length;if(s){var v=new THREE.Vector3,w=f/e,G=0.5*e,N=0.5*f,A=16/f,y=new THREE.Vector2(A*w,A),z=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),O=t,A=p;b.useProgram(n);b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);
|
|
|
-b.uniform1i(O.occlusionMap,0);b.uniform1i(O.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var F,x,D,E,H;for(F=0;F<s;F++)if(A=16/f,y.set(A*w,A),E=a[F],v.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),z.copy(v),C.x=z.x*G+G,
|
|
|
-C.y=z.y*N+N,l||0<C.x&&C.x<e&&0<C.y&&C.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(O.renderType,0);b.uniform2f(O.scale,y.x,y.y);b.uniform3f(O.screenPosition,z.x,z.y,z.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,C.x-8,C.y-8,16,16,0);b.uniform1i(O.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);E.positionScreen.copy(z);E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares();b.uniform1i(O.renderType,2);b.enable(b.BLEND);x=0;for(D=E.lensFlares.length;x<D;x++)H=E.lensFlares[x],0.001<H.opacity&&0.001<H.scale&&(z.x=H.x,z.y=H.y,z.z=H.z,A=H.size*H.scale/f,y.x=A*w,y.y=A,b.uniform3f(O.screenPosition,z.x,z.y,z.z),b.uniform2f(O.scale,y.x,y.y),b.uniform1f(O.rotation,H.rotation),b.uniform1f(O.opacity,
|
|
|
-H.opacity),b.uniform3f(O.color,H.color.r,H.color.g,H.color.b),c.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,p){var t,r,m,q,u,s,v,w,G,N=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);t=0;for(r=n.__lights.length;t<r;t++)if(m=n.__lights[t],m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(u=0;u<m.shadowCascadeCount;u++){var A;if(m.shadowCascadeArray[u])A=m.shadowCascadeArray[u];else{G=m;v=u;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=G.shadowCameraNear;A.shadowCameraFar=G.shadowCameraFar;A.shadowCameraLeft=G.shadowCameraLeft;A.shadowCameraRight=G.shadowCameraRight;
|
|
|
-A.shadowCameraBottom=G.shadowCameraBottom;A.shadowCameraTop=G.shadowCameraTop;A.shadowCameraVisible=G.shadowCameraVisible;A.shadowDarkness=G.shadowDarkness;A.shadowBias=G.shadowCascadeBias[v];A.shadowMapWidth=G.shadowCascadeWidth[v];A.shadowMapHeight=G.shadowCascadeHeight[v];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;s=A.pointsFrustum;for(var y=0;8>y;y++)w[y]=new THREE.Vector3,s[y]=new THREE.Vector3;w=G.shadowCascadeNearZ[v];G=G.shadowCascadeFarZ[v];s[0].set(-1,-1,w);s[1].set(1,-1,w);s[2].set(-1,
|
|
|
-1,w);s[3].set(1,1,w);s[4].set(-1,-1,G);s[5].set(1,-1,G);s[6].set(-1,1,G);s[7].set(1,1,G);A.originalCamera=p;s=new THREE.Gyroscope;s.position=m.shadowCascadeOffset;s.add(A);s.add(A.target);p.add(s);m.shadowCascadeArray[u]=A;console.log("Created virtualLight",A)}v=m;w=u;G=v.shadowCascadeArray[w];G.position.copy(v.position);G.target.position.copy(v.target.position);G.lookAt(G.target);G.shadowCameraVisible=v.shadowCameraVisible;G.shadowDarkness=v.shadowDarkness;G.shadowBias=v.shadowCascadeBias[w];s=v.shadowCascadeNearZ[w];
|
|
|
-v=v.shadowCascadeFarZ[w];G=G.pointsFrustum;G[0].z=s;G[1].z=s;G[2].z=s;G[3].z=s;G[4].z=v;G[5].z=v;G[6].z=v;G[7].z=v;N[q]=A;q++}else N[q]=m,q++;t=0;for(r=N.length;t<r;t++){m=N[t];m.shadowMap||(u=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(u=THREE.NearestFilter),m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:u,magFilter:u,format:THREE.RGBAFormat}),m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight),m.shadowMatrix=new THREE.Matrix4);
|
|
|
+b.getUniformLocation(n,"opacity");t.color=b.getUniformLocation(n,"color");t.scale=b.getUniformLocation(n,"scale");t.rotation=b.getUniformLocation(n,"rotation");t.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,s=a.length;if(s){var v=new THREE.Vector3,w=f/e,G=0.5*e,K=0.5*f,B=16/f,y=new THREE.Vector2(B*w,B),z=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),N=t,B=p;b.useProgram(n);b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);
|
|
|
+b.uniform1i(N.occlusionMap,0);b.uniform1i(N.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var F,D,E,x,H;for(F=0;F<s;F++)if(B=16/f,y.set(B*w,B),x=a[F],v.set(x.matrixWorld.elements[12],x.matrixWorld.elements[13],x.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),z.copy(v),C.x=z.x*G+G,
|
|
|
+C.y=z.y*K+K,l||0<C.x&&C.x<e&&0<C.y&&C.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(N.renderType,0);b.uniform2f(N.scale,y.x,y.y);b.uniform3f(N.screenPosition,z.x,z.y,z.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,C.x-8,C.y-8,16,16,0);b.uniform1i(N.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);x.positionScreen.copy(z);x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();b.uniform1i(N.renderType,2);b.enable(b.BLEND);D=0;for(E=x.lensFlares.length;D<E;D++)H=x.lensFlares[D],0.001<H.opacity&&0.001<H.scale&&(z.x=H.x,z.y=H.y,z.z=H.z,B=H.size*H.scale/f,y.x=B*w,y.y=B,b.uniform3f(N.screenPosition,z.x,z.y,z.z),b.uniform2f(N.scale,y.x,y.y),b.uniform1f(N.rotation,H.rotation),b.uniform1f(N.opacity,
|
|
|
+H.opacity),b.uniform3f(N.color,H.color.r,H.color.g,H.color.b),c.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,p){var t,r,m,q,u,s,v,w,G,K=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);t=0;for(r=n.__lights.length;t<r;t++)if(m=n.__lights[t],m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(u=0;u<m.shadowCascadeCount;u++){var B;if(m.shadowCascadeArray[u])B=m.shadowCascadeArray[u];else{G=m;v=u;B=new THREE.DirectionalLight;B.isVirtual=!0;B.onlyShadow=!0;B.castShadow=!0;B.shadowCameraNear=G.shadowCameraNear;B.shadowCameraFar=G.shadowCameraFar;B.shadowCameraLeft=G.shadowCameraLeft;B.shadowCameraRight=G.shadowCameraRight;
|
|
|
+B.shadowCameraBottom=G.shadowCameraBottom;B.shadowCameraTop=G.shadowCameraTop;B.shadowCameraVisible=G.shadowCameraVisible;B.shadowDarkness=G.shadowDarkness;B.shadowBias=G.shadowCascadeBias[v];B.shadowMapWidth=G.shadowCascadeWidth[v];B.shadowMapHeight=G.shadowCascadeHeight[v];B.pointsWorld=[];B.pointsFrustum=[];w=B.pointsWorld;s=B.pointsFrustum;for(var y=0;8>y;y++)w[y]=new THREE.Vector3,s[y]=new THREE.Vector3;w=G.shadowCascadeNearZ[v];G=G.shadowCascadeFarZ[v];s[0].set(-1,-1,w);s[1].set(1,-1,w);s[2].set(-1,
|
|
|
+1,w);s[3].set(1,1,w);s[4].set(-1,-1,G);s[5].set(1,-1,G);s[6].set(-1,1,G);s[7].set(1,1,G);B.originalCamera=p;s=new THREE.Gyroscope;s.position=m.shadowCascadeOffset;s.add(B);s.add(B.target);p.add(s);m.shadowCascadeArray[u]=B;console.log("Created virtualLight",B)}v=m;w=u;G=v.shadowCascadeArray[w];G.position.copy(v.position);G.target.position.copy(v.target.position);G.lookAt(G.target);G.shadowCameraVisible=v.shadowCameraVisible;G.shadowDarkness=v.shadowDarkness;G.shadowBias=v.shadowCascadeBias[w];s=v.shadowCascadeNearZ[w];
|
|
|
+v=v.shadowCascadeFarZ[w];G=G.pointsFrustum;G[0].z=s;G[1].z=s;G[2].z=s;G[3].z=s;G[4].z=v;G[5].z=v;G[6].z=v;G[7].z=v;K[q]=B;q++}else K[q]=m,q++;t=0;for(r=K.length;t<r;t++){m=K[t];m.shadowMap||(u=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(u=THREE.NearestFilter),m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:u,magFilter:u,format:THREE.RGBAFormat}),m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight),m.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}n.add(m.shadowCamera);!0===n.autoUpdate&&n.updateMatrixWorld()}m.shadowCameraVisible&&
|
|
|
-!m.cameraHelper&&(m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper));if(m.isVirtual&&A.originalCamera==p){u=p;q=m.shadowCamera;s=m.pointsFrustum;G=m.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=G[v],w.copy(s[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,u),w.applyMatrix4(q.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
+!m.cameraHelper&&(m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper));if(m.isVirtual&&B.originalCamera==p){u=p;q=m.shadowCamera;s=m.pointsFrustum;G=m.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=G[v],w.copy(s[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,u),w.applyMatrix4(q.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
(k.z=w.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=m.shadowMap;s=m.shadowMatrix;u=m.shadowCamera;u.position.setFromMatrixPosition(m.matrixWorld);l.setFromMatrixPosition(m.target.matrixWorld);u.lookAt(l);u.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);m.cameraHelper&&(m.cameraHelper.visible=m.shadowCameraVisible);m.shadowCameraVisible&&m.cameraHelper.update();s.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiply(u.projectionMatrix);s.multiply(u.matrixWorldInverse);
|
|
|
g.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(q);b.clear();G=n.__webglObjects;m=0;for(q=G.length;m<q;m++)if(v=G[m],s=v.object,v.render=!1,s.visible&&s.castShadow&&(!(s instanceof THREE.Mesh||s instanceof THREE.ParticleSystem)||!s.frustumCulled||h.intersectsObject(s)))s._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,s.matrixWorld),v.render=!0;m=0;for(q=G.length;m<q;m++)v=G[m],v.render&&(s=v.object,v=v.buffer,y=s.material instanceof THREE.MeshFaceMaterial?
|
|
|
s.material.materials[0]:s.material,w=0<s.geometry.morphTargets.length&&y.morphTargets,y=s instanceof THREE.SkinnedMesh&&y.skinning,w=s.customDepthMaterial?s.customDepthMaterial:y?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(u,n.__lights,null,w,v,s):b.renderBuffer(u,n.__lights,null,w,v,s));G=n.__webglObjectsImmediate;m=0;for(q=G.length;m<q;m++)v=G[m],s=v.object,s.visible&&s.castShadow&&(s._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,s.matrixWorld),b.renderImmediateObject(u,
|
|
|
-n.__lights,null,c,s))}t=b.getClearColor();r=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,h,g,i,k,l,n,p,t,r,m,q;function u(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var s,v,w,G,N,A,y,z;this.init=function(u){s=u.context;v=u;G=new Float32Array([-0.5,-0.5,0,0,0.5,-0.5,1,0,0.5,0.5,1,1,-0.5,0.5,0,1]);N=new Uint16Array([0,1,2,0,2,3]);A=s.createBuffer();y=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,A);s.bufferData(s.ARRAY_BUFFER,G,s.STATIC_DRAW);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,y);s.bufferData(s.ELEMENT_ARRAY_BUFFER,N,s.STATIC_DRAW);var u=s.createProgram(),
|
|
|
-O=s.createShader(s.VERTEX_SHADER),F=s.createShader(s.FRAGMENT_SHADER);s.shaderSource(O,["precision "+v.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
+n.__lights,null,c,s))}t=b.getClearColor();r=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,h,g,i,k,l,n,p,t,r,m,q;function u(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var s,v,w,G,K,B,y,z;this.init=function(u){s=u.context;v=u;G=new Float32Array([-0.5,-0.5,0,0,0.5,-0.5,1,0,0.5,0.5,1,1,-0.5,0.5,0,1]);K=new Uint16Array([0,1,2,0,2,3]);B=s.createBuffer();y=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,B);s.bufferData(s.ARRAY_BUFFER,G,s.STATIC_DRAW);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,y);s.bufferData(s.ELEMENT_ARRAY_BUFFER,K,s.STATIC_DRAW);var u=s.createProgram(),
|
|
|
+N=s.createShader(s.VERTEX_SHADER),F=s.createShader(s.FRAGMENT_SHADER);s.shaderSource(N,["precision "+v.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
s.shaderSource(F,["precision "+v.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
|
|
|
-s.compileShader(O);s.compileShader(F);s.attachShader(u,O);s.attachShader(u,F);s.linkProgram(u);z=u;m=s.getAttribLocation(z,"position");q=s.getAttribLocation(z,"uv");a=s.getUniformLocation(z,"uvOffset");b=s.getUniformLocation(z,"uvScale");c=s.getUniformLocation(z,"rotation");d=s.getUniformLocation(z,"scale");e=s.getUniformLocation(z,"color");f=s.getUniformLocation(z,"map");h=s.getUniformLocation(z,"opacity");g=s.getUniformLocation(z,"modelViewMatrix");i=s.getUniformLocation(z,"projectionMatrix");k=
|
|
|
-s.getUniformLocation(z,"fogType");l=s.getUniformLocation(z,"fogDensity");n=s.getUniformLocation(z,"fogNear");p=s.getUniformLocation(z,"fogFar");t=s.getUniformLocation(z,"fogColor");r=s.getUniformLocation(z,"alphaTest");u=document.createElement("canvas");u.width=8;u.height=8;O=u.getContext("2d");O.fillStyle="#ffffff";O.fillRect(0,0,u.width,u.height);w=new THREE.Texture(u);w.needsUpdate=!0};this.render=function(C,G){var F=C.__webglSprites,x=F.length;if(x){s.useProgram(z);s.enableVertexAttribArray(m);
|
|
|
-s.enableVertexAttribArray(q);s.disable(s.CULL_FACE);s.enable(s.BLEND);s.bindBuffer(s.ARRAY_BUFFER,A);s.vertexAttribPointer(m,2,s.FLOAT,!1,16,0);s.vertexAttribPointer(q,2,s.FLOAT,!1,16,8);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,y);s.uniformMatrix4fv(i,!1,G.projectionMatrix.elements);s.activeTexture(s.TEXTURE0);s.uniform1i(f,0);var D=0,E=0,H=C.fog;H?(s.uniform3f(t,H.color.r,H.color.g,H.color.b),H instanceof THREE.Fog?(s.uniform1f(n,H.near),s.uniform1f(p,H.far),s.uniform1i(k,1),E=D=1):H instanceof THREE.FogExp2&&
|
|
|
-(s.uniform1f(l,H.density),s.uniform1i(k,2),E=D=2)):(s.uniform1i(k,0),E=D=0);for(var K,I,N=[],H=0;H<x;H++)K=F[H],!1!==K.visible&&(K._modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,K.matrixWorld),K.z=-K._modelViewMatrix.elements[14]);F.sort(u);for(H=0;H<x;H++)K=F[H],!1!==K.visible&&(I=K.material,s.uniform1f(r,I.alphaTest),s.uniformMatrix4fv(g,!1,K._modelViewMatrix.elements),N[0]=K.scale.x,N[1]=K.scale.y,K=C.fog&&I.fog?E:0,D!==K&&(s.uniform1i(k,K),D=K),null!==I.map?(s.uniform2f(a,I.map.offset.x,
|
|
|
-I.map.offset.y),s.uniform2f(b,I.map.repeat.x,I.map.repeat.y)):(s.uniform2f(a,0,0),s.uniform2f(b,1,1)),s.uniform1f(h,I.opacity),s.uniform3f(e,I.color.r,I.color.g,I.color.b),s.uniform1f(c,I.rotation),s.uniform2fv(d,N),v.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst),v.setDepthTest(I.depthTest),v.setDepthWrite(I.depthWrite),I.map&&I.map.image&&I.map.image.width?v.setTexture(I.map,0):v.setTexture(w,0),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0));s.enable(s.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+s.compileShader(N);s.compileShader(F);s.attachShader(u,N);s.attachShader(u,F);s.linkProgram(u);z=u;m=s.getAttribLocation(z,"position");q=s.getAttribLocation(z,"uv");a=s.getUniformLocation(z,"uvOffset");b=s.getUniformLocation(z,"uvScale");c=s.getUniformLocation(z,"rotation");d=s.getUniformLocation(z,"scale");e=s.getUniformLocation(z,"color");f=s.getUniformLocation(z,"map");h=s.getUniformLocation(z,"opacity");g=s.getUniformLocation(z,"modelViewMatrix");i=s.getUniformLocation(z,"projectionMatrix");k=
|
|
|
+s.getUniformLocation(z,"fogType");l=s.getUniformLocation(z,"fogDensity");n=s.getUniformLocation(z,"fogNear");p=s.getUniformLocation(z,"fogFar");t=s.getUniformLocation(z,"fogColor");r=s.getUniformLocation(z,"alphaTest");u=document.createElement("canvas");u.width=8;u.height=8;N=u.getContext("2d");N.fillStyle="#ffffff";N.fillRect(0,0,u.width,u.height);w=new THREE.Texture(u);w.needsUpdate=!0};this.render=function(C,G){var F=C.__webglSprites,D=F.length;if(D){s.useProgram(z);s.enableVertexAttribArray(m);
|
|
|
+s.enableVertexAttribArray(q);s.disable(s.CULL_FACE);s.enable(s.BLEND);s.bindBuffer(s.ARRAY_BUFFER,B);s.vertexAttribPointer(m,2,s.FLOAT,!1,16,0);s.vertexAttribPointer(q,2,s.FLOAT,!1,16,8);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,y);s.uniformMatrix4fv(i,!1,G.projectionMatrix.elements);s.activeTexture(s.TEXTURE0);s.uniform1i(f,0);var E=0,x=0,H=C.fog;H?(s.uniform3f(t,H.color.r,H.color.g,H.color.b),H instanceof THREE.Fog?(s.uniform1f(n,H.near),s.uniform1f(p,H.far),s.uniform1i(k,1),x=E=1):H instanceof THREE.FogExp2&&
|
|
|
+(s.uniform1f(l,H.density),s.uniform1i(k,2),x=E=2)):(s.uniform1i(k,0),x=E=0);for(var K,A,ca=[],H=0;H<D;H++)K=F[H],!1!==K.visible&&(K._modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,K.matrixWorld),K.z=-K._modelViewMatrix.elements[14]);F.sort(u);for(H=0;H<D;H++)K=F[H],!1!==K.visible&&(A=K.material,s.uniform1f(r,A.alphaTest),s.uniformMatrix4fv(g,!1,K._modelViewMatrix.elements),ca[0]=K.scale.x,ca[1]=K.scale.y,K=C.fog&&A.fog?x:0,E!==K&&(s.uniform1i(k,K),E=K),null!==A.map?(s.uniform2f(a,A.map.offset.x,
|
|
|
+A.map.offset.y),s.uniform2f(b,A.map.repeat.x,A.map.repeat.y)):(s.uniform2f(a,0,0),s.uniform2f(b,1,1)),s.uniform1f(h,A.opacity),s.uniform3f(e,A.color.r,A.color.g,A.color.b),s.uniform1f(c,A.rotation),s.uniform2fv(d,ca),v.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),v.setDepthTest(A.depthTest),v.setDepthWrite(A.depthWrite),A.map&&A.map.image&&A.map.image.width?v.setTexture(A.map,0):v.setTexture(w,0),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0));s.enable(s.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,n,p,t,r,m;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
|
|
|
k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();m=i.__webglObjects;l=0;for(n=m.length;l<n;l++)if(p=m[l],r=p.object,p.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),p.render=!0;var q;l=0;for(n=m.length;l<n;l++)if(p=m[l],p.render&&(r=p.object,p=p.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
|
|
|
r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),t=0<r.geometry.morphTargets.length&&q.morphTargets,q=r instanceof THREE.SkinnedMesh&&q.skinning,t=r.customDepthMaterial?r.customDepthMaterial:q?t?f:e:t?d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,t,p,r):b.renderBuffer(k,i.__lights,null,t,p,r);m=i.__webglObjectsImmediate;l=0;for(n=m.length;l<n;l++)p=m[l],r=p.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|