|
@@ -92,7 +92,7 @@ f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=n+a*c,b[10]=f*g):"ZXY"===a.order?(
|
|
|
g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+n,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=n*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,g=c+c,h=d+d,k=e+e;a=c*g;var l=c*
|
|
|
h,c=c*k,n=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(n+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+n);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 g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=
|
|
|
a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],l=c[1],n=c[5],q=c[9],s=c[13],u=c[2],t=c[6],p=c[10],v=c[14],w=c[3],r=c[7],x=c[11],
|
|
|
-c=c[15],A=d[0],F=d[4],Q=d[8],I=d[12],B=d[1],z=d[5],M=d[9],G=d[13],J=d[2],y=d[6],N=d[10],D=d[14],E=d[3],C=d[7],L=d[11],d=d[15];e[0]=f*A+g*B+h*J+k*E;e[4]=f*F+g*z+h*y+k*C;e[8]=f*Q+g*M+h*N+k*L;e[12]=f*I+g*G+h*D+k*d;e[1]=l*A+n*B+q*J+s*E;e[5]=l*F+n*z+q*y+s*C;e[9]=l*Q+n*M+q*N+s*L;e[13]=l*I+n*G+q*D+s*d;e[2]=u*A+t*B+p*J+v*E;e[6]=u*F+t*z+p*y+v*C;e[10]=u*Q+t*M+p*N+v*L;e[14]=u*I+t*G+p*D+v*d;e[3]=w*A+r*B+x*J+c*E;e[7]=w*F+r*z+x*y+c*C;e[11]=w*Q+r*M+x*N+c*L;e[15]=w*I+r*G+x*D+c*d;return this},multiplyToArray:function(a,
|
|
|
+c=c[15],A=d[0],G=d[4],Q=d[8],I=d[12],B=d[1],z=d[5],M=d[9],H=d[13],K=d[2],y=d[6],N=d[10],E=d[14],F=d[3],C=d[7],O=d[11],d=d[15];e[0]=f*A+g*B+h*K+k*F;e[4]=f*G+g*z+h*y+k*C;e[8]=f*Q+g*M+h*N+k*O;e[12]=f*I+g*H+h*E+k*d;e[1]=l*A+n*B+q*K+s*F;e[5]=l*G+n*z+q*y+s*C;e[9]=l*Q+n*M+q*N+s*O;e[13]=l*I+n*H+q*E+s*d;e[2]=u*A+t*B+p*K+v*F;e[6]=u*G+t*z+p*y+v*C;e[10]=u*Q+t*M+p*N+v*O;e[14]=u*I+t*H+p*E+v*d;e[3]=w*A+r*B+x*K+c*F;e[7]=w*G+r*z+x*y+c*C;e[11]=w*Q+r*M+x*N+c*O;e[15]=w*I+r*H+x*E+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],g=a[5],h=a[9],k=a[13],l=a[2],n=a[6],q=a[10],s=a[14];return a[3]*(+e*h*n-d*k*n-e*g*q+c*k*q+d*g*s-c*h*s)+a[7]*(+b*h*s-b*k*q+e*f*q-d*f*s+d*k*l-e*h*l)+a[11]*(+b*k*n-b*g*s-e*f*n+c*f*s+e*g*l-c*k*l)+a[15]*(-d*g*l-b*h*n+b*g*q+d*f*n-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},g=new a.Vector3,h=new a.Vector3,k=new a.Vector3,l=function(f,n,u){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var t=n.ray.distanceToPoint(d);if(t>f.scale.x)return u;u.push({distance:t,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
a.LOD)d.setFromMatrixPosition(f.matrixWorld),t=n.ray.origin.distanceTo(d),l(f.getObjectForDistance(t),n,u);else if(f instanceof a.Mesh){var p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return u;if(p instanceof a.BufferGeometry){var v=f.material;if(void 0===
|
|
|
-v||!1===p.dynamic)return u;var w,r,x=n.precision;if(void 0!==p.attributes.index)for(var A=p.offsets,F=p.attributes.index.array,Q=p.attributes.position.array,I=p.offsets.length,B=p.attributes.index.array.length/3,B=0;B<I;++B)for(var t=A[B].start,z=A[B].index,p=t,M=t+A[B].count;p<M;p+=3)t=z+F[p],w=z+F[p+1],r=z+F[p+2],g.set(Q[3*t],Q[3*t+1],Q[3*t+2]),h.set(Q[3*w],Q[3*w+1],Q[3*w+2]),k.set(Q[3*r],Q[3*r+1],Q[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),
|
|
|
+v||!1===p.dynamic)return u;var w,r,x=n.precision;if(void 0!==p.attributes.index)for(var A=p.offsets,G=p.attributes.index.array,Q=p.attributes.position.array,I=p.offsets.length,B=p.attributes.index.array.length/3,B=0;B<I;++B)for(var t=A[B].start,z=A[B].index,p=t,M=t+A[B].count;p<M;p+=3)t=z+G[p],w=z+G[p+1],r=z+G[p+2],g.set(Q[3*t],Q[3*t+1],Q[3*t+2]),h.set(Q[3*w],Q[3*w+1],Q[3*w+2]),k.set(Q[3*r],Q[3*r+1],Q[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),
|
|
|
null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,point:w,face:null,faceIndex:null,object:f}));else for(Q=p.attributes.position.array,B=p.attributes.position.array.length,p=0;p<B;p+=3)t=p,w=p+1,r=p+2,g.set(Q[3*t],Q[3*t+1],Q[3*t+2]),h.set(Q[3*w],Q[3*w+1],Q[3*w+2]),k.set(Q[3*r],Q[3*r+1],Q[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),null!==w&&(w.applyMatrix4(f.matrixWorld),
|
|
|
-t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,point:w,face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry)for(F=f.material instanceof a.MeshFaceMaterial,Q=!0===F?f.material.materials:null,x=n.precision,A=p.vertices,I=0,B=p.faces.length;I<B;I++)if(z=p.faces[I],v=!0===F?Q[z.materialIndex]:f.material,void 0!==v){t=A[z.a];w=A[z.b];r=A[z.c];if(!0===v.morphTargets){var M=p.morphTargets,G=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var J=
|
|
|
-0,y=M.length;J<y;J++){var N=G[J];if(0!==N){var D=M[J].vertices;g.x+=(D[z.a].x-t.x)*N;g.y+=(D[z.a].y-t.y)*N;g.z+=(D[z.a].z-t.z)*N;h.x+=(D[z.b].x-w.x)*N;h.y+=(D[z.b].y-w.y)*N;h.z+=(D[z.b].z-w.z)*N;k.x+=(D[z.c].x-r.x)*N;k.y+=(D[z.c].y-r.y)*N;k.z+=(D[z.c].z-r.z)*N}}g.add(t);h.add(w);k.add(r);t=g;w=h;r=k}w=v.side===a.BackSide?c.intersectTriangle(r,w,t,!0):c.intersectTriangle(t,w,r,v.side!==a.DoubleSide);null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,
|
|
|
+t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,point:w,face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry)for(G=f.material instanceof a.MeshFaceMaterial,Q=!0===G?f.material.materials:null,x=n.precision,A=p.vertices,I=0,B=p.faces.length;I<B;I++)if(z=p.faces[I],v=!0===G?Q[z.materialIndex]:f.material,void 0!==v){t=A[z.a];w=A[z.b];r=A[z.c];if(!0===v.morphTargets){var M=p.morphTargets,H=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var K=
|
|
|
+0,y=M.length;K<y;K++){var N=H[K];if(0!==N){var E=M[K].vertices;g.x+=(E[z.a].x-t.x)*N;g.y+=(E[z.a].y-t.y)*N;g.z+=(E[z.a].z-t.z)*N;h.x+=(E[z.b].x-w.x)*N;h.y+=(E[z.b].y-w.y)*N;h.z+=(E[z.b].z-w.z)*N;k.x+=(E[z.c].x-r.x)*N;k.y+=(E[z.c].y-r.y)*N;k.z+=(E[z.c].z-r.z)*N}}g.add(t);h.add(w);k.add(r);t=g;w=h;r=k}w=v.side===a.BackSide?c.intersectTriangle(r,w,t,!0):c.intersectTriangle(t,w,r,v.side!==a.DoubleSide);null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,
|
|
|
point:w,face:z,faceIndex:I,object:f}))}}else if(f instanceof a.Line){x=n.linePrecision;v=x*x;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(p instanceof a.Geometry)for(A=p.vertices,x=A.length,w=new a.Vector3,r=new a.Vector3,B=f.type===a.LineStrip?1:2,p=0;p<x-1;p+=B)c.distanceSqToSegment(A[p],A[p+1],r,w)>v||(t=c.origin.distanceTo(r),
|
|
|
t<n.near||t>n.far||u.push({distance:t,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},n=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)l(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&&n(a,this,c);l(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++)l(a[d],this,c),!0===b&&n(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;
|
|
@@ -161,22 +161,22 @@ this.children.indexOf(a);if(-1!==b){a.parent=void 0;a.dispatchEvent({type:"remov
|
|
|
b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getObjectByName(a,b),void 0!==e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.compose(this.position,
|
|
|
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(n===s){var a=new THREE.RenderableVertex;q.push(a);s++;n++;return a}return q[n++]}function b(){if(t===v){var a=new THREE.RenderableFace3;p.push(a);v++;t++;return a}return p[t++]}function c(){if(r===A){var a=new THREE.RenderableLine;x.push(a);A++;r++;return a}return x[r++]}function d(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function e(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&
|
|
|
-0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var f,g,h=[],k=0,l,n,q=[],s=0,u,t,p=[],v=0,w,r,x=[],A=0,F,Q,I=[],B=0,z={objects:[],lights:[],elements:[]},M=new THREE.Vector3,G=new THREE.Vector3,J=new THREE.Vector3,y=new THREE.Vector3,N=new THREE.Vector4,D=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),E=new THREE.Box3,C=Array(3),L=new THREE.Matrix4,Y=
|
|
|
-new THREE.Matrix4,T,ja=new THREE.Matrix4,W=new THREE.Matrix3,na=new THREE.Vector3,R=new THREE.Frustum,ea=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Y.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(Y)};this.unprojectVector=function(){var a=new THREE.Matrix4;return function(b,c){a.getInverse(c.projectionMatrix);Y.multiplyMatrices(c.matrixWorld,a);return b.applyProjection(Y)}}();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 O=function(a){if(!1!==a.visible){if(a instanceof THREE.Light)z.lights.push(a);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Sprite)if(!1===a.frustumCulled||!0===R.intersectsObject(a)){if(g===k){var b=new THREE.RenderableObject;h.push(b);k++;g++;f=b}else f=h[g++];f.id=a.id;f.object=a;null!==a.renderDepth?
|
|
|
-f.z=a.renderDepth:(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(Y),f.z=y.z);z.objects.push(f)}for(var b=0,c=a.children.length;b<c;b++)O(a.children[b])}},H=new function(){var d=[],e=null,f=new THREE.Matrix3,g=function(a){var b=a.positionWorld,c=a.positionScreen;b.copy(a.position).applyMatrix4(T);c.copy(b).applyMatrix4(Y);b=1/c.w;c.x*=b;c.y*=b;c.z*=b;a.visible=-1<=c.x&&1>=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},h=function(a,b,c){C[0]=a.positionScreen;C[1]=b.positionScreen;C[2]=c.positionScreen;
|
|
|
-return!0===a.visible||!0===b.visible||!0===c.visible||D.isIntersectionBox(E.setFromPoints(C))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){e=a;f.getNormalMatrix(e.matrixWorld);d.length=0},projectVertex:g,checkTriangleVisibility:h,pushVertex:function(b,c,d){l=a();l.position.set(b,c,d);g(l)},pushNormal:function(a,b,c){d.push(a,b,c)},pushLine:function(a,
|
|
|
-b){var d=q[a],f=q[b];w=c();w.id=e.id;w.v1.copy(d);w.v2.copy(f);u.z=(d.positionScreen.z+f.positionScreen.z)/2;w.material=e.material;z.elements.push(w)},pushTriangle:function(a,c,g){var k=q[a],l=q[c],n=q[g];if(!0===h(k,l,n)){u=b();u.id=e.id;u.v1.copy(k);u.v2.copy(l);u.v3.copy(n);u.z=(k.positionScreen.z+l.positionScreen.z+n.positionScreen.z)/3;for(k=0;3>k;k++)l=3*arguments[k],n=u.vertexNormalsModel[k],n.set(d[l+0],d[l+1],d[l+2]),n.applyMatrix3(f).normalize();u.vertexNormalsLength=3;u.material=e.material;
|
|
|
-z.elements.push(u)}}}};this.projectScene=function(f,h,k,l){var p,s,v,x,y,A,D,C,E;Q=r=t=0;z.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();L.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Y.multiplyMatrices(h.projectionMatrix,L);R.setFromMatrix(Y);g=0;z.objects.length=0;z.lights.length=0;O(f);!0===k&&z.objects.sort(d);f=0;for(k=z.objects.length;f<k;f++)if(p=z.objects[f].object,s=p.geometry,H.setObject(p),T=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof
|
|
|
-THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)H.pushVertex(A[p],A[p+1],A[p+2]);C=x.normal.array;p=0;for(s=C.length;p<s;p+=3)H.pushNormal(C[p],C[p+1],C[p+2]);if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=3)H.pushTriangle(x[p],x[p+1],x[p+2]);else for(p=0,s=A.length/3;p<s;p+=3)H.pushTriangle(p,p+1,p+2)}}else if(s instanceof THREE.Geometry2)for(v=s.vertices,x=p=0,s=v.length;p<s;p+=9,x+=3)H.pushVertex(v[p+0],v[p+1],v[p+2]),H.pushVertex(v[p+
|
|
|
-3],v[p+4],v[p+5]),H.pushVertex(v[p+6],v[p+7],v[p+8]),H.pushTriangle(x+0,x+1,x+2);else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;A=s.faceVertexUvs;W.getNormalMatrix(T);C=p.material instanceof THREE.MeshFaceMaterial;E=!0===C?p.material:null;for(var ka=0,Ma=v.length;ka<Ma;ka++){var Ga=v[ka];H.pushVertex(Ga.x,Ga.y,Ga.z)}ka=0;for(Ma=x.length;ka<Ma;ka++)if(v=x[ka],Ga=!0===C?E.materials[v.materialIndex]:p.material,void 0!==Ga){D=Ga.side;y=q[v.a];var qa=q[v.b],ra=q[v.c];if(!0===Ga.morphTargets){var Aa=
|
|
|
-s.morphTargets,Ca=p.morphTargetInfluences,Da=y.position,Oa=qa.position,Pa=ra.position;M.set(0,0,0);G.set(0,0,0);J.set(0,0,0);for(var Qa=0,gb=Aa.length;Qa<gb;Qa++){var Ea=Ca[Qa];if(0!==Ea){var Z=Aa[Qa].vertices;M.x+=(Z[v.a].x-Da.x)*Ea;M.y+=(Z[v.a].y-Da.y)*Ea;M.z+=(Z[v.a].z-Da.z)*Ea;G.x+=(Z[v.b].x-Oa.x)*Ea;G.y+=(Z[v.b].y-Oa.y)*Ea;G.z+=(Z[v.b].z-Oa.z)*Ea;J.x+=(Z[v.c].x-Pa.x)*Ea;J.y+=(Z[v.c].y-Pa.y)*Ea;J.z+=(Z[v.c].z-Pa.z)*Ea}}y.position.add(M);qa.position.add(G);ra.position.add(J);H.projectVertex(y);
|
|
|
-H.projectVertex(qa);H.projectVertex(ra)}Aa=H.checkTriangleVisibility(y,qa,ra);if(Aa!==(D===THREE.BackSide)){u=b();u.id=p.id;u.v1.copy(y);u.v2.copy(qa);u.v3.copy(ra);u.normalModel.copy(v.normal);!1!==Aa||D!==THREE.BackSide&&D!==THREE.DoubleSide||u.normalModel.negate();u.normalModel.applyMatrix3(W).normalize();u.centroidModel.copy(v.centroid).applyMatrix4(T);y=v.vertexNormals;qa=0;for(ra=Math.min(y.length,3);qa<ra;qa++)Ca=u.vertexNormalsModel[qa],Ca.copy(y[qa]),!1!==Aa||D!==THREE.BackSide&&D!==THREE.DoubleSide||
|
|
|
-Ca.negate(),Ca.applyMatrix3(W).normalize();u.vertexNormalsLength=y.length;y=0;for(qa=Math.min(A.length,3);y<qa;y++)if(D=A[y][ka],void 0!==D)for(ra=0,Aa=D.length;ra<Aa;ra++)u.uvs[y][ra]=D[ra];u.color=v.color;u.material=Ga;na.copy(u.centroidModel).applyProjection(Y);u.z=na.z;z.elements.push(u)}}}}else if(p instanceof THREE.Line)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)H.pushVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=
|
|
|
-x.index.array,p=0,s=x.length;p<s;p+=2)H.pushLine(x[p],x[p+1]);else for(p=0,s=A.length/3-1;p<s;p++)H.pushLine(p,p+1)}}else{if(s instanceof THREE.Geometry)for(ja.multiplyMatrices(Y,T),v=p.geometry.vertices,y=a(),y.positionScreen.copy(v[0]).applyMatrix4(ja),s=p.type===THREE.LinePieces?2:1,ka=1,Ma=v.length;ka<Ma;ka++)y=a(),y.positionScreen.copy(v[ka]).applyMatrix4(ja),0<(ka+1)%s||(qa=q[n-2],ea.copy(y.positionScreen),S.copy(qa.positionScreen),!0===e(ea,S)&&(ea.multiplyScalar(1/ea.w),S.multiplyScalar(1/
|
|
|
-S.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(ea),w.v2.positionScreen.copy(S),w.z=Math.max(ea.z,S.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[ka]),w.vertexColors[1].copy(p.geometry.colors[ka-1])),z.elements.push(w)))}else p instanceof THREE.Sprite&&(T=p.matrixWorld,N.set(T.elements[12],T.elements[13],T.elements[14],1),N.applyMatrix4(Y),s=1/N.w,N.z*=s,-1<=N.z&&1>=N.z&&(Q===B?(x=new THREE.RenderableSprite,I.push(x),B++,Q++,F=x):F=
|
|
|
-I[Q++],F.id=p.id,F.x=N.x*s,F.y=N.y*s,F.z=N.z,F.object=p,F.rotation=p.rotation,F.scale.x=p.scale.x*Math.abs(F.x-(N.x+h.projectionMatrix.elements[0])/(N.w+h.projectionMatrix.elements[12])),F.scale.y=p.scale.y*Math.abs(F.y-(N.y+h.projectionMatrix.elements[5])/(N.w+h.projectionMatrix.elements[13])),F.material=p.material,z.elements.push(F)));!0===l&&z.elements.sort(d);return z}};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};
|
|
|
+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(n===s){var a=new THREE.RenderableVertex;q.push(a);s++;n++;return a}return q[n++]}function b(){if(t===v){var a=new THREE.RenderableFace;p.push(a);v++;t++;return a}return p[t++]}function c(){if(r===A){var a=new THREE.RenderableLine;x.push(a);A++;r++;return a}return x[r++]}function d(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function e(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&
|
|
|
+0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var f,g,h=[],k=0,l,n,q=[],s=0,u,t,p=[],v=0,w,r,x=[],A=0,G,Q,I=[],B=0,z={objects:[],lights:[],elements:[]},M=new THREE.Vector3,H=new THREE.Vector3,K=new THREE.Vector3,y=new THREE.Vector3,N=new THREE.Vector4,E=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),F=new THREE.Box3,C=Array(3),O=new THREE.Matrix4,X=
|
|
|
+new THREE.Matrix4,R,ja=new THREE.Matrix4,W=new THREE.Matrix3,pa=new THREE.Frustum,D=new THREE.Vector4,da=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);X.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(X)};this.unprojectVector=function(){var a=new THREE.Matrix4;return function(b,c){a.getInverse(c.projectionMatrix);X.multiplyMatrices(c.matrixWorld,a);return b.applyProjection(X)}}();this.pickingRay=function(a,b){a.z=
|
|
|
+-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var T=function(a){if(!1!==a.visible){if(a instanceof THREE.Light)z.lights.push(a);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Sprite)if(!1===a.frustumCulled||!0===pa.intersectsObject(a)){if(g===k){var b=new THREE.RenderableObject;h.push(b);k++;g++;f=b}else f=h[g++];f.id=a.id;f.object=a;null!==a.renderDepth?f.z=a.renderDepth:
|
|
|
+(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(X),f.z=y.z);z.objects.push(f)}for(var b=0,c=a.children.length;b<c;b++)T(a.children[b])}},J=new function(){var d=[],e=null,f=new THREE.Matrix3,g=function(a){var b=a.positionWorld,c=a.positionScreen;b.copy(a.position).applyMatrix4(R);c.copy(b).applyMatrix4(X);b=1/c.w;c.x*=b;c.y*=b;c.z*=b;a.visible=-1<=c.x&&1>=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},h=function(a,b,c){C[0]=a.positionScreen;C[1]=b.positionScreen;C[2]=c.positionScreen;return!0===
|
|
|
+a.visible||!0===b.visible||!0===c.visible||E.isIntersectionBox(F.setFromPoints(C))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){e=a;f.getNormalMatrix(e.matrixWorld);d.length=0},projectVertex:g,checkTriangleVisibility:h,pushVertex:function(b,c,d){l=a();l.position.set(b,c,d);g(l)},pushNormal:function(a,b,c){d.push(a,b,c)},pushLine:function(a,b){var d=
|
|
|
+q[a],f=q[b];w=c();w.id=e.id;w.v1.copy(d);w.v2.copy(f);w.z=(d.positionScreen.z+f.positionScreen.z)/2;w.material=e.material;z.elements.push(w)},pushTriangle:function(a,c,g){var k=q[a],l=q[c],n=q[g];if(!0===h(k,l,n)){u=b();u.id=e.id;u.v1.copy(k);u.v2.copy(l);u.v3.copy(n);u.z=(k.positionScreen.z+l.positionScreen.z+n.positionScreen.z)/3;for(k=0;3>k;k++)l=3*arguments[k],n=u.vertexNormalsModel[k],n.set(d[l+0],d[l+1],d[l+2]),n.applyMatrix3(f).normalize();u.vertexNormalsLength=3;u.material=e.material;z.elements.push(u)}}}};
|
|
|
+this.projectScene=function(f,h,k,l){var p,s,v,x,y,A,E,C,F;Q=r=t=0;z.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();O.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));X.multiplyMatrices(h.projectionMatrix,O);pa.setFromMatrix(X);g=0;z.objects.length=0;z.lights.length=0;T(f);!0===k&&z.objects.sort(d);f=0;for(k=z.objects.length;f<k;f++)if(p=z.objects[f].object,s=p.geometry,J.setObject(p),R=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof
|
|
|
+THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)J.pushVertex(A[p],A[p+1],A[p+2]);C=x.normal.array;p=0;for(s=C.length;p<s;p+=3)J.pushNormal(C[p],C[p+1],C[p+2]);if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=3)J.pushTriangle(x[p],x[p+1],x[p+2]);else for(p=0,s=A.length/3;p<s;p+=3)J.pushTriangle(p,p+1,p+2)}}else if(s instanceof THREE.Geometry2)for(v=s.vertices,x=p=0,s=v.length;p<s;p+=9,x+=3)J.pushVertex(v[p+0],v[p+1],v[p+2]),J.pushVertex(v[p+
|
|
|
+3],v[p+4],v[p+5]),J.pushVertex(v[p+6],v[p+7],v[p+8]),J.pushTriangle(x+0,x+1,x+2);else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;A=s.faceVertexUvs;W.getNormalMatrix(R);C=p.material instanceof THREE.MeshFaceMaterial;F=!0===C?p.material:null;for(var ka=0,Ta=v.length;ka<Ta;ka++){var la=v[ka];J.pushVertex(la.x,la.y,la.z)}ka=0;for(Ta=x.length;ka<Ta;ka++){v=x[ka];var va=!0===C?F.materials[v.materialIndex]:p.material;if(void 0!==va){E=va.side;var la=q[v.a],Ka=q[v.b],La=q[v.c];if(!0===va.morphTargets){y=
|
|
|
+s.morphTargets;var Ga=p.morphTargetInfluences,ca=la.position,wa=Ka.position,Ma=La.position;M.set(0,0,0);H.set(0,0,0);K.set(0,0,0);for(var Pa=0,Qa=y.length;Pa<Qa;Pa++){var ma=Ga[Pa];if(0!==ma){var Ea=y[Pa].vertices;M.x+=(Ea[v.a].x-ca.x)*ma;M.y+=(Ea[v.a].y-ca.y)*ma;M.z+=(Ea[v.a].z-ca.z)*ma;H.x+=(Ea[v.b].x-wa.x)*ma;H.y+=(Ea[v.b].y-wa.y)*ma;H.z+=(Ea[v.b].z-wa.z)*ma;K.x+=(Ea[v.c].x-Ma.x)*ma;K.y+=(Ea[v.c].y-Ma.y)*ma;K.z+=(Ea[v.c].z-Ma.z)*ma}}la.position.add(M);Ka.position.add(H);La.position.add(K);J.projectVertex(la);
|
|
|
+J.projectVertex(Ka);J.projectVertex(La)}Ga=J.checkTriangleVisibility(la,Ka,La);if(Ga!==(E===THREE.BackSide)){u=b();u.id=p.id;u.v1.copy(la);u.v2.copy(Ka);u.v3.copy(La);u.normalModel.copy(v.normal);!1!==Ga||E!==THREE.BackSide&&E!==THREE.DoubleSide||u.normalModel.negate();u.normalModel.applyMatrix3(W).normalize();u.centroidModel.copy(v.centroid).applyMatrix4(R);y=v.vertexNormals;ca=0;for(wa=Math.min(y.length,3);ca<wa;ca++)Ma=u.vertexNormalsModel[ca],Ma.copy(y[ca]),!1!==Ga||E!==THREE.BackSide&&E!==THREE.DoubleSide||
|
|
|
+Ma.negate(),Ma.applyMatrix3(W).normalize();u.vertexNormalsLength=y.length;y=0;for(Ga=Math.min(A.length,3);y<Ga;y++)if(E=A[y][ka],void 0!==E)for(ca=0,wa=E.length;ca<wa;ca++)u.uvs[y][ca]=E[ca];u.color=v.color;u.material=va;u.z=(la.positionScreen.z+Ka.positionScreen.z+La.positionScreen.z)/3;z.elements.push(u)}}}}}else if(p instanceof THREE.Line)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)J.pushVertex(A[p],A[p+1],A[p+2]);
|
|
|
+if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=2)J.pushLine(x[p],x[p+1]);else for(p=0,s=A.length/3-1;p<s;p++)J.pushLine(p,p+1)}}else{if(s instanceof THREE.Geometry)for(ja.multiplyMatrices(X,R),v=p.geometry.vertices,la=a(),la.positionScreen.copy(v[0]).applyMatrix4(ja),s=p.type===THREE.LinePieces?2:1,ka=1,Ta=v.length;ka<Ta;ka++)la=a(),la.positionScreen.copy(v[ka]).applyMatrix4(ja),0<(ka+1)%s||(Ka=q[n-2],D.copy(la.positionScreen),da.copy(Ka.positionScreen),!0===e(D,da)&&(D.multiplyScalar(1/
|
|
|
+D.w),da.multiplyScalar(1/da.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(D),w.v2.positionScreen.copy(da),w.z=Math.max(D.z,da.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[ka]),w.vertexColors[1].copy(p.geometry.colors[ka-1])),z.elements.push(w)))}else p instanceof THREE.Sprite&&(N.set(R.elements[12],R.elements[13],R.elements[14],1),N.applyMatrix4(X),s=1/N.w,N.z*=s,-1<=N.z&&1>=N.z&&(Q===B?(x=new THREE.RenderableSprite,I.push(x),B++,Q++,
|
|
|
+G=x):G=I[Q++],G.id=p.id,G.x=N.x*s,G.y=N.y*s,G.z=N.z,G.object=p,G.rotation=p.rotation,G.scale.x=p.scale.x*Math.abs(G.x-(N.x+h.projectionMatrix.elements[0])/(N.w+h.projectionMatrix.elements[12])),G.scale.y=p.scale.y*Math.abs(G.y-(N.y+h.projectionMatrix.elements[5])/(N.w+h.projectionMatrix.elements[13])),G.material=p.material,z.elements.push(G)));!0===l&&z.elements.sort(d);return z}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,g){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,g)};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};
|
|
@@ -186,9 +186,9 @@ g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
|
0,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++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=
|
|
|
e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var 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 g=
|
|
|
this.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.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,g,h,k,l,n,q,s,u,t,p,v,w=[],r=[];c=new THREE.Vector3;var x=new THREE.Vector3,A=new THREE.Vector3,F=new THREE.Vector3,Q=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,r[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,v=e.b,e=e.c,g=this.vertices[d],h=this.vertices[v],k=this.vertices[e],
|
|
|
+d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,l,n,q,s,u,t,p,v,w=[],r=[];c=new THREE.Vector3;var x=new THREE.Vector3,A=new THREE.Vector3,G=new THREE.Vector3,Q=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,r[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,v=e.b,e=e.c,g=this.vertices[d],h=this.vertices[v],k=this.vertices[e],
|
|
|
l=f[0],n=f[1],q=f[2],f=h.x-g.x,s=k.x-g.x,u=h.y-g.y,t=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=n.x-l.x,p=q.x-l.x,n=n.y-l.y,l=q.y-l.y,q=1/(k*l-p*n),c.set((l*f-n*s)*q,(l*u-n*t)*q,(l*h-n*g)*q),x.set((k*s-p*f)*q,(k*t-p*u)*q,(k*g-p*h)*q),w[d].add(c),w[v].add(c),w[e].add(c),r[d].add(x),r[v].add(x),r[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)Q.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],A.copy(v),A.sub(Q.multiplyScalar(Q.dot(v))).normalize(),
|
|
|
-F.crossVectors(e.vertexNormals[c],v),d=F.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(A.x,A.y,A.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);
|
|
|
+G.crossVectors(e.vertexNormals[c],v),d=G.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(A.x,A.y,A.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,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),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(g=this.faces.length;f<g;f++)for(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],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=
|
|
|
a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;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=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},
|
|
|
dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Geometry2=function(a){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=void 0!==a?new Float32Array(3*a):[];this.normals=void 0!==a?new Float32Array(3*a):[];this.uvs=void 0!==a?new Float32Array(2*a):[];this.boundingSphere=this.boundingBox=null};
|
|
@@ -200,10 +200,10 @@ new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&
|
|
|
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 for(a=0,b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0;var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,k,l,n,q,s=new THREE.Vector3,u=new THREE.Vector3,t=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,r=this.offsets;c=0;for(d=
|
|
|
r.length;c<d;++c){b=r[c].start;g=r[c].count;var x=r[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],k=x+w[a+2],l=e[3*g],n=e[3*g+1],q=e[3*g+2],s.set(l,n,q),l=e[3*h],n=e[3*h+1],q=e[3*h+2],u.set(l,n,q),l=e[3*k],n=e[3*k+1],q=e[3*k+2],t.set(l,n,q),p.subVectors(t,u),v.subVectors(s,u),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*k]+=p.x,f[3*k+1]+=p.y,f[3*k+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)l=e[a],n=e[a+1],q=e[a+2],s.set(l,n,q),l=e[a+3],n=e[a+4],
|
|
|
q=e[a+5],u.set(l,n,q),l=e[a+6],n=e[a+7],q=e[a+8],t.set(l,n,q),p.subVectors(t,u),v.subVectors(s,u),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a,b,c){q=d[3*a];s=d[3*a+1];
|
|
|
-u=d[3*a+2];t=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];r=d[3*c+1];x=d[3*c+2];A=f[2*a];F=f[2*a+1];Q=f[2*b];I=f[2*b+1];B=f[2*c];z=f[2*c+1];M=t-q;G=w-q;J=p-s;y=r-s;N=v-u;D=x-u;E=Q-A;C=B-A;L=I-F;Y=z-F;T=1/(E*Y-C*L);ja.set((Y*M-L*G)*T,(Y*J-L*y)*T,(Y*N-L*D)*T);W.set((E*G-C*M)*T,(E*y-C*J)*T,(E*D-C*N)*T);k[a].add(ja);k[b].add(ja);k[c].add(ja);l[a].add(W);l[b].add(W);l[c].add(W)}function b(a){va.x=e[3*a];va.y=e[3*a+1];va.z=e[3*a+2];wa.copy(va);ca=k[a];U.copy(ca);U.sub(va.multiplyScalar(va.dot(ca))).normalize();
|
|
|
-La.crossVectors(wa,ca);za=La.dot(l[a]);Fa=0>za?-1:1;h[4*a]=U.x;h[4*a+1]=U.y;h[4*a+2]=U.z;h[4*a+3]=Fa}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 c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&
|
|
|
-(this.attributes.tangent={itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<g;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var q,s,u,t,p,v,w,r,x,A,F,Q,I,B,z,M,G,J,y,N,D,E,C,L,Y,T,ja=new THREE.Vector3,W=new THREE.Vector3,na,R,ea,S,O,H=this.offsets,n=0;for(R=H.length;n<R;++n){na=H[n].start;ea=H[n].count;var pa=H[n].index,g=na;for(na+=ea;g<na;g+=3)ea=pa+c[g],S=pa+c[g+1],O=pa+c[g+2],a(ea,S,O)}var U=new THREE.Vector3,La=new THREE.Vector3,va=new THREE.Vector3,
|
|
|
-wa=new THREE.Vector3,Fa,ca,za,n=0;for(R=H.length;n<R;++n)for(na=H[n].start,ea=H[n].count,pa=H[n].index,g=na,na+=ea;g<na;g+=3)ea=pa+c[g],S=pa+c[g+1],O=pa+c[g+2],b(ea),b(S),b(O);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,array:null},d=0,g=b.length;d<
|
|
|
+u=d[3*a+2];t=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];r=d[3*c+1];x=d[3*c+2];A=f[2*a];G=f[2*a+1];Q=f[2*b];I=f[2*b+1];B=f[2*c];z=f[2*c+1];M=t-q;H=w-q;K=p-s;y=r-s;N=v-u;E=x-u;F=Q-A;C=B-A;O=I-G;X=z-G;R=1/(F*X-C*O);ja.set((X*M-O*H)*R,(X*K-O*y)*R,(X*N-O*E)*R);W.set((F*H-C*M)*R,(F*y-C*K)*R,(F*E-C*N)*R);k[a].add(ja);k[b].add(ja);k[c].add(ja);l[a].add(W);l[b].add(W);l[c].add(W)}function b(a){za.x=e[3*a];za.y=e[3*a+1];za.z=e[3*a+2];$.copy(za);oa=k[a];S.copy(oa);S.sub(za.multiplyScalar(za.dot(oa))).normalize();
|
|
|
+Oa.crossVectors($,oa);Ca=Oa.dot(l[a]);Fa=0>Ca?-1:1;h[4*a]=S.x;h[4*a+1]=S.y;h[4*a+2]=S.z;h[4*a+3]=Fa}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 c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&
|
|
|
+(this.attributes.tangent={itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<g;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var q,s,u,t,p,v,w,r,x,A,G,Q,I,B,z,M,H,K,y,N,E,F,C,O,X,R,ja=new THREE.Vector3,W=new THREE.Vector3,pa,D,da,T,J,ba=this.offsets,n=0;for(D=ba.length;n<D;++n){pa=ba[n].start;da=ba[n].count;var ra=ba[n].index,g=pa;for(pa+=da;g<pa;g+=3)da=ra+c[g],T=ra+c[g+1],J=ra+c[g+2],a(da,T,J)}var S=new THREE.Vector3,Oa=new THREE.Vector3,za=new THREE.Vector3,
|
|
|
+$=new THREE.Vector3,Fa,oa,Ca,n=0;for(D=ba.length;n<D;++n)for(pa=ba[n].start,da=ba[n].count,ra=ba[n].index,g=pa,pa+=da;g<pa;g+=3)da=ra+c[g],T=ra+c[g+1],J=ra+c[g+2],b(da),b(T),b(J);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,array:null},d=0,g=b.length;d<
|
|
|
g;d++){var h=b[d];if(e instanceof h){f.array=new h(e);break}}a.attributes[c]=f}d=0;for(g=this.offsets.length;d<g;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()};
|
|
@@ -226,9 +226,9 @@ THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){va
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(c){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);if("scene"===h.metadata.type){console.error('THREE.JSONLoader: "'+b+'" seems to be a Scene. Use THREE.SceneLoader instead.');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error('THREE.JSONLoader: "'+b+'" seems to be unreachable or the file is empty.');a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+
|
|
|
b+'" ('+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,n,q,s,u,t,p,v,w,r=a.faces;n=a.vertices;var x=a.normals,A=a.colors,F=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=r.length;k<l;)if(b=r[k++],u=b&1,h=b&2,d=b&8,q=b&16,t=b&32,n=b&64,b&=128,u){u=new THREE.Face3;
|
|
|
-u.a=r[k];u.b=r[k+1];u.c=r[k+3];p=new THREE.Face3;p.a=r[k+1];p.b=r[k+2];p.c=r[k+3];k+=4;h&&(h=r[k++],u.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)s=r[k++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]),p.normal.copy(u.normal));if(t)for(d=0;4>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],
|
|
|
-x[q++],x[q]),2!==d&&u.vertexNormals.push(t),0!==d&&p.vertexNormals.push(t);n&&(n=r[k++],n=A[n],u.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=r[k++],n=A[n],2!==d&&u.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(u);c.faces.push(p)}else{u=new THREE.Face3;u.a=r[k++];u.b=r[k++];u.c=r[k++];h&&(h=r[k++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)s=r[k++],w=v[2*s],s=v[2*s+1],
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,n,q,s,u,t,p,v,w,r=a.faces;n=a.vertices;var x=a.normals,A=a.colors,G=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&G++;for(d=0;d<G;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=r.length;k<l;)if(b=r[k++],u=b&1,h=b&2,d=b&8,q=b&16,t=b&32,n=b&64,b&=128,u){u=new THREE.Face3;
|
|
|
+u.a=r[k];u.b=r[k+1];u.c=r[k+3];p=new THREE.Face3;p.a=r[k+1];p.b=r[k+2];p.c=r[k+3];k+=4;h&&(h=r[k++],u.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<G;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)s=r[k++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]),p.normal.copy(u.normal));if(t)for(d=0;4>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],
|
|
|
+x[q++],x[q]),2!==d&&u.vertexNormals.push(t),0!==d&&p.vertexNormals.push(t);n&&(n=r[k++],n=A[n],u.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=r[k++],n=A[n],2!==d&&u.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(u);c.faces.push(p)}else{u=new THREE.Face3;u.a=r[k++];u.b=r[k++];u.c=r[k++];h&&(h=r[k++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<G;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)s=r[k++],w=v[2*s],s=v[2*s+1],
|
|
|
w=new THREE.Vector2(w,s),c.faceVertexUvs[d][h].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]));if(t)for(d=0;3>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],x[q++],x[q]),u.vertexNormals.push(t);n&&(n=r[k++],u.color.setHex(A[n]));if(b)for(d=0;3>d;d++)n=r[k++],u.vertexColors.push(new THREE.Color(A[n]));c.faces.push(u)}})(d);(function(){if(a.skinWeights)for(var b=0,d=a.skinWeights.length;b<d;b+=2)c.skinWeights.push(new THREE.Vector4(a.skinWeights[b],a.skinWeights[b+1],0,0));if(a.skinIndices)for(b=
|
|
|
0,d=a.skinIndices.length;b<d;b+=2)c.skinIndices.push(new THREE.Vector4(a.skinIndices[b],a.skinIndices[b+1],0,0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,
|
|
|
g,h,k,l,n;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,k=n.length;h<k;h+=3){var q=new THREE.Vector3;q.x=n[h]*b;q.y=n[h+1]*b;q.z=n[h+2]*b;l.push(q)}}if(void 0!==a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,
|
|
@@ -253,19 +253,19 @@ new THREE.DirectionalLight(u,c);x.position.fromArray(r.direction);break;case "Sp
|
|
|
r.size_y}a.add(x);x.name=n;B.lights[n]=x;B.objects[n]=x}else"PerspectiveCamera"===r.type||"OrthographicCamera"===r.type?(e=r.position,g=r.rotation,l=r.quaternion,"PerspectiveCamera"===r.type?v=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):"OrthographicCamera"===r.type&&(v=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),v.name=n,v.position.fromArray(e),void 0!==l?v.quaternion.fromArray(l):void 0!==g&&v.rotation.fromArray(g),a.add(v),B.cameras[n]=v,B.objects[n]=
|
|
|
v):(e=r.position,g=r.rotation,h=r.scale,l=r.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(e),l?q.quaternion.fromArray(l):q.rotation.fromArray(g),q.scale.fromArray(h),q.visible=void 0!==r.visible?r.visible:!1,a.add(q),B.objects[n]=q,B.empties[n]=q);if(q){if(void 0!==r.userData)for(var y in r.userData)q.userData[y]=r.userData[y];if(void 0!==r.groups)for(u=0;u<r.groups.length;u++)c=r.groups[u],void 0===B.groups[c]&&(B.groups[c]=[]),B.groups[c].push(n)}}void 0!==q&&void 0!==r.children&&
|
|
|
f(q,r.children)}}function g(a,b,c,d,f){var g=f.rotation,h=f.quaternion,k=f.scale;a.position.fromArray(f.position);h?a.quaternion.fromArray(h):a.rotation.fromArray(g);a.scale.fromArray(k);d&&a.traverse(function(a){a.material=d});var l=void 0!==f.visible?f.visible:!0;a.traverse(function(a){a.visible=l});c.add(a);a.name=b;B.objects[b]=a;e()}function h(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c;e();A-=1;s.onLoadComplete();n()}}function k(a,b,c,d){return function(e){g(e.content?
|
|
|
-e.content:e.dae?e.scene:e,a,b,c,d);A-=1;s.onLoadComplete();n()}}function l(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c}}function n(){s.callbackProgress({totalModels:Q,totalTextures:I,loadedModels:Q-A,loadedTextures:I-F},B);s.onLoadProgress();if(0===A&&0===F){for(var a=0;a<z.length;a++){var c=z[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 q(a,
|
|
|
-b){b(a);if(void 0!==a.children)for(var c in a.children)q(a.children[c],b)}var s=this,u=THREE.Loader.prototype.extractUrlBase(c),t,p,v,w,r,x,A,F,Q,I,B,z=[],M=a,G;for(G in this.geometryHandlers)a=this.geometryHandlers[G].loaderClass,this.geometryHandlers[G].loaderObject=new a;for(G in this.hierarchyHandlers)a=this.hierarchyHandlers[G].loaderClass,this.hierarchyHandlers[G].loaderObject=new a;F=A=0;B={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
-lights:{},fogs:{},empties:{},groups:{}};M.transform&&(G=M.transform.position,a=M.transform.rotation,c=M.transform.scale,G&&B.scene.position.fromArray(G),a&&B.scene.rotation.fromArray(a),c&&B.scene.scale.fromArray(c),G||a||c)&&(B.scene.updateMatrix(),B.scene.updateMatrixWorld());G=function(a){return function(){F-=a;n();s.onLoadComplete()}};for(var J in M.fogs)a=M.fogs[J],"linear"===a.type?w=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(w=new THREE.FogExp2(0,a.density)),a=a.color,w.color.setRGB(a[0],
|
|
|
-a[1],a[2]),B.fogs[J]=w;for(var y in M.geometries)w=M.geometries[y],w.type in this.geometryHandlers&&(A+=1,s.onLoadStart());for(var N in M.objects)q(M.objects[N],function(a){a.type&&a.type in s.hierarchyHandlers&&(A+=1,s.onLoadStart())});Q=A;for(y in M.geometries)if(w=M.geometries[y],"cube"===w.type)t=new THREE.BoxGeometry(w.width,w.height,w.depth,w.widthSegments,w.heightSegments,w.depthSegments),t.name=y,B.geometries[y]=t;else if("plane"===w.type)t=new THREE.PlaneGeometry(w.width,w.height,w.widthSegments,
|
|
|
+e.content:e.dae?e.scene:e,a,b,c,d);A-=1;s.onLoadComplete();n()}}function l(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c}}function n(){s.callbackProgress({totalModels:Q,totalTextures:I,loadedModels:Q-A,loadedTextures:I-G},B);s.onLoadProgress();if(0===A&&0===G){for(var a=0;a<z.length;a++){var c=z[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 q(a,
|
|
|
+b){b(a);if(void 0!==a.children)for(var c in a.children)q(a.children[c],b)}var s=this,u=THREE.Loader.prototype.extractUrlBase(c),t,p,v,w,r,x,A,G,Q,I,B,z=[],M=a,H;for(H in this.geometryHandlers)a=this.geometryHandlers[H].loaderClass,this.geometryHandlers[H].loaderObject=new a;for(H in this.hierarchyHandlers)a=this.hierarchyHandlers[H].loaderClass,this.hierarchyHandlers[H].loaderObject=new a;G=A=0;B={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
+lights:{},fogs:{},empties:{},groups:{}};M.transform&&(H=M.transform.position,a=M.transform.rotation,c=M.transform.scale,H&&B.scene.position.fromArray(H),a&&B.scene.rotation.fromArray(a),c&&B.scene.scale.fromArray(c),H||a||c)&&(B.scene.updateMatrix(),B.scene.updateMatrixWorld());H=function(a){return function(){G-=a;n();s.onLoadComplete()}};for(var K in M.fogs)a=M.fogs[K],"linear"===a.type?w=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(w=new THREE.FogExp2(0,a.density)),a=a.color,w.color.setRGB(a[0],
|
|
|
+a[1],a[2]),B.fogs[K]=w;for(var y in M.geometries)w=M.geometries[y],w.type in this.geometryHandlers&&(A+=1,s.onLoadStart());for(var N in M.objects)q(M.objects[N],function(a){a.type&&a.type in s.hierarchyHandlers&&(A+=1,s.onLoadStart())});Q=A;for(y in M.geometries)if(w=M.geometries[y],"cube"===w.type)t=new THREE.BoxGeometry(w.width,w.height,w.depth,w.widthSegments,w.heightSegments,w.depthSegments),t.name=y,B.geometries[y]=t;else if("plane"===w.type)t=new THREE.PlaneGeometry(w.width,w.height,w.widthSegments,
|
|
|
w.heightSegments),t.name=y,B.geometries[y]=t;else if("sphere"===w.type)t=new THREE.SphereGeometry(w.radius,w.widthSegments,w.heightSegments),t.name=y,B.geometries[y]=t;else if("cylinder"===w.type)t=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),t.name=y,B.geometries[y]=t;else if("torus"===w.type)t=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),t.name=y,B.geometries[y]=t;else if("icosahedron"===w.type)t=new THREE.IcosahedronGeometry(w.radius,w.subdivisions),
|
|
|
-t.name=y,B.geometries[y]=t;else if(w.type in this.geometryHandlers){N={};for(r in w)"type"!==r&&"url"!==r&&(N[r]=w[r]);this.geometryHandlers[w.type].loaderObject.load(d(w.url,M.urlBaseType),h(y),N)}else"embedded"===w.type&&(N=M.embeds[w.id],N.metadata=M.metadata,N&&(N=this.geometryHandlers.ascii.loaderObject.parse(N,""),l(y)(N.geometry,N.materials)));for(var D in M.textures)if(y=M.textures[D],y.url instanceof Array)for(F+=y.url.length,r=0;r<y.url.length;r++)s.onLoadStart();else F+=1,s.onLoadStart();
|
|
|
-I=F;for(D in M.textures){y=M.textures[D];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){N=y.url.length;w=[];for(r=0;r<N;r++)w[r]=d(y.url[r],M.urlBaseType);r=(r=/\.dds$/i.test(w[0]))?THREE.ImageUtils.loadCompressedTextureCube(w,y.mapping,G(N)):THREE.ImageUtils.loadTextureCube(w,y.mapping,G(N))}else r=/\.dds$/i.test(y.url),N=d(y.url,M.urlBaseType),w=G(1),r=r?THREE.ImageUtils.loadCompressedTexture(N,y.mapping,w):THREE.ImageUtils.loadTexture(N,
|
|
|
+t.name=y,B.geometries[y]=t;else if(w.type in this.geometryHandlers){N={};for(r in w)"type"!==r&&"url"!==r&&(N[r]=w[r]);this.geometryHandlers[w.type].loaderObject.load(d(w.url,M.urlBaseType),h(y),N)}else"embedded"===w.type&&(N=M.embeds[w.id],N.metadata=M.metadata,N&&(N=this.geometryHandlers.ascii.loaderObject.parse(N,""),l(y)(N.geometry,N.materials)));for(var E in M.textures)if(y=M.textures[E],y.url instanceof Array)for(G+=y.url.length,r=0;r<y.url.length;r++)s.onLoadStart();else G+=1,s.onLoadStart();
|
|
|
+I=G;for(E in M.textures){y=M.textures[E];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){N=y.url.length;w=[];for(r=0;r<N;r++)w[r]=d(y.url[r],M.urlBaseType);r=(r=/\.dds$/i.test(w[0]))?THREE.ImageUtils.loadCompressedTextureCube(w,y.mapping,H(N)):THREE.ImageUtils.loadTextureCube(w,y.mapping,H(N))}else r=/\.dds$/i.test(y.url),N=d(y.url,M.urlBaseType),w=H(1),r=r?THREE.ImageUtils.loadCompressedTexture(N,y.mapping,w):THREE.ImageUtils.loadTexture(N,
|
|
|
y.mapping,w),void 0!==THREE[y.minFilter]&&(r.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(r.magFilter=THREE[y.magFilter]),y.anisotropy&&(r.anisotropy=y.anisotropy),y.repeat&&(r.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),y.offset&&r.offset.set(y.offset[0],y.offset[1]),y.wrap&&(N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==N[y.wrap[0]]&&(r.wrapS=N[y.wrap[0]]),void 0!==
|
|
|
-N[y.wrap[1]]&&(r.wrapT=N[y.wrap[1]]));B.textures[D]=r}var E,C;for(E in M.materials){D=M.materials[E];for(C in D.parameters)"envMap"===C||"map"===C||"lightMap"===C||"bumpMap"===C?D.parameters[C]=B.textures[D.parameters[C]]:"shading"===C?D.parameters[C]="flat"===D.parameters[C]?THREE.FlatShading:THREE.SmoothShading:"side"===C?D.parameters[C]="double"==D.parameters[C]?THREE.DoubleSide:"back"==D.parameters[C]?THREE.BackSide:THREE.FrontSide:"blending"===C?D.parameters[C]=D.parameters[C]in THREE?THREE[D.parameters[C]]:
|
|
|
-THREE.NormalBlending:"combine"===C?D.parameters[C]=D.parameters[C]in THREE?THREE[D.parameters[C]]:THREE.MultiplyOperation:"vertexColors"===C?"face"==D.parameters[C]?D.parameters[C]=THREE.FaceColors:D.parameters[C]&&(D.parameters[C]=THREE.VertexColors):"wrapRGB"===C&&(G=D.parameters[C],D.parameters[C]=new THREE.Vector3(G[0],G[1],G[2]));void 0!==D.parameters.opacity&&1>D.parameters.opacity&&(D.parameters.transparent=!0);D.parameters.normalMap?(G=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(G.uniforms),
|
|
|
-r=D.parameters.color,N=D.parameters.specular,w=D.parameters.ambient,J=D.parameters.shininess,y.tNormal.value=B.textures[D.parameters.normalMap],D.parameters.normalScale&&y.uNormalScale.value.set(D.parameters.normalScale[0],D.parameters.normalScale[1]),D.parameters.map&&(y.tDiffuse.value=D.parameters.map,y.enableDiffuse.value=!0),D.parameters.envMap&&(y.tCube.value=D.parameters.envMap,y.enableReflection.value=!0,y.reflectivity.value=D.parameters.reflectivity),D.parameters.lightMap&&(y.tAO.value=D.parameters.lightMap,
|
|
|
-y.enableAO.value=!0),D.parameters.specularMap&&(y.tSpecular.value=B.textures[D.parameters.specularMap],y.enableSpecular.value=!0),D.parameters.displacementMap&&(y.tDisplacement.value=B.textures[D.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=D.parameters.displacementBias,y.uDisplacementScale.value=D.parameters.displacementScale),y.diffuse.value.setHex(r),y.specular.value.setHex(N),y.ambient.value.setHex(w),y.shininess.value=J,D.parameters.opacity&&(y.opacity.value=
|
|
|
-D.parameters.opacity),p=new THREE.ShaderMaterial({fragmentShader:G.fragmentShader,vertexShader:G.vertexShader,uniforms:y,lights:!0,fog:!0})):p=new THREE[D.type](D.parameters);p.name=E;B.materials[E]=p}for(E in M.materials)if(D=M.materials[E],D.parameters.materials){C=[];for(r=0;r<D.parameters.materials.length;r++)C.push(B.materials[D.parameters.materials[r]]);B.materials[E].materials=C}e();B.cameras&&M.defaults.camera&&(B.currentCamera=B.cameras[M.defaults.camera]);B.fogs&&M.defaults.fog&&(B.scene.fog=
|
|
|
+N[y.wrap[1]]&&(r.wrapT=N[y.wrap[1]]));B.textures[E]=r}var F,C;for(F in M.materials){E=M.materials[F];for(C in E.parameters)"envMap"===C||"map"===C||"lightMap"===C||"bumpMap"===C?E.parameters[C]=B.textures[E.parameters[C]]:"shading"===C?E.parameters[C]="flat"===E.parameters[C]?THREE.FlatShading:THREE.SmoothShading:"side"===C?E.parameters[C]="double"==E.parameters[C]?THREE.DoubleSide:"back"==E.parameters[C]?THREE.BackSide:THREE.FrontSide:"blending"===C?E.parameters[C]=E.parameters[C]in THREE?THREE[E.parameters[C]]:
|
|
|
+THREE.NormalBlending:"combine"===C?E.parameters[C]=E.parameters[C]in THREE?THREE[E.parameters[C]]:THREE.MultiplyOperation:"vertexColors"===C?"face"==E.parameters[C]?E.parameters[C]=THREE.FaceColors:E.parameters[C]&&(E.parameters[C]=THREE.VertexColors):"wrapRGB"===C&&(H=E.parameters[C],E.parameters[C]=new THREE.Vector3(H[0],H[1],H[2]));void 0!==E.parameters.opacity&&1>E.parameters.opacity&&(E.parameters.transparent=!0);E.parameters.normalMap?(H=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(H.uniforms),
|
|
|
+r=E.parameters.color,N=E.parameters.specular,w=E.parameters.ambient,K=E.parameters.shininess,y.tNormal.value=B.textures[E.parameters.normalMap],E.parameters.normalScale&&y.uNormalScale.value.set(E.parameters.normalScale[0],E.parameters.normalScale[1]),E.parameters.map&&(y.tDiffuse.value=E.parameters.map,y.enableDiffuse.value=!0),E.parameters.envMap&&(y.tCube.value=E.parameters.envMap,y.enableReflection.value=!0,y.reflectivity.value=E.parameters.reflectivity),E.parameters.lightMap&&(y.tAO.value=E.parameters.lightMap,
|
|
|
+y.enableAO.value=!0),E.parameters.specularMap&&(y.tSpecular.value=B.textures[E.parameters.specularMap],y.enableSpecular.value=!0),E.parameters.displacementMap&&(y.tDisplacement.value=B.textures[E.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=E.parameters.displacementBias,y.uDisplacementScale.value=E.parameters.displacementScale),y.diffuse.value.setHex(r),y.specular.value.setHex(N),y.ambient.value.setHex(w),y.shininess.value=K,E.parameters.opacity&&(y.opacity.value=
|
|
|
+E.parameters.opacity),p=new THREE.ShaderMaterial({fragmentShader:H.fragmentShader,vertexShader:H.vertexShader,uniforms:y,lights:!0,fog:!0})):p=new THREE[E.type](E.parameters);p.name=F;B.materials[F]=p}for(F in M.materials)if(E=M.materials[F],E.parameters.materials){C=[];for(r=0;r<E.parameters.materials.length;r++)C.push(B.materials[E.parameters.materials[r]]);B.materials[F].materials=C}e();B.cameras&&M.defaults.camera&&(B.currentCamera=B.cameras[M.defaults.camera]);B.fogs&&M.defaults.fog&&(B.scene.fog=
|
|
|
B.fogs[M.defaults.fog]);s.callbackSync(B);n()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){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);
|
|
@@ -303,34 +303,34 @@ THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/th
|
|
|
(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};
|
|
|
THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a});this.add(a)};THREE.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;b<c&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object};
|
|
|
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(a){void 0===a&&(a=new THREE.LOD);THREE.Object3D.prototype.clone.call(this,a);for(var b=0,c=this.objects.length;b<c;b++){var d=this.objects[b].object.clone();d.visible=0===b;a.addLevel(d,this.objects[b].distance)}return a};THREE.Sprite=function(a){THREE.Object3D.call(this);this.geometry={boundingSphere:new THREE.Sphere(new THREE.Vector3,0.5)};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.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object3D.prototype.clone.call(this,a);for(var b=0,c=this.objects.length;b<c;b++){var d=this.objects[b].object.clone();d.visible=0===b;a.addLevel(d,this.objects[b].distance)}return a};THREE.Sprite=function(a){THREE.Object3D.call(this);this.geometry={boundingSphere:new THREE.Sphere(new THREE.Vector3,0.5),addEventListener:function(){}};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=Q.length;d<e;d++){var f=Q[d];ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=fa.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(ka.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=fa.setFromMatrixPosition(f.matrixWorld),h=b.dot(fa.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(ka.multiplyScalar(h)))))}}
|
|
|
-function c(a,b,c,d){s(b);u(c);t(d);p(a.getStyle());y.stroke();la.expandByScalar(2*b)}function d(a){v(a.getStyle());y.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);Ma[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
-function g(a,b,c,d,g,h,m,k,l,p,n,r,q){if(!(q instanceof THREE.DataTexture)){!1===q.hasEventListener("update",e)&&(void 0!==q.image&&0<q.image.width&&f(q),q.addEventListener("update",e));var s=Ma[q.id];if(void 0!==s){v(s);var s=q.offset.x/q.repeat.x,u=q.offset.y/q.repeat.y,t=q.image.width*q.repeat.x;q=q.image.height*q.repeat.y;m=(m+s)*t;k=(k+u)*q;c-=a;d-=b;g-=a;h-=b;l=(l+s)*t-m;p=(p+u)*q-k;n=(n+s)*t-m;r=(r+u)*q-k;q=l*r-n*p;0!==q&&(s=1/q,q=(r*c-p*g)*s,p=(r*d-p*h)*s,c=(l*g-n*c)*s,d=(l*h-n*d)*s,a=a-q*
|
|
|
-m-c*k,b=b-p*m-d*k,y.save(),y.transform(q,p,c,d,a,b),y.fill(),y.restore())}else v("rgba(0,0,0,1)"),y.fill()}}function h(a,b,c,d,e,f,g,h,m,k,l,p,n){var q,r;q=n.width-1;r=n.height-1;g*=q;h*=r;c-=a;d-=b;e-=a;f-=b;m=m*q-g;k=k*r-h;l=l*q-g;p=p*r-h;r=1/(m*p-l*k);q=(p*c-k*e)*r;k=(p*d-k*f)*r;c=(m*e-l*c)*r;d=(m*f-l*d)*r;a=a-q*g-c*h;b=b-k*g-d*h;y.save();y.transform(q,k,c,d,a,b);y.clip();y.drawImage(n,0,0);y.restore()}function k(a,b,c,d){da[0]=255*a.r|0;da[1]=255*a.g|0;da[2]=255*a.b|0;da[4]=255*b.r|0;da[5]=255*
|
|
|
-b.g|0;da[6]=255*b.b|0;da[8]=255*c.r|0;da[9]=255*c.g|0;da[10]=255*c.b|0;da[12]=255*d.r|0;da[13]=255*d.g|0;da[14]=255*d.b|0;Ia.putImageData(hb,0,0);Wa.drawImage(m,0,0);return Na}function l(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 n(a){E!==a&&(E=y.globalAlpha=a)}function q(a){C!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
-(y.globalCompositeOperation="darker"),C=a)}function s(a){T!==a&&(T=y.lineWidth=a)}function u(a){ja!==a&&(ja=y.lineCap=a)}function t(a){W!==a&&(W=y.lineJoin=a)}function p(a){L!==a&&(L=y.strokeStyle=a)}function v(a){Y!==a&&(Y=y.fillStyle=a)}function w(a,b){if(na!==a||R!==b)y.setLineDash([a,b]),na=a,R=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var r=THREE.Math.smoothstep;a=a||{};var x=this,A,F,Q,I=new THREE.Projector,B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),z=B.width,M=
|
|
|
-B.height,G=Math.floor(z/2),J=Math.floor(M/2),y=B.getContext("2d"),N=new THREE.Color(0),D=0,E=1,C=0,L=null,Y=null,T=null,ja=null,W=null,na=null,R=0,ea,S,O,H;new THREE.RenderableVertex;new THREE.RenderableVertex;var pa,U,La,va,wa,Fa,ca=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,ya=new THREE.Color,Ba=new THREE.Color,Ha=new THREE.Color,Ya=new THREE.Color,ka=new THREE.Color,Ma={},Ga,qa,ra,Aa,Ca,Da,Oa,Pa,Qa,gb,Ea=new THREE.Box2,Z=new THREE.Box2,la=new THREE.Box2,ib=new THREE.Color,zb=new THREE.Color,
|
|
|
-ua=new THREE.Color,fa=new THREE.Vector3,ga=new THREE.Vector3,Ra=new THREE.Matrix3,m,Ia,hb,da,Na,Wa,Sa=16;m=document.createElement("canvas");m.width=m.height=2;Ia=m.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);hb=Ia.getImageData(0,0,2,2);da=hb.data;Na=document.createElement("canvas");Na.width=Na.height=Sa;Wa=Na.getContext("2d");Wa.translate(-Sa/2,-Sa/2);Wa.scale(Sa,Sa);Sa--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});
|
|
|
-this.domElement=B;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;M=b*this.devicePixelRatio;G=Math.floor(z/2);J=Math.floor(M/2);B.width=z;B.height=M;1!==this.devicePixelRatio&&!1!==c&&(B.style.width=a+"px",
|
|
|
-B.style.height=b+"px");Ea.min.set(-G,-J);Ea.max.set(G,J);Z.min.set(-G,-J);Z.max.set(G,J);E=1;C=0;W=ja=T=Y=L=null};this.setClearColor=function(a,b){N.set(a);D=void 0!==b?b:1;Z.min.set(-G,-J);Z.max.set(G,J)};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(){y.setTransform(1,0,0,-1,G,J);!1===Z.empty()&&(Z.intersect(Ea),Z.expandByScalar(2),
|
|
|
-1>D&&y.clearRect(Z.min.x|0,Z.min.y|0,Z.max.x-Z.min.x|0,Z.max.y-Z.min.y|0),0<D&&(q(THREE.NormalBlending),n(1),v("rgba("+Math.floor(255*N.r)+","+Math.floor(255*N.g)+","+Math.floor(255*N.b)+","+D+")"),y.fillRect(Z.min.x|0,Z.min.y|0,Z.max.x-Z.min.x|0,Z.max.y-Z.min.y|0)),Z.makeEmpty())};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,m){if(!1===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,G,J);x.info.render.vertices=0;x.info.render.faces=0;A=I.projectScene(a,m,this.sortObjects,this.sortElements);F=A.elements;Q=A.lights;ea=m;Ra.getNormalMatrix(m.matrixWorldInverse);ib.setRGB(0,0,0);zb.setRGB(0,0,0);ua.setRGB(0,0,0);for(var B=0,M=Q.length;B<M;B++){var D=Q[B],z=D.color;D instanceof THREE.AmbientLight?ib.add(z):D instanceof THREE.DirectionalLight?zb.add(z):D instanceof THREE.PointLight&&ua.add(z)}B=0;for(M=F.length;B<M;B++){var C=
|
|
|
-F[B],E=C.material;if(void 0!==E&&!1!==E.visible){la.makeEmpty();if(C instanceof THREE.RenderableSprite){S=C;S.x*=G;S.y*=J;D=S;z=E;n(z.opacity);q(z.blending);var N=C.scale.x*G,C=C.scale.y*J,E=0.5*Math.sqrt(N*N+C*C);la.min.set(D.x-E,D.y-E);la.max.set(D.x+E,D.y+E);if(z instanceof THREE.SpriteMaterial||z instanceof THREE.ParticleSystemMaterial){var L=z.map;if(null!==L){!1===L.hasEventListener("update",e)&&(void 0!==L.image&&0<L.image.width&&f(L),L.addEventListener("update",e));E=Ma[L.id];void 0!==E?v(E):
|
|
|
-v("rgba( 0, 0, 0, 1 )");var R=L.image,E=R.width*L.offset.x,T=R.height*L.offset.y,Y=R.width*L.repeat.x,L=R.height*L.repeat.y,R=N/Y,W=C/L;y.save();y.translate(D.x,D.y);0!==z.rotation&&y.rotate(z.rotation);y.translate(-N/2,-C/2);y.scale(R,W);y.translate(-E,-T);y.fillRect(E,T,Y,L)}else v(z.color.getStyle()),y.save(),y.translate(D.x,D.y),0!==z.rotation&&y.rotate(z.rotation),y.scale(N,-C),y.fillRect(-0.5,-0.5,1,1);y.restore()}else z instanceof THREE.SpriteCanvasMaterial&&(p(z.color.getStyle()),v(z.color.getStyle()),
|
|
|
-y.save(),y.translate(D.x,D.y),0!==z.rotation&&y.rotate(z.rotation),y.scale(N,C),z.program(y),y.restore())}else if(C instanceof THREE.RenderableLine){if(S=C.v1,O=C.v2,S.positionScreen.x*=G,S.positionScreen.y*=J,O.positionScreen.x*=G,O.positionScreen.y*=J,la.setFromPoints([S.positionScreen,O.positionScreen]),!0===Ea.isIntersectionBox(la))if(D=S,z=O,N=C,C=E,n(C.opacity),q(C.blending),y.beginPath(),y.moveTo(D.positionScreen.x,D.positionScreen.y),y.lineTo(z.positionScreen.x,z.positionScreen.y),C instanceof
|
|
|
-THREE.LineBasicMaterial){s(C.linewidth);u(C.linecap);t(C.linejoin);if(C.vertexColors!==THREE.VertexColors)p(C.color.getStyle());else if(E=N.vertexColors[0].getStyle(),N=N.vertexColors[1].getStyle(),E===N)p(E);else{try{var fa=y.createLinearGradient(D.positionScreen.x,D.positionScreen.y,z.positionScreen.x,z.positionScreen.y);fa.addColorStop(0,E);fa.addColorStop(1,N)}catch(ka){fa=E}p(fa)}y.stroke();la.expandByScalar(2*C.linewidth)}else C instanceof THREE.LineDashedMaterial&&(s(C.linewidth),u(C.linecap),
|
|
|
-t(C.linejoin),p(C.color.getStyle()),w(C.dashSize,C.gapSize),y.stroke(),la.expandByScalar(2*C.linewidth),w(null,null))}else if(C instanceof THREE.RenderableFace3){S=C.v1;O=C.v2;H=C.v3;if(-1>S.positionScreen.z||1<S.positionScreen.z)continue;if(-1>O.positionScreen.z||1<O.positionScreen.z)continue;if(-1>H.positionScreen.z||1<H.positionScreen.z)continue;S.positionScreen.x*=G;S.positionScreen.y*=J;O.positionScreen.x*=G;O.positionScreen.y*=J;H.positionScreen.x*=G;H.positionScreen.y*=J;0<E.overdraw&&(l(S.positionScreen,
|
|
|
-O.positionScreen,E.overdraw),l(O.positionScreen,H.positionScreen,E.overdraw),l(H.positionScreen,S.positionScreen,E.overdraw));la.setFromPoints([S.positionScreen,O.positionScreen,H.positionScreen]);if(!0===Ea.isIntersectionBox(la)){D=S;z=O;N=H;x.info.render.vertices+=3;x.info.render.faces++;n(E.opacity);q(E.blending);pa=D.positionScreen.x;U=D.positionScreen.y;La=z.positionScreen.x;va=z.positionScreen.y;wa=N.positionScreen.x;Fa=N.positionScreen.y;var T=pa,Y=U,L=La,R=va,W=wa,tc=Fa;y.beginPath();y.moveTo(T,
|
|
|
-Y);y.lineTo(L,R);y.lineTo(W,tc);y.closePath();(E instanceof THREE.MeshLambertMaterial||E instanceof THREE.MeshPhongMaterial)&&null===E.map?(Ha.copy(E.color),Ya.copy(E.emissive),E.vertexColors===THREE.FaceColors&&Ha.multiply(C.color),!1===E.wireframe&&E.shading===THREE.SmoothShading&&3===C.vertexNormalsLength?(za.copy(ib),xa.copy(ib),ya.copy(ib),b(C.v1.positionWorld,C.vertexNormalsModel[0],za),b(C.v2.positionWorld,C.vertexNormalsModel[1],xa),b(C.v3.positionWorld,C.vertexNormalsModel[2],ya),za.multiply(Ha).add(Ya),
|
|
|
-xa.multiply(Ha).add(Ya),ya.multiply(Ha).add(Ya),Ba.addColors(xa,ya).multiplyScalar(0.5),ra=k(za,xa,ya,Ba),h(pa,U,La,va,wa,Fa,0,0,1,0,0,1,ra)):(ca.copy(ib),b(C.centroidModel,C.normalModel,ca),ca.multiply(Ha).add(Ya),!0===E.wireframe?c(ca,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):d(ca))):E instanceof THREE.MeshBasicMaterial||E instanceof THREE.MeshLambertMaterial||E instanceof THREE.MeshPhongMaterial?null!==E.map?E.map.mapping instanceof THREE.UVMapping&&(Aa=C.uvs[0],g(pa,U,La,va,
|
|
|
-wa,Fa,Aa[0].x,Aa[0].y,Aa[1].x,Aa[1].y,Aa[2].x,Aa[2].y,E.map)):null!==E.envMap?E.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ga.copy(C.vertexNormalsModel[0]).applyMatrix3(Ra),Ca=0.5*ga.x+0.5,Da=0.5*ga.y+0.5,ga.copy(C.vertexNormalsModel[1]).applyMatrix3(Ra),Oa=0.5*ga.x+0.5,Pa=0.5*ga.y+0.5,ga.copy(C.vertexNormalsModel[2]).applyMatrix3(Ra),Qa=0.5*ga.x+0.5,gb=0.5*ga.y+0.5,g(pa,U,La,va,wa,Fa,Ca,Da,Oa,Pa,Qa,gb,E.envMap)):(ca.copy(E.color),E.vertexColors===THREE.FaceColors&&ca.multiply(C.color),
|
|
|
-!0===E.wireframe?c(ca,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):d(ca)):E instanceof THREE.MeshDepthMaterial?(Ga=ea.near,qa=ea.far,za.r=za.g=za.b=1-r(D.positionScreen.z*D.positionScreen.w,Ga,qa),xa.r=xa.g=xa.b=1-r(z.positionScreen.z*z.positionScreen.w,Ga,qa),ya.r=ya.g=ya.b=1-r(N.positionScreen.z*N.positionScreen.w,Ga,qa),Ba.addColors(xa,ya).multiplyScalar(0.5),ra=k(za,xa,ya,Ba),h(pa,U,La,va,wa,Fa,0,0,1,0,0,1,ra)):E instanceof THREE.MeshNormalMaterial&&(E.shading===THREE.FlatShading?
|
|
|
-(ga.copy(C.normalModel).applyMatrix3(Ra),ca.setRGB(ga.x,ga.y,ga.z).multiplyScalar(0.5).addScalar(0.5),!0===E.wireframe?c(ca,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):d(ca)):E.shading===THREE.SmoothShading&&(ga.copy(C.vertexNormalsModel[0]).applyMatrix3(Ra),za.setRGB(ga.x,ga.y,ga.z).multiplyScalar(0.5).addScalar(0.5),ga.copy(C.vertexNormalsModel[1]).applyMatrix3(Ra),xa.setRGB(ga.x,ga.y,ga.z).multiplyScalar(0.5).addScalar(0.5),ga.copy(C.vertexNormalsModel[2]).applyMatrix3(Ra),ya.setRGB(ga.x,
|
|
|
-ga.y,ga.z).multiplyScalar(0.5).addScalar(0.5),Ba.addColors(xa,ya).multiplyScalar(0.5),ra=k(za,xa,ya,Ba),h(pa,U,La,va,wa,Fa,0,0,1,0,0,1,ra)))}}Z.union(la)}}y.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=Q.length;d<e;d++){var f=Q[d];Ta.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ea.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Ta.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=ea.setFromMatrixPosition(f.matrixWorld),h=b.dot(ea.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Ta.multiplyScalar(h)))))}}
|
|
|
+function c(a,b,c,d){s(b);u(c);t(d);p(a.getStyle());y.stroke();Na.expandByScalar(2*b)}function d(a){v(a.getStyle());y.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);la[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
+function g(a,b,c,d,g,h,m,k,l,p,n,r,q){if(!(q instanceof THREE.DataTexture)){!1===q.hasEventListener("update",e)&&(void 0!==q.image&&0<q.image.width&&f(q),q.addEventListener("update",e));var s=la[q.id];if(void 0!==s){v(s);var s=q.offset.x/q.repeat.x,u=q.offset.y/q.repeat.y,t=q.image.width*q.repeat.x;q=q.image.height*q.repeat.y;m=(m+s)*t;k=(k+u)*q;c-=a;d-=b;g-=a;h-=b;l=(l+s)*t-m;p=(p+u)*q-k;n=(n+s)*t-m;r=(r+u)*q-k;q=l*r-n*p;0!==q&&(s=1/q,q=(r*c-p*g)*s,p=(r*d-p*h)*s,c=(l*g-n*c)*s,d=(l*h-n*d)*s,a=a-q*
|
|
|
+m-c*k,b=b-p*m-d*k,y.save(),y.transform(q,p,c,d,a,b),y.fill(),y.restore())}else v("rgba(0,0,0,1)"),y.fill()}}function h(a,b,c,d,e,f,g,h,m,k,l,p,n){var q,r;q=n.width-1;r=n.height-1;g*=q;h*=r;c-=a;d-=b;e-=a;f-=b;m=m*q-g;k=k*r-h;l=l*q-g;p=p*r-h;r=1/(m*p-l*k);q=(p*c-k*e)*r;k=(p*d-k*f)*r;c=(m*e-l*c)*r;d=(m*f-l*d)*r;a=a-q*g-c*h;b=b-k*g-d*h;y.save();y.transform(q,k,c,d,a,b);y.clip();y.drawImage(n,0,0);y.restore()}function k(a,b,c,d){xa[0]=255*a.r|0;xa[1]=255*a.g|0;xa[2]=255*a.b|0;xa[4]=255*b.r|0;xa[5]=255*
|
|
|
+b.g|0;xa[6]=255*b.b|0;xa[8]=255*c.r|0;xa[9]=255*c.g|0;xa[10]=255*c.b|0;xa[12]=255*d.r|0;xa[13]=255*d.g|0;xa[14]=255*d.b|0;Ha.putImageData(hb,0,0);Xa.drawImage(m,0,0);return ta}function l(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 n(a){F!==a&&(F=y.globalAlpha=a)}function q(a){C!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
+(y.globalCompositeOperation="darker"),C=a)}function s(a){R!==a&&(R=y.lineWidth=a)}function u(a){ja!==a&&(ja=y.lineCap=a)}function t(a){W!==a&&(W=y.lineJoin=a)}function p(a){O!==a&&(O=y.strokeStyle=a)}function v(a){X!==a&&(X=y.fillStyle=a)}function w(a,b){if(pa!==a||D!==b)y.setLineDash([a,b]),pa=a,D=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var r=THREE.Math.smoothstep;a=a||{};var x=this,A,G,Q,I=new THREE.Projector,B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),z=B.width,M=
|
|
|
+B.height,H=Math.floor(z/2),K=Math.floor(M/2),y=B.getContext("2d"),N=new THREE.Color(0),E=0,F=1,C=0,O=null,X=null,R=null,ja=null,W=null,pa=null,D=0,da,T,J,ba;new THREE.RenderableVertex;new THREE.RenderableVertex;var ra,S,Oa,za,$,Fa,oa=new THREE.Color,Ca=new THREE.Color,Aa=new THREE.Color,Ba=new THREE.Color,Da=new THREE.Color,Sa=new THREE.Color,ka=new THREE.Color,Ta=new THREE.Color,la={},va,Ka,La,Ga,ca,wa,Ma,Pa,Qa,ma,Ea=new THREE.Box2,ha=new THREE.Box2,Na=new THREE.Box2,ib=new THREE.Color,zb=new THREE.Color,
|
|
|
+ya=new THREE.Color,ea=new THREE.Vector3,fa=new THREE.Vector3,Ra=new THREE.Matrix3,m,Ha,hb,xa,ta,Xa,db=16;m=document.createElement("canvas");m.width=m.height=2;Ha=m.getContext("2d");Ha.fillStyle="rgba(0,0,0,1)";Ha.fillRect(0,0,2,2);hb=Ha.getImageData(0,0,2,2);xa=hb.data;ta=document.createElement("canvas");ta.width=ta.height=db;Xa=ta.getContext("2d");Xa.translate(-db/2,-db/2);Xa.scale(db,db);db--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});
|
|
|
+this.domElement=B;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;M=b*this.devicePixelRatio;H=Math.floor(z/2);K=Math.floor(M/2);B.width=z;B.height=M;1!==this.devicePixelRatio&&!1!==c&&(B.style.width=a+"px",
|
|
|
+B.style.height=b+"px");Ea.min.set(-H,-K);Ea.max.set(H,K);ha.min.set(-H,-K);ha.max.set(H,K);F=1;C=0;W=ja=R=X=O=null};this.setClearColor=function(a,b){N.set(a);E=void 0!==b?b:1;ha.min.set(-H,-K);ha.max.set(H,K)};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(){y.setTransform(1,0,0,-1,H,K);!1===ha.empty()&&(ha.intersect(Ea),ha.expandByScalar(2),
|
|
|
+1>E&&y.clearRect(ha.min.x|0,ha.min.y|0,ha.max.x-ha.min.x|0,ha.max.y-ha.min.y|0),0<E&&(q(THREE.NormalBlending),n(1),v("rgba("+Math.floor(255*N.r)+","+Math.floor(255*N.g)+","+Math.floor(255*N.b)+","+E+")"),y.fillRect(ha.min.x|0,ha.min.y|0,ha.max.x-ha.min.x|0,ha.max.y-ha.min.y|0)),ha.makeEmpty())};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,m){if(!1===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,H,K);x.info.render.vertices=0;x.info.render.faces=0;A=I.projectScene(a,m,this.sortObjects,this.sortElements);G=A.elements;Q=A.lights;da=m;Ra.getNormalMatrix(m.matrixWorldInverse);ib.setRGB(0,0,0);zb.setRGB(0,0,0);ya.setRGB(0,0,0);for(var B=0,M=Q.length;B<M;B++){var E=Q[B],z=E.color;E instanceof THREE.AmbientLight?ib.add(z):E instanceof THREE.DirectionalLight?zb.add(z):E instanceof THREE.PointLight&&ya.add(z)}B=0;for(M=G.length;B<M;B++){var C=
|
|
|
+G[B],F=C.material;if(void 0!==F&&!1!==F.visible){Na.makeEmpty();if(C instanceof THREE.RenderableSprite){T=C;T.x*=H;T.y*=K;E=T;z=F;n(z.opacity);q(z.blending);var N=C.scale.x*H,C=C.scale.y*K,F=0.5*Math.sqrt(N*N+C*C);Na.min.set(E.x-F,E.y-F);Na.max.set(E.x+F,E.y+F);if(z instanceof THREE.SpriteMaterial||z instanceof THREE.ParticleSystemMaterial){var D=z.map;if(null!==D){!1===D.hasEventListener("update",e)&&(void 0!==D.image&&0<D.image.width&&f(D),D.addEventListener("update",e));F=la[D.id];void 0!==F?v(F):
|
|
|
+v("rgba( 0, 0, 0, 1 )");var O=D.image,F=O.width*D.offset.x,R=O.height*D.offset.y,X=O.width*D.repeat.x,D=O.height*D.repeat.y,O=N/X,W=C/D;y.save();y.translate(E.x,E.y);0!==z.rotation&&y.rotate(z.rotation);y.translate(-N/2,-C/2);y.scale(O,W);y.translate(-F,-R);y.fillRect(F,R,X,D)}else v(z.color.getStyle()),y.save(),y.translate(E.x,E.y),0!==z.rotation&&y.rotate(z.rotation),y.scale(N,-C),y.fillRect(-0.5,-0.5,1,1);y.restore()}else z instanceof THREE.SpriteCanvasMaterial&&(p(z.color.getStyle()),v(z.color.getStyle()),
|
|
|
+y.save(),y.translate(E.x,E.y),0!==z.rotation&&y.rotate(z.rotation),y.scale(N,C),z.program(y),y.restore())}else if(C instanceof THREE.RenderableLine){if(T=C.v1,J=C.v2,T.positionScreen.x*=H,T.positionScreen.y*=K,J.positionScreen.x*=H,J.positionScreen.y*=K,Na.setFromPoints([T.positionScreen,J.positionScreen]),!0===Ea.isIntersectionBox(Na))if(E=T,z=J,N=C,C=F,n(C.opacity),q(C.blending),y.beginPath(),y.moveTo(E.positionScreen.x,E.positionScreen.y),y.lineTo(z.positionScreen.x,z.positionScreen.y),C instanceof
|
|
|
+THREE.LineBasicMaterial){s(C.linewidth);u(C.linecap);t(C.linejoin);if(C.vertexColors!==THREE.VertexColors)p(C.color.getStyle());else if(F=N.vertexColors[0].getStyle(),N=N.vertexColors[1].getStyle(),F===N)p(F);else{try{var ea=y.createLinearGradient(E.positionScreen.x,E.positionScreen.y,z.positionScreen.x,z.positionScreen.y);ea.addColorStop(0,F);ea.addColorStop(1,N)}catch(ja){ea=F}p(ea)}y.stroke();Na.expandByScalar(2*C.linewidth)}else C instanceof THREE.LineDashedMaterial&&(s(C.linewidth),u(C.linecap),
|
|
|
+t(C.linejoin),p(C.color.getStyle()),w(C.dashSize,C.gapSize),y.stroke(),Na.expandByScalar(2*C.linewidth),w(null,null))}else if(C instanceof THREE.RenderableFace){T=C.v1;J=C.v2;ba=C.v3;if(-1>T.positionScreen.z||1<T.positionScreen.z)continue;if(-1>J.positionScreen.z||1<J.positionScreen.z)continue;if(-1>ba.positionScreen.z||1<ba.positionScreen.z)continue;T.positionScreen.x*=H;T.positionScreen.y*=K;J.positionScreen.x*=H;J.positionScreen.y*=K;ba.positionScreen.x*=H;ba.positionScreen.y*=K;0<F.overdraw&&
|
|
|
+(l(T.positionScreen,J.positionScreen,F.overdraw),l(J.positionScreen,ba.positionScreen,F.overdraw),l(ba.positionScreen,T.positionScreen,F.overdraw));Na.setFromPoints([T.positionScreen,J.positionScreen,ba.positionScreen]);if(!0===Ea.isIntersectionBox(Na)){E=T;z=J;N=ba;x.info.render.vertices+=3;x.info.render.faces++;n(F.opacity);q(F.blending);ra=E.positionScreen.x;S=E.positionScreen.y;Oa=z.positionScreen.x;za=z.positionScreen.y;$=N.positionScreen.x;Fa=N.positionScreen.y;var R=ra,X=S,D=Oa,O=za,W=$,tc=
|
|
|
+Fa;y.beginPath();y.moveTo(R,X);y.lineTo(D,O);y.lineTo(W,tc);y.closePath();(F instanceof THREE.MeshLambertMaterial||F instanceof THREE.MeshPhongMaterial)&&null===F.map?(Sa.copy(F.color),ka.copy(F.emissive),F.vertexColors===THREE.FaceColors&&Sa.multiply(C.color),!1===F.wireframe&&F.shading===THREE.SmoothShading&&3===C.vertexNormalsLength?(Ca.copy(ib),Aa.copy(ib),Ba.copy(ib),b(C.v1.positionWorld,C.vertexNormalsModel[0],Ca),b(C.v2.positionWorld,C.vertexNormalsModel[1],Aa),b(C.v3.positionWorld,C.vertexNormalsModel[2],
|
|
|
+Ba),Ca.multiply(Sa).add(ka),Aa.multiply(Sa).add(ka),Ba.multiply(Sa).add(ka),Da.addColors(Aa,Ba).multiplyScalar(0.5),La=k(Ca,Aa,Ba,Da),h(ra,S,Oa,za,$,Fa,0,0,1,0,0,1,La)):(oa.copy(ib),b(C.centroidModel,C.normalModel,oa),oa.multiply(Sa).add(ka),!0===F.wireframe?c(oa,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(oa))):F instanceof THREE.MeshBasicMaterial||F instanceof THREE.MeshLambertMaterial||F instanceof THREE.MeshPhongMaterial?null!==F.map?F.map.mapping instanceof THREE.UVMapping&&
|
|
|
+(Ga=C.uvs[0],g(ra,S,Oa,za,$,Fa,Ga[0].x,Ga[0].y,Ga[1].x,Ga[1].y,Ga[2].x,Ga[2].y,F.map)):null!==F.envMap?F.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(fa.copy(C.vertexNormalsModel[0]).applyMatrix3(Ra),ca=0.5*fa.x+0.5,wa=0.5*fa.y+0.5,fa.copy(C.vertexNormalsModel[1]).applyMatrix3(Ra),Ma=0.5*fa.x+0.5,Pa=0.5*fa.y+0.5,fa.copy(C.vertexNormalsModel[2]).applyMatrix3(Ra),Qa=0.5*fa.x+0.5,ma=0.5*fa.y+0.5,g(ra,S,Oa,za,$,Fa,ca,wa,Ma,Pa,Qa,ma,F.envMap)):(oa.copy(F.color),F.vertexColors===THREE.FaceColors&&
|
|
|
+oa.multiply(C.color),!0===F.wireframe?c(oa,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(oa)):F instanceof THREE.MeshDepthMaterial?(va=da.near,Ka=da.far,Ca.r=Ca.g=Ca.b=1-r(E.positionScreen.z*E.positionScreen.w,va,Ka),Aa.r=Aa.g=Aa.b=1-r(z.positionScreen.z*z.positionScreen.w,va,Ka),Ba.r=Ba.g=Ba.b=1-r(N.positionScreen.z*N.positionScreen.w,va,Ka),Da.addColors(Aa,Ba).multiplyScalar(0.5),La=k(Ca,Aa,Ba,Da),h(ra,S,Oa,za,$,Fa,0,0,1,0,0,1,La)):F instanceof THREE.MeshNormalMaterial&&(F.shading===
|
|
|
+THREE.FlatShading?(fa.copy(C.normalModel).applyMatrix3(Ra),oa.setRGB(fa.x,fa.y,fa.z).multiplyScalar(0.5).addScalar(0.5),!0===F.wireframe?c(oa,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(oa)):F.shading===THREE.SmoothShading&&(fa.copy(C.vertexNormalsModel[0]).applyMatrix3(Ra),Ca.setRGB(fa.x,fa.y,fa.z).multiplyScalar(0.5).addScalar(0.5),fa.copy(C.vertexNormalsModel[1]).applyMatrix3(Ra),Aa.setRGB(fa.x,fa.y,fa.z).multiplyScalar(0.5).addScalar(0.5),fa.copy(C.vertexNormalsModel[2]).applyMatrix3(Ra),
|
|
|
+Ba.setRGB(fa.x,fa.y,fa.z).multiplyScalar(0.5).addScalar(0.5),Da.addColors(Aa,Ba).multiplyScalar(0.5),La=k(Ca,Aa,Ba,Da),h(ra,S,Oa,za,$,Fa,0,0,1,0,0,1,La)))}}ha.union(Na)}}y.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",
|
|
@@ -380,141 +380,141 @@ function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.leng
|
|
|
(a.__skinIndexArray=new Float32Array(4*h),a.__skinWeightArray=new Float32Array(4*h));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*l);if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,p=a.numMorphTargets;c<p;c++)a.__morphTargetsArrays.push(new Float32Array(3*h));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,p=a.numMorphNormals;c<p;c++)a.__morphNormalsArrays.push(new Float32Array(3*h));a.__webglFaceCount=3*k;a.__webglLineCount=2*l;if(g.attributes){void 0===a.__webglCustomAttributesList&&
|
|
|
(a.__webglCustomAttributesList=[]);for(var r in g.attributes){var k=g.attributes[r],l={},s;for(s in k)l[s]=k[s];if(!l.__webglInitialized||l.createUniqueBuffers)l.__webglInitialized=!0,c=1,"v2"===l.type?c=2:"v3"===l.type?c=3:"v4"===l.type?c=4:"c"===l.type&&(c=3),l.size=c,l.array=new Float32Array(h*c),l.buffer=m.createBuffer(),l.buffer.belongsToAttribute=r,k.needsUpdate=!0,l.__original=k;a.__webglCustomAttributesList.push(l)}}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 g(a,b,c,d){var e,f,g,k;for(f in b)g=b[f],e=c[f],0<=g&&(e?(k=e.itemSize,m.bindBuffer(m.ARRAY_BUFFER,e.buffer),h(g),m.vertexAttribPointer(g,
|
|
|
-k,m.FLOAT,!1,0,d*k*4)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?m.vertexAttrib2fv(g,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&m.vertexAttrib3fv(g,a.defaultAttributeValues[f])))}function h(a){Z[a]||(m.enableVertexAttribArray(a),Z[a]=!0)}function k(){for(var a in Z)Z[a]&&(m.disableVertexAttribArray(a),Z[a]=!1)}function l(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function q(a,b,c){if(a.length)for(var d=0,e=a.length;d<
|
|
|
-e;d++)Fa=U=null,va=wa=ya=xa=Ga=Ma=Ba=-1,ga=!0,a[d].render(b,c,gb,Ea),Fa=U=null,va=wa=ya=xa=Ga=Ma=Ba=-1,ga=!0}function s(a,b,c,d,e,f,g,h){var m,k,l,p;b?(k=a.length-1,p=b=-1):(k=0,b=a.length,p=1);for(var n=k;n!==b;n+=p)if(m=a[n],m.render){k=m.object;l=m.buffer;if(h)m=h;else{m=m[c];if(!m)continue;g&&O.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst);O.setDepthTest(m.depthTest);O.setDepthWrite(m.depthWrite);M(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}O.setMaterialFaces(m);
|
|
|
-l instanceof THREE.BufferGeometry?O.renderBufferDirect(d,e,f,m,l,k):O.renderBuffer(d,e,f,m,l,k)}}function u(a,b,c,d,e,f,g){for(var h,m,k=0,l=a.length;k<l;k++)if(h=a[k],m=h.object,m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);M(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,d,e,h,m)}}function t(a,d){var e,f,g,h;if(void 0===a.__webglInit&&
|
|
|
+k,m.FLOAT,!1,0,d*k*4)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?m.vertexAttrib2fv(g,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&m.vertexAttrib3fv(g,a.defaultAttributeValues[f])))}function h(a){ha[a]||(m.enableVertexAttribArray(a),ha[a]=!0)}function k(){for(var a in ha)ha[a]&&(m.disableVertexAttribArray(a),ha[a]=!1)}function l(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function q(a,b,c){if(a.length)for(var d=0,e=a.length;d<
|
|
|
+e;d++)Fa=S=null,za=$=Ba=Aa=va=la=Da=-1,fa=!0,a[d].render(b,c,ma,Ea),Fa=S=null,za=$=Ba=Aa=va=la=Da=-1,fa=!0}function s(a,b,c,d,e,f,g,h){var m,k,l,p;b?(k=a.length-1,p=b=-1):(k=0,b=a.length,p=1);for(var n=k;n!==b;n+=p)if(m=a[n],m.render){k=m.object;l=m.buffer;if(h)m=h;else{m=m[c];if(!m)continue;g&&J.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst);J.setDepthTest(m.depthTest);J.setDepthWrite(m.depthWrite);M(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}J.setMaterialFaces(m);
|
|
|
+l instanceof THREE.BufferGeometry?J.renderBufferDirect(d,e,f,m,l,k):J.renderBuffer(d,e,f,m,l,k)}}function u(a,b,c,d,e,f,g){for(var h,m,k=0,l=a.length;k<l;k++)if(h=a[k],m=h.object,m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&J.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);J.setDepthTest(h.depthTest);J.setDepthWrite(h.depthWrite);M(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}J.renderImmediateObject(c,d,e,h,m)}}function t(a,d){var e,f,g,h;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",Jb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var k,l;for(k in f.attributes)l="index"===k?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,h=f.attributes[k],h.buffer=m.createBuffer(),m.bindBuffer(l,h.buffer),m.bufferData(l,h.array,m.STATIC_DRAW)}else if(a instanceof THREE.Mesh){g=a.material;
|
|
|
if(void 0===f.geometryGroups){k=f;var n,q,r;l={};var s=k.morphTargets.length,u=k.morphNormals.length,t=g instanceof THREE.MeshFaceMaterial;k.geometryGroups={};g=0;for(n=k.faces.length;g<n;g++)q=k.faces[g],q=t?q.materialIndex:0,void 0===l[q]&&(l[q]={hash:q,counter:0}),r=l[q].hash+"_"+l[q].counter,void 0===k.geometryGroups[r]&&(k.geometryGroups[r]={faces3:[],materialIndex:q,vertices:0,numMorphTargets:s,numMorphNormals:u}),65535<k.geometryGroups[r].vertices+3&&(l[q].counter+=1,r=l[q].hash+"_"+l[q].counter,
|
|
|
-void 0===k.geometryGroups[r]&&(k.geometryGroups[r]={faces3:[],materialIndex:q,vertices:0,numMorphTargets:s,numMorphNormals:u})),k.geometryGroups[r].faces3.push(g),k.geometryGroups[r].vertices+=3;k.geometryGroupsList=[];for(h in k.geometryGroups)k.geometryGroups[h].id=ca++,k.geometryGroupsList.push(k.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){k=h;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();k.__webglTangentBuffer=m.createBuffer();
|
|
|
+void 0===k.geometryGroups[r]&&(k.geometryGroups[r]={faces3:[],materialIndex:q,vertices:0,numMorphTargets:s,numMorphNormals:u})),k.geometryGroups[r].faces3.push(g),k.geometryGroups[r].vertices+=3;k.geometryGroupsList=[];for(h in k.geometryGroups)k.geometryGroups[h].id=oa++,k.geometryGroupsList.push(k.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){k=h;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();k.__webglTangentBuffer=m.createBuffer();
|
|
|
k.__webglColorBuffer=m.createBuffer();k.__webglUVBuffer=m.createBuffer();k.__webglUV2Buffer=m.createBuffer();k.__webglSkinIndicesBuffer=m.createBuffer();k.__webglSkinWeightsBuffer=m.createBuffer();k.__webglFaceBuffer=m.createBuffer();k.__webglLineBuffer=m.createBuffer();s=l=void 0;if(k.numMorphTargets)for(k.__webglMorphTargetsBuffers=[],l=0,s=k.numMorphTargets;l<s;l++)k.__webglMorphTargetsBuffers.push(m.createBuffer());if(k.numMorphNormals)for(k.__webglMorphNormalsBuffers=[],l=0,s=k.numMorphNormals;l<
|
|
|
-s;l++)k.__webglMorphNormalsBuffers.push(m.createBuffer());O.info.memory.geometries++;c(h,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||(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),h.__webglLineDistanceBuffer=m.createBuffer(),O.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=
|
|
|
-new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__lineDistanceArray=new Float32Array(1*k),h.__webglLineCount=k,b(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),O.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__sortArray=[],h.__webglParticleCount=
|
|
|
+s;l++)k.__webglMorphNormalsBuffers.push(m.createBuffer());J.info.memory.geometries++;c(h,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||(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),h.__webglLineDistanceBuffer=m.createBuffer(),J.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=
|
|
|
+new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__lineDistanceArray=new Float32Array(1*k),h.__webglLineCount=k,b(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),J.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__sortArray=[],h.__webglParticleCount=
|
|
|
k,b(h,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)p(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)h=f.geometryGroups[e],p(d.__webglObjects,h,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,p(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 p(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function r(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof
|
|
|
-THREE.Line?x(b.__webglObjects,a):a instanceof THREE.Sprite?A(b.__webglSprites,a):a instanceof THREE.LensFlare?A(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function F(a,b,c,d,e){za=0;d.needsUpdate&&(d.program&&Db(d),O.initMaterial(d,b,c,e),d.needsUpdate=
|
|
|
-!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==U&&(m.useProgram(g),U=g,f=!0);d.id!==va&&(va=d.id,f=!0);if(f||a!==Fa)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==Fa&&(Fa=a);if(d.skinning)if(yb&&e.useVertexTexture){if(null!==h.boneTexture){var l=Q();m.uniform1i(h.boneTexture,l);O.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,
|
|
|
-e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ga){var p,n=l=0,q=0,r,s,u,t=Ra,v=t.directional.colors,
|
|
|
-w=t.directional.positions,x=t.point.colors,A=t.point.positions,F=t.point.distances,z=t.spot.colors,D=t.spot.positions,M=t.spot.distances,G=t.spot.directions,N=t.spot.anglesCos,H=t.spot.exponents,L=t.hemi.skyColors,R=t.hemi.groundColors,J=t.hemi.positions,T=0,Y=0,S=0,pa=0,Z=0,bc=0,aa=0,$=0,ca=p=0;c=u=ca=0;for(f=b.length;c<f;c++)if(p=b[c],!p.onlyShadow)if(r=p.color,s=p.intensity,u=p.distance,p instanceof THREE.AmbientLight)p.visible&&(O.gammaInput?(l+=r.r*r.r,n+=r.g*r.g,q+=r.b*r.b):(l+=r.r,n+=r.g,q+=
|
|
|
-r.b));else if(p instanceof THREE.DirectionalLight){if(Z+=1,p.visible&&(fa.setFromMatrixPosition(p.matrixWorld),ua.setFromMatrixPosition(p.target.matrixWorld),fa.sub(ua),fa.normalize(),0!==fa.x||0!==fa.y||0!==fa.z))p=3*T,w[p]=fa.x,w[p+1]=fa.y,w[p+2]=fa.z,O.gammaInput?I(v,p,r,s*s):B(v,p,r,s),T+=1}else p instanceof THREE.PointLight?(bc+=1,p.visible&&(ca=3*Y,O.gammaInput?I(x,ca,r,s*s):B(x,ca,r,s),ua.setFromMatrixPosition(p.matrixWorld),A[ca]=ua.x,A[ca+1]=ua.y,A[ca+2]=ua.z,F[Y]=u,Y+=1)):p instanceof THREE.SpotLight?
|
|
|
-(aa+=1,p.visible&&(ca=3*S,O.gammaInput?I(z,ca,r,s*s):B(z,ca,r,s),ua.setFromMatrixPosition(p.matrixWorld),D[ca]=ua.x,D[ca+1]=ua.y,D[ca+2]=ua.z,M[S]=u,fa.copy(ua),ua.setFromMatrixPosition(p.target.matrixWorld),fa.sub(ua),fa.normalize(),G[ca]=fa.x,G[ca+1]=fa.y,G[ca+2]=fa.z,N[S]=Math.cos(p.angle),H[S]=p.exponent,S+=1)):p instanceof THREE.HemisphereLight&&($+=1,p.visible&&(fa.setFromMatrixPosition(p.matrixWorld),fa.normalize(),0!==fa.x||0!==fa.y||0!==fa.z))&&(u=3*pa,J[u]=fa.x,J[u+1]=fa.y,J[u+2]=fa.z,r=
|
|
|
-p.color,p=p.groundColor,O.gammaInput?(s*=s,I(L,u,r,s),I(R,u,p,s)):(B(L,u,r,s),B(R,u,p,s)),pa+=1);c=3*T;for(f=Math.max(v.length,3*Z);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(x.length,3*bc);c<f;c++)x[c]=0;c=3*S;for(f=Math.max(z.length,3*aa);c<f;c++)z[c]=0;c=3*pa;for(f=Math.max(L.length,3*$);c<f;c++)L[c]=0;c=3*pa;for(f=Math.max(R.length,3*$);c<f;c++)R[c]=0;t.directional.length=T;t.point.length=Y;t.spot.length=S;t.hemi.length=pa;t.ambient[0]=l;t.ambient[1]=n;t.ambient[2]=q;ga=!1}c=Ra;k.ambientLightColor.value=
|
|
|
-c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngleCos.value=c.spot.anglesCos;k.spotLightExponent.value=c.spot.exponents;
|
|
|
-k.hemisphereLightSkyColor.value=c.hemi.skyColors;k.hemisphereLightGroundColor.value=c.hemi.groundColors;k.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=d.opacity;O.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;k.map.value=d.map;k.lightMap.value=d.lightMap;k.specularMap.value=d.specularMap;d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=
|
|
|
-d.bumpScale);d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale));var W;d.map?W=d.map:d.specularMap?W=d.specularMap:d.normalMap?W=d.normalMap:d.bumpMap&&(W=d.bumpMap);void 0!==W&&(c=W.offset,W=W.repeat,k.offsetRepeat.value.set(c.x,c.y,W.x,W.y));k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&
|
|
|
-d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=d.dashSize+d.gapSize,k.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(k.psColor.value=d.color,k.opacity.value=d.opacity,k.size.value=d.size,k.scale.value=C.height/2,k.map.value=d.map):d instanceof THREE.MeshPhongMaterial?
|
|
|
-(k.shininess.value=d.shininess,O.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive),k.specular.value.copyGammaToLinear(d.specular)):(k.ambient.value=d.ambient,k.emissive.value=d.emissive,k.specular.value=d.specular),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(O.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive)):(k.ambient.value=d.ambient,k.emissive.value=
|
|
|
-d.emissive),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(k.mNear.value=a.near,k.mFar.value=a.far,k.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(k.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix)for(c=W=0,f=b.length;c<f;c++)l=b[c],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)&&(k.shadowMap.value[W]=l.shadowMap,k.shadowMapSize.value[W]=l.shadowMapSize,k.shadowMatrix.value[W]=
|
|
|
-l.shadowMatrix,k.shadowDarkness.value[W]=l.shadowDarkness,k.shadowBias.value[W]=l.shadowBias,W++);b=d.uniformsList;k=0;for(W=b.length;k<W;k++)if(f=g.uniforms[b[k][1]])if(c=b[k][0],n=c.type,l=c.value,"i"===n)m.uniform1i(f,l);else if("f"===n)m.uniform1f(f,l);else if("v2"===n)m.uniform2f(f,l.x,l.y);else if("v3"===n)m.uniform3f(f,l.x,l.y,l.z);else if("v4"===n)m.uniform4f(f,l.x,l.y,l.z,l.w);else if("c"===n)m.uniform3f(f,l.r,l.g,l.b);else if("iv1"===n)m.uniform1iv(f,l);else if("iv"===n)m.uniform3iv(f,l);
|
|
|
-else if("fv1"===n)m.uniform1fv(f,l);else if("fv"===n)m.uniform3fv(f,l);else if("v2v"===n){void 0===c._array&&(c._array=new Float32Array(2*l.length));n=0;for(q=l.length;n<q;n++)t=2*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y;m.uniform2fv(f,c._array)}else if("v3v"===n){void 0===c._array&&(c._array=new Float32Array(3*l.length));n=0;for(q=l.length;n<q;n++)t=3*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z;m.uniform3fv(f,c._array)}else if("v4v"===n){void 0===c._array&&(c._array=new Float32Array(4*
|
|
|
-l.length));n=0;for(q=l.length;n<q;n++)t=4*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z,c._array[t+3]=l[n].w;m.uniform4fv(f,c._array)}else if("m4"===n)void 0===c._array&&(c._array=new Float32Array(16)),l.flattenToArray(c._array),m.uniformMatrix4fv(f,!1,c._array);else if("m4v"===n){void 0===c._array&&(c._array=new Float32Array(16*l.length));n=0;for(q=l.length;n<q;n++)l[n].flattenToArrayOffset(c._array,16*n);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===n){if(t=l,l=Q(),m.uniform1i(f,
|
|
|
-l),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=l,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",tb),c.image.__webglTextureCube=m.createTexture(),O.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;l=[];for(n=0;6>n;n++)O.autoScaleCubemaps&&!f?(q=l,t=n,v=c.image[n],x=Xb,v.width<=x&&v.height<=
|
|
|
-x||(A=Math.max(v.width,v.height),w=Math.floor(v.width*x/A),x=Math.floor(v.height*x/A),A=document.createElement("canvas"),A.width=w,A.height=x,A.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=A),q[t]=v):l[n]=c.image[n];n=l[0];q=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);t=E(c.format);v=E(c.type);y(m.TEXTURE_CUBE_MAP,c,q);for(n=0;6>n;n++)if(f)for(x=l[n].mipmaps,A=0,F=x.length;A<F;A++)w=x[A],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
-n,A,t,w.width,w.height,0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,A,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t,t,v,l[n]);c.generateMipmaps&&q&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):
|
|
|
-O.setTexture(t,l)}else if("tv"===n){void 0===c._array&&(c._array=[]);n=0;for(q=c.value.length;n<q;n++)c._array[n]=Q();m.uniform1iv(f,c._array);n=0;for(q=c.value.length;n<q;n++)t=c.value[n],l=c._array[n],t&&O.setTexture(t,l)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+n);(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(ua.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,ua.x,ua.y,ua.z));(d instanceof
|
|
|
-THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function Q(){var a=za;a>=Wa&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+Wa);za+=1;return a}function I(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 z(a){a!==Ca&&(m.lineWidth(a),Ca=a)}function M(a,b,c){qa!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),qa=a);!a||ra===b&&Aa===c||(m.polygonOffset(b,c),ra=b,Aa=c)}function G(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function J(a,
|
|
|
-b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),console.error(G(b)),null)}function y(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,E(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,E(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,E(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,E(b.minFilter))):(m.texParameteri(a,
|
|
|
-m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,D(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,D(b.minFilter)));da&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,da.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ib)),b.__oldAnisotropy=b.anisotropy)}function N(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,
|
|
|
-b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function D(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function E(a){if(a===
|
|
|
-THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;
|
|
|
-if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;
|
|
|
-if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;
|
|
|
-if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==Na){if(a===THREE.RGB_S3TC_DXT1_Format)return Na.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
-if(a===THREE.RGBA_S3TC_DXT1_Format)return Na.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Na.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Na.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var C=void 0!==a.canvas?a.canvas:document.createElement("canvas"),L=void 0!==a.context?a.context:null,Y=void 0!==a.precision?a.precision:"highp",T=void 0!==a.alpha?a.alpha:!1,ja=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:
|
|
|
-!0,W=void 0!==a.antialias?a.antialias:!1,na=void 0!==a.stencil?a.stencil:!0,R=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ea=new THREE.Color(0),S=0;this.domElement=C;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 O=this,H=[],pa=0,U=null,La=null,va=-1,wa=null,Fa=null,ca=0,za=0,xa=-1,ya=-1,Ba=-1,Ha=-1,Ya=-1,ka=-1,Ma=-1,Ga=-1,qa=null,
|
|
|
-ra=null,Aa=null,Ca=null,Da=0,Oa=0,Pa=C.width,Qa=C.height,gb=0,Ea=0,Z={},la=new THREE.Frustum,ib=new THREE.Matrix4,zb=new THREE.Matrix4,ua=new THREE.Vector3,fa=new THREE.Vector3,ga=!0,Ra={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:[]}},m,Ia,hb,da,Na;(function(){try{var a={alpha:T,premultipliedAlpha:ja,
|
|
|
-antialias:W,stencil:na,preserveDrawingBuffer:R};m=L||C.getContext("webgl",a)||C.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}Ia=m.getExtension("OES_texture_float");m.getExtension("OES_texture_float_linear");hb=m.getExtension("OES_standard_derivatives");da=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Na=m.getExtension("WEBGL_compressed_texture_s3tc")||
|
|
|
-m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Ia||console.log("THREE.WebGLRenderer: Float textures not supported.");hb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");da||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Na||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,
|
|
|
-rangeMax:1,precision:1}})})();m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(Da,Oa,Pa,Qa);m.clearColor(ea.r,ea.g,ea.b,S);this.context=m;var Wa=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),Sa=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var Xb=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),
|
|
|
-Ib=da?m.getParameter(da.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,xb=0<Sa,yb=xb&&Ia;Na&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var Yb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),Zb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_FLOAT);var $b=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),ac=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,
|
|
|
-m.HIGH_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_INT);var sc=0<Yb.precision&&0<$b.precision,Cb=0<Zb.precision&&0<ac.precision;"highp"!==Y||sc||(Cb?(Y="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(Y="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));
|
|
|
-"mediump"!==Y||Cb||(Y="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return m};this.supportsVertexTextures=function(){return xb};this.supportsFloatTextures=function(){return Ia};this.supportsStandardDerivatives=function(){return hb};this.supportsCompressedTextureS3TC=function(){return Na};this.getMaxAnisotropy=function(){return Ib};this.getPrecision=function(){return Y};this.setSize=function(a,b,c){C.width=a*this.devicePixelRatio;C.height=b*this.devicePixelRatio;
|
|
|
-1!==this.devicePixelRatio&&!1!==c&&(C.style.width=a+"px",C.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){Da=a*this.devicePixelRatio;Oa=b*this.devicePixelRatio;Pa=c*this.devicePixelRatio;Qa=d*this.devicePixelRatio;m.viewport(Da,Oa,Pa,Qa)};this.setScissor=function(a,b,c,d){m.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};
|
|
|
-this.setClearColor=function(a,b){ea.set(a);S=void 0!==b?b:1;m.clearColor(ea.r,ea.g,ea.b,S)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return ea};this.getClearAlpha=function(){return S};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=
|
|
|
-function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.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){U=null;va=wa=Ga=Ma=Ba=-1;ga=!0;ya=xa=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=
|
|
|
-a.target;a.removeEventListener("dispose",Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&m.deleteBuffer(b[c].buffer);O.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++)m.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)m.deleteBuffer(c.__webglMorphNormalsBuffers[d]);
|
|
|
-Mb(c)}else Mb(a)},tb=function(a){a=a.target;a.removeEventListener("dispose",tb);a.image&&a.image.__webglTextureCube?m.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,m.deleteTexture(a.__webglTexture));O.info.memory.textures--},Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);if(a&&a.__webglTexture)if(m.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
-else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);O.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);Db(a)},Mb=function(a){void 0!==a.__webglVertexBuffer&&m.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&m.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&m.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&m.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
|
|
|
+THREE.Line?x(b.__webglObjects,a):a instanceof THREE.Sprite?A(b.__webglSprites,a):a instanceof THREE.LensFlare?A(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function G(a,b,c,d,e){Ca=0;d.needsUpdate&&(d.program&&Db(d),J.initMaterial(d,b,c,e),d.needsUpdate=
|
|
|
+!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(J.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==S&&(m.useProgram(g),S=g,f=!0);d.id!==za&&(za=d.id,f=!0);if(f||a!==Fa)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==Fa&&(Fa=a);if(d.skinning)if(yb&&e.useVertexTexture){if(null!==h.boneTexture){var l=Q();m.uniform1i(h.boneTexture,l);J.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,
|
|
|
+e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(fa){var p,n=l=0,q=0,r,s,u,t=Ra,v=t.directional.colors,
|
|
|
+w=t.directional.positions,x=t.point.colors,A=t.point.positions,G=t.point.distances,z=t.spot.colors,E=t.spot.positions,M=t.spot.distances,H=t.spot.directions,N=t.spot.anglesCos,D=t.spot.exponents,O=t.hemi.skyColors,ba=t.hemi.groundColors,K=t.hemi.positions,R=0,X=0,T=0,ra=0,oa=0,bc=0,Z=0,Y=0,W=p=0;c=u=W=0;for(f=b.length;c<f;c++)if(p=b[c],!p.onlyShadow)if(r=p.color,s=p.intensity,u=p.distance,p instanceof THREE.AmbientLight)p.visible&&(J.gammaInput?(l+=r.r*r.r,n+=r.g*r.g,q+=r.b*r.b):(l+=r.r,n+=r.g,q+=
|
|
|
+r.b));else if(p instanceof THREE.DirectionalLight){if(oa+=1,p.visible&&(ea.setFromMatrixPosition(p.matrixWorld),ya.setFromMatrixPosition(p.target.matrixWorld),ea.sub(ya),ea.normalize(),0!==ea.x||0!==ea.y||0!==ea.z))p=3*R,w[p]=ea.x,w[p+1]=ea.y,w[p+2]=ea.z,J.gammaInput?I(v,p,r,s*s):B(v,p,r,s),R+=1}else p instanceof THREE.PointLight?(bc+=1,p.visible&&(W=3*X,J.gammaInput?I(x,W,r,s*s):B(x,W,r,s),ya.setFromMatrixPosition(p.matrixWorld),A[W]=ya.x,A[W+1]=ya.y,A[W+2]=ya.z,G[X]=u,X+=1)):p instanceof THREE.SpotLight?
|
|
|
+(Z+=1,p.visible&&(W=3*T,J.gammaInput?I(z,W,r,s*s):B(z,W,r,s),ya.setFromMatrixPosition(p.matrixWorld),E[W]=ya.x,E[W+1]=ya.y,E[W+2]=ya.z,M[T]=u,ea.copy(ya),ya.setFromMatrixPosition(p.target.matrixWorld),ea.sub(ya),ea.normalize(),H[W]=ea.x,H[W+1]=ea.y,H[W+2]=ea.z,N[T]=Math.cos(p.angle),D[T]=p.exponent,T+=1)):p instanceof THREE.HemisphereLight&&(Y+=1,p.visible&&(ea.setFromMatrixPosition(p.matrixWorld),ea.normalize(),0!==ea.x||0!==ea.y||0!==ea.z))&&(u=3*ra,K[u]=ea.x,K[u+1]=ea.y,K[u+2]=ea.z,r=p.color,p=
|
|
|
+p.groundColor,J.gammaInput?(s*=s,I(O,u,r,s),I(ba,u,p,s)):(B(O,u,r,s),B(ba,u,p,s)),ra+=1);c=3*R;for(f=Math.max(v.length,3*oa);c<f;c++)v[c]=0;c=3*X;for(f=Math.max(x.length,3*bc);c<f;c++)x[c]=0;c=3*T;for(f=Math.max(z.length,3*Z);c<f;c++)z[c]=0;c=3*ra;for(f=Math.max(O.length,3*Y);c<f;c++)O[c]=0;c=3*ra;for(f=Math.max(ba.length,3*Y);c<f;c++)ba[c]=0;t.directional.length=R;t.point.length=X;t.spot.length=T;t.hemi.length=ra;t.ambient[0]=l;t.ambient[1]=n;t.ambient[2]=q;fa=!1}c=Ra;k.ambientLightColor.value=c.ambient;
|
|
|
+k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngleCos.value=c.spot.anglesCos;k.spotLightExponent.value=c.spot.exponents;k.hemisphereLightSkyColor.value=
|
|
|
+c.hemi.skyColors;k.hemisphereLightGroundColor.value=c.hemi.groundColors;k.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=d.opacity;J.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;k.map.value=d.map;k.lightMap.value=d.lightMap;k.specularMap.value=d.specularMap;d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale);d.normalMap&&
|
|
|
+(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale));var $;d.map?$=d.map:d.specularMap?$=d.specularMap:d.normalMap?$=d.normalMap:d.bumpMap&&($=d.bumpMap);void 0!==$&&(c=$.offset,$=$.repeat,k.offsetRepeat.value.set(c.x,c.y,$.x,$.y));k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof
|
|
|
+THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=d.dashSize+d.gapSize,k.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(k.psColor.value=d.color,k.opacity.value=d.opacity,k.size.value=d.size,k.scale.value=C.height/2,k.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(k.shininess.value=
|
|
|
+d.shininess,J.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive),k.specular.value.copyGammaToLinear(d.specular)):(k.ambient.value=d.ambient,k.emissive.value=d.emissive,k.specular.value=d.specular),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(J.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive)):(k.ambient.value=d.ambient,k.emissive.value=d.emissive),d.wrapAround&&
|
|
|
+k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(k.mNear.value=a.near,k.mFar.value=a.far,k.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(k.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix)for(c=$=0,f=b.length;c<f;c++)l=b[c],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)&&(k.shadowMap.value[$]=l.shadowMap,k.shadowMapSize.value[$]=l.shadowMapSize,k.shadowMatrix.value[$]=l.shadowMatrix,
|
|
|
+k.shadowDarkness.value[$]=l.shadowDarkness,k.shadowBias.value[$]=l.shadowBias,$++);b=d.uniformsList;k=0;for($=b.length;k<$;k++)if(f=g.uniforms[b[k][1]])if(c=b[k][0],n=c.type,l=c.value,"i"===n)m.uniform1i(f,l);else if("f"===n)m.uniform1f(f,l);else if("v2"===n)m.uniform2f(f,l.x,l.y);else if("v3"===n)m.uniform3f(f,l.x,l.y,l.z);else if("v4"===n)m.uniform4f(f,l.x,l.y,l.z,l.w);else if("c"===n)m.uniform3f(f,l.r,l.g,l.b);else if("iv1"===n)m.uniform1iv(f,l);else if("iv"===n)m.uniform3iv(f,l);else if("fv1"===
|
|
|
+n)m.uniform1fv(f,l);else if("fv"===n)m.uniform3fv(f,l);else if("v2v"===n){void 0===c._array&&(c._array=new Float32Array(2*l.length));n=0;for(q=l.length;n<q;n++)t=2*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y;m.uniform2fv(f,c._array)}else if("v3v"===n){void 0===c._array&&(c._array=new Float32Array(3*l.length));n=0;for(q=l.length;n<q;n++)t=3*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z;m.uniform3fv(f,c._array)}else if("v4v"===n){void 0===c._array&&(c._array=new Float32Array(4*l.length));
|
|
|
+n=0;for(q=l.length;n<q;n++)t=4*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z,c._array[t+3]=l[n].w;m.uniform4fv(f,c._array)}else if("m4"===n)void 0===c._array&&(c._array=new Float32Array(16)),l.flattenToArray(c._array),m.uniformMatrix4fv(f,!1,c._array);else if("m4v"===n){void 0===c._array&&(c._array=new Float32Array(16*l.length));n=0;for(q=l.length;n<q;n++)l[n].flattenToArrayOffset(c._array,16*n);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===n){if(t=l,l=Q(),m.uniform1i(f,l),t)if(t.image instanceof
|
|
|
+Array&&6===t.image.length){if(c=t,f=l,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",tb),c.image.__webglTextureCube=m.createTexture(),J.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;l=[];for(n=0;6>n;n++)J.autoScaleCubemaps&&!f?(q=l,t=n,v=c.image[n],x=Xb,v.width<=x&&v.height<=x||(A=Math.max(v.width,v.height),
|
|
|
+w=Math.floor(v.width*x/A),x=Math.floor(v.height*x/A),A=document.createElement("canvas"),A.width=w,A.height=x,A.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=A),q[t]=v):l[n]=c.image[n];n=l[0];q=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);t=F(c.format);v=F(c.type);y(m.TEXTURE_CUBE_MAP,c,q);for(n=0;6>n;n++)if(f)for(x=l[n].mipmaps,A=0,G=x.length;A<G;A++)w=x[A],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,A,t,w.width,w.height,
|
|
|
+0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,A,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t,t,v,l[n]);c.generateMipmaps&&q&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):J.setTexture(t,
|
|
|
+l)}else if("tv"===n){void 0===c._array&&(c._array=[]);n=0;for(q=c.value.length;n<q;n++)c._array[n]=Q();m.uniform1iv(f,c._array);n=0;for(q=c.value.length;n<q;n++)t=c.value[n],l=c._array[n],t&&J.setTexture(t,l)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+n);(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(ya.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,ya.x,ya.y,ya.z));(d instanceof THREE.MeshPhongMaterial||
|
|
|
+d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function Q(){var a=Ca;a>=Xa&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+
|
|
|
+Xa);Ca+=1;return a}function I(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 z(a){a!==ca&&(m.lineWidth(a),ca=a)}function M(a,b,c){Ka!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),Ka=a);!a||La===b&&Ga===c||(m.polygonOffset(b,c),La=b,Ga=c)}function H(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function K(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):
|
|
|
+"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),console.error(H(b)),null)}function y(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,F(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,F(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,F(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,F(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,
|
|
|
+m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,E(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,E(b.minFilter)));xa&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,xa.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ib)),b.__oldAnisotropy=b.anisotropy)}function N(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
|
|
|
+m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function E(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function F(a){if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;
|
|
|
+if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;
|
|
|
+if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===
|
|
|
+THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===
|
|
|
+THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==ta){if(a===THREE.RGB_S3TC_DXT1_Format)return ta.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return ta.COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
|
+if(a===THREE.RGBA_S3TC_DXT3_Format)return ta.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return ta.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var C=void 0!==a.canvas?a.canvas:document.createElement("canvas"),O=void 0!==a.context?a.context:null,X=void 0!==a.precision?a.precision:"highp",R=void 0!==a.alpha?a.alpha:!1,ja=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,W=void 0!==a.antialias?a.antialias:!1,pa=void 0!==a.stencil?
|
|
|
+a.stencil:!0,D=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,da=new THREE.Color(0),T=0;this.domElement=C;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 J=this,ba=[],ra=0,S=null,Oa=null,za=-1,$=null,Fa=null,oa=0,Ca=0,Aa=-1,Ba=-1,Da=-1,Sa=-1,ka=-1,Ta=-1,la=-1,va=-1,Ka=null,La=null,Ga=null,ca=null,wa=0,Ma=0,Pa=C.width,Qa=C.height,ma=0,Ea=
|
|
|
+0,ha={},Na=new THREE.Frustum,ib=new THREE.Matrix4,zb=new THREE.Matrix4,ya=new THREE.Vector3,ea=new THREE.Vector3,fa=!0,Ra={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:[]}},m,Ha,hb,xa,ta;(function(){try{var a={alpha:R,premultipliedAlpha:ja,antialias:W,stencil:pa,preserveDrawingBuffer:D};
|
|
|
+m=O||C.getContext("webgl",a)||C.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}Ha=m.getExtension("OES_texture_float");m.getExtension("OES_texture_float_linear");hb=m.getExtension("OES_standard_derivatives");xa=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");ta=m.getExtension("WEBGL_compressed_texture_s3tc")||m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||
|
|
|
+m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Ha||console.log("THREE.WebGLRenderer: Float textures not supported.");hb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");xa||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");ta||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})})();m.clearColor(0,
|
|
|
+0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(wa,Ma,Pa,Qa);m.clearColor(da.r,da.g,da.b,T);this.context=m;var Xa=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),db=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var Xb=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Ib=xa?
|
|
|
+m.getParameter(xa.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,xb=0<db,yb=xb&&Ha;ta&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var Yb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),Zb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_FLOAT);var $b=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),ac=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,
|
|
|
+m.HIGH_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_INT);var sc=0<Yb.precision&&0<$b.precision,Cb=0<Zb.precision&&0<ac.precision;"highp"!==X||sc||(Cb?(X="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(X="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));
|
|
|
+"mediump"!==X||Cb||(X="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return m};this.supportsVertexTextures=function(){return xb};this.supportsFloatTextures=function(){return Ha};this.supportsStandardDerivatives=function(){return hb};this.supportsCompressedTextureS3TC=function(){return ta};this.getMaxAnisotropy=function(){return Ib};this.getPrecision=function(){return X};this.setSize=function(a,b,c){C.width=a*this.devicePixelRatio;C.height=b*this.devicePixelRatio;
|
|
|
+1!==this.devicePixelRatio&&!1!==c&&(C.style.width=a+"px",C.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){wa=a*this.devicePixelRatio;Ma=b*this.devicePixelRatio;Pa=c*this.devicePixelRatio;Qa=d*this.devicePixelRatio;m.viewport(wa,Ma,Pa,Qa)};this.setScissor=function(a,b,c,d){m.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};
|
|
|
+this.setClearColor=function(a,b){da.set(a);T=void 0!==b?b:1;m.clearColor(da.r,da.g,da.b,T)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return da};this.getClearAlpha=function(){return T};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=
|
|
|
+function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.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){S=null;za=$=va=la=Da=-1;fa=!0;Ba=Aa=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=
|
|
|
+a.target;a.removeEventListener("dispose",Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&m.deleteBuffer(b[c].buffer);J.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++)m.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)m.deleteBuffer(c.__webglMorphNormalsBuffers[d]);
|
|
|
+Mb(c)}else Mb(a)},tb=function(a){a=a.target;a.removeEventListener("dispose",tb);a.image&&a.image.__webglTextureCube?m.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,m.deleteTexture(a.__webglTexture));J.info.memory.textures--},Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);if(a&&a.__webglTexture)if(m.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
+else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);J.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);Db(a)},Mb=function(a){void 0!==a.__webglVertexBuffer&&m.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&m.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&m.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&m.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
|
|
|
m.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&m.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&m.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&m.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&m.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&m.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&m.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[b].buffer);
|
|
|
-O.info.memory.geometries--},Db=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=H.length;a<c;a++)if(d=H[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=H.length;a<c;a++)d=H[a],d.program!==b&&e.push(d);H=e;m.deleteProgram(b);O.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
|
|
|
+J.info.memory.geometries--},Db=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=ba.length;a<c;a++)if(d=ba[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ba.length;a<c;a++)d=ba[a],d.program!==b&&e.push(d);ba=e;m.deleteProgram(b);J.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
|
|
|
m.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer());a.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormals){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
e,f,g,h,k,l,n,p,q,r,s=3*a.count;for(r=0;r<s;r+=9)q=a.normalArray,d=q[r],e=q[r+1],f=q[r+2],g=q[r+3],k=q[r+4],n=q[r+5],h=q[r+6],l=q[r+7],p=q[r+8],d=(d+g+h)/3,e=(e+k+l)/3,f=(f+n+p)/3,q[r]=d,q[r+1]=e,q[r+2]=f,q[r+3]=d,q[r+4]=e,q[r+5]=f,q[r+6]=d,q[r+7]=e,q[r+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer),m.bufferData(m.ARRAY_BUFFER,
|
|
|
a.uvArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var l,
|
|
|
-n,p,q;l=F(a,b,c,d,f);a=l.attributes;b=e.attributes;c=!1;l=16777215*e.id+2*l.id+(d.wireframe?1:0);l!==wa&&(wa=l,c=!0);c&&k();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;1<e.length&&(c=!0);for(var r=0,s=e.length;r<s;r++){var t=e[r].index;if(c){for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,t*q*4)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):
|
|
|
-3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)}m.drawElements(m.TRIANGLES,e[r].count,m.UNSIGNED_SHORT,2*e[r].start);O.info.render.calls++;O.info.render.vertices+=e[r].count;O.info.render.faces+=e[r].count/3}}else{if(c)for(n in a)"index"!==n&&(p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&
|
|
|
-(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n]))));d=e.attributes.position;m.drawArrays(m.TRIANGLES,0,d.array.length/3);O.info.render.calls++;O.info.render.vertices+=d.array.length/3;O.info.render.faces+=d.array.length/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,
|
|
|
-q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));d=b.position;m.drawArrays(m.POINTS,0,d.array.length/3);O.info.render.calls++;O.info.render.points+=d.array.length/3}else if(f instanceof THREE.Line)if(n=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),f=b.index)for(e=e.offsets,1<e.length&&
|
|
|
-(c=!0),r=0,s=e.length;r<s;r++)t=e[r].index,c&&(g(d,a,b,t),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,e[r].count,m.UNSIGNED_SHORT,2*e[r].start),O.info.render.calls++,O.info.render.vertices+=e[r].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(n,0,d.array.length/3),O.info.render.calls++,O.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,l;c=F(a,b,c,d,f);a=c.attributes;b=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==
|
|
|
-wa&&(wa=c,b=!0);b&&k();if(!d.morphTargets&&0<=a.position)b&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),m.vertexAttribPointer(c.position,
|
|
|
+n,p,q;l=G(a,b,c,d,f);a=l.attributes;b=e.attributes;c=!1;l=16777215*e.id+2*l.id+(d.wireframe?1:0);l!==$&&($=l,c=!0);c&&k();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;1<e.length&&(c=!0);for(var r=0,s=e.length;r<s;r++){var t=e[r].index;if(c){for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,t*q*4)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):
|
|
|
+3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)}m.drawElements(m.TRIANGLES,e[r].count,m.UNSIGNED_SHORT,2*e[r].start);J.info.render.calls++;J.info.render.vertices+=e[r].count;J.info.render.faces+=e[r].count/3}}else{if(c)for(n in a)"index"!==n&&(p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&
|
|
|
+(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n]))));d=e.attributes.position;m.drawArrays(m.TRIANGLES,0,d.array.length/3);J.info.render.calls++;J.info.render.vertices+=d.array.length/3;J.info.render.faces+=d.array.length/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,
|
|
|
+q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));d=b.position;m.drawArrays(m.POINTS,0,d.array.length/3);J.info.render.calls++;J.info.render.points+=d.array.length/3}else if(f instanceof THREE.Line)if(n=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),f=b.index)for(e=e.offsets,1<e.length&&
|
|
|
+(c=!0),r=0,s=e.length;r<s;r++)t=e[r].index,c&&(g(d,a,b,t),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,e[r].count,m.UNSIGNED_SHORT,2*e[r].start),J.info.render.calls++,J.info.render.vertices+=e[r].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(n,0,d.array.length/3),J.info.render.calls++,J.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,l;c=G(a,b,c,d,f);a=c.attributes;b=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==
|
|
|
+$&&($=c,b=!0);b&&k();if(!d.morphTargets&&0<=a.position)b&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),m.vertexAttribPointer(c.position,
|
|
|
3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var p=0;l=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;p<d.numSupportedMorphTargets&&p<l.length;)0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[p]]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[p]]),h(c["morphNormal"+p]),m.vertexAttribPointer(c["morphNormal"+p],3,
|
|
|
m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[l[p]],p++}else{l=[];g=f.morphTargetInfluences;var q,r=g.length;for(q=0;q<r;q++)p=g[q],0<p&&l.push([p,q]);l.length>d.numSupportedMorphTargets?(l.sort(n),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(n):0===l.length&&l.push([0,0]);for(p=0;p<d.numSupportedMorphTargets;)l[p]?(q=l[p][1],0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+
|
|
|
p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[q]),h(c["morphNormal"+p]),m.vertexAttribPointer(c["morphNormal"+p],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[q]):f.__webglMorphTargetInfluences[p]=0,p++}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList)for(g=0,l=e.__webglCustomAttributesList.length;g<
|
|
|
l;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),m.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,m.FLOAT,!1,0,0));0<=a.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib3fv(a.color,d.defaultAttributeValues.color));0<=a.normal&&
|
|
|
(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));0<=a.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));0<=a.uv&&(f.geometry.faceVertexUvs[0]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib2fv(a.uv,d.defaultAttributeValues.uv));0<=a.uv2&&(f.geometry.faceVertexUvs[1]?
|
|
|
(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib2fv(a.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=a.skinIndex&&0<=a.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0));0<=a.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-e.__webglLineDistanceBuffer),h(a.lineDistance),m.vertexAttribPointer(a.lineDistance,1,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(z(d.wireframeLinewidth),b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,m.UNSIGNED_SHORT,0)):(b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,m.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=e.__webglFaceCount,O.info.render.faces+=
|
|
|
-e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),O.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),O.info.render.calls++,O.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,g,h,k=a.__lights,
|
|
|
-n=a.fog;va=-1;ga=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ib.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(ib);this.autoUpdateObjects&&this.initWebGLObjects(a);q(this.renderPluginsPre,a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;O.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
-h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||la.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,r=p.object,t=p.buffer,v=r.geometry,r=r.material;r instanceof THREE.MeshFaceMaterial?(r=r.materials[v instanceof THREE.BufferGeometry?0:t.materialIndex],r.transparent?
|
|
|
-(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=null)):r&&(r.transparent?(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ua.setFromMatrixPosition(g.matrixWorld),ua.applyProjection(ib),f.z=ua.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),
|
|
|
+e.__webglLineDistanceBuffer),h(a.lineDistance),m.vertexAttribPointer(a.lineDistance,1,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(z(d.wireframeLinewidth),b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,m.UNSIGNED_SHORT,0)):(b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,m.UNSIGNED_SHORT,0)),J.info.render.calls++,J.info.render.vertices+=e.__webglFaceCount,J.info.render.faces+=
|
|
|
+e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),J.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),J.info.render.calls++,J.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,g,h,k=a.__lights,
|
|
|
+n=a.fog;za=-1;fa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ib.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Na.setFromMatrix(ib);this.autoUpdateObjects&&this.initWebGLObjects(a);q(this.renderPluginsPre,a,b);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;J.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Na.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,r=p.object,t=p.buffer,v=r.geometry,r=r.material;r instanceof THREE.MeshFaceMaterial?(r=r.materials[v instanceof THREE.BufferGeometry?0:t.materialIndex],r.transparent?
|
|
|
+(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=null)):r&&(r.transparent?(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ya.setFromMatrixPosition(g.matrixWorld),ya.applyProjection(ib),f.z=ya.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),
|
|
|
g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),M(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,k,n,!0,d),u(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,k,n,!1,d),u(a.__webglObjectsImmediate,
|
|
|
"opaque",b,k,n,!1,d),s(a.__webglObjects,!1,"transparent",b,k,n,!0,d),u(a.__webglObjectsImmediate,"transparent",b,k,n,!0,d));q(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,
|
|
|
-null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=F(a,b,c,d,e);wa=-1;O.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,la):e.render(function(a){O.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;)r(a.__objectsRemoved[0],
|
|
|
+null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=G(a,b,c,d,e);$=-1;J.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,Na):e.render(function(a){J.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;)r(a.__objectsRemoved[0],
|
|
|
a),a.__objectsRemoved.splice(0,1);for(var b=0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&r(h,a),t(h,a));var k=h,l=k.geometry,p=void 0,q=void 0,s=void 0;if(l instanceof THREE.BufferGeometry){var u=m.DYNAMIC_DRAW,x=!l.dynamic,A=l.attributes,y=void 0,C=void 0;for(y in A)C=A[y],C.needsUpdate&&("index"===y?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,C.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,C.array,u)):(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-C.buffer),m.bufferData(m.ARRAY_BUFFER,C.array,u)),C.needsUpdate=!1),x&&!C.dynamic&&(C.array=null)}else if(k instanceof THREE.Mesh){for(var B=0,F=l.geometryGroupsList.length;B<F;B++)if(p=l.geometryGroupsList[B],s=d(k,p),l.buffersNeedUpdate&&c(p,k),q=s.attributes&&v(s),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||q){var z=p,E=k,D=m.DYNAMIC_DRAW,M=!l.dynamic,G=s;if(z.__inittedArrays){var I=e(G),Q=
|
|
|
-G.vertexColors?G.vertexColors:!1,N=f(G),O=I===THREE.SmoothShading,H=void 0,L=void 0,R=void 0,J=void 0,Y=void 0,T=void 0,S=void 0,W=void 0,ca=void 0,pa=void 0,va=void 0,U=void 0,aa=void 0,$=void 0,Z=void 0,Fa=void 0,za=void 0,wa=void 0,ea=void 0,fa=void 0,ga=void 0,La=void 0,xa=void 0,ka=void 0,ja=void 0,na=void 0,qa=void 0,ra=void 0,ya=void 0,da=void 0,Ga=void 0,Aa=void 0,Ea=void 0,Ma=void 0,la=void 0,Na=void 0,Ba=void 0,Ha=void 0,Qa=void 0,Ya=void 0,Ca=0,Da=0,Oa=0,Pa=0,Ra=0,Ia=0,Za=0,Sa=0,db=0,ta=
|
|
|
-0,Ja=0,P=0,Xa=void 0,jb=z.__vertexArray,gb=z.__uvArray,hb=z.__uv2Array,Wa=z.__normalArray,$a=z.__tangentArray,kb=z.__colorArray,ab=z.__skinIndexArray,bb=z.__skinWeightArray,xb=z.__morphTargetsArrays,yb=z.__morphNormalsArrays,tb=z.__webglCustomAttributesList,K=void 0,Nb=z.__faceArray,ub=z.__lineArray,Ta=E.geometry,Ib=Ta.elementsNeedUpdate,Cb=Ta.uvsNeedUpdate,Jb=Ta.normalsNeedUpdate,Kb=Ta.tangentsNeedUpdate,Lb=Ta.colorsNeedUpdate,Mb=Ta.morphTargetsNeedUpdate,cc=Ta.vertices,ha=z.faces3,lb=Ta.faces,Db=
|
|
|
-Ta.faceVertexUvs[0],ic=Ta.faceVertexUvs[1],dc=Ta.skinIndices,Ob=Ta.skinWeights,Pb=Ta.morphTargets,jc=Ta.morphNormals;if(Ta.verticesNeedUpdate){H=0;for(L=ha.length;H<L;H++)J=lb[ha[H]],U=cc[J.a],aa=cc[J.b],$=cc[J.c],jb[Da]=U.x,jb[Da+1]=U.y,jb[Da+2]=U.z,jb[Da+3]=aa.x,jb[Da+4]=aa.y,jb[Da+5]=aa.z,jb[Da+6]=$.x,jb[Da+7]=$.y,jb[Da+8]=$.z,Da+=9;m.bindBuffer(m.ARRAY_BUFFER,z.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,jb,D)}if(Mb)for(la=0,Na=Pb.length;la<Na;la++){H=Ja=0;for(L=ha.length;H<L;H++)Qa=ha[H],
|
|
|
-J=lb[Qa],U=Pb[la].vertices[J.a],aa=Pb[la].vertices[J.b],$=Pb[la].vertices[J.c],Ba=xb[la],Ba[Ja]=U.x,Ba[Ja+1]=U.y,Ba[Ja+2]=U.z,Ba[Ja+3]=aa.x,Ba[Ja+4]=aa.y,Ba[Ja+5]=aa.z,Ba[Ja+6]=$.x,Ba[Ja+7]=$.y,Ba[Ja+8]=$.z,G.morphNormals&&(O?(Ya=jc[la].vertexNormals[Qa],wa=Ya.a,ea=Ya.b,fa=Ya.c):fa=ea=wa=jc[la].faceNormals[Qa],Ha=yb[la],Ha[Ja]=wa.x,Ha[Ja+1]=wa.y,Ha[Ja+2]=wa.z,Ha[Ja+3]=ea.x,Ha[Ja+4]=ea.y,Ha[Ja+5]=ea.z,Ha[Ja+6]=fa.x,Ha[Ja+7]=fa.y,Ha[Ja+8]=fa.z),Ja+=9;m.bindBuffer(m.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[la]);
|
|
|
-m.bufferData(m.ARRAY_BUFFER,xb[la],D);G.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglMorphNormalsBuffers[la]),m.bufferData(m.ARRAY_BUFFER,yb[la],D))}if(Ob.length){H=0;for(L=ha.length;H<L;H++)J=lb[ha[H]],ka=Ob[J.a],ja=Ob[J.b],na=Ob[J.c],bb[ta]=ka.x,bb[ta+1]=ka.y,bb[ta+2]=ka.z,bb[ta+3]=ka.w,bb[ta+4]=ja.x,bb[ta+5]=ja.y,bb[ta+6]=ja.z,bb[ta+7]=ja.w,bb[ta+8]=na.x,bb[ta+9]=na.y,bb[ta+10]=na.z,bb[ta+11]=na.w,qa=dc[J.a],ra=dc[J.b],ya=dc[J.c],ab[ta]=qa.x,ab[ta+1]=qa.y,ab[ta+2]=qa.z,ab[ta+3]=qa.w,ab[ta+
|
|
|
-4]=ra.x,ab[ta+5]=ra.y,ab[ta+6]=ra.z,ab[ta+7]=ra.w,ab[ta+8]=ya.x,ab[ta+9]=ya.y,ab[ta+10]=ya.z,ab[ta+11]=ya.w,ta+=12;0<ta&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,ab,D),m.bindBuffer(m.ARRAY_BUFFER,z.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,bb,D))}if(Lb&&Q){H=0;for(L=ha.length;H<L;H++)J=lb[ha[H]],S=J.vertexColors,W=J.color,3===S.length&&Q===THREE.VertexColors?(ga=S[0],La=S[1],xa=S[2]):xa=La=ga=W,kb[db]=ga.r,kb[db+1]=ga.g,kb[db+2]=ga.b,kb[db+3]=
|
|
|
-La.r,kb[db+4]=La.g,kb[db+5]=La.b,kb[db+6]=xa.r,kb[db+7]=xa.g,kb[db+8]=xa.b,db+=9;0<db&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,kb,D))}if(Kb&&Ta.hasTangents){H=0;for(L=ha.length;H<L;H++)J=lb[ha[H]],ca=J.vertexTangents,Z=ca[0],Fa=ca[1],za=ca[2],$a[Za]=Z.x,$a[Za+1]=Z.y,$a[Za+2]=Z.z,$a[Za+3]=Z.w,$a[Za+4]=Fa.x,$a[Za+5]=Fa.y,$a[Za+6]=Fa.z,$a[Za+7]=Fa.w,$a[Za+8]=za.x,$a[Za+9]=za.y,$a[Za+10]=za.z,$a[Za+11]=za.w,Za+=12;m.bindBuffer(m.ARRAY_BUFFER,z.__webglTangentBuffer);
|
|
|
-m.bufferData(m.ARRAY_BUFFER,$a,D)}if(Jb&&I){H=0;for(L=ha.length;H<L;H++)if(J=lb[ha[H]],Y=J.vertexNormals,T=J.normal,3===Y.length&&O)for(da=0;3>da;da++)Aa=Y[da],Wa[Ia]=Aa.x,Wa[Ia+1]=Aa.y,Wa[Ia+2]=Aa.z,Ia+=3;else for(da=0;3>da;da++)Wa[Ia]=T.x,Wa[Ia+1]=T.y,Wa[Ia+2]=T.z,Ia+=3;m.bindBuffer(m.ARRAY_BUFFER,z.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Wa,D)}if(Cb&&Db&&N){H=0;for(L=ha.length;H<L;H++)if(R=ha[H],pa=Db[R],void 0!==pa)for(da=0;3>da;da++)Ea=pa[da],gb[Oa]=Ea.x,gb[Oa+1]=Ea.y,Oa+=2;0<Oa&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-z.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,gb,D))}if(Cb&&ic&&N){H=0;for(L=ha.length;H<L;H++)if(R=ha[H],va=ic[R],void 0!==va)for(da=0;3>da;da++)Ma=va[da],hb[Pa]=Ma.x,hb[Pa+1]=Ma.y,Pa+=2;0<Pa&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,hb,D))}if(Ib){H=0;for(L=ha.length;H<L;H++)Nb[Ra]=Ca,Nb[Ra+1]=Ca+1,Nb[Ra+2]=Ca+2,Ra+=3,ub[Sa]=Ca,ub[Sa+1]=Ca+1,ub[Sa+2]=Ca,ub[Sa+3]=Ca+2,ub[Sa+4]=Ca+1,ub[Sa+5]=Ca+2,Sa+=6,Ca+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);
|
|
|
-m.bufferData(m.ELEMENT_ARRAY_BUFFER,Nb,D);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,ub,D)}if(tb)for(da=0,Ga=tb.length;da<Ga;da++)if(K=tb[da],K.__original.needsUpdate){P=0;if(1===K.size)if(void 0===K.boundTo||"vertices"===K.boundTo)for(H=0,L=ha.length;H<L;H++)J=lb[ha[H]],K.array[P]=K.value[J.a],K.array[P+1]=K.value[J.b],K.array[P+2]=K.value[J.c],P+=3;else{if("faces"===K.boundTo)for(H=0,L=ha.length;H<L;H++)Xa=K.value[ha[H]],K.array[P]=Xa,K.array[P+
|
|
|
-1]=Xa,K.array[P+2]=Xa,P+=3}else if(2===K.size)if(void 0===K.boundTo||"vertices"===K.boundTo)for(H=0,L=ha.length;H<L;H++)J=lb[ha[H]],U=K.value[J.a],aa=K.value[J.b],$=K.value[J.c],K.array[P]=U.x,K.array[P+1]=U.y,K.array[P+2]=aa.x,K.array[P+3]=aa.y,K.array[P+4]=$.x,K.array[P+5]=$.y,P+=6;else{if("faces"===K.boundTo)for(H=0,L=ha.length;H<L;H++)$=aa=U=Xa=K.value[ha[H]],K.array[P]=U.x,K.array[P+1]=U.y,K.array[P+2]=aa.x,K.array[P+3]=aa.y,K.array[P+4]=$.x,K.array[P+5]=$.y,P+=6}else if(3===K.size){var sa;sa=
|
|
|
-"c"===K.type?["r","g","b"]:["x","y","z"];if(void 0===K.boundTo||"vertices"===K.boundTo)for(H=0,L=ha.length;H<L;H++)J=lb[ha[H]],U=K.value[J.a],aa=K.value[J.b],$=K.value[J.c],K.array[P]=U[sa[0]],K.array[P+1]=U[sa[1]],K.array[P+2]=U[sa[2]],K.array[P+3]=aa[sa[0]],K.array[P+4]=aa[sa[1]],K.array[P+5]=aa[sa[2]],K.array[P+6]=$[sa[0]],K.array[P+7]=$[sa[1]],K.array[P+8]=$[sa[2]],P+=9;else if("faces"===K.boundTo)for(H=0,L=ha.length;H<L;H++)$=aa=U=Xa=K.value[ha[H]],K.array[P]=U[sa[0]],K.array[P+1]=U[sa[1]],K.array[P+
|
|
|
-2]=U[sa[2]],K.array[P+3]=aa[sa[0]],K.array[P+4]=aa[sa[1]],K.array[P+5]=aa[sa[2]],K.array[P+6]=$[sa[0]],K.array[P+7]=$[sa[1]],K.array[P+8]=$[sa[2]],P+=9;else if("faceVertices"===K.boundTo)for(H=0,L=ha.length;H<L;H++)Xa=K.value[ha[H]],U=Xa[0],aa=Xa[1],$=Xa[2],K.array[P]=U[sa[0]],K.array[P+1]=U[sa[1]],K.array[P+2]=U[sa[2]],K.array[P+3]=aa[sa[0]],K.array[P+4]=aa[sa[1]],K.array[P+5]=aa[sa[2]],K.array[P+6]=$[sa[0]],K.array[P+7]=$[sa[1]],K.array[P+8]=$[sa[2]],P+=9}else if(4===K.size)if(void 0===K.boundTo||
|
|
|
-"vertices"===K.boundTo)for(H=0,L=ha.length;H<L;H++)J=lb[ha[H]],U=K.value[J.a],aa=K.value[J.b],$=K.value[J.c],K.array[P]=U.x,K.array[P+1]=U.y,K.array[P+2]=U.z,K.array[P+3]=U.w,K.array[P+4]=aa.x,K.array[P+5]=aa.y,K.array[P+6]=aa.z,K.array[P+7]=aa.w,K.array[P+8]=$.x,K.array[P+9]=$.y,K.array[P+10]=$.z,K.array[P+11]=$.w,P+=12;else if("faces"===K.boundTo)for(H=0,L=ha.length;H<L;H++)$=aa=U=Xa=K.value[ha[H]],K.array[P]=U.x,K.array[P+1]=U.y,K.array[P+2]=U.z,K.array[P+3]=U.w,K.array[P+4]=aa.x,K.array[P+5]=
|
|
|
-aa.y,K.array[P+6]=aa.z,K.array[P+7]=aa.w,K.array[P+8]=$.x,K.array[P+9]=$.y,K.array[P+10]=$.z,K.array[P+11]=$.w,P+=12;else if("faceVertices"===K.boundTo)for(H=0,L=ha.length;H<L;H++)Xa=K.value[ha[H]],U=Xa[0],aa=Xa[1],$=Xa[2],K.array[P]=U.x,K.array[P+1]=U.y,K.array[P+2]=U.z,K.array[P+3]=U.w,K.array[P+4]=aa.x,K.array[P+5]=aa.y,K.array[P+6]=aa.z,K.array[P+7]=aa.w,K.array[P+8]=$.x,K.array[P+9]=$.y,K.array[P+10]=$.z,K.array[P+11]=$.w,P+=12;m.bindBuffer(m.ARRAY_BUFFER,K.buffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
-K.array,D)}M&&(delete z.__inittedArrays,delete z.__colorArray,delete z.__normalArray,delete z.__tangentArray,delete z.__uvArray,delete z.__uv2Array,delete z.__faceArray,delete z.__vertexArray,delete z.__lineArray,delete z.__skinIndexArray,delete z.__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;s.attributes&&w(s)}else if(k instanceof THREE.Line){s=
|
|
|
-d(k,l);q=s.attributes&&v(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||q){var cb=l,Qb=m.DYNAMIC_DRAW,Eb=void 0,Fb=void 0,Gb=void 0,Rb=void 0,oa=void 0,Sb=void 0,kc=cb.vertices,lc=cb.colors,mc=cb.lineDistances,Xb=kc.length,Yb=lc.length,Zb=mc.length,Tb=cb.__vertexArray,Ub=cb.__colorArray,nc=cb.__lineDistanceArray,$b=cb.colorsNeedUpdate,ac=cb.lineDistancesNeedUpdate,ec=cb.__webglCustomAttributesList,Vb=void 0,oc=void 0,Ka=void 0,Ab=void 0,Ua=void 0,ma=void 0;if(cb.verticesNeedUpdate){for(Eb=
|
|
|
-0;Eb<Xb;Eb++)Rb=kc[Eb],oa=3*Eb,Tb[oa]=Rb.x,Tb[oa+1]=Rb.y,Tb[oa+2]=Rb.z;m.bindBuffer(m.ARRAY_BUFFER,cb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Tb,Qb)}if($b){for(Fb=0;Fb<Yb;Fb++)Sb=lc[Fb],oa=3*Fb,Ub[oa]=Sb.r,Ub[oa+1]=Sb.g,Ub[oa+2]=Sb.b;m.bindBuffer(m.ARRAY_BUFFER,cb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Ub,Qb)}if(ac){for(Gb=0;Gb<Zb;Gb++)nc[Gb]=mc[Gb];m.bindBuffer(m.ARRAY_BUFFER,cb.__webglLineDistanceBuffer);m.bufferData(m.ARRAY_BUFFER,nc,Qb)}if(ec)for(Vb=0,oc=ec.length;Vb<oc;Vb++)if(ma=
|
|
|
-ec[Vb],ma.needsUpdate&&(void 0===ma.boundTo||"vertices"===ma.boundTo)){oa=0;Ab=ma.value.length;if(1===ma.size)for(Ka=0;Ka<Ab;Ka++)ma.array[Ka]=ma.value[Ka];else if(2===ma.size)for(Ka=0;Ka<Ab;Ka++)Ua=ma.value[Ka],ma.array[oa]=Ua.x,ma.array[oa+1]=Ua.y,oa+=2;else if(3===ma.size)if("c"===ma.type)for(Ka=0;Ka<Ab;Ka++)Ua=ma.value[Ka],ma.array[oa]=Ua.r,ma.array[oa+1]=Ua.g,ma.array[oa+2]=Ua.b,oa+=3;else for(Ka=0;Ka<Ab;Ka++)Ua=ma.value[Ka],ma.array[oa]=Ua.x,ma.array[oa+1]=Ua.y,ma.array[oa+2]=Ua.z,oa+=3;else if(4===
|
|
|
-ma.size)for(Ka=0;Ka<Ab;Ka++)Ua=ma.value[Ka],ma.array[oa]=Ua.x,ma.array[oa+1]=Ua.y,ma.array[oa+2]=Ua.z,ma.array[oa+3]=Ua.w,oa+=4;m.bindBuffer(m.ARRAY_BUFFER,ma.buffer);m.bufferData(m.ARRAY_BUFFER,ma.array,Qb)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;s.attributes&&w(s)}else if(k instanceof THREE.ParticleSystem){s=d(k,l);q=s.attributes&&v(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||k.sortParticles||q){var mb=l,fc=m.DYNAMIC_DRAW,Hb=k,Va=void 0,nb=void 0,ob=void 0,
|
|
|
-X=void 0,pb=void 0,sb=void 0,Wb=mb.vertices,gc=Wb.length,hc=mb.colors,pc=hc.length,vb=mb.__vertexArray,wb=mb.__colorArray,qb=mb.__sortArray,qc=mb.verticesNeedUpdate,rc=mb.colorsNeedUpdate,rb=mb.__webglCustomAttributesList,eb=void 0,Bb=void 0,ba=void 0,fb=void 0,ia=void 0,V=void 0;if(Hb.sortParticles){zb.copy(ib);zb.multiply(Hb.matrixWorld);for(Va=0;Va<gc;Va++)ob=Wb[Va],ua.copy(ob),ua.applyProjection(zb),qb[Va]=[ua.z,Va];qb.sort(n);for(Va=0;Va<gc;Va++)ob=Wb[qb[Va][1]],X=3*Va,vb[X]=ob.x,vb[X+1]=ob.y,
|
|
|
-vb[X+2]=ob.z;for(nb=0;nb<pc;nb++)X=3*nb,sb=hc[qb[nb][1]],wb[X]=sb.r,wb[X+1]=sb.g,wb[X+2]=sb.b;if(rb)for(eb=0,Bb=rb.length;eb<Bb;eb++)if(V=rb[eb],void 0===V.boundTo||"vertices"===V.boundTo)if(X=0,fb=V.value.length,1===V.size)for(ba=0;ba<fb;ba++)pb=qb[ba][1],V.array[ba]=V.value[pb];else if(2===V.size)for(ba=0;ba<fb;ba++)pb=qb[ba][1],ia=V.value[pb],V.array[X]=ia.x,V.array[X+1]=ia.y,X+=2;else if(3===V.size)if("c"===V.type)for(ba=0;ba<fb;ba++)pb=qb[ba][1],ia=V.value[pb],V.array[X]=ia.r,V.array[X+1]=ia.g,
|
|
|
-V.array[X+2]=ia.b,X+=3;else for(ba=0;ba<fb;ba++)pb=qb[ba][1],ia=V.value[pb],V.array[X]=ia.x,V.array[X+1]=ia.y,V.array[X+2]=ia.z,X+=3;else if(4===V.size)for(ba=0;ba<fb;ba++)pb=qb[ba][1],ia=V.value[pb],V.array[X]=ia.x,V.array[X+1]=ia.y,V.array[X+2]=ia.z,V.array[X+3]=ia.w,X+=4}else{if(qc)for(Va=0;Va<gc;Va++)ob=Wb[Va],X=3*Va,vb[X]=ob.x,vb[X+1]=ob.y,vb[X+2]=ob.z;if(rc)for(nb=0;nb<pc;nb++)sb=hc[nb],X=3*nb,wb[X]=sb.r,wb[X+1]=sb.g,wb[X+2]=sb.b;if(rb)for(eb=0,Bb=rb.length;eb<Bb;eb++)if(V=rb[eb],V.needsUpdate&&
|
|
|
-(void 0===V.boundTo||"vertices"===V.boundTo))if(fb=V.value.length,X=0,1===V.size)for(ba=0;ba<fb;ba++)V.array[ba]=V.value[ba];else if(2===V.size)for(ba=0;ba<fb;ba++)ia=V.value[ba],V.array[X]=ia.x,V.array[X+1]=ia.y,X+=2;else if(3===V.size)if("c"===V.type)for(ba=0;ba<fb;ba++)ia=V.value[ba],V.array[X]=ia.r,V.array[X+1]=ia.g,V.array[X+2]=ia.b,X+=3;else for(ba=0;ba<fb;ba++)ia=V.value[ba],V.array[X]=ia.x,V.array[X+1]=ia.y,V.array[X+2]=ia.z,X+=3;else if(4===V.size)for(ba=0;ba<fb;ba++)ia=V.value[ba],V.array[X]=
|
|
|
-ia.x,V.array[X+1]=ia.y,V.array[X+2]=ia.z,V.array[X+3]=ia.w,X+=4}if(qc||Hb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,vb,fc);if(rc||Hb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,wb,fc);if(rb)for(eb=0,Bb=rb.length;eb<Bb;eb++)if(V=rb[eb],V.needsUpdate||Hb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,V.buffer),m.bufferData(m.ARRAY_BUFFER,V.array,fc)}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;s.attributes&&
|
|
|
-w(s)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Lb);var k,l,p,n,q;a instanceof THREE.MeshDepthMaterial?q="depth":a instanceof THREE.MeshNormalMaterial?q="normal":a instanceof THREE.MeshBasicMaterial?q="basic":a instanceof THREE.MeshLambertMaterial?q="lambert":a instanceof THREE.MeshPhongMaterial?q="phong":a instanceof THREE.LineBasicMaterial?q="basic":a instanceof THREE.LineDashedMaterial?q="dashed":a instanceof THREE.ParticleSystemMaterial&&(q="particle_basic");
|
|
|
-if(q){var r=THREE.ShaderLib[q];a.uniforms=THREE.UniformsUtils.clone(r.uniforms);a.vertexShader=r.vertexShader;a.fragmentShader=r.fragmentShader}var s=e=0,t=0,u=r=0;for(f=b.length;u<f;u++)g=b[u],g.onlyShadow||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&s++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&r++);f=s;g=t;h=r;t=r=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&r++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&
|
|
|
-r++);n=r;yb&&d&&d.useVertexTexture?p=1024:(b=m.getParameter(m.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)")),p=b);a:{t=a.fragmentShader;s=a.vertexShader;r=a.uniforms;b=a.attributes;u=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:p,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
-shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide};d=a.index0AttributeName;var v,w,x;e=[];q?e.push(q):(e.push(t),e.push(s));for(w in u)e.push(w),e.push(u[w]);for(v in c)e.push(v),e.push(c[v]);q=e.join();v=0;for(w=H.length;v<w;v++)if(e=H[v],e.code===q){e.usedTimes++;l=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?
|
|
|
-v="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e="#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+Y+" float;","precision "+Y+" int;",e,xb?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.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.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:"",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");
|
|
|
-v=["precision "+Y+" float;","precision "+Y+" 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:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&
|
|
|
+C.buffer),m.bufferData(m.ARRAY_BUFFER,C.array,u)),C.needsUpdate=!1),x&&!C.dynamic&&(C.array=null)}else if(k instanceof THREE.Mesh){for(var B=0,G=l.geometryGroupsList.length;B<G;B++)if(p=l.geometryGroupsList[B],s=d(k,p),l.buffersNeedUpdate&&c(p,k),q=s.attributes&&v(s),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||q){var z=p,F=k,E=m.DYNAMIC_DRAW,M=!l.dynamic,H=s;if(z.__inittedArrays){var I=e(H),Q=
|
|
|
+H.vertexColors?H.vertexColors:!1,J=f(H),N=I===THREE.SmoothShading,D=void 0,O=void 0,ba=void 0,K=void 0,X=void 0,R=void 0,T=void 0,$=void 0,W=void 0,ra=void 0,za=void 0,S=void 0,Z=void 0,Y=void 0,oa=void 0,Fa=void 0,Ca=void 0,da=void 0,ea=void 0,fa=void 0,Oa=void 0,Aa=void 0,ka=void 0,ha=void 0,ja=void 0,la=void 0,pa=void 0,Ba=void 0,xa=void 0,ca=void 0,Ga=void 0,Ea=void 0,Ka=void 0,La=void 0,ma=void 0,Ta=void 0,va=void 0,wa=void 0,Ma=void 0,Na=void 0,ta=0,Da=0,Sa=0,Pa=0,Ra=0,Ha=0,Za=0,Qa=0,eb=0,ua=
|
|
|
+0,Ia=0,P=0,Ya=void 0,jb=z.__vertexArray,db=z.__uvArray,hb=z.__uv2Array,Xa=z.__normalArray,$a=z.__tangentArray,kb=z.__colorArray,ab=z.__skinIndexArray,bb=z.__skinWeightArray,xb=z.__morphTargetsArrays,yb=z.__morphNormalsArrays,tb=z.__webglCustomAttributesList,L=void 0,Nb=z.__faceArray,ub=z.__lineArray,Ua=F.geometry,Ib=Ua.elementsNeedUpdate,Cb=Ua.uvsNeedUpdate,Jb=Ua.normalsNeedUpdate,Kb=Ua.tangentsNeedUpdate,Lb=Ua.colorsNeedUpdate,Mb=Ua.morphTargetsNeedUpdate,cc=Ua.vertices,ga=z.faces3,lb=Ua.faces,Db=
|
|
|
+Ua.faceVertexUvs[0],ic=Ua.faceVertexUvs[1],dc=Ua.skinIndices,Ob=Ua.skinWeights,Pb=Ua.morphTargets,jc=Ua.morphNormals;if(Ua.verticesNeedUpdate){D=0;for(O=ga.length;D<O;D++)K=lb[ga[D]],S=cc[K.a],Z=cc[K.b],Y=cc[K.c],jb[Da]=S.x,jb[Da+1]=S.y,jb[Da+2]=S.z,jb[Da+3]=Z.x,jb[Da+4]=Z.y,jb[Da+5]=Z.z,jb[Da+6]=Y.x,jb[Da+7]=Y.y,jb[Da+8]=Y.z,Da+=9;m.bindBuffer(m.ARRAY_BUFFER,z.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,jb,E)}if(Mb)for(ma=0,Ta=Pb.length;ma<Ta;ma++){D=Ia=0;for(O=ga.length;D<O;D++)Ma=ga[D],K=
|
|
|
+lb[Ma],S=Pb[ma].vertices[K.a],Z=Pb[ma].vertices[K.b],Y=Pb[ma].vertices[K.c],va=xb[ma],va[Ia]=S.x,va[Ia+1]=S.y,va[Ia+2]=S.z,va[Ia+3]=Z.x,va[Ia+4]=Z.y,va[Ia+5]=Z.z,va[Ia+6]=Y.x,va[Ia+7]=Y.y,va[Ia+8]=Y.z,H.morphNormals&&(N?(Na=jc[ma].vertexNormals[Ma],da=Na.a,ea=Na.b,fa=Na.c):fa=ea=da=jc[ma].faceNormals[Ma],wa=yb[ma],wa[Ia]=da.x,wa[Ia+1]=da.y,wa[Ia+2]=da.z,wa[Ia+3]=ea.x,wa[Ia+4]=ea.y,wa[Ia+5]=ea.z,wa[Ia+6]=fa.x,wa[Ia+7]=fa.y,wa[Ia+8]=fa.z),Ia+=9;m.bindBuffer(m.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[ma]);
|
|
|
+m.bufferData(m.ARRAY_BUFFER,xb[ma],E);H.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglMorphNormalsBuffers[ma]),m.bufferData(m.ARRAY_BUFFER,yb[ma],E))}if(Ob.length){D=0;for(O=ga.length;D<O;D++)K=lb[ga[D]],ha=Ob[K.a],ja=Ob[K.b],la=Ob[K.c],bb[ua]=ha.x,bb[ua+1]=ha.y,bb[ua+2]=ha.z,bb[ua+3]=ha.w,bb[ua+4]=ja.x,bb[ua+5]=ja.y,bb[ua+6]=ja.z,bb[ua+7]=ja.w,bb[ua+8]=la.x,bb[ua+9]=la.y,bb[ua+10]=la.z,bb[ua+11]=la.w,pa=dc[K.a],Ba=dc[K.b],xa=dc[K.c],ab[ua]=pa.x,ab[ua+1]=pa.y,ab[ua+2]=pa.z,ab[ua+3]=pa.w,ab[ua+
|
|
|
+4]=Ba.x,ab[ua+5]=Ba.y,ab[ua+6]=Ba.z,ab[ua+7]=Ba.w,ab[ua+8]=xa.x,ab[ua+9]=xa.y,ab[ua+10]=xa.z,ab[ua+11]=xa.w,ua+=12;0<ua&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,ab,E),m.bindBuffer(m.ARRAY_BUFFER,z.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,bb,E))}if(Lb&&Q){D=0;for(O=ga.length;D<O;D++)K=lb[ga[D]],T=K.vertexColors,$=K.color,3===T.length&&Q===THREE.VertexColors?(Oa=T[0],Aa=T[1],ka=T[2]):ka=Aa=Oa=$,kb[eb]=Oa.r,kb[eb+1]=Oa.g,kb[eb+2]=Oa.b,kb[eb+3]=
|
|
|
+Aa.r,kb[eb+4]=Aa.g,kb[eb+5]=Aa.b,kb[eb+6]=ka.r,kb[eb+7]=ka.g,kb[eb+8]=ka.b,eb+=9;0<eb&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,kb,E))}if(Kb&&Ua.hasTangents){D=0;for(O=ga.length;D<O;D++)K=lb[ga[D]],W=K.vertexTangents,oa=W[0],Fa=W[1],Ca=W[2],$a[Za]=oa.x,$a[Za+1]=oa.y,$a[Za+2]=oa.z,$a[Za+3]=oa.w,$a[Za+4]=Fa.x,$a[Za+5]=Fa.y,$a[Za+6]=Fa.z,$a[Za+7]=Fa.w,$a[Za+8]=Ca.x,$a[Za+9]=Ca.y,$a[Za+10]=Ca.z,$a[Za+11]=Ca.w,Za+=12;m.bindBuffer(m.ARRAY_BUFFER,z.__webglTangentBuffer);
|
|
|
+m.bufferData(m.ARRAY_BUFFER,$a,E)}if(Jb&&I){D=0;for(O=ga.length;D<O;D++)if(K=lb[ga[D]],X=K.vertexNormals,R=K.normal,3===X.length&&N)for(ca=0;3>ca;ca++)Ea=X[ca],Xa[Ha]=Ea.x,Xa[Ha+1]=Ea.y,Xa[Ha+2]=Ea.z,Ha+=3;else for(ca=0;3>ca;ca++)Xa[Ha]=R.x,Xa[Ha+1]=R.y,Xa[Ha+2]=R.z,Ha+=3;m.bindBuffer(m.ARRAY_BUFFER,z.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Xa,E)}if(Cb&&Db&&J){D=0;for(O=ga.length;D<O;D++)if(ba=ga[D],ra=Db[ba],void 0!==ra)for(ca=0;3>ca;ca++)Ka=ra[ca],db[Sa]=Ka.x,db[Sa+1]=Ka.y,Sa+=2;0<Sa&&
|
|
|
+(m.bindBuffer(m.ARRAY_BUFFER,z.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,db,E))}if(Cb&&ic&&J){D=0;for(O=ga.length;D<O;D++)if(ba=ga[D],za=ic[ba],void 0!==za)for(ca=0;3>ca;ca++)La=za[ca],hb[Pa]=La.x,hb[Pa+1]=La.y,Pa+=2;0<Pa&&(m.bindBuffer(m.ARRAY_BUFFER,z.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,hb,E))}if(Ib){D=0;for(O=ga.length;D<O;D++)Nb[Ra]=ta,Nb[Ra+1]=ta+1,Nb[Ra+2]=ta+2,Ra+=3,ub[Qa]=ta,ub[Qa+1]=ta+1,ub[Qa+2]=ta,ub[Qa+3]=ta+2,ub[Qa+4]=ta+1,ub[Qa+5]=ta+2,Qa+=6,ta+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
+z.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Nb,E);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,ub,E)}if(tb)for(ca=0,Ga=tb.length;ca<Ga;ca++)if(L=tb[ca],L.__original.needsUpdate){P=0;if(1===L.size)if(void 0===L.boundTo||"vertices"===L.boundTo)for(D=0,O=ga.length;D<O;D++)K=lb[ga[D]],L.array[P]=L.value[K.a],L.array[P+1]=L.value[K.b],L.array[P+2]=L.value[K.c],P+=3;else{if("faces"===L.boundTo)for(D=0,O=ga.length;D<O;D++)Ya=L.value[ga[D]],L.array[P]=
|
|
|
+Ya,L.array[P+1]=Ya,L.array[P+2]=Ya,P+=3}else if(2===L.size)if(void 0===L.boundTo||"vertices"===L.boundTo)for(D=0,O=ga.length;D<O;D++)K=lb[ga[D]],S=L.value[K.a],Z=L.value[K.b],Y=L.value[K.c],L.array[P]=S.x,L.array[P+1]=S.y,L.array[P+2]=Z.x,L.array[P+3]=Z.y,L.array[P+4]=Y.x,L.array[P+5]=Y.y,P+=6;else{if("faces"===L.boundTo)for(D=0,O=ga.length;D<O;D++)Y=Z=S=Ya=L.value[ga[D]],L.array[P]=S.x,L.array[P+1]=S.y,L.array[P+2]=Z.x,L.array[P+3]=Z.y,L.array[P+4]=Y.x,L.array[P+5]=Y.y,P+=6}else if(3===L.size){var sa;
|
|
|
+sa="c"===L.type?["r","g","b"]:["x","y","z"];if(void 0===L.boundTo||"vertices"===L.boundTo)for(D=0,O=ga.length;D<O;D++)K=lb[ga[D]],S=L.value[K.a],Z=L.value[K.b],Y=L.value[K.c],L.array[P]=S[sa[0]],L.array[P+1]=S[sa[1]],L.array[P+2]=S[sa[2]],L.array[P+3]=Z[sa[0]],L.array[P+4]=Z[sa[1]],L.array[P+5]=Z[sa[2]],L.array[P+6]=Y[sa[0]],L.array[P+7]=Y[sa[1]],L.array[P+8]=Y[sa[2]],P+=9;else if("faces"===L.boundTo)for(D=0,O=ga.length;D<O;D++)Y=Z=S=Ya=L.value[ga[D]],L.array[P]=S[sa[0]],L.array[P+1]=S[sa[1]],L.array[P+
|
|
|
+2]=S[sa[2]],L.array[P+3]=Z[sa[0]],L.array[P+4]=Z[sa[1]],L.array[P+5]=Z[sa[2]],L.array[P+6]=Y[sa[0]],L.array[P+7]=Y[sa[1]],L.array[P+8]=Y[sa[2]],P+=9;else if("faceVertices"===L.boundTo)for(D=0,O=ga.length;D<O;D++)Ya=L.value[ga[D]],S=Ya[0],Z=Ya[1],Y=Ya[2],L.array[P]=S[sa[0]],L.array[P+1]=S[sa[1]],L.array[P+2]=S[sa[2]],L.array[P+3]=Z[sa[0]],L.array[P+4]=Z[sa[1]],L.array[P+5]=Z[sa[2]],L.array[P+6]=Y[sa[0]],L.array[P+7]=Y[sa[1]],L.array[P+8]=Y[sa[2]],P+=9}else if(4===L.size)if(void 0===L.boundTo||"vertices"===
|
|
|
+L.boundTo)for(D=0,O=ga.length;D<O;D++)K=lb[ga[D]],S=L.value[K.a],Z=L.value[K.b],Y=L.value[K.c],L.array[P]=S.x,L.array[P+1]=S.y,L.array[P+2]=S.z,L.array[P+3]=S.w,L.array[P+4]=Z.x,L.array[P+5]=Z.y,L.array[P+6]=Z.z,L.array[P+7]=Z.w,L.array[P+8]=Y.x,L.array[P+9]=Y.y,L.array[P+10]=Y.z,L.array[P+11]=Y.w,P+=12;else if("faces"===L.boundTo)for(D=0,O=ga.length;D<O;D++)Y=Z=S=Ya=L.value[ga[D]],L.array[P]=S.x,L.array[P+1]=S.y,L.array[P+2]=S.z,L.array[P+3]=S.w,L.array[P+4]=Z.x,L.array[P+5]=Z.y,L.array[P+6]=Z.z,
|
|
|
+L.array[P+7]=Z.w,L.array[P+8]=Y.x,L.array[P+9]=Y.y,L.array[P+10]=Y.z,L.array[P+11]=Y.w,P+=12;else if("faceVertices"===L.boundTo)for(D=0,O=ga.length;D<O;D++)Ya=L.value[ga[D]],S=Ya[0],Z=Ya[1],Y=Ya[2],L.array[P]=S.x,L.array[P+1]=S.y,L.array[P+2]=S.z,L.array[P+3]=S.w,L.array[P+4]=Z.x,L.array[P+5]=Z.y,L.array[P+6]=Z.z,L.array[P+7]=Z.w,L.array[P+8]=Y.x,L.array[P+9]=Y.y,L.array[P+10]=Y.z,L.array[P+11]=Y.w,P+=12;m.bindBuffer(m.ARRAY_BUFFER,L.buffer);m.bufferData(m.ARRAY_BUFFER,L.array,E)}M&&(delete z.__inittedArrays,
|
|
|
+delete z.__colorArray,delete z.__normalArray,delete z.__tangentArray,delete z.__uvArray,delete z.__uv2Array,delete z.__faceArray,delete z.__vertexArray,delete z.__lineArray,delete z.__skinIndexArray,delete z.__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;s.attributes&&w(s)}else if(k instanceof THREE.Line){s=d(k,l);q=s.attributes&&v(s);if(l.verticesNeedUpdate||
|
|
|
+l.colorsNeedUpdate||l.lineDistancesNeedUpdate||q){var cb=l,Qb=m.DYNAMIC_DRAW,Eb=void 0,Fb=void 0,Gb=void 0,Rb=void 0,qa=void 0,Sb=void 0,kc=cb.vertices,lc=cb.colors,mc=cb.lineDistances,Xb=kc.length,Yb=lc.length,Zb=mc.length,Tb=cb.__vertexArray,Ub=cb.__colorArray,nc=cb.__lineDistanceArray,$b=cb.colorsNeedUpdate,ac=cb.lineDistancesNeedUpdate,ec=cb.__webglCustomAttributesList,Vb=void 0,oc=void 0,Ja=void 0,Ab=void 0,Va=void 0,na=void 0;if(cb.verticesNeedUpdate){for(Eb=0;Eb<Xb;Eb++)Rb=kc[Eb],qa=3*Eb,Tb[qa]=
|
|
|
+Rb.x,Tb[qa+1]=Rb.y,Tb[qa+2]=Rb.z;m.bindBuffer(m.ARRAY_BUFFER,cb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Tb,Qb)}if($b){for(Fb=0;Fb<Yb;Fb++)Sb=lc[Fb],qa=3*Fb,Ub[qa]=Sb.r,Ub[qa+1]=Sb.g,Ub[qa+2]=Sb.b;m.bindBuffer(m.ARRAY_BUFFER,cb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Ub,Qb)}if(ac){for(Gb=0;Gb<Zb;Gb++)nc[Gb]=mc[Gb];m.bindBuffer(m.ARRAY_BUFFER,cb.__webglLineDistanceBuffer);m.bufferData(m.ARRAY_BUFFER,nc,Qb)}if(ec)for(Vb=0,oc=ec.length;Vb<oc;Vb++)if(na=ec[Vb],na.needsUpdate&&(void 0===
|
|
|
+na.boundTo||"vertices"===na.boundTo)){qa=0;Ab=na.value.length;if(1===na.size)for(Ja=0;Ja<Ab;Ja++)na.array[Ja]=na.value[Ja];else if(2===na.size)for(Ja=0;Ja<Ab;Ja++)Va=na.value[Ja],na.array[qa]=Va.x,na.array[qa+1]=Va.y,qa+=2;else if(3===na.size)if("c"===na.type)for(Ja=0;Ja<Ab;Ja++)Va=na.value[Ja],na.array[qa]=Va.r,na.array[qa+1]=Va.g,na.array[qa+2]=Va.b,qa+=3;else for(Ja=0;Ja<Ab;Ja++)Va=na.value[Ja],na.array[qa]=Va.x,na.array[qa+1]=Va.y,na.array[qa+2]=Va.z,qa+=3;else if(4===na.size)for(Ja=0;Ja<Ab;Ja++)Va=
|
|
|
+na.value[Ja],na.array[qa]=Va.x,na.array[qa+1]=Va.y,na.array[qa+2]=Va.z,na.array[qa+3]=Va.w,qa+=4;m.bindBuffer(m.ARRAY_BUFFER,na.buffer);m.bufferData(m.ARRAY_BUFFER,na.array,Qb)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;s.attributes&&w(s)}else if(k instanceof THREE.ParticleSystem){s=d(k,l);q=s.attributes&&v(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||k.sortParticles||q){var mb=l,fc=m.DYNAMIC_DRAW,Hb=k,Wa=void 0,nb=void 0,ob=void 0,V=void 0,pb=void 0,sb=void 0,
|
|
|
+Wb=mb.vertices,gc=Wb.length,hc=mb.colors,pc=hc.length,vb=mb.__vertexArray,wb=mb.__colorArray,qb=mb.__sortArray,qc=mb.verticesNeedUpdate,rc=mb.colorsNeedUpdate,rb=mb.__webglCustomAttributesList,fb=void 0,Bb=void 0,aa=void 0,gb=void 0,ia=void 0,U=void 0;if(Hb.sortParticles){zb.copy(ib);zb.multiply(Hb.matrixWorld);for(Wa=0;Wa<gc;Wa++)ob=Wb[Wa],ya.copy(ob),ya.applyProjection(zb),qb[Wa]=[ya.z,Wa];qb.sort(n);for(Wa=0;Wa<gc;Wa++)ob=Wb[qb[Wa][1]],V=3*Wa,vb[V]=ob.x,vb[V+1]=ob.y,vb[V+2]=ob.z;for(nb=0;nb<pc;nb++)V=
|
|
|
+3*nb,sb=hc[qb[nb][1]],wb[V]=sb.r,wb[V+1]=sb.g,wb[V+2]=sb.b;if(rb)for(fb=0,Bb=rb.length;fb<Bb;fb++)if(U=rb[fb],void 0===U.boundTo||"vertices"===U.boundTo)if(V=0,gb=U.value.length,1===U.size)for(aa=0;aa<gb;aa++)pb=qb[aa][1],U.array[aa]=U.value[pb];else if(2===U.size)for(aa=0;aa<gb;aa++)pb=qb[aa][1],ia=U.value[pb],U.array[V]=ia.x,U.array[V+1]=ia.y,V+=2;else if(3===U.size)if("c"===U.type)for(aa=0;aa<gb;aa++)pb=qb[aa][1],ia=U.value[pb],U.array[V]=ia.r,U.array[V+1]=ia.g,U.array[V+2]=ia.b,V+=3;else for(aa=
|
|
|
+0;aa<gb;aa++)pb=qb[aa][1],ia=U.value[pb],U.array[V]=ia.x,U.array[V+1]=ia.y,U.array[V+2]=ia.z,V+=3;else if(4===U.size)for(aa=0;aa<gb;aa++)pb=qb[aa][1],ia=U.value[pb],U.array[V]=ia.x,U.array[V+1]=ia.y,U.array[V+2]=ia.z,U.array[V+3]=ia.w,V+=4}else{if(qc)for(Wa=0;Wa<gc;Wa++)ob=Wb[Wa],V=3*Wa,vb[V]=ob.x,vb[V+1]=ob.y,vb[V+2]=ob.z;if(rc)for(nb=0;nb<pc;nb++)sb=hc[nb],V=3*nb,wb[V]=sb.r,wb[V+1]=sb.g,wb[V+2]=sb.b;if(rb)for(fb=0,Bb=rb.length;fb<Bb;fb++)if(U=rb[fb],U.needsUpdate&&(void 0===U.boundTo||"vertices"===
|
|
|
+U.boundTo))if(gb=U.value.length,V=0,1===U.size)for(aa=0;aa<gb;aa++)U.array[aa]=U.value[aa];else if(2===U.size)for(aa=0;aa<gb;aa++)ia=U.value[aa],U.array[V]=ia.x,U.array[V+1]=ia.y,V+=2;else if(3===U.size)if("c"===U.type)for(aa=0;aa<gb;aa++)ia=U.value[aa],U.array[V]=ia.r,U.array[V+1]=ia.g,U.array[V+2]=ia.b,V+=3;else for(aa=0;aa<gb;aa++)ia=U.value[aa],U.array[V]=ia.x,U.array[V+1]=ia.y,U.array[V+2]=ia.z,V+=3;else if(4===U.size)for(aa=0;aa<gb;aa++)ia=U.value[aa],U.array[V]=ia.x,U.array[V+1]=ia.y,U.array[V+
|
|
|
+2]=ia.z,U.array[V+3]=ia.w,V+=4}if(qc||Hb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,vb,fc);if(rc||Hb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,wb,fc);if(rb)for(fb=0,Bb=rb.length;fb<Bb;fb++)if(U=rb[fb],U.needsUpdate||Hb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,U.buffer),m.bufferData(m.ARRAY_BUFFER,U.array,fc)}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;s.attributes&&w(s)}}};this.initMaterial=function(a,
|
|
|
+b,c,d){var e,f,g,h;a.addEventListener("dispose",Lb);var k,l,p,n,q;a instanceof THREE.MeshDepthMaterial?q="depth":a instanceof THREE.MeshNormalMaterial?q="normal":a instanceof THREE.MeshBasicMaterial?q="basic":a instanceof THREE.MeshLambertMaterial?q="lambert":a instanceof THREE.MeshPhongMaterial?q="phong":a instanceof THREE.LineBasicMaterial?q="basic":a instanceof THREE.LineDashedMaterial?q="dashed":a instanceof THREE.ParticleSystemMaterial&&(q="particle_basic");if(q){var r=THREE.ShaderLib[q];a.uniforms=
|
|
|
+THREE.UniformsUtils.clone(r.uniforms);a.vertexShader=r.vertexShader;a.fragmentShader=r.fragmentShader}var s=e=0,t=0,u=r=0;for(f=b.length;u<f;u++)g=b[u],g.onlyShadow||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&s++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&r++);f=s;g=t;h=r;t=r=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&r++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&r++);n=r;yb&&d&&d.useVertexTexture?
|
|
|
+p=1024:(b=m.getParameter(m.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)")),p=b);a:{t=a.fragmentShader;s=a.vertexShader;r=a.uniforms;b=a.attributes;u=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:p,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,
|
|
|
+shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide};d=a.index0AttributeName;var v,w,x;e=[];q?e.push(q):(e.push(t),e.push(s));for(w in u)e.push(w),e.push(u[w]);for(v in c)e.push(v),e.push(c[v]);q=e.join();v=0;for(w=ba.length;v<w;v++)if(e=ba[v],e.code===q){e.usedTimes++;l=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":c.shadowMapType===
|
|
|
+THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e="#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+X+" float;","precision "+X+" int;",e,xb?"#define VERTEX_TEXTURES":"",J.gammaInput?"#define GAMMA_INPUT":"",J.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.wrapAround?"#define WRAP_AROUND":
|
|
|
+"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:"",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");
|
|
|
+v=["precision "+X+" float;","precision "+X+" 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:"",J.gammaInput?"#define GAMMA_INPUT":"",J.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.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:
|
|
|
-"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=J("vertex",w+s);v=J("fragment",v+t);m.attachShader(x,w);m.attachShader(x,v);void 0!==d?m.bindAttribLocation(x,0,d):m.bindAttribLocation(x,0,"position");m.linkProgram(x);m.getProgramParameter(x,m.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(x,m.VALIDATE_STATUS)+", gl error ["+
|
|
|
+"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=K("vertex",w+s);v=K("fragment",v+t);m.attachShader(x,w);m.attachShader(x,v);void 0!==d?m.bindAttribLocation(x,0,d):m.bindAttribLocation(x,0,"position");m.linkProgram(x);m.getProgramParameter(x,m.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(x,m.VALIDATE_STATUS)+", gl error ["+
|
|
|
m.getError()+"]"),console.error("Program Info Log: "+m.getProgramInfoLog(x)));m.deleteShader(v);m.deleteShader(w);x.uniforms={};x.attributes={};var A;v="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(v.push("boneTexture"),v.push("boneTextureWidth"),v.push("boneTextureHeight")):v.push("boneGlobalMatrices");for(A in r)v.push(A);A=v;v=0;for(w=A.length;v<w;v++)r=A[v],x.uniforms[r]=m.getUniformLocation(x,r);v="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
|
|
|
-for(A=0;A<c.maxMorphTargets;A++)v.push("morphTarget"+A);for(A=0;A<c.maxMorphNormals;A++)v.push("morphNormal"+A);for(l in b)v.push(l);l=v;A=0;for(b=l.length;A<b;A++)v=l[A],x.attributes[v]=m.getAttribLocation(x,v);x.id=pa++;H.push({program:x,code:q,usedTimes:1});O.info.memory.programs=H.length;l=x}a.program=l;A=a.program.attributes;if(a.morphTargets)for(a.numSupportedMorphTargets=0,b="morphTarget",l=0;l<this.maxMorphTargets;l++)x=b+l,0<=A[x]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(a.numSupportedMorphNormals=
|
|
|
+for(A=0;A<c.maxMorphTargets;A++)v.push("morphTarget"+A);for(A=0;A<c.maxMorphNormals;A++)v.push("morphNormal"+A);for(l in b)v.push(l);l=v;A=0;for(b=l.length;A<b;A++)v=l[A],x.attributes[v]=m.getAttribLocation(x,v);x.id=ra++;ba.push({program:x,code:q,usedTimes:1});J.info.memory.programs=ba.length;l=x}a.program=l;A=a.program.attributes;if(a.morphTargets)for(a.numSupportedMorphTargets=0,b="morphTarget",l=0;l<this.maxMorphTargets;l++)x=b+l,0<=A[x]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(a.numSupportedMorphNormals=
|
|
|
0,b="morphNormal",l=0;l<this.maxMorphNormals;l++)x=b+l,0<=A[x]&&a.numSupportedMorphNormals++;a.uniformsList=[];for(k in a.uniforms)a.uniformsList.push([a.uniforms[k],k])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?m.disable(m.CULL_FACE):(b===THREE.FrontFaceDirectionCW?m.frontFace(m.CW):m.frontFace(m.CCW),a===THREE.CullFaceBack?m.cullFace(m.BACK):a===THREE.CullFaceFront?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===
|
|
|
-THREE.DoubleSide;a=a.side===THREE.BackSide;xa!==b&&(b?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),xa=b);ya!==a&&(a?m.frontFace(m.CW):m.frontFace(m.CCW),ya=a)};this.setDepthTest=function(a){Ma!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),Ma=a)};this.setDepthWrite=function(a){Ga!==a&&(m.depthMask(a),Ga=a)};this.setBlending=function(a,b,c,d){a!==Ba&&(a===THREE.NoBlending?m.disable(m.BLEND):a===THREE.AdditiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.SRC_ALPHA,m.ONE)):
|
|
|
-a===THREE.SubtractiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.SRC_COLOR)):a===THREE.CustomBlending?m.enable(m.BLEND):(m.enable(m.BLEND),m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)),Ba=a);if(a===THREE.CustomBlending){if(b!==Ha&&(m.blendEquation(E(b)),Ha=b),c!==Ya||
|
|
|
-d!==ka)m.blendFunc(E(c),E(d)),Ya=c,ka=d}else ka=Ya=Ha=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",tb),a.__webglTexture=m.createTexture(),O.info.memory.textures++);m.activeTexture(m.TEXTURE0+b);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a.flipY);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);m.pixelStorei(m.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=THREE.Math.isPowerOfTwo(c.width)&&
|
|
|
-THREE.Math.isPowerOfTwo(c.height),e=E(a.format),f=E(a.type);y(m.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture)for(h=0,k=g.length;h<k;h++)c=g[h],a.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,c.data):
|
|
|
+THREE.DoubleSide;a=a.side===THREE.BackSide;Aa!==b&&(b?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),Aa=b);Ba!==a&&(a?m.frontFace(m.CW):m.frontFace(m.CCW),Ba=a)};this.setDepthTest=function(a){la!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),la=a)};this.setDepthWrite=function(a){va!==a&&(m.depthMask(a),va=a)};this.setBlending=function(a,b,c,d){a!==Da&&(a===THREE.NoBlending?m.disable(m.BLEND):a===THREE.AdditiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.SRC_ALPHA,m.ONE)):
|
|
|
+a===THREE.SubtractiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.SRC_COLOR)):a===THREE.CustomBlending?m.enable(m.BLEND):(m.enable(m.BLEND),m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)),Da=a);if(a===THREE.CustomBlending){if(b!==Sa&&(m.blendEquation(F(b)),Sa=b),c!==ka||
|
|
|
+d!==Ta)m.blendFunc(F(c),F(d)),ka=c,Ta=d}else Ta=ka=Sa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",tb),a.__webglTexture=m.createTexture(),J.info.memory.textures++);m.activeTexture(m.TEXTURE0+b);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a.flipY);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);m.pixelStorei(m.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=THREE.Math.isPowerOfTwo(c.width)&&
|
|
|
+THREE.Math.isPowerOfTwo(c.height),e=F(a.format),f=F(a.type);y(m.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture)for(h=0,k=g.length;h<k;h++)c=g[h],a.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,c.data):
|
|
|
m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);else if(0<g.length&&d){h=0;for(k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&m.generateMipmap(m.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else m.activeTexture(m.TEXTURE0+b),m.bindTexture(m.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",Kb);a.__webglTexture=m.createTexture();O.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=E(a.format),e=E(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);y(m.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();
|
|
|
+a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Kb);a.__webglTexture=m.createTexture();J.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=F(a.format),e=F(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);y(m.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();
|
|
|
m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);N(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),
|
|
|
y(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):
|
|
|
-N(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Pa,a=Qa,d=Da,e=Oa);b!==La&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),La=b);gb=c;Ea=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);
|
|
|
+N(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Pa,a=Qa,d=wa,e=Ma);b!==Oa&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),Oa=b);ma=c;Ea=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;
|
|
|
-return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.position=new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,k=g.vertices,l=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var q=k.length;b<q;b++){var s=k[b].clone();d&&s.applyMatrix4(d);h.push(s)}b=0;for(q=n.length;b<q;b++){var s=n[b],u,t,p=s.vertexNormals,v=s.vertexColors;u=new THREE.Face3(s.a+
|
|
|
+return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.position=new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,k=g.vertices,l=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var q=k.length;b<q;b++){var s=k[b].clone();d&&s.applyMatrix4(d);h.push(s)}b=0;for(q=n.length;b<q;b++){var s=n[b],u,t,p=s.vertexNormals,v=s.vertexColors;u=new THREE.Face3(s.a+
|
|
|
f,s.b+f,s.c+f);u.normal.copy(s.normal);e&&u.normal.applyMatrix3(e).normalize();h=0;for(k=p.length;h<k;h++)t=p[h].clone(),e&&t.applyMatrix3(e).normalize(),u.vertexNormals.push(t);u.color.copy(s.color);h=0;for(k=v.length;h<k;h++)t=v[h],u.vertexColors.push(t.clone());u.materialIndex=s.materialIndex+c;u.centroid.copy(s.centroid);d&&u.centroid.applyMatrix4(d);l.push(u)}b=0;for(q=g.length;b<q;b++){c=g[b];d=[];h=0;for(k=c.length;h<k;h++)d.push(new THREE.Vector2(c[h].x,c[h].y));a.push(d)}},randomPointInTriangle:function(){var a=
|
|
|
new THREE.Vector3;return function(b,c,d){var e=new THREE.Vector3,f=THREE.Math.random16(),g=THREE.Math.random16();1<f+g&&(f=1-f,g=1-g);var h=1-f-g;e.copy(b);e.multiplyScalar(f);a.copy(c);a.multiplyScalar(g);e.add(a);a.copy(d);a.multiplyScalar(h);e.add(a);return e}}(),randomPointInFace:function(a,b,c){return THREE.GeometryUtils.randomPointInTriangle(b.vertices[a.a],b.vertices[a.b],b.vertices[a.c])},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-
|
|
|
c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,k=0,l=[],n,q,s;for(e=0;e<h;e++)d=f[e],n=g[d.a],q=g[d.b],s=g[d.c],d._area=THREE.GeometryUtils.triangleArea(n,q,s),k+=d._area,l[e]=k;d=[];for(e=0;e<b;e++)g=THREE.Math.random16()*k,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){a.subVectors(d,c);b.subVectors(e,c);a.cross(b);return 0.5*
|
|
@@ -535,7 +535,7 @@ String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this
|
|
|
c+d;n=b[a++]*c;u=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(u,t,k,n);if(g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++){var r=g/h;THREE.Shape.Utils.b2(r,q,u,k);THREE.Shape.Utils.b2(r,s,t,n)}break;case "b":if(k=b[a++]*c+d,n=b[a++]*c,u=b[a++]*c+d,t=b[a++]*-c,p=b[a++]*c+d,v=b[a++]*-c,e.bezierCurveTo(k,n,u,t,p,v),g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++)r=g/h,THREE.Shape.Utils.b3(r,q,u,p,k),THREE.Shape.Utils.b3(r,s,t,v,n)}return{offset:w.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,l,n;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var q=2*e;for(l=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);n=l+1;e<=n&&(n=0);var s;a:{var u=s=void 0,t=void 0,p=void 0,v=void 0,w=void 0,r=void 0,x=void 0,A=
|
|
|
-void 0,u=a[g[k]].x,t=a[g[k]].y,p=a[g[l]].x,v=a[g[l]].y,w=a[g[n]].x,r=a[g[n]].y;if(1E-10>(p-u)*(r-t)-(v-t)*(w-u))s=!1;else{var F=void 0,Q=void 0,I=void 0,B=void 0,z=void 0,M=void 0,G=void 0,J=void 0,y=void 0,N=void 0,y=J=G=A=x=void 0,F=w-p,Q=r-v,I=u-w,B=t-r,z=p-u,M=v-t;for(s=0;s<e;s++)if(x=a[g[s]].x,A=a[g[s]].y,!(x===u&&A===t||x===p&&A===v||x===w&&A===r)&&(G=x-u,J=A-t,y=x-p,N=A-v,x-=w,A-=r,y=F*N-Q*y,G=z*J-M*G,J=I*A-B*x,-1E-10<=y&&-1E-10<=J&&-1E-10<=G)){s=!1;break a}s=!0}}if(s){f.push([a[g[k]],a[g[l]],
|
|
|
+void 0,u=a[g[k]].x,t=a[g[k]].y,p=a[g[l]].x,v=a[g[l]].y,w=a[g[n]].x,r=a[g[n]].y;if(1E-10>(p-u)*(r-t)-(v-t)*(w-u))s=!1;else{var G=void 0,Q=void 0,I=void 0,B=void 0,z=void 0,M=void 0,H=void 0,K=void 0,y=void 0,N=void 0,y=K=H=A=x=void 0,G=w-p,Q=r-v,I=u-w,B=t-r,z=p-u,M=v-t;for(s=0;s<e;s++)if(x=a[g[s]].x,A=a[g[s]].y,!(x===u&&A===t||x===p&&A===v||x===w&&A===r)&&(H=x-u,K=A-t,y=x-p,N=A-v,x-=w,A-=r,y=G*N-Q*y,H=z*K-M*H,K=I*A-B*x,-1E-10<=y&&-1E-10<=K&&-1E-10<=H)){s=!1;break a}s=!0}}if(s){f.push([a[g[k]],a[g[l]],
|
|
|
a[g[n]]]);h.push([g[k],g[l],g[n]]);k=l;for(n=l+1;n<e;k++,n++)g[k]=g[n];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -568,8 +568,8 @@ THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTr
|
|
|
THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,q=a.y-d.y,I=h*k-g*l,B=h*n-g*q;if(1E-10<Math.abs(I)){if(0<I){if(0>B||B>I)return[];k=l*n-k*q;if(0>k||k>I)return[]}else{if(0<B||B<I)return[];k=l*n-k*q;if(0<k||k<I)return[]}if(0==k)return!f||0!=B&&B!=I?[a]:[];if(k==I)return!f||0!=B&&B!=I?[b]:[];if(0==B)return[d];
|
|
|
if(B==I)return[e];f=k/I;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=B||l*n!=k*q)return[];h=0==g&&0==h;k=0==k&&0==l;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,I=d.x,l=e,d=e.x):(b=e,I=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,I=d.y,l=e,d=e.y):(b=e,I=e.y,l=d,d=d.y));return k<=I?a<I?[]:a==I?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
|
|
|
[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,k,l,n={};h=a.concat();for(f in b)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)l=h[f].x+":"+h[f].y,void 0!==n[l]&&console.log("Duplicate point",l),n[l]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;
|
|
|
-f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,q,Q,I,B,z,M,G=[],J,y;for(I in b)l.push(I);for(var N=2*l.length;0<l.length;){N--;if(0>N){console.log("Infinite Loop! Holes left:"+
|
|
|
-l.length+", Probably Hole outside Shape!");break}for(q=0;q<h.length;q++){Q=h[q];n=-1;for(I=0;I<l.length;I++)if(B=l[I],M=Q.x+":"+Q.y+":"+B,void 0===G[M]){k=b[B];for(B=0;B<k.length;B++)if(z=k[B],c(q,B)&&!f(Q,z)&&!g(Q,z)){n=B;l.splice(I,1);B=h.slice(0,q+1);z=h.slice(q);J=k.slice(n);y=k.slice(0,n+1);h=B.concat(J).concat(y).concat(z);break}if(0<=n)break;G[M]=!0}if(0<=n)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k=q[f],h=0;3>h;h++)l=k[h].x+":"+k[h].y,l=
|
|
|
+f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,q,Q,I,B,z,M,H=[],K,y;for(I in b)l.push(I);for(var N=2*l.length;0<l.length;){N--;if(0>N){console.log("Infinite Loop! Holes left:"+
|
|
|
+l.length+", Probably Hole outside Shape!");break}for(q=0;q<h.length;q++){Q=h[q];n=-1;for(I=0;I<l.length;I++)if(B=l[I],M=Q.x+":"+Q.y+":"+B,void 0===H[M]){k=b[B];for(B=0;B<k.length;B++)if(z=k[B],c(q,B)&&!f(Q,z)&&!g(Q,z)){n=B;l.splice(I,1);B=h.slice(0,q+1);z=h.slice(q);K=k.slice(n);y=k.slice(0,n+1);h=B.concat(K).concat(y).concat(z);break}if(0<=n)break;H[M]=!0}if(0<=n)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k=q[f],h=0;3>h;h++)l=k[h].x+":"+k[h].y,l=
|
|
|
n[l],void 0!==l&&(k[h]=l);return q.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,
|
|
|
b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
|
|
|
THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};
|
|
@@ -605,22 +605,22 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspe
|
|
|
THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())};
|
|
|
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.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,r=h.heightSegments,x=e/2,A=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",r=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var Q=w+1,I=r+1,B=e/w,z=f/r,M=new THREE.Vector3;M[v]=0<g?1:-1;for(e=0;e<I;e++)for(f=0;f<Q;f++){var G=new THREE.Vector3;G[a]=(f*B-x)*c;G[b]=(e*z-A)*d;G[v]=g;h.vertices.push(G)}for(e=
|
|
|
-0;e<r;e++)for(f=0;f<w;f++)A=f+Q*e,a=f+Q*(e+1),b=f+1+Q*(e+1),c=f+1+Q*e,d=new THREE.Vector2(f/w,1-e/r),g=new THREE.Vector2(f/w,1-(e+1)/r),v=new THREE.Vector2((f+1)/w,1-(e+1)/r),x=new THREE.Vector2((f+1)/w,1-e/r),A=new THREE.Face3(A+F,a+F,c+F),A.normal.copy(M),A.vertexNormals.push(M.clone(),M.clone(),M.clone()),A.materialIndex=p,h.faces.push(A),h.faceVertexUvs[0].push([d,g,x]),A=new THREE.Face3(a+F,b+F,c+F),A.normal.copy(M),A.vertexNormals.push(M.clone(),M.clone(),M.clone()),A.materialIndex=p,h.faces.push(A),
|
|
|
+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.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,r=h.heightSegments,x=e/2,A=f/2,G=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",r=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var Q=w+1,I=r+1,B=e/w,z=f/r,M=new THREE.Vector3;M[v]=0<g?1:-1;for(e=0;e<I;e++)for(f=0;f<Q;f++){var H=new THREE.Vector3;H[a]=(f*B-x)*c;H[b]=(e*z-A)*d;H[v]=g;h.vertices.push(H)}for(e=
|
|
|
+0;e<r;e++)for(f=0;f<w;f++)A=f+Q*e,a=f+Q*(e+1),b=f+1+Q*(e+1),c=f+1+Q*e,d=new THREE.Vector2(f/w,1-e/r),g=new THREE.Vector2(f/w,1-(e+1)/r),v=new THREE.Vector2((f+1)/w,1-(e+1)/r),x=new THREE.Vector2((f+1)/w,1-e/r),A=new THREE.Face3(A+G,a+G,c+G),A.normal.copy(M),A.vertexNormals.push(M.clone(),M.clone(),M.clone()),A.materialIndex=p,h.faces.push(A),h.faceVertexUvs[0].push([d,g,x]),A=new THREE.Face3(a+G,b+G,c+G),A.normal.copy(M),A.vertexNormals.push(M.clone(),M.clone(),M.clone()),A.materialIndex=p,h.faces.push(A),
|
|
|
h.faceVertexUvs[0].push([g.clone(),v,x.clone()])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,
|
|
|
5);this.computeCentroids();this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);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 g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.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(),g.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=THREE.BoxGeometry;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 g=c/2,h,k,l=[],n=[];for(k=0;k<=e;k++){var q=[],s=[],u=k/e,t=u*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,v=new THREE.Vector3;v.x=t*Math.sin(p*Math.PI*2);v.y=-u*c+g;v.z=t*Math.cos(p*Math.PI*2);this.vertices.push(v);q.push(this.vertices.length-1);s.push(new THREE.Vector2(p,
|
|
|
-1-u))}l.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[l[0][h]].clone(),s=this.vertices[l[0][h+1]].clone()):(q=this.vertices[l[1][h]].clone(),s=this.vertices[l[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),k=0;k<e;k++){var u=l[k][h],t=l[k+1][h],p=l[k+1][h+1],v=l[k][h+1],w=q.clone(),r=q.clone(),x=s.clone(),A=s.clone(),F=n[k][h].clone(),Q=n[k+1][h].clone(),I=n[k+1][h+1].clone(),B=n[k][h+1].clone();this.faces.push(new THREE.Face3(u,
|
|
|
-t,v,[w,r,A]));this.faceVertexUvs[0].push([F,Q,B]);this.faces.push(new THREE.Face3(t,p,v,[r.clone(),x,A.clone()]));this.faceVertexUvs[0].push([Q.clone(),I,B.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)u=l[0][h],t=l[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),F=n[0][h].clone(),Q=n[0][h+1].clone(),I=new THREE.Vector2(Q.x,0),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([F,
|
|
|
-Q,I]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)u=l[k][h+1],t=l[k][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),F=n[k][h+1].clone(),Q=n[k][h].clone(),I=new THREE.Vector2(Q.x,1),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([F,Q,I]);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-u))}l.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[l[0][h]].clone(),s=this.vertices[l[0][h+1]].clone()):(q=this.vertices[l[1][h]].clone(),s=this.vertices[l[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),k=0;k<e;k++){var u=l[k][h],t=l[k+1][h],p=l[k+1][h+1],v=l[k][h+1],w=q.clone(),r=q.clone(),x=s.clone(),A=s.clone(),G=n[k][h].clone(),Q=n[k+1][h].clone(),I=n[k+1][h+1].clone(),B=n[k][h+1].clone();this.faces.push(new THREE.Face3(u,
|
|
|
+t,v,[w,r,A]));this.faceVertexUvs[0].push([G,Q,B]);this.faces.push(new THREE.Face3(t,p,v,[r.clone(),x,A.clone()]));this.faceVertexUvs[0].push([Q.clone(),I,B.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)u=l[0][h],t=l[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),G=n[0][h].clone(),Q=n[0][h+1].clone(),I=new THREE.Vector2(Q.x,0),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([G,
|
|
|
+Q,I]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)u=l[k][h+1],t=l[k][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),G=n[k][h+1].clone(),Q=n[k][h].clone(),I=new THREE.Vector2(Q.x,1),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([G,Q,I]);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.Math.sign,e=1,e=a.x-b.x,f=a.y-b.y,g=c.x-a.x,h=c.y-a.y,k=e*e+f*f;if(1E-10<Math.abs(e*h-f*g)){var l=Math.sqrt(k),d=Math.sqrt(g*g+h*h),k=b.x-f/l;b=b.y+e/l;g=((c.x-h/d-k)*h-(c.y+g/d-b)*g)/(e*h-f*g);c=k+e*g-a.x;a=b+f*g-a.y;e=c*c+a*a;if(2>=e)return new THREE.Vector2(c,a);e=Math.sqrt(e/2)}else a=!1,1E-10<e?1E-10<g&&(a=!0):-1E-10>e?-1E-10>g&&
|
|
|
-(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(R=c.length;0<=--R;){e=R;f=R-1;0>f&&(f=c.length-1);for(var g=0,h=u+2*n,g=0;g<h;g++){var k=ja*g,l=ja*(g+1),p=d+e+k,k=d+f+k,q=d+f+l,l=d+e+l,s=c,t=g,v=h,w=e,y=f,p=p+J,k=k+J,q=q+J,l=l+J;G.faces.push(new THREE.Face3(p,k,l,null,null,r));G.faces.push(new THREE.Face3(k,q,l,null,null,r));p=x.generateSideWallUV(G,a,s,b,p,k,q,l,t,v,w,y);G.faceVertexUvs[0].push([p[0],p[1],
|
|
|
-p[3]]);G.faceVertexUvs[0].push([p[1],p[2],p[3]])}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=J;d+=J;e+=J;G.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?x.generateBottomUV(G,a,b,c,d,e):x.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,s=
|
|
|
-void 0!==b.curveSegments?b.curveSegments:12,u=void 0!==b.steps?b.steps:1,t=b.extrudePath,p,v=!1,w=b.material,r=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,A,F,Q,I;t&&(p=t.getSpacedPoints(u),v=!0,q=!1,A=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,u,!1),F=new THREE.Vector3,Q=new THREE.Vector3,I=new THREE.Vector3);q||(l=k=n=0);var B,z,M,G=this,J=this.vertices.length,t=a.extractPoints(s),s=t.shape,y=t.holes;if(t=!THREE.Shape.Utils.isClockWise(s)){s=
|
|
|
-s.reverse();z=0;for(M=y.length;z<M;z++)B=y[z],THREE.Shape.Utils.isClockWise(B)&&(y[z]=B.reverse());t=!1}var N=THREE.Shape.Utils.triangulateShape(s,y),D=s;z=0;for(M=y.length;z<M;z++)B=y[z],s=s.concat(B);var E,C,L,Y,T,ja=s.length,W,na=N.length,t=[],R=0;L=D.length;E=L-1;for(C=R+1;R<L;R++,E++,C++)E===L&&(E=0),C===L&&(C=0),t[R]=d(D[R],D[E],D[C]);var ea=[],S,O=t.concat();z=0;for(M=y.length;z<M;z++){B=y[z];S=[];R=0;L=B.length;E=L-1;for(C=R+1;R<L;R++,E++,C++)E===L&&(E=0),C===L&&(C=0),S[R]=d(B[R],B[E],B[C]);
|
|
|
-ea.push(S);O=O.concat(S)}for(E=0;E<n;E++){L=E/n;Y=k*(1-L);C=l*Math.sin(L*Math.PI/2);R=0;for(L=D.length;R<L;R++)T=c(D[R],t[R],C),f(T.x,T.y,-Y);z=0;for(M=y.length;z<M;z++)for(B=y[z],S=ea[z],R=0,L=B.length;R<L;R++)T=c(B[R],S[R],C),f(T.x,T.y,-Y)}C=l;for(R=0;R<ja;R++)T=q?c(s[R],O[R],C):s[R],v?(Q.copy(A.normals[0]).multiplyScalar(T.x),F.copy(A.binormals[0]).multiplyScalar(T.y),I.copy(p[0]).add(Q).add(F),f(I.x,I.y,I.z)):f(T.x,T.y,0);for(L=1;L<=u;L++)for(R=0;R<ja;R++)T=q?c(s[R],O[R],C):s[R],v?(Q.copy(A.normals[L]).multiplyScalar(T.x),
|
|
|
-F.copy(A.binormals[L]).multiplyScalar(T.y),I.copy(p[L]).add(Q).add(F),f(I.x,I.y,I.z)):f(T.x,T.y,h/u*L);for(E=n-1;0<=E;E--){L=E/n;Y=k*(1-L);C=l*Math.sin(L*Math.PI/2);R=0;for(L=D.length;R<L;R++)T=c(D[R],t[R],C),f(T.x,T.y,h+Y);z=0;for(M=y.length;z<M;z++)for(B=y[z],S=ea[z],R=0,L=B.length;R<L;R++)T=c(B[R],S[R],C),v?f(T.x,T.y+p[u-1].y,p[u-1].x+Y):f(T.x,T.y,h+Y)}(function(){if(q){var a;a=0*ja;for(R=0;R<na;R++)W=N[R],g(W[2]+a,W[1]+a,W[0]+a,!0);a=u+2*n;a*=ja;for(R=0;R<na;R++)W=N[R],g(W[0]+a,W[1]+a,W[2]+a,
|
|
|
-!1)}else{for(R=0;R<na;R++)W=N[R],g(W[2],W[1],W[0],!0);for(R=0;R<na;R++)W=N[R],g(W[0]+ja*u,W[1]+ja*u,W[2]+ja*u,!1)}})();(function(){var a=0;e(D,a);a+=D.length;z=0;for(M=y.length;z<M;z++)B=y[z],e(B,a),a+=B.length})()};
|
|
|
+(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(D=c.length;0<=--D;){e=D;f=D-1;0>f&&(f=c.length-1);for(var g=0,h=u+2*n,g=0;g<h;g++){var k=ja*g,l=ja*(g+1),p=d+e+k,k=d+f+k,q=d+f+l,l=d+e+l,s=c,t=g,v=h,w=e,y=f,p=p+K,k=k+K,q=q+K,l=l+K;H.faces.push(new THREE.Face3(p,k,l,null,null,r));H.faces.push(new THREE.Face3(k,q,l,null,null,r));p=x.generateSideWallUV(H,a,s,b,p,k,q,l,t,v,w,y);H.faceVertexUvs[0].push([p[0],p[1],
|
|
|
+p[3]]);H.faceVertexUvs[0].push([p[1],p[2],p[3]])}}}function f(a,b,c){H.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=K;d+=K;e+=K;H.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?x.generateBottomUV(H,a,b,c,d,e):x.generateTopUV(H,a,b,c,d,e);H.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,s=
|
|
|
+void 0!==b.curveSegments?b.curveSegments:12,u=void 0!==b.steps?b.steps:1,t=b.extrudePath,p,v=!1,w=b.material,r=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,A,G,Q,I;t&&(p=t.getSpacedPoints(u),v=!0,q=!1,A=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,u,!1),G=new THREE.Vector3,Q=new THREE.Vector3,I=new THREE.Vector3);q||(l=k=n=0);var B,z,M,H=this,K=this.vertices.length,t=a.extractPoints(s),s=t.shape,y=t.holes;if(t=!THREE.Shape.Utils.isClockWise(s)){s=
|
|
|
+s.reverse();z=0;for(M=y.length;z<M;z++)B=y[z],THREE.Shape.Utils.isClockWise(B)&&(y[z]=B.reverse());t=!1}var N=THREE.Shape.Utils.triangulateShape(s,y),E=s;z=0;for(M=y.length;z<M;z++)B=y[z],s=s.concat(B);var F,C,O,X,R,ja=s.length,W,pa=N.length,t=[],D=0;O=E.length;F=O-1;for(C=D+1;D<O;D++,F++,C++)F===O&&(F=0),C===O&&(C=0),t[D]=d(E[D],E[F],E[C]);var da=[],T,J=t.concat();z=0;for(M=y.length;z<M;z++){B=y[z];T=[];D=0;O=B.length;F=O-1;for(C=D+1;D<O;D++,F++,C++)F===O&&(F=0),C===O&&(C=0),T[D]=d(B[D],B[F],B[C]);
|
|
|
+da.push(T);J=J.concat(T)}for(F=0;F<n;F++){O=F/n;X=k*(1-O);C=l*Math.sin(O*Math.PI/2);D=0;for(O=E.length;D<O;D++)R=c(E[D],t[D],C),f(R.x,R.y,-X);z=0;for(M=y.length;z<M;z++)for(B=y[z],T=da[z],D=0,O=B.length;D<O;D++)R=c(B[D],T[D],C),f(R.x,R.y,-X)}C=l;for(D=0;D<ja;D++)R=q?c(s[D],J[D],C):s[D],v?(Q.copy(A.normals[0]).multiplyScalar(R.x),G.copy(A.binormals[0]).multiplyScalar(R.y),I.copy(p[0]).add(Q).add(G),f(I.x,I.y,I.z)):f(R.x,R.y,0);for(O=1;O<=u;O++)for(D=0;D<ja;D++)R=q?c(s[D],J[D],C):s[D],v?(Q.copy(A.normals[O]).multiplyScalar(R.x),
|
|
|
+G.copy(A.binormals[O]).multiplyScalar(R.y),I.copy(p[O]).add(Q).add(G),f(I.x,I.y,I.z)):f(R.x,R.y,h/u*O);for(F=n-1;0<=F;F--){O=F/n;X=k*(1-O);C=l*Math.sin(O*Math.PI/2);D=0;for(O=E.length;D<O;D++)R=c(E[D],t[D],C),f(R.x,R.y,h+X);z=0;for(M=y.length;z<M;z++)for(B=y[z],T=da[z],D=0,O=B.length;D<O;D++)R=c(B[D],T[D],C),v?f(R.x,R.y+p[u-1].y,p[u-1].x+X):f(R.x,R.y,h+X)}(function(){if(q){var a;a=0*ja;for(D=0;D<pa;D++)W=N[D],g(W[2]+a,W[1]+a,W[0]+a,!0);a=u+2*n;a*=ja;for(D=0;D<pa;D++)W=N[D],g(W[0]+a,W[1]+a,W[2]+a,
|
|
|
+!1)}else{for(D=0;D<pa;D++)W=N[D],g(W[2],W[1],W[0],!0);for(D=0;D<pa;D++)W=N[D],g(W[0]+ja*u,W[1]+ja*u,W[2]+ja*u,!1)}})();(function(){var a=0;e(E,a);a+=E.length;z=0;for(M=y.length;z<M;z++)B=y[z],e(B,a),a+=B.length})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h,k,l,n,q){b=a.vertices[e].x;c=a.vertices[e].y;e=a.vertices[e].z;d=a.vertices[f].x;k=a.vertices[f].y;f=a.vertices[f].z;l=a.vertices[g].x;
|
|
|
n=a.vertices[g].y;g=a.vertices[g].z;q=a.vertices[h].x;var s=a.vertices[h].y;a=a.vertices[h].z;return 0.01>Math.abs(c-k)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(q,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(k,1-f),new THREE.Vector2(n,1-g),new THREE.Vector2(s,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};
|
|
@@ -685,29 +685,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);k=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,k);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,l);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)?(n=!1,q=a(THREE.ShaderFlares.lensFlare,d)):(n=!0,q=a(THREE.ShaderFlares.lensFlareVertexTexture,d));s={};u={};s.vertex=b.getAttribLocation(q,"position");s.uv=b.getAttribLocation(q,"uv");u.renderType=b.getUniformLocation(q,"renderType");u.map=b.getUniformLocation(q,"map");u.occlusionMap=b.getUniformLocation(q,"occlusionMap");u.opacity=
|
|
|
-b.getUniformLocation(q,"opacity");u.color=b.getUniformLocation(q,"color");u.scale=b.getUniformLocation(q,"scale");u.rotation=b.getUniformLocation(q,"rotation");u.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var r=a.length;if(r){var x=new THREE.Vector3,A=f/e,F=0.5*e,Q=0.5*f,I=16/f,B=new THREE.Vector2(I*A,I),z=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),G=u,I=s;b.useProgram(q);b.enableVertexAttribArray(s.vertex);b.enableVertexAttribArray(s.uv);
|
|
|
-b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var J,y,N,D,E;for(J=0;J<r;J++)if(I=16/f,B.set(I*A,I),D=a[J],x.set(D.matrixWorld.elements[12],D.matrixWorld.elements[13],D.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),z.copy(x),M.x=z.x*F+F,
|
|
|
-M.y=z.y*Q+Q,n||0<M.x&&M.x<e&&0<M.y&&M.y<f)for(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,k),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x-8,M.y-8,16,16,0),b.uniform1i(G.renderType,0),b.uniform2f(G.scale,B.x,B.y),b.uniform3f(G.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,l),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x-8,M.y-8,16,16,0),b.uniform1i(G.renderType,1),b.disable(b.DEPTH_TEST),
|
|
|
-b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,k),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),D.positionScreen.copy(z),D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares(),b.uniform1i(G.renderType,2),b.enable(b.BLEND),y=0,N=D.lensFlares.length;y<N;y++)E=D.lensFlares[y],0.001<E.opacity&&0.001<E.scale&&(z.x=E.x,z.y=E.y,z.z=E.z,I=E.size*E.scale/f,B.x=I*A,B.y=I,b.uniform3f(G.screenPosition,z.x,z.y,z.z),b.uniform2f(G.scale,B.x,B.y),b.uniform1f(G.rotation,E.rotation),b.uniform1f(G.opacity,
|
|
|
-E.opacity),b.uniform3f(G.color,E.color.r,E.color.g,E.color.b),c.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),c.setTexture(E.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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(q,s){var u,t,p,v,w,r,x,A,F,Q=[];v=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);u=0;for(t=q.__lights.length;u<t;u++)if(p=q.__lights[u],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var I;if(p.shadowCascadeArray[w])I=p.shadowCascadeArray[w];else{F=p;x=w;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=F.shadowCameraNear;I.shadowCameraFar=F.shadowCameraFar;I.shadowCameraLeft=F.shadowCameraLeft;I.shadowCameraRight=F.shadowCameraRight;
|
|
|
-I.shadowCameraBottom=F.shadowCameraBottom;I.shadowCameraTop=F.shadowCameraTop;I.shadowCameraVisible=F.shadowCameraVisible;I.shadowDarkness=F.shadowDarkness;I.shadowBias=F.shadowCascadeBias[x];I.shadowMapWidth=F.shadowCascadeWidth[x];I.shadowMapHeight=F.shadowCascadeHeight[x];I.pointsWorld=[];I.pointsFrustum=[];A=I.pointsWorld;r=I.pointsFrustum;for(var B=0;8>B;B++)A[B]=new THREE.Vector3,r[B]=new THREE.Vector3;A=F.shadowCascadeNearZ[x];F=F.shadowCascadeFarZ[x];r[0].set(-1,-1,A);r[1].set(1,-1,A);r[2].set(-1,
|
|
|
-1,A);r[3].set(1,1,A);r[4].set(-1,-1,F);r[5].set(1,-1,F);r[6].set(-1,1,F);r[7].set(1,1,F);I.originalCamera=s;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(I);r.add(I.target);s.add(r);p.shadowCascadeArray[w]=I;console.log("Created virtualLight",I)}x=p;A=w;F=x.shadowCascadeArray[A];F.position.copy(x.position);F.target.position.copy(x.target.position);F.lookAt(F.target);F.shadowCameraVisible=x.shadowCameraVisible;F.shadowDarkness=x.shadowDarkness;F.shadowBias=x.shadowCascadeBias[A];r=x.shadowCascadeNearZ[A];
|
|
|
-x=x.shadowCascadeFarZ[A];F=F.pointsFrustum;F[0].z=r;F[1].z=r;F[2].z=r;F[3].z=r;F[4].z=x;F[5].z=x;F[6].z=x;F[7].z=x;Q[v]=I;v++}else Q[v]=p,v++;u=0;for(t=Q.length;u<t;u++){p=Q[u];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+b.getUniformLocation(q,"opacity");u.color=b.getUniformLocation(q,"color");u.scale=b.getUniformLocation(q,"scale");u.rotation=b.getUniformLocation(q,"rotation");u.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var r=a.length;if(r){var x=new THREE.Vector3,A=f/e,G=0.5*e,Q=0.5*f,I=16/f,B=new THREE.Vector2(I*A,I),z=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),H=u,I=s;b.useProgram(q);b.enableVertexAttribArray(s.vertex);b.enableVertexAttribArray(s.uv);
|
|
|
+b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var K,y,N,E,F;for(K=0;K<r;K++)if(I=16/f,B.set(I*A,I),E=a[K],x.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),z.copy(x),M.x=z.x*G+G,
|
|
|
+M.y=z.y*Q+Q,n||0<M.x&&M.x<e&&0<M.y&&M.y<f)for(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,k),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x-8,M.y-8,16,16,0),b.uniform1i(H.renderType,0),b.uniform2f(H.scale,B.x,B.y),b.uniform3f(H.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,l),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x-8,M.y-8,16,16,0),b.uniform1i(H.renderType,1),b.disable(b.DEPTH_TEST),
|
|
|
+b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,k),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),E.positionScreen.copy(z),E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares(),b.uniform1i(H.renderType,2),b.enable(b.BLEND),y=0,N=E.lensFlares.length;y<N;y++)F=E.lensFlares[y],0.001<F.opacity&&0.001<F.scale&&(z.x=F.x,z.y=F.y,z.z=F.z,I=F.size*F.scale/f,B.x=I*A,B.y=I,b.uniform3f(H.screenPosition,z.x,z.y,z.z),b.uniform2f(H.scale,B.x,B.y),b.uniform1f(H.rotation,F.rotation),b.uniform1f(H.opacity,
|
|
|
+F.opacity),b.uniform3f(H.color,F.color.r,F.color.g,F.color.b),c.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),c.setTexture(F.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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(q,s){var u,t,p,v,w,r,x,A,G,Q=[];v=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);u=0;for(t=q.__lights.length;u<t;u++)if(p=q.__lights[u],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var I;if(p.shadowCascadeArray[w])I=p.shadowCascadeArray[w];else{G=p;x=w;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=G.shadowCameraNear;I.shadowCameraFar=G.shadowCameraFar;I.shadowCameraLeft=G.shadowCameraLeft;I.shadowCameraRight=G.shadowCameraRight;
|
|
|
+I.shadowCameraBottom=G.shadowCameraBottom;I.shadowCameraTop=G.shadowCameraTop;I.shadowCameraVisible=G.shadowCameraVisible;I.shadowDarkness=G.shadowDarkness;I.shadowBias=G.shadowCascadeBias[x];I.shadowMapWidth=G.shadowCascadeWidth[x];I.shadowMapHeight=G.shadowCascadeHeight[x];I.pointsWorld=[];I.pointsFrustum=[];A=I.pointsWorld;r=I.pointsFrustum;for(var B=0;8>B;B++)A[B]=new THREE.Vector3,r[B]=new THREE.Vector3;A=G.shadowCascadeNearZ[x];G=G.shadowCascadeFarZ[x];r[0].set(-1,-1,A);r[1].set(1,-1,A);r[2].set(-1,
|
|
|
+1,A);r[3].set(1,1,A);r[4].set(-1,-1,G);r[5].set(1,-1,G);r[6].set(-1,1,G);r[7].set(1,1,G);I.originalCamera=s;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(I);r.add(I.target);s.add(r);p.shadowCascadeArray[w]=I;console.log("Created virtualLight",I)}x=p;A=w;G=x.shadowCascadeArray[A];G.position.copy(x.position);G.target.position.copy(x.target.position);G.lookAt(G.target);G.shadowCameraVisible=x.shadowCameraVisible;G.shadowDarkness=x.shadowDarkness;G.shadowBias=x.shadowCascadeBias[A];r=x.shadowCascadeNearZ[A];
|
|
|
+x=x.shadowCascadeFarZ[A];G=G.pointsFrustum;G[0].z=r;G[1].z=r;G[2].z=r;G[3].z=r;G[4].z=x;G[5].z=x;G[6].z=x;G[7].z=x;Q[v]=I;v++}else Q[v]=p,v++;u=0;for(t=Q.length;u<t;u++){p=Q[u];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}q.add(p.shadowCamera);!0===q.autoUpdate&&q.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&I.originalCamera==s){w=s;v=p.shadowCamera;r=p.pointsFrustum;F=p.pointsWorld;k.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)A=F[x],A.copy(r[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(A,w),A.applyMatrix4(v.matrixWorldInverse),A.x<k.x&&(k.x=A.x),A.x>l.x&&(l.x=A.x),A.y<k.y&&(k.y=A.y),A.y>l.y&&(l.y=A.y),A.z<k.z&&(k.z=A.z),A.z>l.z&&
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&I.originalCamera==s){w=s;v=p.shadowCamera;r=p.pointsFrustum;G=p.pointsWorld;k.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)A=G[x],A.copy(r[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(A,w),A.applyMatrix4(v.matrixWorldInverse),A.x<k.x&&(k.x=A.x),A.x>l.x&&(l.x=A.x),A.y<k.y&&(k.y=A.y),A.y>l.y&&(l.y=A.y),A.z<k.z&&(k.z=A.z),A.z>l.z&&
|
|
|
(l.z=A.z);v.left=k.x;v.right=l.x;v.top=l.y;v.bottom=k.y;v.updateProjectionMatrix()}v=p.shadowMap;r=p.shadowMatrix;w=p.shadowCamera;w.position.setFromMatrixPosition(p.matrixWorld);n.setFromMatrixPosition(p.target.matrixWorld);w.lookAt(n);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiply(w.projectionMatrix);r.multiply(w.matrixWorldInverse);
|
|
|
-h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();F=q.__webglObjects;p=0;for(v=F.length;p<v;p++)x=F[p],r=x.object,x.render=!1,!r.visible||!r.castShadow||(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)&&r.frustumCulled&&!g.intersectsObject(r)||(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,r.matrixWorld),x.render=!0);p=0;for(v=F.length;p<v;p++)x=F[p],x.render&&(r=x.object,x=x.buffer,B=r.material instanceof THREE.MeshFaceMaterial?
|
|
|
-r.material.materials[0]:r.material,A=void 0!==r.geometry.morphTargets&&0<r.geometry.morphTargets.length&&B.morphTargets,B=r instanceof THREE.SkinnedMesh&&B.skinning,A=r.customDepthMaterial?r.customDepthMaterial:B?A?f:e:A?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(w,q.__lights,null,A,x,r):b.renderBuffer(w,q.__lights,null,A,x,r));F=q.__webglObjectsImmediate;p=0;for(v=F.length;p<v;p++)x=F[p],r=x.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,
|
|
|
-r.matrixWorld),b.renderImmediateObject(w,q.__lights,null,c,r))}u=b.getClearColor();t=b.getClearAlpha();a.clearColor(u.r,u.g,u.b,t);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,g,h,k,l,n,q,s,u,t,p,v;function w(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var r,x,A,F,Q,I,B,z;this.init=function(w){r=w.context;x=w;F=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]);Q=new Uint16Array([0,1,2,0,2,3]);I=r.createBuffer();B=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,I);r.bufferData(r.ARRAY_BUFFER,F,r.STATIC_DRAW);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,B);r.bufferData(r.ELEMENT_ARRAY_BUFFER,Q,r.STATIC_DRAW);w=r.createProgram();
|
|
|
-var G=r.createShader(r.VERTEX_SHADER),J=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(G,["precision "+x.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"));
|
|
|
-r.shaderSource(J,["precision "+x.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"));
|
|
|
-r.compileShader(G);r.compileShader(J);r.attachShader(w,G);r.attachShader(w,J);r.linkProgram(w);z=w;p=r.getAttribLocation(z,"position");v=r.getAttribLocation(z,"uv");a=r.getUniformLocation(z,"uvOffset");b=r.getUniformLocation(z,"uvScale");c=r.getUniformLocation(z,"rotation");d=r.getUniformLocation(z,"scale");e=r.getUniformLocation(z,"color");f=r.getUniformLocation(z,"map");g=r.getUniformLocation(z,"opacity");h=r.getUniformLocation(z,"modelViewMatrix");k=r.getUniformLocation(z,"projectionMatrix");l=
|
|
|
-r.getUniformLocation(z,"fogType");n=r.getUniformLocation(z,"fogDensity");q=r.getUniformLocation(z,"fogNear");s=r.getUniformLocation(z,"fogFar");u=r.getUniformLocation(z,"fogColor");t=r.getUniformLocation(z,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;G=w.getContext("2d");G.fillStyle="#ffffff";G.fillRect(0,0,w.width,w.height);A=new THREE.Texture(w);A.needsUpdate=!0};this.render=function(F,G,J,y){J=F.__webglSprites;if(y=J.length){r.useProgram(z);r.enableVertexAttribArray(p);
|
|
|
-r.enableVertexAttribArray(v);r.disable(r.CULL_FACE);r.enable(r.BLEND);r.bindBuffer(r.ARRAY_BUFFER,I);r.vertexAttribPointer(p,2,r.FLOAT,!1,16,0);r.vertexAttribPointer(v,2,r.FLOAT,!1,16,8);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,B);r.uniformMatrix4fv(k,!1,G.projectionMatrix.elements);r.activeTexture(r.TEXTURE0);r.uniform1i(f,0);var N=0,D=0,E=F.fog;E?(r.uniform3f(u,E.color.r,E.color.g,E.color.b),E instanceof THREE.Fog?(r.uniform1f(q,E.near),r.uniform1f(s,E.far),r.uniform1i(l,1),D=N=1):E instanceof THREE.FogExp2&&
|
|
|
-(r.uniform1f(n,E.density),r.uniform1i(l,2),D=N=2)):(r.uniform1i(l,0),D=N=0);for(var C,L=[],E=0;E<y;E++)C=J[E],!1!==C.visible&&(C._modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,C.matrixWorld),C.z=-C._modelViewMatrix.elements[14]);J.sort(w);for(E=0;E<y;E++)C=J[E],!1!==C.visible&&(G=C.material,r.uniform1f(t,G.alphaTest),r.uniformMatrix4fv(h,!1,C._modelViewMatrix.elements),L[0]=C.scale.x,L[1]=C.scale.y,C=F.fog&&G.fog?D:0,N!==C&&(r.uniform1i(l,C),N=C),null!==G.map?(r.uniform2f(a,G.map.offset.x,
|
|
|
-G.map.offset.y),r.uniform2f(b,G.map.repeat.x,G.map.repeat.y)):(r.uniform2f(a,0,0),r.uniform2f(b,1,1)),r.uniform1f(g,G.opacity),r.uniform3f(e,G.color.r,G.color.g,G.color.b),r.uniform1f(c,G.rotation),r.uniform2fv(d,L),x.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst),x.setDepthTest(G.depthTest),x.setDepthWrite(G.depthWrite),G.map&&G.map.image&&G.map.image.width?x.setTexture(G.map,0):x.setTexture(A,0),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0));r.enable(r.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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,
|
|
|
+h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();G=q.__webglObjects;p=0;for(v=G.length;p<v;p++)x=G[p],r=x.object,x.render=!1,!r.visible||!r.castShadow||(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)&&r.frustumCulled&&!g.intersectsObject(r)||(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,r.matrixWorld),x.render=!0);p=0;for(v=G.length;p<v;p++)x=G[p],x.render&&(r=x.object,x=x.buffer,B=r.material instanceof THREE.MeshFaceMaterial?
|
|
|
+r.material.materials[0]:r.material,A=void 0!==r.geometry.morphTargets&&0<r.geometry.morphTargets.length&&B.morphTargets,B=r instanceof THREE.SkinnedMesh&&B.skinning,A=r.customDepthMaterial?r.customDepthMaterial:B?A?f:e:A?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(w,q.__lights,null,A,x,r):b.renderBuffer(w,q.__lights,null,A,x,r));G=q.__webglObjectsImmediate;p=0;for(v=G.length;p<v;p++)x=G[p],r=x.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,
|
|
|
+r.matrixWorld),b.renderImmediateObject(w,q.__lights,null,c,r))}u=b.getClearColor();t=b.getClearAlpha();a.clearColor(u.r,u.g,u.b,t);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,g,h,k,l,n,q,s,u,t,p,v;function w(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var r,x,A,G,Q,I,B,z;this.init=function(w){r=w.context;x=w;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]);Q=new Uint16Array([0,1,2,0,2,3]);I=r.createBuffer();B=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,I);r.bufferData(r.ARRAY_BUFFER,G,r.STATIC_DRAW);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,B);r.bufferData(r.ELEMENT_ARRAY_BUFFER,Q,r.STATIC_DRAW);w=r.createProgram();
|
|
|
+var H=r.createShader(r.VERTEX_SHADER),K=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(H,["precision "+x.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"));
|
|
|
+r.shaderSource(K,["precision "+x.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"));
|
|
|
+r.compileShader(H);r.compileShader(K);r.attachShader(w,H);r.attachShader(w,K);r.linkProgram(w);z=w;p=r.getAttribLocation(z,"position");v=r.getAttribLocation(z,"uv");a=r.getUniformLocation(z,"uvOffset");b=r.getUniformLocation(z,"uvScale");c=r.getUniformLocation(z,"rotation");d=r.getUniformLocation(z,"scale");e=r.getUniformLocation(z,"color");f=r.getUniformLocation(z,"map");g=r.getUniformLocation(z,"opacity");h=r.getUniformLocation(z,"modelViewMatrix");k=r.getUniformLocation(z,"projectionMatrix");l=
|
|
|
+r.getUniformLocation(z,"fogType");n=r.getUniformLocation(z,"fogDensity");q=r.getUniformLocation(z,"fogNear");s=r.getUniformLocation(z,"fogFar");u=r.getUniformLocation(z,"fogColor");t=r.getUniformLocation(z,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;H=w.getContext("2d");H.fillStyle="#ffffff";H.fillRect(0,0,w.width,w.height);A=new THREE.Texture(w);A.needsUpdate=!0};this.render=function(G,H,K,y){K=G.__webglSprites;if(y=K.length){r.useProgram(z);r.enableVertexAttribArray(p);
|
|
|
+r.enableVertexAttribArray(v);r.disable(r.CULL_FACE);r.enable(r.BLEND);r.bindBuffer(r.ARRAY_BUFFER,I);r.vertexAttribPointer(p,2,r.FLOAT,!1,16,0);r.vertexAttribPointer(v,2,r.FLOAT,!1,16,8);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,B);r.uniformMatrix4fv(k,!1,H.projectionMatrix.elements);r.activeTexture(r.TEXTURE0);r.uniform1i(f,0);var N=0,E=0,F=G.fog;F?(r.uniform3f(u,F.color.r,F.color.g,F.color.b),F instanceof THREE.Fog?(r.uniform1f(q,F.near),r.uniform1f(s,F.far),r.uniform1i(l,1),E=N=1):F instanceof THREE.FogExp2&&
|
|
|
+(r.uniform1f(n,F.density),r.uniform1i(l,2),E=N=2)):(r.uniform1i(l,0),E=N=0);for(var C,O=[],F=0;F<y;F++)C=K[F],!1!==C.visible&&(C._modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,C.matrixWorld),C.z=-C._modelViewMatrix.elements[14]);K.sort(w);for(F=0;F<y;F++)C=K[F],!1!==C.visible&&(H=C.material,r.uniform1f(t,H.alphaTest),r.uniformMatrix4fv(h,!1,C._modelViewMatrix.elements),O[0]=C.scale.x,O[1]=C.scale.y,C=G.fog&&H.fog?E:0,N!==C&&(r.uniform1i(l,C),N=C),null!==H.map?(r.uniform2f(a,H.map.offset.x,
|
|
|
+H.map.offset.y),r.uniform2f(b,H.map.repeat.x,H.map.repeat.y)):(r.uniform2f(a,0,0),r.uniform2f(b,1,1)),r.uniform1f(g,H.opacity),r.uniform3f(e,H.color.r,H.color.g,H.color.b),r.uniform1f(c,H.rotation),r.uniform2fv(d,O),x.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),x.setDepthTest(H.depthTest),x.setDepthWrite(H.depthWrite),H.map&&H.map.image&&H.map.image.width?x.setTexture(H.map,0):x.setTexture(A,0),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0));r.enable(r.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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(k,l){var n,q,s,u,t,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===k.autoUpdate&&k.updateMatrixWorld();l.matrixWorldInverse.getInverse(l.matrixWorld);h.multiplyMatrices(l.projectionMatrix,
|
|
|
l.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=k.__webglObjects;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,s.render=!1,!t.visible||(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)&&t.frustumCulled&&!g.intersectsObject(t)||(t._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,t.matrixWorld),s.render=!0);var v;n=0;for(q=p.length;n<q;n++)s=p[n],s.render&&(t=s.object,s=s.buffer,t instanceof THREE.ParticleSystem&&!t.customDepthMaterial||((v=
|
|
|
t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),u=0<t.geometry.morphTargets.length&&v.morphTargets,v=t instanceof THREE.SkinnedMesh&&v.skinning,u=t.customDepthMaterial?t.customDepthMaterial:v?u?f:e:u?d:c,s instanceof THREE.BufferGeometry?b.renderBufferDirect(l,k.__lights,null,u,s,t):b.renderBuffer(l,k.__lights,null,u,s,t)));p=k.__webglObjectsImmediate;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,
|